2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
34 --------- ---------- ----------------------------------------------
37 #include <linux/sched.h>
38 #include "../rt_config.h"
45 INT
Show_WirelessMode_Proc(
49 INT
Show_TxBurst_Proc(
53 INT
Show_TxPreamble_Proc(
57 INT
Show_TxPower_Proc(
61 INT
Show_Channel_Proc(
65 INT
Show_BGProtection_Proc(
69 INT
Show_RTSThreshold_Proc(
73 INT
Show_FragThreshold_Proc(
77 #ifdef DOT11_N_SUPPORT
90 INT
Show_HtOpMode_Proc(
94 INT
Show_HtExtcha_Proc(
98 INT
Show_HtMpduDensity_Proc(
102 INT
Show_HtBaWinSize_Proc(
103 IN PRTMP_ADAPTER pAd
,
107 IN PRTMP_ADAPTER pAd
,
110 INT
Show_HtAmsdu_Proc(
111 IN PRTMP_ADAPTER pAd
,
114 INT
Show_HtAutoBa_Proc(
115 IN PRTMP_ADAPTER pAd
,
117 #endif // DOT11_N_SUPPORT //
119 INT
Show_CountryRegion_Proc(
120 IN PRTMP_ADAPTER pAd
,
123 INT
Show_CountryRegionABand_Proc(
124 IN PRTMP_ADAPTER pAd
,
127 INT
Show_CountryCode_Proc(
128 IN PRTMP_ADAPTER pAd
,
131 #ifdef AGGREGATION_SUPPORT
132 INT
Show_PktAggregate_Proc(
133 IN PRTMP_ADAPTER pAd
,
135 #endif // AGGREGATION_SUPPORT //
138 INT
Show_WmmCapable_Proc(
139 IN PRTMP_ADAPTER pAd
,
141 #endif // WMM_SUPPORT //
143 INT
Show_IEEE80211H_Proc(
144 IN PRTMP_ADAPTER pAd
,
147 #ifdef CONFIG_STA_SUPPORT
148 INT
Show_NetworkType_Proc(
149 IN PRTMP_ADAPTER pAd
,
152 #endif // CONFIG_STA_SUPPORT //
154 INT
Show_AuthMode_Proc(
155 IN PRTMP_ADAPTER pAd
,
158 INT
Show_EncrypType_Proc(
159 IN PRTMP_ADAPTER pAd
,
162 INT
Show_DefaultKeyID_Proc(
163 IN PRTMP_ADAPTER pAd
,
167 IN PRTMP_ADAPTER pAd
,
171 IN PRTMP_ADAPTER pAd
,
175 IN PRTMP_ADAPTER pAd
,
179 IN PRTMP_ADAPTER pAd
,
182 INT
Show_WPAPSK_Proc(
183 IN PRTMP_ADAPTER pAd
,
188 INT (*show_proc
)(PRTMP_ADAPTER pAdapter
, PSTRING arg
);
189 } *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
[] = {
190 {"SSID", Show_SSID_Proc
},
191 {"WirelessMode", Show_WirelessMode_Proc
},
192 {"TxBurst", Show_TxBurst_Proc
},
193 {"TxPreamble", Show_TxPreamble_Proc
},
194 {"TxPower", Show_TxPower_Proc
},
195 {"Channel", Show_Channel_Proc
},
196 {"BGProtection", Show_BGProtection_Proc
},
197 {"RTSThreshold", Show_RTSThreshold_Proc
},
198 {"FragThreshold", Show_FragThreshold_Proc
},
199 #ifdef DOT11_N_SUPPORT
200 {"HtBw", Show_HtBw_Proc
},
201 {"HtMcs", Show_HtMcs_Proc
},
202 {"HtGi", Show_HtGi_Proc
},
203 {"HtOpMode", Show_HtOpMode_Proc
},
204 {"HtExtcha", Show_HtExtcha_Proc
},
205 {"HtMpduDensity", Show_HtMpduDensity_Proc
},
206 {"HtBaWinSize", Show_HtBaWinSize_Proc
},
207 {"HtRdg", Show_HtRdg_Proc
},
208 {"HtAmsdu", Show_HtAmsdu_Proc
},
209 {"HtAutoBa", Show_HtAutoBa_Proc
},
210 #endif // DOT11_N_SUPPORT //
211 {"CountryRegion", Show_CountryRegion_Proc
},
212 {"CountryRegionABand", Show_CountryRegionABand_Proc
},
213 {"CountryCode", Show_CountryCode_Proc
},
214 #ifdef AGGREGATION_SUPPORT
215 {"PktAggregate", Show_PktAggregate_Proc
},
219 {"WmmCapable", Show_WmmCapable_Proc
},
221 {"IEEE80211H", Show_IEEE80211H_Proc
},
222 #ifdef CONFIG_STA_SUPPORT
223 {"NetworkType", Show_NetworkType_Proc
},
224 #endif // CONFIG_STA_SUPPORT //
225 {"AuthMode", Show_AuthMode_Proc
},
226 {"EncrypType", Show_EncrypType_Proc
},
227 {"DefaultKeyID", Show_DefaultKeyID_Proc
},
228 {"Key1", Show_Key1_Proc
},
229 {"Key2", Show_Key2_Proc
},
230 {"Key3", Show_Key3_Proc
},
231 {"Key4", Show_Key4_Proc
},
232 {"WPAPSK", Show_WPAPSK_Proc
},
237 ==========================================================================
242 ==========================================================================
244 INT
Set_DriverVersion_Proc(
245 IN PRTMP_ADAPTER pAd
,
249 #ifdef CONFIG_STA_SUPPORT
250 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
251 DBGPRINT(RT_DEBUG_TRACE
, ("Driver version-%s\n", STA_DRIVER_VERSION
));
252 #endif // CONFIG_STA_SUPPORT //
259 ==========================================================================
262 This command will not work, if the field of CountryRegion in eeprom is programmed.
264 TRUE if all parameters are OK, FALSE otherwise
265 ==========================================================================
267 INT
Set_CountryRegion_Proc(
268 IN PRTMP_ADAPTER pAd
,
273 #ifdef EXT_BUILD_CHANNEL_LIST
275 #endif // EXT_BUILD_CHANNEL_LIST //
277 retval
= RT_CfgSetCountryRegion(pAd
, arg
, BAND_24G
);
281 // if set country region, driver needs to be reset
282 BuildChannelList(pAd
);
284 DBGPRINT(RT_DEBUG_TRACE
, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd
->CommonCfg
.CountryRegion
));
291 ==========================================================================
293 Set Country Region for A band.
294 This command will not work, if the field of CountryRegion in eeprom is programmed.
296 TRUE if all parameters are OK, FALSE otherwise
297 ==========================================================================
299 INT
Set_CountryRegionABand_Proc(
300 IN PRTMP_ADAPTER pAd
,
305 #ifdef EXT_BUILD_CHANNEL_LIST
307 #endif // EXT_BUILD_CHANNEL_LIST //
309 retval
= RT_CfgSetCountryRegion(pAd
, arg
, BAND_5G
);
313 // if set country region, driver needs to be reset
314 BuildChannelList(pAd
);
316 DBGPRINT(RT_DEBUG_TRACE
, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd
->CommonCfg
.CountryRegionForABand
));
323 ==========================================================================
327 TRUE if all parameters are OK, FALSE otherwise
328 ==========================================================================
330 INT
Set_WirelessMode_Proc(
331 IN PRTMP_ADAPTER pAd
,
336 success
= RT_CfgSetWirelessMode(pAd
, arg
);
340 #ifdef CONFIG_STA_SUPPORT
341 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
343 LONG WirelessMode
= pAd
->CommonCfg
.PhyMode
;
345 RTMPSetPhyMode(pAd
, WirelessMode
);
346 #ifdef DOT11_N_SUPPORT
347 if (WirelessMode
>= PHY_11ABGN_MIXED
)
349 pAd
->CommonCfg
.BACapability
.field
.AutoBA
= TRUE
;
350 pAd
->CommonCfg
.REGBACapability
.field
.AutoBA
= TRUE
;
354 pAd
->CommonCfg
.BACapability
.field
.AutoBA
= FALSE
;
355 pAd
->CommonCfg
.REGBACapability
.field
.AutoBA
= FALSE
;
357 #endif // DOT11_N_SUPPORT //
358 // Set AdhocMode rates
359 if (pAd
->StaCfg
.BssType
== BSS_ADHOC
)
361 MlmeUpdateTxRates(pAd
, FALSE
, 0);
362 MakeIbssBeacon(pAd
); // re-build BEACON frame
363 AsicEnableIbssSync(pAd
); // copy to on-chip memory
366 #endif // CONFIG_STA_SUPPORT //
368 // it is needed to set SSID to take effect
369 #ifdef DOT11_N_SUPPORT
371 #endif // DOT11_N_SUPPORT //
372 DBGPRINT(RT_DEBUG_TRACE
, ("Set_WirelessMode_Proc::(=%d)\n", pAd
->CommonCfg
.PhyMode
));
376 DBGPRINT(RT_DEBUG_ERROR
, ("Set_WirelessMode_Proc::parameters out of range\n"));
383 ==========================================================================
387 TRUE if all parameters are OK, FALSE otherwise
388 ==========================================================================
390 INT
Set_Channel_Proc(
391 IN PRTMP_ADAPTER pAd
,
397 Channel
= (UCHAR
) simple_strtol(arg
, 0, 10);
399 // check if this channel is valid
400 if (ChannelSanity(pAd
, Channel
) == TRUE
)
402 #ifdef CONFIG_STA_SUPPORT
403 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
405 pAd
->CommonCfg
.Channel
= Channel
;
409 #ifdef DOT11_N_SUPPORT
411 if (pAd
->CommonCfg
.PhyMode
>= PHY_11ABGN_MIXED
&&
412 pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
== BW_40
)
415 AsicSwitchChannel(pAd
, pAd
->CommonCfg
.CentralChannel
, FALSE
);
416 AsicLockChannel(pAd
, pAd
->CommonCfg
.CentralChannel
);
417 DBGPRINT(RT_DEBUG_TRACE
, ("BW_40, control_channel(%d), CentralChannel(%d) \n",
418 pAd
->CommonCfg
.Channel
, pAd
->CommonCfg
.CentralChannel
));
421 #endif // DOT11_N_SUPPORT //
423 AsicSwitchChannel(pAd
, pAd
->CommonCfg
.Channel
, FALSE
);
424 AsicLockChannel(pAd
, pAd
->CommonCfg
.Channel
);
425 DBGPRINT(RT_DEBUG_TRACE
, ("BW_20, Channel(%d)\n", pAd
->CommonCfg
.Channel
));
429 #endif // CONFIG_STA_SUPPORT //
435 #ifdef CONFIG_STA_SUPPORT
436 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
438 #endif // CONFIG_STA_SUPPORT //
443 DBGPRINT(RT_DEBUG_TRACE
, ("Set_Channel_Proc::(Channel=%d)\n", pAd
->CommonCfg
.Channel
));
450 ==========================================================================
452 Set Short Slot Time Enable or Disable
454 TRUE if all parameters are OK, FALSE otherwise
455 ==========================================================================
457 INT
Set_ShortSlot_Proc(
458 IN PRTMP_ADAPTER pAd
,
463 retval
= RT_CfgSetShortSlot(pAd
, arg
);
465 DBGPRINT(RT_DEBUG_TRACE
, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd
->CommonCfg
.bUseShortSlotTime
));
472 ==========================================================================
476 TRUE if all parameters are OK, FALSE otherwise
477 ==========================================================================
479 INT
Set_TxPower_Proc(
480 IN PRTMP_ADAPTER pAd
,
486 TxPower
= simple_strtol(arg
, 0, 10);
490 #ifdef CONFIG_STA_SUPPORT
491 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
493 pAd
->CommonCfg
.TxPowerDefault
= TxPower
;
494 pAd
->CommonCfg
.TxPowerPercentage
= pAd
->CommonCfg
.TxPowerDefault
;
496 #endif // CONFIG_STA_SUPPORT //
502 DBGPRINT(RT_DEBUG_TRACE
, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd
->CommonCfg
.TxPowerPercentage
));
508 ==========================================================================
510 Set 11B/11G Protection
512 TRUE if all parameters are OK, FALSE otherwise
513 ==========================================================================
515 INT
Set_BGProtection_Proc(
516 IN PRTMP_ADAPTER pAd
,
519 switch (simple_strtol(arg
, 0, 10))
522 pAd
->CommonCfg
.UseBGProtection
= 0;
525 pAd
->CommonCfg
.UseBGProtection
= 1;
528 pAd
->CommonCfg
.UseBGProtection
= 2;
530 default: //Invalid argument
535 DBGPRINT(RT_DEBUG_TRACE
, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd
->CommonCfg
.UseBGProtection
));
541 ==========================================================================
545 TRUE if all parameters are OK, FALSE otherwise
546 ==========================================================================
548 INT
Set_TxPreamble_Proc(
549 IN PRTMP_ADAPTER pAd
,
552 RT_802_11_PREAMBLE Preamble
;
554 Preamble
= simple_strtol(arg
, 0, 10);
559 case Rt802_11PreambleShort
:
560 pAd
->CommonCfg
.TxPreamble
= Preamble
;
561 #ifdef CONFIG_STA_SUPPORT
562 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
563 MlmeSetTxPreamble(pAd
, Rt802_11PreambleShort
);
564 #endif // CONFIG_STA_SUPPORT //
566 case Rt802_11PreambleLong
:
567 #ifdef CONFIG_STA_SUPPORT
568 case Rt802_11PreambleAuto
:
569 // if user wants AUTO, initialize to LONG here, then change according to AP's
570 // capability upon association.
571 #endif // CONFIG_STA_SUPPORT //
572 pAd
->CommonCfg
.TxPreamble
= Preamble
;
573 #ifdef CONFIG_STA_SUPPORT
574 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
575 MlmeSetTxPreamble(pAd
, Rt802_11PreambleLong
);
576 #endif // CONFIG_STA_SUPPORT //
578 default: //Invalid argument
582 DBGPRINT(RT_DEBUG_TRACE
, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd
->CommonCfg
.TxPreamble
));
588 ==========================================================================
592 TRUE if all parameters are OK, FALSE otherwise
593 ==========================================================================
595 INT
Set_RTSThreshold_Proc(
596 IN PRTMP_ADAPTER pAd
,
599 NDIS_802_11_RTS_THRESHOLD RtsThresh
;
601 RtsThresh
= simple_strtol(arg
, 0, 10);
603 if((RtsThresh
> 0) && (RtsThresh
<= MAX_RTS_THRESHOLD
))
604 pAd
->CommonCfg
.RtsThreshold
= (USHORT
)RtsThresh
;
605 #ifdef CONFIG_STA_SUPPORT
606 else if (RtsThresh
== 0)
607 pAd
->CommonCfg
.RtsThreshold
= MAX_RTS_THRESHOLD
;
608 #endif // CONFIG_STA_SUPPORT //
610 return FALSE
; //Invalid argument
612 DBGPRINT(RT_DEBUG_TRACE
, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd
->CommonCfg
.RtsThreshold
));
618 ==========================================================================
620 Set Fragment Threshold
622 TRUE if all parameters are OK, FALSE otherwise
623 ==========================================================================
625 INT
Set_FragThreshold_Proc(
626 IN PRTMP_ADAPTER pAd
,
629 NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh
;
631 FragThresh
= simple_strtol(arg
, 0, 10);
633 if (FragThresh
> MAX_FRAG_THRESHOLD
|| FragThresh
< MIN_FRAG_THRESHOLD
)
635 //Illegal FragThresh so we set it to default
636 pAd
->CommonCfg
.FragmentThreshold
= MAX_FRAG_THRESHOLD
;
638 else if (FragThresh
% 2 == 1)
640 // The length of each fragment shall always be an even number of octets, except for the last fragment
641 // of an MSDU or MMPDU, which may be either an even or an odd number of octets.
642 pAd
->CommonCfg
.FragmentThreshold
= (USHORT
)(FragThresh
- 1);
646 pAd
->CommonCfg
.FragmentThreshold
= (USHORT
)FragThresh
;
649 #ifdef CONFIG_STA_SUPPORT
650 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
652 if (pAd
->CommonCfg
.FragmentThreshold
== MAX_FRAG_THRESHOLD
)
653 pAd
->CommonCfg
.bUseZeroToDisableFragment
= TRUE
;
655 pAd
->CommonCfg
.bUseZeroToDisableFragment
= FALSE
;
657 #endif // CONFIG_STA_SUPPORT //
659 DBGPRINT(RT_DEBUG_TRACE
, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd
->CommonCfg
.FragmentThreshold
));
665 ==========================================================================
669 TRUE if all parameters are OK, FALSE otherwise
670 ==========================================================================
672 INT
Set_TxBurst_Proc(
673 IN PRTMP_ADAPTER pAd
,
678 TxBurst
= simple_strtol(arg
, 0, 10);
680 pAd
->CommonCfg
.bEnableTxBurst
= TRUE
;
681 else if (TxBurst
== 0)
682 pAd
->CommonCfg
.bEnableTxBurst
= FALSE
;
684 return FALSE
; //Invalid argument
686 DBGPRINT(RT_DEBUG_TRACE
, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd
->CommonCfg
.bEnableTxBurst
));
691 #ifdef AGGREGATION_SUPPORT
693 ==========================================================================
697 TRUE if all parameters are OK, FALSE otherwise
698 ==========================================================================
700 INT
Set_PktAggregate_Proc(
701 IN PRTMP_ADAPTER pAd
,
706 aggre
= simple_strtol(arg
, 0, 10);
709 pAd
->CommonCfg
.bAggregationCapable
= TRUE
;
711 pAd
->CommonCfg
.bAggregationCapable
= FALSE
;
713 return FALSE
; //Invalid argument
716 DBGPRINT(RT_DEBUG_TRACE
, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd
->CommonCfg
.bAggregationCapable
));
723 #ifdef INF_AMAZON_PPA
724 INT
Set_INF_AMAZON_SE_PPA_Proc(
725 IN PRTMP_ADAPTER pAd
,
731 aggre
= simple_strtol(arg
, 0, 10);
735 if(pAd
->PPAEnable
==TRUE
)
737 printk("INF_AMAZON_SE_PPA already enabled \n");
741 if (ppa_hook_directpath_register_dev_fn
)
745 if (pAd
->pDirectpathCb
== NULL
)
747 pAd
->pDirectpathCb
= (PPA_DIRECTPATH_CB
*) kmalloc (sizeof(PPA_DIRECTPATH_CB
), GFP_ATOMIC
);
748 printk("Realloc memory for pDirectpathCb ??\n");
751 /* register callback */
752 pAd
->pDirectpathCb
->rx_fn
= NULL
;
753 pAd
->pDirectpathCb
->stop_tx_fn
= NULL
;
754 pAd
->pDirectpathCb
->start_tx_fn
= NULL
;
756 status
= ppa_hook_directpath_register_dev_fn(&g_if_id
, pAd
->net_dev
, pAd
->pDirectpathCb
, PPA_F_DIRECTPATH_ETH_IF
);
760 pAd
->g_if_id
=g_if_id
;
761 printk("register INF_AMAZON_SE_PPA success :ret:%d id:%d:%d\n",status
,pAd
->g_if_id
,g_if_id
);
766 printk("register INF_AMAZON_SE_PPA fail :ret:%d\n",status
);
772 printk("INF_AMAZON_SE_PPA enable fail : there is no INF_AMAZON_SE_PPA module . \n");
780 if(pAd
->PPAEnable
==FALSE
)
783 printk("INF_AMAZON_SE_PPA already disable \n");
787 if (ppa_hook_directpath_register_dev_fn
)
790 g_if_id
=pAd
->g_if_id
;
791 printk("g_if_id=%d \n",pAd
->g_if_id
);
792 status
=ppa_hook_directpath_register_dev_fn(&g_if_id
, pAd
->net_dev
, NULL
, PPA_F_DIRECTPATH_DEREGISTER
);
797 printk("unregister INF_AMAZON_SE_PPA success :ret:%d\n",status
);
798 pAd
->PPAEnable
=FALSE
;
802 printk("unregister INF_AMAZON_SE_PPA fail :ret:%d\n",status
);
808 printk("INF_AMAZON_SE_PPA enable fail : there is no INF_AMAZON_SE_PPA module . \n");
815 printk("Invalid argument %d \n",aggre
);
816 return FALSE
; //Invalid argument
822 #endif // INF_AMAZON_PPA //
826 ==========================================================================
829 This parameter is 1 when needs radar detection, otherwise 0
831 TRUE if all parameters are OK, FALSE otherwise
832 ==========================================================================
834 INT
Set_IEEE80211H_Proc(
835 IN PRTMP_ADAPTER pAd
,
840 ieee80211h
= simple_strtol(arg
, 0, 10);
843 pAd
->CommonCfg
.bIEEE80211H
= TRUE
;
844 else if (ieee80211h
== 0)
845 pAd
->CommonCfg
.bIEEE80211H
= FALSE
;
847 return FALSE
; //Invalid argument
849 DBGPRINT(RT_DEBUG_TRACE
, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd
->CommonCfg
.bIEEE80211H
));
857 ==========================================================================
859 For Debug information
861 TRUE if all parameters are OK, FALSE otherwise
862 ==========================================================================
865 IN PRTMP_ADAPTER pAd
,
868 DBGPRINT(RT_DEBUG_TRACE
, ("==> Set_Debug_Proc *******************\n"));
870 if(simple_strtol(arg
, 0, 10) <= RT_DEBUG_LOUD
)
871 RTDebugLevel
= simple_strtol(arg
, 0, 10);
873 DBGPRINT(RT_DEBUG_TRACE
, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel
));
879 INT
Show_DescInfo_Proc(
880 IN PRTMP_ADAPTER pAd
,
886 PRT28XX_RXD_STRUC pRxD
;
888 PRTMP_TX_RING pTxRing
= &pAd
->TxRing
[QueIdx
];
889 PRTMP_MGMT_RING pMgmtRing
= &pAd
->MgmtRing
;
890 PRTMP_RX_RING pRxRing
= &pAd
->RxRing
;
892 for(i
=0;i
<TX_RING_SIZE
;i
++)
894 pTxD
= (PTXD_STRUC
) pTxRing
->Cell
[i
].AllocVa
;
895 DBGPRINT(RT_DEBUG_OFF
, ("Desc #%d\n",i
));
896 hex_dump("Tx Descriptor", (PUCHAR
)pTxD
, 16);
897 DBGPRINT(RT_DEBUG_OFF
, ("pTxD->DMADONE = %x\n", pTxD
->DMADONE
));
899 DBGPRINT(RT_DEBUG_OFF
, ("---------------------------------------------------\n"));
900 for(i
=0;i
<MGMT_RING_SIZE
;i
++)
902 pTxD
= (PTXD_STRUC
) pMgmtRing
->Cell
[i
].AllocVa
;
903 DBGPRINT(RT_DEBUG_OFF
, ("Desc #%d\n",i
));
904 hex_dump("Mgmt Descriptor", (PUCHAR
)pTxD
, 16);
905 DBGPRINT(RT_DEBUG_OFF
, ("pMgmt->DMADONE = %x\n", pTxD
->DMADONE
));
907 DBGPRINT(RT_DEBUG_OFF
, ("---------------------------------------------------\n"));
908 for(i
=0;i
<RX_RING_SIZE
;i
++)
910 pRxD
= (PRT28XX_RXD_STRUC
) pRxRing
->Cell
[i
].AllocVa
;
911 DBGPRINT(RT_DEBUG_OFF
, ("Desc #%d\n",i
));
912 hex_dump("Rx Descriptor", (PUCHAR
)pRxD
, 16);
913 DBGPRINT(RT_DEBUG_OFF
, ("pRxD->DDONE = %x\n", pRxD
->DDONE
));
915 #endif // RTMP_MAC_PCI //
921 ==========================================================================
923 Reset statistics counter
926 pAdapter Pointer to our adapter
930 TRUE if all parameters are OK, FALSE otherwise
931 ==========================================================================
933 INT
Set_ResetStatCounter_Proc(
934 IN PRTMP_ADAPTER pAd
,
938 //MAC_TABLE_ENTRY *pEntry;
940 DBGPRINT(RT_DEBUG_TRACE
, ("==>Set_ResetStatCounter_Proc\n"));
942 // add the most up-to-date h/w raw counters into software counters
943 NICUpdateRawCounters(pAd
);
945 NdisZeroMemory(&pAd
->WlanCounters
, sizeof(COUNTER_802_11
));
946 NdisZeroMemory(&pAd
->Counters8023
, sizeof(COUNTER_802_3
));
947 NdisZeroMemory(&pAd
->RalinkCounters
, sizeof(COUNTER_RALINK
));
949 // Reset HotSpot counter
956 ========================================================================
960 In Adhoc WPANONE, bPairwise = 0; KeyIdx = 0;
963 pAd Pointer to our adapter
964 pBuf Pointer to the where the key stored
967 NDIS_SUCCESS Add key successfully
969 IRQL = DISPATCH_LEVEL
973 ========================================================================
976 BOOLEAN
RTMPCheckStrPrintAble(
982 for (i
=0; i
<strLen
; i
++)
984 if ((pInPutStr
[i
] < 0x21) ||
985 (pInPutStr
[i
] > 0x7E))
993 ========================================================================
996 Remove WPA Key process
999 pAd Pointer to our adapter
1000 pBuf Pointer to the where the key stored
1003 NDIS_SUCCESS Add key successfully
1005 IRQL = DISPATCH_LEVEL
1009 ========================================================================
1011 #ifdef CONFIG_STA_SUPPORT
1012 VOID
RTMPSetDesiredRates(
1013 IN PRTMP_ADAPTER pAdapter
,
1016 NDIS_802_11_RATES aryRates
;
1018 memset(&aryRates
, 0x00, sizeof(NDIS_802_11_RATES
));
1019 switch (pAdapter
->CommonCfg
.PhyMode
)
1021 case PHY_11A
: // A only
1025 aryRates
[0] = 0x0c; // 6M
1026 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_0
;
1029 aryRates
[0] = 0x12; // 9M
1030 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_1
;
1032 case 12000000: //12M
1033 aryRates
[0] = 0x18; // 12M
1034 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_2
;
1036 case 18000000: //18M
1037 aryRates
[0] = 0x24; // 18M
1038 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_3
;
1040 case 24000000: //24M
1041 aryRates
[0] = 0x30; // 24M
1042 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_4
;
1044 case 36000000: //36M
1045 aryRates
[0] = 0x48; // 36M
1046 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_5
;
1048 case 48000000: //48M
1049 aryRates
[0] = 0x60; // 48M
1050 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_6
;
1052 case 54000000: //54M
1053 aryRates
[0] = 0x6c; // 54M
1054 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_7
;
1058 aryRates
[0] = 0x6c; // 54Mbps
1059 aryRates
[1] = 0x60; // 48Mbps
1060 aryRates
[2] = 0x48; // 36Mbps
1061 aryRates
[3] = 0x30; // 24Mbps
1062 aryRates
[4] = 0x24; // 18M
1063 aryRates
[5] = 0x18; // 12M
1064 aryRates
[6] = 0x12; // 9M
1065 aryRates
[7] = 0x0c; // 6M
1066 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_AUTO
;
1070 case PHY_11BG_MIXED
: // B/G Mixed
1071 case PHY_11B
: // B only
1072 case PHY_11ABG_MIXED
: // A/B/G Mixed
1078 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_0
;
1082 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_1
;
1084 case 5000000: //5.5M
1085 aryRates
[0] = 0x0b; // 5.5M
1086 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_2
;
1088 case 11000000: //11M
1089 aryRates
[0] = 0x16; // 11M
1090 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_3
;
1093 aryRates
[0] = 0x0c; // 6M
1094 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_0
;
1097 aryRates
[0] = 0x12; // 9M
1098 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_1
;
1100 case 12000000: //12M
1101 aryRates
[0] = 0x18; // 12M
1102 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_2
;
1104 case 18000000: //18M
1105 aryRates
[0] = 0x24; // 18M
1106 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_3
;
1108 case 24000000: //24M
1109 aryRates
[0] = 0x30; // 24M
1110 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_4
;
1112 case 36000000: //36M
1113 aryRates
[0] = 0x48; // 36M
1114 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_5
;
1116 case 48000000: //48M
1117 aryRates
[0] = 0x60; // 48M
1118 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_6
;
1120 case 54000000: //54M
1121 aryRates
[0] = 0x6c; // 54M
1122 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_7
;
1126 if (pAdapter
->CommonCfg
.PhyMode
== PHY_11B
)
1128 aryRates
[0] = 0x16; // 11Mbps
1129 aryRates
[1] = 0x0b; // 5.5Mbps
1130 aryRates
[2] = 0x04; // 2Mbps
1131 aryRates
[3] = 0x02; // 1Mbps
1134 { //(B/G) Mixed or (A/B/G) Mixed
1135 aryRates
[0] = 0x6c; // 54Mbps
1136 aryRates
[1] = 0x60; // 48Mbps
1137 aryRates
[2] = 0x48; // 36Mbps
1138 aryRates
[3] = 0x30; // 24Mbps
1139 aryRates
[4] = 0x16; // 11Mbps
1140 aryRates
[5] = 0x0b; // 5.5Mbps
1141 aryRates
[6] = 0x04; // 2Mbps
1142 aryRates
[7] = 0x02; // 1Mbps
1144 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_AUTO
;
1150 NdisZeroMemory(pAdapter
->CommonCfg
.DesireRate
, MAX_LEN_OF_SUPPORTED_RATES
);
1151 NdisMoveMemory(pAdapter
->CommonCfg
.DesireRate
, &aryRates
, sizeof(NDIS_802_11_RATES
));
1152 DBGPRINT(RT_DEBUG_TRACE
, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
1153 pAdapter
->CommonCfg
.DesireRate
[0],pAdapter
->CommonCfg
.DesireRate
[1],
1154 pAdapter
->CommonCfg
.DesireRate
[2],pAdapter
->CommonCfg
.DesireRate
[3],
1155 pAdapter
->CommonCfg
.DesireRate
[4],pAdapter
->CommonCfg
.DesireRate
[5],
1156 pAdapter
->CommonCfg
.DesireRate
[6],pAdapter
->CommonCfg
.DesireRate
[7] ));
1157 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
1158 MlmeUpdateTxRates(pAdapter
, FALSE
, 0);
1161 NDIS_STATUS
RTMPWPARemoveKeyProc(
1162 IN PRTMP_ADAPTER pAd
,
1165 PNDIS_802_11_REMOVE_KEY pKey
;
1167 NDIS_STATUS Status
= NDIS_STATUS_FAILURE
;
1168 BOOLEAN bTxKey
; // Set the key as transmit key
1169 BOOLEAN bPairwise
; // Indicate the key is pairwise key
1170 BOOLEAN bKeyRSC
; // indicate the receive SC set by KeyRSC value.
1171 // Otherwise, it will set by the NIC.
1172 BOOLEAN bAuthenticator
; // indicate key is set by authenticator.
1175 DBGPRINT(RT_DEBUG_TRACE
,("---> RTMPWPARemoveKeyProc\n"));
1177 pKey
= (PNDIS_802_11_REMOVE_KEY
) pBuf
;
1178 KeyIdx
= pKey
->KeyIndex
& 0xff;
1179 // Bit 31 of Add-key, Tx Key
1180 bTxKey
= (pKey
->KeyIndex
& 0x80000000) ? TRUE
: FALSE
;
1181 // Bit 30 of Add-key PairwiseKey
1182 bPairwise
= (pKey
->KeyIndex
& 0x40000000) ? TRUE
: FALSE
;
1183 // Bit 29 of Add-key KeyRSC
1184 bKeyRSC
= (pKey
->KeyIndex
& 0x20000000) ? TRUE
: FALSE
;
1185 // Bit 28 of Add-key Authenticator
1186 bAuthenticator
= (pKey
->KeyIndex
& 0x10000000) ? TRUE
: FALSE
;
1188 // 1. If bTx is TRUE, return failure information
1190 return(NDIS_STATUS_INVALID_DATA
);
1192 // 2. Check Pairwise Key
1195 // a. If BSSID is broadcast, remove all pairwise keys.
1196 // b. If not broadcast, remove the pairwise specified by BSSID
1197 for (i
= 0; i
< SHARE_KEY_NUM
; i
++)
1199 if (MAC_ADDR_EQUAL(pAd
->SharedKey
[BSS0
][i
].BssId
, pKey
->BSSID
))
1201 DBGPRINT(RT_DEBUG_TRACE
,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i
));
1202 pAd
->SharedKey
[BSS0
][i
].KeyLen
= 0;
1203 pAd
->SharedKey
[BSS0
][i
].CipherAlg
= CIPHER_NONE
;
1204 AsicRemoveSharedKeyEntry(pAd
, BSS0
, (UCHAR
)i
);
1205 Status
= NDIS_STATUS_SUCCESS
;
1213 // a. If BSSID is broadcast, remove all group keys indexed
1214 // b. If BSSID matched, delete the group key indexed.
1215 DBGPRINT(RT_DEBUG_TRACE
,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx
));
1216 pAd
->SharedKey
[BSS0
][KeyIdx
].KeyLen
= 0;
1217 pAd
->SharedKey
[BSS0
][KeyIdx
].CipherAlg
= CIPHER_NONE
;
1218 AsicRemoveSharedKeyEntry(pAd
, BSS0
, (UCHAR
)KeyIdx
);
1219 Status
= NDIS_STATUS_SUCCESS
;
1224 #endif // CONFIG_STA_SUPPORT //
1227 #ifdef CONFIG_STA_SUPPORT
1229 ========================================================================
1231 Routine Description:
1235 pAd Pointer to our adapter
1240 IRQL = DISPATCH_LEVEL
1244 ========================================================================
1246 VOID
RTMPWPARemoveAllKeys(
1247 IN PRTMP_ADAPTER pAd
)
1252 DBGPRINT(RT_DEBUG_TRACE
,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd
->StaCfg
.AuthMode
, pAd
->StaCfg
.WepStatus
));
1253 RTMP_CLEAR_PSFLAG(pAd
, fRTMP_PS_CAN_GO_SLEEP
);
1254 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1255 // Link up. And it will be replaced if user changed it.
1256 if (pAd
->StaCfg
.AuthMode
< Ndis802_11AuthModeWPA
)
1259 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1260 // Link up. And it will be replaced if user changed it.
1261 if (pAd
->StaCfg
.AuthMode
== Ndis802_11AuthModeWPANone
)
1264 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1265 AsicRemovePairwiseKeyEntry(pAd
, BSS0
, BSSID_WCID
);
1267 // set all shared key mode as no-security.
1268 for (i
= 0; i
< SHARE_KEY_NUM
; i
++)
1270 DBGPRINT(RT_DEBUG_TRACE
,("remove %s key #%d\n", CipherName
[pAd
->SharedKey
[BSS0
][i
].CipherAlg
], i
));
1271 NdisZeroMemory(&pAd
->SharedKey
[BSS0
][i
], sizeof(CIPHER_KEY
));
1273 AsicRemoveSharedKeyEntry(pAd
, BSS0
, i
);
1275 RTMP_SET_PSFLAG(pAd
, fRTMP_PS_CAN_GO_SLEEP
);
1278 #endif // CONFIG_STA_SUPPORT //
1282 ========================================================================
1284 Routine Description:
1285 As STA's BSSID is a WC too, it uses shared key table.
1286 This function write correct unicast TX key to ASIC WCID.
1287 And we still make a copy in our MacTab.Content[BSSID_WCID].PairwiseKey.
1288 Caller guarantee TKIP/AES always has keyidx = 0. (pairwise key)
1289 Caller guarantee WEP calls this function when set Txkey, default key index=0~3.
1292 pAd Pointer to our adapter
1293 pKey Pointer to the where the key stored
1296 NDIS_SUCCESS Add key successfully
1298 IRQL = DISPATCH_LEVEL
1302 ========================================================================
1305 ========================================================================
1306 Routine Description:
1307 Change NIC PHY mode. Re-association may be necessary. possible settings
1308 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1311 pAd - Pointer to our adapter
1314 IRQL = PASSIVE_LEVEL
1315 IRQL = DISPATCH_LEVEL
1317 ========================================================================
1319 VOID
RTMPSetPhyMode(
1320 IN PRTMP_ADAPTER pAd
,
1324 // the selected phymode must be supported by the RF IC encoded in E2PROM
1326 // if no change, do nothing
1328 if (pAd->CommonCfg.PhyMode == phymode)
1331 pAd
->CommonCfg
.PhyMode
= (UCHAR
)phymode
;
1333 DBGPRINT(RT_DEBUG_TRACE
,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd
->CommonCfg
.PhyMode
, pAd
->CommonCfg
.Channel
));
1334 #ifdef EXT_BUILD_CHANNEL_LIST
1335 BuildChannelListEx(pAd
);
1337 BuildChannelList(pAd
);
1338 #endif // EXT_BUILD_CHANNEL_LIST //
1340 // sanity check user setting
1341 for (i
= 0; i
< pAd
->ChannelListNum
; i
++)
1343 if (pAd
->CommonCfg
.Channel
== pAd
->ChannelList
[i
].Channel
)
1347 if (i
== pAd
->ChannelListNum
)
1349 #ifdef CONFIG_STA_SUPPORT
1350 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1351 pAd
->CommonCfg
.Channel
= FirstChannel(pAd
);
1352 #endif // CONFIG_STA_SUPPORT //
1353 DBGPRINT(RT_DEBUG_ERROR
, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd
->CommonCfg
.Channel
));
1356 NdisZeroMemory(pAd
->CommonCfg
.SupRate
, MAX_LEN_OF_SUPPORTED_RATES
);
1357 NdisZeroMemory(pAd
->CommonCfg
.ExtRate
, MAX_LEN_OF_SUPPORTED_RATES
);
1358 NdisZeroMemory(pAd
->CommonCfg
.DesireRate
, MAX_LEN_OF_SUPPORTED_RATES
);
1361 pAd
->CommonCfg
.SupRate
[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1362 pAd
->CommonCfg
.SupRate
[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1363 pAd
->CommonCfg
.SupRate
[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1364 pAd
->CommonCfg
.SupRate
[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1365 pAd
->CommonCfg
.SupRateLen
= 4;
1366 pAd
->CommonCfg
.ExtRateLen
= 0;
1367 pAd
->CommonCfg
.DesireRate
[0] = 2; // 1 mbps, in units of 0.5 Mbps
1368 pAd
->CommonCfg
.DesireRate
[1] = 4; // 2 mbps, in units of 0.5 Mbps
1369 pAd
->CommonCfg
.DesireRate
[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1370 pAd
->CommonCfg
.DesireRate
[3] = 22; // 11 mbps, in units of 0.5 Mbps
1371 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1375 case PHY_11BG_MIXED
:
1376 case PHY_11ABG_MIXED
:
1377 #ifdef DOT11_N_SUPPORT
1379 case PHY_11ABGN_MIXED
:
1380 case PHY_11BGN_MIXED
:
1381 case PHY_11GN_MIXED
:
1382 #endif // DOT11_N_SUPPORT //
1383 pAd
->CommonCfg
.SupRate
[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1384 pAd
->CommonCfg
.SupRate
[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1385 pAd
->CommonCfg
.SupRate
[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1386 pAd
->CommonCfg
.SupRate
[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1387 pAd
->CommonCfg
.SupRate
[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1388 pAd
->CommonCfg
.SupRate
[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1389 pAd
->CommonCfg
.SupRate
[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1390 pAd
->CommonCfg
.SupRate
[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1391 pAd
->CommonCfg
.SupRateLen
= 8;
1392 pAd
->CommonCfg
.ExtRate
[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1393 pAd
->CommonCfg
.ExtRate
[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1394 pAd
->CommonCfg
.ExtRate
[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1395 pAd
->CommonCfg
.ExtRate
[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1396 pAd
->CommonCfg
.ExtRateLen
= 4;
1397 pAd
->CommonCfg
.DesireRate
[0] = 2; // 1 mbps, in units of 0.5 Mbps
1398 pAd
->CommonCfg
.DesireRate
[1] = 4; // 2 mbps, in units of 0.5 Mbps
1399 pAd
->CommonCfg
.DesireRate
[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1400 pAd
->CommonCfg
.DesireRate
[3] = 22; // 11 mbps, in units of 0.5 Mbps
1401 pAd
->CommonCfg
.DesireRate
[4] = 12; // 6 mbps, in units of 0.5 Mbps
1402 pAd
->CommonCfg
.DesireRate
[5] = 18; // 9 mbps, in units of 0.5 Mbps
1403 pAd
->CommonCfg
.DesireRate
[6] = 24; // 12 mbps, in units of 0.5 Mbps
1404 pAd
->CommonCfg
.DesireRate
[7] = 36; // 18 mbps, in units of 0.5 Mbps
1405 pAd
->CommonCfg
.DesireRate
[8] = 48; // 24 mbps, in units of 0.5 Mbps
1406 pAd
->CommonCfg
.DesireRate
[9] = 72; // 36 mbps, in units of 0.5 Mbps
1407 pAd
->CommonCfg
.DesireRate
[10] = 96; // 48 mbps, in units of 0.5 Mbps
1408 pAd
->CommonCfg
.DesireRate
[11] = 108; // 54 mbps, in units of 0.5 Mbps
1412 #ifdef DOT11_N_SUPPORT
1413 case PHY_11AN_MIXED
:
1414 case PHY_11AGN_MIXED
:
1416 #endif // DOT11_N_SUPPORT //
1417 pAd
->CommonCfg
.SupRate
[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1418 pAd
->CommonCfg
.SupRate
[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1419 pAd
->CommonCfg
.SupRate
[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1420 pAd
->CommonCfg
.SupRate
[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1421 pAd
->CommonCfg
.SupRate
[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1422 pAd
->CommonCfg
.SupRate
[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1423 pAd
->CommonCfg
.SupRate
[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1424 pAd
->CommonCfg
.SupRate
[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1425 pAd
->CommonCfg
.SupRateLen
= 8;
1426 pAd
->CommonCfg
.ExtRateLen
= 0;
1427 pAd
->CommonCfg
.DesireRate
[0] = 12; // 6 mbps, in units of 0.5 Mbps
1428 pAd
->CommonCfg
.DesireRate
[1] = 18; // 9 mbps, in units of 0.5 Mbps
1429 pAd
->CommonCfg
.DesireRate
[2] = 24; // 12 mbps, in units of 0.5 Mbps
1430 pAd
->CommonCfg
.DesireRate
[3] = 36; // 18 mbps, in units of 0.5 Mbps
1431 pAd
->CommonCfg
.DesireRate
[4] = 48; // 24 mbps, in units of 0.5 Mbps
1432 pAd
->CommonCfg
.DesireRate
[5] = 72; // 36 mbps, in units of 0.5 Mbps
1433 pAd
->CommonCfg
.DesireRate
[6] = 96; // 48 mbps, in units of 0.5 Mbps
1434 pAd
->CommonCfg
.DesireRate
[7] = 108; // 54 mbps, in units of 0.5 Mbps
1435 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1443 pAd
->CommonCfg
.BandState
= UNKNOWN_BAND
;
1447 #ifdef DOT11_N_SUPPORT
1449 ========================================================================
1450 Routine Description:
1451 Caller ensures we has 802.11n support.
1452 Calls at setting HT from AP/STASetinformation
1455 pAd - Pointer to our adapter
1458 ========================================================================
1461 IN PRTMP_ADAPTER pAd
,
1462 IN OID_SET_HT_PHYMODE
*pHTPhyMode
)
1467 UCHAR BBP3Value
= 0;
1468 UCHAR RxStream
= pAd
->CommonCfg
.RxStream
;
1470 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1471 pHTPhyMode
->HtMode
, pHTPhyMode
->ExtOffset
,
1472 pHTPhyMode
->MCS
, pHTPhyMode
->BW
,
1473 pHTPhyMode
->STBC
, pHTPhyMode
->SHORTGI
));
1475 // Don't zero supportedHyPhy structure.
1476 RTMPZeroMemory(&pAd
->CommonCfg
.HtCapability
, sizeof(pAd
->CommonCfg
.HtCapability
));
1477 RTMPZeroMemory(&pAd
->CommonCfg
.AddHTInfo
, sizeof(pAd
->CommonCfg
.AddHTInfo
));
1478 RTMPZeroMemory(&pAd
->CommonCfg
.NewExtChanOffset
, sizeof(pAd
->CommonCfg
.NewExtChanOffset
));
1479 RTMPZeroMemory(&pAd
->CommonCfg
.DesiredHtPhy
, sizeof(pAd
->CommonCfg
.DesiredHtPhy
));
1481 if (pAd
->CommonCfg
.bRdg
)
1483 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.PlusHTC
= 1;
1484 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.RDGSupport
= 1;
1488 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.PlusHTC
= 0;
1489 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.RDGSupport
= 0;
1492 pAd
->CommonCfg
.HtCapability
.HtCapParm
.MaxRAmpduFactor
= 3;
1493 pAd
->CommonCfg
.DesiredHtPhy
.MaxRAmpduFactor
= 3;
1495 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
));
1497 // Mimo power save, A-MSDU size,
1498 pAd
->CommonCfg
.DesiredHtPhy
.AmsduEnable
= (USHORT
)pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
;
1499 pAd
->CommonCfg
.DesiredHtPhy
.AmsduSize
= (UCHAR
)pAd
->CommonCfg
.BACapability
.field
.AmsduSize
;
1500 pAd
->CommonCfg
.DesiredHtPhy
.MimoPs
= (UCHAR
)pAd
->CommonCfg
.BACapability
.field
.MMPSmode
;
1501 pAd
->CommonCfg
.DesiredHtPhy
.MpduDensity
= (UCHAR
)pAd
->CommonCfg
.BACapability
.field
.MpduDensity
;
1503 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.AMsduSize
= (USHORT
)pAd
->CommonCfg
.BACapability
.field
.AmsduSize
;
1504 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.MimoPs
= (USHORT
)pAd
->CommonCfg
.BACapability
.field
.MMPSmode
;
1505 pAd
->CommonCfg
.HtCapability
.HtCapParm
.MpduDensity
= (UCHAR
)pAd
->CommonCfg
.BACapability
.field
.MpduDensity
;
1507 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1508 pAd
->CommonCfg
.DesiredHtPhy
.AmsduSize
,
1509 pAd
->CommonCfg
.DesiredHtPhy
.MimoPs
,
1510 pAd
->CommonCfg
.DesiredHtPhy
.MpduDensity
,
1511 pAd
->CommonCfg
.DesiredHtPhy
.MaxRAmpduFactor
));
1513 if(pHTPhyMode
->HtMode
== HTMODE_GF
)
1515 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.GF
= 1;
1516 pAd
->CommonCfg
.DesiredHtPhy
.GF
= 1;
1519 pAd
->CommonCfg
.DesiredHtPhy
.GF
= 0;
1525 pAd
->CommonCfg
.HtCapability
.MCSSet
[0] = 0xff;
1526 pAd
->CommonCfg
.HtCapability
.MCSSet
[1] = 0x00;
1530 pAd
->CommonCfg
.HtCapability
.MCSSet
[0] = 0xff;
1531 pAd
->CommonCfg
.HtCapability
.MCSSet
[1] = 0xff;
1535 pAd
->CommonCfg
.HtCapability
.MCSSet
[0] = 0xff;
1536 pAd
->CommonCfg
.HtCapability
.MCSSet
[1] = 0xff;
1537 pAd
->CommonCfg
.HtCapability
.MCSSet
[2] = 0xff;
1541 if (pAd
->CommonCfg
.bForty_Mhz_Intolerant
&& (pAd
->CommonCfg
.Channel
<= 14) && (pHTPhyMode
->BW
== BW_40
) )
1543 pHTPhyMode
->BW
= BW_20
;
1544 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.Forty_Mhz_Intolerant
= 1;
1547 if(pHTPhyMode
->BW
== BW_40
)
1549 pAd
->CommonCfg
.HtCapability
.MCSSet
[4] = 0x1; // MCS 32
1550 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ChannelWidth
= 1;
1551 if (pAd
->CommonCfg
.Channel
<= 14)
1552 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.CCKmodein40
= 1;
1554 pAd
->CommonCfg
.DesiredHtPhy
.ChannelWidth
= 1;
1555 pAd
->CommonCfg
.AddHTInfo
.AddHtInfo
.RecomWidth
= 1;
1556 pAd
->CommonCfg
.AddHTInfo
.AddHtInfo
.ExtChanOffset
= (pHTPhyMode
->ExtOffset
== EXTCHA_BELOW
)? (EXTCHA_BELOW
): EXTCHA_ABOVE
;
1557 // Set Regsiter for extension channel position.
1558 RTMP_IO_READ32(pAd
, TX_BAND_CFG
, &Value
);
1559 RTMP_BBP_IO_READ8_BY_REG_ID(pAd
, BBP_R3
, &BBP3Value
);
1560 if ((pHTPhyMode
->ExtOffset
== EXTCHA_BELOW
))
1563 BBP3Value
|= (0x20);
1564 RTMP_IO_WRITE32(pAd
, TX_BAND_CFG
, Value
);
1566 else if ((pHTPhyMode
->ExtOffset
== EXTCHA_ABOVE
))
1569 BBP3Value
&= (~0x20);
1570 RTMP_IO_WRITE32(pAd
, TX_BAND_CFG
, Value
);
1573 // Turn on BBP 40MHz mode now only as AP .
1574 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1575 if ((pAd
->OpMode
== OPMODE_AP
) || INFRA_ON(pAd
) || ADHOC_ON(pAd
)
1578 RTMP_BBP_IO_READ8_BY_REG_ID(pAd
, BBP_R4
, &BBPValue
);
1579 BBPValue
&= (~0x18);
1581 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd
, BBP_R4
, BBPValue
);
1583 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd
, BBP_R3
, BBP3Value
);
1584 pAd
->CommonCfg
.BBPCurrentBW
= BW_40
;
1589 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ChannelWidth
= 0;
1590 pAd
->CommonCfg
.DesiredHtPhy
.ChannelWidth
= 0;
1591 pAd
->CommonCfg
.AddHTInfo
.AddHtInfo
.RecomWidth
= 0;
1592 pAd
->CommonCfg
.AddHTInfo
.AddHtInfo
.ExtChanOffset
= EXTCHA_NONE
;
1593 pAd
->CommonCfg
.CentralChannel
= pAd
->CommonCfg
.Channel
;
1594 // Turn on BBP 20MHz mode by request here.
1596 RTMP_BBP_IO_READ8_BY_REG_ID(pAd
, BBP_R4
, &BBPValue
);
1597 BBPValue
&= (~0x18);
1598 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd
, BBP_R4
, BBPValue
);
1599 pAd
->CommonCfg
.BBPCurrentBW
= BW_20
;
1603 if(pHTPhyMode
->STBC
== STBC_USE
)
1605 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.TxSTBC
= 1;
1606 pAd
->CommonCfg
.DesiredHtPhy
.TxSTBC
= 1;
1607 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.RxSTBC
= 1;
1608 pAd
->CommonCfg
.DesiredHtPhy
.RxSTBC
= 1;
1612 pAd
->CommonCfg
.DesiredHtPhy
.TxSTBC
= 0;
1613 pAd
->CommonCfg
.DesiredHtPhy
.RxSTBC
= 0;
1616 if(pHTPhyMode
->SHORTGI
== GI_400
)
1618 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ShortGIfor20
= 1;
1619 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ShortGIfor40
= 1;
1620 pAd
->CommonCfg
.DesiredHtPhy
.ShortGIfor20
= 1;
1621 pAd
->CommonCfg
.DesiredHtPhy
.ShortGIfor40
= 1;
1625 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ShortGIfor20
= 0;
1626 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ShortGIfor40
= 0;
1627 pAd
->CommonCfg
.DesiredHtPhy
.ShortGIfor20
= 0;
1628 pAd
->CommonCfg
.DesiredHtPhy
.ShortGIfor40
= 0;
1631 // We support link adaptation for unsolicit MCS feedback, set to 2.
1632 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.MCSFeedback
= MCSFBK_NONE
; //MCSFBK_UNSOLICIT;
1633 pAd
->CommonCfg
.AddHTInfo
.ControlChan
= pAd
->CommonCfg
.Channel
;
1634 // 1, the extension channel above the control channel.
1636 // EDCA parameters used for AP's own transmission
1637 if (pAd
->CommonCfg
.APEdcaParm
.bValid
== FALSE
)
1639 pAd
->CommonCfg
.APEdcaParm
.bValid
= TRUE
;
1640 pAd
->CommonCfg
.APEdcaParm
.Aifsn
[0] = 3;
1641 pAd
->CommonCfg
.APEdcaParm
.Aifsn
[1] = 7;
1642 pAd
->CommonCfg
.APEdcaParm
.Aifsn
[2] = 1;
1643 pAd
->CommonCfg
.APEdcaParm
.Aifsn
[3] = 1;
1645 pAd
->CommonCfg
.APEdcaParm
.Cwmin
[0] = 4;
1646 pAd
->CommonCfg
.APEdcaParm
.Cwmin
[1] = 4;
1647 pAd
->CommonCfg
.APEdcaParm
.Cwmin
[2] = 3;
1648 pAd
->CommonCfg
.APEdcaParm
.Cwmin
[3] = 2;
1650 pAd
->CommonCfg
.APEdcaParm
.Cwmax
[0] = 6;
1651 pAd
->CommonCfg
.APEdcaParm
.Cwmax
[1] = 10;
1652 pAd
->CommonCfg
.APEdcaParm
.Cwmax
[2] = 4;
1653 pAd
->CommonCfg
.APEdcaParm
.Cwmax
[3] = 3;
1655 pAd
->CommonCfg
.APEdcaParm
.Txop
[0] = 0;
1656 pAd
->CommonCfg
.APEdcaParm
.Txop
[1] = 0;
1657 pAd
->CommonCfg
.APEdcaParm
.Txop
[2] = 94;
1658 pAd
->CommonCfg
.APEdcaParm
.Txop
[3] = 47;
1660 AsicSetEdcaParm(pAd
, &pAd
->CommonCfg
.APEdcaParm
);
1663 #ifdef CONFIG_STA_SUPPORT
1664 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1666 RTMPSetIndividualHT(pAd
, 0);
1668 #endif // CONFIG_STA_SUPPORT //
1673 ========================================================================
1674 Routine Description:
1675 Caller ensures we has 802.11n support.
1676 Calls at setting HT from AP/STASetinformation
1679 pAd - Pointer to our adapter
1682 ========================================================================
1684 VOID
RTMPSetIndividualHT(
1685 IN PRTMP_ADAPTER pAd
,
1688 PRT_HT_PHY_INFO pDesired_ht_phy
= NULL
;
1689 UCHAR TxStream
= pAd
->CommonCfg
.TxStream
;
1690 UCHAR DesiredMcs
= MCS_AUTO
;
1695 #ifdef CONFIG_STA_SUPPORT
1696 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1698 pDesired_ht_phy
= &pAd
->StaCfg
.DesiredHtPhyInfo
;
1699 DesiredMcs
= pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
;
1700 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1703 #endif // CONFIG_STA_SUPPORT //
1706 if (pDesired_ht_phy
== NULL
)
1708 DBGPRINT(RT_DEBUG_ERROR
, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx
));
1711 RTMPZeroMemory(pDesired_ht_phy
, sizeof(RT_HT_PHY_INFO
));
1713 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs
));
1714 // Check the validity of MCS
1715 if ((TxStream
== 1) && ((DesiredMcs
>= MCS_8
) && (DesiredMcs
<= MCS_15
)))
1717 DBGPRINT(RT_DEBUG_WARN
, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs
));
1721 if ((pAd
->CommonCfg
.DesiredHtPhy
.ChannelWidth
== BW_20
) && (DesiredMcs
== MCS_32
))
1723 DBGPRINT(RT_DEBUG_WARN
, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1727 pDesired_ht_phy
->bHtEnable
= TRUE
;
1729 // Decide desired Tx MCS
1733 if (DesiredMcs
== MCS_AUTO
)
1735 pDesired_ht_phy
->MCSSet
[0]= 0xff;
1736 pDesired_ht_phy
->MCSSet
[1]= 0x00;
1738 else if (DesiredMcs
<= MCS_7
)
1740 pDesired_ht_phy
->MCSSet
[0]= 1<<DesiredMcs
;
1741 pDesired_ht_phy
->MCSSet
[1]= 0x00;
1746 if (DesiredMcs
== MCS_AUTO
)
1748 pDesired_ht_phy
->MCSSet
[0]= 0xff;
1749 pDesired_ht_phy
->MCSSet
[1]= 0xff;
1751 else if (DesiredMcs
<= MCS_15
)
1755 mode
= DesiredMcs
/ 8;
1757 pDesired_ht_phy
->MCSSet
[mode
] = (1 << (DesiredMcs
- mode
* 8));
1762 if (DesiredMcs
== MCS_AUTO
)
1764 /* MCS0 ~ MCS23, 3 bytes */
1765 pDesired_ht_phy
->MCSSet
[0]= 0xff;
1766 pDesired_ht_phy
->MCSSet
[1]= 0xff;
1767 pDesired_ht_phy
->MCSSet
[2]= 0xff;
1769 else if (DesiredMcs
<= MCS_23
)
1773 mode
= DesiredMcs
/ 8;
1775 pDesired_ht_phy
->MCSSet
[mode
] = (1 << (DesiredMcs
- mode
* 8));
1780 if(pAd
->CommonCfg
.DesiredHtPhy
.ChannelWidth
== BW_40
)
1782 if (DesiredMcs
== MCS_AUTO
|| DesiredMcs
== MCS_32
)
1783 pDesired_ht_phy
->MCSSet
[4] = 0x1;
1786 // update HT Rate setting
1787 if (pAd
->OpMode
== OPMODE_STA
)
1788 MlmeUpdateHtTxRates(pAd
, BSS0
);
1790 MlmeUpdateHtTxRates(pAd
, apidx
);
1795 ========================================================================
1796 Routine Description:
1797 Update HT IE from our capability.
1800 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1803 ========================================================================
1805 VOID
RTMPUpdateHTIE(
1806 IN RT_HT_CAPABILITY
*pRtHt
,
1808 OUT HT_CAPABILITY_IE
*pHtCapability
,
1809 OUT ADD_HT_INFO_IE
*pAddHtInfo
)
1811 RTMPZeroMemory(pHtCapability
, sizeof(HT_CAPABILITY_IE
));
1812 RTMPZeroMemory(pAddHtInfo
, sizeof(ADD_HT_INFO_IE
));
1814 pHtCapability
->HtCapInfo
.ChannelWidth
= pRtHt
->ChannelWidth
;
1815 pHtCapability
->HtCapInfo
.MimoPs
= pRtHt
->MimoPs
;
1816 pHtCapability
->HtCapInfo
.GF
= pRtHt
->GF
;
1817 pHtCapability
->HtCapInfo
.ShortGIfor20
= pRtHt
->ShortGIfor20
;
1818 pHtCapability
->HtCapInfo
.ShortGIfor40
= pRtHt
->ShortGIfor40
;
1819 pHtCapability
->HtCapInfo
.TxSTBC
= pRtHt
->TxSTBC
;
1820 pHtCapability
->HtCapInfo
.RxSTBC
= pRtHt
->RxSTBC
;
1821 pHtCapability
->HtCapInfo
.AMsduSize
= pRtHt
->AmsduSize
;
1822 pHtCapability
->HtCapParm
.MaxRAmpduFactor
= pRtHt
->MaxRAmpduFactor
;
1823 pHtCapability
->HtCapParm
.MpduDensity
= pRtHt
->MpduDensity
;
1825 pAddHtInfo
->AddHtInfo
.ExtChanOffset
= pRtHt
->ExtChanOffset
;
1826 pAddHtInfo
->AddHtInfo
.RecomWidth
= pRtHt
->RecomWidth
;
1827 pAddHtInfo
->AddHtInfo2
.OperaionMode
= pRtHt
->OperaionMode
;
1828 pAddHtInfo
->AddHtInfo2
.NonGfPresent
= pRtHt
->NonGfPresent
;
1829 RTMPMoveMemory(pAddHtInfo
->MCSSet
, /*pRtHt->MCSSet*/pMcsSet
, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1831 DBGPRINT(RT_DEBUG_TRACE
,("RTMPUpdateHTIE <== \n"));
1833 #endif // DOT11_N_SUPPORT //
1836 ========================================================================
1838 Add Client security information into ASIC WCID table and IVEIV table.
1840 ========================================================================
1842 VOID
RTMPAddWcidAttributeEntry(
1843 IN PRTMP_ADAPTER pAd
,
1847 IN MAC_TABLE_ENTRY
*pEntry
)
1849 UINT32 WCIDAttri
= 0;
1855 #ifdef CONFIG_STA_SUPPORT
1856 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1860 DBGPRINT(RT_DEBUG_ERROR
, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx
));
1864 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
1865 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
1866 // the AID:2~ assign to mesh link entry.
1872 #endif // CONFIG_STA_SUPPORT //
1875 // Update WCID attribute table
1876 offset
= MAC_WCID_ATTRIBUTE_BASE
+ (Wcid
* HW_WCID_ATTRI_SIZE
);
1878 #ifdef CONFIG_STA_SUPPORT
1879 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1881 if (pEntry
&& pEntry
->ValidAsMesh
)
1882 WCIDAttri
= (CipherAlg
<<1) | PAIRWISEKEYTABLE
;
1883 #ifdef QOS_DLS_SUPPORT
1884 else if ((pEntry
) && (pEntry
->ValidAsDls
) &&
1885 ((CipherAlg
== CIPHER_TKIP
) ||
1886 (CipherAlg
== CIPHER_TKIP_NO_MIC
) ||
1887 (CipherAlg
== CIPHER_AES
) ||
1888 (CipherAlg
== CIPHER_NONE
)))
1889 WCIDAttri
= (CipherAlg
<<1) | PAIRWISEKEYTABLE
;
1890 #endif // QOS_DLS_SUPPORT //
1892 WCIDAttri
= (CipherAlg
<<1) | SHAREDKEYTABLE
;
1894 #endif // CONFIG_STA_SUPPORT //
1896 RTMP_IO_WRITE32(pAd
, offset
, WCIDAttri
);
1899 // Update IV/EIV table
1900 offset
= MAC_IVEIV_TABLE_BASE
+ (Wcid
* HW_IVEIV_ENTRY_SIZE
);
1903 if ((CipherAlg
== CIPHER_TKIP
) || (CipherAlg
== CIPHER_TKIP_NO_MIC
) || (CipherAlg
== CIPHER_AES
))
1905 // Eiv bit on. keyid always is 0 for pairwise key
1906 IVEIV
= (KeyIdx
<<6) | 0x20;
1910 // WEP KeyIdx is default tx key.
1911 IVEIV
= (KeyIdx
<< 6);
1914 // For key index and ext IV bit, so only need to update the position(offset+3).
1916 RTMP_IO_WRITE8(pAd
, offset
+3, IVEIV
);
1917 #endif // RTMP_MAC_PCI //
1919 DBGPRINT(RT_DEBUG_TRACE
,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid
, KeyIdx
, CipherName
[CipherAlg
]));
1920 DBGPRINT(RT_DEBUG_TRACE
,(" WCIDAttri = 0x%x \n", WCIDAttri
));
1925 ==========================================================================
1927 Parse encryption type
1929 pAdapter Pointer to our adapter
1930 wrq Pointer to the ioctl argument
1936 ==========================================================================
1938 PSTRING
GetEncryptType(CHAR enc
)
1940 if(enc
== Ndis802_11WEPDisabled
)
1942 if(enc
== Ndis802_11WEPEnabled
)
1944 if(enc
== Ndis802_11Encryption2Enabled
)
1946 if(enc
== Ndis802_11Encryption3Enabled
)
1948 if(enc
== Ndis802_11Encryption4Enabled
)
1954 PSTRING
GetAuthMode(CHAR auth
)
1956 if(auth
== Ndis802_11AuthModeOpen
)
1958 if(auth
== Ndis802_11AuthModeShared
)
1960 if(auth
== Ndis802_11AuthModeAutoSwitch
)
1962 if(auth
== Ndis802_11AuthModeWPA
)
1964 if(auth
== Ndis802_11AuthModeWPAPSK
)
1966 if(auth
== Ndis802_11AuthModeWPANone
)
1968 if(auth
== Ndis802_11AuthModeWPA2
)
1970 if(auth
== Ndis802_11AuthModeWPA2PSK
)
1972 if(auth
== Ndis802_11AuthModeWPA1WPA2
)
1974 if(auth
== Ndis802_11AuthModeWPA1PSKWPA2PSK
)
1975 return "WPA1PSKWPA2PSK";
1982 ==========================================================================
1984 Get site survey results
1986 pAdapter Pointer to our adapter
1987 wrq Pointer to the ioctl argument
1994 1.) UI needs to wait 4 seconds after issue a site survey command
1995 2.) iwpriv ra0 get_site_survey
1996 3.) UI needs to prepare at least 4096bytes to get the results
1997 ==========================================================================
1999 #define LINE_LEN (4+33+20+23+9+7+3) // Channel+SSID+Bssid+Security+Signal+WiressMode+NetworkType
2000 #ifdef CONFIG_STA_SUPPORT
2001 #endif // CONFIG_STA_SUPPORT //
2002 VOID
RTMPCommSiteSurveyData(
2007 UINT Rssi_Quality
= 0;
2008 NDIS_802_11_NETWORK_TYPE wireless_mode
;
2009 CHAR Ssid
[MAX_LEN_OF_SSID
+1];
2010 STRING SecurityStr
[32] = {0};
2011 NDIS_802_11_ENCRYPTION_STATUS ap_cipher
= Ndis802_11EncryptionDisabled
;
2012 NDIS_802_11_AUTHENTICATION_MODE ap_auth_mode
= Ndis802_11AuthModeOpen
;
2014 memset(Ssid
, 0 ,(MAX_LEN_OF_SSID
+1));
2017 sprintf(msg
+strlen(msg
),"%-4d", pBss
->Channel
);
2019 memcpy(Ssid
, pBss
->Ssid
, pBss
->SsidLen
);
2020 Ssid
[pBss
->SsidLen
] = '\0';
2021 sprintf(msg
+strlen(msg
),"%-33s", Ssid
);
2023 sprintf(msg
+strlen(msg
),"%02x:%02x:%02x:%02x:%02x:%02x ",
2032 if ((Ndis802_11AuthModeWPA
<= pBss
->AuthMode
) &&
2033 (pBss
->AuthMode
<= Ndis802_11AuthModeWPA1PSKWPA2PSK
))
2035 if (pBss
->AuthModeAux
== Ndis802_11AuthModeWPANone
)
2037 ap_auth_mode
= pBss
->AuthMode
;
2038 if (pBss
->WPA
.PairCipherAux
== Ndis802_11WEPDisabled
)
2039 ap_cipher
= pBss
->WPA
.PairCipher
;
2041 ap_cipher
= Ndis802_11Encryption4Enabled
;
2043 else if (pBss
->AuthModeAux
== Ndis802_11AuthModeOpen
)
2045 ap_auth_mode
= pBss
->AuthMode
;
2046 if ((ap_auth_mode
== Ndis802_11AuthModeWPA
) ||
2047 (ap_auth_mode
== Ndis802_11AuthModeWPAPSK
))
2049 if (pBss
->WPA
.PairCipherAux
== Ndis802_11WEPDisabled
)
2050 ap_cipher
= pBss
->WPA
.PairCipher
;
2052 ap_cipher
= Ndis802_11Encryption4Enabled
;
2054 else if ((ap_auth_mode
== Ndis802_11AuthModeWPA2
) ||
2055 (ap_auth_mode
== Ndis802_11AuthModeWPA2PSK
))
2057 if (pBss
->WPA2
.PairCipherAux
== Ndis802_11WEPDisabled
)
2058 ap_cipher
= pBss
->WPA2
.PairCipher
;
2060 ap_cipher
= Ndis802_11Encryption4Enabled
;
2063 else if ((pBss
->AuthMode
== Ndis802_11AuthModeWPAPSK
) ||
2064 (pBss
->AuthMode
== Ndis802_11AuthModeWPA2PSK
))
2066 if ((pBss
->AuthModeAux
== Ndis802_11AuthModeWPAPSK
) ||
2067 (pBss
->AuthModeAux
== Ndis802_11AuthModeWPA2PSK
))
2068 ap_auth_mode
= Ndis802_11AuthModeWPA1PSKWPA2PSK
;
2070 ap_auth_mode
= pBss
->AuthMode
;
2072 if (pBss
->WPA
.PairCipher
!= pBss
->WPA2
.PairCipher
)
2073 ap_cipher
= Ndis802_11Encryption4Enabled
;
2074 else if ((pBss
->WPA
.PairCipher
== pBss
->WPA2
.PairCipher
) &&
2075 (pBss
->WPA
.PairCipherAux
!= pBss
->WPA2
.PairCipherAux
))
2076 ap_cipher
= Ndis802_11Encryption4Enabled
;
2077 else if ((pBss
->WPA
.PairCipher
== pBss
->WPA2
.PairCipher
) &&
2078 (pBss
->WPA
.PairCipherAux
== pBss
->WPA2
.PairCipherAux
) &&
2079 (pBss
->WPA
.PairCipherAux
!= Ndis802_11WEPDisabled
))
2080 ap_cipher
= Ndis802_11Encryption4Enabled
;
2081 else if ((pBss
->WPA
.PairCipher
== pBss
->WPA2
.PairCipher
) &&
2082 (pBss
->WPA
.PairCipherAux
== pBss
->WPA2
.PairCipherAux
) &&
2083 (pBss
->WPA
.PairCipherAux
== Ndis802_11WEPDisabled
))
2084 ap_cipher
= pBss
->WPA
.PairCipher
;
2086 else if ((pBss
->AuthMode
== Ndis802_11AuthModeWPA
) ||
2087 (pBss
->AuthMode
== Ndis802_11AuthModeWPA2
))
2089 if ((pBss
->AuthModeAux
== Ndis802_11AuthModeWPA
) ||
2090 (pBss
->AuthMode
== Ndis802_11AuthModeWPA2
))
2091 ap_auth_mode
= Ndis802_11AuthModeWPA1WPA2
;
2093 ap_auth_mode
= pBss
->AuthMode
;
2095 if (pBss
->WPA
.PairCipher
!= pBss
->WPA2
.PairCipher
)
2096 ap_cipher
= Ndis802_11Encryption4Enabled
;
2097 else if ((pBss
->WPA
.PairCipher
== pBss
->WPA2
.PairCipher
) &&
2098 (pBss
->WPA
.PairCipherAux
!= pBss
->WPA2
.PairCipherAux
))
2099 ap_cipher
= Ndis802_11Encryption4Enabled
;
2100 else if ((pBss
->WPA
.PairCipher
== pBss
->WPA2
.PairCipher
) &&
2101 (pBss
->WPA
.PairCipherAux
== pBss
->WPA2
.PairCipherAux
) &&
2102 (pBss
->WPA
.PairCipherAux
!= Ndis802_11WEPDisabled
))
2103 ap_cipher
= Ndis802_11Encryption4Enabled
;
2104 else if ((pBss
->WPA
.PairCipher
== pBss
->WPA2
.PairCipher
) &&
2105 (pBss
->WPA
.PairCipherAux
== pBss
->WPA2
.PairCipherAux
) &&
2106 (pBss
->WPA
.PairCipherAux
== Ndis802_11WEPDisabled
))
2107 ap_cipher
= pBss
->WPA
.PairCipher
;
2110 sprintf(SecurityStr
, "%s/%s", GetAuthMode((CHAR
)ap_auth_mode
), GetEncryptType((CHAR
)ap_cipher
));
2114 ap_auth_mode
= pBss
->AuthMode
;
2115 ap_cipher
= pBss
->WepStatus
;
2116 if (ap_cipher
== Ndis802_11WEPDisabled
)
2117 sprintf(SecurityStr
, "NONE");
2118 else if (ap_cipher
== Ndis802_11WEPEnabled
)
2119 sprintf(SecurityStr
, "WEP");
2121 sprintf(SecurityStr
, "%s/%s", GetAuthMode((CHAR
)ap_auth_mode
), GetEncryptType((CHAR
)ap_cipher
));
2124 sprintf(msg
+strlen(msg
), "%-23s", SecurityStr
);
2127 Rssi
= (INT
)pBss
->Rssi
;
2130 else if (Rssi
>= -80) // between -50 ~ -80dbm
2131 Rssi_Quality
= (UINT
)(24 + ((Rssi
+ 80) * 26)/10);
2132 else if (Rssi
>= -90) // between -80 ~ -90dbm
2133 Rssi_Quality
= (UINT
)(((Rssi
+ 90) * 26)/10);
2136 sprintf(msg
+strlen(msg
),"%-9d", Rssi_Quality
);
2138 wireless_mode
= NetworkTypeInUseSanity(pBss
);
2139 if (wireless_mode
== Ndis802_11FH
||
2140 wireless_mode
== Ndis802_11DS
)
2141 sprintf(msg
+strlen(msg
),"%-7s", "11b");
2142 else if (wireless_mode
== Ndis802_11OFDM5
)
2143 sprintf(msg
+strlen(msg
),"%-7s", "11a");
2144 else if (wireless_mode
== Ndis802_11OFDM5_N
)
2145 sprintf(msg
+strlen(msg
),"%-7s", "11a/n");
2146 else if (wireless_mode
== Ndis802_11OFDM24
)
2147 sprintf(msg
+strlen(msg
),"%-7s", "11b/g");
2148 else if (wireless_mode
== Ndis802_11OFDM24_N
)
2149 sprintf(msg
+strlen(msg
),"%-7s", "11b/g/n");
2151 sprintf(msg
+strlen(msg
),"%-7s", "unknow");
2153 if (pBss
->BssType
== BSS_ADHOC
)
2154 sprintf(msg
+strlen(msg
),"%-3s", " Ad");
2156 sprintf(msg
+strlen(msg
),"%-3s", " In");
2158 sprintf(msg
+strlen(msg
),"\n");
2163 VOID
RTMPIoctlGetSiteSurvey(
2164 IN PRTMP_ADAPTER pAdapter
,
2165 IN
struct iwreq
*wrq
)
2171 INT max_len
= LINE_LEN
;
2174 #ifdef CONFIG_STA_SUPPORT
2175 #endif // CONFIG_STA_SUPPORT //
2177 os_alloc_mem(NULL
, (PUCHAR
*)&msg
, sizeof(CHAR
)*((MAX_LEN_OF_BSS_TABLE
)*max_len
));
2181 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
2185 memset(msg
, 0 ,(MAX_LEN_OF_BSS_TABLE
)*max_len
);
2186 sprintf(msg
,"%s","\n");
2187 sprintf(msg
+strlen(msg
),"%-4s%-33s%-20s%-23s%-9s%-7s%-3s\n",
2188 "Ch", "SSID", "BSSID", "Security", "Siganl(%)", "W-Mode", " NT");
2190 #ifdef CONFIG_STA_SUPPORT
2192 #endif // CONFIG_STA_SUPPORT //
2195 #ifdef CONFIG_STA_SUPPORT
2196 pAdapter
->StaCfg
.bScanReqIsFromWebUI
= TRUE
;
2197 while ((ScanRunning(pAdapter
) == TRUE
) && (WaitCnt
++ < 200))
2199 #endif // CONFIG_STA_SUPPORT //
2201 for(i
=0; i
<pAdapter
->ScanTab
.BssNr
;i
++)
2203 pBss
= &pAdapter
->ScanTab
.BssEntry
[i
];
2205 if( pBss
->Channel
==0)
2208 if((strlen(msg
)+max_len
) >= IW_SCAN_MAX_DATA
)
2212 RTMPCommSiteSurveyData(msg
, pBss
);
2214 #ifdef CONFIG_STA_SUPPORT
2216 #endif // CONFIG_STA_SUPPORT //
2219 #ifdef CONFIG_STA_SUPPORT
2220 pAdapter
->StaCfg
.bScanReqIsFromWebUI
= FALSE
;
2221 #endif // CONFIG_STA_SUPPORT //
2222 wrq
->u
.data
.length
= strlen(msg
);
2223 Status
= copy_to_user(wrq
->u
.data
.pointer
, msg
, wrq
->u
.data
.length
);
2225 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq
->u
.data
.length
));
2226 os_free_mem(NULL
, (PUCHAR
)msg
);
2229 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
2230 VOID
RTMPIoctlGetMacTable(
2231 IN PRTMP_ADAPTER pAd
,
2232 IN
struct iwreq
*wrq
)
2235 RT_802_11_MAC_TABLE MacTab
;
2239 for (i
=0; i
<MAX_LEN_OF_MAC_TABLE
; i
++)
2241 if (pAd
->MacTab
.Content
[i
].ValidAsCLI
&& (pAd
->MacTab
.Content
[i
].Sst
== SST_ASSOC
))
2243 COPY_MAC_ADDR(MacTab
.Entry
[MacTab
.Num
].Addr
, &pAd
->MacTab
.Content
[i
].Addr
);
2244 MacTab
.Entry
[MacTab
.Num
].Aid
= (UCHAR
)pAd
->MacTab
.Content
[i
].Aid
;
2245 MacTab
.Entry
[MacTab
.Num
].Psm
= pAd
->MacTab
.Content
[i
].PsMode
;
2246 #ifdef DOT11_N_SUPPORT
2247 MacTab
.Entry
[MacTab
.Num
].MimoPs
= pAd
->MacTab
.Content
[i
].MmpsMode
;
2248 #endif // DOT11_N_SUPPORT //
2250 // Fill in RSSI per entry
2251 MacTab
.Entry
[MacTab
.Num
].AvgRssi0
= pAd
->MacTab
.Content
[i
].RssiSample
.AvgRssi0
;
2252 MacTab
.Entry
[MacTab
.Num
].AvgRssi1
= pAd
->MacTab
.Content
[i
].RssiSample
.AvgRssi1
;
2253 MacTab
.Entry
[MacTab
.Num
].AvgRssi2
= pAd
->MacTab
.Content
[i
].RssiSample
.AvgRssi2
;
2255 // the connected time per entry
2256 MacTab
.Entry
[MacTab
.Num
].ConnectedTime
= pAd
->MacTab
.Content
[i
].StaConnectTime
;
2257 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.MCS
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.MCS
;
2258 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.BW
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.BW
;
2259 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.ShortGI
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.ShortGI
;
2260 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.STBC
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.STBC
;
2261 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.rsv
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.rsv
;
2262 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.MODE
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.MODE
;
2263 MacTab
.Entry
[MacTab
.Num
].TxRate
.word
= pAd
->MacTab
.Content
[i
].HTPhyMode
.word
;
2268 wrq
->u
.data
.length
= sizeof(RT_802_11_MAC_TABLE
);
2269 if (copy_to_user(wrq
->u
.data
.pointer
, &MacTab
, wrq
->u
.data
.length
))
2271 DBGPRINT(RT_DEBUG_TRACE
, ("%s: copy_to_user() fail\n", __FUNCTION__
));
2274 msg
= kmalloc(sizeof(CHAR
)*(MAX_LEN_OF_MAC_TABLE
*MAC_LINE_LEN
), MEM_ALLOC_FLAG
);
2277 DBGPRINT(RT_DEBUG_ERROR
, ("%s():Alloc memory failed\n", __FUNCTION__
));
2280 memset(msg
, 0 ,MAX_LEN_OF_MAC_TABLE
*MAC_LINE_LEN
);
2281 sprintf(msg
,"%s","\n");
2282 sprintf(msg
+strlen(msg
),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
2283 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
2285 for (i
=0; i
<MAX_LEN_OF_MAC_TABLE
; i
++)
2287 PMAC_TABLE_ENTRY pEntry
= &pAd
->MacTab
.Content
[i
];
2288 if (pEntry
->ValidAsCLI
&& (pEntry
->Sst
== SST_ASSOC
))
2290 if((strlen(msg
)+MAC_LINE_LEN
) >= (MAX_LEN_OF_MAC_TABLE
*MAC_LINE_LEN
) )
2292 sprintf(msg
+strlen(msg
),"%02x%02x%02x%02x%02x%02x ",
2293 pEntry
->Addr
[0], pEntry
->Addr
[1], pEntry
->Addr
[2],
2294 pEntry
->Addr
[3], pEntry
->Addr
[4], pEntry
->Addr
[5]);
2295 sprintf(msg
+strlen(msg
),"%-4d", (int)pEntry
->Aid
);
2296 sprintf(msg
+strlen(msg
),"%-4d", (int)pEntry
->PsMode
);
2297 sprintf(msg
+strlen(msg
),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
2298 sprintf(msg
+strlen(msg
),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
2299 sprintf(msg
+strlen(msg
),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
2300 sprintf(msg
+strlen(msg
),"%-6d",RateIdToMbps
[pAd
->MacTab
.Content
[i
].CurrTxRate
]);
2301 sprintf(msg
+strlen(msg
),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
2304 // for compatible with old API just do the printk to console
2305 //wrq->u.data.length = strlen(msg);
2306 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
2308 DBGPRINT(RT_DEBUG_TRACE
, ("%s", msg
));
2315 #ifdef DOT11_N_SUPPORT
2316 INT
Set_BASetup_Proc(
2317 IN PRTMP_ADAPTER pAd
,
2322 STRING sepValue
[] = ":", DASH
= '-';
2324 MAC_TABLE_ENTRY
*pEntry
;
2327 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
2328 =>The six 2 digit hex-decimal number previous are the Mac address,
2329 =>The seventh decimal number is the tid value.
2331 //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg));
2333 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2336 token
= strchr(arg
, DASH
);
2337 if ((token
!= NULL
) && (strlen(token
)>1))
2339 tid
= (UCHAR
) simple_strtol((token
+1), 0, 10);
2344 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2346 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2348 AtoH(token
, (&mac
[i
]), 1);
2353 DBGPRINT(RT_DEBUG_OFF
, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n",
2354 mac
[0], mac
[1], mac
[2], mac
[3], mac
[4], mac
[5], tid
));
2356 pEntry
= MacTableLookup(pAd
, (PUCHAR
) mac
);
2359 DBGPRINT(RT_DEBUG_OFF
, ("\nSetup BA Session: Tid = %d\n", tid
));
2360 BAOriSessionSetUp(pAd
, pEntry
, tid
, 0, 100, TRUE
);
2370 INT
Set_BADecline_Proc(
2371 IN PRTMP_ADAPTER pAd
,
2376 bBADecline
= simple_strtol(arg
, 0, 10);
2378 if (bBADecline
== 0)
2380 pAd
->CommonCfg
.bBADecline
= FALSE
;
2382 else if (bBADecline
== 1)
2384 pAd
->CommonCfg
.bBADecline
= TRUE
;
2388 return FALSE
; //Invalid argument
2391 DBGPRINT(RT_DEBUG_TRACE
, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd
->CommonCfg
.bBADecline
));
2396 INT
Set_BAOriTearDown_Proc(
2397 IN PRTMP_ADAPTER pAd
,
2402 STRING sepValue
[] = ":", DASH
= '-';
2404 MAC_TABLE_ENTRY
*pEntry
;
2406 //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg));
2408 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2409 =>The six 2 digit hex-decimal number previous are the Mac address,
2410 =>The seventh decimal number is the tid value.
2412 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2415 token
= strchr(arg
, DASH
);
2416 if ((token
!= NULL
) && (strlen(token
)>1))
2418 tid
= simple_strtol((token
+1), 0, 10);
2419 if (tid
> NUM_OF_TID
)
2423 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2425 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2427 AtoH(token
, (&mac
[i
]), 1);
2432 DBGPRINT(RT_DEBUG_OFF
, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x",
2433 mac
[0], mac
[1], mac
[2], mac
[3], mac
[4], mac
[5], tid
));
2435 pEntry
= MacTableLookup(pAd
, (PUCHAR
) mac
);
2438 DBGPRINT(RT_DEBUG_OFF
, ("\nTear down Ori BA Session: Tid = %d\n", tid
));
2439 BAOriSessionTearDown(pAd
, pEntry
->Aid
, tid
, FALSE
, TRUE
);
2449 INT
Set_BARecTearDown_Proc(
2450 IN PRTMP_ADAPTER pAd
,
2455 STRING sepValue
[] = ":", DASH
= '-';
2457 MAC_TABLE_ENTRY
*pEntry
;
2459 //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg));
2461 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2462 =>The six 2 digit hex-decimal number previous are the Mac address,
2463 =>The seventh decimal number is the tid value.
2465 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2468 token
= strchr(arg
, DASH
);
2469 if ((token
!= NULL
) && (strlen(token
)>1))
2471 tid
= simple_strtol((token
+1), 0, 10);
2472 if (tid
> NUM_OF_TID
)
2476 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2478 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2480 AtoH(token
, (&mac
[i
]), 1);
2485 DBGPRINT(RT_DEBUG_OFF
, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x",
2486 mac
[0], mac
[1], mac
[2], mac
[3], mac
[4], mac
[5], tid
));
2488 pEntry
= MacTableLookup(pAd
, (PUCHAR
) mac
);
2491 DBGPRINT(RT_DEBUG_OFF
, ("\nTear down Rec BA Session: Tid = %d\n", tid
));
2492 BARecSessionTearDown(pAd
, pEntry
->Aid
, tid
, FALSE
);
2503 IN PRTMP_ADAPTER pAd
,
2508 HtBw
= simple_strtol(arg
, 0, 10);
2510 pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
= BW_40
;
2511 else if (HtBw
== BW_20
)
2512 pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
= BW_20
;
2514 return FALSE
; //Invalid argument
2518 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
));
2524 IN PRTMP_ADAPTER pAd
,
2527 ULONG HtMcs
, Mcs_tmp
;
2528 #ifdef CONFIG_STA_SUPPORT
2529 BOOLEAN bAutoRate
= FALSE
;
2530 #endif // CONFIG_STA_SUPPORT //
2532 Mcs_tmp
= simple_strtol(arg
, 0, 10);
2534 if (Mcs_tmp
<= 15 || Mcs_tmp
== 32)
2539 #ifdef CONFIG_STA_SUPPORT
2540 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
2542 pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= HtMcs
;
2543 pAd
->StaCfg
.bAutoTxRateSwitch
= (HtMcs
== MCS_AUTO
) ? TRUE
:FALSE
;
2544 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2545 pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
, pAd
->StaCfg
.bAutoTxRateSwitch
));
2547 if ((pAd
->CommonCfg
.PhyMode
< PHY_11ABGN_MIXED
) ||
2548 (pAd
->MacTab
.Content
[BSSID_WCID
].HTPhyMode
.field
.MODE
< MODE_HTMIX
))
2550 if ((pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
!= MCS_AUTO
) &&
2551 (HtMcs
>= 0 && HtMcs
<= 3) &&
2552 (pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
== FIXED_TXMODE_CCK
))
2554 RTMPSetDesiredRates(pAd
, (LONG
) (RateIdToMbps
[HtMcs
] * 1000000));
2556 else if ((pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
!= MCS_AUTO
) &&
2557 (HtMcs
>= 0 && HtMcs
<= 7) &&
2558 (pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
== FIXED_TXMODE_OFDM
))
2560 RTMPSetDesiredRates(pAd
, (LONG
) (RateIdToMbps
[HtMcs
+4] * 1000000));
2567 pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_AUTO
;
2568 RTMPSetDesiredRates(pAd
, -1);
2570 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
));
2575 #endif // CONFIG_STA_SUPPORT //
2583 IN PRTMP_ADAPTER pAd
,
2588 HtGi
= simple_strtol(arg
, 0, 10);
2590 if ( HtGi
== GI_400
)
2591 pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
= GI_400
;
2592 else if ( HtGi
== GI_800
)
2593 pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
= GI_800
;
2595 return FALSE
; //Invalid argument
2599 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
));
2605 INT
Set_HtTxBASize_Proc(
2606 IN PRTMP_ADAPTER pAd
,
2611 Size
= simple_strtol(arg
, 0, 10);
2613 if (Size
<=0 || Size
>=64)
2617 pAd
->CommonCfg
.TxBASize
= Size
-1;
2618 DBGPRINT(RT_DEBUG_ERROR
, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size
));
2623 INT
Set_HtDisallowTKIP_Proc(
2624 IN PRTMP_ADAPTER pAd
,
2629 Value
= simple_strtol(arg
, 0, 10);
2633 pAd
->CommonCfg
.HT_DisallowTKIP
= TRUE
;
2637 pAd
->CommonCfg
.HT_DisallowTKIP
= FALSE
;
2640 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtDisallowTKIP_Proc ::%s\n",
2641 (pAd
->CommonCfg
.HT_DisallowTKIP
== TRUE
) ? "enabled" : "disabled"));
2646 INT
Set_HtOpMode_Proc(
2647 IN PRTMP_ADAPTER pAd
,
2653 Value
= simple_strtol(arg
, 0, 10);
2655 if (Value
== HTMODE_GF
)
2656 pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
= HTMODE_GF
;
2657 else if ( Value
== HTMODE_MM
)
2658 pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
= HTMODE_MM
;
2660 return FALSE
; //Invalid argument
2664 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
));
2670 INT
Set_HtStbc_Proc(
2671 IN PRTMP_ADAPTER pAd
,
2677 Value
= simple_strtol(arg
, 0, 10);
2679 if (Value
== STBC_USE
)
2680 pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
= STBC_USE
;
2681 else if ( Value
== STBC_NONE
)
2682 pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
= STBC_NONE
;
2684 return FALSE
; //Invalid argument
2688 DBGPRINT(RT_DEBUG_TRACE
, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
));
2694 IN PRTMP_ADAPTER pAd
,
2700 Value
= simple_strtol(arg
, 0, 10);
2702 pAd
->HTCEnable
= FALSE
;
2703 else if ( Value
==1 )
2704 pAd
->HTCEnable
= TRUE
;
2706 return FALSE
; //Invalid argument
2708 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd
->HTCEnable
));
2713 INT
Set_HtExtcha_Proc(
2714 IN PRTMP_ADAPTER pAd
,
2720 Value
= simple_strtol(arg
, 0, 10);
2723 pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
= EXTCHA_BELOW
;
2724 else if ( Value
==1 )
2725 pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
= EXTCHA_ABOVE
;
2727 return FALSE
; //Invalid argument
2731 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
));
2736 INT
Set_HtMpduDensity_Proc(
2737 IN PRTMP_ADAPTER pAd
,
2742 Value
= simple_strtol(arg
, 0, 10);
2744 if (Value
<=7 && Value
>= 0)
2745 pAd
->CommonCfg
.BACapability
.field
.MpduDensity
= Value
;
2747 pAd
->CommonCfg
.BACapability
.field
.MpduDensity
= 4;
2751 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd
->CommonCfg
.BACapability
.field
.MpduDensity
));
2756 INT
Set_HtBaWinSize_Proc(
2757 IN PRTMP_ADAPTER pAd
,
2762 Value
= simple_strtol(arg
, 0, 10);
2765 if (Value
>=1 && Value
<= 64)
2767 pAd
->CommonCfg
.REGBACapability
.field
.RxBAWinLimit
= Value
;
2768 pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
= Value
;
2772 pAd
->CommonCfg
.REGBACapability
.field
.RxBAWinLimit
= 64;
2773 pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
= 64;
2778 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
));
2784 IN PRTMP_ADAPTER pAd
,
2789 Value
= simple_strtol(arg
, 0, 10);
2792 pAd
->CommonCfg
.bRdg
= FALSE
;
2793 else if ( Value
==1 )
2795 pAd
->HTCEnable
= TRUE
;
2796 pAd
->CommonCfg
.bRdg
= TRUE
;
2799 return FALSE
; //Invalid argument
2803 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd
->CommonCfg
.bRdg
));
2808 INT
Set_HtLinkAdapt_Proc(
2809 IN PRTMP_ADAPTER pAd
,
2814 Value
= simple_strtol(arg
, 0, 10);
2816 pAd
->bLinkAdapt
= FALSE
;
2817 else if ( Value
==1 )
2819 pAd
->HTCEnable
= TRUE
;
2820 pAd
->bLinkAdapt
= TRUE
;
2823 return FALSE
; //Invalid argument
2825 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd
->bLinkAdapt
));
2830 INT
Set_HtAmsdu_Proc(
2831 IN PRTMP_ADAPTER pAd
,
2836 Value
= simple_strtol(arg
, 0, 10);
2838 pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
= FALSE
;
2839 else if ( Value
== 1 )
2840 pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
= TRUE
;
2842 return FALSE
; //Invalid argument
2846 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
));
2851 INT
Set_HtAutoBa_Proc(
2852 IN PRTMP_ADAPTER pAd
,
2857 Value
= simple_strtol(arg
, 0, 10);
2860 pAd
->CommonCfg
.BACapability
.field
.AutoBA
= FALSE
;
2861 pAd
->CommonCfg
.BACapability
.field
.Policy
= BA_NOTUSE
;
2863 else if (Value
== 1)
2865 pAd
->CommonCfg
.BACapability
.field
.AutoBA
= TRUE
;
2866 pAd
->CommonCfg
.BACapability
.field
.Policy
= IMMED_BA
;
2869 return FALSE
; //Invalid argument
2871 pAd
->CommonCfg
.REGBACapability
.field
.AutoBA
= pAd
->CommonCfg
.BACapability
.field
.AutoBA
;
2872 pAd
->CommonCfg
.REGBACapability
.field
.Policy
= pAd
->CommonCfg
.BACapability
.field
.Policy
;
2875 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd
->CommonCfg
.BACapability
.field
.AutoBA
));
2881 INT
Set_HtProtect_Proc(
2882 IN PRTMP_ADAPTER pAd
,
2887 Value
= simple_strtol(arg
, 0, 10);
2889 pAd
->CommonCfg
.bHTProtect
= FALSE
;
2890 else if (Value
== 1)
2891 pAd
->CommonCfg
.bHTProtect
= TRUE
;
2893 return FALSE
; //Invalid argument
2895 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd
->CommonCfg
.bHTProtect
));
2900 INT
Set_SendPSMPAction_Proc(
2901 IN PRTMP_ADAPTER pAd
,
2906 STRING sepValue
[] = ":", DASH
= '-';
2908 MAC_TABLE_ENTRY
*pEntry
;
2910 //DBGPRINT(RT_DEBUG_TRACE,("\n%s\n", arg));
2912 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2913 =>The six 2 digit hex-decimal number previous are the Mac address,
2914 =>The seventh decimal number is the mode value.
2916 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2919 token
= strchr(arg
, DASH
);
2920 if ((token
!= NULL
) && (strlen(token
)>1))
2922 mode
= simple_strtol((token
+1), 0, 10);
2923 if (mode
> MMPS_ENABLE
)
2927 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2929 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2931 AtoH(token
, (&mac
[i
]), 1);
2936 DBGPRINT(RT_DEBUG_OFF
, ("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x",
2937 mac
[0], mac
[1], mac
[2], mac
[3], mac
[4], mac
[5], mode
));
2939 pEntry
= MacTableLookup(pAd
, mac
);
2942 DBGPRINT(RT_DEBUG_OFF
, ("\nSendPSMPAction MIPS mode = %d\n", mode
));
2943 SendPSMPAction(pAd
, pEntry
->Aid
, mode
);
2954 INT
Set_HtMIMOPSmode_Proc(
2955 IN PRTMP_ADAPTER pAd
,
2960 Value
= simple_strtol(arg
, 0, 10);
2962 if (Value
<=3 && Value
>= 0)
2963 pAd
->CommonCfg
.BACapability
.field
.MMPSmode
= Value
;
2965 pAd
->CommonCfg
.BACapability
.field
.MMPSmode
= 3;
2969 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd
->CommonCfg
.BACapability
.field
.MMPSmode
));
2975 INT
Set_ForceShortGI_Proc(
2976 IN PRTMP_ADAPTER pAd
,
2981 Value
= simple_strtol(arg
, 0, 10);
2983 pAd
->WIFItestbed
.bShortGI
= FALSE
;
2984 else if (Value
== 1)
2985 pAd
->WIFItestbed
.bShortGI
= TRUE
;
2987 return FALSE
; //Invalid argument
2991 DBGPRINT(RT_DEBUG_TRACE
, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd
->WIFItestbed
.bShortGI
));
2998 INT
Set_ForceGF_Proc(
2999 IN PRTMP_ADAPTER pAd
,
3004 Value
= simple_strtol(arg
, 0, 10);
3006 pAd
->WIFItestbed
.bGreenField
= FALSE
;
3007 else if (Value
== 1)
3008 pAd
->WIFItestbed
.bGreenField
= TRUE
;
3010 return FALSE
; //Invalid argument
3014 DBGPRINT(RT_DEBUG_TRACE
, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd
->WIFItestbed
.bGreenField
));
3019 INT
Set_HtMimoPs_Proc(
3020 IN PRTMP_ADAPTER pAd
,
3025 Value
= simple_strtol(arg
, 0, 10);
3027 pAd
->CommonCfg
.bMIMOPSEnable
= FALSE
;
3028 else if (Value
== 1)
3029 pAd
->CommonCfg
.bMIMOPSEnable
= TRUE
;
3031 return FALSE
; //Invalid argument
3033 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd
->CommonCfg
.bMIMOPSEnable
));
3037 #endif // DOT11_N_SUPPORT //
3040 #ifdef DOT11_N_SUPPORT
3042 IN PRTMP_ADAPTER pAd
)
3044 OID_SET_HT_PHYMODE SetHT
;
3046 if (pAd
->CommonCfg
.PhyMode
< PHY_11ABGN_MIXED
)
3049 SetHT
.PhyMode
= pAd
->CommonCfg
.PhyMode
;
3050 SetHT
.TransmitNo
= ((UCHAR
)pAd
->Antenna
.field
.TxPath
);
3051 SetHT
.HtMode
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
;
3052 SetHT
.ExtOffset
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
;
3053 SetHT
.MCS
= MCS_AUTO
;
3054 SetHT
.BW
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
;
3055 SetHT
.STBC
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
;
3056 SetHT
.SHORTGI
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
;
3058 RTMPSetHT(pAd
, &SetHT
);
3062 #endif // DOT11_N_SUPPORT //
3064 INT
Set_FixedTxMode_Proc(
3065 IN PRTMP_ADAPTER pAd
,
3068 UCHAR fix_tx_mode
= FIXED_TXMODE_HT
;
3070 if (strcmp(arg
, "OFDM") == 0 || strcmp(arg
, "ofdm") == 0)
3072 fix_tx_mode
= FIXED_TXMODE_OFDM
;
3074 else if (strcmp(arg
, "CCK") == 0 || strcmp(arg
, "cck") == 0)
3076 fix_tx_mode
= FIXED_TXMODE_CCK
;
3079 #ifdef CONFIG_STA_SUPPORT
3080 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3081 pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
= fix_tx_mode
;
3082 #endif // CONFIG_STA_SUPPORT //
3084 DBGPRINT(RT_DEBUG_TRACE
, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode
));
3089 #ifdef CONFIG_APSTA_MIXED_SUPPORT
3090 INT
Set_OpMode_Proc(
3091 IN PRTMP_ADAPTER pAd
,
3096 Value
= simple_strtol(arg
, 0, 10);
3099 if (RTMP_TEST_FLAG(pAd
, fRTMP_ADAPTER_INTERRUPT_IN_USE
))
3100 #endif // RTMP_MAC_PCI //
3102 DBGPRINT(RT_DEBUG_ERROR
, ("Can not switch operate mode on interface up !! \n"));
3107 pAd
->OpMode
= OPMODE_STA
;
3108 else if (Value
== 1)
3109 pAd
->OpMode
= OPMODE_AP
;
3111 return FALSE
; //Invalid argument
3113 DBGPRINT(RT_DEBUG_TRACE
, ("Set_OpMode_Proc::(OpMode=%s)\n", pAd
->OpMode
== 1 ? "AP Mode" : "STA Mode"));
3117 #endif // CONFIG_APSTA_MIXED_SUPPORT //
3121 INT
Set_LongRetryLimit_Proc(
3122 IN PRTMP_ADAPTER pAdapter
,
3125 TX_RTY_CFG_STRUC tx_rty_cfg
;
3126 UCHAR LongRetryLimit
= (UCHAR
)simple_strtol(arg
, 0, 10);
3128 RTMP_IO_READ32(pAdapter
, TX_RTY_CFG
, &tx_rty_cfg
.word
);
3129 tx_rty_cfg
.field
.LongRtyLimit
= LongRetryLimit
;
3130 RTMP_IO_WRITE32(pAdapter
, TX_RTY_CFG
, tx_rty_cfg
.word
);
3131 DBGPRINT(RT_DEBUG_TRACE
, ("IF Set_LongRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg
.word
));
3135 INT
Set_ShortRetryLimit_Proc(
3136 IN PRTMP_ADAPTER pAdapter
,
3139 TX_RTY_CFG_STRUC tx_rty_cfg
;
3140 UCHAR ShortRetryLimit
= (UCHAR
)simple_strtol(arg
, 0, 10);
3142 RTMP_IO_READ32(pAdapter
, TX_RTY_CFG
, &tx_rty_cfg
.word
);
3143 tx_rty_cfg
.field
.ShortRtyLimit
= ShortRetryLimit
;
3144 RTMP_IO_WRITE32(pAdapter
, TX_RTY_CFG
, tx_rty_cfg
.word
);
3145 DBGPRINT(RT_DEBUG_TRACE
, ("IF Set_ShortRetryLimit_Proc::(tx_rty_cfg=0x%x)\n", tx_rty_cfg
.word
));
3150 /////////////////////////////////////////////////////////////////////////
3151 PSTRING
RTMPGetRalinkAuthModeStr(
3152 IN NDIS_802_11_AUTHENTICATION_MODE authMode
)
3156 case Ndis802_11AuthModeOpen
:
3158 case Ndis802_11AuthModeWPAPSK
:
3160 case Ndis802_11AuthModeShared
:
3162 case Ndis802_11AuthModeWPA
:
3164 case Ndis802_11AuthModeWPA2
:
3166 case Ndis802_11AuthModeWPA2PSK
:
3168 case Ndis802_11AuthModeWPA1PSKWPA2PSK
:
3169 return "WPAPSKWPA2PSK";
3170 case Ndis802_11AuthModeWPA1WPA2
:
3172 case Ndis802_11AuthModeWPANone
:
3179 PSTRING
RTMPGetRalinkEncryModeStr(
3180 IN USHORT encryMode
)
3184 case Ndis802_11WEPDisabled
:
3186 case Ndis802_11WEPEnabled
:
3188 case Ndis802_11Encryption2Enabled
:
3190 case Ndis802_11Encryption3Enabled
:
3192 case Ndis802_11Encryption4Enabled
:
3199 INT
RTMPShowCfgValue(
3200 IN PRTMP_ADAPTER pAd
,
3206 for (PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
= RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
++)
3208 if (!strcmp(pName
, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
))
3210 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->show_proc(pAd
, pBuf
))
3212 break; //Exit for loop.
3216 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
== NULL
)
3218 sprintf(pBuf
, "\n");
3219 for (PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
= RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
++)
3220 sprintf(pBuf
, "%s%s\n", pBuf
, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
);
3227 IN PRTMP_ADAPTER pAd
,
3231 #ifdef CONFIG_STA_SUPPORT
3232 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3233 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.Ssid
);
3234 #endif // CONFIG_STA_SUPPORT //
3238 INT
Show_WirelessMode_Proc(
3239 IN PRTMP_ADAPTER pAd
,
3242 switch(pAd
->CommonCfg
.PhyMode
)
3244 case PHY_11BG_MIXED
:
3245 sprintf(pBuf
, "\t11B/G");
3248 sprintf(pBuf
, "\t11B");
3251 sprintf(pBuf
, "\t11A");
3253 case PHY_11ABG_MIXED
:
3254 sprintf(pBuf
, "\t11A/B/G");
3257 sprintf(pBuf
, "\t11G");
3259 #ifdef DOT11_N_SUPPORT
3260 case PHY_11ABGN_MIXED
:
3261 sprintf(pBuf
, "\t11A/B/G/N");
3264 sprintf(pBuf
, "\t11N only with 2.4G");
3266 case PHY_11GN_MIXED
:
3267 sprintf(pBuf
, "\t11G/N");
3269 case PHY_11AN_MIXED
:
3270 sprintf(pBuf
, "\t11A/N");
3272 case PHY_11BGN_MIXED
:
3273 sprintf(pBuf
, "\t11B/G/N");
3275 case PHY_11AGN_MIXED
:
3276 sprintf(pBuf
, "\t11A/G/N");
3279 sprintf(pBuf
, "\t11N only with 5G");
3281 #endif // DOT11_N_SUPPORT //
3283 sprintf(pBuf
, "\tUnknow Value(%d)", pAd
->CommonCfg
.PhyMode
);
3290 INT
Show_TxBurst_Proc(
3291 IN PRTMP_ADAPTER pAd
,
3294 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bEnableTxBurst
? "TRUE":"FALSE");
3298 INT
Show_TxPreamble_Proc(
3299 IN PRTMP_ADAPTER pAd
,
3302 switch(pAd
->CommonCfg
.TxPreamble
)
3304 case Rt802_11PreambleShort
:
3305 sprintf(pBuf
, "\tShort");
3307 case Rt802_11PreambleLong
:
3308 sprintf(pBuf
, "\tLong");
3310 case Rt802_11PreambleAuto
:
3311 sprintf(pBuf
, "\tAuto");
3314 sprintf(pBuf
, "\tUnknow Value(%lu)", pAd
->CommonCfg
.TxPreamble
);
3321 INT
Show_TxPower_Proc(
3322 IN PRTMP_ADAPTER pAd
,
3325 sprintf(pBuf
, "\t%lu", pAd
->CommonCfg
.TxPowerPercentage
);
3329 INT
Show_Channel_Proc(
3330 IN PRTMP_ADAPTER pAd
,
3333 sprintf(pBuf
, "\t%d", pAd
->CommonCfg
.Channel
);
3337 INT
Show_BGProtection_Proc(
3338 IN PRTMP_ADAPTER pAd
,
3341 switch(pAd
->CommonCfg
.UseBGProtection
)
3344 sprintf(pBuf
, "\tON");
3346 case 2: //Always OFF
3347 sprintf(pBuf
, "\tOFF");
3350 sprintf(pBuf
, "\tAuto");
3353 sprintf(pBuf
, "\tUnknow Value(%lu)", pAd
->CommonCfg
.UseBGProtection
);
3359 INT
Show_RTSThreshold_Proc(
3360 IN PRTMP_ADAPTER pAd
,
3363 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.RtsThreshold
);
3367 INT
Show_FragThreshold_Proc(
3368 IN PRTMP_ADAPTER pAd
,
3371 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.FragmentThreshold
);
3375 #ifdef DOT11_N_SUPPORT
3377 IN PRTMP_ADAPTER pAd
,
3380 if (pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
== BW_40
)
3382 sprintf(pBuf
, "\t40 MHz");
3386 sprintf(pBuf
, "\t20 MHz");
3391 INT
Show_HtMcs_Proc(
3392 IN PRTMP_ADAPTER pAd
,
3396 #ifdef CONFIG_STA_SUPPORT
3397 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3398 sprintf(pBuf
, "\t%u", pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
);
3399 #endif // CONFIG_STA_SUPPORT //
3404 IN PRTMP_ADAPTER pAd
,
3407 switch(pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
)
3410 sprintf(pBuf
, "\tGI_400");
3413 sprintf(pBuf
, "\tGI_800");
3416 sprintf(pBuf
, "\tUnknow Value(%u)", pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
);
3422 INT
Show_HtOpMode_Proc(
3423 IN PRTMP_ADAPTER pAd
,
3426 switch(pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
)
3429 sprintf(pBuf
, "\tGF");
3432 sprintf(pBuf
, "\tMM");
3435 sprintf(pBuf
, "\tUnknow Value(%u)", pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
);
3441 INT
Show_HtExtcha_Proc(
3442 IN PRTMP_ADAPTER pAd
,
3445 switch(pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
)
3448 sprintf(pBuf
, "\tBelow");
3451 sprintf(pBuf
, "\tAbove");
3454 sprintf(pBuf
, "\tUnknow Value(%u)", pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
);
3461 INT
Show_HtMpduDensity_Proc(
3462 IN PRTMP_ADAPTER pAd
,
3465 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.BACapability
.field
.MpduDensity
);
3469 INT
Show_HtBaWinSize_Proc(
3470 IN PRTMP_ADAPTER pAd
,
3473 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
);
3477 INT
Show_HtRdg_Proc(
3478 IN PRTMP_ADAPTER pAd
,
3481 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bRdg
? "TRUE":"FALSE");
3485 INT
Show_HtAmsdu_Proc(
3486 IN PRTMP_ADAPTER pAd
,
3489 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
? "TRUE":"FALSE");
3493 INT
Show_HtAutoBa_Proc(
3494 IN PRTMP_ADAPTER pAd
,
3497 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.BACapability
.field
.AutoBA
? "TRUE":"FALSE");
3500 #endif // DOT11_N_SUPPORT //
3502 INT
Show_CountryRegion_Proc(
3503 IN PRTMP_ADAPTER pAd
,
3506 sprintf(pBuf
, "\t%d", pAd
->CommonCfg
.CountryRegion
);
3510 INT
Show_CountryRegionABand_Proc(
3511 IN PRTMP_ADAPTER pAd
,
3514 sprintf(pBuf
, "\t%d", pAd
->CommonCfg
.CountryRegionForABand
);
3518 INT
Show_CountryCode_Proc(
3519 IN PRTMP_ADAPTER pAd
,
3522 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.CountryCode
);
3526 #ifdef AGGREGATION_SUPPORT
3527 INT
Show_PktAggregate_Proc(
3528 IN PRTMP_ADAPTER pAd
,
3531 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bAggregationCapable
? "TRUE":"FALSE");
3534 #endif // AGGREGATION_SUPPORT //
3537 INT
Show_WmmCapable_Proc(
3538 IN PRTMP_ADAPTER pAd
,
3542 #ifdef CONFIG_STA_SUPPORT
3543 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3544 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bWmmCapable
? "TRUE":"FALSE");
3545 #endif // CONFIG_STA_SUPPORT //
3549 #endif // WMM_SUPPORT //
3551 INT
Show_IEEE80211H_Proc(
3552 IN PRTMP_ADAPTER pAd
,
3555 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bIEEE80211H
? "TRUE":"FALSE");
3559 #ifdef CONFIG_STA_SUPPORT
3560 INT
Show_NetworkType_Proc(
3561 IN PRTMP_ADAPTER pAd
,
3564 switch(pAd
->StaCfg
.BssType
)
3567 sprintf(pBuf
, "\tAdhoc");
3570 sprintf(pBuf
, "\tInfra");
3573 sprintf(pBuf
, "\tAny");
3576 sprintf(pBuf
, "\tMonitor");
3579 sprintf(pBuf
, "\tUnknow Value(%d)", pAd
->StaCfg
.BssType
);
3586 #endif // CONFIG_STA_SUPPORT //
3588 INT
Show_AuthMode_Proc(
3589 IN PRTMP_ADAPTER pAd
,
3592 NDIS_802_11_AUTHENTICATION_MODE AuthMode
= Ndis802_11AuthModeOpen
;
3594 #ifdef CONFIG_STA_SUPPORT
3595 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3596 AuthMode
= pAd
->StaCfg
.AuthMode
;
3597 #endif // CONFIG_STA_SUPPORT //
3599 if ((AuthMode
>= Ndis802_11AuthModeOpen
) &&
3600 (AuthMode
<= Ndis802_11AuthModeWPA1PSKWPA2PSK
))
3601 sprintf(pBuf
, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode
));
3603 sprintf(pBuf
, "\tUnknow Value(%d)", AuthMode
);
3608 INT
Show_EncrypType_Proc(
3609 IN PRTMP_ADAPTER pAd
,
3612 NDIS_802_11_WEP_STATUS WepStatus
= Ndis802_11WEPDisabled
;
3614 #ifdef CONFIG_STA_SUPPORT
3615 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3616 WepStatus
= pAd
->StaCfg
.WepStatus
;
3617 #endif // CONFIG_STA_SUPPORT //
3619 if ((WepStatus
>= Ndis802_11WEPEnabled
) &&
3620 (WepStatus
<= Ndis802_11Encryption4KeyAbsent
))
3621 sprintf(pBuf
, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus
));
3623 sprintf(pBuf
, "\tUnknow Value(%d)", WepStatus
);
3628 INT
Show_DefaultKeyID_Proc(
3629 IN PRTMP_ADAPTER pAd
,
3632 UCHAR DefaultKeyId
= 0;
3634 #ifdef CONFIG_STA_SUPPORT
3635 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3636 DefaultKeyId
= pAd
->StaCfg
.DefaultKeyId
;
3637 #endif // CONFIG_STA_SUPPORT //
3639 sprintf(pBuf
, "\t%d", DefaultKeyId
);
3644 INT
Show_WepKey_Proc(
3645 IN PRTMP_ADAPTER pAd
,
3649 UCHAR Key
[16] = {0}, KeyLength
= 0;
3652 KeyLength
= pAd
->SharedKey
[index
][KeyIdx
].KeyLen
;
3653 NdisMoveMemory(Key
, pAd
->SharedKey
[index
][KeyIdx
].Key
, KeyLength
);
3655 //check key string is ASCII or not
3656 if (RTMPCheckStrPrintAble((PCHAR
)Key
, KeyLength
))
3657 sprintf(pBuf
, "\t%s", Key
);
3661 sprintf(pBuf
, "\t");
3662 for (idx
= 0; idx
< KeyLength
; idx
++)
3663 sprintf(pBuf
+strlen(pBuf
), "%02X", Key
[idx
]);
3669 IN PRTMP_ADAPTER pAd
,
3672 Show_WepKey_Proc(pAd
, 0, pBuf
);
3677 IN PRTMP_ADAPTER pAd
,
3680 Show_WepKey_Proc(pAd
, 1, pBuf
);
3685 IN PRTMP_ADAPTER pAd
,
3688 Show_WepKey_Proc(pAd
, 2, pBuf
);
3693 IN PRTMP_ADAPTER pAd
,
3696 Show_WepKey_Proc(pAd
, 3, pBuf
);
3700 INT
Show_WPAPSK_Proc(
3701 IN PRTMP_ADAPTER pAd
,
3705 UCHAR PMK
[32] = {0};
3708 #ifdef CONFIG_STA_SUPPORT
3709 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3710 NdisMoveMemory(PMK
, pAd
->StaCfg
.PMK
, 32);
3711 #endif // CONFIG_STA_SUPPORT //
3713 sprintf(pBuf
, "\tPMK = ");
3714 for (idx
= 0; idx
< 32; idx
++)
3715 sprintf(pBuf
+strlen(pBuf
), "%02X", PMK
[idx
]);