2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
28 #include "../rt_config.h"
34 INT Show_WirelessMode_Proc(
38 INT Show_TxBurst_Proc(
42 INT Show_TxPreamble_Proc(
46 INT Show_TxPower_Proc(
50 INT Show_Channel_Proc(
54 INT Show_BGProtection_Proc(
58 INT Show_RTSThreshold_Proc(
62 INT Show_FragThreshold_Proc(
78 INT Show_HtOpMode_Proc(
82 INT Show_HtExtcha_Proc(
86 INT Show_HtMpduDensity_Proc(
90 INT Show_HtBaWinSize_Proc(
98 INT Show_HtAmsdu_Proc(
102 INT Show_HtAutoBa_Proc(
103 IN PRTMP_ADAPTER pAd,
106 INT Show_CountryRegion_Proc(
107 IN PRTMP_ADAPTER pAd,
110 INT Show_CountryRegionABand_Proc(
111 IN PRTMP_ADAPTER pAd,
114 INT Show_CountryCode_Proc(
115 IN PRTMP_ADAPTER pAd,
118 #ifdef AGGREGATION_SUPPORT
119 INT Show_PktAggregate_Proc(
120 IN PRTMP_ADAPTER pAd,
122 #endif // AGGREGATION_SUPPORT //
125 INT Show_WmmCapable_Proc(
126 IN PRTMP_ADAPTER pAd,
128 #endif // WMM_SUPPORT //
130 INT Show_IEEE80211H_Proc(
131 IN PRTMP_ADAPTER pAd,
134 INT Show_NetworkType_Proc(
135 IN PRTMP_ADAPTER pAd,
138 INT Show_AuthMode_Proc(
139 IN PRTMP_ADAPTER pAd,
142 INT Show_EncrypType_Proc(
143 IN PRTMP_ADAPTER pAd,
146 INT Show_DefaultKeyID_Proc(
147 IN PRTMP_ADAPTER pAd,
151 IN PRTMP_ADAPTER pAd,
155 IN PRTMP_ADAPTER pAd,
159 IN PRTMP_ADAPTER pAd,
163 IN PRTMP_ADAPTER pAd,
166 INT Show_WPAPSK_Proc(
167 IN PRTMP_ADAPTER pAd,
172 INT (*show_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg);
173 } *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = {
174 {"SSID", Show_SSID_Proc},
175 {"WirelessMode", Show_WirelessMode_Proc},
176 {"TxBurst", Show_TxBurst_Proc},
177 {"TxPreamble", Show_TxPreamble_Proc},
178 {"TxPower", Show_TxPower_Proc},
179 {"Channel", Show_Channel_Proc},
180 {"BGProtection", Show_BGProtection_Proc},
181 {"RTSThreshold", Show_RTSThreshold_Proc},
182 {"FragThreshold", Show_FragThreshold_Proc},
183 {"HtBw", Show_HtBw_Proc},
184 {"HtMcs", Show_HtMcs_Proc},
185 {"HtGi", Show_HtGi_Proc},
186 {"HtOpMode", Show_HtOpMode_Proc},
187 {"HtExtcha", Show_HtExtcha_Proc},
188 {"HtMpduDensity", Show_HtMpduDensity_Proc},
189 {"HtBaWinSize", Show_HtBaWinSize_Proc},
190 {"HtRdg", Show_HtRdg_Proc},
191 {"HtAmsdu", Show_HtAmsdu_Proc},
192 {"HtAutoBa", Show_HtAutoBa_Proc},
193 {"CountryRegion", Show_CountryRegion_Proc},
194 {"CountryRegionABand", Show_CountryRegionABand_Proc},
195 {"CountryCode", Show_CountryCode_Proc},
196 #ifdef AGGREGATION_SUPPORT
197 {"PktAggregate", Show_PktAggregate_Proc},
201 {"WmmCapable", Show_WmmCapable_Proc},
203 {"IEEE80211H", Show_IEEE80211H_Proc},
204 {"NetworkType", Show_NetworkType_Proc},
205 {"AuthMode", Show_AuthMode_Proc},
206 {"EncrypType", Show_EncrypType_Proc},
207 {"DefaultKeyID", Show_DefaultKeyID_Proc},
208 {"Key1", Show_Key1_Proc},
209 {"Key2", Show_Key2_Proc},
210 {"Key3", Show_Key3_Proc},
211 {"Key4", Show_Key4_Proc},
212 {"WPAPSK", Show_WPAPSK_Proc},
217 ==========================================================================
222 ==========================================================================
224 INT Set_DriverVersion_Proc(
225 IN PRTMP_ADAPTER pAd,
228 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
229 DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION));
235 ==========================================================================
238 This command will not work, if the field of CountryRegion in eeprom is programmed.
240 TRUE if all parameters are OK, FALSE otherwise
241 ==========================================================================
243 INT Set_CountryRegion_Proc(
244 IN PRTMP_ADAPTER pAd,
249 region = simple_strtol(arg, 0, 10);
251 // Country can be set only when EEPROM not programmed
252 if (pAd->CommonCfg.CountryRegion & 0x80)
254 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameter of CountryRegion in eeprom is programmed \n"));
258 if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND))
260 pAd->CommonCfg.CountryRegion = (UCHAR) region;
262 else if (region == REGION_31_BG_BAND)
264 pAd->CommonCfg.CountryRegion = (UCHAR) region;
268 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameters out of range\n"));
272 // if set country region, driver needs to be reset
273 BuildChannelList(pAd);
275 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion));
281 ==========================================================================
283 Set Country Region for A band.
284 This command will not work, if the field of CountryRegion in eeprom is programmed.
286 TRUE if all parameters are OK, FALSE otherwise
287 ==========================================================================
289 INT Set_CountryRegionABand_Proc(
290 IN PRTMP_ADAPTER pAd,
295 region = simple_strtol(arg, 0, 10);
297 // Country can be set only when EEPROM not programmed
298 if (pAd->CommonCfg.CountryRegionForABand & 0x80)
300 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameter of CountryRegion in eeprom is programmed \n"));
304 if((region >= 0) && (region <= REGION_MAXIMUM_A_BAND))
306 pAd->CommonCfg.CountryRegionForABand = (UCHAR) region;
310 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameters out of range\n"));
314 // if set country region, driver needs to be reset
315 BuildChannelList(pAd);
317 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegionForABand));
323 ==========================================================================
327 TRUE if all parameters are OK, FALSE otherwise
328 ==========================================================================
330 INT Set_WirelessMode_Proc(
331 IN PRTMP_ADAPTER pAd,
337 WirelessMode = simple_strtol(arg, 0, 10);
339 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
341 INT MaxPhyMode = PHY_11G;
343 MaxPhyMode = PHY_11N_5G;
345 if (WirelessMode <= MaxPhyMode)
347 RTMPSetPhyMode(pAd, WirelessMode);
349 if (WirelessMode >= PHY_11ABGN_MIXED)
351 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
352 pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE;
356 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
357 pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE;
360 // Set AdhocMode rates
361 if (pAd->StaCfg.BssType == BSS_ADHOC)
363 MlmeUpdateTxRates(pAd, FALSE, 0);
364 MakeIbssBeacon(pAd); // re-build BEACON frame
365 AsicEnableIbssSync(pAd); // copy to on-chip memory
374 // it is needed to set SSID to take effect
378 DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%ld)\n", WirelessMode));
382 DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n"));
389 ==========================================================================
393 TRUE if all parameters are OK, FALSE otherwise
394 ==========================================================================
396 INT Set_Channel_Proc(
397 IN PRTMP_ADAPTER pAd,
403 Channel = (UCHAR) simple_strtol(arg, 0, 10);
405 // check if this channel is valid
406 if (ChannelSanity(pAd, Channel) == TRUE)
408 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
410 pAd->CommonCfg.Channel = Channel;
415 if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED &&
416 pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
419 AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
420 AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
421 DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n",
422 pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel));
426 AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
427 AsicLockChannel(pAd, pAd->CommonCfg.Channel);
428 DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel));
436 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
442 DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel));
448 ==========================================================================
450 Set Short Slot Time Enable or Disable
452 TRUE if all parameters are OK, FALSE otherwise
453 ==========================================================================
455 INT Set_ShortSlot_Proc(
456 IN PRTMP_ADAPTER pAd,
461 ShortSlot = simple_strtol(arg, 0, 10);
464 pAd->CommonCfg.bUseShortSlotTime = TRUE;
465 else if (ShortSlot == 0)
466 pAd->CommonCfg.bUseShortSlotTime = FALSE;
468 return FALSE; //Invalid argument
470 DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime));
476 ==========================================================================
480 TRUE if all parameters are OK, FALSE otherwise
481 ==========================================================================
483 INT Set_TxPower_Proc(
484 IN PRTMP_ADAPTER pAd,
490 TxPower = (ULONG) simple_strtol(arg, 0, 10);
493 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
495 pAd->CommonCfg.TxPowerDefault = TxPower;
496 pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
503 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
509 ==========================================================================
511 Set 11B/11G Protection
513 TRUE if all parameters are OK, FALSE otherwise
514 ==========================================================================
516 INT Set_BGProtection_Proc(
517 IN PRTMP_ADAPTER pAd,
520 switch (simple_strtol(arg, 0, 10))
523 pAd->CommonCfg.UseBGProtection = 0;
526 pAd->CommonCfg.UseBGProtection = 1;
529 pAd->CommonCfg.UseBGProtection = 2;
531 default: //Invalid argument
536 DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection));
542 ==========================================================================
546 TRUE if all parameters are OK, FALSE otherwise
547 ==========================================================================
549 INT Set_TxPreamble_Proc(
550 IN PRTMP_ADAPTER pAd,
553 RT_802_11_PREAMBLE Preamble;
555 Preamble = simple_strtol(arg, 0, 10);
560 case Rt802_11PreambleShort:
561 pAd->CommonCfg.TxPreamble = Preamble;
563 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
564 MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);
566 case Rt802_11PreambleLong:
567 case Rt802_11PreambleAuto:
568 // if user wants AUTO, initialize to LONG here, then change according to AP's
569 // capability upon association.
570 pAd->CommonCfg.TxPreamble = Preamble;
572 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
573 MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);
575 default: //Invalid argument
579 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble));
585 ==========================================================================
589 TRUE if all parameters are OK, FALSE otherwise
590 ==========================================================================
592 INT Set_RTSThreshold_Proc(
593 IN PRTMP_ADAPTER pAd,
596 NDIS_802_11_RTS_THRESHOLD RtsThresh;
598 RtsThresh = simple_strtol(arg, 0, 10);
600 if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD))
601 pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
602 else if (RtsThresh == 0)
603 pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;
605 return FALSE; //Invalid argument
607 DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold));
613 ==========================================================================
615 Set Fragment Threshold
617 TRUE if all parameters are OK, FALSE otherwise
618 ==========================================================================
620 INT Set_FragThreshold_Proc(
621 IN PRTMP_ADAPTER pAd,
624 NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
626 FragThresh = simple_strtol(arg, 0, 10);
628 if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)
630 //Illegal FragThresh so we set it to default
631 pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
633 else if (FragThresh % 2 == 1)
635 // The length of each fragment shall always be an even number of octets, except for the last fragment
636 // of an MSDU or MMPDU, which may be either an even or an odd number of octets.
637 pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1);
641 pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
644 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
646 if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)
647 pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;
649 pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;
652 DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold));
658 ==========================================================================
662 TRUE if all parameters are OK, FALSE otherwise
663 ==========================================================================
665 INT Set_TxBurst_Proc(
666 IN PRTMP_ADAPTER pAd,
671 TxBurst = simple_strtol(arg, 0, 10);
673 pAd->CommonCfg.bEnableTxBurst = TRUE;
674 else if (TxBurst == 0)
675 pAd->CommonCfg.bEnableTxBurst = FALSE;
677 return FALSE; //Invalid argument
679 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst));
684 #ifdef AGGREGATION_SUPPORT
686 ==========================================================================
690 TRUE if all parameters are OK, FALSE otherwise
691 ==========================================================================
693 INT Set_PktAggregate_Proc(
694 IN PRTMP_ADAPTER pAd,
699 aggre = simple_strtol(arg, 0, 10);
702 pAd->CommonCfg.bAggregationCapable = TRUE;
704 pAd->CommonCfg.bAggregationCapable = FALSE;
706 return FALSE; //Invalid argument
709 DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable));
716 ==========================================================================
719 This parameter is 1 when needs radar detection, otherwise 0
721 TRUE if all parameters are OK, FALSE otherwise
722 ==========================================================================
724 INT Set_IEEE80211H_Proc(
725 IN PRTMP_ADAPTER pAd,
730 ieee80211h = simple_strtol(arg, 0, 10);
733 pAd->CommonCfg.bIEEE80211H = TRUE;
734 else if (ieee80211h == 0)
735 pAd->CommonCfg.bIEEE80211H = FALSE;
737 return FALSE; //Invalid argument
739 DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H));
747 ==========================================================================
749 For Debug information
751 TRUE if all parameters are OK, FALSE otherwise
752 ==========================================================================
755 IN PRTMP_ADAPTER pAd,
758 DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n"));
760 if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD)
761 RTDebugLevel = simple_strtol(arg, 0, 10);
763 DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel));
769 INT Show_DescInfo_Proc(
770 IN PRTMP_ADAPTER pAd,
774 PRT28XX_RXD_STRUC pRxD;
776 PRTMP_TX_RING pTxRing = &pAd->TxRing[QueIdx];
777 PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing;
778 PRTMP_RX_RING pRxRing = &pAd->RxRing;
780 for(i=0;i<TX_RING_SIZE;i++)
782 pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa;
783 printk("Desc #%d\n",i);
784 hex_dump("Tx Descriptor", (char *)pTxD, 16);
785 printk("pTxD->DMADONE = %x\n", pTxD->DMADONE);
787 printk("---------------------------------------------------\n");
788 for(i=0;i<MGMT_RING_SIZE;i++)
790 pTxD = (PTXD_STRUC) pMgmtRing->Cell[i].AllocVa;
791 printk("Desc #%d\n",i);
792 hex_dump("Mgmt Descriptor", (char *)pTxD, 16);
793 printk("pMgmt->DMADONE = %x\n", pTxD->DMADONE);
795 printk("---------------------------------------------------\n");
796 for(i=0;i<RX_RING_SIZE;i++)
798 pRxD = (PRT28XX_RXD_STRUC) pRxRing->Cell[i].AllocVa;
799 printk("Desc #%d\n",i);
800 hex_dump("Rx Descriptor", (char *)pRxD, 16);
801 printk("pRxD->DDONE = %x\n", pRxD->DDONE);
808 ==========================================================================
810 Reset statistics counter
813 pAdapter Pointer to our adapter
817 TRUE if all parameters are OK, FALSE otherwise
818 ==========================================================================
820 INT Set_ResetStatCounter_Proc(
821 IN PRTMP_ADAPTER pAd,
824 DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n"));
826 // add the most up-to-date h/w raw counters into software counters
827 NICUpdateRawCounters(pAd);
829 NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));
830 NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));
831 NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));
836 BOOLEAN RTMPCheckStrPrintAble(
842 for (i=0; i<strLen; i++)
844 if ((pInPutStr[i] < 0x21) ||
845 (pInPutStr[i] > 0x7E))
853 ========================================================================
856 Remove WPA Key process
859 pAd Pointer to our adapter
860 pBuf Pointer to the where the key stored
863 NDIS_SUCCESS Add key successfully
865 IRQL = DISPATCH_LEVEL
869 ========================================================================
871 VOID RTMPSetDesiredRates(
872 IN PRTMP_ADAPTER pAdapter,
875 NDIS_802_11_RATES aryRates;
877 memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
878 switch (pAdapter->CommonCfg.PhyMode)
880 case PHY_11A: // A only
884 aryRates[0] = 0x0c; // 6M
885 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
888 aryRates[0] = 0x12; // 9M
889 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
892 aryRates[0] = 0x18; // 12M
893 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
896 aryRates[0] = 0x24; // 18M
897 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
900 aryRates[0] = 0x30; // 24M
901 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
904 aryRates[0] = 0x48; // 36M
905 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
908 aryRates[0] = 0x60; // 48M
909 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
912 aryRates[0] = 0x6c; // 54M
913 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
917 aryRates[0] = 0x6c; // 54Mbps
918 aryRates[1] = 0x60; // 48Mbps
919 aryRates[2] = 0x48; // 36Mbps
920 aryRates[3] = 0x30; // 24Mbps
921 aryRates[4] = 0x24; // 18M
922 aryRates[5] = 0x18; // 12M
923 aryRates[6] = 0x12; // 9M
924 aryRates[7] = 0x0c; // 6M
925 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
929 case PHY_11BG_MIXED: // B/G Mixed
930 case PHY_11B: // B only
931 case PHY_11ABG_MIXED: // A/B/G Mixed
937 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
941 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
944 aryRates[0] = 0x0b; // 5.5M
945 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
948 aryRates[0] = 0x16; // 11M
949 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
952 aryRates[0] = 0x0c; // 6M
953 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
956 aryRates[0] = 0x12; // 9M
957 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
960 aryRates[0] = 0x18; // 12M
961 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
964 aryRates[0] = 0x24; // 18M
965 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
968 aryRates[0] = 0x30; // 24M
969 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
972 aryRates[0] = 0x48; // 36M
973 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
976 aryRates[0] = 0x60; // 48M
977 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
980 aryRates[0] = 0x6c; // 54M
981 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
985 if (pAdapter->CommonCfg.PhyMode == PHY_11B)
987 aryRates[0] = 0x16; // 11Mbps
988 aryRates[1] = 0x0b; // 5.5Mbps
989 aryRates[2] = 0x04; // 2Mbps
990 aryRates[3] = 0x02; // 1Mbps
993 { //(B/G) Mixed or (A/B/G) Mixed
994 aryRates[0] = 0x6c; // 54Mbps
995 aryRates[1] = 0x60; // 48Mbps
996 aryRates[2] = 0x48; // 36Mbps
997 aryRates[3] = 0x30; // 24Mbps
998 aryRates[4] = 0x16; // 11Mbps
999 aryRates[5] = 0x0b; // 5.5Mbps
1000 aryRates[6] = 0x04; // 2Mbps
1001 aryRates[7] = 0x02; // 1Mbps
1003 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
1009 NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1010 NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
1011 DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
1012 pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1],
1013 pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3],
1014 pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5],
1015 pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] ));
1016 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
1017 MlmeUpdateTxRates(pAdapter, FALSE, 0);
1020 NDIS_STATUS RTMPWPARemoveKeyProc(
1021 IN PRTMP_ADAPTER pAd,
1024 PNDIS_802_11_REMOVE_KEY pKey;
1026 NDIS_STATUS Status = NDIS_STATUS_FAILURE;
1027 BOOLEAN bTxKey; // Set the key as transmit key
1028 BOOLEAN bPairwise; // Indicate the key is pairwise key
1029 BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value.
1030 // Otherwise, it will set by the NIC.
1031 BOOLEAN bAuthenticator; // indicate key is set by authenticator.
1034 DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n"));
1036 pKey = (PNDIS_802_11_REMOVE_KEY) pBuf;
1037 KeyIdx = pKey->KeyIndex & 0xff;
1038 // Bit 31 of Add-key, Tx Key
1039 bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE;
1040 // Bit 30 of Add-key PairwiseKey
1041 bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE;
1042 // Bit 29 of Add-key KeyRSC
1043 bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE;
1044 // Bit 28 of Add-key Authenticator
1045 bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE;
1047 // 1. If bTx is TRUE, return failure information
1049 return(NDIS_STATUS_INVALID_DATA);
1051 // 2. Check Pairwise Key
1054 // a. If BSSID is broadcast, remove all pairwise keys.
1055 // b. If not broadcast, remove the pairwise specified by BSSID
1056 for (i = 0; i < SHARE_KEY_NUM; i++)
1058 if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID))
1060 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i));
1061 pAd->SharedKey[BSS0][i].KeyLen = 0;
1062 pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE;
1063 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i);
1064 Status = NDIS_STATUS_SUCCESS;
1072 // a. If BSSID is broadcast, remove all group keys indexed
1073 // b. If BSSID matched, delete the group key indexed.
1074 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx));
1075 pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
1076 pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
1077 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx);
1078 Status = NDIS_STATUS_SUCCESS;
1085 ========================================================================
1087 Routine Description:
1091 pAd Pointer to our adapter
1096 IRQL = DISPATCH_LEVEL
1100 ========================================================================
1102 VOID RTMPWPARemoveAllKeys(
1103 IN PRTMP_ADAPTER pAd)
1108 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
1110 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1111 // Link up. And it will be replaced if user changed it.
1112 if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)
1115 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1116 // Link up. And it will be replaced if user changed it.
1117 if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone)
1120 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1121 AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
1123 // set all shared key mode as no-security.
1124 for (i = 0; i < SHARE_KEY_NUM; i++)
1126 DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
1127 NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY));
1129 AsicRemoveSharedKeyEntry(pAd, BSS0, i);
1135 ========================================================================
1136 Routine Description:
1137 Change NIC PHY mode. Re-association may be necessary. possible settings
1138 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1141 pAd - Pointer to our adapter
1144 IRQL = PASSIVE_LEVEL
1145 IRQL = DISPATCH_LEVEL
1147 ========================================================================
1149 VOID RTMPSetPhyMode(
1150 IN PRTMP_ADAPTER pAd,
1154 // the selected phymode must be supported by the RF IC encoded in E2PROM
1156 // if no change, do nothing
1158 if (pAd->CommonCfg.PhyMode == phymode)
1161 pAd->CommonCfg.PhyMode = (UCHAR)phymode;
1163 DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
1165 BuildChannelList(pAd);
1167 // sanity check user setting
1168 for (i = 0; i < pAd->ChannelListNum; i++)
1170 if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
1174 if (i == pAd->ChannelListNum)
1176 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1177 pAd->CommonCfg.Channel = FirstChannel(pAd);
1178 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel));
1181 NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES);
1182 NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES);
1183 NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1186 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1187 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1188 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1189 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1190 pAd->CommonCfg.SupRateLen = 4;
1191 pAd->CommonCfg.ExtRateLen = 0;
1192 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1193 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1194 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1195 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1196 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1200 case PHY_11BG_MIXED:
1201 case PHY_11ABG_MIXED:
1203 case PHY_11ABGN_MIXED:
1204 case PHY_11BGN_MIXED:
1205 case PHY_11GN_MIXED:
1206 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1207 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1208 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1209 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1210 pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1211 pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1212 pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1213 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1214 pAd->CommonCfg.SupRateLen = 8;
1215 pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1216 pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1217 pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1218 pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1219 pAd->CommonCfg.ExtRateLen = 4;
1220 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1221 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1222 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1223 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1224 pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
1225 pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
1226 pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
1227 pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
1228 pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
1229 pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
1230 pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
1231 pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
1235 case PHY_11AN_MIXED:
1236 case PHY_11AGN_MIXED:
1238 pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1239 pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1240 pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1241 pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1242 pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1243 pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1244 pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1245 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1246 pAd->CommonCfg.SupRateLen = 8;
1247 pAd->CommonCfg.ExtRateLen = 0;
1248 pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
1249 pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
1250 pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
1251 pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
1252 pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
1253 pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
1254 pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
1255 pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
1256 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1264 pAd->CommonCfg.BandState = UNKNOWN_BAND;
1268 ========================================================================
1269 Routine Description:
1270 Caller ensures we has 802.11n support.
1271 Calls at setting HT from AP/STASetinformation
1274 pAd - Pointer to our adapter
1277 ========================================================================
1280 IN PRTMP_ADAPTER pAd,
1281 IN OID_SET_HT_PHYMODE *pHTPhyMode)
1286 UCHAR BBP3Value = 0;
1287 UCHAR RxStream = pAd->CommonCfg.RxStream;
1289 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1290 pHTPhyMode->HtMode, pHTPhyMode->ExtOffset,
1291 pHTPhyMode->MCS, pHTPhyMode->BW,
1292 pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
1294 // Don't zero supportedHyPhy structure.
1295 RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability));
1296 RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo));
1297 RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset));
1298 RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy));
1300 if (pAd->CommonCfg.bRdg)
1302 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1;
1303 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1;
1307 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0;
1308 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0;
1311 pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3;
1312 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3;
1314 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit));
1316 // Mimo power save, A-MSDU size,
1317 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
1318 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize;
1319 pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode;
1320 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1322 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
1323 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
1324 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1326 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1327 pAd->CommonCfg.DesiredHtPhy.AmsduSize,
1328 pAd->CommonCfg.DesiredHtPhy.MimoPs,
1329 pAd->CommonCfg.DesiredHtPhy.MpduDensity,
1330 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
1332 if(pHTPhyMode->HtMode == HTMODE_GF)
1334 pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1;
1335 pAd->CommonCfg.DesiredHtPhy.GF = 1;
1338 pAd->CommonCfg.DesiredHtPhy.GF = 0;
1344 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1345 pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
1349 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1350 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1354 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1355 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1356 pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
1360 if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) )
1362 pHTPhyMode->BW = BW_20;
1363 pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1;
1366 if(pHTPhyMode->BW == BW_40)
1368 pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
1369 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
1370 if (pAd->CommonCfg.Channel <= 14)
1371 pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
1373 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1;
1374 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
1375 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE;
1376 // Set Regsiter for extension channel position.
1377 RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
1378 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
1379 if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW))
1382 BBP3Value |= (0x20);
1383 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1385 else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE))
1388 BBP3Value &= (~0x20);
1389 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1392 // Turn on BBP 40MHz mode now only as AP .
1393 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1394 if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
1397 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1398 BBPValue &= (~0x18);
1400 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1402 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value);
1403 pAd->CommonCfg.BBPCurrentBW = BW_40;
1408 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0;
1409 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0;
1410 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
1411 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE;
1412 pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
1413 // Turn on BBP 20MHz mode by request here.
1415 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1416 BBPValue &= (~0x18);
1417 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1418 pAd->CommonCfg.BBPCurrentBW = BW_20;
1422 if(pHTPhyMode->STBC == STBC_USE)
1424 pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1;
1425 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1;
1426 pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1;
1427 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1;
1431 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
1432 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
1436 if(pHTPhyMode->SHORTGI == GI_400)
1438 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1;
1439 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1;
1440 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1;
1441 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1;
1445 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0;
1446 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0;
1447 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0;
1448 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0;
1451 // We support link adaptation for unsolicit MCS feedback, set to 2.
1452 pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
1453 pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
1454 // 1, the extension channel above the control channel.
1456 // EDCA parameters used for AP's own transmission
1457 if (pAd->CommonCfg.APEdcaParm.bValid == FALSE)
1459 pAd->CommonCfg.APEdcaParm.bValid = TRUE;
1460 pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
1461 pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7;
1462 pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1;
1463 pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1;
1465 pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4;
1466 pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4;
1467 pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3;
1468 pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2;
1470 pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6;
1471 pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10;
1472 pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4;
1473 pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3;
1475 pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
1476 pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
1477 pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
1478 pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
1480 AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm);
1482 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1484 RTMPSetIndividualHT(pAd, 0);
1489 ========================================================================
1490 Routine Description:
1491 Caller ensures we has 802.11n support.
1492 Calls at setting HT from AP/STASetinformation
1495 pAd - Pointer to our adapter
1498 ========================================================================
1500 VOID RTMPSetIndividualHT(
1501 IN PRTMP_ADAPTER pAd,
1504 PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
1505 UCHAR TxStream = pAd->CommonCfg.TxStream;
1506 UCHAR DesiredMcs = MCS_AUTO;
1510 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1512 pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
1513 DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS;
1514 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1519 if (pDesired_ht_phy == NULL)
1521 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
1524 RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO));
1526 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
1527 // Check the validity of MCS
1528 if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15)))
1530 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs));
1534 if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32))
1536 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1540 pDesired_ht_phy->bHtEnable = TRUE;
1542 // Decide desired Tx MCS
1546 if (DesiredMcs == MCS_AUTO)
1548 pDesired_ht_phy->MCSSet[0]= 0xff;
1549 pDesired_ht_phy->MCSSet[1]= 0x00;
1551 else if (DesiredMcs <= MCS_7)
1553 pDesired_ht_phy->MCSSet[0]= 1<<DesiredMcs;
1554 pDesired_ht_phy->MCSSet[1]= 0x00;
1559 if (DesiredMcs == MCS_AUTO)
1561 pDesired_ht_phy->MCSSet[0]= 0xff;
1562 pDesired_ht_phy->MCSSet[1]= 0xff;
1564 else if (DesiredMcs <= MCS_15)
1568 mode = DesiredMcs / 8;
1570 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1575 if (DesiredMcs == MCS_AUTO)
1577 /* MCS0 ~ MCS23, 3 bytes */
1578 pDesired_ht_phy->MCSSet[0]= 0xff;
1579 pDesired_ht_phy->MCSSet[1]= 0xff;
1580 pDesired_ht_phy->MCSSet[2]= 0xff;
1582 else if (DesiredMcs <= MCS_23)
1586 mode = DesiredMcs / 8;
1588 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1593 if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40)
1595 if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
1596 pDesired_ht_phy->MCSSet[4] = 0x1;
1599 // update HT Rate setting
1600 if (pAd->OpMode == OPMODE_STA)
1601 MlmeUpdateHtTxRates(pAd, BSS0);
1603 MlmeUpdateHtTxRates(pAd, apidx);
1608 ========================================================================
1609 Routine Description:
1610 Update HT IE from our capability.
1613 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1616 ========================================================================
1618 VOID RTMPUpdateHTIE(
1619 IN RT_HT_CAPABILITY *pRtHt,
1621 OUT HT_CAPABILITY_IE *pHtCapability,
1622 OUT ADD_HT_INFO_IE *pAddHtInfo)
1624 RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE));
1625 RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE));
1627 pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
1628 pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
1629 pHtCapability->HtCapInfo.GF = pRtHt->GF;
1630 pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
1631 pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
1632 pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
1633 pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
1634 pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
1635 pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
1636 pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
1638 pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ;
1639 pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
1640 pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
1641 pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
1642 RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1644 DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n"));
1648 ========================================================================
1650 Add Client security information into ASIC WCID table and IVEIV table.
1652 ========================================================================
1654 VOID RTMPAddWcidAttributeEntry(
1655 IN PRTMP_ADAPTER pAd,
1659 IN MAC_TABLE_ENTRY *pEntry)
1661 UINT32 WCIDAttri = 0;
1667 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1671 DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx));
1675 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
1676 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
1677 // the AID:2~ assign to mesh link entry.
1678 if (pEntry && ADHOC_ON(pAd))
1680 else if (pEntry && INFRA_ON(pAd))
1689 // Update WCID attribute table
1690 offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE);
1692 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1694 if (pEntry && pEntry->ValidAsMesh)
1695 WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE;
1697 WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE;
1700 RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
1703 // Update IV/EIV table
1704 offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
1707 if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES))
1709 // Eiv bit on. keyid always is 0 for pairwise key
1710 IVEIV = (KeyIdx <<6) | 0x20;
1714 // WEP KeyIdx is default tx key.
1715 IVEIV = (KeyIdx << 6);
1718 // For key index and ext IV bit, so only need to update the position(offset+3).
1719 RTMP_IO_WRITE8(pAd, offset+3, IVEIV);
1721 DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg]));
1722 DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri));
1727 ==========================================================================
1729 Parse encryption type
1731 pAdapter Pointer to our adapter
1732 wrq Pointer to the ioctl argument
1738 ==========================================================================
1740 CHAR *GetEncryptType(CHAR enc)
1742 if(enc == Ndis802_11WEPDisabled)
1744 if(enc == Ndis802_11WEPEnabled)
1746 if(enc == Ndis802_11Encryption2Enabled)
1748 if(enc == Ndis802_11Encryption3Enabled)
1750 if(enc == Ndis802_11Encryption4Enabled)
1756 CHAR *GetAuthMode(CHAR auth)
1758 if(auth == Ndis802_11AuthModeOpen)
1760 if(auth == Ndis802_11AuthModeShared)
1762 if(auth == Ndis802_11AuthModeAutoSwitch)
1764 if(auth == Ndis802_11AuthModeWPA)
1766 if(auth == Ndis802_11AuthModeWPAPSK)
1768 if(auth == Ndis802_11AuthModeWPANone)
1770 if(auth == Ndis802_11AuthModeWPA2)
1772 if(auth == Ndis802_11AuthModeWPA2PSK)
1774 if(auth == Ndis802_11AuthModeWPA1WPA2)
1776 if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
1777 return "WPA1PSKWPA2PSK";
1783 ==========================================================================
1785 Get site survey results
1787 pAdapter Pointer to our adapter
1788 wrq Pointer to the ioctl argument
1795 1.) UI needs to wait 4 seconds after issue a site survey command
1796 2.) iwpriv ra0 get_site_survey
1797 3.) UI needs to prepare at least 4096bytes to get the results
1798 ==========================================================================
1800 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
1801 VOID RTMPIoctlGetSiteSurvey(
1802 IN PRTMP_ADAPTER pAdapter,
1803 IN struct iwreq *wrq)
1809 CHAR Ssid[MAX_LEN_OF_SSID +1];
1810 INT Rssi = 0, max_len = LINE_LEN;
1811 UINT Rssi_Quality = 0;
1812 NDIS_802_11_NETWORK_TYPE wireless_mode;
1814 os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len));
1818 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
1822 memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len );
1823 memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1));
1824 sprintf(msg,"%s","\n");
1825 sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
1826 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
1829 pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE;
1831 while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200))
1834 for(i=0; i<pAdapter->ScanTab.BssNr ;i++)
1836 if( pAdapter->ScanTab.BssEntry[i].Channel==0)
1839 if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA)
1843 sprintf(msg+strlen(msg),"%-4d", pAdapter->ScanTab.BssEntry[i].Channel);
1845 memcpy(Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen);
1846 Ssid[pAdapter->ScanTab.BssEntry[i].SsidLen] = '\0';
1847 sprintf(msg+strlen(msg),"%-33s", Ssid);
1849 sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ",
1850 pAdapter->ScanTab.BssEntry[i].Bssid[0],
1851 pAdapter->ScanTab.BssEntry[i].Bssid[1],
1852 pAdapter->ScanTab.BssEntry[i].Bssid[2],
1853 pAdapter->ScanTab.BssEntry[i].Bssid[3],
1854 pAdapter->ScanTab.BssEntry[i].Bssid[4],
1855 pAdapter->ScanTab.BssEntry[i].Bssid[5]);
1857 sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus));
1858 //Authentication Mode
1859 if (pAdapter->ScanTab.BssEntry[i].WepStatus == Ndis802_11WEPEnabled)
1860 sprintf(msg+strlen(msg),"%-10s", "UNKNOW");
1862 sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode));
1864 Rssi = (INT)pAdapter->ScanTab.BssEntry[i].Rssi;
1867 else if (Rssi >= -80) // between -50 ~ -80dbm
1868 Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10);
1869 else if (Rssi >= -90) // between -80 ~ -90dbm
1870 Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10);
1873 sprintf(msg+strlen(msg),"%-9d", Rssi_Quality);
1875 wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]);
1876 if (wireless_mode == Ndis802_11FH ||
1877 wireless_mode == Ndis802_11DS)
1878 sprintf(msg+strlen(msg),"%-7s", "11b");
1879 else if (wireless_mode == Ndis802_11OFDM5)
1880 sprintf(msg+strlen(msg),"%-7s", "11a");
1881 else if (wireless_mode == Ndis802_11OFDM5_N)
1882 sprintf(msg+strlen(msg),"%-7s", "11a/n");
1883 else if (wireless_mode == Ndis802_11OFDM24)
1884 sprintf(msg+strlen(msg),"%-7s", "11b/g");
1885 else if (wireless_mode == Ndis802_11OFDM24_N)
1886 sprintf(msg+strlen(msg),"%-7s", "11b/g/n");
1888 sprintf(msg+strlen(msg),"%-7s", "unknow");
1890 if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC)
1891 sprintf(msg+strlen(msg),"%-3s", " Ad");
1893 sprintf(msg+strlen(msg),"%-3s", " In");
1895 sprintf(msg+strlen(msg),"\n");
1898 pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE;
1899 wrq->u.data.length = strlen(msg);
1900 Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);
1902 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length));
1903 os_free_mem(NULL, (PUCHAR)msg);
1907 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
1908 VOID RTMPIoctlGetMacTable(
1909 IN PRTMP_ADAPTER pAd,
1910 IN struct iwreq *wrq)
1913 RT_802_11_MAC_TABLE MacTab;
1917 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1919 if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC))
1921 COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr);
1922 MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid;
1923 MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode;
1924 MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode;
1926 // Fill in RSSI per entry
1927 MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0;
1928 MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1;
1929 MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2;
1931 // the connected time per entry
1932 MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime;
1933 MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS;
1934 MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW;
1935 MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI;
1936 MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC;
1937 MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv;
1938 MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE;
1939 MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word;
1944 wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE);
1945 if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length))
1947 DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__));
1950 msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG);
1951 memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN );
1952 sprintf(msg,"%s","\n");
1953 sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
1954 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
1956 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1958 PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];
1959 if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC))
1961 if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) )
1963 sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ",
1964 pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],
1965 pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);
1966 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid);
1967 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode);
1968 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
1969 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
1970 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
1971 sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]);
1972 sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
1975 // for compatible with old API just do the printk to console
1976 //wrq->u.data.length = strlen(msg);
1977 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
1979 DBGPRINT(RT_DEBUG_TRACE, ("%s", msg));
1985 INT Set_BASetup_Proc(
1986 IN PRTMP_ADAPTER pAd,
1990 char *token, sepValue[] = ":", DASH = '-';
1992 MAC_TABLE_ENTRY *pEntry;
1995 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
1996 =>The six 2 digit hex-decimal number previous are the Mac address,
1997 =>The seventh decimal number is the tid value.
1999 //printk("\n%s\n", arg);
2001 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2004 token = strchr(arg, DASH);
2005 if ((token != NULL) && (strlen(token)>1))
2007 tid = simple_strtol((token+1), 0, 10);
2012 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2014 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2016 AtoH(token, (PUCHAR)(&mac[i]), 1);
2021 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1],
2022 mac[2], mac[3], mac[4], mac[5], tid);
2024 pEntry = MacTableLookup(pAd, mac);
2027 printk("\nSetup BA Session: Tid = %d\n", tid);
2028 BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE);
2038 INT Set_BADecline_Proc(
2039 IN PRTMP_ADAPTER pAd,
2044 bBADecline = simple_strtol(arg, 0, 10);
2046 if (bBADecline == 0)
2048 pAd->CommonCfg.bBADecline = FALSE;
2050 else if (bBADecline == 1)
2052 pAd->CommonCfg.bBADecline = TRUE;
2056 return FALSE; //Invalid argument
2059 DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline));
2064 INT Set_BAOriTearDown_Proc(
2065 IN PRTMP_ADAPTER pAd,
2069 char *token, sepValue[] = ":", DASH = '-';
2071 MAC_TABLE_ENTRY *pEntry;
2074 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2075 =>The six 2 digit hex-decimal number previous are the Mac address,
2076 =>The seventh decimal number is the tid value.
2078 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2081 token = strchr(arg, DASH);
2082 if ((token != NULL) && (strlen(token)>1))
2084 tid = simple_strtol((token+1), 0, 10);
2085 if (tid > NUM_OF_TID)
2089 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2091 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2093 AtoH(token, (PUCHAR)(&mac[i]), 1);
2098 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2099 mac[2], mac[3], mac[4], mac[5], tid);
2101 pEntry = MacTableLookup(pAd, mac);
2104 printk("\nTear down Ori BA Session: Tid = %d\n", tid);
2105 BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE);
2115 INT Set_BARecTearDown_Proc(
2116 IN PRTMP_ADAPTER pAd,
2120 char *token, sepValue[] = ":", DASH = '-';
2122 MAC_TABLE_ENTRY *pEntry;
2124 //printk("\n%s\n", arg);
2126 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2127 =>The six 2 digit hex-decimal number previous are the Mac address,
2128 =>The seventh decimal number is the tid value.
2130 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2133 token = strchr(arg, DASH);
2134 if ((token != NULL) && (strlen(token)>1))
2136 tid = simple_strtol((token+1), 0, 10);
2137 if (tid > NUM_OF_TID)
2141 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2143 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2145 AtoH(token, (PUCHAR)(&mac[i]), 1);
2150 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2151 mac[2], mac[3], mac[4], mac[5], tid);
2153 pEntry = MacTableLookup(pAd, mac);
2156 printk("\nTear down Rec BA Session: Tid = %d\n", tid);
2157 BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE);
2168 IN PRTMP_ADAPTER pAd,
2173 HtBw = simple_strtol(arg, 0, 10);
2175 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
2176 else if (HtBw == BW_20)
2177 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
2179 return FALSE; //Invalid argument
2183 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW));
2189 IN PRTMP_ADAPTER pAd,
2192 ULONG HtMcs, Mcs_tmp;
2193 BOOLEAN bAutoRate = FALSE;
2195 Mcs_tmp = simple_strtol(arg, 0, 10);
2197 if (Mcs_tmp <= 15 || Mcs_tmp == 32)
2202 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2204 pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs;
2205 pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE;
2206 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2207 pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch));
2209 if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) ||
2210 (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX))
2212 if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2213 (HtMcs >= 0 && HtMcs <= 3) &&
2214 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK))
2216 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000));
2218 else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2219 (HtMcs >= 0 && HtMcs <= 7) &&
2220 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM))
2222 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000));
2229 pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
2230 RTMPSetDesiredRates(pAd, -1);
2232 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode));
2244 IN PRTMP_ADAPTER pAd,
2249 HtGi = simple_strtol(arg, 0, 10);
2251 if ( HtGi == GI_400)
2252 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400;
2253 else if ( HtGi == GI_800 )
2254 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800;
2256 return FALSE; //Invalid argument
2260 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI));
2266 INT Set_HtTxBASize_Proc(
2267 IN PRTMP_ADAPTER pAd,
2272 Size = simple_strtol(arg, 0, 10);
2274 if (Size <=0 || Size >=64)
2278 pAd->CommonCfg.TxBASize = Size-1;
2279 DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size));
2285 INT Set_HtOpMode_Proc(
2286 IN PRTMP_ADAPTER pAd,
2292 Value = simple_strtol(arg, 0, 10);
2294 if (Value == HTMODE_GF)
2295 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF;
2296 else if ( Value == HTMODE_MM )
2297 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM;
2299 return FALSE; //Invalid argument
2303 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE));
2309 INT Set_HtStbc_Proc(
2310 IN PRTMP_ADAPTER pAd,
2316 Value = simple_strtol(arg, 0, 10);
2318 if (Value == STBC_USE)
2319 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE;
2320 else if ( Value == STBC_NONE )
2321 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE;
2323 return FALSE; //Invalid argument
2327 DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC));
2333 IN PRTMP_ADAPTER pAd,
2339 Value = simple_strtol(arg, 0, 10);
2341 pAd->HTCEnable = FALSE;
2342 else if ( Value ==1 )
2343 pAd->HTCEnable = TRUE;
2345 return FALSE; //Invalid argument
2347 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable));
2352 INT Set_HtExtcha_Proc(
2353 IN PRTMP_ADAPTER pAd,
2359 Value = simple_strtol(arg, 0, 10);
2362 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW;
2363 else if ( Value ==1 )
2364 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE;
2366 return FALSE; //Invalid argument
2370 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA));
2375 INT Set_HtMpduDensity_Proc(
2376 IN PRTMP_ADAPTER pAd,
2381 Value = simple_strtol(arg, 0, 10);
2383 if (Value <=7 && Value >= 0)
2384 pAd->CommonCfg.BACapability.field.MpduDensity = Value;
2386 pAd->CommonCfg.BACapability.field.MpduDensity = 4;
2390 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity));
2395 INT Set_HtBaWinSize_Proc(
2396 IN PRTMP_ADAPTER pAd,
2401 Value = simple_strtol(arg, 0, 10);
2404 if (Value >=1 && Value <= 64)
2406 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value;
2407 pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value;
2411 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64;
2412 pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64;
2417 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit));
2423 IN PRTMP_ADAPTER pAd,
2428 Value = simple_strtol(arg, 0, 10);
2431 pAd->CommonCfg.bRdg = FALSE;
2432 else if ( Value ==1 )
2434 pAd->HTCEnable = TRUE;
2435 pAd->CommonCfg.bRdg = TRUE;
2438 return FALSE; //Invalid argument
2442 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg));
2447 INT Set_HtLinkAdapt_Proc(
2448 IN PRTMP_ADAPTER pAd,
2453 Value = simple_strtol(arg, 0, 10);
2455 pAd->bLinkAdapt = FALSE;
2456 else if ( Value ==1 )
2458 pAd->HTCEnable = TRUE;
2459 pAd->bLinkAdapt = TRUE;
2462 return FALSE; //Invalid argument
2464 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt));
2469 INT Set_HtAmsdu_Proc(
2470 IN PRTMP_ADAPTER pAd,
2475 Value = simple_strtol(arg, 0, 10);
2477 pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE;
2478 else if ( Value == 1 )
2479 pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE;
2481 return FALSE; //Invalid argument
2485 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable));
2490 INT Set_HtAutoBa_Proc(
2491 IN PRTMP_ADAPTER pAd,
2496 Value = simple_strtol(arg, 0, 10);
2498 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
2499 else if (Value == 1)
2500 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
2502 return FALSE; //Invalid argument
2504 pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
2507 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA));
2513 INT Set_HtProtect_Proc(
2514 IN PRTMP_ADAPTER pAd,
2519 Value = simple_strtol(arg, 0, 10);
2521 pAd->CommonCfg.bHTProtect = FALSE;
2522 else if (Value == 1)
2523 pAd->CommonCfg.bHTProtect = TRUE;
2525 return FALSE; //Invalid argument
2527 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect));
2532 INT Set_SendPSMPAction_Proc(
2533 IN PRTMP_ADAPTER pAd,
2537 char *token, sepValue[] = ":", DASH = '-';
2539 MAC_TABLE_ENTRY *pEntry;
2541 //printk("\n%s\n", arg);
2543 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2544 =>The six 2 digit hex-decimal number previous are the Mac address,
2545 =>The seventh decimal number is the mode value.
2547 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2550 token = strchr(arg, DASH);
2551 if ((token != NULL) && (strlen(token)>1))
2553 mode = simple_strtol((token+1), 0, 10);
2554 if (mode > MMPS_ENABLE)
2558 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2560 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2562 AtoH(token, (PUCHAR)(&mac[i]), 1);
2567 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2568 mac[2], mac[3], mac[4], mac[5], mode);
2570 pEntry = MacTableLookup(pAd, mac);
2573 printk("\nSendPSMPAction MIPS mode = %d\n", mode);
2574 SendPSMPAction(pAd, pEntry->Aid, mode);
2585 INT Set_HtMIMOPSmode_Proc(
2586 IN PRTMP_ADAPTER pAd,
2591 Value = simple_strtol(arg, 0, 10);
2593 if (Value <=3 && Value >= 0)
2594 pAd->CommonCfg.BACapability.field.MMPSmode = Value;
2596 pAd->CommonCfg.BACapability.field.MMPSmode = 3;
2600 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode));
2606 INT Set_ForceShortGI_Proc(
2607 IN PRTMP_ADAPTER pAd,
2612 Value = simple_strtol(arg, 0, 10);
2614 pAd->WIFItestbed.bShortGI = FALSE;
2615 else if (Value == 1)
2616 pAd->WIFItestbed.bShortGI = TRUE;
2618 return FALSE; //Invalid argument
2622 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI));
2629 INT Set_ForceGF_Proc(
2630 IN PRTMP_ADAPTER pAd,
2635 Value = simple_strtol(arg, 0, 10);
2637 pAd->WIFItestbed.bGreenField = FALSE;
2638 else if (Value == 1)
2639 pAd->WIFItestbed.bGreenField = TRUE;
2641 return FALSE; //Invalid argument
2645 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField));
2650 INT Set_HtMimoPs_Proc(
2651 IN PRTMP_ADAPTER pAd,
2656 Value = simple_strtol(arg, 0, 10);
2658 pAd->CommonCfg.bMIMOPSEnable = FALSE;
2659 else if (Value == 1)
2660 pAd->CommonCfg.bMIMOPSEnable = TRUE;
2662 return FALSE; //Invalid argument
2664 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable));
2670 IN PRTMP_ADAPTER pAd)
2672 OID_SET_HT_PHYMODE SetHT;
2674 if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED)
2677 SetHT.PhyMode = pAd->CommonCfg.PhyMode;
2678 SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath);
2679 SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
2680 SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
2681 SetHT.MCS = MCS_AUTO;
2682 SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
2683 SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
2684 SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
2686 RTMPSetHT(pAd, &SetHT);
2691 INT Set_FixedTxMode_Proc(
2692 IN PRTMP_ADAPTER pAd,
2695 UCHAR fix_tx_mode = FIXED_TXMODE_HT;
2697 if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0)
2699 fix_tx_mode = FIXED_TXMODE_OFDM;
2701 else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0)
2703 fix_tx_mode = FIXED_TXMODE_CCK;
2706 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2707 pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode;
2709 DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode));
2714 /////////////////////////////////////////////////////////////////////////
2715 PCHAR RTMPGetRalinkAuthModeStr(
2716 IN NDIS_802_11_AUTHENTICATION_MODE authMode)
2720 case Ndis802_11AuthModeOpen:
2723 case Ndis802_11AuthModeWPAPSK:
2725 case Ndis802_11AuthModeShared:
2727 case Ndis802_11AuthModeWPA:
2729 case Ndis802_11AuthModeWPA2:
2731 case Ndis802_11AuthModeWPA2PSK:
2733 case Ndis802_11AuthModeWPA1PSKWPA2PSK:
2734 return "WPAPSKWPA2PSK";
2735 case Ndis802_11AuthModeWPA1WPA2:
2737 case Ndis802_11AuthModeWPANone:
2742 PCHAR RTMPGetRalinkEncryModeStr(
2743 IN USHORT encryMode)
2748 case Ndis802_11WEPDisabled:
2750 case Ndis802_11WEPEnabled:
2752 case Ndis802_11Encryption2Enabled:
2754 case Ndis802_11Encryption3Enabled:
2756 case Ndis802_11Encryption4Enabled:
2761 INT RTMPShowCfgValue(
2762 IN PRTMP_ADAPTER pAd,
2768 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++)
2770 if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name))
2772 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf))
2774 break; //Exit for loop.
2778 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL)
2780 sprintf(pBuf, "\n");
2781 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++)
2782 sprintf(pBuf + strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
2789 IN PRTMP_ADAPTER pAd,
2792 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2793 sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid);
2797 INT Show_WirelessMode_Proc(
2798 IN PRTMP_ADAPTER pAd,
2801 switch(pAd->CommonCfg.PhyMode)
2803 case PHY_11BG_MIXED:
2804 sprintf(pBuf, "\t11B/G");
2807 sprintf(pBuf, "\t11B");
2810 sprintf(pBuf, "\t11A");
2812 case PHY_11ABG_MIXED:
2813 sprintf(pBuf, "\t11A/B/G");
2816 sprintf(pBuf, "\t11G");
2818 case PHY_11ABGN_MIXED:
2819 sprintf(pBuf, "\t11A/B/G/N");
2822 sprintf(pBuf, "\t11N only with 2.4G");
2824 case PHY_11GN_MIXED:
2825 sprintf(pBuf, "\t11G/N");
2827 case PHY_11AN_MIXED:
2828 sprintf(pBuf, "\t11A/N");
2830 case PHY_11BGN_MIXED:
2831 sprintf(pBuf, "\t11B/G/N");
2833 case PHY_11AGN_MIXED:
2834 sprintf(pBuf, "\t11A/G/N");
2837 sprintf(pBuf, "\t11N only with 5G");
2840 sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode);
2847 INT Show_TxBurst_Proc(
2848 IN PRTMP_ADAPTER pAd,
2851 sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE");
2855 INT Show_TxPreamble_Proc(
2856 IN PRTMP_ADAPTER pAd,
2859 switch(pAd->CommonCfg.TxPreamble)
2861 case Rt802_11PreambleShort:
2862 sprintf(pBuf, "\tShort");
2864 case Rt802_11PreambleLong:
2865 sprintf(pBuf, "\tLong");
2867 case Rt802_11PreambleAuto:
2868 sprintf(pBuf, "\tAuto");
2871 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble);
2878 INT Show_TxPower_Proc(
2879 IN PRTMP_ADAPTER pAd,
2882 sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage);
2886 INT Show_Channel_Proc(
2887 IN PRTMP_ADAPTER pAd,
2890 sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel);
2894 INT Show_BGProtection_Proc(
2895 IN PRTMP_ADAPTER pAd,
2898 switch(pAd->CommonCfg.UseBGProtection)
2901 sprintf(pBuf, "\tON");
2903 case 2: //Always OFF
2904 sprintf(pBuf, "\tOFF");
2907 sprintf(pBuf, "\tAuto");
2910 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection);
2916 INT Show_RTSThreshold_Proc(
2917 IN PRTMP_ADAPTER pAd,
2920 sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold);
2924 INT Show_FragThreshold_Proc(
2925 IN PRTMP_ADAPTER pAd,
2928 sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold);
2933 IN PRTMP_ADAPTER pAd,
2936 if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
2938 sprintf(pBuf, "\t40 MHz");
2942 sprintf(pBuf, "\t20 MHz");
2947 INT Show_HtMcs_Proc(
2948 IN PRTMP_ADAPTER pAd,
2951 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2952 sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS);
2957 IN PRTMP_ADAPTER pAd,
2960 switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI)
2963 sprintf(pBuf, "\tGI_400");
2966 sprintf(pBuf, "\tGI_800");
2969 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI);
2975 INT Show_HtOpMode_Proc(
2976 IN PRTMP_ADAPTER pAd,
2979 switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE)
2982 sprintf(pBuf, "\tGF");
2985 sprintf(pBuf, "\tMM");
2988 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE);
2994 INT Show_HtExtcha_Proc(
2995 IN PRTMP_ADAPTER pAd,
2998 switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)
3001 sprintf(pBuf, "\tBelow");
3004 sprintf(pBuf, "\tAbove");
3007 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA);
3014 INT Show_HtMpduDensity_Proc(
3015 IN PRTMP_ADAPTER pAd,
3018 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity);
3022 INT Show_HtBaWinSize_Proc(
3023 IN PRTMP_ADAPTER pAd,
3026 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit);
3030 INT Show_HtRdg_Proc(
3031 IN PRTMP_ADAPTER pAd,
3034 sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE");
3038 INT Show_HtAmsdu_Proc(
3039 IN PRTMP_ADAPTER pAd,
3042 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE");
3046 INT Show_HtAutoBa_Proc(
3047 IN PRTMP_ADAPTER pAd,
3050 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE");
3054 INT Show_CountryRegion_Proc(
3055 IN PRTMP_ADAPTER pAd,
3058 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion);
3062 INT Show_CountryRegionABand_Proc(
3063 IN PRTMP_ADAPTER pAd,
3066 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand);
3070 INT Show_CountryCode_Proc(
3071 IN PRTMP_ADAPTER pAd,
3074 sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode);
3078 #ifdef AGGREGATION_SUPPORT
3079 INT Show_PktAggregate_Proc(
3080 IN PRTMP_ADAPTER pAd,
3083 sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE");
3086 #endif // AGGREGATION_SUPPORT //
3089 INT Show_WmmCapable_Proc(
3090 IN PRTMP_ADAPTER pAd,
3093 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3094 sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE");
3098 #endif // WMM_SUPPORT //
3100 INT Show_IEEE80211H_Proc(
3101 IN PRTMP_ADAPTER pAd,
3104 sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE");
3108 INT Show_NetworkType_Proc(
3109 IN PRTMP_ADAPTER pAd,
3112 switch(pAd->StaCfg.BssType)
3115 sprintf(pBuf, "\tAdhoc");
3118 sprintf(pBuf, "\tInfra");
3121 sprintf(pBuf, "\tAny");
3124 sprintf(pBuf, "\tMonitor");
3127 sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType);
3133 INT Show_AuthMode_Proc(
3134 IN PRTMP_ADAPTER pAd,
3137 NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen;
3139 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3140 AuthMode = pAd->StaCfg.AuthMode;
3142 if ((AuthMode >= Ndis802_11AuthModeOpen) &&
3143 (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK))
3144 sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode));
3146 sprintf(pBuf, "\tUnknow Value(%d)", AuthMode);
3151 INT Show_EncrypType_Proc(
3152 IN PRTMP_ADAPTER pAd,
3155 NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled;
3157 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3158 WepStatus = pAd->StaCfg.WepStatus;
3160 if ((WepStatus >= Ndis802_11WEPEnabled) &&
3161 (WepStatus <= Ndis802_11Encryption4KeyAbsent))
3162 sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus));
3164 sprintf(pBuf, "\tUnknow Value(%d)", WepStatus);
3169 INT Show_DefaultKeyID_Proc(
3170 IN PRTMP_ADAPTER pAd,
3173 UCHAR DefaultKeyId = 0;
3175 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3176 DefaultKeyId = pAd->StaCfg.DefaultKeyId;
3178 sprintf(pBuf, "\t%d", DefaultKeyId);
3183 INT Show_WepKey_Proc(
3184 IN PRTMP_ADAPTER pAd,
3188 UCHAR Key[16] = {0}, KeyLength = 0;
3191 KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen;
3192 NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength);
3194 //check key string is ASCII or not
3195 if (RTMPCheckStrPrintAble(Key, KeyLength))
3196 sprintf(pBuf, "\t%s", Key);
3200 sprintf(pBuf, "\t");
3201 for (idx = 0; idx < KeyLength; idx++)
3202 sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]);
3208 IN PRTMP_ADAPTER pAd,
3211 Show_WepKey_Proc(pAd, 0, pBuf);
3216 IN PRTMP_ADAPTER pAd,
3219 Show_WepKey_Proc(pAd, 1, pBuf);
3224 IN PRTMP_ADAPTER pAd,
3227 Show_WepKey_Proc(pAd, 2, pBuf);
3232 IN PRTMP_ADAPTER pAd,
3235 Show_WepKey_Proc(pAd, 3, pBuf);
3239 INT Show_WPAPSK_Proc(
3240 IN PRTMP_ADAPTER pAd,
3244 UCHAR PMK[32] = {0};
3246 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3247 NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32);
3249 sprintf(pBuf, "\tPMK = ");
3250 for (idx = 0; idx < 32; idx++)
3251 sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]);