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,
787 //MAC_TABLE_ENTRY *pEntry;
789 DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n"));
791 // add the most up-to-date h/w raw counters into software counters
792 NICUpdateRawCounters(pAd);
794 NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));
795 NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));
796 NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));
801 BOOLEAN RTMPCheckStrPrintAble(
807 for (i=0; i<strLen; i++)
809 if ((pInPutStr[i] < 0x21) ||
810 (pInPutStr[i] > 0x7E))
818 ========================================================================
821 Remove WPA Key process
824 pAd Pointer to our adapter
825 pBuf Pointer to the where the key stored
828 NDIS_SUCCESS Add key successfully
830 IRQL = DISPATCH_LEVEL
834 ========================================================================
836 VOID RTMPSetDesiredRates(
837 IN PRTMP_ADAPTER pAdapter,
840 NDIS_802_11_RATES aryRates;
842 memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
843 switch (pAdapter->CommonCfg.PhyMode)
845 case PHY_11A: // A only
849 aryRates[0] = 0x0c; // 6M
850 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
853 aryRates[0] = 0x12; // 9M
854 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
857 aryRates[0] = 0x18; // 12M
858 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
861 aryRates[0] = 0x24; // 18M
862 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
865 aryRates[0] = 0x30; // 24M
866 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
869 aryRates[0] = 0x48; // 36M
870 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
873 aryRates[0] = 0x60; // 48M
874 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
877 aryRates[0] = 0x6c; // 54M
878 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
882 aryRates[0] = 0x6c; // 54Mbps
883 aryRates[1] = 0x60; // 48Mbps
884 aryRates[2] = 0x48; // 36Mbps
885 aryRates[3] = 0x30; // 24Mbps
886 aryRates[4] = 0x24; // 18M
887 aryRates[5] = 0x18; // 12M
888 aryRates[6] = 0x12; // 9M
889 aryRates[7] = 0x0c; // 6M
890 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
894 case PHY_11BG_MIXED: // B/G Mixed
895 case PHY_11B: // B only
896 case PHY_11ABG_MIXED: // A/B/G Mixed
902 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
906 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
909 aryRates[0] = 0x0b; // 5.5M
910 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
913 aryRates[0] = 0x16; // 11M
914 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
917 aryRates[0] = 0x0c; // 6M
918 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
921 aryRates[0] = 0x12; // 9M
922 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
925 aryRates[0] = 0x18; // 12M
926 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
929 aryRates[0] = 0x24; // 18M
930 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
933 aryRates[0] = 0x30; // 24M
934 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
937 aryRates[0] = 0x48; // 36M
938 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
941 aryRates[0] = 0x60; // 48M
942 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
945 aryRates[0] = 0x6c; // 54M
946 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
950 if (pAdapter->CommonCfg.PhyMode == PHY_11B)
952 aryRates[0] = 0x16; // 11Mbps
953 aryRates[1] = 0x0b; // 5.5Mbps
954 aryRates[2] = 0x04; // 2Mbps
955 aryRates[3] = 0x02; // 1Mbps
958 { //(B/G) Mixed or (A/B/G) Mixed
959 aryRates[0] = 0x6c; // 54Mbps
960 aryRates[1] = 0x60; // 48Mbps
961 aryRates[2] = 0x48; // 36Mbps
962 aryRates[3] = 0x30; // 24Mbps
963 aryRates[4] = 0x16; // 11Mbps
964 aryRates[5] = 0x0b; // 5.5Mbps
965 aryRates[6] = 0x04; // 2Mbps
966 aryRates[7] = 0x02; // 1Mbps
968 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
974 NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
975 NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
976 DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
977 pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1],
978 pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3],
979 pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5],
980 pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] ));
981 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
982 MlmeUpdateTxRates(pAdapter, FALSE, 0);
985 NDIS_STATUS RTMPWPARemoveKeyProc(
986 IN PRTMP_ADAPTER pAd,
989 PNDIS_802_11_REMOVE_KEY pKey;
991 NDIS_STATUS Status = NDIS_STATUS_FAILURE;
992 BOOLEAN bTxKey; // Set the key as transmit key
993 BOOLEAN bPairwise; // Indicate the key is pairwise key
994 BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value.
995 // Otherwise, it will set by the NIC.
996 BOOLEAN bAuthenticator; // indicate key is set by authenticator.
999 DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n"));
1001 pKey = (PNDIS_802_11_REMOVE_KEY) pBuf;
1002 KeyIdx = pKey->KeyIndex & 0xff;
1003 // Bit 31 of Add-key, Tx Key
1004 bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE;
1005 // Bit 30 of Add-key PairwiseKey
1006 bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE;
1007 // Bit 29 of Add-key KeyRSC
1008 bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE;
1009 // Bit 28 of Add-key Authenticator
1010 bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE;
1012 // 1. If bTx is TRUE, return failure information
1014 return(NDIS_STATUS_INVALID_DATA);
1016 // 2. Check Pairwise Key
1019 // a. If BSSID is broadcast, remove all pairwise keys.
1020 // b. If not broadcast, remove the pairwise specified by BSSID
1021 for (i = 0; i < SHARE_KEY_NUM; i++)
1023 if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID))
1025 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i));
1026 pAd->SharedKey[BSS0][i].KeyLen = 0;
1027 pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE;
1028 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i);
1029 Status = NDIS_STATUS_SUCCESS;
1037 // a. If BSSID is broadcast, remove all group keys indexed
1038 // b. If BSSID matched, delete the group key indexed.
1039 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx));
1040 pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
1041 pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
1042 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx);
1043 Status = NDIS_STATUS_SUCCESS;
1050 ========================================================================
1052 Routine Description:
1056 pAd Pointer to our adapter
1061 IRQL = DISPATCH_LEVEL
1065 ========================================================================
1067 VOID RTMPWPARemoveAllKeys(
1068 IN PRTMP_ADAPTER pAd)
1073 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
1075 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1076 // Link up. And it will be replaced if user changed it.
1077 if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)
1080 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1081 // Link up. And it will be replaced if user changed it.
1082 if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone)
1085 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1086 AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
1088 // set all shared key mode as no-security.
1089 for (i = 0; i < SHARE_KEY_NUM; i++)
1091 DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
1092 NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY));
1094 AsicRemoveSharedKeyEntry(pAd, BSS0, i);
1100 ========================================================================
1101 Routine Description:
1102 Change NIC PHY mode. Re-association may be necessary. possible settings
1103 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1106 pAd - Pointer to our adapter
1109 IRQL = PASSIVE_LEVEL
1110 IRQL = DISPATCH_LEVEL
1112 ========================================================================
1114 VOID RTMPSetPhyMode(
1115 IN PRTMP_ADAPTER pAd,
1119 // the selected phymode must be supported by the RF IC encoded in E2PROM
1121 pAd->CommonCfg.PhyMode = (UCHAR)phymode;
1123 DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
1125 BuildChannelList(pAd);
1127 // sanity check user setting
1128 for (i = 0; i < pAd->ChannelListNum; i++)
1130 if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
1134 if (i == pAd->ChannelListNum)
1136 pAd->CommonCfg.Channel = FirstChannel(pAd);
1137 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel));
1140 NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES);
1141 NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES);
1142 NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1145 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1146 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1147 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1148 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1149 pAd->CommonCfg.SupRateLen = 4;
1150 pAd->CommonCfg.ExtRateLen = 0;
1151 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1152 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1153 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1154 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1155 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1159 case PHY_11BG_MIXED:
1160 case PHY_11ABG_MIXED:
1162 case PHY_11ABGN_MIXED:
1163 case PHY_11BGN_MIXED:
1164 case PHY_11GN_MIXED:
1165 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1166 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1167 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1168 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1169 pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1170 pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1171 pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1172 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1173 pAd->CommonCfg.SupRateLen = 8;
1174 pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1175 pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1176 pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1177 pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1178 pAd->CommonCfg.ExtRateLen = 4;
1179 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1180 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1181 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1182 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1183 pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
1184 pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
1185 pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
1186 pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
1187 pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
1188 pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
1189 pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
1190 pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
1194 case PHY_11AN_MIXED:
1195 case PHY_11AGN_MIXED:
1197 pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1198 pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1199 pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1200 pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1201 pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1202 pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1203 pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1204 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1205 pAd->CommonCfg.SupRateLen = 8;
1206 pAd->CommonCfg.ExtRateLen = 0;
1207 pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
1208 pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
1209 pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
1210 pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
1211 pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
1212 pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
1213 pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
1214 pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
1215 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1223 pAd->CommonCfg.BandState = UNKNOWN_BAND;
1227 ========================================================================
1228 Routine Description:
1229 Caller ensures we has 802.11n support.
1230 Calls at setting HT from AP/STASetinformation
1233 pAd - Pointer to our adapter
1236 ========================================================================
1239 IN PRTMP_ADAPTER pAd,
1240 IN OID_SET_HT_PHYMODE *pHTPhyMode)
1245 UCHAR BBP3Value = 0;
1246 UCHAR RxStream = pAd->CommonCfg.RxStream;
1248 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1249 pHTPhyMode->HtMode, pHTPhyMode->ExtOffset,
1250 pHTPhyMode->MCS, pHTPhyMode->BW,
1251 pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
1253 // Don't zero supportedHyPhy structure.
1254 RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability));
1255 RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo));
1256 RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset));
1257 RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy));
1259 if (pAd->CommonCfg.bRdg)
1261 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1;
1262 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1;
1266 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0;
1267 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0;
1270 pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3;
1271 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3;
1273 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit));
1275 // Mimo power save, A-MSDU size,
1276 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
1277 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize;
1278 pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode;
1279 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1281 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
1282 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
1283 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1285 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1286 pAd->CommonCfg.DesiredHtPhy.AmsduSize,
1287 pAd->CommonCfg.DesiredHtPhy.MimoPs,
1288 pAd->CommonCfg.DesiredHtPhy.MpduDensity,
1289 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
1291 if(pHTPhyMode->HtMode == HTMODE_GF)
1293 pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1;
1294 pAd->CommonCfg.DesiredHtPhy.GF = 1;
1297 pAd->CommonCfg.DesiredHtPhy.GF = 0;
1303 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1304 pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
1308 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1309 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1313 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1314 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1315 pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
1319 if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) )
1321 pHTPhyMode->BW = BW_20;
1322 pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1;
1325 if(pHTPhyMode->BW == BW_40)
1327 pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
1328 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
1329 if (pAd->CommonCfg.Channel <= 14)
1330 pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
1332 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1;
1333 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
1334 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE;
1335 // Set Regsiter for extension channel position.
1336 RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
1337 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
1338 if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW))
1341 BBP3Value |= (0x20);
1342 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1344 else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE))
1347 BBP3Value &= (~0x20);
1348 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1351 // Turn on BBP 40MHz mode now only as AP .
1352 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1353 if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
1356 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1357 BBPValue &= (~0x18);
1359 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1361 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value);
1362 pAd->CommonCfg.BBPCurrentBW = BW_40;
1367 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0;
1368 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0;
1369 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
1370 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE;
1371 pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
1372 // Turn on BBP 20MHz mode by request here.
1374 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1375 BBPValue &= (~0x18);
1376 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1377 pAd->CommonCfg.BBPCurrentBW = BW_20;
1381 if(pHTPhyMode->STBC == STBC_USE)
1383 pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1;
1384 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1;
1385 pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1;
1386 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1;
1390 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
1391 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
1394 if(pHTPhyMode->SHORTGI == GI_400)
1396 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1;
1397 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1;
1398 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1;
1399 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1;
1403 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0;
1404 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0;
1405 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0;
1406 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0;
1409 // We support link adaptation for unsolicit MCS feedback, set to 2.
1410 pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
1411 pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
1412 // 1, the extension channel above the control channel.
1414 // EDCA parameters used for AP's own transmission
1415 if (pAd->CommonCfg.APEdcaParm.bValid == FALSE)
1417 pAd->CommonCfg.APEdcaParm.bValid = TRUE;
1418 pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
1419 pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7;
1420 pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1;
1421 pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1;
1423 pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4;
1424 pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4;
1425 pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3;
1426 pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2;
1428 pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6;
1429 pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10;
1430 pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4;
1431 pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3;
1433 pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
1434 pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
1435 pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
1436 pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
1438 AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm);
1440 RTMPSetIndividualHT(pAd, 0);
1444 ========================================================================
1445 Routine Description:
1446 Caller ensures we has 802.11n support.
1447 Calls at setting HT from AP/STASetinformation
1450 pAd - Pointer to our adapter
1453 ========================================================================
1455 VOID RTMPSetIndividualHT(
1456 IN PRTMP_ADAPTER pAd,
1459 PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
1460 UCHAR TxStream = pAd->CommonCfg.TxStream;
1461 UCHAR DesiredMcs = MCS_AUTO;
1466 pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
1467 DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS;
1468 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1473 if (pDesired_ht_phy == NULL)
1475 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
1478 RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO));
1480 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
1481 // Check the validity of MCS
1482 if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15)))
1484 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs));
1488 if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32))
1490 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1494 pDesired_ht_phy->bHtEnable = TRUE;
1496 // Decide desired Tx MCS
1500 if (DesiredMcs == MCS_AUTO)
1502 pDesired_ht_phy->MCSSet[0]= 0xff;
1503 pDesired_ht_phy->MCSSet[1]= 0x00;
1505 else if (DesiredMcs <= MCS_7)
1507 pDesired_ht_phy->MCSSet[0]= 1<<DesiredMcs;
1508 pDesired_ht_phy->MCSSet[1]= 0x00;
1513 if (DesiredMcs == MCS_AUTO)
1515 pDesired_ht_phy->MCSSet[0]= 0xff;
1516 pDesired_ht_phy->MCSSet[1]= 0xff;
1518 else if (DesiredMcs <= MCS_15)
1522 mode = DesiredMcs / 8;
1524 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1529 if (DesiredMcs == MCS_AUTO)
1531 /* MCS0 ~ MCS23, 3 bytes */
1532 pDesired_ht_phy->MCSSet[0]= 0xff;
1533 pDesired_ht_phy->MCSSet[1]= 0xff;
1534 pDesired_ht_phy->MCSSet[2]= 0xff;
1536 else if (DesiredMcs <= MCS_23)
1540 mode = DesiredMcs / 8;
1542 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1547 if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40)
1549 if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
1550 pDesired_ht_phy->MCSSet[4] = 0x1;
1553 // update HT Rate setting
1554 if (pAd->OpMode == OPMODE_STA)
1555 MlmeUpdateHtTxRates(pAd, BSS0);
1557 MlmeUpdateHtTxRates(pAd, apidx);
1562 ========================================================================
1563 Routine Description:
1564 Update HT IE from our capability.
1567 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1570 ========================================================================
1572 VOID RTMPUpdateHTIE(
1573 IN RT_HT_CAPABILITY *pRtHt,
1575 OUT HT_CAPABILITY_IE *pHtCapability,
1576 OUT ADD_HT_INFO_IE *pAddHtInfo)
1578 RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE));
1579 RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE));
1581 pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
1582 pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
1583 pHtCapability->HtCapInfo.GF = pRtHt->GF;
1584 pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
1585 pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
1586 pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
1587 pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
1588 pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
1589 pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
1590 pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
1592 pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ;
1593 pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
1594 pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
1595 pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
1596 RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1598 DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n"));
1602 ========================================================================
1604 Add Client security information into ASIC WCID table and IVEIV table.
1606 ========================================================================
1608 VOID RTMPAddWcidAttributeEntry(
1609 IN PRTMP_ADAPTER pAd,
1613 IN MAC_TABLE_ENTRY *pEntry)
1615 UINT32 WCIDAttri = 0;
1624 DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx));
1628 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
1629 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
1630 // the AID:2~ assign to mesh link entry.
1631 if (pEntry && ADHOC_ON(pAd))
1633 else if (pEntry && INFRA_ON(pAd))
1642 // Update WCID attribute table
1643 offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE);
1646 if (pEntry && pEntry->ValidAsMesh)
1647 WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE;
1649 WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE;
1652 RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
1655 // Update IV/EIV table
1656 offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
1659 if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES))
1661 // Eiv bit on. keyid always is 0 for pairwise key
1662 IVEIV = (KeyIdx <<6) | 0x20;
1666 // WEP KeyIdx is default tx key.
1667 IVEIV = (KeyIdx << 6);
1670 // For key index and ext IV bit, so only need to update the position(offset+3).
1672 RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV);
1675 DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg]));
1676 DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri));
1681 ==========================================================================
1683 Parse encryption type
1685 pAdapter Pointer to our adapter
1686 wrq Pointer to the ioctl argument
1692 ==========================================================================
1694 CHAR *GetEncryptType(CHAR enc)
1696 if(enc == Ndis802_11WEPDisabled)
1698 if(enc == Ndis802_11WEPEnabled)
1700 if(enc == Ndis802_11Encryption2Enabled)
1702 if(enc == Ndis802_11Encryption3Enabled)
1704 if(enc == Ndis802_11Encryption4Enabled)
1710 CHAR *GetAuthMode(CHAR auth)
1712 if(auth == Ndis802_11AuthModeOpen)
1714 if(auth == Ndis802_11AuthModeShared)
1716 if(auth == Ndis802_11AuthModeAutoSwitch)
1718 if(auth == Ndis802_11AuthModeWPA)
1720 if(auth == Ndis802_11AuthModeWPAPSK)
1722 if(auth == Ndis802_11AuthModeWPANone)
1724 if(auth == Ndis802_11AuthModeWPA2)
1726 if(auth == Ndis802_11AuthModeWPA2PSK)
1728 if(auth == Ndis802_11AuthModeWPA1WPA2)
1730 if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
1731 return "WPA1PSKWPA2PSK";
1737 ==========================================================================
1739 Get site survey results
1741 pAdapter Pointer to our adapter
1742 wrq Pointer to the ioctl argument
1749 1.) UI needs to wait 4 seconds after issue a site survey command
1750 2.) iwpriv ra0 get_site_survey
1751 3.) UI needs to prepare at least 4096bytes to get the results
1752 ==========================================================================
1754 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
1755 VOID RTMPIoctlGetSiteSurvey(
1756 IN PRTMP_ADAPTER pAdapter,
1757 IN struct iwreq *wrq)
1763 CHAR Ssid[MAX_LEN_OF_SSID +1];
1764 INT Rssi = 0, max_len = LINE_LEN;
1765 UINT Rssi_Quality = 0;
1766 NDIS_802_11_NETWORK_TYPE wireless_mode;
1768 os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len));
1772 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
1776 memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len );
1777 memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1));
1778 sprintf(msg,"%s","\n");
1779 sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
1780 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
1783 pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE;
1785 while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200))
1788 for(i=0; i<pAdapter->ScanTab.BssNr ;i++)
1790 if( pAdapter->ScanTab.BssEntry[i].Channel==0)
1793 if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA)
1797 sprintf(msg+strlen(msg),"%-4d", pAdapter->ScanTab.BssEntry[i].Channel);
1799 memcpy(Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen);
1800 Ssid[pAdapter->ScanTab.BssEntry[i].SsidLen] = '\0';
1801 sprintf(msg+strlen(msg),"%-33s", Ssid);
1803 sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ",
1804 pAdapter->ScanTab.BssEntry[i].Bssid[0],
1805 pAdapter->ScanTab.BssEntry[i].Bssid[1],
1806 pAdapter->ScanTab.BssEntry[i].Bssid[2],
1807 pAdapter->ScanTab.BssEntry[i].Bssid[3],
1808 pAdapter->ScanTab.BssEntry[i].Bssid[4],
1809 pAdapter->ScanTab.BssEntry[i].Bssid[5]);
1811 sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus));
1812 //Authentication Mode
1813 if (pAdapter->ScanTab.BssEntry[i].WepStatus == Ndis802_11WEPEnabled)
1814 sprintf(msg+strlen(msg),"%-10s", "UNKNOW");
1816 sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode));
1818 Rssi = (INT)pAdapter->ScanTab.BssEntry[i].Rssi;
1821 else if (Rssi >= -80) // between -50 ~ -80dbm
1822 Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10);
1823 else if (Rssi >= -90) // between -80 ~ -90dbm
1824 Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10);
1827 sprintf(msg+strlen(msg),"%-9d", Rssi_Quality);
1829 wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]);
1830 if (wireless_mode == Ndis802_11FH ||
1831 wireless_mode == Ndis802_11DS)
1832 sprintf(msg+strlen(msg),"%-7s", "11b");
1833 else if (wireless_mode == Ndis802_11OFDM5)
1834 sprintf(msg+strlen(msg),"%-7s", "11a");
1835 else if (wireless_mode == Ndis802_11OFDM5_N)
1836 sprintf(msg+strlen(msg),"%-7s", "11a/n");
1837 else if (wireless_mode == Ndis802_11OFDM24)
1838 sprintf(msg+strlen(msg),"%-7s", "11b/g");
1839 else if (wireless_mode == Ndis802_11OFDM24_N)
1840 sprintf(msg+strlen(msg),"%-7s", "11b/g/n");
1842 sprintf(msg+strlen(msg),"%-7s", "unknow");
1844 if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC)
1845 sprintf(msg+strlen(msg),"%-3s", " Ad");
1847 sprintf(msg+strlen(msg),"%-3s", " In");
1849 sprintf(msg+strlen(msg),"\n");
1852 pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE;
1853 wrq->u.data.length = strlen(msg);
1854 Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);
1856 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length));
1857 os_free_mem(NULL, (PUCHAR)msg);
1861 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
1862 VOID RTMPIoctlGetMacTable(
1863 IN PRTMP_ADAPTER pAd,
1864 IN struct iwreq *wrq)
1867 RT_802_11_MAC_TABLE MacTab;
1871 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1873 if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC))
1875 COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr);
1876 MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid;
1877 MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode;
1878 MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode;
1880 // Fill in RSSI per entry
1881 MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0;
1882 MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1;
1883 MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2;
1885 // the connected time per entry
1886 MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime;
1887 MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS;
1888 MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW;
1889 MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI;
1890 MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC;
1891 MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv;
1892 MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE;
1893 MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word;
1898 wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE);
1899 if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length))
1901 DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__));
1904 msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG);
1905 memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN );
1906 sprintf(msg,"%s","\n");
1907 sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
1908 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
1910 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1912 PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];
1913 if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC))
1915 if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) )
1917 sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ",
1918 pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],
1919 pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);
1920 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid);
1921 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode);
1922 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
1923 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
1924 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
1925 sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]);
1926 sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
1929 // for compatible with old API just do the printk to console
1930 //wrq->u.data.length = strlen(msg);
1931 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
1933 DBGPRINT(RT_DEBUG_TRACE, ("%s", msg));
1939 INT Set_BASetup_Proc(
1940 IN PRTMP_ADAPTER pAd,
1944 char *token, sepValue[] = ":", DASH = '-';
1946 MAC_TABLE_ENTRY *pEntry;
1949 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
1950 =>The six 2 digit hex-decimal number previous are the Mac address,
1951 =>The seventh decimal number is the tid value.
1953 //printk("\n%s\n", arg);
1955 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
1958 token = strchr(arg, DASH);
1959 if ((token != NULL) && (strlen(token)>1))
1961 tid = simple_strtol((token+1), 0, 10);
1966 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
1968 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
1970 AtoH(token, (PUCHAR)(&mac[i]), 1);
1975 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1],
1976 mac[2], mac[3], mac[4], mac[5], tid);
1978 pEntry = MacTableLookup(pAd, mac);
1981 printk("\nSetup BA Session: Tid = %d\n", tid);
1982 BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE);
1992 INT Set_BADecline_Proc(
1993 IN PRTMP_ADAPTER pAd,
1998 bBADecline = simple_strtol(arg, 0, 10);
2000 if (bBADecline == 0)
2002 pAd->CommonCfg.bBADecline = FALSE;
2004 else if (bBADecline == 1)
2006 pAd->CommonCfg.bBADecline = TRUE;
2010 return FALSE; //Invalid argument
2013 DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline));
2018 INT Set_BAOriTearDown_Proc(
2019 IN PRTMP_ADAPTER pAd,
2023 char *token, sepValue[] = ":", DASH = '-';
2025 MAC_TABLE_ENTRY *pEntry;
2027 //printk("\n%s\n", arg);
2029 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2030 =>The six 2 digit hex-decimal number previous are the Mac address,
2031 =>The seventh decimal number is the tid value.
2033 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2036 token = strchr(arg, DASH);
2037 if ((token != NULL) && (strlen(token)>1))
2039 tid = simple_strtol((token+1), 0, 10);
2040 if (tid > NUM_OF_TID)
2044 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2046 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2048 AtoH(token, (PUCHAR)(&mac[i]), 1);
2053 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2054 mac[2], mac[3], mac[4], mac[5], tid);
2056 pEntry = MacTableLookup(pAd, mac);
2059 printk("\nTear down Ori BA Session: Tid = %d\n", tid);
2060 BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE);
2070 INT Set_BARecTearDown_Proc(
2071 IN PRTMP_ADAPTER pAd,
2075 char *token, sepValue[] = ":", DASH = '-';
2077 MAC_TABLE_ENTRY *pEntry;
2079 //printk("\n%s\n", arg);
2081 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2082 =>The six 2 digit hex-decimal number previous are the Mac address,
2083 =>The seventh decimal number is the tid value.
2085 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2088 token = strchr(arg, DASH);
2089 if ((token != NULL) && (strlen(token)>1))
2091 tid = simple_strtol((token+1), 0, 10);
2092 if (tid > NUM_OF_TID)
2096 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2098 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2100 AtoH(token, (PUCHAR)(&mac[i]), 1);
2105 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2106 mac[2], mac[3], mac[4], mac[5], tid);
2108 pEntry = MacTableLookup(pAd, mac);
2111 printk("\nTear down Rec BA Session: Tid = %d\n", tid);
2112 BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE);
2123 IN PRTMP_ADAPTER pAd,
2128 HtBw = simple_strtol(arg, 0, 10);
2130 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
2131 else if (HtBw == BW_20)
2132 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
2134 return FALSE; //Invalid argument
2138 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW));
2144 IN PRTMP_ADAPTER pAd,
2147 ULONG HtMcs, Mcs_tmp;
2148 BOOLEAN bAutoRate = FALSE;
2150 Mcs_tmp = simple_strtol(arg, 0, 10);
2152 if (Mcs_tmp <= 15 || Mcs_tmp == 32)
2158 pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs;
2159 pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE;
2160 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2161 pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch));
2163 if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) ||
2164 (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX))
2166 if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2167 (HtMcs >= 0 && HtMcs <= 3) &&
2168 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK))
2170 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000));
2172 else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2173 (HtMcs >= 0 && HtMcs <= 7) &&
2174 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM))
2176 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000));
2183 pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
2184 RTMPSetDesiredRates(pAd, -1);
2186 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode));
2198 IN PRTMP_ADAPTER pAd,
2203 HtGi = simple_strtol(arg, 0, 10);
2205 if ( HtGi == GI_400)
2206 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400;
2207 else if ( HtGi == GI_800 )
2208 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800;
2210 return FALSE; //Invalid argument
2214 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI));
2220 INT Set_HtTxBASize_Proc(
2221 IN PRTMP_ADAPTER pAd,
2226 Size = simple_strtol(arg, 0, 10);
2228 if (Size <=0 || Size >=64)
2232 pAd->CommonCfg.TxBASize = Size-1;
2233 DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size));
2239 INT Set_HtOpMode_Proc(
2240 IN PRTMP_ADAPTER pAd,
2246 Value = simple_strtol(arg, 0, 10);
2248 if (Value == HTMODE_GF)
2249 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF;
2250 else if ( Value == HTMODE_MM )
2251 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM;
2253 return FALSE; //Invalid argument
2257 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE));
2263 INT Set_HtStbc_Proc(
2264 IN PRTMP_ADAPTER pAd,
2270 Value = simple_strtol(arg, 0, 10);
2272 if (Value == STBC_USE)
2273 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE;
2274 else if ( Value == STBC_NONE )
2275 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE;
2277 return FALSE; //Invalid argument
2281 DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC));
2287 IN PRTMP_ADAPTER pAd,
2293 Value = simple_strtol(arg, 0, 10);
2295 pAd->HTCEnable = FALSE;
2296 else if ( Value ==1 )
2297 pAd->HTCEnable = TRUE;
2299 return FALSE; //Invalid argument
2301 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable));
2306 INT Set_HtExtcha_Proc(
2307 IN PRTMP_ADAPTER pAd,
2313 Value = simple_strtol(arg, 0, 10);
2316 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW;
2317 else if ( Value ==1 )
2318 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE;
2320 return FALSE; //Invalid argument
2324 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA));
2329 INT Set_HtMpduDensity_Proc(
2330 IN PRTMP_ADAPTER pAd,
2335 Value = simple_strtol(arg, 0, 10);
2337 if (Value <=7 && Value >= 0)
2338 pAd->CommonCfg.BACapability.field.MpduDensity = Value;
2340 pAd->CommonCfg.BACapability.field.MpduDensity = 4;
2344 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity));
2349 INT Set_HtBaWinSize_Proc(
2350 IN PRTMP_ADAPTER pAd,
2355 Value = simple_strtol(arg, 0, 10);
2358 if (Value >=1 && Value <= 64)
2360 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value;
2361 pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value;
2365 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64;
2366 pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64;
2371 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit));
2377 IN PRTMP_ADAPTER pAd,
2382 Value = simple_strtol(arg, 0, 10);
2385 pAd->CommonCfg.bRdg = FALSE;
2386 else if ( Value ==1 )
2388 pAd->HTCEnable = TRUE;
2389 pAd->CommonCfg.bRdg = TRUE;
2392 return FALSE; //Invalid argument
2396 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg));
2401 INT Set_HtLinkAdapt_Proc(
2402 IN PRTMP_ADAPTER pAd,
2407 Value = simple_strtol(arg, 0, 10);
2409 pAd->bLinkAdapt = FALSE;
2410 else if ( Value ==1 )
2412 pAd->HTCEnable = TRUE;
2413 pAd->bLinkAdapt = TRUE;
2416 return FALSE; //Invalid argument
2418 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt));
2423 INT Set_HtAmsdu_Proc(
2424 IN PRTMP_ADAPTER pAd,
2429 Value = simple_strtol(arg, 0, 10);
2431 pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE;
2432 else if ( Value == 1 )
2433 pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE;
2435 return FALSE; //Invalid argument
2439 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable));
2444 INT Set_HtAutoBa_Proc(
2445 IN PRTMP_ADAPTER pAd,
2450 Value = simple_strtol(arg, 0, 10);
2453 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
2454 pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE;
2456 else if (Value == 1)
2458 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
2459 pAd->CommonCfg.BACapability.field.Policy = IMMED_BA;
2462 return FALSE; //Invalid argument
2464 pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
2465 pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy;
2468 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA));
2474 INT Set_HtProtect_Proc(
2475 IN PRTMP_ADAPTER pAd,
2480 Value = simple_strtol(arg, 0, 10);
2482 pAd->CommonCfg.bHTProtect = FALSE;
2483 else if (Value == 1)
2484 pAd->CommonCfg.bHTProtect = TRUE;
2486 return FALSE; //Invalid argument
2488 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect));
2493 INT Set_SendPSMPAction_Proc(
2494 IN PRTMP_ADAPTER pAd,
2498 char *token, sepValue[] = ":", DASH = '-';
2500 MAC_TABLE_ENTRY *pEntry;
2502 //printk("\n%s\n", arg);
2504 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2505 =>The six 2 digit hex-decimal number previous are the Mac address,
2506 =>The seventh decimal number is the mode value.
2508 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2511 token = strchr(arg, DASH);
2512 if ((token != NULL) && (strlen(token)>1))
2514 mode = simple_strtol((token+1), 0, 10);
2515 if (mode > MMPS_ENABLE)
2519 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2521 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2523 AtoH(token, (PUCHAR)(&mac[i]), 1);
2528 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2529 mac[2], mac[3], mac[4], mac[5], mode);
2531 pEntry = MacTableLookup(pAd, mac);
2534 printk("\nSendPSMPAction MIPS mode = %d\n", mode);
2535 SendPSMPAction(pAd, pEntry->Aid, mode);
2546 INT Set_HtMIMOPSmode_Proc(
2547 IN PRTMP_ADAPTER pAd,
2552 Value = simple_strtol(arg, 0, 10);
2554 if (Value <=3 && Value >= 0)
2555 pAd->CommonCfg.BACapability.field.MMPSmode = Value;
2557 pAd->CommonCfg.BACapability.field.MMPSmode = 3;
2561 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode));
2567 INT Set_ForceShortGI_Proc(
2568 IN PRTMP_ADAPTER pAd,
2573 Value = simple_strtol(arg, 0, 10);
2575 pAd->WIFItestbed.bShortGI = FALSE;
2576 else if (Value == 1)
2577 pAd->WIFItestbed.bShortGI = TRUE;
2579 return FALSE; //Invalid argument
2583 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI));
2590 INT Set_ForceGF_Proc(
2591 IN PRTMP_ADAPTER pAd,
2596 Value = simple_strtol(arg, 0, 10);
2598 pAd->WIFItestbed.bGreenField = FALSE;
2599 else if (Value == 1)
2600 pAd->WIFItestbed.bGreenField = TRUE;
2602 return FALSE; //Invalid argument
2606 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField));
2611 INT Set_HtMimoPs_Proc(
2612 IN PRTMP_ADAPTER pAd,
2617 Value = simple_strtol(arg, 0, 10);
2619 pAd->CommonCfg.bMIMOPSEnable = FALSE;
2620 else if (Value == 1)
2621 pAd->CommonCfg.bMIMOPSEnable = TRUE;
2623 return FALSE; //Invalid argument
2625 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable));
2631 IN PRTMP_ADAPTER pAd)
2633 OID_SET_HT_PHYMODE SetHT;
2635 if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED)
2638 SetHT.PhyMode = pAd->CommonCfg.PhyMode;
2639 SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath);
2640 SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
2641 SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
2642 SetHT.MCS = MCS_AUTO;
2643 SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
2644 SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
2645 SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
2647 RTMPSetHT(pAd, &SetHT);
2652 INT Set_FixedTxMode_Proc(
2653 IN PRTMP_ADAPTER pAd,
2656 UCHAR fix_tx_mode = FIXED_TXMODE_HT;
2658 if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0)
2660 fix_tx_mode = FIXED_TXMODE_OFDM;
2662 else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0)
2664 fix_tx_mode = FIXED_TXMODE_CCK;
2667 pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode;
2669 DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode));
2674 /////////////////////////////////////////////////////////////////////////
2675 PCHAR RTMPGetRalinkAuthModeStr(
2676 IN NDIS_802_11_AUTHENTICATION_MODE authMode)
2680 case Ndis802_11AuthModeOpen:
2683 case Ndis802_11AuthModeWPAPSK:
2685 case Ndis802_11AuthModeShared:
2687 case Ndis802_11AuthModeWPA:
2689 case Ndis802_11AuthModeWPA2:
2691 case Ndis802_11AuthModeWPA2PSK:
2693 case Ndis802_11AuthModeWPA1PSKWPA2PSK:
2694 return "WPAPSKWPA2PSK";
2695 case Ndis802_11AuthModeWPA1WPA2:
2700 PCHAR RTMPGetRalinkEncryModeStr(
2701 IN USHORT encryMode)
2706 case Ndis802_11WEPDisabled:
2708 case Ndis802_11WEPEnabled:
2710 case Ndis802_11Encryption2Enabled:
2712 case Ndis802_11Encryption3Enabled:
2714 case Ndis802_11Encryption4Enabled:
2719 INT RTMPShowCfgValue(
2720 IN PRTMP_ADAPTER pAd,
2726 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++)
2728 if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name))
2730 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf))
2732 break; //Exit for loop.
2736 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL)
2738 sprintf(pBuf, "\n");
2739 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++)
2740 sprintf(pBuf, "%s%s\n", pBuf, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
2747 IN PRTMP_ADAPTER pAd,
2750 sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid);
2754 INT Show_WirelessMode_Proc(
2755 IN PRTMP_ADAPTER pAd,
2758 switch(pAd->CommonCfg.PhyMode)
2760 case PHY_11BG_MIXED:
2761 sprintf(pBuf, "\t11B/G");
2764 sprintf(pBuf, "\t11B");
2767 sprintf(pBuf, "\t11A");
2769 case PHY_11ABG_MIXED:
2770 sprintf(pBuf, "\t11A/B/G");
2773 sprintf(pBuf, "\t11G");
2775 case PHY_11ABGN_MIXED:
2776 sprintf(pBuf, "\t11A/B/G/N");
2779 sprintf(pBuf, "\t11N only with 2.4G");
2781 case PHY_11GN_MIXED:
2782 sprintf(pBuf, "\t11G/N");
2784 case PHY_11AN_MIXED:
2785 sprintf(pBuf, "\t11A/N");
2787 case PHY_11BGN_MIXED:
2788 sprintf(pBuf, "\t11B/G/N");
2790 case PHY_11AGN_MIXED:
2791 sprintf(pBuf, "\t11A/G/N");
2794 sprintf(pBuf, "\t11N only with 5G");
2797 sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode);
2804 INT Show_TxBurst_Proc(
2805 IN PRTMP_ADAPTER pAd,
2808 sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE");
2812 INT Show_TxPreamble_Proc(
2813 IN PRTMP_ADAPTER pAd,
2816 switch(pAd->CommonCfg.TxPreamble)
2818 case Rt802_11PreambleShort:
2819 sprintf(pBuf, "\tShort");
2821 case Rt802_11PreambleLong:
2822 sprintf(pBuf, "\tLong");
2824 case Rt802_11PreambleAuto:
2825 sprintf(pBuf, "\tAuto");
2828 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble);
2835 INT Show_TxPower_Proc(
2836 IN PRTMP_ADAPTER pAd,
2839 sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage);
2843 INT Show_Channel_Proc(
2844 IN PRTMP_ADAPTER pAd,
2847 sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel);
2851 INT Show_BGProtection_Proc(
2852 IN PRTMP_ADAPTER pAd,
2855 switch(pAd->CommonCfg.UseBGProtection)
2858 sprintf(pBuf, "\tON");
2860 case 2: //Always OFF
2861 sprintf(pBuf, "\tOFF");
2864 sprintf(pBuf, "\tAuto");
2867 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection);
2873 INT Show_RTSThreshold_Proc(
2874 IN PRTMP_ADAPTER pAd,
2877 sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold);
2881 INT Show_FragThreshold_Proc(
2882 IN PRTMP_ADAPTER pAd,
2885 sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold);
2890 IN PRTMP_ADAPTER pAd,
2893 if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
2895 sprintf(pBuf, "\t40 MHz");
2899 sprintf(pBuf, "\t20 MHz");
2904 INT Show_HtMcs_Proc(
2905 IN PRTMP_ADAPTER pAd,
2908 sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS);
2913 IN PRTMP_ADAPTER pAd,
2916 switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI)
2919 sprintf(pBuf, "\tGI_400");
2922 sprintf(pBuf, "\tGI_800");
2925 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI);
2931 INT Show_HtOpMode_Proc(
2932 IN PRTMP_ADAPTER pAd,
2935 switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE)
2938 sprintf(pBuf, "\tGF");
2941 sprintf(pBuf, "\tMM");
2944 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE);
2950 INT Show_HtExtcha_Proc(
2951 IN PRTMP_ADAPTER pAd,
2954 switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)
2957 sprintf(pBuf, "\tBelow");
2960 sprintf(pBuf, "\tAbove");
2963 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA);
2970 INT Show_HtMpduDensity_Proc(
2971 IN PRTMP_ADAPTER pAd,
2974 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity);
2978 INT Show_HtBaWinSize_Proc(
2979 IN PRTMP_ADAPTER pAd,
2982 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit);
2986 INT Show_HtRdg_Proc(
2987 IN PRTMP_ADAPTER pAd,
2990 sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE");
2994 INT Show_HtAmsdu_Proc(
2995 IN PRTMP_ADAPTER pAd,
2998 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE");
3002 INT Show_HtAutoBa_Proc(
3003 IN PRTMP_ADAPTER pAd,
3006 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE");
3010 INT Show_CountryRegion_Proc(
3011 IN PRTMP_ADAPTER pAd,
3014 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion);
3018 INT Show_CountryRegionABand_Proc(
3019 IN PRTMP_ADAPTER pAd,
3022 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand);
3026 INT Show_CountryCode_Proc(
3027 IN PRTMP_ADAPTER pAd,
3030 sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode);
3034 #ifdef AGGREGATION_SUPPORT
3035 INT Show_PktAggregate_Proc(
3036 IN PRTMP_ADAPTER pAd,
3039 sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE");
3042 #endif // AGGREGATION_SUPPORT //
3045 INT Show_WmmCapable_Proc(
3046 IN PRTMP_ADAPTER pAd,
3049 sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE");
3053 #endif // WMM_SUPPORT //
3055 INT Show_IEEE80211H_Proc(
3056 IN PRTMP_ADAPTER pAd,
3059 sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE");
3063 INT Show_NetworkType_Proc(
3064 IN PRTMP_ADAPTER pAd,
3067 switch(pAd->StaCfg.BssType)
3070 sprintf(pBuf, "\tAdhoc");
3073 sprintf(pBuf, "\tInfra");
3076 sprintf(pBuf, "\tAny");
3079 sprintf(pBuf, "\tMonitor");
3082 sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType);
3088 INT Show_AuthMode_Proc(
3089 IN PRTMP_ADAPTER pAd,
3092 NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen;
3094 AuthMode = pAd->StaCfg.AuthMode;
3096 if ((AuthMode >= Ndis802_11AuthModeOpen) &&
3097 (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK))
3098 sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode));
3100 sprintf(pBuf, "\tUnknow Value(%d)", AuthMode);
3105 INT Show_EncrypType_Proc(
3106 IN PRTMP_ADAPTER pAd,
3109 NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled;
3111 WepStatus = pAd->StaCfg.WepStatus;
3113 if ((WepStatus >= Ndis802_11WEPEnabled) &&
3114 (WepStatus <= Ndis802_11Encryption4KeyAbsent))
3115 sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus));
3117 sprintf(pBuf, "\tUnknow Value(%d)", WepStatus);
3122 INT Show_DefaultKeyID_Proc(
3123 IN PRTMP_ADAPTER pAd,
3126 UCHAR DefaultKeyId = 0;
3128 DefaultKeyId = pAd->StaCfg.DefaultKeyId;
3130 sprintf(pBuf, "\t%d", DefaultKeyId);
3135 INT Show_WepKey_Proc(
3136 IN PRTMP_ADAPTER pAd,
3140 UCHAR Key[16] = {0}, KeyLength = 0;
3143 KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen;
3144 NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength);
3146 //check key string is ASCII or not
3147 if (RTMPCheckStrPrintAble(Key, KeyLength))
3148 sprintf(pBuf, "\t%s", Key);
3152 sprintf(pBuf, "\t");
3153 for (idx = 0; idx < KeyLength; idx++)
3154 sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]);
3160 IN PRTMP_ADAPTER pAd,
3163 Show_WepKey_Proc(pAd, 0, pBuf);
3168 IN PRTMP_ADAPTER pAd,
3171 Show_WepKey_Proc(pAd, 1, pBuf);
3176 IN PRTMP_ADAPTER pAd,
3179 Show_WepKey_Proc(pAd, 2, pBuf);
3184 IN PRTMP_ADAPTER pAd,
3187 Show_WepKey_Proc(pAd, 3, pBuf);
3191 INT Show_WPAPSK_Proc(
3192 IN PRTMP_ADAPTER pAd,
3196 UCHAR PMK[32] = {0};
3198 NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32);
3200 sprintf(pBuf, "\tPMK = ");
3201 for (idx = 0; idx < 32; idx++)
3202 sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]);