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 DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION));
234 ==========================================================================
237 This command will not work, if the field of CountryRegion in eeprom is programmed.
239 TRUE if all parameters are OK, FALSE otherwise
240 ==========================================================================
242 INT Set_CountryRegion_Proc(
243 IN PRTMP_ADAPTER pAd,
248 region = simple_strtol(arg, 0, 10);
250 // Country can be set only when EEPROM not programmed
251 if (pAd->CommonCfg.CountryRegion & 0x80)
253 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameter of CountryRegion in eeprom is programmed \n"));
257 if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND))
259 pAd->CommonCfg.CountryRegion = (UCHAR) region;
261 else if (region == REGION_31_BG_BAND)
263 pAd->CommonCfg.CountryRegion = (UCHAR) region;
267 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameters out of range\n"));
271 // if set country region, driver needs to be reset
272 BuildChannelList(pAd);
274 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion));
280 ==========================================================================
282 Set Country Region for A band.
283 This command will not work, if the field of CountryRegion in eeprom is programmed.
285 TRUE if all parameters are OK, FALSE otherwise
286 ==========================================================================
288 INT Set_CountryRegionABand_Proc(
289 IN PRTMP_ADAPTER pAd,
294 region = simple_strtol(arg, 0, 10);
296 // Country can be set only when EEPROM not programmed
297 if (pAd->CommonCfg.CountryRegionForABand & 0x80)
299 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameter of CountryRegion in eeprom is programmed \n"));
303 if((region >= 0) && (region <= REGION_MAXIMUM_A_BAND))
305 pAd->CommonCfg.CountryRegionForABand = (UCHAR) region;
309 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameters out of range\n"));
313 // if set country region, driver needs to be reset
314 BuildChannelList(pAd);
316 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegionForABand));
322 ==========================================================================
326 TRUE if all parameters are OK, FALSE otherwise
327 ==========================================================================
329 INT Set_WirelessMode_Proc(
330 IN PRTMP_ADAPTER pAd,
336 WirelessMode = simple_strtol(arg, 0, 10);
339 INT MaxPhyMode = PHY_11G;
341 MaxPhyMode = PHY_11N_5G;
343 if (WirelessMode <= MaxPhyMode)
345 RTMPSetPhyMode(pAd, WirelessMode);
347 if (WirelessMode >= PHY_11ABGN_MIXED)
349 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
350 pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE;
354 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
355 pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE;
358 // Set AdhocMode rates
359 if (pAd->StaCfg.BssType == BSS_ADHOC)
361 MlmeUpdateTxRates(pAd, FALSE, 0);
362 MakeIbssBeacon(pAd); // re-build BEACON frame
363 AsicEnableIbssSync(pAd); // copy to on-chip memory
372 // it is needed to set SSID to take effect
376 DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%ld)\n", WirelessMode));
380 DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n"));
387 ==========================================================================
391 TRUE if all parameters are OK, FALSE otherwise
392 ==========================================================================
394 INT Set_Channel_Proc(
395 IN PRTMP_ADAPTER pAd,
401 Channel = (UCHAR) simple_strtol(arg, 0, 10);
403 // check if this channel is valid
404 if (ChannelSanity(pAd, Channel) == TRUE)
407 pAd->CommonCfg.Channel = Channel;
412 if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED &&
413 pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
416 AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
417 AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
418 DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n",
419 pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel));
423 AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
424 AsicLockChannel(pAd, pAd->CommonCfg.Channel);
425 DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel));
438 DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel));
444 ==========================================================================
446 Set Short Slot Time Enable or Disable
448 TRUE if all parameters are OK, FALSE otherwise
449 ==========================================================================
451 INT Set_ShortSlot_Proc(
452 IN PRTMP_ADAPTER pAd,
457 ShortSlot = simple_strtol(arg, 0, 10);
460 pAd->CommonCfg.bUseShortSlotTime = TRUE;
461 else if (ShortSlot == 0)
462 pAd->CommonCfg.bUseShortSlotTime = FALSE;
464 return FALSE; //Invalid argument
466 DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime));
472 ==========================================================================
476 TRUE if all parameters are OK, FALSE otherwise
477 ==========================================================================
479 INT Set_TxPower_Proc(
480 IN PRTMP_ADAPTER pAd,
486 TxPower = (ULONG) simple_strtol(arg, 0, 10);
490 pAd->CommonCfg.TxPowerDefault = TxPower;
491 pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
498 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
504 ==========================================================================
506 Set 11B/11G Protection
508 TRUE if all parameters are OK, FALSE otherwise
509 ==========================================================================
511 INT Set_BGProtection_Proc(
512 IN PRTMP_ADAPTER pAd,
515 switch (simple_strtol(arg, 0, 10))
518 pAd->CommonCfg.UseBGProtection = 0;
521 pAd->CommonCfg.UseBGProtection = 1;
524 pAd->CommonCfg.UseBGProtection = 2;
526 default: //Invalid argument
531 DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection));
537 ==========================================================================
541 TRUE if all parameters are OK, FALSE otherwise
542 ==========================================================================
544 INT Set_TxPreamble_Proc(
545 IN PRTMP_ADAPTER pAd,
548 RT_802_11_PREAMBLE Preamble;
550 Preamble = simple_strtol(arg, 0, 10);
555 case Rt802_11PreambleShort:
556 pAd->CommonCfg.TxPreamble = Preamble;
558 MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);
560 case Rt802_11PreambleLong:
561 case Rt802_11PreambleAuto:
562 // if user wants AUTO, initialize to LONG here, then change according to AP's
563 // capability upon association.
564 pAd->CommonCfg.TxPreamble = Preamble;
566 MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);
568 default: //Invalid argument
572 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble));
578 ==========================================================================
582 TRUE if all parameters are OK, FALSE otherwise
583 ==========================================================================
585 INT Set_RTSThreshold_Proc(
586 IN PRTMP_ADAPTER pAd,
589 NDIS_802_11_RTS_THRESHOLD RtsThresh;
591 RtsThresh = simple_strtol(arg, 0, 10);
593 if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD))
594 pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
595 else if (RtsThresh == 0)
596 pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;
598 return FALSE; //Invalid argument
600 DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold));
606 ==========================================================================
608 Set Fragment Threshold
610 TRUE if all parameters are OK, FALSE otherwise
611 ==========================================================================
613 INT Set_FragThreshold_Proc(
614 IN PRTMP_ADAPTER pAd,
617 NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
619 FragThresh = simple_strtol(arg, 0, 10);
621 if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)
623 //Illegal FragThresh so we set it to default
624 pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
626 else if (FragThresh % 2 == 1)
628 // The length of each fragment shall always be an even number of octets, except for the last fragment
629 // of an MSDU or MMPDU, which may be either an even or an odd number of octets.
630 pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1);
634 pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
638 if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)
639 pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;
641 pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;
644 DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold));
650 ==========================================================================
654 TRUE if all parameters are OK, FALSE otherwise
655 ==========================================================================
657 INT Set_TxBurst_Proc(
658 IN PRTMP_ADAPTER pAd,
663 TxBurst = simple_strtol(arg, 0, 10);
665 pAd->CommonCfg.bEnableTxBurst = TRUE;
666 else if (TxBurst == 0)
667 pAd->CommonCfg.bEnableTxBurst = FALSE;
669 return FALSE; //Invalid argument
671 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst));
676 #ifdef AGGREGATION_SUPPORT
678 ==========================================================================
682 TRUE if all parameters are OK, FALSE otherwise
683 ==========================================================================
685 INT Set_PktAggregate_Proc(
686 IN PRTMP_ADAPTER pAd,
691 aggre = simple_strtol(arg, 0, 10);
694 pAd->CommonCfg.bAggregationCapable = TRUE;
696 pAd->CommonCfg.bAggregationCapable = FALSE;
698 return FALSE; //Invalid argument
701 DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable));
708 ==========================================================================
711 This parameter is 1 when needs radar detection, otherwise 0
713 TRUE if all parameters are OK, FALSE otherwise
714 ==========================================================================
716 INT Set_IEEE80211H_Proc(
717 IN PRTMP_ADAPTER pAd,
722 ieee80211h = simple_strtol(arg, 0, 10);
725 pAd->CommonCfg.bIEEE80211H = TRUE;
726 else if (ieee80211h == 0)
727 pAd->CommonCfg.bIEEE80211H = FALSE;
729 return FALSE; //Invalid argument
731 DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H));
739 ==========================================================================
741 For Debug information
743 TRUE if all parameters are OK, FALSE otherwise
744 ==========================================================================
747 IN PRTMP_ADAPTER pAd,
750 DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n"));
752 if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD)
753 RTDebugLevel = simple_strtol(arg, 0, 10);
755 DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel));
761 INT Show_DescInfo_Proc(
762 IN PRTMP_ADAPTER pAd,
770 ==========================================================================
772 Reset statistics counter
775 pAdapter Pointer to our adapter
779 TRUE if all parameters are OK, FALSE otherwise
780 ==========================================================================
782 INT Set_ResetStatCounter_Proc(
783 IN PRTMP_ADAPTER pAd,
786 DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n"));
788 // add the most up-to-date h/w raw counters into software counters
789 NICUpdateRawCounters(pAd);
791 NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));
792 NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));
793 NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));
798 BOOLEAN RTMPCheckStrPrintAble(
804 for (i=0; i<strLen; i++)
806 if ((pInPutStr[i] < 0x21) ||
807 (pInPutStr[i] > 0x7E))
815 ========================================================================
818 Remove WPA Key process
821 pAd Pointer to our adapter
822 pBuf Pointer to the where the key stored
825 NDIS_SUCCESS Add key successfully
827 IRQL = DISPATCH_LEVEL
831 ========================================================================
833 VOID RTMPSetDesiredRates(
834 IN PRTMP_ADAPTER pAdapter,
837 NDIS_802_11_RATES aryRates;
839 memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
840 switch (pAdapter->CommonCfg.PhyMode)
842 case PHY_11A: // A only
846 aryRates[0] = 0x0c; // 6M
847 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
850 aryRates[0] = 0x12; // 9M
851 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
854 aryRates[0] = 0x18; // 12M
855 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
858 aryRates[0] = 0x24; // 18M
859 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
862 aryRates[0] = 0x30; // 24M
863 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
866 aryRates[0] = 0x48; // 36M
867 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
870 aryRates[0] = 0x60; // 48M
871 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
874 aryRates[0] = 0x6c; // 54M
875 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
879 aryRates[0] = 0x6c; // 54Mbps
880 aryRates[1] = 0x60; // 48Mbps
881 aryRates[2] = 0x48; // 36Mbps
882 aryRates[3] = 0x30; // 24Mbps
883 aryRates[4] = 0x24; // 18M
884 aryRates[5] = 0x18; // 12M
885 aryRates[6] = 0x12; // 9M
886 aryRates[7] = 0x0c; // 6M
887 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
891 case PHY_11BG_MIXED: // B/G Mixed
892 case PHY_11B: // B only
893 case PHY_11ABG_MIXED: // A/B/G Mixed
899 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
903 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
906 aryRates[0] = 0x0b; // 5.5M
907 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
910 aryRates[0] = 0x16; // 11M
911 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
914 aryRates[0] = 0x0c; // 6M
915 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
918 aryRates[0] = 0x12; // 9M
919 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
922 aryRates[0] = 0x18; // 12M
923 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
926 aryRates[0] = 0x24; // 18M
927 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
930 aryRates[0] = 0x30; // 24M
931 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
934 aryRates[0] = 0x48; // 36M
935 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
938 aryRates[0] = 0x60; // 48M
939 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
942 aryRates[0] = 0x6c; // 54M
943 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
947 if (pAdapter->CommonCfg.PhyMode == PHY_11B)
949 aryRates[0] = 0x16; // 11Mbps
950 aryRates[1] = 0x0b; // 5.5Mbps
951 aryRates[2] = 0x04; // 2Mbps
952 aryRates[3] = 0x02; // 1Mbps
955 { //(B/G) Mixed or (A/B/G) Mixed
956 aryRates[0] = 0x6c; // 54Mbps
957 aryRates[1] = 0x60; // 48Mbps
958 aryRates[2] = 0x48; // 36Mbps
959 aryRates[3] = 0x30; // 24Mbps
960 aryRates[4] = 0x16; // 11Mbps
961 aryRates[5] = 0x0b; // 5.5Mbps
962 aryRates[6] = 0x04; // 2Mbps
963 aryRates[7] = 0x02; // 1Mbps
965 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
971 NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
972 NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
973 DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
974 pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1],
975 pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3],
976 pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5],
977 pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] ));
978 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
979 MlmeUpdateTxRates(pAdapter, FALSE, 0);
982 NDIS_STATUS RTMPWPARemoveKeyProc(
983 IN PRTMP_ADAPTER pAd,
986 PNDIS_802_11_REMOVE_KEY pKey;
988 NDIS_STATUS Status = NDIS_STATUS_FAILURE;
989 BOOLEAN bTxKey; // Set the key as transmit key
990 BOOLEAN bPairwise; // Indicate the key is pairwise key
991 BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value.
992 // Otherwise, it will set by the NIC.
993 BOOLEAN bAuthenticator; // indicate key is set by authenticator.
996 DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n"));
998 pKey = (PNDIS_802_11_REMOVE_KEY) pBuf;
999 KeyIdx = pKey->KeyIndex & 0xff;
1000 // Bit 31 of Add-key, Tx Key
1001 bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE;
1002 // Bit 30 of Add-key PairwiseKey
1003 bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE;
1004 // Bit 29 of Add-key KeyRSC
1005 bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE;
1006 // Bit 28 of Add-key Authenticator
1007 bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE;
1009 // 1. If bTx is TRUE, return failure information
1011 return(NDIS_STATUS_INVALID_DATA);
1013 // 2. Check Pairwise Key
1016 // a. If BSSID is broadcast, remove all pairwise keys.
1017 // b. If not broadcast, remove the pairwise specified by BSSID
1018 for (i = 0; i < SHARE_KEY_NUM; i++)
1020 if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID))
1022 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i));
1023 pAd->SharedKey[BSS0][i].KeyLen = 0;
1024 pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE;
1025 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i);
1026 Status = NDIS_STATUS_SUCCESS;
1034 // a. If BSSID is broadcast, remove all group keys indexed
1035 // b. If BSSID matched, delete the group key indexed.
1036 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx));
1037 pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
1038 pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
1039 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx);
1040 Status = NDIS_STATUS_SUCCESS;
1047 ========================================================================
1049 Routine Description:
1053 pAd Pointer to our adapter
1058 IRQL = DISPATCH_LEVEL
1062 ========================================================================
1064 VOID RTMPWPARemoveAllKeys(
1065 IN PRTMP_ADAPTER pAd)
1070 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
1072 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1073 // Link up. And it will be replaced if user changed it.
1074 if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)
1077 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1078 // Link up. And it will be replaced if user changed it.
1079 if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone)
1082 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1083 AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
1085 // set all shared key mode as no-security.
1086 for (i = 0; i < SHARE_KEY_NUM; i++)
1088 DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
1089 NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY));
1091 AsicRemoveSharedKeyEntry(pAd, BSS0, i);
1097 ========================================================================
1098 Routine Description:
1099 Change NIC PHY mode. Re-association may be necessary. possible settings
1100 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1103 pAd - Pointer to our adapter
1106 IRQL = PASSIVE_LEVEL
1107 IRQL = DISPATCH_LEVEL
1109 ========================================================================
1111 VOID RTMPSetPhyMode(
1112 IN PRTMP_ADAPTER pAd,
1116 // the selected phymode must be supported by the RF IC encoded in E2PROM
1118 pAd->CommonCfg.PhyMode = (UCHAR)phymode;
1120 DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
1122 BuildChannelList(pAd);
1124 // sanity check user setting
1125 for (i = 0; i < pAd->ChannelListNum; i++)
1127 if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
1131 if (i == pAd->ChannelListNum)
1133 pAd->CommonCfg.Channel = FirstChannel(pAd);
1134 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel));
1137 NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES);
1138 NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES);
1139 NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1142 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1143 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1144 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1145 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1146 pAd->CommonCfg.SupRateLen = 4;
1147 pAd->CommonCfg.ExtRateLen = 0;
1148 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1149 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1150 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1151 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1152 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1156 case PHY_11BG_MIXED:
1157 case PHY_11ABG_MIXED:
1159 case PHY_11ABGN_MIXED:
1160 case PHY_11BGN_MIXED:
1161 case PHY_11GN_MIXED:
1162 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1163 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1164 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1165 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1166 pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1167 pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1168 pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1169 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1170 pAd->CommonCfg.SupRateLen = 8;
1171 pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1172 pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1173 pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1174 pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1175 pAd->CommonCfg.ExtRateLen = 4;
1176 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1177 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1178 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1179 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1180 pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
1181 pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
1182 pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
1183 pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
1184 pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
1185 pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
1186 pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
1187 pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
1191 case PHY_11AN_MIXED:
1192 case PHY_11AGN_MIXED:
1194 pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1195 pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1196 pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1197 pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1198 pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1199 pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1200 pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1201 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1202 pAd->CommonCfg.SupRateLen = 8;
1203 pAd->CommonCfg.ExtRateLen = 0;
1204 pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
1205 pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
1206 pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
1207 pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
1208 pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
1209 pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
1210 pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
1211 pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
1212 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1220 pAd->CommonCfg.BandState = UNKNOWN_BAND;
1224 ========================================================================
1225 Routine Description:
1226 Caller ensures we has 802.11n support.
1227 Calls at setting HT from AP/STASetinformation
1230 pAd - Pointer to our adapter
1233 ========================================================================
1236 IN PRTMP_ADAPTER pAd,
1237 IN OID_SET_HT_PHYMODE *pHTPhyMode)
1242 UCHAR BBP3Value = 0;
1243 UCHAR RxStream = pAd->CommonCfg.RxStream;
1245 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1246 pHTPhyMode->HtMode, pHTPhyMode->ExtOffset,
1247 pHTPhyMode->MCS, pHTPhyMode->BW,
1248 pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
1250 // Don't zero supportedHyPhy structure.
1251 RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability));
1252 RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo));
1253 RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset));
1254 RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy));
1256 if (pAd->CommonCfg.bRdg)
1258 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1;
1259 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1;
1263 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0;
1264 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0;
1267 pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3;
1268 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3;
1270 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit));
1272 // Mimo power save, A-MSDU size,
1273 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
1274 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize;
1275 pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode;
1276 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1278 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
1279 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
1280 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1282 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1283 pAd->CommonCfg.DesiredHtPhy.AmsduSize,
1284 pAd->CommonCfg.DesiredHtPhy.MimoPs,
1285 pAd->CommonCfg.DesiredHtPhy.MpduDensity,
1286 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
1288 if(pHTPhyMode->HtMode == HTMODE_GF)
1290 pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1;
1291 pAd->CommonCfg.DesiredHtPhy.GF = 1;
1294 pAd->CommonCfg.DesiredHtPhy.GF = 0;
1300 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1301 pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
1305 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1306 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1310 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1311 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1312 pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
1316 if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) )
1318 pHTPhyMode->BW = BW_20;
1319 pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1;
1322 if(pHTPhyMode->BW == BW_40)
1324 pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
1325 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
1326 if (pAd->CommonCfg.Channel <= 14)
1327 pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
1329 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1;
1330 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
1331 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE;
1332 // Set Regsiter for extension channel position.
1333 RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
1334 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
1335 if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW))
1338 BBP3Value |= (0x20);
1339 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1341 else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE))
1344 BBP3Value &= (~0x20);
1345 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1348 // Turn on BBP 40MHz mode now only as AP .
1349 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1350 if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
1353 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1354 BBPValue &= (~0x18);
1356 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1358 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value);
1359 pAd->CommonCfg.BBPCurrentBW = BW_40;
1364 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0;
1365 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0;
1366 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
1367 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE;
1368 pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
1369 // Turn on BBP 20MHz mode by request here.
1371 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1372 BBPValue &= (~0x18);
1373 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1374 pAd->CommonCfg.BBPCurrentBW = BW_20;
1378 if(pHTPhyMode->STBC == STBC_USE)
1380 pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1;
1381 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1;
1382 pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1;
1383 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1;
1387 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
1388 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
1391 if(pHTPhyMode->SHORTGI == GI_400)
1393 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1;
1394 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1;
1395 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1;
1396 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1;
1400 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0;
1401 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0;
1402 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0;
1403 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0;
1406 // We support link adaptation for unsolicit MCS feedback, set to 2.
1407 pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
1408 pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
1409 // 1, the extension channel above the control channel.
1411 // EDCA parameters used for AP's own transmission
1412 if (pAd->CommonCfg.APEdcaParm.bValid == FALSE)
1414 pAd->CommonCfg.APEdcaParm.bValid = TRUE;
1415 pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
1416 pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7;
1417 pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1;
1418 pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1;
1420 pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4;
1421 pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4;
1422 pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3;
1423 pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2;
1425 pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6;
1426 pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10;
1427 pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4;
1428 pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3;
1430 pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
1431 pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
1432 pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
1433 pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
1435 AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm);
1437 RTMPSetIndividualHT(pAd, 0);
1441 ========================================================================
1442 Routine Description:
1443 Caller ensures we has 802.11n support.
1444 Calls at setting HT from AP/STASetinformation
1447 pAd - Pointer to our adapter
1450 ========================================================================
1452 VOID RTMPSetIndividualHT(
1453 IN PRTMP_ADAPTER pAd,
1456 PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
1457 UCHAR TxStream = pAd->CommonCfg.TxStream;
1458 UCHAR DesiredMcs = MCS_AUTO;
1463 pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
1464 DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS;
1465 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1470 if (pDesired_ht_phy == NULL)
1472 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
1475 RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO));
1477 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
1478 // Check the validity of MCS
1479 if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15)))
1481 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs));
1485 if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32))
1487 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1491 pDesired_ht_phy->bHtEnable = TRUE;
1493 // Decide desired Tx MCS
1497 if (DesiredMcs == MCS_AUTO)
1499 pDesired_ht_phy->MCSSet[0]= 0xff;
1500 pDesired_ht_phy->MCSSet[1]= 0x00;
1502 else if (DesiredMcs <= MCS_7)
1504 pDesired_ht_phy->MCSSet[0]= 1<<DesiredMcs;
1505 pDesired_ht_phy->MCSSet[1]= 0x00;
1510 if (DesiredMcs == MCS_AUTO)
1512 pDesired_ht_phy->MCSSet[0]= 0xff;
1513 pDesired_ht_phy->MCSSet[1]= 0xff;
1515 else if (DesiredMcs <= MCS_15)
1519 mode = DesiredMcs / 8;
1521 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1526 if (DesiredMcs == MCS_AUTO)
1528 /* MCS0 ~ MCS23, 3 bytes */
1529 pDesired_ht_phy->MCSSet[0]= 0xff;
1530 pDesired_ht_phy->MCSSet[1]= 0xff;
1531 pDesired_ht_phy->MCSSet[2]= 0xff;
1533 else if (DesiredMcs <= MCS_23)
1537 mode = DesiredMcs / 8;
1539 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1544 if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40)
1546 if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
1547 pDesired_ht_phy->MCSSet[4] = 0x1;
1550 // update HT Rate setting
1551 if (pAd->OpMode == OPMODE_STA)
1552 MlmeUpdateHtTxRates(pAd, BSS0);
1554 MlmeUpdateHtTxRates(pAd, apidx);
1559 ========================================================================
1560 Routine Description:
1561 Update HT IE from our capability.
1564 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1567 ========================================================================
1569 VOID RTMPUpdateHTIE(
1570 IN RT_HT_CAPABILITY *pRtHt,
1572 OUT HT_CAPABILITY_IE *pHtCapability,
1573 OUT ADD_HT_INFO_IE *pAddHtInfo)
1575 RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE));
1576 RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE));
1578 pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
1579 pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
1580 pHtCapability->HtCapInfo.GF = pRtHt->GF;
1581 pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
1582 pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
1583 pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
1584 pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
1585 pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
1586 pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
1587 pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
1589 pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ;
1590 pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
1591 pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
1592 pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
1593 RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1595 DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n"));
1599 ========================================================================
1601 Add Client security information into ASIC WCID table and IVEIV table.
1603 ========================================================================
1605 VOID RTMPAddWcidAttributeEntry(
1606 IN PRTMP_ADAPTER pAd,
1610 IN MAC_TABLE_ENTRY *pEntry)
1612 UINT32 WCIDAttri = 0;
1621 DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx));
1625 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
1626 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
1627 // the AID:2~ assign to mesh link entry.
1628 if (pEntry && ADHOC_ON(pAd))
1630 else if (pEntry && INFRA_ON(pAd))
1639 // Update WCID attribute table
1640 offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE);
1643 if (pEntry && pEntry->ValidAsMesh)
1644 WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE;
1646 WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE;
1649 RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
1652 // Update IV/EIV table
1653 offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
1656 if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES))
1658 // Eiv bit on. keyid always is 0 for pairwise key
1659 IVEIV = (KeyIdx <<6) | 0x20;
1663 // WEP KeyIdx is default tx key.
1664 IVEIV = (KeyIdx << 6);
1667 // For key index and ext IV bit, so only need to update the position(offset+3).
1669 RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV);
1672 DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg]));
1673 DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri));
1678 ==========================================================================
1680 Parse encryption type
1682 pAdapter Pointer to our adapter
1683 wrq Pointer to the ioctl argument
1689 ==========================================================================
1691 CHAR *GetEncryptType(CHAR enc)
1693 if(enc == Ndis802_11WEPDisabled)
1695 if(enc == Ndis802_11WEPEnabled)
1697 if(enc == Ndis802_11Encryption2Enabled)
1699 if(enc == Ndis802_11Encryption3Enabled)
1701 if(enc == Ndis802_11Encryption4Enabled)
1707 CHAR *GetAuthMode(CHAR auth)
1709 if(auth == Ndis802_11AuthModeOpen)
1711 if(auth == Ndis802_11AuthModeShared)
1713 if(auth == Ndis802_11AuthModeAutoSwitch)
1715 if(auth == Ndis802_11AuthModeWPA)
1717 if(auth == Ndis802_11AuthModeWPAPSK)
1719 if(auth == Ndis802_11AuthModeWPANone)
1721 if(auth == Ndis802_11AuthModeWPA2)
1723 if(auth == Ndis802_11AuthModeWPA2PSK)
1725 if(auth == Ndis802_11AuthModeWPA1WPA2)
1727 if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
1728 return "WPA1PSKWPA2PSK";
1734 ==========================================================================
1736 Get site survey results
1738 pAdapter Pointer to our adapter
1739 wrq Pointer to the ioctl argument
1746 1.) UI needs to wait 4 seconds after issue a site survey command
1747 2.) iwpriv ra0 get_site_survey
1748 3.) UI needs to prepare at least 4096bytes to get the results
1749 ==========================================================================
1751 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
1752 VOID RTMPIoctlGetSiteSurvey(
1753 IN PRTMP_ADAPTER pAdapter,
1754 IN struct iwreq *wrq)
1760 CHAR Ssid[MAX_LEN_OF_SSID +1];
1761 INT Rssi = 0, max_len = LINE_LEN;
1762 UINT Rssi_Quality = 0;
1763 NDIS_802_11_NETWORK_TYPE wireless_mode;
1765 os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len));
1769 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
1773 memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len );
1774 memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1));
1775 sprintf(msg,"%s","\n");
1776 sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
1777 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
1780 pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE;
1782 while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200))
1785 for(i=0; i<pAdapter->ScanTab.BssNr ;i++)
1787 if( pAdapter->ScanTab.BssEntry[i].Channel==0)
1790 if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA)
1794 sprintf(msg+strlen(msg),"%-4d", pAdapter->ScanTab.BssEntry[i].Channel);
1796 memcpy(Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen);
1797 Ssid[pAdapter->ScanTab.BssEntry[i].SsidLen] = '\0';
1798 sprintf(msg+strlen(msg),"%-33s", Ssid);
1800 sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ",
1801 pAdapter->ScanTab.BssEntry[i].Bssid[0],
1802 pAdapter->ScanTab.BssEntry[i].Bssid[1],
1803 pAdapter->ScanTab.BssEntry[i].Bssid[2],
1804 pAdapter->ScanTab.BssEntry[i].Bssid[3],
1805 pAdapter->ScanTab.BssEntry[i].Bssid[4],
1806 pAdapter->ScanTab.BssEntry[i].Bssid[5]);
1808 sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus));
1809 //Authentication Mode
1810 if (pAdapter->ScanTab.BssEntry[i].WepStatus == Ndis802_11WEPEnabled)
1811 sprintf(msg+strlen(msg),"%-10s", "UNKNOW");
1813 sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode));
1815 Rssi = (INT)pAdapter->ScanTab.BssEntry[i].Rssi;
1818 else if (Rssi >= -80) // between -50 ~ -80dbm
1819 Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10);
1820 else if (Rssi >= -90) // between -80 ~ -90dbm
1821 Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10);
1824 sprintf(msg+strlen(msg),"%-9d", Rssi_Quality);
1826 wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]);
1827 if (wireless_mode == Ndis802_11FH ||
1828 wireless_mode == Ndis802_11DS)
1829 sprintf(msg+strlen(msg),"%-7s", "11b");
1830 else if (wireless_mode == Ndis802_11OFDM5)
1831 sprintf(msg+strlen(msg),"%-7s", "11a");
1832 else if (wireless_mode == Ndis802_11OFDM5_N)
1833 sprintf(msg+strlen(msg),"%-7s", "11a/n");
1834 else if (wireless_mode == Ndis802_11OFDM24)
1835 sprintf(msg+strlen(msg),"%-7s", "11b/g");
1836 else if (wireless_mode == Ndis802_11OFDM24_N)
1837 sprintf(msg+strlen(msg),"%-7s", "11b/g/n");
1839 sprintf(msg+strlen(msg),"%-7s", "unknow");
1841 if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC)
1842 sprintf(msg+strlen(msg),"%-3s", " Ad");
1844 sprintf(msg+strlen(msg),"%-3s", " In");
1846 sprintf(msg+strlen(msg),"\n");
1849 pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE;
1850 wrq->u.data.length = strlen(msg);
1851 Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);
1853 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length));
1854 os_free_mem(NULL, (PUCHAR)msg);
1858 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
1859 VOID RTMPIoctlGetMacTable(
1860 IN PRTMP_ADAPTER pAd,
1861 IN struct iwreq *wrq)
1864 RT_802_11_MAC_TABLE MacTab;
1868 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1870 if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC))
1872 COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr);
1873 MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid;
1874 MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode;
1875 MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode;
1877 // Fill in RSSI per entry
1878 MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0;
1879 MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1;
1880 MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2;
1882 // the connected time per entry
1883 MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime;
1884 MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS;
1885 MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW;
1886 MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI;
1887 MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC;
1888 MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv;
1889 MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE;
1890 MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word;
1895 wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE);
1896 if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length))
1898 DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__));
1901 msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG);
1902 memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN );
1903 sprintf(msg,"%s","\n");
1904 sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
1905 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
1907 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1909 PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];
1910 if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC))
1912 if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) )
1914 sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ",
1915 pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],
1916 pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);
1917 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid);
1918 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode);
1919 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
1920 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
1921 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
1922 sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]);
1923 sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
1926 // for compatible with old API just do the printk to console
1927 //wrq->u.data.length = strlen(msg);
1928 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
1930 DBGPRINT(RT_DEBUG_TRACE, ("%s", msg));
1936 INT Set_BASetup_Proc(
1937 IN PRTMP_ADAPTER pAd,
1941 char *token, sepValue[] = ":", DASH = '-';
1943 MAC_TABLE_ENTRY *pEntry;
1946 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
1947 =>The six 2 digit hex-decimal number previous are the Mac address,
1948 =>The seventh decimal number is the tid value.
1951 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
1954 token = strchr(arg, DASH);
1955 if ((token != NULL) && (strlen(token)>1))
1957 tid = simple_strtol((token+1), 0, 10);
1962 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
1964 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
1966 AtoH(token, (PUCHAR)(&mac[i]), 1);
1971 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1],
1972 mac[2], mac[3], mac[4], mac[5], tid);
1974 pEntry = MacTableLookup(pAd, mac);
1977 printk("\nSetup BA Session: Tid = %d\n", tid);
1978 BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE);
1988 INT Set_BADecline_Proc(
1989 IN PRTMP_ADAPTER pAd,
1994 bBADecline = simple_strtol(arg, 0, 10);
1996 if (bBADecline == 0)
1998 pAd->CommonCfg.bBADecline = FALSE;
2000 else if (bBADecline == 1)
2002 pAd->CommonCfg.bBADecline = TRUE;
2006 return FALSE; //Invalid argument
2009 DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline));
2014 INT Set_BAOriTearDown_Proc(
2015 IN PRTMP_ADAPTER pAd,
2019 char *token, sepValue[] = ":", DASH = '-';
2021 MAC_TABLE_ENTRY *pEntry;
2024 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2025 =>The six 2 digit hex-decimal number previous are the Mac address,
2026 =>The seventh decimal number is the tid value.
2028 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2031 token = strchr(arg, DASH);
2032 if ((token != NULL) && (strlen(token)>1))
2034 tid = simple_strtol((token+1), 0, 10);
2035 if (tid > NUM_OF_TID)
2039 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2041 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2043 AtoH(token, (PUCHAR)(&mac[i]), 1);
2048 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2049 mac[2], mac[3], mac[4], mac[5], tid);
2051 pEntry = MacTableLookup(pAd, mac);
2054 printk("\nTear down Ori BA Session: Tid = %d\n", tid);
2055 BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE);
2065 INT Set_BARecTearDown_Proc(
2066 IN PRTMP_ADAPTER pAd,
2070 char *token, sepValue[] = ":", DASH = '-';
2072 MAC_TABLE_ENTRY *pEntry;
2074 //printk("\n%s\n", arg);
2076 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2077 =>The six 2 digit hex-decimal number previous are the Mac address,
2078 =>The seventh decimal number is the tid value.
2080 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2083 token = strchr(arg, DASH);
2084 if ((token != NULL) && (strlen(token)>1))
2086 tid = simple_strtol((token+1), 0, 10);
2087 if (tid > NUM_OF_TID)
2091 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2093 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2095 AtoH(token, (PUCHAR)(&mac[i]), 1);
2100 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2101 mac[2], mac[3], mac[4], mac[5], tid);
2103 pEntry = MacTableLookup(pAd, mac);
2106 printk("\nTear down Rec BA Session: Tid = %d\n", tid);
2107 BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE);
2118 IN PRTMP_ADAPTER pAd,
2123 HtBw = simple_strtol(arg, 0, 10);
2125 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
2126 else if (HtBw == BW_20)
2127 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
2129 return FALSE; //Invalid argument
2133 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW));
2139 IN PRTMP_ADAPTER pAd,
2142 ULONG HtMcs, Mcs_tmp;
2143 BOOLEAN bAutoRate = FALSE;
2145 Mcs_tmp = simple_strtol(arg, 0, 10);
2147 if (Mcs_tmp <= 15 || Mcs_tmp == 32)
2153 pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs;
2154 pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE;
2155 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2156 pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch));
2158 if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) ||
2159 (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX))
2161 if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2162 (HtMcs >= 0 && HtMcs <= 3) &&
2163 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK))
2165 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000));
2167 else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2168 (HtMcs >= 0 && HtMcs <= 7) &&
2169 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM))
2171 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000));
2178 pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
2179 RTMPSetDesiredRates(pAd, -1);
2181 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode));
2193 IN PRTMP_ADAPTER pAd,
2198 HtGi = simple_strtol(arg, 0, 10);
2200 if ( HtGi == GI_400)
2201 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400;
2202 else if ( HtGi == GI_800 )
2203 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800;
2205 return FALSE; //Invalid argument
2209 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI));
2215 INT Set_HtTxBASize_Proc(
2216 IN PRTMP_ADAPTER pAd,
2221 Size = simple_strtol(arg, 0, 10);
2223 if (Size <=0 || Size >=64)
2227 pAd->CommonCfg.TxBASize = Size-1;
2228 DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size));
2234 INT Set_HtOpMode_Proc(
2235 IN PRTMP_ADAPTER pAd,
2241 Value = simple_strtol(arg, 0, 10);
2243 if (Value == HTMODE_GF)
2244 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF;
2245 else if ( Value == HTMODE_MM )
2246 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM;
2248 return FALSE; //Invalid argument
2252 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE));
2258 INT Set_HtStbc_Proc(
2259 IN PRTMP_ADAPTER pAd,
2265 Value = simple_strtol(arg, 0, 10);
2267 if (Value == STBC_USE)
2268 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE;
2269 else if ( Value == STBC_NONE )
2270 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE;
2272 return FALSE; //Invalid argument
2276 DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC));
2282 IN PRTMP_ADAPTER pAd,
2288 Value = simple_strtol(arg, 0, 10);
2290 pAd->HTCEnable = FALSE;
2291 else if ( Value ==1 )
2292 pAd->HTCEnable = TRUE;
2294 return FALSE; //Invalid argument
2296 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable));
2301 INT Set_HtExtcha_Proc(
2302 IN PRTMP_ADAPTER pAd,
2308 Value = simple_strtol(arg, 0, 10);
2311 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW;
2312 else if ( Value ==1 )
2313 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE;
2315 return FALSE; //Invalid argument
2319 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA));
2324 INT Set_HtMpduDensity_Proc(
2325 IN PRTMP_ADAPTER pAd,
2330 Value = simple_strtol(arg, 0, 10);
2332 if (Value <=7 && Value >= 0)
2333 pAd->CommonCfg.BACapability.field.MpduDensity = Value;
2335 pAd->CommonCfg.BACapability.field.MpduDensity = 4;
2339 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity));
2344 INT Set_HtBaWinSize_Proc(
2345 IN PRTMP_ADAPTER pAd,
2350 Value = simple_strtol(arg, 0, 10);
2353 if (Value >=1 && Value <= 64)
2355 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value;
2356 pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value;
2360 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64;
2361 pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64;
2366 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit));
2372 IN PRTMP_ADAPTER pAd,
2377 Value = simple_strtol(arg, 0, 10);
2380 pAd->CommonCfg.bRdg = FALSE;
2381 else if ( Value ==1 )
2383 pAd->HTCEnable = TRUE;
2384 pAd->CommonCfg.bRdg = TRUE;
2387 return FALSE; //Invalid argument
2391 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg));
2396 INT Set_HtLinkAdapt_Proc(
2397 IN PRTMP_ADAPTER pAd,
2402 Value = simple_strtol(arg, 0, 10);
2404 pAd->bLinkAdapt = FALSE;
2405 else if ( Value ==1 )
2407 pAd->HTCEnable = TRUE;
2408 pAd->bLinkAdapt = TRUE;
2411 return FALSE; //Invalid argument
2413 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt));
2418 INT Set_HtAmsdu_Proc(
2419 IN PRTMP_ADAPTER pAd,
2424 Value = simple_strtol(arg, 0, 10);
2426 pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE;
2427 else if ( Value == 1 )
2428 pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE;
2430 return FALSE; //Invalid argument
2434 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable));
2439 INT Set_HtAutoBa_Proc(
2440 IN PRTMP_ADAPTER pAd,
2445 Value = simple_strtol(arg, 0, 10);
2448 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
2449 pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE;
2451 else if (Value == 1)
2453 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
2454 pAd->CommonCfg.BACapability.field.Policy = IMMED_BA;
2457 return FALSE; //Invalid argument
2459 pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
2460 pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy;
2463 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA));
2469 INT Set_HtProtect_Proc(
2470 IN PRTMP_ADAPTER pAd,
2475 Value = simple_strtol(arg, 0, 10);
2477 pAd->CommonCfg.bHTProtect = FALSE;
2478 else if (Value == 1)
2479 pAd->CommonCfg.bHTProtect = TRUE;
2481 return FALSE; //Invalid argument
2483 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect));
2488 INT Set_SendPSMPAction_Proc(
2489 IN PRTMP_ADAPTER pAd,
2493 char *token, sepValue[] = ":", DASH = '-';
2495 MAC_TABLE_ENTRY *pEntry;
2497 //printk("\n%s\n", arg);
2499 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2500 =>The six 2 digit hex-decimal number previous are the Mac address,
2501 =>The seventh decimal number is the mode value.
2503 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2506 token = strchr(arg, DASH);
2507 if ((token != NULL) && (strlen(token)>1))
2509 mode = simple_strtol((token+1), 0, 10);
2510 if (mode > MMPS_ENABLE)
2514 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2516 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2518 AtoH(token, (PUCHAR)(&mac[i]), 1);
2523 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2524 mac[2], mac[3], mac[4], mac[5], mode);
2526 pEntry = MacTableLookup(pAd, mac);
2529 printk("\nSendPSMPAction MIPS mode = %d\n", mode);
2530 SendPSMPAction(pAd, pEntry->Aid, mode);
2541 INT Set_HtMIMOPSmode_Proc(
2542 IN PRTMP_ADAPTER pAd,
2547 Value = simple_strtol(arg, 0, 10);
2549 if (Value <=3 && Value >= 0)
2550 pAd->CommonCfg.BACapability.field.MMPSmode = Value;
2552 pAd->CommonCfg.BACapability.field.MMPSmode = 3;
2556 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode));
2562 INT Set_ForceShortGI_Proc(
2563 IN PRTMP_ADAPTER pAd,
2568 Value = simple_strtol(arg, 0, 10);
2570 pAd->WIFItestbed.bShortGI = FALSE;
2571 else if (Value == 1)
2572 pAd->WIFItestbed.bShortGI = TRUE;
2574 return FALSE; //Invalid argument
2578 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI));
2585 INT Set_ForceGF_Proc(
2586 IN PRTMP_ADAPTER pAd,
2591 Value = simple_strtol(arg, 0, 10);
2593 pAd->WIFItestbed.bGreenField = FALSE;
2594 else if (Value == 1)
2595 pAd->WIFItestbed.bGreenField = TRUE;
2597 return FALSE; //Invalid argument
2601 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField));
2606 INT Set_HtMimoPs_Proc(
2607 IN PRTMP_ADAPTER pAd,
2612 Value = simple_strtol(arg, 0, 10);
2614 pAd->CommonCfg.bMIMOPSEnable = FALSE;
2615 else if (Value == 1)
2616 pAd->CommonCfg.bMIMOPSEnable = TRUE;
2618 return FALSE; //Invalid argument
2620 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable));
2626 IN PRTMP_ADAPTER pAd)
2628 OID_SET_HT_PHYMODE SetHT;
2630 if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED)
2633 SetHT.PhyMode = pAd->CommonCfg.PhyMode;
2634 SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath);
2635 SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
2636 SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
2637 SetHT.MCS = MCS_AUTO;
2638 SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
2639 SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
2640 SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
2642 RTMPSetHT(pAd, &SetHT);
2647 INT Set_FixedTxMode_Proc(
2648 IN PRTMP_ADAPTER pAd,
2651 UCHAR fix_tx_mode = FIXED_TXMODE_HT;
2653 if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0)
2655 fix_tx_mode = FIXED_TXMODE_OFDM;
2657 else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0)
2659 fix_tx_mode = FIXED_TXMODE_CCK;
2662 pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode;
2664 DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode));
2669 /////////////////////////////////////////////////////////////////////////
2670 PCHAR RTMPGetRalinkAuthModeStr(
2671 IN NDIS_802_11_AUTHENTICATION_MODE authMode)
2675 case Ndis802_11AuthModeOpen:
2678 case Ndis802_11AuthModeWPAPSK:
2680 case Ndis802_11AuthModeShared:
2682 case Ndis802_11AuthModeWPA:
2684 case Ndis802_11AuthModeWPA2:
2686 case Ndis802_11AuthModeWPA2PSK:
2688 case Ndis802_11AuthModeWPA1PSKWPA2PSK:
2689 return "WPAPSKWPA2PSK";
2690 case Ndis802_11AuthModeWPA1WPA2:
2695 PCHAR RTMPGetRalinkEncryModeStr(
2696 IN USHORT encryMode)
2701 case Ndis802_11WEPDisabled:
2703 case Ndis802_11WEPEnabled:
2705 case Ndis802_11Encryption2Enabled:
2707 case Ndis802_11Encryption3Enabled:
2709 case Ndis802_11Encryption4Enabled:
2714 INT RTMPShowCfgValue(
2715 IN PRTMP_ADAPTER pAd,
2721 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++)
2723 if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name))
2725 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf))
2727 break; //Exit for loop.
2731 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL)
2733 sprintf(pBuf, "\n");
2734 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++)
2735 sprintf(pBuf, "%s%s\n", pBuf, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
2742 IN PRTMP_ADAPTER pAd,
2745 sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid);
2749 INT Show_WirelessMode_Proc(
2750 IN PRTMP_ADAPTER pAd,
2753 switch(pAd->CommonCfg.PhyMode)
2755 case PHY_11BG_MIXED:
2756 sprintf(pBuf, "\t11B/G");
2759 sprintf(pBuf, "\t11B");
2762 sprintf(pBuf, "\t11A");
2764 case PHY_11ABG_MIXED:
2765 sprintf(pBuf, "\t11A/B/G");
2768 sprintf(pBuf, "\t11G");
2770 case PHY_11ABGN_MIXED:
2771 sprintf(pBuf, "\t11A/B/G/N");
2774 sprintf(pBuf, "\t11N only with 2.4G");
2776 case PHY_11GN_MIXED:
2777 sprintf(pBuf, "\t11G/N");
2779 case PHY_11AN_MIXED:
2780 sprintf(pBuf, "\t11A/N");
2782 case PHY_11BGN_MIXED:
2783 sprintf(pBuf, "\t11B/G/N");
2785 case PHY_11AGN_MIXED:
2786 sprintf(pBuf, "\t11A/G/N");
2789 sprintf(pBuf, "\t11N only with 5G");
2792 sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode);
2799 INT Show_TxBurst_Proc(
2800 IN PRTMP_ADAPTER pAd,
2803 sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE");
2807 INT Show_TxPreamble_Proc(
2808 IN PRTMP_ADAPTER pAd,
2811 switch(pAd->CommonCfg.TxPreamble)
2813 case Rt802_11PreambleShort:
2814 sprintf(pBuf, "\tShort");
2816 case Rt802_11PreambleLong:
2817 sprintf(pBuf, "\tLong");
2819 case Rt802_11PreambleAuto:
2820 sprintf(pBuf, "\tAuto");
2823 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble);
2830 INT Show_TxPower_Proc(
2831 IN PRTMP_ADAPTER pAd,
2834 sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage);
2838 INT Show_Channel_Proc(
2839 IN PRTMP_ADAPTER pAd,
2842 sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel);
2846 INT Show_BGProtection_Proc(
2847 IN PRTMP_ADAPTER pAd,
2850 switch(pAd->CommonCfg.UseBGProtection)
2853 sprintf(pBuf, "\tON");
2855 case 2: //Always OFF
2856 sprintf(pBuf, "\tOFF");
2859 sprintf(pBuf, "\tAuto");
2862 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection);
2868 INT Show_RTSThreshold_Proc(
2869 IN PRTMP_ADAPTER pAd,
2872 sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold);
2876 INT Show_FragThreshold_Proc(
2877 IN PRTMP_ADAPTER pAd,
2880 sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold);
2885 IN PRTMP_ADAPTER pAd,
2888 if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
2890 sprintf(pBuf, "\t40 MHz");
2894 sprintf(pBuf, "\t20 MHz");
2899 INT Show_HtMcs_Proc(
2900 IN PRTMP_ADAPTER pAd,
2903 sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS);
2908 IN PRTMP_ADAPTER pAd,
2911 switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI)
2914 sprintf(pBuf, "\tGI_400");
2917 sprintf(pBuf, "\tGI_800");
2920 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI);
2926 INT Show_HtOpMode_Proc(
2927 IN PRTMP_ADAPTER pAd,
2930 switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE)
2933 sprintf(pBuf, "\tGF");
2936 sprintf(pBuf, "\tMM");
2939 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE);
2945 INT Show_HtExtcha_Proc(
2946 IN PRTMP_ADAPTER pAd,
2949 switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)
2952 sprintf(pBuf, "\tBelow");
2955 sprintf(pBuf, "\tAbove");
2958 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA);
2965 INT Show_HtMpduDensity_Proc(
2966 IN PRTMP_ADAPTER pAd,
2969 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity);
2973 INT Show_HtBaWinSize_Proc(
2974 IN PRTMP_ADAPTER pAd,
2977 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit);
2981 INT Show_HtRdg_Proc(
2982 IN PRTMP_ADAPTER pAd,
2985 sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE");
2989 INT Show_HtAmsdu_Proc(
2990 IN PRTMP_ADAPTER pAd,
2993 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE");
2997 INT Show_HtAutoBa_Proc(
2998 IN PRTMP_ADAPTER pAd,
3001 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE");
3005 INT Show_CountryRegion_Proc(
3006 IN PRTMP_ADAPTER pAd,
3009 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion);
3013 INT Show_CountryRegionABand_Proc(
3014 IN PRTMP_ADAPTER pAd,
3017 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand);
3021 INT Show_CountryCode_Proc(
3022 IN PRTMP_ADAPTER pAd,
3025 sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode);
3029 #ifdef AGGREGATION_SUPPORT
3030 INT Show_PktAggregate_Proc(
3031 IN PRTMP_ADAPTER pAd,
3034 sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE");
3037 #endif // AGGREGATION_SUPPORT //
3040 INT Show_WmmCapable_Proc(
3041 IN PRTMP_ADAPTER pAd,
3044 sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE");
3048 #endif // WMM_SUPPORT //
3050 INT Show_IEEE80211H_Proc(
3051 IN PRTMP_ADAPTER pAd,
3054 sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE");
3058 INT Show_NetworkType_Proc(
3059 IN PRTMP_ADAPTER pAd,
3062 switch(pAd->StaCfg.BssType)
3065 sprintf(pBuf, "\tAdhoc");
3068 sprintf(pBuf, "\tInfra");
3071 sprintf(pBuf, "\tAny");
3074 sprintf(pBuf, "\tMonitor");
3077 sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType);
3083 INT Show_AuthMode_Proc(
3084 IN PRTMP_ADAPTER pAd,
3087 NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen;
3089 AuthMode = pAd->StaCfg.AuthMode;
3091 if ((AuthMode >= Ndis802_11AuthModeOpen) &&
3092 (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK))
3093 sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode));
3095 sprintf(pBuf, "\tUnknow Value(%d)", AuthMode);
3100 INT Show_EncrypType_Proc(
3101 IN PRTMP_ADAPTER pAd,
3104 NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled;
3106 WepStatus = pAd->StaCfg.WepStatus;
3108 if ((WepStatus >= Ndis802_11WEPEnabled) &&
3109 (WepStatus <= Ndis802_11Encryption4KeyAbsent))
3110 sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus));
3112 sprintf(pBuf, "\tUnknow Value(%d)", WepStatus);
3117 INT Show_DefaultKeyID_Proc(
3118 IN PRTMP_ADAPTER pAd,
3121 UCHAR DefaultKeyId = 0;
3123 DefaultKeyId = pAd->StaCfg.DefaultKeyId;
3125 sprintf(pBuf, "\t%d", DefaultKeyId);
3130 INT Show_WepKey_Proc(
3131 IN PRTMP_ADAPTER pAd,
3135 UCHAR Key[16] = {0}, KeyLength = 0;
3138 KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen;
3139 NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength);
3141 //check key string is ASCII or not
3142 if (RTMPCheckStrPrintAble(Key, KeyLength))
3143 sprintf(pBuf, "\t%s", Key);
3147 sprintf(pBuf, "\t");
3148 for (idx = 0; idx < KeyLength; idx++)
3149 sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]);
3155 IN PRTMP_ADAPTER pAd,
3158 Show_WepKey_Proc(pAd, 0, pBuf);
3163 IN PRTMP_ADAPTER pAd,
3166 Show_WepKey_Proc(pAd, 1, pBuf);
3171 IN PRTMP_ADAPTER pAd,
3174 Show_WepKey_Proc(pAd, 2, pBuf);
3179 IN PRTMP_ADAPTER pAd,
3182 Show_WepKey_Proc(pAd, 3, pBuf);
3186 INT Show_WPAPSK_Proc(
3187 IN PRTMP_ADAPTER pAd,
3191 UCHAR PMK[32] = {0};
3193 NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32);
3195 sprintf(pBuf, "\tPMK = ");
3196 for (idx = 0; idx < 32; idx++)
3197 sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]);