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(
78 INT Show_HtOpMode_Proc(
82 INT Show_HtExtcha_Proc(
86 INT Show_HtMpduDensity_Proc(
90 INT Show_HtBaWinSize_Proc(
98 INT Show_HtAmsdu_Proc(
102 INT Show_HtAutoBa_Proc(
103 IN PRTMP_ADAPTER pAd,
106 INT Show_CountryRegion_Proc(
107 IN PRTMP_ADAPTER pAd,
110 INT Show_CountryRegionABand_Proc(
111 IN PRTMP_ADAPTER pAd,
114 INT Show_CountryCode_Proc(
115 IN PRTMP_ADAPTER pAd,
118 #ifdef AGGREGATION_SUPPORT
119 INT Show_PktAggregate_Proc(
120 IN PRTMP_ADAPTER pAd,
122 #endif // AGGREGATION_SUPPORT //
125 INT Show_WmmCapable_Proc(
126 IN PRTMP_ADAPTER pAd,
128 #endif // WMM_SUPPORT //
130 INT Show_IEEE80211H_Proc(
131 IN PRTMP_ADAPTER pAd,
134 INT Show_NetworkType_Proc(
135 IN PRTMP_ADAPTER pAd,
138 INT Show_AuthMode_Proc(
139 IN PRTMP_ADAPTER pAd,
142 INT Show_EncrypType_Proc(
143 IN PRTMP_ADAPTER pAd,
146 INT Show_DefaultKeyID_Proc(
147 IN PRTMP_ADAPTER pAd,
151 IN PRTMP_ADAPTER pAd,
155 IN PRTMP_ADAPTER pAd,
159 IN PRTMP_ADAPTER pAd,
163 IN PRTMP_ADAPTER pAd,
166 INT Show_WPAPSK_Proc(
167 IN PRTMP_ADAPTER pAd,
172 INT (*show_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg);
173 } *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = {
174 {"SSID", Show_SSID_Proc},
175 {"WirelessMode", Show_WirelessMode_Proc},
176 {"TxBurst", Show_TxBurst_Proc},
177 {"TxPreamble", Show_TxPreamble_Proc},
178 {"TxPower", Show_TxPower_Proc},
179 {"Channel", Show_Channel_Proc},
180 {"BGProtection", Show_BGProtection_Proc},
181 {"RTSThreshold", Show_RTSThreshold_Proc},
182 {"FragThreshold", Show_FragThreshold_Proc},
183 {"HtBw", Show_HtBw_Proc},
184 {"HtMcs", Show_HtMcs_Proc},
185 {"HtGi", Show_HtGi_Proc},
186 {"HtOpMode", Show_HtOpMode_Proc},
187 {"HtExtcha", Show_HtExtcha_Proc},
188 {"HtMpduDensity", Show_HtMpduDensity_Proc},
189 {"HtBaWinSize", Show_HtBaWinSize_Proc},
190 {"HtRdg", Show_HtRdg_Proc},
191 {"HtAmsdu", Show_HtAmsdu_Proc},
192 {"HtAutoBa", Show_HtAutoBa_Proc},
193 {"CountryRegion", Show_CountryRegion_Proc},
194 {"CountryRegionABand", Show_CountryRegionABand_Proc},
195 {"CountryCode", Show_CountryCode_Proc},
196 #ifdef AGGREGATION_SUPPORT
197 {"PktAggregate", Show_PktAggregate_Proc},
201 {"WmmCapable", Show_WmmCapable_Proc},
203 {"IEEE80211H", Show_IEEE80211H_Proc},
204 {"NetworkType", Show_NetworkType_Proc},
205 {"AuthMode", Show_AuthMode_Proc},
206 {"EncrypType", Show_EncrypType_Proc},
207 {"DefaultKeyID", Show_DefaultKeyID_Proc},
208 {"Key1", Show_Key1_Proc},
209 {"Key2", Show_Key2_Proc},
210 {"Key3", Show_Key3_Proc},
211 {"Key4", Show_Key4_Proc},
212 {"WPAPSK", Show_WPAPSK_Proc},
217 ==========================================================================
222 ==========================================================================
224 INT Set_DriverVersion_Proc(
225 IN PRTMP_ADAPTER pAd,
228 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
229 DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION));
235 ==========================================================================
238 This command will not work, if the field of CountryRegion in eeprom is programmed.
240 TRUE if all parameters are OK, FALSE otherwise
241 ==========================================================================
243 INT Set_CountryRegion_Proc(
244 IN PRTMP_ADAPTER pAd,
249 region = simple_strtol(arg, 0, 10);
251 // Country can be set only when EEPROM not programmed
252 if (pAd->CommonCfg.CountryRegion & 0x80)
254 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameter of CountryRegion in eeprom is programmed \n"));
258 if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND))
260 pAd->CommonCfg.CountryRegion = (UCHAR) region;
262 else if (region == REGION_31_BG_BAND)
264 pAd->CommonCfg.CountryRegion = (UCHAR) region;
268 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameters out of range\n"));
272 // if set country region, driver needs to be reset
273 BuildChannelList(pAd);
275 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion));
281 ==========================================================================
283 Set Country Region for A band.
284 This command will not work, if the field of CountryRegion in eeprom is programmed.
286 TRUE if all parameters are OK, FALSE otherwise
287 ==========================================================================
289 INT Set_CountryRegionABand_Proc(
290 IN PRTMP_ADAPTER pAd,
295 region = simple_strtol(arg, 0, 10);
297 // Country can be set only when EEPROM not programmed
298 if (pAd->CommonCfg.CountryRegionForABand & 0x80)
300 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameter of CountryRegion in eeprom is programmed \n"));
304 if((region >= 0) && (region <= REGION_MAXIMUM_A_BAND))
306 pAd->CommonCfg.CountryRegionForABand = (UCHAR) region;
310 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameters out of range\n"));
314 // if set country region, driver needs to be reset
315 BuildChannelList(pAd);
317 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,
337 WirelessMode = simple_strtol(arg, 0, 10);
339 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
341 INT MaxPhyMode = PHY_11G;
343 MaxPhyMode = PHY_11N_5G;
345 if (WirelessMode <= MaxPhyMode)
347 RTMPSetPhyMode(pAd, WirelessMode);
349 if (WirelessMode >= PHY_11ABGN_MIXED)
351 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
352 pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE;
356 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
357 pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE;
360 // Set AdhocMode rates
361 if (pAd->StaCfg.BssType == BSS_ADHOC)
363 MlmeUpdateTxRates(pAd, FALSE, 0);
364 MakeIbssBeacon(pAd); // re-build BEACON frame
365 AsicEnableIbssSync(pAd); // copy to on-chip memory
374 // it is needed to set SSID to take effect
378 DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%ld)\n", WirelessMode));
382 DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n"));
389 ==========================================================================
393 TRUE if all parameters are OK, FALSE otherwise
394 ==========================================================================
396 INT Set_Channel_Proc(
397 IN PRTMP_ADAPTER pAd,
403 Channel = (UCHAR) simple_strtol(arg, 0, 10);
405 // check if this channel is valid
406 if (ChannelSanity(pAd, Channel) == TRUE)
408 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
410 pAd->CommonCfg.Channel = Channel;
415 if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED &&
416 pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
419 AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
420 AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
421 DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n",
422 pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel));
426 AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
427 AsicLockChannel(pAd, pAd->CommonCfg.Channel);
428 DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel));
436 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
442 DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel));
448 ==========================================================================
450 Set Short Slot Time Enable or Disable
452 TRUE if all parameters are OK, FALSE otherwise
453 ==========================================================================
455 INT Set_ShortSlot_Proc(
456 IN PRTMP_ADAPTER pAd,
461 ShortSlot = simple_strtol(arg, 0, 10);
464 pAd->CommonCfg.bUseShortSlotTime = TRUE;
465 else if (ShortSlot == 0)
466 pAd->CommonCfg.bUseShortSlotTime = FALSE;
468 return FALSE; //Invalid argument
470 DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime));
476 ==========================================================================
480 TRUE if all parameters are OK, FALSE otherwise
481 ==========================================================================
483 INT Set_TxPower_Proc(
484 IN PRTMP_ADAPTER pAd,
490 TxPower = (ULONG) simple_strtol(arg, 0, 10);
493 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
495 pAd->CommonCfg.TxPowerDefault = TxPower;
496 pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
503 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
509 ==========================================================================
511 Set 11B/11G Protection
513 TRUE if all parameters are OK, FALSE otherwise
514 ==========================================================================
516 INT Set_BGProtection_Proc(
517 IN PRTMP_ADAPTER pAd,
520 switch (simple_strtol(arg, 0, 10))
523 pAd->CommonCfg.UseBGProtection = 0;
526 pAd->CommonCfg.UseBGProtection = 1;
529 pAd->CommonCfg.UseBGProtection = 2;
531 default: //Invalid argument
536 DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection));
542 ==========================================================================
546 TRUE if all parameters are OK, FALSE otherwise
547 ==========================================================================
549 INT Set_TxPreamble_Proc(
550 IN PRTMP_ADAPTER pAd,
553 RT_802_11_PREAMBLE Preamble;
555 Preamble = simple_strtol(arg, 0, 10);
560 case Rt802_11PreambleShort:
561 pAd->CommonCfg.TxPreamble = Preamble;
563 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
564 MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);
566 case Rt802_11PreambleLong:
567 case Rt802_11PreambleAuto:
568 // if user wants AUTO, initialize to LONG here, then change according to AP's
569 // capability upon association.
570 pAd->CommonCfg.TxPreamble = Preamble;
572 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
573 MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);
575 default: //Invalid argument
579 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble));
585 ==========================================================================
589 TRUE if all parameters are OK, FALSE otherwise
590 ==========================================================================
592 INT Set_RTSThreshold_Proc(
593 IN PRTMP_ADAPTER pAd,
596 NDIS_802_11_RTS_THRESHOLD RtsThresh;
598 RtsThresh = simple_strtol(arg, 0, 10);
600 if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD))
601 pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
602 else if (RtsThresh == 0)
603 pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;
605 return FALSE; //Invalid argument
607 DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold));
613 ==========================================================================
615 Set Fragment Threshold
617 TRUE if all parameters are OK, FALSE otherwise
618 ==========================================================================
620 INT Set_FragThreshold_Proc(
621 IN PRTMP_ADAPTER pAd,
624 NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
626 FragThresh = simple_strtol(arg, 0, 10);
628 if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)
630 //Illegal FragThresh so we set it to default
631 pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
633 else if (FragThresh % 2 == 1)
635 // The length of each fragment shall always be an even number of octets, except for the last fragment
636 // of an MSDU or MMPDU, which may be either an even or an odd number of octets.
637 pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1);
641 pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
644 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
646 if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)
647 pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;
649 pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;
652 DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold));
658 ==========================================================================
662 TRUE if all parameters are OK, FALSE otherwise
663 ==========================================================================
665 INT Set_TxBurst_Proc(
666 IN PRTMP_ADAPTER pAd,
671 TxBurst = simple_strtol(arg, 0, 10);
673 pAd->CommonCfg.bEnableTxBurst = TRUE;
674 else if (TxBurst == 0)
675 pAd->CommonCfg.bEnableTxBurst = FALSE;
677 return FALSE; //Invalid argument
679 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst));
684 #ifdef AGGREGATION_SUPPORT
686 ==========================================================================
690 TRUE if all parameters are OK, FALSE otherwise
691 ==========================================================================
693 INT Set_PktAggregate_Proc(
694 IN PRTMP_ADAPTER pAd,
699 aggre = simple_strtol(arg, 0, 10);
702 pAd->CommonCfg.bAggregationCapable = TRUE;
704 pAd->CommonCfg.bAggregationCapable = FALSE;
706 return FALSE; //Invalid argument
709 DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable));
716 ==========================================================================
719 This parameter is 1 when needs radar detection, otherwise 0
721 TRUE if all parameters are OK, FALSE otherwise
722 ==========================================================================
724 INT Set_IEEE80211H_Proc(
725 IN PRTMP_ADAPTER pAd,
730 ieee80211h = simple_strtol(arg, 0, 10);
733 pAd->CommonCfg.bIEEE80211H = TRUE;
734 else if (ieee80211h == 0)
735 pAd->CommonCfg.bIEEE80211H = FALSE;
737 return FALSE; //Invalid argument
739 DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H));
747 ==========================================================================
749 For Debug information
751 TRUE if all parameters are OK, FALSE otherwise
752 ==========================================================================
755 IN PRTMP_ADAPTER pAd,
758 DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n"));
760 if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD)
761 RTDebugLevel = simple_strtol(arg, 0, 10);
763 DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel));
769 INT Show_DescInfo_Proc(
770 IN PRTMP_ADAPTER pAd,
778 ==========================================================================
780 Reset statistics counter
783 pAdapter Pointer to our adapter
787 TRUE if all parameters are OK, FALSE otherwise
788 ==========================================================================
790 INT Set_ResetStatCounter_Proc(
791 IN PRTMP_ADAPTER pAd,
795 //MAC_TABLE_ENTRY *pEntry;
797 DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n"));
799 // add the most up-to-date h/w raw counters into software counters
800 NICUpdateRawCounters(pAd);
802 NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));
803 NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));
804 NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));
809 BOOLEAN RTMPCheckStrPrintAble(
815 for (i=0; i<strLen; i++)
817 if ((pInPutStr[i] < 0x21) ||
818 (pInPutStr[i] > 0x7E))
826 ========================================================================
829 Remove WPA Key process
832 pAd Pointer to our adapter
833 pBuf Pointer to the where the key stored
836 NDIS_SUCCESS Add key successfully
838 IRQL = DISPATCH_LEVEL
842 ========================================================================
844 VOID RTMPSetDesiredRates(
845 IN PRTMP_ADAPTER pAdapter,
848 NDIS_802_11_RATES aryRates;
850 memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
851 switch (pAdapter->CommonCfg.PhyMode)
853 case PHY_11A: // A only
857 aryRates[0] = 0x0c; // 6M
858 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
861 aryRates[0] = 0x12; // 9M
862 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
865 aryRates[0] = 0x18; // 12M
866 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
869 aryRates[0] = 0x24; // 18M
870 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
873 aryRates[0] = 0x30; // 24M
874 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
877 aryRates[0] = 0x48; // 36M
878 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
881 aryRates[0] = 0x60; // 48M
882 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
885 aryRates[0] = 0x6c; // 54M
886 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
890 aryRates[0] = 0x6c; // 54Mbps
891 aryRates[1] = 0x60; // 48Mbps
892 aryRates[2] = 0x48; // 36Mbps
893 aryRates[3] = 0x30; // 24Mbps
894 aryRates[4] = 0x24; // 18M
895 aryRates[5] = 0x18; // 12M
896 aryRates[6] = 0x12; // 9M
897 aryRates[7] = 0x0c; // 6M
898 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
902 case PHY_11BG_MIXED: // B/G Mixed
903 case PHY_11B: // B only
904 case PHY_11ABG_MIXED: // A/B/G Mixed
910 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
914 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
917 aryRates[0] = 0x0b; // 5.5M
918 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
921 aryRates[0] = 0x16; // 11M
922 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
925 aryRates[0] = 0x0c; // 6M
926 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
929 aryRates[0] = 0x12; // 9M
930 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
933 aryRates[0] = 0x18; // 12M
934 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
937 aryRates[0] = 0x24; // 18M
938 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
941 aryRates[0] = 0x30; // 24M
942 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
945 aryRates[0] = 0x48; // 36M
946 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
949 aryRates[0] = 0x60; // 48M
950 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
953 aryRates[0] = 0x6c; // 54M
954 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
958 if (pAdapter->CommonCfg.PhyMode == PHY_11B)
960 aryRates[0] = 0x16; // 11Mbps
961 aryRates[1] = 0x0b; // 5.5Mbps
962 aryRates[2] = 0x04; // 2Mbps
963 aryRates[3] = 0x02; // 1Mbps
966 { //(B/G) Mixed or (A/B/G) Mixed
967 aryRates[0] = 0x6c; // 54Mbps
968 aryRates[1] = 0x60; // 48Mbps
969 aryRates[2] = 0x48; // 36Mbps
970 aryRates[3] = 0x30; // 24Mbps
971 aryRates[4] = 0x16; // 11Mbps
972 aryRates[5] = 0x0b; // 5.5Mbps
973 aryRates[6] = 0x04; // 2Mbps
974 aryRates[7] = 0x02; // 1Mbps
976 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
982 NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
983 NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
984 DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
985 pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1],
986 pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3],
987 pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5],
988 pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] ));
989 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
990 MlmeUpdateTxRates(pAdapter, FALSE, 0);
993 NDIS_STATUS RTMPWPARemoveKeyProc(
994 IN PRTMP_ADAPTER pAd,
997 PNDIS_802_11_REMOVE_KEY pKey;
999 NDIS_STATUS Status = NDIS_STATUS_FAILURE;
1000 BOOLEAN bTxKey; // Set the key as transmit key
1001 BOOLEAN bPairwise; // Indicate the key is pairwise key
1002 BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value.
1003 // Otherwise, it will set by the NIC.
1004 BOOLEAN bAuthenticator; // indicate key is set by authenticator.
1007 DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n"));
1009 pKey = (PNDIS_802_11_REMOVE_KEY) pBuf;
1010 KeyIdx = pKey->KeyIndex & 0xff;
1011 // Bit 31 of Add-key, Tx Key
1012 bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE;
1013 // Bit 30 of Add-key PairwiseKey
1014 bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE;
1015 // Bit 29 of Add-key KeyRSC
1016 bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE;
1017 // Bit 28 of Add-key Authenticator
1018 bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE;
1020 // 1. If bTx is TRUE, return failure information
1022 return(NDIS_STATUS_INVALID_DATA);
1024 // 2. Check Pairwise Key
1027 // a. If BSSID is broadcast, remove all pairwise keys.
1028 // b. If not broadcast, remove the pairwise specified by BSSID
1029 for (i = 0; i < SHARE_KEY_NUM; i++)
1031 if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID))
1033 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i));
1034 pAd->SharedKey[BSS0][i].KeyLen = 0;
1035 pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE;
1036 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i);
1037 Status = NDIS_STATUS_SUCCESS;
1045 // a. If BSSID is broadcast, remove all group keys indexed
1046 // b. If BSSID matched, delete the group key indexed.
1047 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx));
1048 pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
1049 pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
1050 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx);
1051 Status = NDIS_STATUS_SUCCESS;
1058 ========================================================================
1060 Routine Description:
1064 pAd Pointer to our adapter
1069 IRQL = DISPATCH_LEVEL
1073 ========================================================================
1075 VOID RTMPWPARemoveAllKeys(
1076 IN PRTMP_ADAPTER pAd)
1081 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
1083 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1084 // Link up. And it will be replaced if user changed it.
1085 if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)
1088 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1089 // Link up. And it will be replaced if user changed it.
1090 if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone)
1093 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1094 AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
1096 // set all shared key mode as no-security.
1097 for (i = 0; i < SHARE_KEY_NUM; i++)
1099 DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
1100 NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY));
1102 AsicRemoveSharedKeyEntry(pAd, BSS0, i);
1108 ========================================================================
1109 Routine Description:
1110 Change NIC PHY mode. Re-association may be necessary. possible settings
1111 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1114 pAd - Pointer to our adapter
1117 IRQL = PASSIVE_LEVEL
1118 IRQL = DISPATCH_LEVEL
1120 ========================================================================
1122 VOID RTMPSetPhyMode(
1123 IN PRTMP_ADAPTER pAd,
1127 // the selected phymode must be supported by the RF IC encoded in E2PROM
1129 pAd->CommonCfg.PhyMode = (UCHAR)phymode;
1131 DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
1133 BuildChannelList(pAd);
1135 // sanity check user setting
1136 for (i = 0; i < pAd->ChannelListNum; i++)
1138 if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
1142 if (i == pAd->ChannelListNum)
1144 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1145 pAd->CommonCfg.Channel = FirstChannel(pAd);
1146 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel));
1149 NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES);
1150 NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES);
1151 NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1154 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1155 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1156 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1157 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1158 pAd->CommonCfg.SupRateLen = 4;
1159 pAd->CommonCfg.ExtRateLen = 0;
1160 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1161 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1162 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1163 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1164 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1168 case PHY_11BG_MIXED:
1169 case PHY_11ABG_MIXED:
1171 case PHY_11ABGN_MIXED:
1172 case PHY_11BGN_MIXED:
1173 case PHY_11GN_MIXED:
1174 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1175 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1176 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1177 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1178 pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1179 pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1180 pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1181 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1182 pAd->CommonCfg.SupRateLen = 8;
1183 pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1184 pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1185 pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1186 pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1187 pAd->CommonCfg.ExtRateLen = 4;
1188 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1189 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1190 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1191 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1192 pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
1193 pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
1194 pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
1195 pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
1196 pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
1197 pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
1198 pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
1199 pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
1203 case PHY_11AN_MIXED:
1204 case PHY_11AGN_MIXED:
1206 pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1207 pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1208 pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1209 pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1210 pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1211 pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1212 pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1213 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1214 pAd->CommonCfg.SupRateLen = 8;
1215 pAd->CommonCfg.ExtRateLen = 0;
1216 pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
1217 pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
1218 pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
1219 pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
1220 pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
1221 pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
1222 pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
1223 pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
1224 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1232 pAd->CommonCfg.BandState = UNKNOWN_BAND;
1236 ========================================================================
1237 Routine Description:
1238 Caller ensures we has 802.11n support.
1239 Calls at setting HT from AP/STASetinformation
1242 pAd - Pointer to our adapter
1245 ========================================================================
1248 IN PRTMP_ADAPTER pAd,
1249 IN OID_SET_HT_PHYMODE *pHTPhyMode)
1254 UCHAR BBP3Value = 0;
1255 UCHAR RxStream = pAd->CommonCfg.RxStream;
1257 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1258 pHTPhyMode->HtMode, pHTPhyMode->ExtOffset,
1259 pHTPhyMode->MCS, pHTPhyMode->BW,
1260 pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
1262 // Don't zero supportedHyPhy structure.
1263 RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability));
1264 RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo));
1265 RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset));
1266 RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy));
1268 if (pAd->CommonCfg.bRdg)
1270 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1;
1271 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1;
1275 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0;
1276 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0;
1279 pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3;
1280 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3;
1282 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit));
1284 // Mimo power save, A-MSDU size,
1285 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
1286 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize;
1287 pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode;
1288 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1290 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
1291 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
1292 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1294 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1295 pAd->CommonCfg.DesiredHtPhy.AmsduSize,
1296 pAd->CommonCfg.DesiredHtPhy.MimoPs,
1297 pAd->CommonCfg.DesiredHtPhy.MpduDensity,
1298 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
1300 if(pHTPhyMode->HtMode == HTMODE_GF)
1302 pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1;
1303 pAd->CommonCfg.DesiredHtPhy.GF = 1;
1306 pAd->CommonCfg.DesiredHtPhy.GF = 0;
1312 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1313 pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
1317 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1318 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1322 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1323 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1324 pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
1328 if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) )
1330 pHTPhyMode->BW = BW_20;
1331 pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1;
1334 if(pHTPhyMode->BW == BW_40)
1336 pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
1337 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
1338 if (pAd->CommonCfg.Channel <= 14)
1339 pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
1341 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1;
1342 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
1343 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE;
1344 // Set Regsiter for extension channel position.
1345 RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
1346 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
1347 if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW))
1350 BBP3Value |= (0x20);
1351 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1353 else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE))
1356 BBP3Value &= (~0x20);
1357 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1360 // Turn on BBP 40MHz mode now only as AP .
1361 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1362 if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
1365 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1366 BBPValue &= (~0x18);
1368 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1370 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value);
1371 pAd->CommonCfg.BBPCurrentBW = BW_40;
1376 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0;
1377 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0;
1378 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
1379 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE;
1380 pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
1381 // Turn on BBP 20MHz mode by request here.
1383 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1384 BBPValue &= (~0x18);
1385 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1386 pAd->CommonCfg.BBPCurrentBW = BW_20;
1390 if(pHTPhyMode->STBC == STBC_USE)
1392 pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1;
1393 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1;
1394 pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1;
1395 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1;
1399 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
1400 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
1403 if(pHTPhyMode->SHORTGI == GI_400)
1405 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1;
1406 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1;
1407 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1;
1408 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1;
1412 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0;
1413 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0;
1414 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0;
1415 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0;
1418 // We support link adaptation for unsolicit MCS feedback, set to 2.
1419 pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
1420 pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
1421 // 1, the extension channel above the control channel.
1423 // EDCA parameters used for AP's own transmission
1424 if (pAd->CommonCfg.APEdcaParm.bValid == FALSE)
1426 pAd->CommonCfg.APEdcaParm.bValid = TRUE;
1427 pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
1428 pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7;
1429 pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1;
1430 pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1;
1432 pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4;
1433 pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4;
1434 pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3;
1435 pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2;
1437 pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6;
1438 pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10;
1439 pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4;
1440 pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3;
1442 pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
1443 pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
1444 pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
1445 pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
1447 AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm);
1449 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1451 RTMPSetIndividualHT(pAd, 0);
1456 ========================================================================
1457 Routine Description:
1458 Caller ensures we has 802.11n support.
1459 Calls at setting HT from AP/STASetinformation
1462 pAd - Pointer to our adapter
1465 ========================================================================
1467 VOID RTMPSetIndividualHT(
1468 IN PRTMP_ADAPTER pAd,
1471 PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
1472 UCHAR TxStream = pAd->CommonCfg.TxStream;
1473 UCHAR DesiredMcs = MCS_AUTO;
1477 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1479 pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
1480 DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS;
1481 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1486 if (pDesired_ht_phy == NULL)
1488 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
1491 RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO));
1493 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
1494 // Check the validity of MCS
1495 if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15)))
1497 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs));
1501 if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32))
1503 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1507 pDesired_ht_phy->bHtEnable = TRUE;
1509 // Decide desired Tx MCS
1513 if (DesiredMcs == MCS_AUTO)
1515 pDesired_ht_phy->MCSSet[0]= 0xff;
1516 pDesired_ht_phy->MCSSet[1]= 0x00;
1518 else if (DesiredMcs <= MCS_7)
1520 pDesired_ht_phy->MCSSet[0]= 1<<DesiredMcs;
1521 pDesired_ht_phy->MCSSet[1]= 0x00;
1526 if (DesiredMcs == MCS_AUTO)
1528 pDesired_ht_phy->MCSSet[0]= 0xff;
1529 pDesired_ht_phy->MCSSet[1]= 0xff;
1531 else if (DesiredMcs <= MCS_15)
1535 mode = DesiredMcs / 8;
1537 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1542 if (DesiredMcs == MCS_AUTO)
1544 /* MCS0 ~ MCS23, 3 bytes */
1545 pDesired_ht_phy->MCSSet[0]= 0xff;
1546 pDesired_ht_phy->MCSSet[1]= 0xff;
1547 pDesired_ht_phy->MCSSet[2]= 0xff;
1549 else if (DesiredMcs <= MCS_23)
1553 mode = DesiredMcs / 8;
1555 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1560 if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40)
1562 if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
1563 pDesired_ht_phy->MCSSet[4] = 0x1;
1566 // update HT Rate setting
1567 if (pAd->OpMode == OPMODE_STA)
1568 MlmeUpdateHtTxRates(pAd, BSS0);
1570 MlmeUpdateHtTxRates(pAd, apidx);
1575 ========================================================================
1576 Routine Description:
1577 Update HT IE from our capability.
1580 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1583 ========================================================================
1585 VOID RTMPUpdateHTIE(
1586 IN RT_HT_CAPABILITY *pRtHt,
1588 OUT HT_CAPABILITY_IE *pHtCapability,
1589 OUT ADD_HT_INFO_IE *pAddHtInfo)
1591 RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE));
1592 RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE));
1594 pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
1595 pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
1596 pHtCapability->HtCapInfo.GF = pRtHt->GF;
1597 pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
1598 pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
1599 pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
1600 pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
1601 pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
1602 pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
1603 pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
1605 pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ;
1606 pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
1607 pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
1608 pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
1609 RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1611 DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n"));
1615 ========================================================================
1617 Add Client security information into ASIC WCID table and IVEIV table.
1619 ========================================================================
1621 VOID RTMPAddWcidAttributeEntry(
1622 IN PRTMP_ADAPTER pAd,
1626 IN MAC_TABLE_ENTRY *pEntry)
1628 UINT32 WCIDAttri = 0;
1634 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1638 DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx));
1642 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
1643 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
1644 // the AID:2~ assign to mesh link entry.
1645 if (pEntry && ADHOC_ON(pAd))
1647 else if (pEntry && INFRA_ON(pAd))
1656 // Update WCID attribute table
1657 offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE);
1659 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1661 if (pEntry && pEntry->ValidAsMesh)
1662 WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE;
1664 WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE;
1667 RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
1670 // Update IV/EIV table
1671 offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
1674 if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES))
1676 // Eiv bit on. keyid always is 0 for pairwise key
1677 IVEIV = (KeyIdx <<6) | 0x20;
1681 // WEP KeyIdx is default tx key.
1682 IVEIV = (KeyIdx << 6);
1685 // For key index and ext IV bit, so only need to update the position(offset+3).
1687 RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV);
1690 DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg]));
1691 DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri));
1696 ==========================================================================
1698 Parse encryption type
1700 pAdapter Pointer to our adapter
1701 wrq Pointer to the ioctl argument
1707 ==========================================================================
1709 CHAR *GetEncryptType(CHAR enc)
1711 if(enc == Ndis802_11WEPDisabled)
1713 if(enc == Ndis802_11WEPEnabled)
1715 if(enc == Ndis802_11Encryption2Enabled)
1717 if(enc == Ndis802_11Encryption3Enabled)
1719 if(enc == Ndis802_11Encryption4Enabled)
1725 CHAR *GetAuthMode(CHAR auth)
1727 if(auth == Ndis802_11AuthModeOpen)
1729 if(auth == Ndis802_11AuthModeShared)
1731 if(auth == Ndis802_11AuthModeAutoSwitch)
1733 if(auth == Ndis802_11AuthModeWPA)
1735 if(auth == Ndis802_11AuthModeWPAPSK)
1737 if(auth == Ndis802_11AuthModeWPANone)
1739 if(auth == Ndis802_11AuthModeWPA2)
1741 if(auth == Ndis802_11AuthModeWPA2PSK)
1743 if(auth == Ndis802_11AuthModeWPA1WPA2)
1745 if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
1746 return "WPA1PSKWPA2PSK";
1752 ==========================================================================
1754 Get site survey results
1756 pAdapter Pointer to our adapter
1757 wrq Pointer to the ioctl argument
1764 1.) UI needs to wait 4 seconds after issue a site survey command
1765 2.) iwpriv ra0 get_site_survey
1766 3.) UI needs to prepare at least 4096bytes to get the results
1767 ==========================================================================
1769 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
1770 VOID RTMPIoctlGetSiteSurvey(
1771 IN PRTMP_ADAPTER pAdapter,
1772 IN struct iwreq *wrq)
1778 CHAR Ssid[MAX_LEN_OF_SSID +1];
1779 INT Rssi = 0, max_len = LINE_LEN;
1780 UINT Rssi_Quality = 0;
1781 NDIS_802_11_NETWORK_TYPE wireless_mode;
1783 os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len));
1787 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
1791 memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len );
1792 memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1));
1793 sprintf(msg,"%s","\n");
1794 sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
1795 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
1798 pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE;
1800 while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200))
1803 for(i=0; i<pAdapter->ScanTab.BssNr ;i++)
1805 if( pAdapter->ScanTab.BssEntry[i].Channel==0)
1808 if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA)
1812 sprintf(msg+strlen(msg),"%-4d", pAdapter->ScanTab.BssEntry[i].Channel);
1814 memcpy(Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen);
1815 Ssid[pAdapter->ScanTab.BssEntry[i].SsidLen] = '\0';
1816 sprintf(msg+strlen(msg),"%-33s", Ssid);
1818 sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ",
1819 pAdapter->ScanTab.BssEntry[i].Bssid[0],
1820 pAdapter->ScanTab.BssEntry[i].Bssid[1],
1821 pAdapter->ScanTab.BssEntry[i].Bssid[2],
1822 pAdapter->ScanTab.BssEntry[i].Bssid[3],
1823 pAdapter->ScanTab.BssEntry[i].Bssid[4],
1824 pAdapter->ScanTab.BssEntry[i].Bssid[5]);
1826 sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus));
1827 //Authentication Mode
1828 if (pAdapter->ScanTab.BssEntry[i].WepStatus == Ndis802_11WEPEnabled)
1829 sprintf(msg+strlen(msg),"%-10s", "UNKNOW");
1831 sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode));
1833 Rssi = (INT)pAdapter->ScanTab.BssEntry[i].Rssi;
1836 else if (Rssi >= -80) // between -50 ~ -80dbm
1837 Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10);
1838 else if (Rssi >= -90) // between -80 ~ -90dbm
1839 Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10);
1842 sprintf(msg+strlen(msg),"%-9d", Rssi_Quality);
1844 wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]);
1845 if (wireless_mode == Ndis802_11FH ||
1846 wireless_mode == Ndis802_11DS)
1847 sprintf(msg+strlen(msg),"%-7s", "11b");
1848 else if (wireless_mode == Ndis802_11OFDM5)
1849 sprintf(msg+strlen(msg),"%-7s", "11a");
1850 else if (wireless_mode == Ndis802_11OFDM5_N)
1851 sprintf(msg+strlen(msg),"%-7s", "11a/n");
1852 else if (wireless_mode == Ndis802_11OFDM24)
1853 sprintf(msg+strlen(msg),"%-7s", "11b/g");
1854 else if (wireless_mode == Ndis802_11OFDM24_N)
1855 sprintf(msg+strlen(msg),"%-7s", "11b/g/n");
1857 sprintf(msg+strlen(msg),"%-7s", "unknow");
1859 if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC)
1860 sprintf(msg+strlen(msg),"%-3s", " Ad");
1862 sprintf(msg+strlen(msg),"%-3s", " In");
1864 sprintf(msg+strlen(msg),"\n");
1867 pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE;
1868 wrq->u.data.length = strlen(msg);
1869 Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);
1871 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length));
1872 os_free_mem(NULL, (PUCHAR)msg);
1876 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
1877 VOID RTMPIoctlGetMacTable(
1878 IN PRTMP_ADAPTER pAd,
1879 IN struct iwreq *wrq)
1882 RT_802_11_MAC_TABLE MacTab;
1886 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1888 if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC))
1890 COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr);
1891 MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid;
1892 MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode;
1893 MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode;
1895 // Fill in RSSI per entry
1896 MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0;
1897 MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1;
1898 MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2;
1900 // the connected time per entry
1901 MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime;
1902 MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS;
1903 MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW;
1904 MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI;
1905 MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC;
1906 MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv;
1907 MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE;
1908 MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word;
1913 wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE);
1914 if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length))
1916 DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__));
1919 msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG);
1920 memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN );
1921 sprintf(msg,"%s","\n");
1922 sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
1923 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
1925 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1927 PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];
1928 if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC))
1930 if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) )
1932 sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ",
1933 pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],
1934 pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);
1935 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid);
1936 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode);
1937 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
1938 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
1939 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
1940 sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]);
1941 sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
1944 // for compatible with old API just do the printk to console
1945 //wrq->u.data.length = strlen(msg);
1946 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
1948 DBGPRINT(RT_DEBUG_TRACE, ("%s", msg));
1954 INT Set_BASetup_Proc(
1955 IN PRTMP_ADAPTER pAd,
1959 char *token, sepValue[] = ":", DASH = '-';
1961 MAC_TABLE_ENTRY *pEntry;
1964 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
1965 =>The six 2 digit hex-decimal number previous are the Mac address,
1966 =>The seventh decimal number is the tid value.
1968 //printk("\n%s\n", arg);
1970 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
1973 token = strchr(arg, DASH);
1974 if ((token != NULL) && (strlen(token)>1))
1976 tid = simple_strtol((token+1), 0, 10);
1981 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
1983 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
1985 AtoH(token, (PUCHAR)(&mac[i]), 1);
1990 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1],
1991 mac[2], mac[3], mac[4], mac[5], tid);
1993 pEntry = MacTableLookup(pAd, mac);
1996 printk("\nSetup BA Session: Tid = %d\n", tid);
1997 BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE);
2007 INT Set_BADecline_Proc(
2008 IN PRTMP_ADAPTER pAd,
2013 bBADecline = simple_strtol(arg, 0, 10);
2015 if (bBADecline == 0)
2017 pAd->CommonCfg.bBADecline = FALSE;
2019 else if (bBADecline == 1)
2021 pAd->CommonCfg.bBADecline = TRUE;
2025 return FALSE; //Invalid argument
2028 DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline));
2033 INT Set_BAOriTearDown_Proc(
2034 IN PRTMP_ADAPTER pAd,
2038 char *token, sepValue[] = ":", DASH = '-';
2040 MAC_TABLE_ENTRY *pEntry;
2042 //printk("\n%s\n", arg);
2044 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2045 =>The six 2 digit hex-decimal number previous are the Mac address,
2046 =>The seventh decimal number is the tid value.
2048 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2051 token = strchr(arg, DASH);
2052 if ((token != NULL) && (strlen(token)>1))
2054 tid = simple_strtol((token+1), 0, 10);
2055 if (tid > NUM_OF_TID)
2059 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2061 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2063 AtoH(token, (PUCHAR)(&mac[i]), 1);
2068 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2069 mac[2], mac[3], mac[4], mac[5], tid);
2071 pEntry = MacTableLookup(pAd, mac);
2074 printk("\nTear down Ori BA Session: Tid = %d\n", tid);
2075 BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE);
2085 INT Set_BARecTearDown_Proc(
2086 IN PRTMP_ADAPTER pAd,
2090 char *token, sepValue[] = ":", DASH = '-';
2092 MAC_TABLE_ENTRY *pEntry;
2094 //printk("\n%s\n", arg);
2096 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2097 =>The six 2 digit hex-decimal number previous are the Mac address,
2098 =>The seventh decimal number is the tid value.
2100 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2103 token = strchr(arg, DASH);
2104 if ((token != NULL) && (strlen(token)>1))
2106 tid = simple_strtol((token+1), 0, 10);
2107 if (tid > NUM_OF_TID)
2111 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2113 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2115 AtoH(token, (PUCHAR)(&mac[i]), 1);
2120 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2121 mac[2], mac[3], mac[4], mac[5], tid);
2123 pEntry = MacTableLookup(pAd, mac);
2126 printk("\nTear down Rec BA Session: Tid = %d\n", tid);
2127 BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE);
2138 IN PRTMP_ADAPTER pAd,
2143 HtBw = simple_strtol(arg, 0, 10);
2145 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
2146 else if (HtBw == BW_20)
2147 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
2149 return FALSE; //Invalid argument
2153 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW));
2159 IN PRTMP_ADAPTER pAd,
2162 ULONG HtMcs, Mcs_tmp;
2163 BOOLEAN bAutoRate = FALSE;
2165 Mcs_tmp = simple_strtol(arg, 0, 10);
2167 if (Mcs_tmp <= 15 || Mcs_tmp == 32)
2172 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2174 pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs;
2175 pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE;
2176 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2177 pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch));
2179 if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) ||
2180 (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX))
2182 if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2183 (HtMcs >= 0 && HtMcs <= 3) &&
2184 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK))
2186 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000));
2188 else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2189 (HtMcs >= 0 && HtMcs <= 7) &&
2190 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM))
2192 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000));
2199 pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
2200 RTMPSetDesiredRates(pAd, -1);
2202 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode));
2214 IN PRTMP_ADAPTER pAd,
2219 HtGi = simple_strtol(arg, 0, 10);
2221 if ( HtGi == GI_400)
2222 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400;
2223 else if ( HtGi == GI_800 )
2224 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800;
2226 return FALSE; //Invalid argument
2230 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI));
2236 INT Set_HtTxBASize_Proc(
2237 IN PRTMP_ADAPTER pAd,
2242 Size = simple_strtol(arg, 0, 10);
2244 if (Size <=0 || Size >=64)
2248 pAd->CommonCfg.TxBASize = Size-1;
2249 DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size));
2255 INT Set_HtOpMode_Proc(
2256 IN PRTMP_ADAPTER pAd,
2262 Value = simple_strtol(arg, 0, 10);
2264 if (Value == HTMODE_GF)
2265 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF;
2266 else if ( Value == HTMODE_MM )
2267 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM;
2269 return FALSE; //Invalid argument
2273 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE));
2279 INT Set_HtStbc_Proc(
2280 IN PRTMP_ADAPTER pAd,
2286 Value = simple_strtol(arg, 0, 10);
2288 if (Value == STBC_USE)
2289 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE;
2290 else if ( Value == STBC_NONE )
2291 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE;
2293 return FALSE; //Invalid argument
2297 DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC));
2303 IN PRTMP_ADAPTER pAd,
2309 Value = simple_strtol(arg, 0, 10);
2311 pAd->HTCEnable = FALSE;
2312 else if ( Value ==1 )
2313 pAd->HTCEnable = TRUE;
2315 return FALSE; //Invalid argument
2317 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable));
2322 INT Set_HtExtcha_Proc(
2323 IN PRTMP_ADAPTER pAd,
2329 Value = simple_strtol(arg, 0, 10);
2332 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW;
2333 else if ( Value ==1 )
2334 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE;
2336 return FALSE; //Invalid argument
2340 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA));
2345 INT Set_HtMpduDensity_Proc(
2346 IN PRTMP_ADAPTER pAd,
2351 Value = simple_strtol(arg, 0, 10);
2353 if (Value <=7 && Value >= 0)
2354 pAd->CommonCfg.BACapability.field.MpduDensity = Value;
2356 pAd->CommonCfg.BACapability.field.MpduDensity = 4;
2360 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity));
2365 INT Set_HtBaWinSize_Proc(
2366 IN PRTMP_ADAPTER pAd,
2371 Value = simple_strtol(arg, 0, 10);
2374 if (Value >=1 && Value <= 64)
2376 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value;
2377 pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value;
2381 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64;
2382 pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64;
2387 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit));
2393 IN PRTMP_ADAPTER pAd,
2398 Value = simple_strtol(arg, 0, 10);
2401 pAd->CommonCfg.bRdg = FALSE;
2402 else if ( Value ==1 )
2404 pAd->HTCEnable = TRUE;
2405 pAd->CommonCfg.bRdg = TRUE;
2408 return FALSE; //Invalid argument
2412 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg));
2417 INT Set_HtLinkAdapt_Proc(
2418 IN PRTMP_ADAPTER pAd,
2423 Value = simple_strtol(arg, 0, 10);
2425 pAd->bLinkAdapt = FALSE;
2426 else if ( Value ==1 )
2428 pAd->HTCEnable = TRUE;
2429 pAd->bLinkAdapt = TRUE;
2432 return FALSE; //Invalid argument
2434 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt));
2439 INT Set_HtAmsdu_Proc(
2440 IN PRTMP_ADAPTER pAd,
2445 Value = simple_strtol(arg, 0, 10);
2447 pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE;
2448 else if ( Value == 1 )
2449 pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE;
2451 return FALSE; //Invalid argument
2455 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable));
2460 INT Set_HtAutoBa_Proc(
2461 IN PRTMP_ADAPTER pAd,
2466 Value = simple_strtol(arg, 0, 10);
2469 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
2470 pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE;
2472 else if (Value == 1)
2474 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
2475 pAd->CommonCfg.BACapability.field.Policy = IMMED_BA;
2478 return FALSE; //Invalid argument
2480 pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
2481 pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy;
2484 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA));
2490 INT Set_HtProtect_Proc(
2491 IN PRTMP_ADAPTER pAd,
2496 Value = simple_strtol(arg, 0, 10);
2498 pAd->CommonCfg.bHTProtect = FALSE;
2499 else if (Value == 1)
2500 pAd->CommonCfg.bHTProtect = TRUE;
2502 return FALSE; //Invalid argument
2504 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect));
2509 INT Set_SendPSMPAction_Proc(
2510 IN PRTMP_ADAPTER pAd,
2514 char *token, sepValue[] = ":", DASH = '-';
2516 MAC_TABLE_ENTRY *pEntry;
2518 //printk("\n%s\n", arg);
2520 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2521 =>The six 2 digit hex-decimal number previous are the Mac address,
2522 =>The seventh decimal number is the mode value.
2524 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2527 token = strchr(arg, DASH);
2528 if ((token != NULL) && (strlen(token)>1))
2530 mode = simple_strtol((token+1), 0, 10);
2531 if (mode > MMPS_ENABLE)
2535 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2537 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2539 AtoH(token, (PUCHAR)(&mac[i]), 1);
2544 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2545 mac[2], mac[3], mac[4], mac[5], mode);
2547 pEntry = MacTableLookup(pAd, mac);
2550 printk("\nSendPSMPAction MIPS mode = %d\n", mode);
2551 SendPSMPAction(pAd, pEntry->Aid, mode);
2562 INT Set_HtMIMOPSmode_Proc(
2563 IN PRTMP_ADAPTER pAd,
2568 Value = simple_strtol(arg, 0, 10);
2570 if (Value <=3 && Value >= 0)
2571 pAd->CommonCfg.BACapability.field.MMPSmode = Value;
2573 pAd->CommonCfg.BACapability.field.MMPSmode = 3;
2577 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode));
2583 INT Set_ForceShortGI_Proc(
2584 IN PRTMP_ADAPTER pAd,
2589 Value = simple_strtol(arg, 0, 10);
2591 pAd->WIFItestbed.bShortGI = FALSE;
2592 else if (Value == 1)
2593 pAd->WIFItestbed.bShortGI = TRUE;
2595 return FALSE; //Invalid argument
2599 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI));
2606 INT Set_ForceGF_Proc(
2607 IN PRTMP_ADAPTER pAd,
2612 Value = simple_strtol(arg, 0, 10);
2614 pAd->WIFItestbed.bGreenField = FALSE;
2615 else if (Value == 1)
2616 pAd->WIFItestbed.bGreenField = TRUE;
2618 return FALSE; //Invalid argument
2622 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField));
2627 INT Set_HtMimoPs_Proc(
2628 IN PRTMP_ADAPTER pAd,
2633 Value = simple_strtol(arg, 0, 10);
2635 pAd->CommonCfg.bMIMOPSEnable = FALSE;
2636 else if (Value == 1)
2637 pAd->CommonCfg.bMIMOPSEnable = TRUE;
2639 return FALSE; //Invalid argument
2641 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable));
2647 IN PRTMP_ADAPTER pAd)
2649 OID_SET_HT_PHYMODE SetHT;
2651 if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED)
2654 SetHT.PhyMode = pAd->CommonCfg.PhyMode;
2655 SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath);
2656 SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
2657 SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
2658 SetHT.MCS = MCS_AUTO;
2659 SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
2660 SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
2661 SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
2663 RTMPSetHT(pAd, &SetHT);
2668 INT Set_FixedTxMode_Proc(
2669 IN PRTMP_ADAPTER pAd,
2672 UCHAR fix_tx_mode = FIXED_TXMODE_HT;
2674 if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0)
2676 fix_tx_mode = FIXED_TXMODE_OFDM;
2678 else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0)
2680 fix_tx_mode = FIXED_TXMODE_CCK;
2683 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2684 pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode;
2686 DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode));
2691 /////////////////////////////////////////////////////////////////////////
2692 PCHAR RTMPGetRalinkAuthModeStr(
2693 IN NDIS_802_11_AUTHENTICATION_MODE authMode)
2697 case Ndis802_11AuthModeOpen:
2700 case Ndis802_11AuthModeWPAPSK:
2702 case Ndis802_11AuthModeShared:
2704 case Ndis802_11AuthModeWPA:
2706 case Ndis802_11AuthModeWPA2:
2708 case Ndis802_11AuthModeWPA2PSK:
2710 case Ndis802_11AuthModeWPA1PSKWPA2PSK:
2711 return "WPAPSKWPA2PSK";
2712 case Ndis802_11AuthModeWPA1WPA2:
2717 PCHAR RTMPGetRalinkEncryModeStr(
2718 IN USHORT encryMode)
2723 case Ndis802_11WEPDisabled:
2725 case Ndis802_11WEPEnabled:
2727 case Ndis802_11Encryption2Enabled:
2729 case Ndis802_11Encryption3Enabled:
2731 case Ndis802_11Encryption4Enabled:
2736 INT RTMPShowCfgValue(
2737 IN PRTMP_ADAPTER pAd,
2743 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++)
2745 if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name))
2747 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf))
2749 break; //Exit for loop.
2753 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL)
2755 sprintf(pBuf, "\n");
2756 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++)
2757 sprintf(pBuf, "%s%s\n", pBuf, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
2764 IN PRTMP_ADAPTER pAd,
2767 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2768 sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid);
2772 INT Show_WirelessMode_Proc(
2773 IN PRTMP_ADAPTER pAd,
2776 switch(pAd->CommonCfg.PhyMode)
2778 case PHY_11BG_MIXED:
2779 sprintf(pBuf, "\t11B/G");
2782 sprintf(pBuf, "\t11B");
2785 sprintf(pBuf, "\t11A");
2787 case PHY_11ABG_MIXED:
2788 sprintf(pBuf, "\t11A/B/G");
2791 sprintf(pBuf, "\t11G");
2793 case PHY_11ABGN_MIXED:
2794 sprintf(pBuf, "\t11A/B/G/N");
2797 sprintf(pBuf, "\t11N only with 2.4G");
2799 case PHY_11GN_MIXED:
2800 sprintf(pBuf, "\t11G/N");
2802 case PHY_11AN_MIXED:
2803 sprintf(pBuf, "\t11A/N");
2805 case PHY_11BGN_MIXED:
2806 sprintf(pBuf, "\t11B/G/N");
2808 case PHY_11AGN_MIXED:
2809 sprintf(pBuf, "\t11A/G/N");
2812 sprintf(pBuf, "\t11N only with 5G");
2815 sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode);
2822 INT Show_TxBurst_Proc(
2823 IN PRTMP_ADAPTER pAd,
2826 sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE");
2830 INT Show_TxPreamble_Proc(
2831 IN PRTMP_ADAPTER pAd,
2834 switch(pAd->CommonCfg.TxPreamble)
2836 case Rt802_11PreambleShort:
2837 sprintf(pBuf, "\tShort");
2839 case Rt802_11PreambleLong:
2840 sprintf(pBuf, "\tLong");
2842 case Rt802_11PreambleAuto:
2843 sprintf(pBuf, "\tAuto");
2846 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble);
2853 INT Show_TxPower_Proc(
2854 IN PRTMP_ADAPTER pAd,
2857 sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage);
2861 INT Show_Channel_Proc(
2862 IN PRTMP_ADAPTER pAd,
2865 sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel);
2869 INT Show_BGProtection_Proc(
2870 IN PRTMP_ADAPTER pAd,
2873 switch(pAd->CommonCfg.UseBGProtection)
2876 sprintf(pBuf, "\tON");
2878 case 2: //Always OFF
2879 sprintf(pBuf, "\tOFF");
2882 sprintf(pBuf, "\tAuto");
2885 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection);
2891 INT Show_RTSThreshold_Proc(
2892 IN PRTMP_ADAPTER pAd,
2895 sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold);
2899 INT Show_FragThreshold_Proc(
2900 IN PRTMP_ADAPTER pAd,
2903 sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold);
2908 IN PRTMP_ADAPTER pAd,
2911 if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
2913 sprintf(pBuf, "\t40 MHz");
2917 sprintf(pBuf, "\t20 MHz");
2922 INT Show_HtMcs_Proc(
2923 IN PRTMP_ADAPTER pAd,
2926 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2927 sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS);
2932 IN PRTMP_ADAPTER pAd,
2935 switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI)
2938 sprintf(pBuf, "\tGI_400");
2941 sprintf(pBuf, "\tGI_800");
2944 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI);
2950 INT Show_HtOpMode_Proc(
2951 IN PRTMP_ADAPTER pAd,
2954 switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE)
2957 sprintf(pBuf, "\tGF");
2960 sprintf(pBuf, "\tMM");
2963 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE);
2969 INT Show_HtExtcha_Proc(
2970 IN PRTMP_ADAPTER pAd,
2973 switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)
2976 sprintf(pBuf, "\tBelow");
2979 sprintf(pBuf, "\tAbove");
2982 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA);
2989 INT Show_HtMpduDensity_Proc(
2990 IN PRTMP_ADAPTER pAd,
2993 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity);
2997 INT Show_HtBaWinSize_Proc(
2998 IN PRTMP_ADAPTER pAd,
3001 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit);
3005 INT Show_HtRdg_Proc(
3006 IN PRTMP_ADAPTER pAd,
3009 sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE");
3013 INT Show_HtAmsdu_Proc(
3014 IN PRTMP_ADAPTER pAd,
3017 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE");
3021 INT Show_HtAutoBa_Proc(
3022 IN PRTMP_ADAPTER pAd,
3025 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE");
3029 INT Show_CountryRegion_Proc(
3030 IN PRTMP_ADAPTER pAd,
3033 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion);
3037 INT Show_CountryRegionABand_Proc(
3038 IN PRTMP_ADAPTER pAd,
3041 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand);
3045 INT Show_CountryCode_Proc(
3046 IN PRTMP_ADAPTER pAd,
3049 sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode);
3053 #ifdef AGGREGATION_SUPPORT
3054 INT Show_PktAggregate_Proc(
3055 IN PRTMP_ADAPTER pAd,
3058 sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE");
3061 #endif // AGGREGATION_SUPPORT //
3064 INT Show_WmmCapable_Proc(
3065 IN PRTMP_ADAPTER pAd,
3068 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3069 sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE");
3073 #endif // WMM_SUPPORT //
3075 INT Show_IEEE80211H_Proc(
3076 IN PRTMP_ADAPTER pAd,
3079 sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE");
3083 INT Show_NetworkType_Proc(
3084 IN PRTMP_ADAPTER pAd,
3087 switch(pAd->StaCfg.BssType)
3090 sprintf(pBuf, "\tAdhoc");
3093 sprintf(pBuf, "\tInfra");
3096 sprintf(pBuf, "\tAny");
3099 sprintf(pBuf, "\tMonitor");
3102 sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType);
3108 INT Show_AuthMode_Proc(
3109 IN PRTMP_ADAPTER pAd,
3112 NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen;
3114 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3115 AuthMode = pAd->StaCfg.AuthMode;
3117 if ((AuthMode >= Ndis802_11AuthModeOpen) &&
3118 (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK))
3119 sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode));
3121 sprintf(pBuf, "\tUnknow Value(%d)", AuthMode);
3126 INT Show_EncrypType_Proc(
3127 IN PRTMP_ADAPTER pAd,
3130 NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled;
3132 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3133 WepStatus = pAd->StaCfg.WepStatus;
3135 if ((WepStatus >= Ndis802_11WEPEnabled) &&
3136 (WepStatus <= Ndis802_11Encryption4KeyAbsent))
3137 sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus));
3139 sprintf(pBuf, "\tUnknow Value(%d)", WepStatus);
3144 INT Show_DefaultKeyID_Proc(
3145 IN PRTMP_ADAPTER pAd,
3148 UCHAR DefaultKeyId = 0;
3150 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3151 DefaultKeyId = pAd->StaCfg.DefaultKeyId;
3153 sprintf(pBuf, "\t%d", DefaultKeyId);
3158 INT Show_WepKey_Proc(
3159 IN PRTMP_ADAPTER pAd,
3163 UCHAR Key[16] = {0}, KeyLength = 0;
3166 KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen;
3167 NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength);
3169 //check key string is ASCII or not
3170 if (RTMPCheckStrPrintAble(Key, KeyLength))
3171 sprintf(pBuf, "\t%s", Key);
3175 sprintf(pBuf, "\t");
3176 for (idx = 0; idx < KeyLength; idx++)
3177 sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]);
3183 IN PRTMP_ADAPTER pAd,
3186 Show_WepKey_Proc(pAd, 0, pBuf);
3191 IN PRTMP_ADAPTER pAd,
3194 Show_WepKey_Proc(pAd, 1, pBuf);
3199 IN PRTMP_ADAPTER pAd,
3202 Show_WepKey_Proc(pAd, 2, pBuf);
3207 IN PRTMP_ADAPTER pAd,
3210 Show_WepKey_Proc(pAd, 3, pBuf);
3214 INT Show_WPAPSK_Proc(
3215 IN PRTMP_ADAPTER pAd,
3219 UCHAR PMK[32] = {0};
3221 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3222 NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32);
3224 sprintf(pBuf, "\tPMK = ");
3225 for (idx = 0; idx < 32; idx++)
3226 sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]);