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 *************************************************************************
28 #include "../rt_config.h"
34 INT Show_WirelessMode_Proc(
38 INT Show_TxBurst_Proc(
42 INT Show_TxPreamble_Proc(
46 INT Show_TxPower_Proc(
50 INT Show_Channel_Proc(
54 INT Show_BGProtection_Proc(
58 INT Show_RTSThreshold_Proc(
62 INT Show_FragThreshold_Proc(
66 #ifdef DOT11_N_SUPPORT
79 INT Show_HtOpMode_Proc(
83 INT Show_HtExtcha_Proc(
87 INT Show_HtMpduDensity_Proc(
91 INT Show_HtBaWinSize_Proc(
99 INT Show_HtAmsdu_Proc(
100 IN PRTMP_ADAPTER pAd,
103 INT Show_HtAutoBa_Proc(
104 IN PRTMP_ADAPTER pAd,
106 #endif // DOT11_N_SUPPORT //
108 INT Show_CountryRegion_Proc(
109 IN PRTMP_ADAPTER pAd,
112 INT Show_CountryRegionABand_Proc(
113 IN PRTMP_ADAPTER pAd,
116 INT Show_CountryCode_Proc(
117 IN PRTMP_ADAPTER pAd,
120 #ifdef AGGREGATION_SUPPORT
121 INT Show_PktAggregate_Proc(
122 IN PRTMP_ADAPTER pAd,
124 #endif // AGGREGATION_SUPPORT //
127 INT Show_WmmCapable_Proc(
128 IN PRTMP_ADAPTER pAd,
130 #endif // WMM_SUPPORT //
132 INT Show_IEEE80211H_Proc(
133 IN PRTMP_ADAPTER pAd,
136 INT Show_NetworkType_Proc(
137 IN PRTMP_ADAPTER pAd,
140 INT Show_AuthMode_Proc(
141 IN PRTMP_ADAPTER pAd,
144 INT Show_EncrypType_Proc(
145 IN PRTMP_ADAPTER pAd,
148 INT Show_DefaultKeyID_Proc(
149 IN PRTMP_ADAPTER pAd,
153 IN PRTMP_ADAPTER pAd,
157 IN PRTMP_ADAPTER pAd,
161 IN PRTMP_ADAPTER pAd,
165 IN PRTMP_ADAPTER pAd,
168 INT Show_WPAPSK_Proc(
169 IN PRTMP_ADAPTER pAd,
174 INT (*show_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg);
175 } *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = {
176 {"SSID", Show_SSID_Proc},
177 {"WirelessMode", Show_WirelessMode_Proc},
178 {"TxBurst", Show_TxBurst_Proc},
179 {"TxPreamble", Show_TxPreamble_Proc},
180 {"TxPower", Show_TxPower_Proc},
181 {"Channel", Show_Channel_Proc},
182 {"BGProtection", Show_BGProtection_Proc},
183 {"RTSThreshold", Show_RTSThreshold_Proc},
184 {"FragThreshold", Show_FragThreshold_Proc},
185 #ifdef DOT11_N_SUPPORT
186 {"HtBw", Show_HtBw_Proc},
187 {"HtMcs", Show_HtMcs_Proc},
188 {"HtGi", Show_HtGi_Proc},
189 {"HtOpMode", Show_HtOpMode_Proc},
190 {"HtExtcha", Show_HtExtcha_Proc},
191 {"HtMpduDensity", Show_HtMpduDensity_Proc},
192 {"HtBaWinSize", Show_HtBaWinSize_Proc},
193 {"HtRdg", Show_HtRdg_Proc},
194 {"HtAmsdu", Show_HtAmsdu_Proc},
195 {"HtAutoBa", Show_HtAutoBa_Proc},
196 #endif // DOT11_N_SUPPORT //
197 {"CountryRegion", Show_CountryRegion_Proc},
198 {"CountryRegionABand", Show_CountryRegionABand_Proc},
199 {"CountryCode", Show_CountryCode_Proc},
200 #ifdef AGGREGATION_SUPPORT
201 {"PktAggregate", Show_PktAggregate_Proc},
205 {"WmmCapable", Show_WmmCapable_Proc},
207 {"IEEE80211H", Show_IEEE80211H_Proc},
208 {"NetworkType", Show_NetworkType_Proc},
209 {"AuthMode", Show_AuthMode_Proc},
210 {"EncrypType", Show_EncrypType_Proc},
211 {"DefaultKeyID", Show_DefaultKeyID_Proc},
212 {"Key1", Show_Key1_Proc},
213 {"Key2", Show_Key2_Proc},
214 {"Key3", Show_Key3_Proc},
215 {"Key4", Show_Key4_Proc},
216 {"WPAPSK", Show_WPAPSK_Proc},
221 ==========================================================================
226 ==========================================================================
228 INT Set_DriverVersion_Proc(
229 IN PRTMP_ADAPTER pAd,
232 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
233 DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION));
239 ==========================================================================
242 This command will not work, if the field of CountryRegion in eeprom is programmed.
244 TRUE if all parameters are OK, FALSE otherwise
245 ==========================================================================
247 INT Set_CountryRegion_Proc(
248 IN PRTMP_ADAPTER pAd,
253 region = simple_strtol(arg, 0, 10);
255 // Country can be set only when EEPROM not programmed
256 if (pAd->CommonCfg.CountryRegion & 0x80)
258 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameter of CountryRegion in eeprom is programmed \n"));
262 if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND))
264 pAd->CommonCfg.CountryRegion = (UCHAR) region;
266 else if (region == REGION_31_BG_BAND)
268 pAd->CommonCfg.CountryRegion = (UCHAR) region;
272 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameters out of range\n"));
276 // if set country region, driver needs to be reset
277 BuildChannelList(pAd);
279 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion));
285 ==========================================================================
287 Set Country Region for A band.
288 This command will not work, if the field of CountryRegion in eeprom is programmed.
290 TRUE if all parameters are OK, FALSE otherwise
291 ==========================================================================
293 INT Set_CountryRegionABand_Proc(
294 IN PRTMP_ADAPTER pAd,
299 region = simple_strtol(arg, 0, 10);
301 // Country can be set only when EEPROM not programmed
302 if (pAd->CommonCfg.CountryRegionForABand & 0x80)
304 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameter of CountryRegion in eeprom is programmed \n"));
308 if((region >= 0) && (region <= REGION_MAXIMUM_A_BAND))
310 pAd->CommonCfg.CountryRegionForABand = (UCHAR) region;
314 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameters out of range\n"));
318 // if set country region, driver needs to be reset
319 BuildChannelList(pAd);
321 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegionForABand));
327 ==========================================================================
331 TRUE if all parameters are OK, FALSE otherwise
332 ==========================================================================
334 INT Set_WirelessMode_Proc(
335 IN PRTMP_ADAPTER pAd,
341 WirelessMode = simple_strtol(arg, 0, 10);
343 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
345 INT MaxPhyMode = PHY_11G;
347 #ifdef DOT11_N_SUPPORT
348 MaxPhyMode = PHY_11N_5G;
349 #endif // DOT11_N_SUPPORT //
351 if (WirelessMode <= MaxPhyMode)
353 RTMPSetPhyMode(pAd, WirelessMode);
354 #ifdef DOT11_N_SUPPORT
355 if (WirelessMode >= PHY_11ABGN_MIXED)
357 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
358 pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE;
362 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
363 pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE;
365 #endif // DOT11_N_SUPPORT //
366 // Set AdhocMode rates
367 if (pAd->StaCfg.BssType == BSS_ADHOC)
369 MlmeUpdateTxRates(pAd, FALSE, 0);
370 MakeIbssBeacon(pAd); // re-build BEACON frame
371 AsicEnableIbssSync(pAd); // copy to on-chip memory
380 // it is needed to set SSID to take effect
383 #ifdef DOT11_N_SUPPORT
385 #endif // DOT11_N_SUPPORT //
386 DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%ld)\n", WirelessMode));
390 DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n"));
397 ==========================================================================
401 TRUE if all parameters are OK, FALSE otherwise
402 ==========================================================================
404 INT Set_Channel_Proc(
405 IN PRTMP_ADAPTER pAd,
411 Channel = (UCHAR) simple_strtol(arg, 0, 10);
413 // check if this channel is valid
414 if (ChannelSanity(pAd, Channel) == TRUE)
416 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
418 pAd->CommonCfg.Channel = Channel;
422 #ifdef DOT11_N_SUPPORT
424 if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED &&
425 pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
428 AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
429 AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
430 DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n",
431 pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel));
434 #endif // DOT11_N_SUPPORT //
436 AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
437 AsicLockChannel(pAd, pAd->CommonCfg.Channel);
438 DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel));
446 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
452 DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel));
458 ==========================================================================
460 Set Short Slot Time Enable or Disable
462 TRUE if all parameters are OK, FALSE otherwise
463 ==========================================================================
465 INT Set_ShortSlot_Proc(
466 IN PRTMP_ADAPTER pAd,
471 ShortSlot = simple_strtol(arg, 0, 10);
474 pAd->CommonCfg.bUseShortSlotTime = TRUE;
475 else if (ShortSlot == 0)
476 pAd->CommonCfg.bUseShortSlotTime = FALSE;
478 return FALSE; //Invalid argument
480 DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime));
486 ==========================================================================
490 TRUE if all parameters are OK, FALSE otherwise
491 ==========================================================================
493 INT Set_TxPower_Proc(
494 IN PRTMP_ADAPTER pAd,
500 TxPower = (ULONG) simple_strtol(arg, 0, 10);
503 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
505 pAd->CommonCfg.TxPowerDefault = TxPower;
506 pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
513 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
519 ==========================================================================
521 Set 11B/11G Protection
523 TRUE if all parameters are OK, FALSE otherwise
524 ==========================================================================
526 INT Set_BGProtection_Proc(
527 IN PRTMP_ADAPTER pAd,
530 switch (simple_strtol(arg, 0, 10))
533 pAd->CommonCfg.UseBGProtection = 0;
536 pAd->CommonCfg.UseBGProtection = 1;
539 pAd->CommonCfg.UseBGProtection = 2;
541 default: //Invalid argument
546 DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection));
552 ==========================================================================
556 TRUE if all parameters are OK, FALSE otherwise
557 ==========================================================================
559 INT Set_TxPreamble_Proc(
560 IN PRTMP_ADAPTER pAd,
563 RT_802_11_PREAMBLE Preamble;
565 Preamble = simple_strtol(arg, 0, 10);
570 case Rt802_11PreambleShort:
571 pAd->CommonCfg.TxPreamble = Preamble;
573 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
574 MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);
576 case Rt802_11PreambleLong:
577 case Rt802_11PreambleAuto:
578 // if user wants AUTO, initialize to LONG here, then change according to AP's
579 // capability upon association.
580 pAd->CommonCfg.TxPreamble = Preamble;
582 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
583 MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);
585 default: //Invalid argument
589 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble));
595 ==========================================================================
599 TRUE if all parameters are OK, FALSE otherwise
600 ==========================================================================
602 INT Set_RTSThreshold_Proc(
603 IN PRTMP_ADAPTER pAd,
606 NDIS_802_11_RTS_THRESHOLD RtsThresh;
608 RtsThresh = simple_strtol(arg, 0, 10);
610 if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD))
611 pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
612 else if (RtsThresh == 0)
613 pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;
615 return FALSE; //Invalid argument
617 DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold));
623 ==========================================================================
625 Set Fragment Threshold
627 TRUE if all parameters are OK, FALSE otherwise
628 ==========================================================================
630 INT Set_FragThreshold_Proc(
631 IN PRTMP_ADAPTER pAd,
634 NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
636 FragThresh = simple_strtol(arg, 0, 10);
638 if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)
640 //Illegal FragThresh so we set it to default
641 pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
643 else if (FragThresh % 2 == 1)
645 // The length of each fragment shall always be an even number of octets, except for the last fragment
646 // of an MSDU or MMPDU, which may be either an even or an odd number of octets.
647 pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1);
651 pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
654 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
656 if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)
657 pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;
659 pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;
662 DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold));
668 ==========================================================================
672 TRUE if all parameters are OK, FALSE otherwise
673 ==========================================================================
675 INT Set_TxBurst_Proc(
676 IN PRTMP_ADAPTER pAd,
681 TxBurst = simple_strtol(arg, 0, 10);
683 pAd->CommonCfg.bEnableTxBurst = TRUE;
684 else if (TxBurst == 0)
685 pAd->CommonCfg.bEnableTxBurst = FALSE;
687 return FALSE; //Invalid argument
689 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst));
694 #ifdef AGGREGATION_SUPPORT
696 ==========================================================================
700 TRUE if all parameters are OK, FALSE otherwise
701 ==========================================================================
703 INT Set_PktAggregate_Proc(
704 IN PRTMP_ADAPTER pAd,
709 aggre = simple_strtol(arg, 0, 10);
712 pAd->CommonCfg.bAggregationCapable = TRUE;
714 pAd->CommonCfg.bAggregationCapable = FALSE;
716 return FALSE; //Invalid argument
719 DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable));
726 ==========================================================================
729 This parameter is 1 when needs radar detection, otherwise 0
731 TRUE if all parameters are OK, FALSE otherwise
732 ==========================================================================
734 INT Set_IEEE80211H_Proc(
735 IN PRTMP_ADAPTER pAd,
740 ieee80211h = simple_strtol(arg, 0, 10);
743 pAd->CommonCfg.bIEEE80211H = TRUE;
744 else if (ieee80211h == 0)
745 pAd->CommonCfg.bIEEE80211H = FALSE;
747 return FALSE; //Invalid argument
749 DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H));
757 ==========================================================================
759 For Debug information
761 TRUE if all parameters are OK, FALSE otherwise
762 ==========================================================================
765 IN PRTMP_ADAPTER pAd,
768 DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n"));
770 if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD)
771 RTDebugLevel = simple_strtol(arg, 0, 10);
773 DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel));
779 INT Show_DescInfo_Proc(
780 IN PRTMP_ADAPTER pAd,
784 PRT28XX_RXD_STRUC pRxD;
786 PRTMP_TX_RING pTxRing = &pAd->TxRing[QueIdx];
787 PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing;
788 PRTMP_RX_RING pRxRing = &pAd->RxRing;
790 for(i=0;i<TX_RING_SIZE;i++)
792 pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa;
793 printk("Desc #%d\n",i);
794 hex_dump("Tx Descriptor", (char *)pTxD, 16);
795 printk("pTxD->DMADONE = %x\n", pTxD->DMADONE);
797 printk("---------------------------------------------------\n");
798 for(i=0;i<MGMT_RING_SIZE;i++)
800 pTxD = (PTXD_STRUC) pMgmtRing->Cell[i].AllocVa;
801 printk("Desc #%d\n",i);
802 hex_dump("Mgmt Descriptor", (char *)pTxD, 16);
803 printk("pMgmt->DMADONE = %x\n", pTxD->DMADONE);
805 printk("---------------------------------------------------\n");
806 for(i=0;i<RX_RING_SIZE;i++)
808 pRxD = (PRT28XX_RXD_STRUC) pRxRing->Cell[i].AllocVa;
809 printk("Desc #%d\n",i);
810 hex_dump("Rx Descriptor", (char *)pRxD, 16);
811 printk("pRxD->DDONE = %x\n", pRxD->DDONE);
818 ==========================================================================
820 Reset statistics counter
823 pAdapter Pointer to our adapter
827 TRUE if all parameters are OK, FALSE otherwise
828 ==========================================================================
830 INT Set_ResetStatCounter_Proc(
831 IN PRTMP_ADAPTER pAd,
834 DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n"));
836 // add the most up-to-date h/w raw counters into software counters
837 NICUpdateRawCounters(pAd);
839 NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));
840 NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));
841 NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));
846 BOOLEAN RTMPCheckStrPrintAble(
852 for (i=0; i<strLen; i++)
854 if ((pInPutStr[i] < 0x21) ||
855 (pInPutStr[i] > 0x7E))
863 ========================================================================
866 Remove WPA Key process
869 pAd Pointer to our adapter
870 pBuf Pointer to the where the key stored
873 NDIS_SUCCESS Add key successfully
875 IRQL = DISPATCH_LEVEL
879 ========================================================================
881 VOID RTMPSetDesiredRates(
882 IN PRTMP_ADAPTER pAdapter,
885 NDIS_802_11_RATES aryRates;
887 memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
888 switch (pAdapter->CommonCfg.PhyMode)
890 case PHY_11A: // A only
894 aryRates[0] = 0x0c; // 6M
895 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
898 aryRates[0] = 0x12; // 9M
899 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
902 aryRates[0] = 0x18; // 12M
903 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
906 aryRates[0] = 0x24; // 18M
907 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
910 aryRates[0] = 0x30; // 24M
911 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
914 aryRates[0] = 0x48; // 36M
915 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
918 aryRates[0] = 0x60; // 48M
919 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
922 aryRates[0] = 0x6c; // 54M
923 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
927 aryRates[0] = 0x6c; // 54Mbps
928 aryRates[1] = 0x60; // 48Mbps
929 aryRates[2] = 0x48; // 36Mbps
930 aryRates[3] = 0x30; // 24Mbps
931 aryRates[4] = 0x24; // 18M
932 aryRates[5] = 0x18; // 12M
933 aryRates[6] = 0x12; // 9M
934 aryRates[7] = 0x0c; // 6M
935 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
939 case PHY_11BG_MIXED: // B/G Mixed
940 case PHY_11B: // B only
941 case PHY_11ABG_MIXED: // A/B/G Mixed
947 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
951 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
954 aryRates[0] = 0x0b; // 5.5M
955 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
958 aryRates[0] = 0x16; // 11M
959 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
962 aryRates[0] = 0x0c; // 6M
963 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
966 aryRates[0] = 0x12; // 9M
967 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
970 aryRates[0] = 0x18; // 12M
971 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
974 aryRates[0] = 0x24; // 18M
975 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
978 aryRates[0] = 0x30; // 24M
979 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
982 aryRates[0] = 0x48; // 36M
983 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
986 aryRates[0] = 0x60; // 48M
987 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
990 aryRates[0] = 0x6c; // 54M
991 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
995 if (pAdapter->CommonCfg.PhyMode == PHY_11B)
997 aryRates[0] = 0x16; // 11Mbps
998 aryRates[1] = 0x0b; // 5.5Mbps
999 aryRates[2] = 0x04; // 2Mbps
1000 aryRates[3] = 0x02; // 1Mbps
1003 { //(B/G) Mixed or (A/B/G) Mixed
1004 aryRates[0] = 0x6c; // 54Mbps
1005 aryRates[1] = 0x60; // 48Mbps
1006 aryRates[2] = 0x48; // 36Mbps
1007 aryRates[3] = 0x30; // 24Mbps
1008 aryRates[4] = 0x16; // 11Mbps
1009 aryRates[5] = 0x0b; // 5.5Mbps
1010 aryRates[6] = 0x04; // 2Mbps
1011 aryRates[7] = 0x02; // 1Mbps
1013 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
1019 NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1020 NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
1021 DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
1022 pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1],
1023 pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3],
1024 pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5],
1025 pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] ));
1026 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
1027 MlmeUpdateTxRates(pAdapter, FALSE, 0);
1030 NDIS_STATUS RTMPWPARemoveKeyProc(
1031 IN PRTMP_ADAPTER pAd,
1034 PNDIS_802_11_REMOVE_KEY pKey;
1036 NDIS_STATUS Status = NDIS_STATUS_FAILURE;
1037 BOOLEAN bTxKey; // Set the key as transmit key
1038 BOOLEAN bPairwise; // Indicate the key is pairwise key
1039 BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value.
1040 // Otherwise, it will set by the NIC.
1041 BOOLEAN bAuthenticator; // indicate key is set by authenticator.
1044 DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n"));
1046 pKey = (PNDIS_802_11_REMOVE_KEY) pBuf;
1047 KeyIdx = pKey->KeyIndex & 0xff;
1048 // Bit 31 of Add-key, Tx Key
1049 bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE;
1050 // Bit 30 of Add-key PairwiseKey
1051 bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE;
1052 // Bit 29 of Add-key KeyRSC
1053 bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE;
1054 // Bit 28 of Add-key Authenticator
1055 bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE;
1057 // 1. If bTx is TRUE, return failure information
1059 return(NDIS_STATUS_INVALID_DATA);
1061 // 2. Check Pairwise Key
1064 // a. If BSSID is broadcast, remove all pairwise keys.
1065 // b. If not broadcast, remove the pairwise specified by BSSID
1066 for (i = 0; i < SHARE_KEY_NUM; i++)
1068 if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID))
1070 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i));
1071 pAd->SharedKey[BSS0][i].KeyLen = 0;
1072 pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE;
1073 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i);
1074 Status = NDIS_STATUS_SUCCESS;
1082 // a. If BSSID is broadcast, remove all group keys indexed
1083 // b. If BSSID matched, delete the group key indexed.
1084 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx));
1085 pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
1086 pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
1087 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx);
1088 Status = NDIS_STATUS_SUCCESS;
1095 ========================================================================
1097 Routine Description:
1101 pAd Pointer to our adapter
1106 IRQL = DISPATCH_LEVEL
1110 ========================================================================
1112 VOID RTMPWPARemoveAllKeys(
1113 IN PRTMP_ADAPTER pAd)
1118 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
1120 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1121 // Link up. And it will be replaced if user changed it.
1122 if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)
1125 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1126 // Link up. And it will be replaced if user changed it.
1127 if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone)
1130 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1131 AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
1133 // set all shared key mode as no-security.
1134 for (i = 0; i < SHARE_KEY_NUM; i++)
1136 DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
1137 NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY));
1139 AsicRemoveSharedKeyEntry(pAd, BSS0, i);
1145 ========================================================================
1146 Routine Description:
1147 Change NIC PHY mode. Re-association may be necessary. possible settings
1148 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1151 pAd - Pointer to our adapter
1154 IRQL = PASSIVE_LEVEL
1155 IRQL = DISPATCH_LEVEL
1157 ========================================================================
1159 VOID RTMPSetPhyMode(
1160 IN PRTMP_ADAPTER pAd,
1164 // the selected phymode must be supported by the RF IC encoded in E2PROM
1166 // if no change, do nothing
1168 if (pAd->CommonCfg.PhyMode == phymode)
1171 pAd->CommonCfg.PhyMode = (UCHAR)phymode;
1173 DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
1175 BuildChannelList(pAd);
1177 // sanity check user setting
1178 for (i = 0; i < pAd->ChannelListNum; i++)
1180 if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
1184 if (i == pAd->ChannelListNum)
1186 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1187 pAd->CommonCfg.Channel = FirstChannel(pAd);
1188 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel));
1191 NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES);
1192 NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES);
1193 NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1196 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1197 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1198 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1199 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1200 pAd->CommonCfg.SupRateLen = 4;
1201 pAd->CommonCfg.ExtRateLen = 0;
1202 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1203 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1204 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1205 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1206 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1210 case PHY_11BG_MIXED:
1211 case PHY_11ABG_MIXED:
1212 #ifdef DOT11_N_SUPPORT
1214 case PHY_11ABGN_MIXED:
1215 case PHY_11BGN_MIXED:
1216 case PHY_11GN_MIXED:
1217 #endif // DOT11_N_SUPPORT //
1218 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1219 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1220 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1221 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1222 pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1223 pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1224 pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1225 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1226 pAd->CommonCfg.SupRateLen = 8;
1227 pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1228 pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1229 pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1230 pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1231 pAd->CommonCfg.ExtRateLen = 4;
1232 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1233 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1234 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1235 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1236 pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
1237 pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
1238 pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
1239 pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
1240 pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
1241 pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
1242 pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
1243 pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
1247 #ifdef DOT11_N_SUPPORT
1248 case PHY_11AN_MIXED:
1249 case PHY_11AGN_MIXED:
1251 #endif // DOT11_N_SUPPORT //
1252 pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1253 pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1254 pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1255 pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1256 pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1257 pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1258 pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1259 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1260 pAd->CommonCfg.SupRateLen = 8;
1261 pAd->CommonCfg.ExtRateLen = 0;
1262 pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
1263 pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
1264 pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
1265 pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
1266 pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
1267 pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
1268 pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
1269 pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
1270 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1278 pAd->CommonCfg.BandState = UNKNOWN_BAND;
1282 #ifdef DOT11_N_SUPPORT
1284 ========================================================================
1285 Routine Description:
1286 Caller ensures we has 802.11n support.
1287 Calls at setting HT from AP/STASetinformation
1290 pAd - Pointer to our adapter
1293 ========================================================================
1296 IN PRTMP_ADAPTER pAd,
1297 IN OID_SET_HT_PHYMODE *pHTPhyMode)
1302 UCHAR BBP3Value = 0;
1303 UCHAR RxStream = pAd->CommonCfg.RxStream;
1305 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1306 pHTPhyMode->HtMode, pHTPhyMode->ExtOffset,
1307 pHTPhyMode->MCS, pHTPhyMode->BW,
1308 pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
1310 // Don't zero supportedHyPhy structure.
1311 RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability));
1312 RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo));
1313 RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset));
1314 RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy));
1316 if (pAd->CommonCfg.bRdg)
1318 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1;
1319 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1;
1323 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0;
1324 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0;
1327 pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3;
1328 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3;
1330 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit));
1332 // Mimo power save, A-MSDU size,
1333 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
1334 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize;
1335 pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode;
1336 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1338 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
1339 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
1340 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1342 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1343 pAd->CommonCfg.DesiredHtPhy.AmsduSize,
1344 pAd->CommonCfg.DesiredHtPhy.MimoPs,
1345 pAd->CommonCfg.DesiredHtPhy.MpduDensity,
1346 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
1348 if(pHTPhyMode->HtMode == HTMODE_GF)
1350 pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1;
1351 pAd->CommonCfg.DesiredHtPhy.GF = 1;
1354 pAd->CommonCfg.DesiredHtPhy.GF = 0;
1360 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1361 pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
1365 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1366 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1370 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1371 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1372 pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
1376 if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) )
1378 pHTPhyMode->BW = BW_20;
1379 pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1;
1382 if(pHTPhyMode->BW == BW_40)
1384 pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
1385 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
1386 if (pAd->CommonCfg.Channel <= 14)
1387 pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
1389 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1;
1390 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
1391 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE;
1392 // Set Regsiter for extension channel position.
1393 RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
1394 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
1395 if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW))
1398 BBP3Value |= (0x20);
1399 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1401 else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE))
1404 BBP3Value &= (~0x20);
1405 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1408 // Turn on BBP 40MHz mode now only as AP .
1409 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1410 if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
1413 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1414 BBPValue &= (~0x18);
1416 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1418 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value);
1419 pAd->CommonCfg.BBPCurrentBW = BW_40;
1424 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0;
1425 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0;
1426 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
1427 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE;
1428 pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
1429 // Turn on BBP 20MHz mode by request here.
1431 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1432 BBPValue &= (~0x18);
1433 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1434 pAd->CommonCfg.BBPCurrentBW = BW_20;
1438 if(pHTPhyMode->STBC == STBC_USE)
1440 pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1;
1441 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1;
1442 pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1;
1443 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1;
1447 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
1448 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
1452 if(pHTPhyMode->SHORTGI == GI_400)
1454 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1;
1455 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1;
1456 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1;
1457 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1;
1461 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0;
1462 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0;
1463 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0;
1464 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0;
1467 // We support link adaptation for unsolicit MCS feedback, set to 2.
1468 pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
1469 pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
1470 // 1, the extension channel above the control channel.
1472 // EDCA parameters used for AP's own transmission
1473 if (pAd->CommonCfg.APEdcaParm.bValid == FALSE)
1475 pAd->CommonCfg.APEdcaParm.bValid = TRUE;
1476 pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
1477 pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7;
1478 pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1;
1479 pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1;
1481 pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4;
1482 pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4;
1483 pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3;
1484 pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2;
1486 pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6;
1487 pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10;
1488 pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4;
1489 pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3;
1491 pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
1492 pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
1493 pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
1494 pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
1496 AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm);
1498 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1500 RTMPSetIndividualHT(pAd, 0);
1505 ========================================================================
1506 Routine Description:
1507 Caller ensures we has 802.11n support.
1508 Calls at setting HT from AP/STASetinformation
1511 pAd - Pointer to our adapter
1514 ========================================================================
1516 VOID RTMPSetIndividualHT(
1517 IN PRTMP_ADAPTER pAd,
1520 PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
1521 UCHAR TxStream = pAd->CommonCfg.TxStream;
1522 UCHAR DesiredMcs = MCS_AUTO;
1526 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1528 pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
1529 DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS;
1530 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1535 if (pDesired_ht_phy == NULL)
1537 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
1540 RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO));
1542 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
1543 // Check the validity of MCS
1544 if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15)))
1546 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs));
1550 if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32))
1552 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1556 pDesired_ht_phy->bHtEnable = TRUE;
1558 // Decide desired Tx MCS
1562 if (DesiredMcs == MCS_AUTO)
1564 pDesired_ht_phy->MCSSet[0]= 0xff;
1565 pDesired_ht_phy->MCSSet[1]= 0x00;
1567 else if (DesiredMcs <= MCS_7)
1569 pDesired_ht_phy->MCSSet[0]= 1<<DesiredMcs;
1570 pDesired_ht_phy->MCSSet[1]= 0x00;
1575 if (DesiredMcs == MCS_AUTO)
1577 pDesired_ht_phy->MCSSet[0]= 0xff;
1578 pDesired_ht_phy->MCSSet[1]= 0xff;
1580 else if (DesiredMcs <= MCS_15)
1584 mode = DesiredMcs / 8;
1586 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1591 if (DesiredMcs == MCS_AUTO)
1593 /* MCS0 ~ MCS23, 3 bytes */
1594 pDesired_ht_phy->MCSSet[0]= 0xff;
1595 pDesired_ht_phy->MCSSet[1]= 0xff;
1596 pDesired_ht_phy->MCSSet[2]= 0xff;
1598 else if (DesiredMcs <= MCS_23)
1602 mode = DesiredMcs / 8;
1604 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1609 if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40)
1611 if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
1612 pDesired_ht_phy->MCSSet[4] = 0x1;
1615 // update HT Rate setting
1616 if (pAd->OpMode == OPMODE_STA)
1617 MlmeUpdateHtTxRates(pAd, BSS0);
1619 MlmeUpdateHtTxRates(pAd, apidx);
1624 ========================================================================
1625 Routine Description:
1626 Update HT IE from our capability.
1629 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1632 ========================================================================
1634 VOID RTMPUpdateHTIE(
1635 IN RT_HT_CAPABILITY *pRtHt,
1637 OUT HT_CAPABILITY_IE *pHtCapability,
1638 OUT ADD_HT_INFO_IE *pAddHtInfo)
1640 RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE));
1641 RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE));
1643 pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
1644 pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
1645 pHtCapability->HtCapInfo.GF = pRtHt->GF;
1646 pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
1647 pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
1648 pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
1649 pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
1650 pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
1651 pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
1652 pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
1654 pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ;
1655 pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
1656 pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
1657 pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
1658 RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1660 DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n"));
1662 #endif // DOT11_N_SUPPORT //
1665 ========================================================================
1667 Add Client security information into ASIC WCID table and IVEIV table.
1669 ========================================================================
1671 VOID RTMPAddWcidAttributeEntry(
1672 IN PRTMP_ADAPTER pAd,
1676 IN MAC_TABLE_ENTRY *pEntry)
1678 UINT32 WCIDAttri = 0;
1684 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1688 DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx));
1692 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
1693 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
1694 // the AID:2~ assign to mesh link entry.
1695 if (pEntry && ADHOC_ON(pAd))
1697 else if (pEntry && INFRA_ON(pAd))
1706 // Update WCID attribute table
1707 offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE);
1709 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1711 if (pEntry && pEntry->ValidAsMesh)
1712 WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE;
1714 WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE;
1717 RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
1720 // Update IV/EIV table
1721 offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
1724 if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES))
1726 // Eiv bit on. keyid always is 0 for pairwise key
1727 IVEIV = (KeyIdx <<6) | 0x20;
1731 // WEP KeyIdx is default tx key.
1732 IVEIV = (KeyIdx << 6);
1735 // For key index and ext IV bit, so only need to update the position(offset+3).
1736 RTMP_IO_WRITE8(pAd, offset+3, IVEIV);
1738 DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg]));
1739 DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri));
1744 ==========================================================================
1746 Parse encryption type
1748 pAdapter Pointer to our adapter
1749 wrq Pointer to the ioctl argument
1755 ==========================================================================
1757 CHAR *GetEncryptType(CHAR enc)
1759 if(enc == Ndis802_11WEPDisabled)
1761 if(enc == Ndis802_11WEPEnabled)
1763 if(enc == Ndis802_11Encryption2Enabled)
1765 if(enc == Ndis802_11Encryption3Enabled)
1767 if(enc == Ndis802_11Encryption4Enabled)
1773 CHAR *GetAuthMode(CHAR auth)
1775 if(auth == Ndis802_11AuthModeOpen)
1777 if(auth == Ndis802_11AuthModeShared)
1779 if(auth == Ndis802_11AuthModeAutoSwitch)
1781 if(auth == Ndis802_11AuthModeWPA)
1783 if(auth == Ndis802_11AuthModeWPAPSK)
1785 if(auth == Ndis802_11AuthModeWPANone)
1787 if(auth == Ndis802_11AuthModeWPA2)
1789 if(auth == Ndis802_11AuthModeWPA2PSK)
1791 if(auth == Ndis802_11AuthModeWPA1WPA2)
1793 if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
1794 return "WPA1PSKWPA2PSK";
1800 ==========================================================================
1802 Get site survey results
1804 pAdapter Pointer to our adapter
1805 wrq Pointer to the ioctl argument
1812 1.) UI needs to wait 4 seconds after issue a site survey command
1813 2.) iwpriv ra0 get_site_survey
1814 3.) UI needs to prepare at least 4096bytes to get the results
1815 ==========================================================================
1817 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
1818 VOID RTMPIoctlGetSiteSurvey(
1819 IN PRTMP_ADAPTER pAdapter,
1820 IN struct iwreq *wrq)
1826 CHAR Ssid[MAX_LEN_OF_SSID +1];
1827 INT Rssi = 0, max_len = LINE_LEN;
1828 UINT Rssi_Quality = 0;
1829 NDIS_802_11_NETWORK_TYPE wireless_mode;
1831 os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len));
1835 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
1839 memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len );
1840 memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1));
1841 sprintf(msg,"%s","\n");
1842 sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
1843 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
1846 pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE;
1848 while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200))
1851 for(i=0; i<pAdapter->ScanTab.BssNr ;i++)
1853 if( pAdapter->ScanTab.BssEntry[i].Channel==0)
1856 if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA)
1860 sprintf(msg+strlen(msg),"%-4d", pAdapter->ScanTab.BssEntry[i].Channel);
1862 memcpy(Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen);
1863 Ssid[pAdapter->ScanTab.BssEntry[i].SsidLen] = '\0';
1864 sprintf(msg+strlen(msg),"%-33s", Ssid);
1866 sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ",
1867 pAdapter->ScanTab.BssEntry[i].Bssid[0],
1868 pAdapter->ScanTab.BssEntry[i].Bssid[1],
1869 pAdapter->ScanTab.BssEntry[i].Bssid[2],
1870 pAdapter->ScanTab.BssEntry[i].Bssid[3],
1871 pAdapter->ScanTab.BssEntry[i].Bssid[4],
1872 pAdapter->ScanTab.BssEntry[i].Bssid[5]);
1874 sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus));
1875 //Authentication Mode
1876 if (pAdapter->ScanTab.BssEntry[i].WepStatus == Ndis802_11WEPEnabled)
1877 sprintf(msg+strlen(msg),"%-10s", "UNKNOW");
1879 sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode));
1881 Rssi = (INT)pAdapter->ScanTab.BssEntry[i].Rssi;
1884 else if (Rssi >= -80) // between -50 ~ -80dbm
1885 Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10);
1886 else if (Rssi >= -90) // between -80 ~ -90dbm
1887 Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10);
1890 sprintf(msg+strlen(msg),"%-9d", Rssi_Quality);
1892 wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]);
1893 if (wireless_mode == Ndis802_11FH ||
1894 wireless_mode == Ndis802_11DS)
1895 sprintf(msg+strlen(msg),"%-7s", "11b");
1896 else if (wireless_mode == Ndis802_11OFDM5)
1897 sprintf(msg+strlen(msg),"%-7s", "11a");
1898 else if (wireless_mode == Ndis802_11OFDM5_N)
1899 sprintf(msg+strlen(msg),"%-7s", "11a/n");
1900 else if (wireless_mode == Ndis802_11OFDM24)
1901 sprintf(msg+strlen(msg),"%-7s", "11b/g");
1902 else if (wireless_mode == Ndis802_11OFDM24_N)
1903 sprintf(msg+strlen(msg),"%-7s", "11b/g/n");
1905 sprintf(msg+strlen(msg),"%-7s", "unknow");
1907 if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC)
1908 sprintf(msg+strlen(msg),"%-3s", " Ad");
1910 sprintf(msg+strlen(msg),"%-3s", " In");
1912 sprintf(msg+strlen(msg),"\n");
1915 pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE;
1916 wrq->u.data.length = strlen(msg);
1917 Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);
1919 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length));
1920 os_free_mem(NULL, (PUCHAR)msg);
1924 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
1925 VOID RTMPIoctlGetMacTable(
1926 IN PRTMP_ADAPTER pAd,
1927 IN struct iwreq *wrq)
1930 RT_802_11_MAC_TABLE MacTab;
1934 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1936 if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC))
1938 COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr);
1939 MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid;
1940 MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode;
1941 #ifdef DOT11_N_SUPPORT
1942 MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode;
1943 #endif // DOT11_N_SUPPORT //
1945 // Fill in RSSI per entry
1946 MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0;
1947 MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1;
1948 MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2;
1950 // the connected time per entry
1951 MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime;
1952 MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS;
1953 MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW;
1954 MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI;
1955 MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC;
1956 MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv;
1957 MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE;
1958 MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word;
1963 wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE);
1964 if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length))
1966 DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__));
1969 msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG);
1970 memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN );
1971 sprintf(msg,"%s","\n");
1972 sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
1973 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
1975 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1977 PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];
1978 if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC))
1980 if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) )
1982 sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ",
1983 pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],
1984 pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);
1985 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid);
1986 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode);
1987 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
1988 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
1989 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
1990 sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]);
1991 sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
1994 // for compatible with old API just do the printk to console
1995 //wrq->u.data.length = strlen(msg);
1996 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
1998 DBGPRINT(RT_DEBUG_TRACE, ("%s", msg));
2004 #ifdef DOT11_N_SUPPORT
2005 INT Set_BASetup_Proc(
2006 IN PRTMP_ADAPTER pAd,
2010 char *token, sepValue[] = ":", DASH = '-';
2012 MAC_TABLE_ENTRY *pEntry;
2015 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
2016 =>The six 2 digit hex-decimal number previous are the Mac address,
2017 =>The seventh decimal number is the tid value.
2019 //printk("\n%s\n", arg);
2021 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2024 token = strchr(arg, DASH);
2025 if ((token != NULL) && (strlen(token)>1))
2027 tid = simple_strtol((token+1), 0, 10);
2032 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2034 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2036 AtoH(token, (PUCHAR)(&mac[i]), 1);
2041 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1],
2042 mac[2], mac[3], mac[4], mac[5], tid);
2044 pEntry = MacTableLookup(pAd, mac);
2047 printk("\nSetup BA Session: Tid = %d\n", tid);
2048 BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE);
2058 INT Set_BADecline_Proc(
2059 IN PRTMP_ADAPTER pAd,
2064 bBADecline = simple_strtol(arg, 0, 10);
2066 if (bBADecline == 0)
2068 pAd->CommonCfg.bBADecline = FALSE;
2070 else if (bBADecline == 1)
2072 pAd->CommonCfg.bBADecline = TRUE;
2076 return FALSE; //Invalid argument
2079 DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline));
2084 INT Set_BAOriTearDown_Proc(
2085 IN PRTMP_ADAPTER pAd,
2089 char *token, sepValue[] = ":", DASH = '-';
2091 MAC_TABLE_ENTRY *pEntry;
2094 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2095 =>The six 2 digit hex-decimal number previous are the Mac address,
2096 =>The seventh decimal number is the tid value.
2098 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2101 token = strchr(arg, DASH);
2102 if ((token != NULL) && (strlen(token)>1))
2104 tid = simple_strtol((token+1), 0, 10);
2105 if (tid > NUM_OF_TID)
2109 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2111 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2113 AtoH(token, (PUCHAR)(&mac[i]), 1);
2118 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2119 mac[2], mac[3], mac[4], mac[5], tid);
2121 pEntry = MacTableLookup(pAd, mac);
2124 printk("\nTear down Ori BA Session: Tid = %d\n", tid);
2125 BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE);
2135 INT Set_BARecTearDown_Proc(
2136 IN PRTMP_ADAPTER pAd,
2140 char *token, sepValue[] = ":", DASH = '-';
2142 MAC_TABLE_ENTRY *pEntry;
2144 //printk("\n%s\n", arg);
2146 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2147 =>The six 2 digit hex-decimal number previous are the Mac address,
2148 =>The seventh decimal number is the tid value.
2150 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2153 token = strchr(arg, DASH);
2154 if ((token != NULL) && (strlen(token)>1))
2156 tid = simple_strtol((token+1), 0, 10);
2157 if (tid > NUM_OF_TID)
2161 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2163 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2165 AtoH(token, (PUCHAR)(&mac[i]), 1);
2170 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2171 mac[2], mac[3], mac[4], mac[5], tid);
2173 pEntry = MacTableLookup(pAd, mac);
2176 printk("\nTear down Rec BA Session: Tid = %d\n", tid);
2177 BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE);
2188 IN PRTMP_ADAPTER pAd,
2193 HtBw = simple_strtol(arg, 0, 10);
2195 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
2196 else if (HtBw == BW_20)
2197 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
2199 return FALSE; //Invalid argument
2203 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW));
2209 IN PRTMP_ADAPTER pAd,
2212 ULONG HtMcs, Mcs_tmp;
2213 BOOLEAN bAutoRate = FALSE;
2215 Mcs_tmp = simple_strtol(arg, 0, 10);
2217 if (Mcs_tmp <= 15 || Mcs_tmp == 32)
2222 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2224 pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs;
2225 pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE;
2226 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2227 pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch));
2229 if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) ||
2230 (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX))
2232 if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2233 (HtMcs >= 0 && HtMcs <= 3) &&
2234 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK))
2236 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000));
2238 else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2239 (HtMcs >= 0 && HtMcs <= 7) &&
2240 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM))
2242 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000));
2249 pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
2250 RTMPSetDesiredRates(pAd, -1);
2252 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode));
2264 IN PRTMP_ADAPTER pAd,
2269 HtGi = simple_strtol(arg, 0, 10);
2271 if ( HtGi == GI_400)
2272 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400;
2273 else if ( HtGi == GI_800 )
2274 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800;
2276 return FALSE; //Invalid argument
2280 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI));
2286 INT Set_HtTxBASize_Proc(
2287 IN PRTMP_ADAPTER pAd,
2292 Size = simple_strtol(arg, 0, 10);
2294 if (Size <=0 || Size >=64)
2298 pAd->CommonCfg.TxBASize = Size-1;
2299 DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size));
2305 INT Set_HtOpMode_Proc(
2306 IN PRTMP_ADAPTER pAd,
2312 Value = simple_strtol(arg, 0, 10);
2314 if (Value == HTMODE_GF)
2315 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF;
2316 else if ( Value == HTMODE_MM )
2317 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM;
2319 return FALSE; //Invalid argument
2323 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE));
2329 INT Set_HtStbc_Proc(
2330 IN PRTMP_ADAPTER pAd,
2336 Value = simple_strtol(arg, 0, 10);
2338 if (Value == STBC_USE)
2339 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE;
2340 else if ( Value == STBC_NONE )
2341 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE;
2343 return FALSE; //Invalid argument
2347 DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC));
2353 IN PRTMP_ADAPTER pAd,
2359 Value = simple_strtol(arg, 0, 10);
2361 pAd->HTCEnable = FALSE;
2362 else if ( Value ==1 )
2363 pAd->HTCEnable = TRUE;
2365 return FALSE; //Invalid argument
2367 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable));
2372 INT Set_HtExtcha_Proc(
2373 IN PRTMP_ADAPTER pAd,
2379 Value = simple_strtol(arg, 0, 10);
2382 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW;
2383 else if ( Value ==1 )
2384 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE;
2386 return FALSE; //Invalid argument
2390 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA));
2395 INT Set_HtMpduDensity_Proc(
2396 IN PRTMP_ADAPTER pAd,
2401 Value = simple_strtol(arg, 0, 10);
2403 if (Value <=7 && Value >= 0)
2404 pAd->CommonCfg.BACapability.field.MpduDensity = Value;
2406 pAd->CommonCfg.BACapability.field.MpduDensity = 4;
2410 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity));
2415 INT Set_HtBaWinSize_Proc(
2416 IN PRTMP_ADAPTER pAd,
2421 Value = simple_strtol(arg, 0, 10);
2424 if (Value >=1 && Value <= 64)
2426 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value;
2427 pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value;
2431 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64;
2432 pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64;
2437 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit));
2443 IN PRTMP_ADAPTER pAd,
2448 Value = simple_strtol(arg, 0, 10);
2451 pAd->CommonCfg.bRdg = FALSE;
2452 else if ( Value ==1 )
2454 pAd->HTCEnable = TRUE;
2455 pAd->CommonCfg.bRdg = TRUE;
2458 return FALSE; //Invalid argument
2462 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg));
2467 INT Set_HtLinkAdapt_Proc(
2468 IN PRTMP_ADAPTER pAd,
2473 Value = simple_strtol(arg, 0, 10);
2475 pAd->bLinkAdapt = FALSE;
2476 else if ( Value ==1 )
2478 pAd->HTCEnable = TRUE;
2479 pAd->bLinkAdapt = TRUE;
2482 return FALSE; //Invalid argument
2484 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt));
2489 INT Set_HtAmsdu_Proc(
2490 IN PRTMP_ADAPTER pAd,
2495 Value = simple_strtol(arg, 0, 10);
2497 pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE;
2498 else if ( Value == 1 )
2499 pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE;
2501 return FALSE; //Invalid argument
2505 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable));
2510 INT Set_HtAutoBa_Proc(
2511 IN PRTMP_ADAPTER pAd,
2516 Value = simple_strtol(arg, 0, 10);
2518 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
2519 else if (Value == 1)
2520 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
2522 return FALSE; //Invalid argument
2524 pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
2527 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA));
2533 INT Set_HtProtect_Proc(
2534 IN PRTMP_ADAPTER pAd,
2539 Value = simple_strtol(arg, 0, 10);
2541 pAd->CommonCfg.bHTProtect = FALSE;
2542 else if (Value == 1)
2543 pAd->CommonCfg.bHTProtect = TRUE;
2545 return FALSE; //Invalid argument
2547 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect));
2552 INT Set_SendPSMPAction_Proc(
2553 IN PRTMP_ADAPTER pAd,
2557 char *token, sepValue[] = ":", DASH = '-';
2559 MAC_TABLE_ENTRY *pEntry;
2561 //printk("\n%s\n", arg);
2563 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2564 =>The six 2 digit hex-decimal number previous are the Mac address,
2565 =>The seventh decimal number is the mode value.
2567 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2570 token = strchr(arg, DASH);
2571 if ((token != NULL) && (strlen(token)>1))
2573 mode = simple_strtol((token+1), 0, 10);
2574 if (mode > MMPS_ENABLE)
2578 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2580 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2582 AtoH(token, (PUCHAR)(&mac[i]), 1);
2587 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2588 mac[2], mac[3], mac[4], mac[5], mode);
2590 pEntry = MacTableLookup(pAd, mac);
2593 printk("\nSendPSMPAction MIPS mode = %d\n", mode);
2594 SendPSMPAction(pAd, pEntry->Aid, mode);
2605 INT Set_HtMIMOPSmode_Proc(
2606 IN PRTMP_ADAPTER pAd,
2611 Value = simple_strtol(arg, 0, 10);
2613 if (Value <=3 && Value >= 0)
2614 pAd->CommonCfg.BACapability.field.MMPSmode = Value;
2616 pAd->CommonCfg.BACapability.field.MMPSmode = 3;
2620 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode));
2626 INT Set_ForceShortGI_Proc(
2627 IN PRTMP_ADAPTER pAd,
2632 Value = simple_strtol(arg, 0, 10);
2634 pAd->WIFItestbed.bShortGI = FALSE;
2635 else if (Value == 1)
2636 pAd->WIFItestbed.bShortGI = TRUE;
2638 return FALSE; //Invalid argument
2642 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI));
2649 INT Set_ForceGF_Proc(
2650 IN PRTMP_ADAPTER pAd,
2655 Value = simple_strtol(arg, 0, 10);
2657 pAd->WIFItestbed.bGreenField = FALSE;
2658 else if (Value == 1)
2659 pAd->WIFItestbed.bGreenField = TRUE;
2661 return FALSE; //Invalid argument
2665 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField));
2670 INT Set_HtMimoPs_Proc(
2671 IN PRTMP_ADAPTER pAd,
2676 Value = simple_strtol(arg, 0, 10);
2678 pAd->CommonCfg.bMIMOPSEnable = FALSE;
2679 else if (Value == 1)
2680 pAd->CommonCfg.bMIMOPSEnable = TRUE;
2682 return FALSE; //Invalid argument
2684 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable));
2688 #endif // DOT11_N_SUPPORT //
2691 #ifdef DOT11_N_SUPPORT
2693 IN PRTMP_ADAPTER pAd)
2695 OID_SET_HT_PHYMODE SetHT;
2697 if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED)
2700 SetHT.PhyMode = pAd->CommonCfg.PhyMode;
2701 SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath);
2702 SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
2703 SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
2704 SetHT.MCS = MCS_AUTO;
2705 SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
2706 SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
2707 SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
2709 RTMPSetHT(pAd, &SetHT);
2713 #endif // DOT11_N_SUPPORT //
2715 INT Set_FixedTxMode_Proc(
2716 IN PRTMP_ADAPTER pAd,
2719 UCHAR fix_tx_mode = FIXED_TXMODE_HT;
2721 if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0)
2723 fix_tx_mode = FIXED_TXMODE_OFDM;
2725 else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0)
2727 fix_tx_mode = FIXED_TXMODE_CCK;
2730 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2731 pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode;
2733 DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode));
2738 /////////////////////////////////////////////////////////////////////////
2739 PCHAR RTMPGetRalinkAuthModeStr(
2740 IN NDIS_802_11_AUTHENTICATION_MODE authMode)
2744 case Ndis802_11AuthModeOpen:
2747 case Ndis802_11AuthModeWPAPSK:
2749 case Ndis802_11AuthModeShared:
2751 case Ndis802_11AuthModeWPA:
2753 case Ndis802_11AuthModeWPA2:
2755 case Ndis802_11AuthModeWPA2PSK:
2757 case Ndis802_11AuthModeWPA1PSKWPA2PSK:
2758 return "WPAPSKWPA2PSK";
2759 case Ndis802_11AuthModeWPA1WPA2:
2761 case Ndis802_11AuthModeWPANone:
2766 PCHAR RTMPGetRalinkEncryModeStr(
2767 IN USHORT encryMode)
2772 case Ndis802_11WEPDisabled:
2774 case Ndis802_11WEPEnabled:
2776 case Ndis802_11Encryption2Enabled:
2778 case Ndis802_11Encryption3Enabled:
2780 case Ndis802_11Encryption4Enabled:
2785 INT RTMPShowCfgValue(
2786 IN PRTMP_ADAPTER pAd,
2792 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++)
2794 if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name))
2796 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf))
2798 break; //Exit for loop.
2802 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL)
2804 sprintf(pBuf, "\n");
2805 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++)
2806 sprintf(pBuf + strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
2813 IN PRTMP_ADAPTER pAd,
2816 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2817 sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid);
2821 INT Show_WirelessMode_Proc(
2822 IN PRTMP_ADAPTER pAd,
2825 switch(pAd->CommonCfg.PhyMode)
2827 case PHY_11BG_MIXED:
2828 sprintf(pBuf, "\t11B/G");
2831 sprintf(pBuf, "\t11B");
2834 sprintf(pBuf, "\t11A");
2836 case PHY_11ABG_MIXED:
2837 sprintf(pBuf, "\t11A/B/G");
2840 sprintf(pBuf, "\t11G");
2842 #ifdef DOT11_N_SUPPORT
2843 case PHY_11ABGN_MIXED:
2844 sprintf(pBuf, "\t11A/B/G/N");
2847 sprintf(pBuf, "\t11N only with 2.4G");
2849 case PHY_11GN_MIXED:
2850 sprintf(pBuf, "\t11G/N");
2852 case PHY_11AN_MIXED:
2853 sprintf(pBuf, "\t11A/N");
2855 case PHY_11BGN_MIXED:
2856 sprintf(pBuf, "\t11B/G/N");
2858 case PHY_11AGN_MIXED:
2859 sprintf(pBuf, "\t11A/G/N");
2862 sprintf(pBuf, "\t11N only with 5G");
2864 #endif // DOT11_N_SUPPORT //
2866 sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode);
2873 INT Show_TxBurst_Proc(
2874 IN PRTMP_ADAPTER pAd,
2877 sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE");
2881 INT Show_TxPreamble_Proc(
2882 IN PRTMP_ADAPTER pAd,
2885 switch(pAd->CommonCfg.TxPreamble)
2887 case Rt802_11PreambleShort:
2888 sprintf(pBuf, "\tShort");
2890 case Rt802_11PreambleLong:
2891 sprintf(pBuf, "\tLong");
2893 case Rt802_11PreambleAuto:
2894 sprintf(pBuf, "\tAuto");
2897 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble);
2904 INT Show_TxPower_Proc(
2905 IN PRTMP_ADAPTER pAd,
2908 sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage);
2912 INT Show_Channel_Proc(
2913 IN PRTMP_ADAPTER pAd,
2916 sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel);
2920 INT Show_BGProtection_Proc(
2921 IN PRTMP_ADAPTER pAd,
2924 switch(pAd->CommonCfg.UseBGProtection)
2927 sprintf(pBuf, "\tON");
2929 case 2: //Always OFF
2930 sprintf(pBuf, "\tOFF");
2933 sprintf(pBuf, "\tAuto");
2936 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection);
2942 INT Show_RTSThreshold_Proc(
2943 IN PRTMP_ADAPTER pAd,
2946 sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold);
2950 INT Show_FragThreshold_Proc(
2951 IN PRTMP_ADAPTER pAd,
2954 sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold);
2958 #ifdef DOT11_N_SUPPORT
2960 IN PRTMP_ADAPTER pAd,
2963 if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
2965 sprintf(pBuf, "\t40 MHz");
2969 sprintf(pBuf, "\t20 MHz");
2974 INT Show_HtMcs_Proc(
2975 IN PRTMP_ADAPTER pAd,
2978 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2979 sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS);
2984 IN PRTMP_ADAPTER pAd,
2987 switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI)
2990 sprintf(pBuf, "\tGI_400");
2993 sprintf(pBuf, "\tGI_800");
2996 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI);
3002 INT Show_HtOpMode_Proc(
3003 IN PRTMP_ADAPTER pAd,
3006 switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE)
3009 sprintf(pBuf, "\tGF");
3012 sprintf(pBuf, "\tMM");
3015 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE);
3021 INT Show_HtExtcha_Proc(
3022 IN PRTMP_ADAPTER pAd,
3025 switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)
3028 sprintf(pBuf, "\tBelow");
3031 sprintf(pBuf, "\tAbove");
3034 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA);
3041 INT Show_HtMpduDensity_Proc(
3042 IN PRTMP_ADAPTER pAd,
3045 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity);
3049 INT Show_HtBaWinSize_Proc(
3050 IN PRTMP_ADAPTER pAd,
3053 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit);
3057 INT Show_HtRdg_Proc(
3058 IN PRTMP_ADAPTER pAd,
3061 sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE");
3065 INT Show_HtAmsdu_Proc(
3066 IN PRTMP_ADAPTER pAd,
3069 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE");
3073 INT Show_HtAutoBa_Proc(
3074 IN PRTMP_ADAPTER pAd,
3077 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE");
3080 #endif // DOT11_N_SUPPORT //
3082 INT Show_CountryRegion_Proc(
3083 IN PRTMP_ADAPTER pAd,
3086 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion);
3090 INT Show_CountryRegionABand_Proc(
3091 IN PRTMP_ADAPTER pAd,
3094 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand);
3098 INT Show_CountryCode_Proc(
3099 IN PRTMP_ADAPTER pAd,
3102 sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode);
3106 #ifdef AGGREGATION_SUPPORT
3107 INT Show_PktAggregate_Proc(
3108 IN PRTMP_ADAPTER pAd,
3111 sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE");
3114 #endif // AGGREGATION_SUPPORT //
3117 INT Show_WmmCapable_Proc(
3118 IN PRTMP_ADAPTER pAd,
3121 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3122 sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE");
3126 #endif // WMM_SUPPORT //
3128 INT Show_IEEE80211H_Proc(
3129 IN PRTMP_ADAPTER pAd,
3132 sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE");
3136 INT Show_NetworkType_Proc(
3137 IN PRTMP_ADAPTER pAd,
3140 switch(pAd->StaCfg.BssType)
3143 sprintf(pBuf, "\tAdhoc");
3146 sprintf(pBuf, "\tInfra");
3149 sprintf(pBuf, "\tAny");
3152 sprintf(pBuf, "\tMonitor");
3155 sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType);
3161 INT Show_AuthMode_Proc(
3162 IN PRTMP_ADAPTER pAd,
3165 NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen;
3167 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3168 AuthMode = pAd->StaCfg.AuthMode;
3170 if ((AuthMode >= Ndis802_11AuthModeOpen) &&
3171 (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK))
3172 sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode));
3174 sprintf(pBuf, "\tUnknow Value(%d)", AuthMode);
3179 INT Show_EncrypType_Proc(
3180 IN PRTMP_ADAPTER pAd,
3183 NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled;
3185 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3186 WepStatus = pAd->StaCfg.WepStatus;
3188 if ((WepStatus >= Ndis802_11WEPEnabled) &&
3189 (WepStatus <= Ndis802_11Encryption4KeyAbsent))
3190 sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus));
3192 sprintf(pBuf, "\tUnknow Value(%d)", WepStatus);
3197 INT Show_DefaultKeyID_Proc(
3198 IN PRTMP_ADAPTER pAd,
3201 UCHAR DefaultKeyId = 0;
3203 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3204 DefaultKeyId = pAd->StaCfg.DefaultKeyId;
3206 sprintf(pBuf, "\t%d", DefaultKeyId);
3211 INT Show_WepKey_Proc(
3212 IN PRTMP_ADAPTER pAd,
3216 UCHAR Key[16] = {0}, KeyLength = 0;
3219 KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen;
3220 NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength);
3222 //check key string is ASCII or not
3223 if (RTMPCheckStrPrintAble(Key, KeyLength))
3224 sprintf(pBuf, "\t%s", Key);
3228 sprintf(pBuf, "\t");
3229 for (idx = 0; idx < KeyLength; idx++)
3230 sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]);
3236 IN PRTMP_ADAPTER pAd,
3239 Show_WepKey_Proc(pAd, 0, pBuf);
3244 IN PRTMP_ADAPTER pAd,
3247 Show_WepKey_Proc(pAd, 1, pBuf);
3252 IN PRTMP_ADAPTER pAd,
3255 Show_WepKey_Proc(pAd, 2, pBuf);
3260 IN PRTMP_ADAPTER pAd,
3263 Show_WepKey_Proc(pAd, 3, pBuf);
3267 INT Show_WPAPSK_Proc(
3268 IN PRTMP_ADAPTER pAd,
3272 UCHAR PMK[32] = {0};
3274 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3275 NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32);
3277 sprintf(pBuf, "\tPMK = ");
3278 for (idx = 0; idx < 32; idx++)
3279 sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]);