2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
28 #include "../rt_config.h"
34 INT Show_WirelessMode_Proc(
38 INT Show_TxBurst_Proc(
42 INT Show_TxPreamble_Proc(
46 INT Show_TxPower_Proc(
50 INT Show_Channel_Proc(
54 INT Show_BGProtection_Proc(
58 INT Show_RTSThreshold_Proc(
62 INT Show_FragThreshold_Proc(
78 INT Show_HtOpMode_Proc(
82 INT Show_HtExtcha_Proc(
86 INT Show_HtMpduDensity_Proc(
90 INT Show_HtBaWinSize_Proc(
98 INT Show_HtAmsdu_Proc(
102 INT Show_HtAutoBa_Proc(
103 IN PRTMP_ADAPTER pAd,
106 INT Show_CountryRegion_Proc(
107 IN PRTMP_ADAPTER pAd,
110 INT Show_CountryRegionABand_Proc(
111 IN PRTMP_ADAPTER pAd,
114 INT Show_CountryCode_Proc(
115 IN PRTMP_ADAPTER pAd,
118 #ifdef AGGREGATION_SUPPORT
119 INT Show_PktAggregate_Proc(
120 IN PRTMP_ADAPTER pAd,
122 #endif // AGGREGATION_SUPPORT //
125 INT Show_WmmCapable_Proc(
126 IN PRTMP_ADAPTER pAd,
128 #endif // WMM_SUPPORT //
130 INT Show_IEEE80211H_Proc(
131 IN PRTMP_ADAPTER pAd,
134 INT Show_NetworkType_Proc(
135 IN PRTMP_ADAPTER pAd,
138 INT Show_AuthMode_Proc(
139 IN PRTMP_ADAPTER pAd,
142 INT Show_EncrypType_Proc(
143 IN PRTMP_ADAPTER pAd,
146 INT Show_DefaultKeyID_Proc(
147 IN PRTMP_ADAPTER pAd,
151 IN PRTMP_ADAPTER pAd,
155 IN PRTMP_ADAPTER pAd,
159 IN PRTMP_ADAPTER pAd,
163 IN PRTMP_ADAPTER pAd,
166 INT Show_WPAPSK_Proc(
167 IN PRTMP_ADAPTER pAd,
172 INT (*show_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg);
173 } *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = {
174 {"SSID", Show_SSID_Proc},
175 {"WirelessMode", Show_WirelessMode_Proc},
176 {"TxBurst", Show_TxBurst_Proc},
177 {"TxPreamble", Show_TxPreamble_Proc},
178 {"TxPower", Show_TxPower_Proc},
179 {"Channel", Show_Channel_Proc},
180 {"BGProtection", Show_BGProtection_Proc},
181 {"RTSThreshold", Show_RTSThreshold_Proc},
182 {"FragThreshold", Show_FragThreshold_Proc},
183 {"HtBw", Show_HtBw_Proc},
184 {"HtMcs", Show_HtMcs_Proc},
185 {"HtGi", Show_HtGi_Proc},
186 {"HtOpMode", Show_HtOpMode_Proc},
187 {"HtExtcha", Show_HtExtcha_Proc},
188 {"HtMpduDensity", Show_HtMpduDensity_Proc},
189 {"HtBaWinSize", Show_HtBaWinSize_Proc},
190 {"HtRdg", Show_HtRdg_Proc},
191 {"HtAmsdu", Show_HtAmsdu_Proc},
192 {"HtAutoBa", Show_HtAutoBa_Proc},
193 {"CountryRegion", Show_CountryRegion_Proc},
194 {"CountryRegionABand", Show_CountryRegionABand_Proc},
195 {"CountryCode", Show_CountryCode_Proc},
196 #ifdef AGGREGATION_SUPPORT
197 {"PktAggregate", Show_PktAggregate_Proc},
201 {"WmmCapable", Show_WmmCapable_Proc},
203 {"IEEE80211H", Show_IEEE80211H_Proc},
204 {"NetworkType", Show_NetworkType_Proc},
205 {"AuthMode", Show_AuthMode_Proc},
206 {"EncrypType", Show_EncrypType_Proc},
207 {"DefaultKeyID", Show_DefaultKeyID_Proc},
208 {"Key1", Show_Key1_Proc},
209 {"Key2", Show_Key2_Proc},
210 {"Key3", Show_Key3_Proc},
211 {"Key4", Show_Key4_Proc},
212 {"WPAPSK", Show_WPAPSK_Proc},
217 ==========================================================================
222 ==========================================================================
224 INT Set_DriverVersion_Proc(
225 IN PRTMP_ADAPTER pAd,
228 DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION));
234 ==========================================================================
237 This command will not work, if the field of CountryRegion in eeprom is programmed.
239 TRUE if all parameters are OK, FALSE otherwise
240 ==========================================================================
242 INT Set_CountryRegion_Proc(
243 IN PRTMP_ADAPTER pAd,
248 region = simple_strtol(arg, 0, 10);
250 // Country can be set only when EEPROM not programmed
251 if (pAd->CommonCfg.CountryRegion & 0x80)
253 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameter of CountryRegion in eeprom is programmed \n"));
257 if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND))
259 pAd->CommonCfg.CountryRegion = (UCHAR) region;
261 else if (region == REGION_31_BG_BAND)
263 pAd->CommonCfg.CountryRegion = (UCHAR) region;
267 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameters out of range\n"));
271 // if set country region, driver needs to be reset
272 BuildChannelList(pAd);
274 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion));
280 ==========================================================================
282 Set Country Region for A band.
283 This command will not work, if the field of CountryRegion in eeprom is programmed.
285 TRUE if all parameters are OK, FALSE otherwise
286 ==========================================================================
288 INT Set_CountryRegionABand_Proc(
289 IN PRTMP_ADAPTER pAd,
294 region = simple_strtol(arg, 0, 10);
296 // Country can be set only when EEPROM not programmed
297 if (pAd->CommonCfg.CountryRegionForABand & 0x80)
299 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameter of CountryRegion in eeprom is programmed \n"));
303 if((region >= 0) && (region <= REGION_MAXIMUM_A_BAND))
305 pAd->CommonCfg.CountryRegionForABand = (UCHAR) region;
309 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameters out of range\n"));
313 // if set country region, driver needs to be reset
314 BuildChannelList(pAd);
316 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegionForABand));
322 ==========================================================================
326 TRUE if all parameters are OK, FALSE otherwise
327 ==========================================================================
329 INT Set_WirelessMode_Proc(
330 IN PRTMP_ADAPTER pAd,
336 WirelessMode = simple_strtol(arg, 0, 10);
339 INT MaxPhyMode = PHY_11G;
341 MaxPhyMode = PHY_11N_5G;
343 if (WirelessMode <= MaxPhyMode)
345 RTMPSetPhyMode(pAd, WirelessMode);
347 if (WirelessMode >= PHY_11ABGN_MIXED)
349 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
350 pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE;
354 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
355 pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE;
358 // Set AdhocMode rates
359 if (pAd->StaCfg.BssType == BSS_ADHOC)
361 MlmeUpdateTxRates(pAd, FALSE, 0);
362 MakeIbssBeacon(pAd); // re-build BEACON frame
363 AsicEnableIbssSync(pAd); // copy to on-chip memory
372 // it is needed to set SSID to take effect
376 DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%ld)\n", WirelessMode));
380 DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n"));
387 ==========================================================================
391 TRUE if all parameters are OK, FALSE otherwise
392 ==========================================================================
394 INT Set_Channel_Proc(
395 IN PRTMP_ADAPTER pAd,
401 Channel = (UCHAR) simple_strtol(arg, 0, 10);
403 // check if this channel is valid
404 if (ChannelSanity(pAd, Channel) == TRUE)
407 pAd->CommonCfg.Channel = Channel;
412 if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED &&
413 pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
416 AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
417 AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
418 DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n",
419 pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel));
423 AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
424 AsicLockChannel(pAd, pAd->CommonCfg.Channel);
425 DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel));
438 DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel));
444 ==========================================================================
446 Set Short Slot Time Enable or Disable
448 TRUE if all parameters are OK, FALSE otherwise
449 ==========================================================================
451 INT Set_ShortSlot_Proc(
452 IN PRTMP_ADAPTER pAd,
457 ShortSlot = simple_strtol(arg, 0, 10);
460 pAd->CommonCfg.bUseShortSlotTime = TRUE;
461 else if (ShortSlot == 0)
462 pAd->CommonCfg.bUseShortSlotTime = FALSE;
464 return FALSE; //Invalid argument
466 DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime));
472 ==========================================================================
476 TRUE if all parameters are OK, FALSE otherwise
477 ==========================================================================
479 INT Set_TxPower_Proc(
480 IN PRTMP_ADAPTER pAd,
486 TxPower = (ULONG) simple_strtol(arg, 0, 10);
490 pAd->CommonCfg.TxPowerDefault = TxPower;
491 pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
498 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
504 ==========================================================================
506 Set 11B/11G Protection
508 TRUE if all parameters are OK, FALSE otherwise
509 ==========================================================================
511 INT Set_BGProtection_Proc(
512 IN PRTMP_ADAPTER pAd,
515 switch (simple_strtol(arg, 0, 10))
518 pAd->CommonCfg.UseBGProtection = 0;
521 pAd->CommonCfg.UseBGProtection = 1;
524 pAd->CommonCfg.UseBGProtection = 2;
526 default: //Invalid argument
531 DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection));
537 ==========================================================================
541 TRUE if all parameters are OK, FALSE otherwise
542 ==========================================================================
544 INT Set_TxPreamble_Proc(
545 IN PRTMP_ADAPTER pAd,
548 RT_802_11_PREAMBLE Preamble;
550 Preamble = simple_strtol(arg, 0, 10);
555 case Rt802_11PreambleShort:
556 pAd->CommonCfg.TxPreamble = Preamble;
558 MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);
560 case Rt802_11PreambleLong:
561 case Rt802_11PreambleAuto:
562 // if user wants AUTO, initialize to LONG here, then change according to AP's
563 // capability upon association.
564 pAd->CommonCfg.TxPreamble = Preamble;
566 MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);
568 default: //Invalid argument
572 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble));
578 ==========================================================================
582 TRUE if all parameters are OK, FALSE otherwise
583 ==========================================================================
585 INT Set_RTSThreshold_Proc(
586 IN PRTMP_ADAPTER pAd,
589 NDIS_802_11_RTS_THRESHOLD RtsThresh;
591 RtsThresh = simple_strtol(arg, 0, 10);
593 if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD))
594 pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
595 else if (RtsThresh == 0)
596 pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;
598 return FALSE; //Invalid argument
600 DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold));
606 ==========================================================================
608 Set Fragment Threshold
610 TRUE if all parameters are OK, FALSE otherwise
611 ==========================================================================
613 INT Set_FragThreshold_Proc(
614 IN PRTMP_ADAPTER pAd,
617 NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
619 FragThresh = simple_strtol(arg, 0, 10);
621 if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)
623 //Illegal FragThresh so we set it to default
624 pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
626 else if (FragThresh % 2 == 1)
628 // The length of each fragment shall always be an even number of octets, except for the last fragment
629 // of an MSDU or MMPDU, which may be either an even or an odd number of octets.
630 pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1);
634 pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
638 if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)
639 pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;
641 pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;
644 DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold));
650 ==========================================================================
654 TRUE if all parameters are OK, FALSE otherwise
655 ==========================================================================
657 INT Set_TxBurst_Proc(
658 IN PRTMP_ADAPTER pAd,
663 TxBurst = simple_strtol(arg, 0, 10);
665 pAd->CommonCfg.bEnableTxBurst = TRUE;
666 else if (TxBurst == 0)
667 pAd->CommonCfg.bEnableTxBurst = FALSE;
669 return FALSE; //Invalid argument
671 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst));
676 #ifdef AGGREGATION_SUPPORT
678 ==========================================================================
682 TRUE if all parameters are OK, FALSE otherwise
683 ==========================================================================
685 INT Set_PktAggregate_Proc(
686 IN PRTMP_ADAPTER pAd,
691 aggre = simple_strtol(arg, 0, 10);
694 pAd->CommonCfg.bAggregationCapable = TRUE;
696 pAd->CommonCfg.bAggregationCapable = FALSE;
698 return FALSE; //Invalid argument
701 DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable));
708 ==========================================================================
711 This parameter is 1 when needs radar detection, otherwise 0
713 TRUE if all parameters are OK, FALSE otherwise
714 ==========================================================================
716 INT Set_IEEE80211H_Proc(
717 IN PRTMP_ADAPTER pAd,
722 ieee80211h = simple_strtol(arg, 0, 10);
725 pAd->CommonCfg.bIEEE80211H = TRUE;
726 else if (ieee80211h == 0)
727 pAd->CommonCfg.bIEEE80211H = FALSE;
729 return FALSE; //Invalid argument
731 DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H));
739 ==========================================================================
741 For Debug information
743 TRUE if all parameters are OK, FALSE otherwise
744 ==========================================================================
747 IN PRTMP_ADAPTER pAd,
750 DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n"));
752 if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD)
753 RTDebugLevel = simple_strtol(arg, 0, 10);
755 DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel));
761 INT Show_DescInfo_Proc(
762 IN PRTMP_ADAPTER pAd,
767 PRT28XX_RXD_STRUC pRxD;
769 PRTMP_TX_RING pTxRing = &pAd->TxRing[QueIdx];
770 PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing;
771 PRTMP_RX_RING pRxRing = &pAd->RxRing;
773 for(i=0;i<TX_RING_SIZE;i++)
775 pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa;
776 printk("Desc #%d\n",i);
777 hex_dump("Tx Descriptor", (char *)pTxD, 16);
778 printk("pTxD->DMADONE = %x\n", pTxD->DMADONE);
780 printk("---------------------------------------------------\n");
781 for(i=0;i<MGMT_RING_SIZE;i++)
783 pTxD = (PTXD_STRUC) pMgmtRing->Cell[i].AllocVa;
784 printk("Desc #%d\n",i);
785 hex_dump("Mgmt Descriptor", (char *)pTxD, 16);
786 printk("pMgmt->DMADONE = %x\n", pTxD->DMADONE);
788 printk("---------------------------------------------------\n");
789 for(i=0;i<RX_RING_SIZE;i++)
791 pRxD = (PRT28XX_RXD_STRUC) pRxRing->Cell[i].AllocVa;
792 printk("Desc #%d\n",i);
793 hex_dump("Rx Descriptor", (char *)pRxD, 16);
794 printk("pRxD->DDONE = %x\n", pRxD->DDONE);
801 ==========================================================================
803 Reset statistics counter
806 pAdapter Pointer to our adapter
810 TRUE if all parameters are OK, FALSE otherwise
811 ==========================================================================
813 INT Set_ResetStatCounter_Proc(
814 IN PRTMP_ADAPTER pAd,
817 DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n"));
819 // add the most up-to-date h/w raw counters into software counters
820 NICUpdateRawCounters(pAd);
822 NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));
823 NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));
824 NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));
829 BOOLEAN RTMPCheckStrPrintAble(
835 for (i=0; i<strLen; i++)
837 if ((pInPutStr[i] < 0x21) ||
838 (pInPutStr[i] > 0x7E))
846 ========================================================================
849 Remove WPA Key process
852 pAd Pointer to our adapter
853 pBuf Pointer to the where the key stored
856 NDIS_SUCCESS Add key successfully
858 IRQL = DISPATCH_LEVEL
862 ========================================================================
864 VOID RTMPSetDesiredRates(
865 IN PRTMP_ADAPTER pAdapter,
868 NDIS_802_11_RATES aryRates;
870 memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
871 switch (pAdapter->CommonCfg.PhyMode)
873 case PHY_11A: // A only
877 aryRates[0] = 0x0c; // 6M
878 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
881 aryRates[0] = 0x12; // 9M
882 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
885 aryRates[0] = 0x18; // 12M
886 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
889 aryRates[0] = 0x24; // 18M
890 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
893 aryRates[0] = 0x30; // 24M
894 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
897 aryRates[0] = 0x48; // 36M
898 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
901 aryRates[0] = 0x60; // 48M
902 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
905 aryRates[0] = 0x6c; // 54M
906 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
910 aryRates[0] = 0x6c; // 54Mbps
911 aryRates[1] = 0x60; // 48Mbps
912 aryRates[2] = 0x48; // 36Mbps
913 aryRates[3] = 0x30; // 24Mbps
914 aryRates[4] = 0x24; // 18M
915 aryRates[5] = 0x18; // 12M
916 aryRates[6] = 0x12; // 9M
917 aryRates[7] = 0x0c; // 6M
918 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
922 case PHY_11BG_MIXED: // B/G Mixed
923 case PHY_11B: // B only
924 case PHY_11ABG_MIXED: // A/B/G Mixed
930 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
934 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
937 aryRates[0] = 0x0b; // 5.5M
938 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
941 aryRates[0] = 0x16; // 11M
942 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
945 aryRates[0] = 0x0c; // 6M
946 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
949 aryRates[0] = 0x12; // 9M
950 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
953 aryRates[0] = 0x18; // 12M
954 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
957 aryRates[0] = 0x24; // 18M
958 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
961 aryRates[0] = 0x30; // 24M
962 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
965 aryRates[0] = 0x48; // 36M
966 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
969 aryRates[0] = 0x60; // 48M
970 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
973 aryRates[0] = 0x6c; // 54M
974 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
978 if (pAdapter->CommonCfg.PhyMode == PHY_11B)
980 aryRates[0] = 0x16; // 11Mbps
981 aryRates[1] = 0x0b; // 5.5Mbps
982 aryRates[2] = 0x04; // 2Mbps
983 aryRates[3] = 0x02; // 1Mbps
986 { //(B/G) Mixed or (A/B/G) Mixed
987 aryRates[0] = 0x6c; // 54Mbps
988 aryRates[1] = 0x60; // 48Mbps
989 aryRates[2] = 0x48; // 36Mbps
990 aryRates[3] = 0x30; // 24Mbps
991 aryRates[4] = 0x16; // 11Mbps
992 aryRates[5] = 0x0b; // 5.5Mbps
993 aryRates[6] = 0x04; // 2Mbps
994 aryRates[7] = 0x02; // 1Mbps
996 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
1002 NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1003 NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
1004 DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
1005 pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1],
1006 pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3],
1007 pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5],
1008 pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] ));
1009 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
1010 MlmeUpdateTxRates(pAdapter, FALSE, 0);
1013 NDIS_STATUS RTMPWPARemoveKeyProc(
1014 IN PRTMP_ADAPTER pAd,
1017 PNDIS_802_11_REMOVE_KEY pKey;
1019 NDIS_STATUS Status = NDIS_STATUS_FAILURE;
1020 BOOLEAN bTxKey; // Set the key as transmit key
1021 BOOLEAN bPairwise; // Indicate the key is pairwise key
1022 BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value.
1023 // Otherwise, it will set by the NIC.
1024 BOOLEAN bAuthenticator; // indicate key is set by authenticator.
1027 DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n"));
1029 pKey = (PNDIS_802_11_REMOVE_KEY) pBuf;
1030 KeyIdx = pKey->KeyIndex & 0xff;
1031 // Bit 31 of Add-key, Tx Key
1032 bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE;
1033 // Bit 30 of Add-key PairwiseKey
1034 bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE;
1035 // Bit 29 of Add-key KeyRSC
1036 bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE;
1037 // Bit 28 of Add-key Authenticator
1038 bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE;
1040 // 1. If bTx is TRUE, return failure information
1042 return(NDIS_STATUS_INVALID_DATA);
1044 // 2. Check Pairwise Key
1047 // a. If BSSID is broadcast, remove all pairwise keys.
1048 // b. If not broadcast, remove the pairwise specified by BSSID
1049 for (i = 0; i < SHARE_KEY_NUM; i++)
1051 if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID))
1053 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i));
1054 pAd->SharedKey[BSS0][i].KeyLen = 0;
1055 pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE;
1056 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i);
1057 Status = NDIS_STATUS_SUCCESS;
1065 // a. If BSSID is broadcast, remove all group keys indexed
1066 // b. If BSSID matched, delete the group key indexed.
1067 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx));
1068 pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
1069 pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
1070 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx);
1071 Status = NDIS_STATUS_SUCCESS;
1078 ========================================================================
1080 Routine Description:
1084 pAd Pointer to our adapter
1089 IRQL = DISPATCH_LEVEL
1093 ========================================================================
1095 VOID RTMPWPARemoveAllKeys(
1096 IN PRTMP_ADAPTER pAd)
1101 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
1103 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1104 // Link up. And it will be replaced if user changed it.
1105 if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)
1108 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1109 // Link up. And it will be replaced if user changed it.
1110 if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone)
1113 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1114 AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
1116 // set all shared key mode as no-security.
1117 for (i = 0; i < SHARE_KEY_NUM; i++)
1119 DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
1120 NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY));
1122 AsicRemoveSharedKeyEntry(pAd, BSS0, i);
1128 ========================================================================
1129 Routine Description:
1130 Change NIC PHY mode. Re-association may be necessary. possible settings
1131 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1134 pAd - Pointer to our adapter
1137 IRQL = PASSIVE_LEVEL
1138 IRQL = DISPATCH_LEVEL
1140 ========================================================================
1142 VOID RTMPSetPhyMode(
1143 IN PRTMP_ADAPTER pAd,
1147 // the selected phymode must be supported by the RF IC encoded in E2PROM
1149 pAd->CommonCfg.PhyMode = (UCHAR)phymode;
1151 DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
1153 BuildChannelList(pAd);
1155 // sanity check user setting
1156 for (i = 0; i < pAd->ChannelListNum; i++)
1158 if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
1162 if (i == pAd->ChannelListNum)
1164 pAd->CommonCfg.Channel = FirstChannel(pAd);
1165 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel));
1168 NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES);
1169 NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES);
1170 NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1173 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1174 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1175 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1176 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1177 pAd->CommonCfg.SupRateLen = 4;
1178 pAd->CommonCfg.ExtRateLen = 0;
1179 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1180 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1181 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1182 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1183 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1187 case PHY_11BG_MIXED:
1188 case PHY_11ABG_MIXED:
1190 case PHY_11ABGN_MIXED:
1191 case PHY_11BGN_MIXED:
1192 case PHY_11GN_MIXED:
1193 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1194 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1195 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1196 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1197 pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1198 pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1199 pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1200 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1201 pAd->CommonCfg.SupRateLen = 8;
1202 pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1203 pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1204 pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1205 pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1206 pAd->CommonCfg.ExtRateLen = 4;
1207 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1208 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1209 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1210 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1211 pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
1212 pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
1213 pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
1214 pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
1215 pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
1216 pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
1217 pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
1218 pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
1222 case PHY_11AN_MIXED:
1223 case PHY_11AGN_MIXED:
1225 pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1226 pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1227 pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1228 pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1229 pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1230 pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1231 pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1232 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1233 pAd->CommonCfg.SupRateLen = 8;
1234 pAd->CommonCfg.ExtRateLen = 0;
1235 pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
1236 pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
1237 pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
1238 pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
1239 pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
1240 pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
1241 pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
1242 pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
1243 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1251 pAd->CommonCfg.BandState = UNKNOWN_BAND;
1255 ========================================================================
1256 Routine Description:
1257 Caller ensures we has 802.11n support.
1258 Calls at setting HT from AP/STASetinformation
1261 pAd - Pointer to our adapter
1264 ========================================================================
1267 IN PRTMP_ADAPTER pAd,
1268 IN OID_SET_HT_PHYMODE *pHTPhyMode)
1273 UCHAR BBP3Value = 0;
1274 UCHAR RxStream = pAd->CommonCfg.RxStream;
1276 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1277 pHTPhyMode->HtMode, pHTPhyMode->ExtOffset,
1278 pHTPhyMode->MCS, pHTPhyMode->BW,
1279 pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
1281 // Don't zero supportedHyPhy structure.
1282 RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability));
1283 RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo));
1284 RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset));
1285 RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy));
1287 if (pAd->CommonCfg.bRdg)
1289 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1;
1290 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1;
1294 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0;
1295 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0;
1298 pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3;
1299 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3;
1301 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit));
1303 // Mimo power save, A-MSDU size,
1304 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
1305 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize;
1306 pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode;
1307 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1309 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
1310 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
1311 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1313 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1314 pAd->CommonCfg.DesiredHtPhy.AmsduSize,
1315 pAd->CommonCfg.DesiredHtPhy.MimoPs,
1316 pAd->CommonCfg.DesiredHtPhy.MpduDensity,
1317 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
1319 if(pHTPhyMode->HtMode == HTMODE_GF)
1321 pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1;
1322 pAd->CommonCfg.DesiredHtPhy.GF = 1;
1325 pAd->CommonCfg.DesiredHtPhy.GF = 0;
1331 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1332 pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
1336 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1337 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1341 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1342 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1343 pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
1347 if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) )
1349 pHTPhyMode->BW = BW_20;
1350 pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1;
1353 if(pHTPhyMode->BW == BW_40)
1355 pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
1356 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
1357 if (pAd->CommonCfg.Channel <= 14)
1358 pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
1360 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1;
1361 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
1362 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE;
1363 // Set Regsiter for extension channel position.
1364 RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
1365 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
1366 if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW))
1369 BBP3Value |= (0x20);
1370 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1372 else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE))
1375 BBP3Value &= (~0x20);
1376 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1379 // Turn on BBP 40MHz mode now only as AP .
1380 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1381 if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
1384 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1385 BBPValue &= (~0x18);
1387 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1389 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value);
1390 pAd->CommonCfg.BBPCurrentBW = BW_40;
1395 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0;
1396 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0;
1397 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
1398 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE;
1399 pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
1400 // Turn on BBP 20MHz mode by request here.
1402 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1403 BBPValue &= (~0x18);
1404 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1405 pAd->CommonCfg.BBPCurrentBW = BW_20;
1409 if(pHTPhyMode->STBC == STBC_USE)
1411 pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1;
1412 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1;
1413 pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1;
1414 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1;
1418 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
1419 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
1422 if(pHTPhyMode->SHORTGI == GI_400)
1424 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1;
1425 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1;
1426 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1;
1427 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1;
1431 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0;
1432 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0;
1433 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0;
1434 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0;
1437 // We support link adaptation for unsolicit MCS feedback, set to 2.
1438 pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
1439 pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
1440 // 1, the extension channel above the control channel.
1442 // EDCA parameters used for AP's own transmission
1443 if (pAd->CommonCfg.APEdcaParm.bValid == FALSE)
1445 pAd->CommonCfg.APEdcaParm.bValid = TRUE;
1446 pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
1447 pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7;
1448 pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1;
1449 pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1;
1451 pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4;
1452 pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4;
1453 pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3;
1454 pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2;
1456 pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6;
1457 pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10;
1458 pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4;
1459 pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3;
1461 pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
1462 pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
1463 pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
1464 pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
1466 AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm);
1468 RTMPSetIndividualHT(pAd, 0);
1472 ========================================================================
1473 Routine Description:
1474 Caller ensures we has 802.11n support.
1475 Calls at setting HT from AP/STASetinformation
1478 pAd - Pointer to our adapter
1481 ========================================================================
1483 VOID RTMPSetIndividualHT(
1484 IN PRTMP_ADAPTER pAd,
1487 PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
1488 UCHAR TxStream = pAd->CommonCfg.TxStream;
1489 UCHAR DesiredMcs = MCS_AUTO;
1494 pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
1495 DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS;
1496 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1501 if (pDesired_ht_phy == NULL)
1503 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
1506 RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO));
1508 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
1509 // Check the validity of MCS
1510 if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15)))
1512 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs));
1516 if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32))
1518 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1522 pDesired_ht_phy->bHtEnable = TRUE;
1524 // Decide desired Tx MCS
1528 if (DesiredMcs == MCS_AUTO)
1530 pDesired_ht_phy->MCSSet[0]= 0xff;
1531 pDesired_ht_phy->MCSSet[1]= 0x00;
1533 else if (DesiredMcs <= MCS_7)
1535 pDesired_ht_phy->MCSSet[0]= 1<<DesiredMcs;
1536 pDesired_ht_phy->MCSSet[1]= 0x00;
1541 if (DesiredMcs == MCS_AUTO)
1543 pDesired_ht_phy->MCSSet[0]= 0xff;
1544 pDesired_ht_phy->MCSSet[1]= 0xff;
1546 else if (DesiredMcs <= MCS_15)
1550 mode = DesiredMcs / 8;
1552 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1557 if (DesiredMcs == MCS_AUTO)
1559 /* MCS0 ~ MCS23, 3 bytes */
1560 pDesired_ht_phy->MCSSet[0]= 0xff;
1561 pDesired_ht_phy->MCSSet[1]= 0xff;
1562 pDesired_ht_phy->MCSSet[2]= 0xff;
1564 else if (DesiredMcs <= MCS_23)
1568 mode = DesiredMcs / 8;
1570 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1575 if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40)
1577 if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
1578 pDesired_ht_phy->MCSSet[4] = 0x1;
1581 // update HT Rate setting
1582 if (pAd->OpMode == OPMODE_STA)
1583 MlmeUpdateHtTxRates(pAd, BSS0);
1585 MlmeUpdateHtTxRates(pAd, apidx);
1590 ========================================================================
1591 Routine Description:
1592 Update HT IE from our capability.
1595 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1598 ========================================================================
1600 VOID RTMPUpdateHTIE(
1601 IN RT_HT_CAPABILITY *pRtHt,
1603 OUT HT_CAPABILITY_IE *pHtCapability,
1604 OUT ADD_HT_INFO_IE *pAddHtInfo)
1606 RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE));
1607 RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE));
1609 pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
1610 pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
1611 pHtCapability->HtCapInfo.GF = pRtHt->GF;
1612 pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
1613 pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
1614 pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
1615 pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
1616 pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
1617 pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
1618 pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
1620 pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ;
1621 pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
1622 pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
1623 pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
1624 RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1626 DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n"));
1630 ========================================================================
1632 Add Client security information into ASIC WCID table and IVEIV table.
1634 ========================================================================
1636 VOID RTMPAddWcidAttributeEntry(
1637 IN PRTMP_ADAPTER pAd,
1641 IN MAC_TABLE_ENTRY *pEntry)
1643 UINT32 WCIDAttri = 0;
1652 DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx));
1656 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
1657 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
1658 // the AID:2~ assign to mesh link entry.
1659 if (pEntry && ADHOC_ON(pAd))
1661 else if (pEntry && INFRA_ON(pAd))
1670 // Update WCID attribute table
1671 offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE);
1674 if (pEntry && pEntry->ValidAsMesh)
1675 WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE;
1677 WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE;
1680 RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
1683 // Update IV/EIV table
1684 offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
1687 if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES))
1689 // Eiv bit on. keyid always is 0 for pairwise key
1690 IVEIV = (KeyIdx <<6) | 0x20;
1694 // WEP KeyIdx is default tx key.
1695 IVEIV = (KeyIdx << 6);
1698 // For key index and ext IV bit, so only need to update the position(offset+3).
1700 RTMP_IO_WRITE8(pAd, offset+3, IVEIV);
1703 RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV);
1706 DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg]));
1707 DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri));
1712 ==========================================================================
1714 Parse encryption type
1716 pAdapter Pointer to our adapter
1717 wrq Pointer to the ioctl argument
1723 ==========================================================================
1725 CHAR *GetEncryptType(CHAR enc)
1727 if(enc == Ndis802_11WEPDisabled)
1729 if(enc == Ndis802_11WEPEnabled)
1731 if(enc == Ndis802_11Encryption2Enabled)
1733 if(enc == Ndis802_11Encryption3Enabled)
1735 if(enc == Ndis802_11Encryption4Enabled)
1741 CHAR *GetAuthMode(CHAR auth)
1743 if(auth == Ndis802_11AuthModeOpen)
1745 if(auth == Ndis802_11AuthModeShared)
1747 if(auth == Ndis802_11AuthModeAutoSwitch)
1749 if(auth == Ndis802_11AuthModeWPA)
1751 if(auth == Ndis802_11AuthModeWPAPSK)
1753 if(auth == Ndis802_11AuthModeWPANone)
1755 if(auth == Ndis802_11AuthModeWPA2)
1757 if(auth == Ndis802_11AuthModeWPA2PSK)
1759 if(auth == Ndis802_11AuthModeWPA1WPA2)
1761 if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
1762 return "WPA1PSKWPA2PSK";
1768 ==========================================================================
1770 Get site survey results
1772 pAdapter Pointer to our adapter
1773 wrq Pointer to the ioctl argument
1780 1.) UI needs to wait 4 seconds after issue a site survey command
1781 2.) iwpriv ra0 get_site_survey
1782 3.) UI needs to prepare at least 4096bytes to get the results
1783 ==========================================================================
1785 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
1786 VOID RTMPIoctlGetSiteSurvey(
1787 IN PRTMP_ADAPTER pAdapter,
1788 IN struct iwreq *wrq)
1794 CHAR Ssid[MAX_LEN_OF_SSID +1];
1795 INT Rssi = 0, max_len = LINE_LEN;
1796 UINT Rssi_Quality = 0;
1797 NDIS_802_11_NETWORK_TYPE wireless_mode;
1799 os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len));
1803 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
1807 memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len );
1808 memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1));
1809 sprintf(msg,"%s","\n");
1810 sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
1811 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
1814 pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE;
1816 while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200))
1819 for(i=0; i<pAdapter->ScanTab.BssNr ;i++)
1821 if( pAdapter->ScanTab.BssEntry[i].Channel==0)
1824 if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA)
1828 sprintf(msg+strlen(msg),"%-4d", pAdapter->ScanTab.BssEntry[i].Channel);
1830 memcpy(Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen);
1831 Ssid[pAdapter->ScanTab.BssEntry[i].SsidLen] = '\0';
1832 sprintf(msg+strlen(msg),"%-33s", Ssid);
1834 sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ",
1835 pAdapter->ScanTab.BssEntry[i].Bssid[0],
1836 pAdapter->ScanTab.BssEntry[i].Bssid[1],
1837 pAdapter->ScanTab.BssEntry[i].Bssid[2],
1838 pAdapter->ScanTab.BssEntry[i].Bssid[3],
1839 pAdapter->ScanTab.BssEntry[i].Bssid[4],
1840 pAdapter->ScanTab.BssEntry[i].Bssid[5]);
1842 sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus));
1843 //Authentication Mode
1844 if (pAdapter->ScanTab.BssEntry[i].WepStatus == Ndis802_11WEPEnabled)
1845 sprintf(msg+strlen(msg),"%-10s", "UNKNOW");
1847 sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode));
1849 Rssi = (INT)pAdapter->ScanTab.BssEntry[i].Rssi;
1852 else if (Rssi >= -80) // between -50 ~ -80dbm
1853 Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10);
1854 else if (Rssi >= -90) // between -80 ~ -90dbm
1855 Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10);
1858 sprintf(msg+strlen(msg),"%-9d", Rssi_Quality);
1860 wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]);
1861 if (wireless_mode == Ndis802_11FH ||
1862 wireless_mode == Ndis802_11DS)
1863 sprintf(msg+strlen(msg),"%-7s", "11b");
1864 else if (wireless_mode == Ndis802_11OFDM5)
1865 sprintf(msg+strlen(msg),"%-7s", "11a");
1866 else if (wireless_mode == Ndis802_11OFDM5_N)
1867 sprintf(msg+strlen(msg),"%-7s", "11a/n");
1868 else if (wireless_mode == Ndis802_11OFDM24)
1869 sprintf(msg+strlen(msg),"%-7s", "11b/g");
1870 else if (wireless_mode == Ndis802_11OFDM24_N)
1871 sprintf(msg+strlen(msg),"%-7s", "11b/g/n");
1873 sprintf(msg+strlen(msg),"%-7s", "unknow");
1875 if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC)
1876 sprintf(msg+strlen(msg),"%-3s", " Ad");
1878 sprintf(msg+strlen(msg),"%-3s", " In");
1880 sprintf(msg+strlen(msg),"\n");
1883 pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE;
1884 wrq->u.data.length = strlen(msg);
1885 Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);
1887 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length));
1888 os_free_mem(NULL, (PUCHAR)msg);
1892 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
1893 VOID RTMPIoctlGetMacTable(
1894 IN PRTMP_ADAPTER pAd,
1895 IN struct iwreq *wrq)
1898 RT_802_11_MAC_TABLE MacTab;
1902 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1904 if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC))
1906 COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr);
1907 MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid;
1908 MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode;
1909 MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode;
1911 // Fill in RSSI per entry
1912 MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0;
1913 MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1;
1914 MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2;
1916 // the connected time per entry
1917 MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime;
1918 MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS;
1919 MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW;
1920 MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI;
1921 MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC;
1922 MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv;
1923 MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE;
1924 MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word;
1929 wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE);
1930 if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length))
1932 DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__));
1935 msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG);
1936 memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN );
1937 sprintf(msg,"%s","\n");
1938 sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
1939 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
1941 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
1943 PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];
1944 if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC))
1946 if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) )
1948 sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ",
1949 pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],
1950 pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);
1951 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid);
1952 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode);
1953 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
1954 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
1955 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
1956 sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]);
1957 sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
1960 // for compatible with old API just do the printk to console
1961 //wrq->u.data.length = strlen(msg);
1962 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
1964 DBGPRINT(RT_DEBUG_TRACE, ("%s", msg));
1970 INT Set_BASetup_Proc(
1971 IN PRTMP_ADAPTER pAd,
1975 char *token, sepValue[] = ":", DASH = '-';
1977 MAC_TABLE_ENTRY *pEntry;
1980 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
1981 =>The six 2 digit hex-decimal number previous are the Mac address,
1982 =>The seventh decimal number is the tid value.
1985 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
1988 token = strchr(arg, DASH);
1989 if ((token != NULL) && (strlen(token)>1))
1991 tid = simple_strtol((token+1), 0, 10);
1996 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
1998 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2000 AtoH(token, (PUCHAR)(&mac[i]), 1);
2005 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1],
2006 mac[2], mac[3], mac[4], mac[5], tid);
2008 pEntry = MacTableLookup(pAd, mac);
2011 printk("\nSetup BA Session: Tid = %d\n", tid);
2012 BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE);
2022 INT Set_BADecline_Proc(
2023 IN PRTMP_ADAPTER pAd,
2028 bBADecline = simple_strtol(arg, 0, 10);
2030 if (bBADecline == 0)
2032 pAd->CommonCfg.bBADecline = FALSE;
2034 else if (bBADecline == 1)
2036 pAd->CommonCfg.bBADecline = TRUE;
2040 return FALSE; //Invalid argument
2043 DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline));
2048 INT Set_BAOriTearDown_Proc(
2049 IN PRTMP_ADAPTER pAd,
2053 char *token, sepValue[] = ":", DASH = '-';
2055 MAC_TABLE_ENTRY *pEntry;
2058 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2059 =>The six 2 digit hex-decimal number previous are the Mac address,
2060 =>The seventh decimal number is the tid value.
2062 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2065 token = strchr(arg, DASH);
2066 if ((token != NULL) && (strlen(token)>1))
2068 tid = simple_strtol((token+1), 0, 10);
2069 if (tid > NUM_OF_TID)
2073 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2075 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2077 AtoH(token, (PUCHAR)(&mac[i]), 1);
2082 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2083 mac[2], mac[3], mac[4], mac[5], tid);
2085 pEntry = MacTableLookup(pAd, mac);
2088 printk("\nTear down Ori BA Session: Tid = %d\n", tid);
2089 BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE);
2099 INT Set_BARecTearDown_Proc(
2100 IN PRTMP_ADAPTER pAd,
2104 char *token, sepValue[] = ":", DASH = '-';
2106 MAC_TABLE_ENTRY *pEntry;
2108 //printk("\n%s\n", arg);
2110 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2111 =>The six 2 digit hex-decimal number previous are the Mac address,
2112 =>The seventh decimal number is the tid value.
2114 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2117 token = strchr(arg, DASH);
2118 if ((token != NULL) && (strlen(token)>1))
2120 tid = simple_strtol((token+1), 0, 10);
2121 if (tid > NUM_OF_TID)
2125 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2127 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2129 AtoH(token, (PUCHAR)(&mac[i]), 1);
2134 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2135 mac[2], mac[3], mac[4], mac[5], tid);
2137 pEntry = MacTableLookup(pAd, mac);
2140 printk("\nTear down Rec BA Session: Tid = %d\n", tid);
2141 BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE);
2152 IN PRTMP_ADAPTER pAd,
2157 HtBw = simple_strtol(arg, 0, 10);
2159 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
2160 else if (HtBw == BW_20)
2161 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
2163 return FALSE; //Invalid argument
2167 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW));
2173 IN PRTMP_ADAPTER pAd,
2176 ULONG HtMcs, Mcs_tmp;
2177 BOOLEAN bAutoRate = FALSE;
2179 Mcs_tmp = simple_strtol(arg, 0, 10);
2181 if (Mcs_tmp <= 15 || Mcs_tmp == 32)
2187 pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs;
2188 pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE;
2189 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2190 pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch));
2192 if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) ||
2193 (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX))
2195 if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2196 (HtMcs >= 0 && HtMcs <= 3) &&
2197 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK))
2199 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000));
2201 else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2202 (HtMcs >= 0 && HtMcs <= 7) &&
2203 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM))
2205 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000));
2212 pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
2213 RTMPSetDesiredRates(pAd, -1);
2215 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode));
2227 IN PRTMP_ADAPTER pAd,
2232 HtGi = simple_strtol(arg, 0, 10);
2234 if ( HtGi == GI_400)
2235 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400;
2236 else if ( HtGi == GI_800 )
2237 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800;
2239 return FALSE; //Invalid argument
2243 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI));
2249 INT Set_HtTxBASize_Proc(
2250 IN PRTMP_ADAPTER pAd,
2255 Size = simple_strtol(arg, 0, 10);
2257 if (Size <=0 || Size >=64)
2261 pAd->CommonCfg.TxBASize = Size-1;
2262 DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size));
2268 INT Set_HtOpMode_Proc(
2269 IN PRTMP_ADAPTER pAd,
2275 Value = simple_strtol(arg, 0, 10);
2277 if (Value == HTMODE_GF)
2278 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF;
2279 else if ( Value == HTMODE_MM )
2280 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM;
2282 return FALSE; //Invalid argument
2286 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE));
2292 INT Set_HtStbc_Proc(
2293 IN PRTMP_ADAPTER pAd,
2299 Value = simple_strtol(arg, 0, 10);
2301 if (Value == STBC_USE)
2302 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE;
2303 else if ( Value == STBC_NONE )
2304 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE;
2306 return FALSE; //Invalid argument
2310 DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC));
2316 IN PRTMP_ADAPTER pAd,
2322 Value = simple_strtol(arg, 0, 10);
2324 pAd->HTCEnable = FALSE;
2325 else if ( Value ==1 )
2326 pAd->HTCEnable = TRUE;
2328 return FALSE; //Invalid argument
2330 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable));
2335 INT Set_HtExtcha_Proc(
2336 IN PRTMP_ADAPTER pAd,
2342 Value = simple_strtol(arg, 0, 10);
2345 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW;
2346 else if ( Value ==1 )
2347 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE;
2349 return FALSE; //Invalid argument
2353 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA));
2358 INT Set_HtMpduDensity_Proc(
2359 IN PRTMP_ADAPTER pAd,
2364 Value = simple_strtol(arg, 0, 10);
2366 if (Value <=7 && Value >= 0)
2367 pAd->CommonCfg.BACapability.field.MpduDensity = Value;
2369 pAd->CommonCfg.BACapability.field.MpduDensity = 4;
2373 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity));
2378 INT Set_HtBaWinSize_Proc(
2379 IN PRTMP_ADAPTER pAd,
2384 Value = simple_strtol(arg, 0, 10);
2387 if (Value >=1 && Value <= 64)
2389 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value;
2390 pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value;
2394 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64;
2395 pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64;
2400 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit));
2406 IN PRTMP_ADAPTER pAd,
2411 Value = simple_strtol(arg, 0, 10);
2414 pAd->CommonCfg.bRdg = FALSE;
2415 else if ( Value ==1 )
2417 pAd->HTCEnable = TRUE;
2418 pAd->CommonCfg.bRdg = TRUE;
2421 return FALSE; //Invalid argument
2425 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg));
2430 INT Set_HtLinkAdapt_Proc(
2431 IN PRTMP_ADAPTER pAd,
2436 Value = simple_strtol(arg, 0, 10);
2438 pAd->bLinkAdapt = FALSE;
2439 else if ( Value ==1 )
2441 pAd->HTCEnable = TRUE;
2442 pAd->bLinkAdapt = TRUE;
2445 return FALSE; //Invalid argument
2447 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt));
2452 INT Set_HtAmsdu_Proc(
2453 IN PRTMP_ADAPTER pAd,
2458 Value = simple_strtol(arg, 0, 10);
2460 pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE;
2461 else if ( Value == 1 )
2462 pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE;
2464 return FALSE; //Invalid argument
2468 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable));
2473 INT Set_HtAutoBa_Proc(
2474 IN PRTMP_ADAPTER pAd,
2479 Value = simple_strtol(arg, 0, 10);
2482 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
2483 pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE;
2485 else if (Value == 1)
2487 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
2488 pAd->CommonCfg.BACapability.field.Policy = IMMED_BA;
2491 return FALSE; //Invalid argument
2493 pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
2494 pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy;
2498 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA));
2504 INT Set_HtProtect_Proc(
2505 IN PRTMP_ADAPTER pAd,
2510 Value = simple_strtol(arg, 0, 10);
2512 pAd->CommonCfg.bHTProtect = FALSE;
2513 else if (Value == 1)
2514 pAd->CommonCfg.bHTProtect = TRUE;
2516 return FALSE; //Invalid argument
2518 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect));
2523 INT Set_SendPSMPAction_Proc(
2524 IN PRTMP_ADAPTER pAd,
2528 char *token, sepValue[] = ":", DASH = '-';
2530 MAC_TABLE_ENTRY *pEntry;
2532 //printk("\n%s\n", arg);
2534 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2535 =>The six 2 digit hex-decimal number previous are the Mac address,
2536 =>The seventh decimal number is the mode value.
2538 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2541 token = strchr(arg, DASH);
2542 if ((token != NULL) && (strlen(token)>1))
2544 mode = simple_strtol((token+1), 0, 10);
2545 if (mode > MMPS_ENABLE)
2549 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2551 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2553 AtoH(token, (PUCHAR)(&mac[i]), 1);
2558 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2559 mac[2], mac[3], mac[4], mac[5], mode);
2561 pEntry = MacTableLookup(pAd, mac);
2564 printk("\nSendPSMPAction MIPS mode = %d\n", mode);
2565 SendPSMPAction(pAd, pEntry->Aid, mode);
2576 INT Set_HtMIMOPSmode_Proc(
2577 IN PRTMP_ADAPTER pAd,
2582 Value = simple_strtol(arg, 0, 10);
2584 if (Value <=3 && Value >= 0)
2585 pAd->CommonCfg.BACapability.field.MMPSmode = Value;
2587 pAd->CommonCfg.BACapability.field.MMPSmode = 3;
2591 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode));
2597 INT Set_ForceShortGI_Proc(
2598 IN PRTMP_ADAPTER pAd,
2603 Value = simple_strtol(arg, 0, 10);
2605 pAd->WIFItestbed.bShortGI = FALSE;
2606 else if (Value == 1)
2607 pAd->WIFItestbed.bShortGI = TRUE;
2609 return FALSE; //Invalid argument
2613 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI));
2620 INT Set_ForceGF_Proc(
2621 IN PRTMP_ADAPTER pAd,
2626 Value = simple_strtol(arg, 0, 10);
2628 pAd->WIFItestbed.bGreenField = FALSE;
2629 else if (Value == 1)
2630 pAd->WIFItestbed.bGreenField = TRUE;
2632 return FALSE; //Invalid argument
2636 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField));
2641 INT Set_HtMimoPs_Proc(
2642 IN PRTMP_ADAPTER pAd,
2647 Value = simple_strtol(arg, 0, 10);
2649 pAd->CommonCfg.bMIMOPSEnable = FALSE;
2650 else if (Value == 1)
2651 pAd->CommonCfg.bMIMOPSEnable = TRUE;
2653 return FALSE; //Invalid argument
2655 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable));
2661 IN PRTMP_ADAPTER pAd)
2663 OID_SET_HT_PHYMODE SetHT;
2665 if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED)
2668 SetHT.PhyMode = pAd->CommonCfg.PhyMode;
2669 SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath);
2670 SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
2671 SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
2672 SetHT.MCS = MCS_AUTO;
2673 SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
2674 SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
2675 SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
2677 RTMPSetHT(pAd, &SetHT);
2682 INT Set_FixedTxMode_Proc(
2683 IN PRTMP_ADAPTER pAd,
2686 UCHAR fix_tx_mode = FIXED_TXMODE_HT;
2688 if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0)
2690 fix_tx_mode = FIXED_TXMODE_OFDM;
2692 else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0)
2694 fix_tx_mode = FIXED_TXMODE_CCK;
2697 pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode;
2699 DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode));
2704 /////////////////////////////////////////////////////////////////////////
2705 PCHAR RTMPGetRalinkAuthModeStr(
2706 IN NDIS_802_11_AUTHENTICATION_MODE authMode)
2710 case Ndis802_11AuthModeOpen:
2712 case Ndis802_11AuthModeWPAPSK:
2714 case Ndis802_11AuthModeShared:
2716 case Ndis802_11AuthModeWPA:
2718 case Ndis802_11AuthModeWPA2:
2720 case Ndis802_11AuthModeWPA2PSK:
2722 case Ndis802_11AuthModeWPA1PSKWPA2PSK:
2723 return "WPAPSKWPA2PSK";
2724 case Ndis802_11AuthModeWPA1WPA2:
2726 case Ndis802_11AuthModeWPANone:
2733 PCHAR RTMPGetRalinkEncryModeStr(
2734 IN USHORT encryMode)
2738 #if defined(RT2860) || defined(RT30xx)
2741 case Ndis802_11WEPDisabled:
2743 case Ndis802_11WEPEnabled:
2745 case Ndis802_11Encryption2Enabled:
2747 case Ndis802_11Encryption3Enabled:
2749 case Ndis802_11Encryption4Enabled:
2751 #if !defined(RT2860) && !defined(RT30xx)
2758 INT RTMPShowCfgValue(
2759 IN PRTMP_ADAPTER pAd,
2765 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++)
2767 if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name))
2769 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf))
2771 break; //Exit for loop.
2775 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL)
2777 sprintf(pBuf, "\n");
2778 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++)
2779 sprintf(pBuf + strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
2786 IN PRTMP_ADAPTER pAd,
2789 sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid);
2793 INT Show_WirelessMode_Proc(
2794 IN PRTMP_ADAPTER pAd,
2797 switch(pAd->CommonCfg.PhyMode)
2799 case PHY_11BG_MIXED:
2800 sprintf(pBuf, "\t11B/G");
2803 sprintf(pBuf, "\t11B");
2806 sprintf(pBuf, "\t11A");
2808 case PHY_11ABG_MIXED:
2809 sprintf(pBuf, "\t11A/B/G");
2812 sprintf(pBuf, "\t11G");
2814 case PHY_11ABGN_MIXED:
2815 sprintf(pBuf, "\t11A/B/G/N");
2818 sprintf(pBuf, "\t11N only with 2.4G");
2820 case PHY_11GN_MIXED:
2821 sprintf(pBuf, "\t11G/N");
2823 case PHY_11AN_MIXED:
2824 sprintf(pBuf, "\t11A/N");
2826 case PHY_11BGN_MIXED:
2827 sprintf(pBuf, "\t11B/G/N");
2829 case PHY_11AGN_MIXED:
2830 sprintf(pBuf, "\t11A/G/N");
2833 sprintf(pBuf, "\t11N only with 5G");
2836 sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode);
2843 INT Show_TxBurst_Proc(
2844 IN PRTMP_ADAPTER pAd,
2847 sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE");
2851 INT Show_TxPreamble_Proc(
2852 IN PRTMP_ADAPTER pAd,
2855 switch(pAd->CommonCfg.TxPreamble)
2857 case Rt802_11PreambleShort:
2858 sprintf(pBuf, "\tShort");
2860 case Rt802_11PreambleLong:
2861 sprintf(pBuf, "\tLong");
2863 case Rt802_11PreambleAuto:
2864 sprintf(pBuf, "\tAuto");
2867 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble);
2874 INT Show_TxPower_Proc(
2875 IN PRTMP_ADAPTER pAd,
2878 sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage);
2882 INT Show_Channel_Proc(
2883 IN PRTMP_ADAPTER pAd,
2886 sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel);
2890 INT Show_BGProtection_Proc(
2891 IN PRTMP_ADAPTER pAd,
2894 switch(pAd->CommonCfg.UseBGProtection)
2897 sprintf(pBuf, "\tON");
2899 case 2: //Always OFF
2900 sprintf(pBuf, "\tOFF");
2903 sprintf(pBuf, "\tAuto");
2906 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection);
2912 INT Show_RTSThreshold_Proc(
2913 IN PRTMP_ADAPTER pAd,
2916 sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold);
2920 INT Show_FragThreshold_Proc(
2921 IN PRTMP_ADAPTER pAd,
2924 sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold);
2929 IN PRTMP_ADAPTER pAd,
2932 if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
2934 sprintf(pBuf, "\t40 MHz");
2938 sprintf(pBuf, "\t20 MHz");
2943 INT Show_HtMcs_Proc(
2944 IN PRTMP_ADAPTER pAd,
2947 sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS);
2952 IN PRTMP_ADAPTER pAd,
2955 switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI)
2958 sprintf(pBuf, "\tGI_400");
2961 sprintf(pBuf, "\tGI_800");
2964 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI);
2970 INT Show_HtOpMode_Proc(
2971 IN PRTMP_ADAPTER pAd,
2974 switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE)
2977 sprintf(pBuf, "\tGF");
2980 sprintf(pBuf, "\tMM");
2983 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE);
2989 INT Show_HtExtcha_Proc(
2990 IN PRTMP_ADAPTER pAd,
2993 switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)
2996 sprintf(pBuf, "\tBelow");
2999 sprintf(pBuf, "\tAbove");
3002 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA);
3009 INT Show_HtMpduDensity_Proc(
3010 IN PRTMP_ADAPTER pAd,
3013 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity);
3017 INT Show_HtBaWinSize_Proc(
3018 IN PRTMP_ADAPTER pAd,
3021 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit);
3025 INT Show_HtRdg_Proc(
3026 IN PRTMP_ADAPTER pAd,
3029 sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE");
3033 INT Show_HtAmsdu_Proc(
3034 IN PRTMP_ADAPTER pAd,
3037 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE");
3041 INT Show_HtAutoBa_Proc(
3042 IN PRTMP_ADAPTER pAd,
3045 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE");
3049 INT Show_CountryRegion_Proc(
3050 IN PRTMP_ADAPTER pAd,
3053 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion);
3057 INT Show_CountryRegionABand_Proc(
3058 IN PRTMP_ADAPTER pAd,
3061 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand);
3065 INT Show_CountryCode_Proc(
3066 IN PRTMP_ADAPTER pAd,
3069 sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode);
3073 #ifdef AGGREGATION_SUPPORT
3074 INT Show_PktAggregate_Proc(
3075 IN PRTMP_ADAPTER pAd,
3078 sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE");
3081 #endif // AGGREGATION_SUPPORT //
3084 INT Show_WmmCapable_Proc(
3085 IN PRTMP_ADAPTER pAd,
3088 sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE");
3092 #endif // WMM_SUPPORT //
3094 INT Show_IEEE80211H_Proc(
3095 IN PRTMP_ADAPTER pAd,
3098 sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE");
3102 INT Show_NetworkType_Proc(
3103 IN PRTMP_ADAPTER pAd,
3106 switch(pAd->StaCfg.BssType)
3109 sprintf(pBuf, "\tAdhoc");
3112 sprintf(pBuf, "\tInfra");
3115 sprintf(pBuf, "\tAny");
3118 sprintf(pBuf, "\tMonitor");
3121 sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType);
3127 INT Show_AuthMode_Proc(
3128 IN PRTMP_ADAPTER pAd,
3131 NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen;
3133 AuthMode = pAd->StaCfg.AuthMode;
3135 if ((AuthMode >= Ndis802_11AuthModeOpen) &&
3136 (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK))
3137 sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode));
3139 sprintf(pBuf, "\tUnknow Value(%d)", AuthMode);
3144 INT Show_EncrypType_Proc(
3145 IN PRTMP_ADAPTER pAd,
3148 NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled;
3150 WepStatus = pAd->StaCfg.WepStatus;
3152 if ((WepStatus >= Ndis802_11WEPEnabled) &&
3153 (WepStatus <= Ndis802_11Encryption4KeyAbsent))
3154 sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus));
3156 sprintf(pBuf, "\tUnknow Value(%d)", WepStatus);
3161 INT Show_DefaultKeyID_Proc(
3162 IN PRTMP_ADAPTER pAd,
3165 UCHAR DefaultKeyId = 0;
3167 DefaultKeyId = pAd->StaCfg.DefaultKeyId;
3169 sprintf(pBuf, "\t%d", DefaultKeyId);
3174 INT Show_WepKey_Proc(
3175 IN PRTMP_ADAPTER pAd,
3179 UCHAR Key[16] = {0}, KeyLength = 0;
3182 KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen;
3183 NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength);
3185 //check key string is ASCII or not
3186 if (RTMPCheckStrPrintAble(Key, KeyLength))
3187 sprintf(pBuf, "\t%s", Key);
3191 sprintf(pBuf, "\t");
3192 for (idx = 0; idx < KeyLength; idx++)
3193 sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]);
3199 IN PRTMP_ADAPTER pAd,
3202 Show_WepKey_Proc(pAd, 0, pBuf);
3207 IN PRTMP_ADAPTER pAd,
3210 Show_WepKey_Proc(pAd, 1, pBuf);
3215 IN PRTMP_ADAPTER pAd,
3218 Show_WepKey_Proc(pAd, 2, pBuf);
3223 IN PRTMP_ADAPTER pAd,
3226 Show_WepKey_Proc(pAd, 3, pBuf);
3230 INT Show_WPAPSK_Proc(
3231 IN PRTMP_ADAPTER pAd,
3235 UCHAR PMK[32] = {0};
3237 NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32);
3239 sprintf(pBuf, "\tPMK = ");
3240 for (idx = 0; idx < 32; idx++)
3241 sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]);