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 <linux/sched.h>
29 #include "../rt_config.h"
35 INT Show_WirelessMode_Proc(
39 INT Show_TxBurst_Proc(
43 INT Show_TxPreamble_Proc(
47 INT Show_TxPower_Proc(
51 INT Show_Channel_Proc(
55 INT Show_BGProtection_Proc(
59 INT Show_RTSThreshold_Proc(
63 INT Show_FragThreshold_Proc(
79 INT Show_HtOpMode_Proc(
83 INT Show_HtExtcha_Proc(
87 INT Show_HtMpduDensity_Proc(
91 INT Show_HtBaWinSize_Proc(
99 INT Show_HtAmsdu_Proc(
100 IN PRTMP_ADAPTER pAd,
103 INT Show_HtAutoBa_Proc(
104 IN PRTMP_ADAPTER pAd,
107 INT Show_CountryRegion_Proc(
108 IN PRTMP_ADAPTER pAd,
111 INT Show_CountryRegionABand_Proc(
112 IN PRTMP_ADAPTER pAd,
115 INT Show_CountryCode_Proc(
116 IN PRTMP_ADAPTER pAd,
119 #ifdef AGGREGATION_SUPPORT
120 INT Show_PktAggregate_Proc(
121 IN PRTMP_ADAPTER pAd,
123 #endif // AGGREGATION_SUPPORT //
126 INT Show_WmmCapable_Proc(
127 IN PRTMP_ADAPTER pAd,
129 #endif // WMM_SUPPORT //
131 INT Show_IEEE80211H_Proc(
132 IN PRTMP_ADAPTER pAd,
135 INT Show_NetworkType_Proc(
136 IN PRTMP_ADAPTER pAd,
139 INT Show_AuthMode_Proc(
140 IN PRTMP_ADAPTER pAd,
143 INT Show_EncrypType_Proc(
144 IN PRTMP_ADAPTER pAd,
147 INT Show_DefaultKeyID_Proc(
148 IN PRTMP_ADAPTER pAd,
152 IN PRTMP_ADAPTER pAd,
156 IN PRTMP_ADAPTER pAd,
160 IN PRTMP_ADAPTER pAd,
164 IN PRTMP_ADAPTER pAd,
167 INT Show_WPAPSK_Proc(
168 IN PRTMP_ADAPTER pAd,
173 INT (*show_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg);
174 } *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = {
175 {"SSID", Show_SSID_Proc},
176 {"WirelessMode", Show_WirelessMode_Proc},
177 {"TxBurst", Show_TxBurst_Proc},
178 {"TxPreamble", Show_TxPreamble_Proc},
179 {"TxPower", Show_TxPower_Proc},
180 {"Channel", Show_Channel_Proc},
181 {"BGProtection", Show_BGProtection_Proc},
182 {"RTSThreshold", Show_RTSThreshold_Proc},
183 {"FragThreshold", Show_FragThreshold_Proc},
184 {"HtBw", Show_HtBw_Proc},
185 {"HtMcs", Show_HtMcs_Proc},
186 {"HtGi", Show_HtGi_Proc},
187 {"HtOpMode", Show_HtOpMode_Proc},
188 {"HtExtcha", Show_HtExtcha_Proc},
189 {"HtMpduDensity", Show_HtMpduDensity_Proc},
190 {"HtBaWinSize", Show_HtBaWinSize_Proc},
191 {"HtRdg", Show_HtRdg_Proc},
192 {"HtAmsdu", Show_HtAmsdu_Proc},
193 {"HtAutoBa", Show_HtAutoBa_Proc},
194 {"CountryRegion", Show_CountryRegion_Proc},
195 {"CountryRegionABand", Show_CountryRegionABand_Proc},
196 {"CountryCode", Show_CountryCode_Proc},
197 #ifdef AGGREGATION_SUPPORT
198 {"PktAggregate", Show_PktAggregate_Proc},
202 {"WmmCapable", Show_WmmCapable_Proc},
204 {"IEEE80211H", Show_IEEE80211H_Proc},
205 {"NetworkType", Show_NetworkType_Proc},
206 {"AuthMode", Show_AuthMode_Proc},
207 {"EncrypType", Show_EncrypType_Proc},
208 {"DefaultKeyID", Show_DefaultKeyID_Proc},
209 {"Key1", Show_Key1_Proc},
210 {"Key2", Show_Key2_Proc},
211 {"Key3", Show_Key3_Proc},
212 {"Key4", Show_Key4_Proc},
213 {"WPAPSK", Show_WPAPSK_Proc},
218 ==========================================================================
223 ==========================================================================
225 INT Set_DriverVersion_Proc(
226 IN PRTMP_ADAPTER 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);
340 INT MaxPhyMode = PHY_11G;
342 MaxPhyMode = PHY_11N_5G;
344 if (WirelessMode <= MaxPhyMode)
346 RTMPSetPhyMode(pAd, WirelessMode);
348 if (WirelessMode >= PHY_11ABGN_MIXED)
350 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
351 pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE;
355 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
356 pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE;
359 // Set AdhocMode rates
360 if (pAd->StaCfg.BssType == BSS_ADHOC)
362 MlmeUpdateTxRates(pAd, FALSE, 0);
363 MakeIbssBeacon(pAd); // re-build BEACON frame
364 AsicEnableIbssSync(pAd); // copy to on-chip memory
373 // it is needed to set SSID to take effect
377 DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%ld)\n", WirelessMode));
381 DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n"));
388 ==========================================================================
392 TRUE if all parameters are OK, FALSE otherwise
393 ==========================================================================
395 INT Set_Channel_Proc(
396 IN PRTMP_ADAPTER pAd,
402 Channel = (UCHAR) simple_strtol(arg, 0, 10);
404 // check if this channel is valid
405 if (ChannelSanity(pAd, Channel) == TRUE)
408 pAd->CommonCfg.Channel = Channel;
413 if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED &&
414 pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
417 AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
418 AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
419 DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n",
420 pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel));
424 AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
425 AsicLockChannel(pAd, pAd->CommonCfg.Channel);
426 DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel));
439 DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel));
445 ==========================================================================
447 Set Short Slot Time Enable or Disable
449 TRUE if all parameters are OK, FALSE otherwise
450 ==========================================================================
452 INT Set_ShortSlot_Proc(
453 IN PRTMP_ADAPTER pAd,
458 ShortSlot = simple_strtol(arg, 0, 10);
461 pAd->CommonCfg.bUseShortSlotTime = TRUE;
462 else if (ShortSlot == 0)
463 pAd->CommonCfg.bUseShortSlotTime = FALSE;
465 return FALSE; //Invalid argument
467 DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime));
473 ==========================================================================
477 TRUE if all parameters are OK, FALSE otherwise
478 ==========================================================================
480 INT Set_TxPower_Proc(
481 IN PRTMP_ADAPTER pAd,
487 TxPower = (ULONG) simple_strtol(arg, 0, 10);
491 pAd->CommonCfg.TxPowerDefault = TxPower;
492 pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
499 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
505 ==========================================================================
507 Set 11B/11G Protection
509 TRUE if all parameters are OK, FALSE otherwise
510 ==========================================================================
512 INT Set_BGProtection_Proc(
513 IN PRTMP_ADAPTER pAd,
516 switch (simple_strtol(arg, 0, 10))
519 pAd->CommonCfg.UseBGProtection = 0;
522 pAd->CommonCfg.UseBGProtection = 1;
525 pAd->CommonCfg.UseBGProtection = 2;
527 default: //Invalid argument
532 DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection));
538 ==========================================================================
542 TRUE if all parameters are OK, FALSE otherwise
543 ==========================================================================
545 INT Set_TxPreamble_Proc(
546 IN PRTMP_ADAPTER pAd,
549 RT_802_11_PREAMBLE Preamble;
551 Preamble = simple_strtol(arg, 0, 10);
556 case Rt802_11PreambleShort:
557 pAd->CommonCfg.TxPreamble = Preamble;
559 MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);
561 case Rt802_11PreambleLong:
562 case Rt802_11PreambleAuto:
563 // if user wants AUTO, initialize to LONG here, then change according to AP's
564 // capability upon association.
565 pAd->CommonCfg.TxPreamble = Preamble;
567 MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);
569 default: //Invalid argument
573 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble));
579 ==========================================================================
583 TRUE if all parameters are OK, FALSE otherwise
584 ==========================================================================
586 INT Set_RTSThreshold_Proc(
587 IN PRTMP_ADAPTER pAd,
590 NDIS_802_11_RTS_THRESHOLD RtsThresh;
592 RtsThresh = simple_strtol(arg, 0, 10);
594 if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD))
595 pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
596 else if (RtsThresh == 0)
597 pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;
599 return FALSE; //Invalid argument
601 DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold));
607 ==========================================================================
609 Set Fragment Threshold
611 TRUE if all parameters are OK, FALSE otherwise
612 ==========================================================================
614 INT Set_FragThreshold_Proc(
615 IN PRTMP_ADAPTER pAd,
618 NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
620 FragThresh = simple_strtol(arg, 0, 10);
622 if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)
624 //Illegal FragThresh so we set it to default
625 pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
627 else if (FragThresh % 2 == 1)
629 // The length of each fragment shall always be an even number of octets, except for the last fragment
630 // of an MSDU or MMPDU, which may be either an even or an odd number of octets.
631 pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1);
635 pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
639 if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)
640 pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;
642 pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;
645 DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold));
651 ==========================================================================
655 TRUE if all parameters are OK, FALSE otherwise
656 ==========================================================================
658 INT Set_TxBurst_Proc(
659 IN PRTMP_ADAPTER pAd,
664 TxBurst = simple_strtol(arg, 0, 10);
666 pAd->CommonCfg.bEnableTxBurst = TRUE;
667 else if (TxBurst == 0)
668 pAd->CommonCfg.bEnableTxBurst = FALSE;
670 return FALSE; //Invalid argument
672 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst));
677 #ifdef AGGREGATION_SUPPORT
679 ==========================================================================
683 TRUE if all parameters are OK, FALSE otherwise
684 ==========================================================================
686 INT Set_PktAggregate_Proc(
687 IN PRTMP_ADAPTER pAd,
692 aggre = simple_strtol(arg, 0, 10);
695 pAd->CommonCfg.bAggregationCapable = TRUE;
697 pAd->CommonCfg.bAggregationCapable = FALSE;
699 return FALSE; //Invalid argument
702 DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable));
709 ==========================================================================
712 This parameter is 1 when needs radar detection, otherwise 0
714 TRUE if all parameters are OK, FALSE otherwise
715 ==========================================================================
717 INT Set_IEEE80211H_Proc(
718 IN PRTMP_ADAPTER pAd,
723 ieee80211h = simple_strtol(arg, 0, 10);
726 pAd->CommonCfg.bIEEE80211H = TRUE;
727 else if (ieee80211h == 0)
728 pAd->CommonCfg.bIEEE80211H = FALSE;
730 return FALSE; //Invalid argument
732 DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H));
740 ==========================================================================
742 For Debug information
744 TRUE if all parameters are OK, FALSE otherwise
745 ==========================================================================
748 IN PRTMP_ADAPTER pAd,
751 DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n"));
753 if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD)
754 RTDebugLevel = simple_strtol(arg, 0, 10);
756 DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel));
762 INT Show_DescInfo_Proc(
763 IN PRTMP_ADAPTER pAd,
768 PRT28XX_RXD_STRUC pRxD;
770 PRTMP_TX_RING pTxRing = &pAd->TxRing[QueIdx];
771 PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing;
772 PRTMP_RX_RING pRxRing = &pAd->RxRing;
774 for(i=0;i<TX_RING_SIZE;i++)
776 pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa;
777 printk("Desc #%d\n",i);
778 hex_dump("Tx Descriptor", (char *)pTxD, 16);
779 printk("pTxD->DMADONE = %x\n", pTxD->DMADONE);
781 printk("---------------------------------------------------\n");
782 for(i=0;i<MGMT_RING_SIZE;i++)
784 pTxD = (PTXD_STRUC) pMgmtRing->Cell[i].AllocVa;
785 printk("Desc #%d\n",i);
786 hex_dump("Mgmt Descriptor", (char *)pTxD, 16);
787 printk("pMgmt->DMADONE = %x\n", pTxD->DMADONE);
789 printk("---------------------------------------------------\n");
790 for(i=0;i<RX_RING_SIZE;i++)
792 pRxD = (PRT28XX_RXD_STRUC) pRxRing->Cell[i].AllocVa;
793 printk("Desc #%d\n",i);
794 hex_dump("Rx Descriptor", (char *)pRxD, 16);
795 printk("pRxD->DDONE = %x\n", pRxD->DDONE);
802 ==========================================================================
804 Reset statistics counter
807 pAdapter Pointer to our adapter
811 TRUE if all parameters are OK, FALSE otherwise
812 ==========================================================================
814 INT Set_ResetStatCounter_Proc(
815 IN PRTMP_ADAPTER pAd,
818 DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n"));
820 // add the most up-to-date h/w raw counters into software counters
821 NICUpdateRawCounters(pAd);
823 NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));
824 NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));
825 NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));
830 BOOLEAN RTMPCheckStrPrintAble(
836 for (i=0; i<strLen; i++)
838 if ((pInPutStr[i] < 0x21) ||
839 (pInPutStr[i] > 0x7E))
847 ========================================================================
850 Remove WPA Key process
853 pAd Pointer to our adapter
854 pBuf Pointer to the where the key stored
857 NDIS_SUCCESS Add key successfully
859 IRQL = DISPATCH_LEVEL
863 ========================================================================
865 VOID RTMPSetDesiredRates(
866 IN PRTMP_ADAPTER pAdapter,
869 NDIS_802_11_RATES aryRates;
871 memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
872 switch (pAdapter->CommonCfg.PhyMode)
874 case PHY_11A: // A only
878 aryRates[0] = 0x0c; // 6M
879 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
882 aryRates[0] = 0x12; // 9M
883 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
886 aryRates[0] = 0x18; // 12M
887 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
890 aryRates[0] = 0x24; // 18M
891 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
894 aryRates[0] = 0x30; // 24M
895 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
898 aryRates[0] = 0x48; // 36M
899 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
902 aryRates[0] = 0x60; // 48M
903 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
906 aryRates[0] = 0x6c; // 54M
907 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
911 aryRates[0] = 0x6c; // 54Mbps
912 aryRates[1] = 0x60; // 48Mbps
913 aryRates[2] = 0x48; // 36Mbps
914 aryRates[3] = 0x30; // 24Mbps
915 aryRates[4] = 0x24; // 18M
916 aryRates[5] = 0x18; // 12M
917 aryRates[6] = 0x12; // 9M
918 aryRates[7] = 0x0c; // 6M
919 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
923 case PHY_11BG_MIXED: // B/G Mixed
924 case PHY_11B: // B only
925 case PHY_11ABG_MIXED: // A/B/G Mixed
931 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
935 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
938 aryRates[0] = 0x0b; // 5.5M
939 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
942 aryRates[0] = 0x16; // 11M
943 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
946 aryRates[0] = 0x0c; // 6M
947 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
950 aryRates[0] = 0x12; // 9M
951 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
954 aryRates[0] = 0x18; // 12M
955 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
958 aryRates[0] = 0x24; // 18M
959 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
962 aryRates[0] = 0x30; // 24M
963 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
966 aryRates[0] = 0x48; // 36M
967 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
970 aryRates[0] = 0x60; // 48M
971 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
974 aryRates[0] = 0x6c; // 54M
975 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
979 if (pAdapter->CommonCfg.PhyMode == PHY_11B)
981 aryRates[0] = 0x16; // 11Mbps
982 aryRates[1] = 0x0b; // 5.5Mbps
983 aryRates[2] = 0x04; // 2Mbps
984 aryRates[3] = 0x02; // 1Mbps
987 { //(B/G) Mixed or (A/B/G) Mixed
988 aryRates[0] = 0x6c; // 54Mbps
989 aryRates[1] = 0x60; // 48Mbps
990 aryRates[2] = 0x48; // 36Mbps
991 aryRates[3] = 0x30; // 24Mbps
992 aryRates[4] = 0x16; // 11Mbps
993 aryRates[5] = 0x0b; // 5.5Mbps
994 aryRates[6] = 0x04; // 2Mbps
995 aryRates[7] = 0x02; // 1Mbps
997 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
1003 NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1004 NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
1005 DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
1006 pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1],
1007 pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3],
1008 pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5],
1009 pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] ));
1010 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
1011 MlmeUpdateTxRates(pAdapter, FALSE, 0);
1014 NDIS_STATUS RTMPWPARemoveKeyProc(
1015 IN PRTMP_ADAPTER pAd,
1018 PNDIS_802_11_REMOVE_KEY pKey;
1020 NDIS_STATUS Status = NDIS_STATUS_FAILURE;
1021 BOOLEAN bTxKey; // Set the key as transmit key
1022 BOOLEAN bPairwise; // Indicate the key is pairwise key
1023 BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value.
1024 // Otherwise, it will set by the NIC.
1025 BOOLEAN bAuthenticator; // indicate key is set by authenticator.
1028 DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n"));
1030 pKey = (PNDIS_802_11_REMOVE_KEY) pBuf;
1031 KeyIdx = pKey->KeyIndex & 0xff;
1032 // Bit 31 of Add-key, Tx Key
1033 bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE;
1034 // Bit 30 of Add-key PairwiseKey
1035 bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE;
1036 // Bit 29 of Add-key KeyRSC
1037 bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE;
1038 // Bit 28 of Add-key Authenticator
1039 bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE;
1041 // 1. If bTx is TRUE, return failure information
1043 return(NDIS_STATUS_INVALID_DATA);
1045 // 2. Check Pairwise Key
1048 // a. If BSSID is broadcast, remove all pairwise keys.
1049 // b. If not broadcast, remove the pairwise specified by BSSID
1050 for (i = 0; i < SHARE_KEY_NUM; i++)
1052 if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID))
1054 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i));
1055 pAd->SharedKey[BSS0][i].KeyLen = 0;
1056 pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE;
1057 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i);
1058 Status = NDIS_STATUS_SUCCESS;
1066 // a. If BSSID is broadcast, remove all group keys indexed
1067 // b. If BSSID matched, delete the group key indexed.
1068 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx));
1069 pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
1070 pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
1071 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx);
1072 Status = NDIS_STATUS_SUCCESS;
1079 ========================================================================
1081 Routine Description:
1085 pAd Pointer to our adapter
1090 IRQL = DISPATCH_LEVEL
1094 ========================================================================
1096 VOID RTMPWPARemoveAllKeys(
1097 IN PRTMP_ADAPTER pAd)
1102 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
1104 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1105 // Link up. And it will be replaced if user changed it.
1106 if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)
1109 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1110 // Link up. And it will be replaced if user changed it.
1111 if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone)
1114 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1115 AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
1117 // set all shared key mode as no-security.
1118 for (i = 0; i < SHARE_KEY_NUM; i++)
1120 DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
1121 NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY));
1123 AsicRemoveSharedKeyEntry(pAd, BSS0, i);
1129 ========================================================================
1130 Routine Description:
1131 Change NIC PHY mode. Re-association may be necessary. possible settings
1132 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1135 pAd - Pointer to our adapter
1138 IRQL = PASSIVE_LEVEL
1139 IRQL = DISPATCH_LEVEL
1141 ========================================================================
1143 VOID RTMPSetPhyMode(
1144 IN PRTMP_ADAPTER pAd,
1148 // the selected phymode must be supported by the RF IC encoded in E2PROM
1150 pAd->CommonCfg.PhyMode = (UCHAR)phymode;
1152 DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
1154 BuildChannelList(pAd);
1156 // sanity check user setting
1157 for (i = 0; i < pAd->ChannelListNum; i++)
1159 if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
1163 if (i == pAd->ChannelListNum)
1165 pAd->CommonCfg.Channel = FirstChannel(pAd);
1166 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel));
1169 NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES);
1170 NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES);
1171 NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1174 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1175 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1176 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1177 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1178 pAd->CommonCfg.SupRateLen = 4;
1179 pAd->CommonCfg.ExtRateLen = 0;
1180 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1181 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1182 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1183 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1184 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1188 case PHY_11BG_MIXED:
1189 case PHY_11ABG_MIXED:
1191 case PHY_11ABGN_MIXED:
1192 case PHY_11BGN_MIXED:
1193 case PHY_11GN_MIXED:
1194 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1195 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1196 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1197 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1198 pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1199 pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1200 pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1201 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1202 pAd->CommonCfg.SupRateLen = 8;
1203 pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1204 pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1205 pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1206 pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1207 pAd->CommonCfg.ExtRateLen = 4;
1208 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1209 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1210 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1211 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1212 pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
1213 pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
1214 pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
1215 pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
1216 pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
1217 pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
1218 pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
1219 pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
1223 case PHY_11AN_MIXED:
1224 case PHY_11AGN_MIXED:
1226 pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1227 pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1228 pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1229 pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1230 pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1231 pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1232 pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1233 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1234 pAd->CommonCfg.SupRateLen = 8;
1235 pAd->CommonCfg.ExtRateLen = 0;
1236 pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
1237 pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
1238 pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
1239 pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
1240 pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
1241 pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
1242 pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
1243 pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
1244 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1252 pAd->CommonCfg.BandState = UNKNOWN_BAND;
1256 ========================================================================
1257 Routine Description:
1258 Caller ensures we has 802.11n support.
1259 Calls at setting HT from AP/STASetinformation
1262 pAd - Pointer to our adapter
1265 ========================================================================
1268 IN PRTMP_ADAPTER pAd,
1269 IN OID_SET_HT_PHYMODE *pHTPhyMode)
1274 UCHAR BBP3Value = 0;
1275 UCHAR RxStream = pAd->CommonCfg.RxStream;
1277 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1278 pHTPhyMode->HtMode, pHTPhyMode->ExtOffset,
1279 pHTPhyMode->MCS, pHTPhyMode->BW,
1280 pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
1282 // Don't zero supportedHyPhy structure.
1283 RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability));
1284 RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo));
1285 RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset));
1286 RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy));
1288 if (pAd->CommonCfg.bRdg)
1290 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1;
1291 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1;
1295 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0;
1296 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0;
1299 pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3;
1300 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3;
1302 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit));
1304 // Mimo power save, A-MSDU size,
1305 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
1306 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize;
1307 pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode;
1308 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1310 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
1311 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
1312 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1314 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1315 pAd->CommonCfg.DesiredHtPhy.AmsduSize,
1316 pAd->CommonCfg.DesiredHtPhy.MimoPs,
1317 pAd->CommonCfg.DesiredHtPhy.MpduDensity,
1318 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
1320 if(pHTPhyMode->HtMode == HTMODE_GF)
1322 pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1;
1323 pAd->CommonCfg.DesiredHtPhy.GF = 1;
1326 pAd->CommonCfg.DesiredHtPhy.GF = 0;
1332 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1333 pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
1337 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1338 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1342 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1343 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1344 pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
1348 if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) )
1350 pHTPhyMode->BW = BW_20;
1351 pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1;
1354 if(pHTPhyMode->BW == BW_40)
1356 pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
1357 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
1358 if (pAd->CommonCfg.Channel <= 14)
1359 pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
1361 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1;
1362 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
1363 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE;
1364 // Set Regsiter for extension channel position.
1365 RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
1366 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
1367 if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW))
1370 BBP3Value |= (0x20);
1371 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1373 else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE))
1376 BBP3Value &= (~0x20);
1377 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1380 // Turn on BBP 40MHz mode now only as AP .
1381 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1382 if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
1385 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1386 BBPValue &= (~0x18);
1388 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1390 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value);
1391 pAd->CommonCfg.BBPCurrentBW = BW_40;
1396 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0;
1397 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0;
1398 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
1399 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE;
1400 pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
1401 // Turn on BBP 20MHz mode by request here.
1403 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1404 BBPValue &= (~0x18);
1405 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1406 pAd->CommonCfg.BBPCurrentBW = BW_20;
1410 if(pHTPhyMode->STBC == STBC_USE)
1412 pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1;
1413 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1;
1414 pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1;
1415 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1;
1419 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
1420 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
1423 if(pHTPhyMode->SHORTGI == GI_400)
1425 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1;
1426 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1;
1427 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1;
1428 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1;
1432 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0;
1433 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0;
1434 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0;
1435 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0;
1438 // We support link adaptation for unsolicit MCS feedback, set to 2.
1439 pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
1440 pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
1441 // 1, the extension channel above the control channel.
1443 // EDCA parameters used for AP's own transmission
1444 if (pAd->CommonCfg.APEdcaParm.bValid == FALSE)
1446 pAd->CommonCfg.APEdcaParm.bValid = TRUE;
1447 pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
1448 pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7;
1449 pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1;
1450 pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1;
1452 pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4;
1453 pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4;
1454 pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3;
1455 pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2;
1457 pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6;
1458 pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10;
1459 pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4;
1460 pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3;
1462 pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
1463 pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
1464 pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
1465 pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
1467 AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm);
1469 RTMPSetIndividualHT(pAd, 0);
1473 ========================================================================
1474 Routine Description:
1475 Caller ensures we has 802.11n support.
1476 Calls at setting HT from AP/STASetinformation
1479 pAd - Pointer to our adapter
1482 ========================================================================
1484 VOID RTMPSetIndividualHT(
1485 IN PRTMP_ADAPTER pAd,
1488 PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
1489 UCHAR TxStream = pAd->CommonCfg.TxStream;
1490 UCHAR DesiredMcs = MCS_AUTO;
1495 pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
1496 DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS;
1497 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1502 if (pDesired_ht_phy == NULL)
1504 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
1507 RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO));
1509 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
1510 // Check the validity of MCS
1511 if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15)))
1513 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs));
1517 if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32))
1519 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1523 pDesired_ht_phy->bHtEnable = TRUE;
1525 // Decide desired Tx MCS
1529 if (DesiredMcs == MCS_AUTO)
1531 pDesired_ht_phy->MCSSet[0]= 0xff;
1532 pDesired_ht_phy->MCSSet[1]= 0x00;
1534 else if (DesiredMcs <= MCS_7)
1536 pDesired_ht_phy->MCSSet[0]= 1<<DesiredMcs;
1537 pDesired_ht_phy->MCSSet[1]= 0x00;
1542 if (DesiredMcs == MCS_AUTO)
1544 pDesired_ht_phy->MCSSet[0]= 0xff;
1545 pDesired_ht_phy->MCSSet[1]= 0xff;
1547 else if (DesiredMcs <= MCS_15)
1551 mode = DesiredMcs / 8;
1553 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1558 if (DesiredMcs == MCS_AUTO)
1560 /* MCS0 ~ MCS23, 3 bytes */
1561 pDesired_ht_phy->MCSSet[0]= 0xff;
1562 pDesired_ht_phy->MCSSet[1]= 0xff;
1563 pDesired_ht_phy->MCSSet[2]= 0xff;
1565 else if (DesiredMcs <= MCS_23)
1569 mode = DesiredMcs / 8;
1571 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1576 if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40)
1578 if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
1579 pDesired_ht_phy->MCSSet[4] = 0x1;
1582 // update HT Rate setting
1583 if (pAd->OpMode == OPMODE_STA)
1584 MlmeUpdateHtTxRates(pAd, BSS0);
1586 MlmeUpdateHtTxRates(pAd, apidx);
1591 ========================================================================
1592 Routine Description:
1593 Update HT IE from our capability.
1596 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1599 ========================================================================
1601 VOID RTMPUpdateHTIE(
1602 IN RT_HT_CAPABILITY *pRtHt,
1604 OUT HT_CAPABILITY_IE *pHtCapability,
1605 OUT ADD_HT_INFO_IE *pAddHtInfo)
1607 RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE));
1608 RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE));
1610 pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
1611 pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
1612 pHtCapability->HtCapInfo.GF = pRtHt->GF;
1613 pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
1614 pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
1615 pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
1616 pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
1617 pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
1618 pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
1619 pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
1621 pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ;
1622 pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
1623 pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
1624 pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
1625 RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1627 DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n"));
1631 ========================================================================
1633 Add Client security information into ASIC WCID table and IVEIV table.
1635 ========================================================================
1637 VOID RTMPAddWcidAttributeEntry(
1638 IN PRTMP_ADAPTER pAd,
1642 IN MAC_TABLE_ENTRY *pEntry)
1644 UINT32 WCIDAttri = 0;
1653 DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx));
1657 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
1658 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
1659 // the AID:2~ assign to mesh link entry.
1660 if (pEntry && ADHOC_ON(pAd))
1662 else if (pEntry && INFRA_ON(pAd))
1671 // Update WCID attribute table
1672 offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE);
1675 if (pEntry && pEntry->ValidAsMesh)
1676 WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE;
1678 WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE;
1681 RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
1684 // Update IV/EIV table
1685 offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
1688 if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES))
1690 // Eiv bit on. keyid always is 0 for pairwise key
1691 IVEIV = (KeyIdx <<6) | 0x20;
1695 // WEP KeyIdx is default tx key.
1696 IVEIV = (KeyIdx << 6);
1699 // For key index and ext IV bit, so only need to update the position(offset+3).
1701 RTMP_IO_WRITE8(pAd, offset+3, IVEIV);
1704 RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV);
1707 DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg]));
1708 DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri));
1713 ==========================================================================
1715 Parse encryption type
1717 pAdapter Pointer to our adapter
1718 wrq Pointer to the ioctl argument
1724 ==========================================================================
1726 CHAR *GetEncryptType(CHAR enc)
1728 if(enc == Ndis802_11WEPDisabled)
1730 if(enc == Ndis802_11WEPEnabled)
1732 if(enc == Ndis802_11Encryption2Enabled)
1734 if(enc == Ndis802_11Encryption3Enabled)
1736 if(enc == Ndis802_11Encryption4Enabled)
1742 CHAR *GetAuthMode(CHAR auth)
1744 if(auth == Ndis802_11AuthModeOpen)
1746 if(auth == Ndis802_11AuthModeShared)
1748 if(auth == Ndis802_11AuthModeAutoSwitch)
1750 if(auth == Ndis802_11AuthModeWPA)
1752 if(auth == Ndis802_11AuthModeWPAPSK)
1754 if(auth == Ndis802_11AuthModeWPANone)
1756 if(auth == Ndis802_11AuthModeWPA2)
1758 if(auth == Ndis802_11AuthModeWPA2PSK)
1760 if(auth == Ndis802_11AuthModeWPA1WPA2)
1762 if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
1763 return "WPA1PSKWPA2PSK";
1769 ==========================================================================
1771 Get site survey results
1773 pAdapter Pointer to our adapter
1774 wrq Pointer to the ioctl argument
1781 1.) UI needs to wait 4 seconds after issue a site survey command
1782 2.) iwpriv ra0 get_site_survey
1783 3.) UI needs to prepare at least 4096bytes to get the results
1784 ==========================================================================
1786 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
1787 VOID RTMPIoctlGetSiteSurvey(
1788 IN PRTMP_ADAPTER pAdapter,
1789 IN struct iwreq *wrq)
1795 CHAR Ssid[MAX_LEN_OF_SSID +1];
1796 INT Rssi = 0, max_len = LINE_LEN;
1797 UINT Rssi_Quality = 0;
1798 NDIS_802_11_NETWORK_TYPE wireless_mode;
1800 os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len));
1804 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
1808 memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len );
1809 memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1));
1810 sprintf(msg,"%s","\n");
1811 sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
1812 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
1815 pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE;
1817 while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200))
1820 for(i=0; i<pAdapter->ScanTab.BssNr ;i++)
1822 if( pAdapter->ScanTab.BssEntry[i].Channel==0)
1825 if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA)
1829 sprintf(msg+strlen(msg),"%-4d", pAdapter->ScanTab.BssEntry[i].Channel);
1831 memcpy(Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen);
1832 Ssid[pAdapter->ScanTab.BssEntry[i].SsidLen] = '\0';
1833 sprintf(msg+strlen(msg),"%-33s", Ssid);
1835 sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ",
1836 pAdapter->ScanTab.BssEntry[i].Bssid[0],
1837 pAdapter->ScanTab.BssEntry[i].Bssid[1],
1838 pAdapter->ScanTab.BssEntry[i].Bssid[2],
1839 pAdapter->ScanTab.BssEntry[i].Bssid[3],
1840 pAdapter->ScanTab.BssEntry[i].Bssid[4],
1841 pAdapter->ScanTab.BssEntry[i].Bssid[5]);
1843 sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus));
1844 //Authentication Mode
1845 if (pAdapter->ScanTab.BssEntry[i].WepStatus == Ndis802_11WEPEnabled)
1846 sprintf(msg+strlen(msg),"%-10s", "UNKNOW");
1848 sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode));
1850 Rssi = (INT)pAdapter->ScanTab.BssEntry[i].Rssi;
1853 else if (Rssi >= -80) // between -50 ~ -80dbm
1854 Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10);
1855 else if (Rssi >= -90) // between -80 ~ -90dbm
1856 Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10);
1859 sprintf(msg+strlen(msg),"%-9d", Rssi_Quality);
1861 wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]);
1862 if (wireless_mode == Ndis802_11FH ||
1863 wireless_mode == Ndis802_11DS)
1864 sprintf(msg+strlen(msg),"%-7s", "11b");
1865 else if (wireless_mode == Ndis802_11OFDM5)
1866 sprintf(msg+strlen(msg),"%-7s", "11a");
1867 else if (wireless_mode == Ndis802_11OFDM5_N)
1868 sprintf(msg+strlen(msg),"%-7s", "11a/n");
1869 else if (wireless_mode == Ndis802_11OFDM24)
1870 sprintf(msg+strlen(msg),"%-7s", "11b/g");
1871 else if (wireless_mode == Ndis802_11OFDM24_N)
1872 sprintf(msg+strlen(msg),"%-7s", "11b/g/n");
1874 sprintf(msg+strlen(msg),"%-7s", "unknow");
1876 if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC)
1877 sprintf(msg+strlen(msg),"%-3s", " Ad");
1879 sprintf(msg+strlen(msg),"%-3s", " In");
1881 sprintf(msg+strlen(msg),"\n");
1884 pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE;
1885 wrq->u.data.length = strlen(msg);
1886 Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);
1888 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length));
1889 os_free_mem(NULL, (PUCHAR)msg);
1893 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
1894 VOID RTMPIoctlGetMacTable(
1895 IN PRTMP_ADAPTER pAd,
1896 IN struct iwreq *wrq)
1899 RT_802_11_MAC_TABLE MacTab;
1903 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1905 if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC))
1907 COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr);
1908 MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid;
1909 MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode;
1910 MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode;
1912 // Fill in RSSI per entry
1913 MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0;
1914 MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1;
1915 MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2;
1917 // the connected time per entry
1918 MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime;
1919 MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS;
1920 MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW;
1921 MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI;
1922 MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC;
1923 MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv;
1924 MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE;
1925 MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word;
1930 wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE);
1931 if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length))
1933 DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__));
1936 msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG);
1937 memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN );
1938 sprintf(msg,"%s","\n");
1939 sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
1940 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
1942 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1944 PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];
1945 if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC))
1947 if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) )
1949 sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ",
1950 pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],
1951 pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);
1952 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid);
1953 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode);
1954 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
1955 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
1956 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
1957 sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]);
1958 sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
1961 // for compatible with old API just do the printk to console
1962 //wrq->u.data.length = strlen(msg);
1963 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
1965 DBGPRINT(RT_DEBUG_TRACE, ("%s", msg));
1971 INT Set_BASetup_Proc(
1972 IN PRTMP_ADAPTER pAd,
1976 char *token, sepValue[] = ":", DASH = '-';
1978 MAC_TABLE_ENTRY *pEntry;
1981 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
1982 =>The six 2 digit hex-decimal number previous are the Mac address,
1983 =>The seventh decimal number is the tid value.
1986 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
1989 token = strchr(arg, DASH);
1990 if ((token != NULL) && (strlen(token)>1))
1992 tid = simple_strtol((token+1), 0, 10);
1997 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
1999 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2001 AtoH(token, (PUCHAR)(&mac[i]), 1);
2006 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1],
2007 mac[2], mac[3], mac[4], mac[5], tid);
2009 pEntry = MacTableLookup(pAd, mac);
2012 printk("\nSetup BA Session: Tid = %d\n", tid);
2013 BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE);
2023 INT Set_BADecline_Proc(
2024 IN PRTMP_ADAPTER pAd,
2029 bBADecline = simple_strtol(arg, 0, 10);
2031 if (bBADecline == 0)
2033 pAd->CommonCfg.bBADecline = FALSE;
2035 else if (bBADecline == 1)
2037 pAd->CommonCfg.bBADecline = TRUE;
2041 return FALSE; //Invalid argument
2044 DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline));
2049 INT Set_BAOriTearDown_Proc(
2050 IN PRTMP_ADAPTER pAd,
2054 char *token, sepValue[] = ":", DASH = '-';
2056 MAC_TABLE_ENTRY *pEntry;
2059 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2060 =>The six 2 digit hex-decimal number previous are the Mac address,
2061 =>The seventh decimal number is the tid value.
2063 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2066 token = strchr(arg, DASH);
2067 if ((token != NULL) && (strlen(token)>1))
2069 tid = simple_strtol((token+1), 0, 10);
2070 if (tid > NUM_OF_TID)
2074 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2076 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2078 AtoH(token, (PUCHAR)(&mac[i]), 1);
2083 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2084 mac[2], mac[3], mac[4], mac[5], tid);
2086 pEntry = MacTableLookup(pAd, mac);
2089 printk("\nTear down Ori BA Session: Tid = %d\n", tid);
2090 BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE);
2100 INT Set_BARecTearDown_Proc(
2101 IN PRTMP_ADAPTER pAd,
2105 char *token, sepValue[] = ":", DASH = '-';
2107 MAC_TABLE_ENTRY *pEntry;
2109 //printk("\n%s\n", arg);
2111 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2112 =>The six 2 digit hex-decimal number previous are the Mac address,
2113 =>The seventh decimal number is the tid value.
2115 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2118 token = strchr(arg, DASH);
2119 if ((token != NULL) && (strlen(token)>1))
2121 tid = simple_strtol((token+1), 0, 10);
2122 if (tid > NUM_OF_TID)
2126 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2128 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2130 AtoH(token, (PUCHAR)(&mac[i]), 1);
2135 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2136 mac[2], mac[3], mac[4], mac[5], tid);
2138 pEntry = MacTableLookup(pAd, mac);
2141 printk("\nTear down Rec BA Session: Tid = %d\n", tid);
2142 BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE);
2153 IN PRTMP_ADAPTER pAd,
2158 HtBw = simple_strtol(arg, 0, 10);
2160 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
2161 else if (HtBw == BW_20)
2162 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
2164 return FALSE; //Invalid argument
2168 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW));
2174 IN PRTMP_ADAPTER pAd,
2177 ULONG HtMcs, Mcs_tmp;
2178 BOOLEAN bAutoRate = FALSE;
2180 Mcs_tmp = simple_strtol(arg, 0, 10);
2182 if (Mcs_tmp <= 15 || Mcs_tmp == 32)
2188 pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs;
2189 pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE;
2190 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2191 pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch));
2193 if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) ||
2194 (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX))
2196 if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2197 (HtMcs >= 0 && HtMcs <= 3) &&
2198 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK))
2200 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000));
2202 else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2203 (HtMcs >= 0 && HtMcs <= 7) &&
2204 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM))
2206 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000));
2213 pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
2214 RTMPSetDesiredRates(pAd, -1);
2216 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode));
2228 IN PRTMP_ADAPTER pAd,
2233 HtGi = simple_strtol(arg, 0, 10);
2235 if ( HtGi == GI_400)
2236 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400;
2237 else if ( HtGi == GI_800 )
2238 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800;
2240 return FALSE; //Invalid argument
2244 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI));
2250 INT Set_HtTxBASize_Proc(
2251 IN PRTMP_ADAPTER pAd,
2256 Size = simple_strtol(arg, 0, 10);
2258 if (Size <=0 || Size >=64)
2262 pAd->CommonCfg.TxBASize = Size-1;
2263 DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size));
2269 INT Set_HtOpMode_Proc(
2270 IN PRTMP_ADAPTER pAd,
2276 Value = simple_strtol(arg, 0, 10);
2278 if (Value == HTMODE_GF)
2279 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF;
2280 else if ( Value == HTMODE_MM )
2281 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM;
2283 return FALSE; //Invalid argument
2287 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE));
2293 INT Set_HtStbc_Proc(
2294 IN PRTMP_ADAPTER pAd,
2300 Value = simple_strtol(arg, 0, 10);
2302 if (Value == STBC_USE)
2303 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE;
2304 else if ( Value == STBC_NONE )
2305 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE;
2307 return FALSE; //Invalid argument
2311 DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC));
2317 IN PRTMP_ADAPTER pAd,
2323 Value = simple_strtol(arg, 0, 10);
2325 pAd->HTCEnable = FALSE;
2326 else if ( Value ==1 )
2327 pAd->HTCEnable = TRUE;
2329 return FALSE; //Invalid argument
2331 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable));
2336 INT Set_HtExtcha_Proc(
2337 IN PRTMP_ADAPTER pAd,
2343 Value = simple_strtol(arg, 0, 10);
2346 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW;
2347 else if ( Value ==1 )
2348 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE;
2350 return FALSE; //Invalid argument
2354 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA));
2359 INT Set_HtMpduDensity_Proc(
2360 IN PRTMP_ADAPTER pAd,
2365 Value = simple_strtol(arg, 0, 10);
2367 if (Value <=7 && Value >= 0)
2368 pAd->CommonCfg.BACapability.field.MpduDensity = Value;
2370 pAd->CommonCfg.BACapability.field.MpduDensity = 4;
2374 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity));
2379 INT Set_HtBaWinSize_Proc(
2380 IN PRTMP_ADAPTER pAd,
2385 Value = simple_strtol(arg, 0, 10);
2388 if (Value >=1 && Value <= 64)
2390 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value;
2391 pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value;
2395 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64;
2396 pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64;
2401 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit));
2407 IN PRTMP_ADAPTER pAd,
2412 Value = simple_strtol(arg, 0, 10);
2415 pAd->CommonCfg.bRdg = FALSE;
2416 else if ( Value ==1 )
2418 pAd->HTCEnable = TRUE;
2419 pAd->CommonCfg.bRdg = TRUE;
2422 return FALSE; //Invalid argument
2426 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg));
2431 INT Set_HtLinkAdapt_Proc(
2432 IN PRTMP_ADAPTER pAd,
2437 Value = simple_strtol(arg, 0, 10);
2439 pAd->bLinkAdapt = FALSE;
2440 else if ( Value ==1 )
2442 pAd->HTCEnable = TRUE;
2443 pAd->bLinkAdapt = TRUE;
2446 return FALSE; //Invalid argument
2448 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt));
2453 INT Set_HtAmsdu_Proc(
2454 IN PRTMP_ADAPTER pAd,
2459 Value = simple_strtol(arg, 0, 10);
2461 pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE;
2462 else if ( Value == 1 )
2463 pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE;
2465 return FALSE; //Invalid argument
2469 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable));
2474 INT Set_HtAutoBa_Proc(
2475 IN PRTMP_ADAPTER pAd,
2480 Value = simple_strtol(arg, 0, 10);
2483 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
2484 pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE;
2486 else if (Value == 1)
2488 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
2489 pAd->CommonCfg.BACapability.field.Policy = IMMED_BA;
2492 return FALSE; //Invalid argument
2494 pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
2495 pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy;
2499 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA));
2505 INT Set_HtProtect_Proc(
2506 IN PRTMP_ADAPTER pAd,
2511 Value = simple_strtol(arg, 0, 10);
2513 pAd->CommonCfg.bHTProtect = FALSE;
2514 else if (Value == 1)
2515 pAd->CommonCfg.bHTProtect = TRUE;
2517 return FALSE; //Invalid argument
2519 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect));
2524 INT Set_SendPSMPAction_Proc(
2525 IN PRTMP_ADAPTER pAd,
2529 char *token, sepValue[] = ":", DASH = '-';
2531 MAC_TABLE_ENTRY *pEntry;
2533 //printk("\n%s\n", arg);
2535 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2536 =>The six 2 digit hex-decimal number previous are the Mac address,
2537 =>The seventh decimal number is the mode value.
2539 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2542 token = strchr(arg, DASH);
2543 if ((token != NULL) && (strlen(token)>1))
2545 mode = simple_strtol((token+1), 0, 10);
2546 if (mode > MMPS_ENABLE)
2550 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2552 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2554 AtoH(token, (PUCHAR)(&mac[i]), 1);
2559 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2560 mac[2], mac[3], mac[4], mac[5], mode);
2562 pEntry = MacTableLookup(pAd, mac);
2565 printk("\nSendPSMPAction MIPS mode = %d\n", mode);
2566 SendPSMPAction(pAd, pEntry->Aid, mode);
2577 INT Set_HtMIMOPSmode_Proc(
2578 IN PRTMP_ADAPTER pAd,
2583 Value = simple_strtol(arg, 0, 10);
2585 if (Value <=3 && Value >= 0)
2586 pAd->CommonCfg.BACapability.field.MMPSmode = Value;
2588 pAd->CommonCfg.BACapability.field.MMPSmode = 3;
2592 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode));
2598 INT Set_ForceShortGI_Proc(
2599 IN PRTMP_ADAPTER pAd,
2604 Value = simple_strtol(arg, 0, 10);
2606 pAd->WIFItestbed.bShortGI = FALSE;
2607 else if (Value == 1)
2608 pAd->WIFItestbed.bShortGI = TRUE;
2610 return FALSE; //Invalid argument
2614 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI));
2621 INT Set_ForceGF_Proc(
2622 IN PRTMP_ADAPTER pAd,
2627 Value = simple_strtol(arg, 0, 10);
2629 pAd->WIFItestbed.bGreenField = FALSE;
2630 else if (Value == 1)
2631 pAd->WIFItestbed.bGreenField = TRUE;
2633 return FALSE; //Invalid argument
2637 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField));
2642 INT Set_HtMimoPs_Proc(
2643 IN PRTMP_ADAPTER pAd,
2648 Value = simple_strtol(arg, 0, 10);
2650 pAd->CommonCfg.bMIMOPSEnable = FALSE;
2651 else if (Value == 1)
2652 pAd->CommonCfg.bMIMOPSEnable = TRUE;
2654 return FALSE; //Invalid argument
2656 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable));
2662 IN PRTMP_ADAPTER pAd)
2664 OID_SET_HT_PHYMODE SetHT;
2666 if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED)
2669 SetHT.PhyMode = pAd->CommonCfg.PhyMode;
2670 SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath);
2671 SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
2672 SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
2673 SetHT.MCS = MCS_AUTO;
2674 SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
2675 SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
2676 SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
2678 RTMPSetHT(pAd, &SetHT);
2683 INT Set_FixedTxMode_Proc(
2684 IN PRTMP_ADAPTER pAd,
2687 UCHAR fix_tx_mode = FIXED_TXMODE_HT;
2689 if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0)
2691 fix_tx_mode = FIXED_TXMODE_OFDM;
2693 else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0)
2695 fix_tx_mode = FIXED_TXMODE_CCK;
2698 pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode;
2700 DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode));
2705 /////////////////////////////////////////////////////////////////////////
2706 PCHAR RTMPGetRalinkAuthModeStr(
2707 IN NDIS_802_11_AUTHENTICATION_MODE authMode)
2711 case Ndis802_11AuthModeOpen:
2713 case Ndis802_11AuthModeWPAPSK:
2715 case Ndis802_11AuthModeShared:
2717 case Ndis802_11AuthModeWPA:
2719 case Ndis802_11AuthModeWPA2:
2721 case Ndis802_11AuthModeWPA2PSK:
2723 case Ndis802_11AuthModeWPA1PSKWPA2PSK:
2724 return "WPAPSKWPA2PSK";
2725 case Ndis802_11AuthModeWPA1WPA2:
2727 case Ndis802_11AuthModeWPANone:
2734 PCHAR RTMPGetRalinkEncryModeStr(
2735 IN USHORT encryMode)
2739 #if defined(RT2860) || defined(RT30xx)
2742 case Ndis802_11WEPDisabled:
2744 case Ndis802_11WEPEnabled:
2746 case Ndis802_11Encryption2Enabled:
2748 case Ndis802_11Encryption3Enabled:
2750 case Ndis802_11Encryption4Enabled:
2752 #if !defined(RT2860) && !defined(RT30xx)
2759 INT RTMPShowCfgValue(
2760 IN PRTMP_ADAPTER pAd,
2766 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++)
2768 if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name))
2770 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf))
2772 break; //Exit for loop.
2776 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL)
2778 sprintf(pBuf, "\n");
2779 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++)
2780 sprintf(pBuf + strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
2787 IN PRTMP_ADAPTER pAd,
2790 sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid);
2794 INT Show_WirelessMode_Proc(
2795 IN PRTMP_ADAPTER pAd,
2798 switch(pAd->CommonCfg.PhyMode)
2800 case PHY_11BG_MIXED:
2801 sprintf(pBuf, "\t11B/G");
2804 sprintf(pBuf, "\t11B");
2807 sprintf(pBuf, "\t11A");
2809 case PHY_11ABG_MIXED:
2810 sprintf(pBuf, "\t11A/B/G");
2813 sprintf(pBuf, "\t11G");
2815 case PHY_11ABGN_MIXED:
2816 sprintf(pBuf, "\t11A/B/G/N");
2819 sprintf(pBuf, "\t11N only with 2.4G");
2821 case PHY_11GN_MIXED:
2822 sprintf(pBuf, "\t11G/N");
2824 case PHY_11AN_MIXED:
2825 sprintf(pBuf, "\t11A/N");
2827 case PHY_11BGN_MIXED:
2828 sprintf(pBuf, "\t11B/G/N");
2830 case PHY_11AGN_MIXED:
2831 sprintf(pBuf, "\t11A/G/N");
2834 sprintf(pBuf, "\t11N only with 5G");
2837 sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode);
2844 INT Show_TxBurst_Proc(
2845 IN PRTMP_ADAPTER pAd,
2848 sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE");
2852 INT Show_TxPreamble_Proc(
2853 IN PRTMP_ADAPTER pAd,
2856 switch(pAd->CommonCfg.TxPreamble)
2858 case Rt802_11PreambleShort:
2859 sprintf(pBuf, "\tShort");
2861 case Rt802_11PreambleLong:
2862 sprintf(pBuf, "\tLong");
2864 case Rt802_11PreambleAuto:
2865 sprintf(pBuf, "\tAuto");
2868 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble);
2875 INT Show_TxPower_Proc(
2876 IN PRTMP_ADAPTER pAd,
2879 sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage);
2883 INT Show_Channel_Proc(
2884 IN PRTMP_ADAPTER pAd,
2887 sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel);
2891 INT Show_BGProtection_Proc(
2892 IN PRTMP_ADAPTER pAd,
2895 switch(pAd->CommonCfg.UseBGProtection)
2898 sprintf(pBuf, "\tON");
2900 case 2: //Always OFF
2901 sprintf(pBuf, "\tOFF");
2904 sprintf(pBuf, "\tAuto");
2907 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection);
2913 INT Show_RTSThreshold_Proc(
2914 IN PRTMP_ADAPTER pAd,
2917 sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold);
2921 INT Show_FragThreshold_Proc(
2922 IN PRTMP_ADAPTER pAd,
2925 sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold);
2930 IN PRTMP_ADAPTER pAd,
2933 if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
2935 sprintf(pBuf, "\t40 MHz");
2939 sprintf(pBuf, "\t20 MHz");
2944 INT Show_HtMcs_Proc(
2945 IN PRTMP_ADAPTER pAd,
2948 sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS);
2953 IN PRTMP_ADAPTER pAd,
2956 switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI)
2959 sprintf(pBuf, "\tGI_400");
2962 sprintf(pBuf, "\tGI_800");
2965 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI);
2971 INT Show_HtOpMode_Proc(
2972 IN PRTMP_ADAPTER pAd,
2975 switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE)
2978 sprintf(pBuf, "\tGF");
2981 sprintf(pBuf, "\tMM");
2984 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE);
2990 INT Show_HtExtcha_Proc(
2991 IN PRTMP_ADAPTER pAd,
2994 switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)
2997 sprintf(pBuf, "\tBelow");
3000 sprintf(pBuf, "\tAbove");
3003 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA);
3010 INT Show_HtMpduDensity_Proc(
3011 IN PRTMP_ADAPTER pAd,
3014 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity);
3018 INT Show_HtBaWinSize_Proc(
3019 IN PRTMP_ADAPTER pAd,
3022 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit);
3026 INT Show_HtRdg_Proc(
3027 IN PRTMP_ADAPTER pAd,
3030 sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE");
3034 INT Show_HtAmsdu_Proc(
3035 IN PRTMP_ADAPTER pAd,
3038 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE");
3042 INT Show_HtAutoBa_Proc(
3043 IN PRTMP_ADAPTER pAd,
3046 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE");
3050 INT Show_CountryRegion_Proc(
3051 IN PRTMP_ADAPTER pAd,
3054 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion);
3058 INT Show_CountryRegionABand_Proc(
3059 IN PRTMP_ADAPTER pAd,
3062 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand);
3066 INT Show_CountryCode_Proc(
3067 IN PRTMP_ADAPTER pAd,
3070 sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode);
3074 #ifdef AGGREGATION_SUPPORT
3075 INT Show_PktAggregate_Proc(
3076 IN PRTMP_ADAPTER pAd,
3079 sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE");
3082 #endif // AGGREGATION_SUPPORT //
3085 INT Show_WmmCapable_Proc(
3086 IN PRTMP_ADAPTER pAd,
3089 sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE");
3093 #endif // WMM_SUPPORT //
3095 INT Show_IEEE80211H_Proc(
3096 IN PRTMP_ADAPTER pAd,
3099 sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE");
3103 INT Show_NetworkType_Proc(
3104 IN PRTMP_ADAPTER pAd,
3107 switch(pAd->StaCfg.BssType)
3110 sprintf(pBuf, "\tAdhoc");
3113 sprintf(pBuf, "\tInfra");
3116 sprintf(pBuf, "\tAny");
3119 sprintf(pBuf, "\tMonitor");
3122 sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType);
3128 INT Show_AuthMode_Proc(
3129 IN PRTMP_ADAPTER pAd,
3132 NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen;
3134 AuthMode = pAd->StaCfg.AuthMode;
3136 if ((AuthMode >= Ndis802_11AuthModeOpen) &&
3137 (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK))
3138 sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode));
3140 sprintf(pBuf, "\tUnknow Value(%d)", AuthMode);
3145 INT Show_EncrypType_Proc(
3146 IN PRTMP_ADAPTER pAd,
3149 NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled;
3151 WepStatus = pAd->StaCfg.WepStatus;
3153 if ((WepStatus >= Ndis802_11WEPEnabled) &&
3154 (WepStatus <= Ndis802_11Encryption4KeyAbsent))
3155 sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus));
3157 sprintf(pBuf, "\tUnknow Value(%d)", WepStatus);
3162 INT Show_DefaultKeyID_Proc(
3163 IN PRTMP_ADAPTER pAd,
3166 UCHAR DefaultKeyId = 0;
3168 DefaultKeyId = pAd->StaCfg.DefaultKeyId;
3170 sprintf(pBuf, "\t%d", DefaultKeyId);
3175 INT Show_WepKey_Proc(
3176 IN PRTMP_ADAPTER pAd,
3180 UCHAR Key[16] = {0}, KeyLength = 0;
3183 KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen;
3184 NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength);
3186 //check key string is ASCII or not
3187 if (RTMPCheckStrPrintAble(Key, KeyLength))
3188 sprintf(pBuf, "\t%s", Key);
3192 sprintf(pBuf, "\t");
3193 for (idx = 0; idx < KeyLength; idx++)
3194 sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]);
3200 IN PRTMP_ADAPTER pAd,
3203 Show_WepKey_Proc(pAd, 0, pBuf);
3208 IN PRTMP_ADAPTER pAd,
3211 Show_WepKey_Proc(pAd, 1, pBuf);
3216 IN PRTMP_ADAPTER pAd,
3219 Show_WepKey_Proc(pAd, 2, pBuf);
3224 IN PRTMP_ADAPTER pAd,
3227 Show_WepKey_Proc(pAd, 3, pBuf);
3231 INT Show_WPAPSK_Proc(
3232 IN PRTMP_ADAPTER pAd,
3236 UCHAR PMK[32] = {0};
3238 NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32);
3240 sprintf(pBuf, "\tPMK = ");
3241 for (idx = 0; idx < 32; idx++)
3242 sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]);