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(
66 #ifdef DOT11_N_SUPPORT
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,
106 #endif // DOT11_N_SUPPORT //
108 INT Show_CountryRegion_Proc(
109 IN PRTMP_ADAPTER pAd,
112 INT Show_CountryRegionABand_Proc(
113 IN PRTMP_ADAPTER pAd,
116 INT Show_CountryCode_Proc(
117 IN PRTMP_ADAPTER pAd,
120 #ifdef AGGREGATION_SUPPORT
121 INT Show_PktAggregate_Proc(
122 IN PRTMP_ADAPTER pAd,
124 #endif // AGGREGATION_SUPPORT //
127 INT Show_WmmCapable_Proc(
128 IN PRTMP_ADAPTER pAd,
130 #endif // WMM_SUPPORT //
132 INT Show_IEEE80211H_Proc(
133 IN PRTMP_ADAPTER pAd,
136 #ifdef CONFIG_STA_SUPPORT
137 INT Show_NetworkType_Proc(
138 IN PRTMP_ADAPTER pAd,
140 #endif // CONFIG_STA_SUPPORT //
142 INT Show_AuthMode_Proc(
143 IN PRTMP_ADAPTER pAd,
146 INT Show_EncrypType_Proc(
147 IN PRTMP_ADAPTER pAd,
150 INT Show_DefaultKeyID_Proc(
151 IN PRTMP_ADAPTER pAd,
155 IN PRTMP_ADAPTER pAd,
159 IN PRTMP_ADAPTER pAd,
163 IN PRTMP_ADAPTER pAd,
167 IN PRTMP_ADAPTER pAd,
170 INT Show_WPAPSK_Proc(
171 IN PRTMP_ADAPTER pAd,
176 INT (*show_proc)(PRTMP_ADAPTER pAdapter, PUCHAR arg);
177 } *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = {
178 {"SSID", Show_SSID_Proc},
179 {"WirelessMode", Show_WirelessMode_Proc},
180 {"TxBurst", Show_TxBurst_Proc},
181 {"TxPreamble", Show_TxPreamble_Proc},
182 {"TxPower", Show_TxPower_Proc},
183 {"Channel", Show_Channel_Proc},
184 {"BGProtection", Show_BGProtection_Proc},
185 {"RTSThreshold", Show_RTSThreshold_Proc},
186 {"FragThreshold", Show_FragThreshold_Proc},
187 #ifdef DOT11_N_SUPPORT
188 {"HtBw", Show_HtBw_Proc},
189 {"HtMcs", Show_HtMcs_Proc},
190 {"HtGi", Show_HtGi_Proc},
191 {"HtOpMode", Show_HtOpMode_Proc},
192 {"HtExtcha", Show_HtExtcha_Proc},
193 {"HtMpduDensity", Show_HtMpduDensity_Proc},
194 {"HtBaWinSize", Show_HtBaWinSize_Proc},
195 {"HtRdg", Show_HtRdg_Proc},
196 {"HtAmsdu", Show_HtAmsdu_Proc},
197 {"HtAutoBa", Show_HtAutoBa_Proc},
198 #endif // DOT11_N_SUPPORT //
199 {"CountryRegion", Show_CountryRegion_Proc},
200 {"CountryRegionABand", Show_CountryRegionABand_Proc},
201 {"CountryCode", Show_CountryCode_Proc},
202 #ifdef AGGREGATION_SUPPORT
203 {"PktAggregate", Show_PktAggregate_Proc},
207 {"WmmCapable", Show_WmmCapable_Proc},
209 {"IEEE80211H", Show_IEEE80211H_Proc},
210 #ifdef CONFIG_STA_SUPPORT
211 {"NetworkType", Show_NetworkType_Proc},
212 #endif // CONFIG_STA_SUPPORT //
213 {"AuthMode", Show_AuthMode_Proc},
214 {"EncrypType", Show_EncrypType_Proc},
215 {"DefaultKeyID", Show_DefaultKeyID_Proc},
216 {"Key1", Show_Key1_Proc},
217 {"Key2", Show_Key2_Proc},
218 {"Key3", Show_Key3_Proc},
219 {"Key4", Show_Key4_Proc},
220 {"WPAPSK", Show_WPAPSK_Proc},
225 ==========================================================================
230 ==========================================================================
232 INT Set_DriverVersion_Proc(
233 IN PRTMP_ADAPTER pAd,
237 #ifdef CONFIG_STA_SUPPORT
238 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
239 DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION));
240 #endif // CONFIG_STA_SUPPORT //
246 ==========================================================================
249 This command will not work, if the field of CountryRegion in eeprom is programmed.
251 TRUE if all parameters are OK, FALSE otherwise
252 ==========================================================================
254 INT Set_CountryRegion_Proc(
255 IN PRTMP_ADAPTER pAd,
260 region = simple_strtol(arg, 0, 10);
262 #ifdef EXT_BUILD_CHANNEL_LIST
264 #endif // EXT_BUILD_CHANNEL_LIST //
266 // Country can be set only when EEPROM not programmed
267 if (pAd->CommonCfg.CountryRegion & 0x80)
269 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameter of CountryRegion in eeprom is programmed \n"));
273 if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND))
275 pAd->CommonCfg.CountryRegion = (UCHAR) region;
277 else if (region == REGION_31_BG_BAND)
279 pAd->CommonCfg.CountryRegion = (UCHAR) region;
283 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegion_Proc::parameters out of range\n"));
287 // if set country region, driver needs to be reset
288 BuildChannelList(pAd);
290 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion));
296 ==========================================================================
298 Set Country Region for A band.
299 This command will not work, if the field of CountryRegion in eeprom is programmed.
301 TRUE if all parameters are OK, FALSE otherwise
302 ==========================================================================
304 INT Set_CountryRegionABand_Proc(
305 IN PRTMP_ADAPTER pAd,
310 region = simple_strtol(arg, 0, 10);
312 #ifdef EXT_BUILD_CHANNEL_LIST
314 #endif // EXT_BUILD_CHANNEL_LIST //
316 // Country can be set only when EEPROM not programmed
317 if (pAd->CommonCfg.CountryRegionForABand & 0x80)
319 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameter of CountryRegion in eeprom is programmed \n"));
323 if((region >= 0) && (region <= REGION_MAXIMUM_A_BAND))
325 pAd->CommonCfg.CountryRegionForABand = (UCHAR) region;
329 DBGPRINT(RT_DEBUG_ERROR, ("Set_CountryRegionABand_Proc::parameters out of range\n"));
333 // if set country region, driver needs to be reset
334 BuildChannelList(pAd);
336 DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegionForABand));
342 ==========================================================================
346 TRUE if all parameters are OK, FALSE otherwise
347 ==========================================================================
349 INT Set_WirelessMode_Proc(
350 IN PRTMP_ADAPTER pAd,
356 WirelessMode = simple_strtol(arg, 0, 10);
359 #ifdef CONFIG_STA_SUPPORT
360 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
362 INT MaxPhyMode = PHY_11G;
364 #ifdef DOT11_N_SUPPORT
365 MaxPhyMode = PHY_11N_5G;
366 #endif // DOT11_N_SUPPORT //
368 if (WirelessMode <= MaxPhyMode)
370 RTMPSetPhyMode(pAd, WirelessMode);
371 #ifdef DOT11_N_SUPPORT
372 if (WirelessMode >= PHY_11ABGN_MIXED)
374 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
375 pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE;
379 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
380 pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE;
382 #endif // DOT11_N_SUPPORT //
383 // Set AdhocMode rates
384 if (pAd->StaCfg.BssType == BSS_ADHOC)
386 MlmeUpdateTxRates(pAd, FALSE, 0);
387 MakeIbssBeacon(pAd); // re-build BEACON frame
388 AsicEnableIbssSync(pAd); // copy to on-chip memory
396 #endif // CONFIG_STA_SUPPORT //
398 // it is needed to set SSID to take effect
401 #ifdef DOT11_N_SUPPORT
403 #endif // DOT11_N_SUPPORT //
404 DBGPRINT(RT_DEBUG_TRACE, ("Set_WirelessMode_Proc::(=%ld)\n", WirelessMode));
408 DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n"));
415 ==========================================================================
419 TRUE if all parameters are OK, FALSE otherwise
420 ==========================================================================
422 INT Set_Channel_Proc(
423 IN PRTMP_ADAPTER pAd,
429 Channel = (UCHAR) simple_strtol(arg, 0, 10);
431 // check if this channel is valid
432 if (ChannelSanity(pAd, Channel) == TRUE)
434 #ifdef CONFIG_STA_SUPPORT
435 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
437 pAd->CommonCfg.Channel = Channel;
441 #ifdef DOT11_N_SUPPORT
443 if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED &&
444 pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
447 AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
448 AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
449 DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n",
450 pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel));
453 #endif // DOT11_N_SUPPORT //
455 AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
456 AsicLockChannel(pAd, pAd->CommonCfg.Channel);
457 DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel));
461 #endif // CONFIG_STA_SUPPORT //
467 #ifdef CONFIG_STA_SUPPORT
468 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
470 #endif // CONFIG_STA_SUPPORT //
475 DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel));
481 ==========================================================================
483 Set Short Slot Time Enable or Disable
485 TRUE if all parameters are OK, FALSE otherwise
486 ==========================================================================
488 INT Set_ShortSlot_Proc(
489 IN PRTMP_ADAPTER pAd,
494 ShortSlot = simple_strtol(arg, 0, 10);
497 pAd->CommonCfg.bUseShortSlotTime = TRUE;
498 else if (ShortSlot == 0)
499 pAd->CommonCfg.bUseShortSlotTime = FALSE;
501 return FALSE; //Invalid argument
503 DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime));
509 ==========================================================================
513 TRUE if all parameters are OK, FALSE otherwise
514 ==========================================================================
516 INT Set_TxPower_Proc(
517 IN PRTMP_ADAPTER pAd,
523 TxPower = (ULONG) simple_strtol(arg, 0, 10);
527 #ifdef CONFIG_STA_SUPPORT
528 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
530 pAd->CommonCfg.TxPowerDefault = TxPower;
531 pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
533 #endif // CONFIG_STA_SUPPORT //
539 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
545 ==========================================================================
547 Set 11B/11G Protection
549 TRUE if all parameters are OK, FALSE otherwise
550 ==========================================================================
552 INT Set_BGProtection_Proc(
553 IN PRTMP_ADAPTER pAd,
556 switch (simple_strtol(arg, 0, 10))
559 pAd->CommonCfg.UseBGProtection = 0;
562 pAd->CommonCfg.UseBGProtection = 1;
565 pAd->CommonCfg.UseBGProtection = 2;
567 default: //Invalid argument
572 DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection));
578 ==========================================================================
582 TRUE if all parameters are OK, FALSE otherwise
583 ==========================================================================
585 INT Set_TxPreamble_Proc(
586 IN PRTMP_ADAPTER pAd,
589 RT_802_11_PREAMBLE Preamble;
591 Preamble = simple_strtol(arg, 0, 10);
596 case Rt802_11PreambleShort:
597 pAd->CommonCfg.TxPreamble = Preamble;
598 #ifdef CONFIG_STA_SUPPORT
599 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
600 MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);
601 #endif // CONFIG_STA_SUPPORT //
603 case Rt802_11PreambleLong:
604 #ifdef CONFIG_STA_SUPPORT
605 case Rt802_11PreambleAuto:
606 // if user wants AUTO, initialize to LONG here, then change according to AP's
607 // capability upon association.
608 #endif // CONFIG_STA_SUPPORT //
609 pAd->CommonCfg.TxPreamble = Preamble;
610 #ifdef CONFIG_STA_SUPPORT
611 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
612 MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);
613 #endif // CONFIG_STA_SUPPORT //
615 default: //Invalid argument
619 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble));
625 ==========================================================================
629 TRUE if all parameters are OK, FALSE otherwise
630 ==========================================================================
632 INT Set_RTSThreshold_Proc(
633 IN PRTMP_ADAPTER pAd,
636 NDIS_802_11_RTS_THRESHOLD RtsThresh;
638 RtsThresh = simple_strtol(arg, 0, 10);
640 if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD))
641 pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
642 #ifdef CONFIG_STA_SUPPORT
643 else if (RtsThresh == 0)
644 pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;
645 #endif // CONFIG_STA_SUPPORT //
647 return FALSE; //Invalid argument
649 DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold));
655 ==========================================================================
657 Set Fragment Threshold
659 TRUE if all parameters are OK, FALSE otherwise
660 ==========================================================================
662 INT Set_FragThreshold_Proc(
663 IN PRTMP_ADAPTER pAd,
666 NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
668 FragThresh = simple_strtol(arg, 0, 10);
670 if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)
672 //Illegal FragThresh so we set it to default
673 pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
675 else if (FragThresh % 2 == 1)
677 // The length of each fragment shall always be an even number of octets, except for the last fragment
678 // of an MSDU or MMPDU, which may be either an even or an odd number of octets.
679 pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1);
683 pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
686 #ifdef CONFIG_STA_SUPPORT
687 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
689 if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)
690 pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;
692 pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;
694 #endif // CONFIG_STA_SUPPORT //
696 DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold));
702 ==========================================================================
706 TRUE if all parameters are OK, FALSE otherwise
707 ==========================================================================
709 INT Set_TxBurst_Proc(
710 IN PRTMP_ADAPTER pAd,
715 TxBurst = simple_strtol(arg, 0, 10);
717 pAd->CommonCfg.bEnableTxBurst = TRUE;
718 else if (TxBurst == 0)
719 pAd->CommonCfg.bEnableTxBurst = FALSE;
721 return FALSE; //Invalid argument
723 DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst));
728 #ifdef AGGREGATION_SUPPORT
730 ==========================================================================
734 TRUE if all parameters are OK, FALSE otherwise
735 ==========================================================================
737 INT Set_PktAggregate_Proc(
738 IN PRTMP_ADAPTER pAd,
743 aggre = simple_strtol(arg, 0, 10);
746 pAd->CommonCfg.bAggregationCapable = TRUE;
748 pAd->CommonCfg.bAggregationCapable = FALSE;
750 return FALSE; //Invalid argument
753 DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable));
760 ==========================================================================
763 This parameter is 1 when needs radar detection, otherwise 0
765 TRUE if all parameters are OK, FALSE otherwise
766 ==========================================================================
768 INT Set_IEEE80211H_Proc(
769 IN PRTMP_ADAPTER pAd,
774 ieee80211h = simple_strtol(arg, 0, 10);
777 pAd->CommonCfg.bIEEE80211H = TRUE;
778 else if (ieee80211h == 0)
779 pAd->CommonCfg.bIEEE80211H = FALSE;
781 return FALSE; //Invalid argument
783 DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H));
791 ==========================================================================
793 For Debug information
795 TRUE if all parameters are OK, FALSE otherwise
796 ==========================================================================
799 IN PRTMP_ADAPTER pAd,
802 DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n"));
804 if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD)
805 RTDebugLevel = simple_strtol(arg, 0, 10);
807 DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel));
813 INT Show_DescInfo_Proc(
814 IN PRTMP_ADAPTER pAd,
822 ==========================================================================
824 Reset statistics counter
827 pAdapter Pointer to our adapter
831 TRUE if all parameters are OK, FALSE otherwise
832 ==========================================================================
834 INT Set_ResetStatCounter_Proc(
835 IN PRTMP_ADAPTER pAd,
839 //MAC_TABLE_ENTRY *pEntry;
841 DBGPRINT(RT_DEBUG_TRACE, ("==>Set_ResetStatCounter_Proc\n"));
843 // add the most up-to-date h/w raw counters into software counters
844 NICUpdateRawCounters(pAd);
846 NdisZeroMemory(&pAd->WlanCounters, sizeof(COUNTER_802_11));
847 NdisZeroMemory(&pAd->Counters8023, sizeof(COUNTER_802_3));
848 NdisZeroMemory(&pAd->RalinkCounters, sizeof(COUNTER_RALINK));
850 // Reset HotSpot counter
852 for (i = 0; i < MAX_LEN_OF_MAC_TABLE; i++)
854 pEntry = &pAd->MacTab.Content[i];
856 if ((pEntry->Valid == FALSE) || (pEntry->Sst != SST_ASSOC))
859 pEntry->HSCounter.LastDataPacketTime = 0;
860 pEntry->HSCounter.TotalRxByteCount= 0;
861 pEntry->HSCounter.TotalTxByteCount= 0;
870 ========================================================================
874 In Adhoc WPANONE, bPairwise = 0; KeyIdx = 0;
877 pAd Pointer to our adapter
878 pBuf Pointer to the where the key stored
881 NDIS_SUCCESS Add key successfully
883 IRQL = DISPATCH_LEVEL
887 ========================================================================
889 #if 0 // remove by AlbertY
890 NDIS_STATUS RTMPWPAAddKeyProc(
891 IN PRTMP_ADAPTER pAd,
894 PNDIS_802_11_KEY pKey;
896 // NDIS_STATUS Status;
897 // ULONG offset; // unused variable, snowpin 2006.07.13
899 PUCHAR pTxMic, pRxMic;
900 BOOLEAN bTxKey; // Set the key as transmit key
901 BOOLEAN bPairwise; // Indicate the key is pairwise key
902 BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value.
903 // Otherwise, it will set by the NIC.
904 BOOLEAN bAuthenticator; // indicate key is set by authenticator.
907 pKey = (PNDIS_802_11_KEY) pBuf;
908 KeyIdx = pKey->KeyIndex & 0xff;
909 // Bit 31 of Add-key, Tx Key
910 bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE;
911 // Bit 30 of Add-key PairwiseKey
912 bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE;
913 // Bit 29 of Add-key KeyRSC
914 bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE;
915 // Bit 28 of Add-key Authenticator
916 bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE;
918 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPAAddKeyProc==>pKey->KeyIndex = %x. bPairwise= %d\n", pKey->KeyIndex, bPairwise));
919 // 1. Check Group / Pairwise Key
920 if (bPairwise) // Pairwise Key
922 // 1. KeyIdx must be 0, otherwise, return NDIS_STATUS_INVALID_DATA
924 return(NDIS_STATUS_INVALID_DATA);
926 // 2. Check bTx, it must be true, otherwise, return NDIS_STATUS_INVALID_DATA
928 return(NDIS_STATUS_INVALID_DATA);
930 // 3. If BSSID is all 0xff, return NDIS_STATUS_INVALID_DATA
931 if (MAC_ADDR_EQUAL(pKey->BSSID, BROADCAST_ADDR))
932 return(NDIS_STATUS_INVALID_DATA);
934 // 3.1 Check Pairwise key length for TKIP key. For AES, it's always 128 bits
935 //if ((pAdapter->PortCfg.WepStatus == Ndis802_11Encryption2Enabled) && (pKey->KeyLength != LEN_TKIP_KEY))
936 if ((pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) && (pKey->KeyLength != LEN_TKIP_KEY))
937 return(NDIS_STATUS_INVALID_DATA);
939 pAd->SharedKey[apidx][KeyIdx].Type = PAIRWISE_KEY;
941 if (pAd->ApCfg.MBSSID[apidx].AuthMode == Ndis802_11AuthModeWPA2)
943 // Send media specific event to start PMKID caching
944 RTMPIndicateWPA2Status(pAd);
949 // 1. Check BSSID, if not current BSSID or Bcast, return NDIS_STATUS_INVALID_DATA
950 if ((! MAC_ADDR_EQUAL(pKey->BSSID, BROADCAST_ADDR)) &&
951 (! MAC_ADDR_EQUAL(pKey->BSSID, pAd->ApCfg.MBSSID[apidx].Bssid)))
952 return(NDIS_STATUS_INVALID_DATA);
954 // 2. Check Key index for supported Group Key
955 if (KeyIdx >= GROUP_KEY_NUM)
956 return(NDIS_STATUS_INVALID_DATA);
958 // 3. Set as default Tx Key if bTxKey is TRUE
960 pAd->ApCfg.MBSSID[apidx].DefaultKeyId = (UCHAR) KeyIdx;
962 pAd->SharedKey[apidx][KeyIdx].Type = GROUP_KEY;
965 // 4. Select RxMic / TxMic based on Supp / Authenticator
966 if (pAd->ApCfg.MBSSID[apidx].AuthMode == Ndis802_11AuthModeWPANone)
968 // for WPA-None Tx, Rx MIC is the same
969 pTxMic = (PUCHAR) (&pKey->KeyMaterial) + 16;
972 else if (bAuthenticator == TRUE)
974 pTxMic = (PUCHAR) (&pKey->KeyMaterial) + 16;
975 pRxMic = (PUCHAR) (&pKey->KeyMaterial) + 24;
979 pRxMic = (PUCHAR) (&pKey->KeyMaterial) + 16;
980 pTxMic = (PUCHAR) (&pKey->KeyMaterial) + 24;
986 NdisMoveMemory(pAd->SharedKey[apidx][KeyIdx].RxTsc, &pKey->KeyRSC, 6);
987 NdisMoveMemory(pAd->MacTab.Content[BSSID_WCID].PairwiseKey.RxTsc, &pKey->KeyRSC, 6);
991 NdisZeroMemory(pAd->SharedKey[apidx][KeyIdx].RxTsc, 6);
994 // 7. Copy information into Pairwise Key structure.
995 // pKey->KeyLength will include TxMic and RxMic, therefore, we use 16 bytes hardcoded.
996 pAd->SharedKey[apidx][KeyIdx].KeyLen = (UCHAR) pKey->KeyLength;
997 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.KeyLen = (UCHAR)pKey->KeyLength;
998 NdisMoveMemory(pAd->SharedKey[BSS0][KeyIdx].Key, &pKey->KeyMaterial, 16);
999 NdisMoveMemory(pAd->MacTab.Content[BSSID_WCID].PairwiseKey.Key, &pKey->KeyMaterial, 16);
1000 if (pKey->KeyLength == LEN_TKIP_KEY)
1002 // Only Key lenth equal to TKIP key have these
1003 NdisMoveMemory(pAd->SharedKey[apidx][KeyIdx].RxMic, pRxMic, 8);
1004 NdisMoveMemory(pAd->SharedKey[apidx][KeyIdx].TxMic, pTxMic, 8);
1005 NdisMoveMemory(pAd->MacTab.Content[BSSID_WCID].PairwiseKey.RxMic, pRxMic, 8);
1006 NdisMoveMemory(pAd->MacTab.Content[BSSID_WCID].PairwiseKey.TxMic, pTxMic, 8);
1009 COPY_MAC_ADDR(pAd->SharedKey[BSS0][KeyIdx].BssId, pKey->BSSID);
1011 // Init TxTsc to one based on WiFi WPA specs
1012 pAd->SharedKey[apidx][KeyIdx].TxTsc[0] = 1;
1013 pAd->SharedKey[apidx][KeyIdx].TxTsc[1] = 0;
1014 pAd->SharedKey[apidx][KeyIdx].TxTsc[2] = 0;
1015 pAd->SharedKey[apidx][KeyIdx].TxTsc[3] = 0;
1016 pAd->SharedKey[apidx][KeyIdx].TxTsc[4] = 0;
1017 pAd->SharedKey[apidx][KeyIdx].TxTsc[5] = 0;
1018 // 4. Init TxTsc to one based on WiFi WPA specs
1019 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.TxTsc[0] = 1;
1020 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.TxTsc[1] = 0;
1021 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.TxTsc[2] = 0;
1022 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.TxTsc[3] = 0;
1023 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.TxTsc[4] = 0;
1024 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.TxTsc[5] = 0;
1026 if (pAd->ApCfg.MBSSID[apidx].WepStatus == Ndis802_11Encryption3Enabled)
1028 pAd->SharedKey[apidx][KeyIdx].CipherAlg = CIPHER_AES;
1029 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = CIPHER_AES;
1031 else if (pAd->ApCfg.MBSSID[apidx].WepStatus == Ndis802_11Encryption2Enabled)
1033 pAd->SharedKey[apidx][KeyIdx].CipherAlg = CIPHER_TKIP;
1034 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = CIPHER_TKIP;
1036 else if (pAd->ApCfg.MBSSID[apidx].WepStatus == Ndis802_11Encryption1Enabled)
1038 if (pAd->SharedKey[apidx][KeyIdx].KeyLen == 5)
1040 pAd->SharedKey[apidx][KeyIdx].CipherAlg = CIPHER_WEP64;
1041 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = CIPHER_WEP64;
1043 else if (pAd->SharedKey[apidx][KeyIdx].KeyLen == 13)
1045 pAd->SharedKey[apidx][KeyIdx].CipherAlg = CIPHER_WEP128;
1046 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = CIPHER_WEP128;
1050 pAd->SharedKey[apidx][KeyIdx].CipherAlg = CIPHER_NONE;
1051 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = CIPHER_NONE;
1056 pAd->SharedKey[apidx][KeyIdx].CipherAlg = CIPHER_NONE;
1057 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = CIPHER_NONE;
1060 if ((pAd->OpMode == OPMODE_STA)) // Pairwise Key. Add BSSID to WCTable
1062 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.CipherAlg = pAd->SharedKey[BSS0][KeyIdx].CipherAlg;
1063 pAd->MacTab.Content[BSSID_WCID].PairwiseKey.KeyLen = pAd->SharedKey[BSS0][KeyIdx].KeyLen;
1066 if ((pAd->ApCfg.MBSSID[apidx].AuthMode == Ndis802_11AuthModeWPA2) ||
1067 (pAd->ApCfg.MBSSID[apidx].AuthMode == Ndis802_11AuthModeWPA2PSK))
1070 // On WPA2, Update Group Key Cipher.
1074 if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption3Enabled)
1075 pAd->SharedKey[apidx][KeyIdx].CipherAlg = CIPHER_AES;
1076 else if (pAd->StaCfg.GroupCipher == Ndis802_11Encryption2Enabled)
1077 pAd->SharedKey[apidx][KeyIdx].CipherAlg = CIPHER_TKIP;
1081 DBGPRINT(RT_DEBUG_TRACE, ("pAd->SharedKey[%d][%d].CipherAlg = %d\n", apidx, KeyIdx, pAd->SharedKey[apidx][KeyIdx].CipherAlg));
1084 DBGPRINT_RAW(RT_DEBUG_TRACE, ("%s Key #%d", CipherName[pAd->SharedKey[apidx][KeyIdx].CipherAlg],KeyIdx));
1085 for (i = 0; i < 16; i++)
1087 DBGPRINT_RAW(RT_DEBUG_TRACE, ("%02x:", pAd->SharedKey[apidx][KeyIdx].Key[i]));
1089 DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n Rx MIC Key = "));
1090 for (i = 0; i < 8; i++)
1092 DBGPRINT_RAW(RT_DEBUG_TRACE, ("%02x:", pAd->SharedKey[apidx][KeyIdx].RxMic[i]));
1094 DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n Tx MIC Key = "));
1095 for (i = 0; i < 8; i++)
1097 DBGPRINT_RAW(RT_DEBUG_TRACE, ("%02x:", pAd->SharedKey[apidx][KeyIdx].TxMic[i]));
1099 DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n RxTSC = "));
1100 for (i = 0; i < 6; i++)
1102 DBGPRINT_RAW(RT_DEBUG_TRACE, ("%02x:", pAd->SharedKey[apidx][KeyIdx].RxTsc[i]));
1105 DBGPRINT_RAW(RT_DEBUG_TRACE, ("\n pKey-> BSSID:%02x:%02x:%02x:%02x:%02x:%02x \n",
1106 pKey->BSSID[0],pKey->BSSID[1],pKey->BSSID[2],pKey->BSSID[3],pKey->BSSID[4],pKey->BSSID[5]));
1108 if ((bTxKey) && (pAd->OpMode == OPMODE_STA)) // Pairwise Key. Add BSSID to WCTable
1109 RTMPAddBSSIDCipher(pAd, BSSID_WCID, pKey, pAd->SharedKey[BSS0][KeyIdx].CipherAlg);
1112 // No matter pairwise key or what leyidx is, always has a copy at on-chip SharedKeytable.
1113 AsicAddSharedKeyEntry(pAd,
1116 pAd->SharedKey[apidx][KeyIdx].CipherAlg,
1117 pAd->SharedKey[apidx][KeyIdx].Key,
1118 pAd->SharedKey[apidx][KeyIdx].TxMic,
1119 pAd->SharedKey[apidx][KeyIdx].RxMic);
1121 // The WCID key specified in used at Tx. For STA, always use pairwise key.
1123 // ad-hoc mode need to specify WAP Group key with WCID index=BSS0Mcast_WCID. Let's always set this key here.
1124 /* if (bPairwise == FALSE)
1126 offset = MAC_IVEIV_TABLE_BASE + (BSS0Mcast_WCID * HW_IVEIV_ENTRY_SIZE);
1127 NdisZeroMemory(IVEIV, 8);
1129 // Specify key index to find shared key.
1130 if ((pAd->SharedKey[BSS0][KeyIdx].CipherAlg==CIPHER_TKIP) ||
1131 (pAd->SharedKey[BSS0][KeyIdx].CipherAlg==CIPHER_AES))
1132 IVEIV[3] = 0x20; // Eiv bit on. keyid always 0 for pairwise key
1133 IVEIV[3] |= (KeyIdx<< 6); // groupkey index is not 0
1136 RTMP_IO_WRITE8(pAd, offset+i, IVEIV[i]);
1139 // 2. WCID Attribute UDF:3, BSSIdx:3, Alg:3, Keytable:use share key, BSSIdx is 0
1140 WCIDAttri = (pAd->SharedKey[BSS0][KeyIdx].CipherAlg<<1)|PAIRWISEKEYTABLE;
1141 offset = MAC_WCID_ATTRIBUTE_BASE + (BSS0Mcast_WCID* HW_WCID_ATTRI_SIZE);
1142 RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
1148 if (pAd->SharedKey[apidx][KeyIdx].Type == GROUP_KEY)
1150 // 802.1x port control
1151 pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED;
1152 DBGPRINT(RT_DEBUG_TRACE,("!!WPA_802_1X_PORT_SECURED!!\n"));
1156 return (NDIS_STATUS_SUCCESS);
1160 BOOLEAN RTMPCheckStrPrintAble(
1166 for (i=0; i<strLen; i++)
1168 if ((pInPutStr[i] < 0x21) ||
1169 (pInPutStr[i] > 0x7E))
1177 ========================================================================
1179 Routine Description:
1180 Remove WPA Key process
1183 pAd Pointer to our adapter
1184 pBuf Pointer to the where the key stored
1187 NDIS_SUCCESS Add key successfully
1189 IRQL = DISPATCH_LEVEL
1193 ========================================================================
1195 #ifdef CONFIG_STA_SUPPORT
1196 VOID RTMPSetDesiredRates(
1197 IN PRTMP_ADAPTER pAdapter,
1200 NDIS_802_11_RATES aryRates;
1202 memset(&aryRates, 0x00, sizeof(NDIS_802_11_RATES));
1203 switch (pAdapter->CommonCfg.PhyMode)
1205 case PHY_11A: // A only
1209 aryRates[0] = 0x0c; // 6M
1210 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
1213 aryRates[0] = 0x12; // 9M
1214 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
1216 case 12000000: //12M
1217 aryRates[0] = 0x18; // 12M
1218 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
1220 case 18000000: //18M
1221 aryRates[0] = 0x24; // 18M
1222 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
1224 case 24000000: //24M
1225 aryRates[0] = 0x30; // 24M
1226 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
1228 case 36000000: //36M
1229 aryRates[0] = 0x48; // 36M
1230 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
1232 case 48000000: //48M
1233 aryRates[0] = 0x60; // 48M
1234 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
1236 case 54000000: //54M
1237 aryRates[0] = 0x6c; // 54M
1238 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
1242 aryRates[0] = 0x6c; // 54Mbps
1243 aryRates[1] = 0x60; // 48Mbps
1244 aryRates[2] = 0x48; // 36Mbps
1245 aryRates[3] = 0x30; // 24Mbps
1246 aryRates[4] = 0x24; // 18M
1247 aryRates[5] = 0x18; // 12M
1248 aryRates[6] = 0x12; // 9M
1249 aryRates[7] = 0x0c; // 6M
1250 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
1254 case PHY_11BG_MIXED: // B/G Mixed
1255 case PHY_11B: // B only
1256 case PHY_11ABG_MIXED: // A/B/G Mixed
1262 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
1266 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
1268 case 5000000: //5.5M
1269 aryRates[0] = 0x0b; // 5.5M
1270 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
1272 case 11000000: //11M
1273 aryRates[0] = 0x16; // 11M
1274 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
1277 aryRates[0] = 0x0c; // 6M
1278 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_0;
1281 aryRates[0] = 0x12; // 9M
1282 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_1;
1284 case 12000000: //12M
1285 aryRates[0] = 0x18; // 12M
1286 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_2;
1288 case 18000000: //18M
1289 aryRates[0] = 0x24; // 18M
1290 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_3;
1292 case 24000000: //24M
1293 aryRates[0] = 0x30; // 24M
1294 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_4;
1296 case 36000000: //36M
1297 aryRates[0] = 0x48; // 36M
1298 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_5;
1300 case 48000000: //48M
1301 aryRates[0] = 0x60; // 48M
1302 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_6;
1304 case 54000000: //54M
1305 aryRates[0] = 0x6c; // 54M
1306 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_7;
1310 if (pAdapter->CommonCfg.PhyMode == PHY_11B)
1312 aryRates[0] = 0x16; // 11Mbps
1313 aryRates[1] = 0x0b; // 5.5Mbps
1314 aryRates[2] = 0x04; // 2Mbps
1315 aryRates[3] = 0x02; // 1Mbps
1318 { //(B/G) Mixed or (A/B/G) Mixed
1319 aryRates[0] = 0x6c; // 54Mbps
1320 aryRates[1] = 0x60; // 48Mbps
1321 aryRates[2] = 0x48; // 36Mbps
1322 aryRates[3] = 0x30; // 24Mbps
1323 aryRates[4] = 0x16; // 11Mbps
1324 aryRates[5] = 0x0b; // 5.5Mbps
1325 aryRates[6] = 0x04; // 2Mbps
1326 aryRates[7] = 0x02; // 1Mbps
1328 pAdapter->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
1334 NdisZeroMemory(pAdapter->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1335 NdisMoveMemory(pAdapter->CommonCfg.DesireRate, &aryRates, sizeof(NDIS_802_11_RATES));
1336 DBGPRINT(RT_DEBUG_TRACE, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
1337 pAdapter->CommonCfg.DesireRate[0],pAdapter->CommonCfg.DesireRate[1],
1338 pAdapter->CommonCfg.DesireRate[2],pAdapter->CommonCfg.DesireRate[3],
1339 pAdapter->CommonCfg.DesireRate[4],pAdapter->CommonCfg.DesireRate[5],
1340 pAdapter->CommonCfg.DesireRate[6],pAdapter->CommonCfg.DesireRate[7] ));
1341 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
1342 MlmeUpdateTxRates(pAdapter, FALSE, 0);
1345 NDIS_STATUS RTMPWPARemoveKeyProc(
1346 IN PRTMP_ADAPTER pAd,
1349 PNDIS_802_11_REMOVE_KEY pKey;
1351 NDIS_STATUS Status = NDIS_STATUS_FAILURE;
1352 BOOLEAN bTxKey; // Set the key as transmit key
1353 BOOLEAN bPairwise; // Indicate the key is pairwise key
1354 BOOLEAN bKeyRSC; // indicate the receive SC set by KeyRSC value.
1355 // Otherwise, it will set by the NIC.
1356 BOOLEAN bAuthenticator; // indicate key is set by authenticator.
1359 DBGPRINT(RT_DEBUG_TRACE,("---> RTMPWPARemoveKeyProc\n"));
1361 pKey = (PNDIS_802_11_REMOVE_KEY) pBuf;
1362 KeyIdx = pKey->KeyIndex & 0xff;
1363 // Bit 31 of Add-key, Tx Key
1364 bTxKey = (pKey->KeyIndex & 0x80000000) ? TRUE : FALSE;
1365 // Bit 30 of Add-key PairwiseKey
1366 bPairwise = (pKey->KeyIndex & 0x40000000) ? TRUE : FALSE;
1367 // Bit 29 of Add-key KeyRSC
1368 bKeyRSC = (pKey->KeyIndex & 0x20000000) ? TRUE : FALSE;
1369 // Bit 28 of Add-key Authenticator
1370 bAuthenticator = (pKey->KeyIndex & 0x10000000) ? TRUE : FALSE;
1372 // 1. If bTx is TRUE, return failure information
1374 return(NDIS_STATUS_INVALID_DATA);
1376 // 2. Check Pairwise Key
1379 // a. If BSSID is broadcast, remove all pairwise keys.
1380 // b. If not broadcast, remove the pairwise specified by BSSID
1381 for (i = 0; i < SHARE_KEY_NUM; i++)
1383 if (MAC_ADDR_EQUAL(pAd->SharedKey[BSS0][i].BssId, pKey->BSSID))
1385 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i));
1386 pAd->SharedKey[BSS0][i].KeyLen = 0;
1387 pAd->SharedKey[BSS0][i].CipherAlg = CIPHER_NONE;
1388 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)i);
1389 Status = NDIS_STATUS_SUCCESS;
1397 // a. If BSSID is broadcast, remove all group keys indexed
1398 // b. If BSSID matched, delete the group key indexed.
1399 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx));
1400 pAd->SharedKey[BSS0][KeyIdx].KeyLen = 0;
1401 pAd->SharedKey[BSS0][KeyIdx].CipherAlg = CIPHER_NONE;
1402 AsicRemoveSharedKeyEntry(pAd, BSS0, (UCHAR)KeyIdx);
1403 Status = NDIS_STATUS_SUCCESS;
1408 #endif // CONFIG_STA_SUPPORT //
1411 #ifdef CONFIG_STA_SUPPORT
1413 ========================================================================
1415 Routine Description:
1419 pAd Pointer to our adapter
1424 IRQL = DISPATCH_LEVEL
1428 ========================================================================
1430 VOID RTMPWPARemoveAllKeys(
1431 IN PRTMP_ADAPTER pAd)
1436 DBGPRINT(RT_DEBUG_TRACE,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus));
1438 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1439 // Link up. And it will be replaced if user changed it.
1440 if (pAd->StaCfg.AuthMode < Ndis802_11AuthModeWPA)
1443 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1444 // Link up. And it will be replaced if user changed it.
1445 if (pAd->StaCfg.AuthMode == Ndis802_11AuthModeWPANone)
1448 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1449 AsicRemovePairwiseKeyEntry(pAd, BSS0, BSSID_WCID);
1451 // set all shared key mode as no-security.
1452 for (i = 0; i < SHARE_KEY_NUM; i++)
1454 DBGPRINT(RT_DEBUG_TRACE,("remove %s key #%d\n", CipherName[pAd->SharedKey[BSS0][i].CipherAlg], i));
1455 NdisZeroMemory(&pAd->SharedKey[BSS0][i], sizeof(CIPHER_KEY));
1457 AsicRemoveSharedKeyEntry(pAd, BSS0, i);
1461 #endif // CONFIG_STA_SUPPORT //
1464 ========================================================================
1465 Routine Description:
1466 Change NIC PHY mode. Re-association may be necessary. possible settings
1467 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1470 pAd - Pointer to our adapter
1473 IRQL = PASSIVE_LEVEL
1474 IRQL = DISPATCH_LEVEL
1476 ========================================================================
1478 VOID RTMPSetPhyMode(
1479 IN PRTMP_ADAPTER pAd,
1483 // the selected phymode must be supported by the RF IC encoded in E2PROM
1485 // if no change, do nothing
1487 if (pAd->CommonCfg.PhyMode == phymode)
1490 pAd->CommonCfg.PhyMode = (UCHAR)phymode;
1492 DBGPRINT(RT_DEBUG_TRACE,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd->CommonCfg.PhyMode, pAd->CommonCfg.Channel));
1493 #ifdef EXT_BUILD_CHANNEL_LIST
1494 BuildChannelListEx(pAd);
1496 BuildChannelList(pAd);
1497 #endif // EXT_BUILD_CHANNEL_LIST //
1499 // sanity check user setting
1500 for (i = 0; i < pAd->ChannelListNum; i++)
1502 if (pAd->CommonCfg.Channel == pAd->ChannelList[i].Channel)
1506 if (i == pAd->ChannelListNum)
1508 #ifdef CONFIG_STA_SUPPORT
1509 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1510 pAd->CommonCfg.Channel = FirstChannel(pAd);
1511 #endif // CONFIG_STA_SUPPORT //
1512 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd->CommonCfg.Channel));
1515 NdisZeroMemory(pAd->CommonCfg.SupRate, MAX_LEN_OF_SUPPORTED_RATES);
1516 NdisZeroMemory(pAd->CommonCfg.ExtRate, MAX_LEN_OF_SUPPORTED_RATES);
1517 NdisZeroMemory(pAd->CommonCfg.DesireRate, MAX_LEN_OF_SUPPORTED_RATES);
1520 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1521 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1522 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1523 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1524 pAd->CommonCfg.SupRateLen = 4;
1525 pAd->CommonCfg.ExtRateLen = 0;
1526 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1527 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1528 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1529 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1530 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1534 case PHY_11BG_MIXED:
1535 case PHY_11ABG_MIXED:
1536 #ifdef DOT11_N_SUPPORT
1538 case PHY_11ABGN_MIXED:
1539 case PHY_11BGN_MIXED:
1540 case PHY_11GN_MIXED:
1541 #endif // DOT11_N_SUPPORT //
1542 pAd->CommonCfg.SupRate[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1543 pAd->CommonCfg.SupRate[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1544 pAd->CommonCfg.SupRate[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1545 pAd->CommonCfg.SupRate[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1546 pAd->CommonCfg.SupRate[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1547 pAd->CommonCfg.SupRate[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1548 pAd->CommonCfg.SupRate[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1549 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1550 pAd->CommonCfg.SupRateLen = 8;
1551 pAd->CommonCfg.ExtRate[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1552 pAd->CommonCfg.ExtRate[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1553 pAd->CommonCfg.ExtRate[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1554 pAd->CommonCfg.ExtRate[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1555 pAd->CommonCfg.ExtRateLen = 4;
1556 pAd->CommonCfg.DesireRate[0] = 2; // 1 mbps, in units of 0.5 Mbps
1557 pAd->CommonCfg.DesireRate[1] = 4; // 2 mbps, in units of 0.5 Mbps
1558 pAd->CommonCfg.DesireRate[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1559 pAd->CommonCfg.DesireRate[3] = 22; // 11 mbps, in units of 0.5 Mbps
1560 pAd->CommonCfg.DesireRate[4] = 12; // 6 mbps, in units of 0.5 Mbps
1561 pAd->CommonCfg.DesireRate[5] = 18; // 9 mbps, in units of 0.5 Mbps
1562 pAd->CommonCfg.DesireRate[6] = 24; // 12 mbps, in units of 0.5 Mbps
1563 pAd->CommonCfg.DesireRate[7] = 36; // 18 mbps, in units of 0.5 Mbps
1564 pAd->CommonCfg.DesireRate[8] = 48; // 24 mbps, in units of 0.5 Mbps
1565 pAd->CommonCfg.DesireRate[9] = 72; // 36 mbps, in units of 0.5 Mbps
1566 pAd->CommonCfg.DesireRate[10] = 96; // 48 mbps, in units of 0.5 Mbps
1567 pAd->CommonCfg.DesireRate[11] = 108; // 54 mbps, in units of 0.5 Mbps
1571 #ifdef DOT11_N_SUPPORT
1572 case PHY_11AN_MIXED:
1573 case PHY_11AGN_MIXED:
1575 #endif // DOT11_N_SUPPORT //
1576 pAd->CommonCfg.SupRate[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1577 pAd->CommonCfg.SupRate[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1578 pAd->CommonCfg.SupRate[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1579 pAd->CommonCfg.SupRate[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1580 pAd->CommonCfg.SupRate[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1581 pAd->CommonCfg.SupRate[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1582 pAd->CommonCfg.SupRate[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1583 pAd->CommonCfg.SupRate[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1584 pAd->CommonCfg.SupRateLen = 8;
1585 pAd->CommonCfg.ExtRateLen = 0;
1586 pAd->CommonCfg.DesireRate[0] = 12; // 6 mbps, in units of 0.5 Mbps
1587 pAd->CommonCfg.DesireRate[1] = 18; // 9 mbps, in units of 0.5 Mbps
1588 pAd->CommonCfg.DesireRate[2] = 24; // 12 mbps, in units of 0.5 Mbps
1589 pAd->CommonCfg.DesireRate[3] = 36; // 18 mbps, in units of 0.5 Mbps
1590 pAd->CommonCfg.DesireRate[4] = 48; // 24 mbps, in units of 0.5 Mbps
1591 pAd->CommonCfg.DesireRate[5] = 72; // 36 mbps, in units of 0.5 Mbps
1592 pAd->CommonCfg.DesireRate[6] = 96; // 48 mbps, in units of 0.5 Mbps
1593 pAd->CommonCfg.DesireRate[7] = 108; // 54 mbps, in units of 0.5 Mbps
1594 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1602 pAd->CommonCfg.BandState = UNKNOWN_BAND;
1606 #ifdef DOT11_N_SUPPORT
1608 ========================================================================
1609 Routine Description:
1610 Caller ensures we has 802.11n support.
1611 Calls at setting HT from AP/STASetinformation
1614 pAd - Pointer to our adapter
1617 ========================================================================
1620 IN PRTMP_ADAPTER pAd,
1621 IN OID_SET_HT_PHYMODE *pHTPhyMode)
1626 UCHAR BBP3Value = 0;
1627 UCHAR RxStream = pAd->CommonCfg.RxStream;
1629 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1630 pHTPhyMode->HtMode, pHTPhyMode->ExtOffset,
1631 pHTPhyMode->MCS, pHTPhyMode->BW,
1632 pHTPhyMode->STBC, pHTPhyMode->SHORTGI));
1634 // Don't zero supportedHyPhy structure.
1635 RTMPZeroMemory(&pAd->CommonCfg.HtCapability, sizeof(pAd->CommonCfg.HtCapability));
1636 RTMPZeroMemory(&pAd->CommonCfg.AddHTInfo, sizeof(pAd->CommonCfg.AddHTInfo));
1637 RTMPZeroMemory(&pAd->CommonCfg.NewExtChanOffset, sizeof(pAd->CommonCfg.NewExtChanOffset));
1638 RTMPZeroMemory(&pAd->CommonCfg.DesiredHtPhy, sizeof(pAd->CommonCfg.DesiredHtPhy));
1640 if (pAd->CommonCfg.bRdg)
1642 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 1;
1643 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 1;
1647 pAd->CommonCfg.HtCapability.ExtHtCapInfo.PlusHTC = 0;
1648 pAd->CommonCfg.HtCapability.ExtHtCapInfo.RDGSupport = 0;
1651 pAd->CommonCfg.HtCapability.HtCapParm.MaxRAmpduFactor = 3;
1652 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor = 3;
1654 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd->CommonCfg.BACapability.field.RxBAWinLimit));
1656 // Mimo power save, A-MSDU size,
1657 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
1658 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (UCHAR)pAd->CommonCfg.BACapability.field.AmsduSize;
1659 pAd->CommonCfg.DesiredHtPhy.MimoPs = (UCHAR)pAd->CommonCfg.BACapability.field.MMPSmode;
1660 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1662 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
1663 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
1664 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
1666 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1667 pAd->CommonCfg.DesiredHtPhy.AmsduSize,
1668 pAd->CommonCfg.DesiredHtPhy.MimoPs,
1669 pAd->CommonCfg.DesiredHtPhy.MpduDensity,
1670 pAd->CommonCfg.DesiredHtPhy.MaxRAmpduFactor));
1672 if(pHTPhyMode->HtMode == HTMODE_GF)
1674 pAd->CommonCfg.HtCapability.HtCapInfo.GF = 1;
1675 pAd->CommonCfg.DesiredHtPhy.GF = 1;
1678 pAd->CommonCfg.DesiredHtPhy.GF = 0;
1684 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1685 pAd->CommonCfg.HtCapability.MCSSet[1] = 0x00;
1689 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1690 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1694 pAd->CommonCfg.HtCapability.MCSSet[0] = 0xff;
1695 pAd->CommonCfg.HtCapability.MCSSet[1] = 0xff;
1696 pAd->CommonCfg.HtCapability.MCSSet[2] = 0xff;
1700 if (pAd->CommonCfg.bForty_Mhz_Intolerant && (pAd->CommonCfg.Channel <= 14) && (pHTPhyMode->BW == BW_40) )
1702 pHTPhyMode->BW = BW_20;
1703 pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant = 1;
1706 if(pHTPhyMode->BW == BW_40)
1708 pAd->CommonCfg.HtCapability.MCSSet[4] = 0x1; // MCS 32
1709 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 1;
1710 if (pAd->CommonCfg.Channel <= 14)
1711 pAd->CommonCfg.HtCapability.HtCapInfo.CCKmodein40 = 1;
1713 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 1;
1714 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
1715 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = (pHTPhyMode->ExtOffset == EXTCHA_BELOW)? (EXTCHA_BELOW): EXTCHA_ABOVE;
1716 // Set Regsiter for extension channel position.
1717 RTMP_IO_READ32(pAd, TX_BAND_CFG, &Value);
1718 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &BBP3Value);
1719 if ((pHTPhyMode->ExtOffset == EXTCHA_BELOW))
1722 BBP3Value |= (0x20);
1723 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1725 else if ((pHTPhyMode->ExtOffset == EXTCHA_ABOVE))
1728 BBP3Value &= (~0x20);
1729 RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Value);
1732 // Turn on BBP 40MHz mode now only as AP .
1733 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1734 if ((pAd->OpMode == OPMODE_AP) || INFRA_ON(pAd) || ADHOC_ON(pAd)
1737 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1738 BBPValue &= (~0x18);
1740 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1742 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, BBP3Value);
1743 pAd->CommonCfg.BBPCurrentBW = BW_40;
1748 pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth = 0;
1749 pAd->CommonCfg.DesiredHtPhy.ChannelWidth = 0;
1750 pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
1751 pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = EXTCHA_NONE;
1752 pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel;
1753 // Turn on BBP 20MHz mode by request here.
1755 RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
1756 BBPValue &= (~0x18);
1757 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
1758 pAd->CommonCfg.BBPCurrentBW = BW_20;
1762 if(pHTPhyMode->STBC == STBC_USE)
1764 pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 1;
1765 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 1;
1766 pAd->CommonCfg.HtCapability.HtCapInfo.RxSTBC = 1;
1767 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 1;
1771 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
1772 pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
1776 /* Frank recommend ,If not, Tx maybe block in high power. Rx has no problem*/
1777 if(IS_RT3070(pAd) && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020)))
1779 pAd->CommonCfg.HtCapability.HtCapInfo.TxSTBC = 0;
1780 pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
1784 if(pHTPhyMode->SHORTGI == GI_400)
1786 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 1;
1787 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 1;
1788 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 1;
1789 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 1;
1793 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor20 = 0;
1794 pAd->CommonCfg.HtCapability.HtCapInfo.ShortGIfor40 = 0;
1795 pAd->CommonCfg.DesiredHtPhy.ShortGIfor20 = 0;
1796 pAd->CommonCfg.DesiredHtPhy.ShortGIfor40 = 0;
1799 // We support link adaptation for unsolicit MCS feedback, set to 2.
1800 pAd->CommonCfg.HtCapability.ExtHtCapInfo.MCSFeedback = MCSFBK_NONE; //MCSFBK_UNSOLICIT;
1801 pAd->CommonCfg.AddHTInfo.ControlChan = pAd->CommonCfg.Channel;
1802 // 1, the extension channel above the control channel.
1804 // EDCA parameters used for AP's own transmission
1805 if (pAd->CommonCfg.APEdcaParm.bValid == FALSE)
1807 pAd->CommonCfg.APEdcaParm.bValid = TRUE;
1808 pAd->CommonCfg.APEdcaParm.Aifsn[0] = 3;
1809 pAd->CommonCfg.APEdcaParm.Aifsn[1] = 7;
1810 pAd->CommonCfg.APEdcaParm.Aifsn[2] = 1;
1811 pAd->CommonCfg.APEdcaParm.Aifsn[3] = 1;
1813 pAd->CommonCfg.APEdcaParm.Cwmin[0] = 4;
1814 pAd->CommonCfg.APEdcaParm.Cwmin[1] = 4;
1815 pAd->CommonCfg.APEdcaParm.Cwmin[2] = 3;
1816 pAd->CommonCfg.APEdcaParm.Cwmin[3] = 2;
1818 pAd->CommonCfg.APEdcaParm.Cwmax[0] = 6;
1819 pAd->CommonCfg.APEdcaParm.Cwmax[1] = 10;
1820 pAd->CommonCfg.APEdcaParm.Cwmax[2] = 4;
1821 pAd->CommonCfg.APEdcaParm.Cwmax[3] = 3;
1823 pAd->CommonCfg.APEdcaParm.Txop[0] = 0;
1824 pAd->CommonCfg.APEdcaParm.Txop[1] = 0;
1825 pAd->CommonCfg.APEdcaParm.Txop[2] = 94;
1826 pAd->CommonCfg.APEdcaParm.Txop[3] = 47;
1828 AsicSetEdcaParm(pAd, &pAd->CommonCfg.APEdcaParm);
1831 #ifdef CONFIG_STA_SUPPORT
1832 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1834 RTMPSetIndividualHT(pAd, 0);
1836 #endif // CONFIG_STA_SUPPORT //
1841 ========================================================================
1842 Routine Description:
1843 Caller ensures we has 802.11n support.
1844 Calls at setting HT from AP/STASetinformation
1847 pAd - Pointer to our adapter
1850 ========================================================================
1852 VOID RTMPSetIndividualHT(
1853 IN PRTMP_ADAPTER pAd,
1856 PRT_HT_PHY_INFO pDesired_ht_phy = NULL;
1857 UCHAR TxStream = pAd->CommonCfg.TxStream;
1858 UCHAR DesiredMcs = MCS_AUTO;
1863 #ifdef CONFIG_STA_SUPPORT
1864 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1866 pDesired_ht_phy = &pAd->StaCfg.DesiredHtPhyInfo;
1867 DesiredMcs = pAd->StaCfg.DesiredTransmitSetting.field.MCS;
1868 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1871 #endif // CONFIG_STA_SUPPORT //
1874 if (pDesired_ht_phy == NULL)
1876 DBGPRINT(RT_DEBUG_ERROR, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx));
1879 RTMPZeroMemory(pDesired_ht_phy, sizeof(RT_HT_PHY_INFO));
1881 DBGPRINT(RT_DEBUG_TRACE, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs));
1882 // Check the validity of MCS
1883 if ((TxStream == 1) && ((DesiredMcs >= MCS_8) && (DesiredMcs <= MCS_15)))
1885 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs));
1889 if ((pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_20) && (DesiredMcs == MCS_32))
1891 DBGPRINT(RT_DEBUG_WARN, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1895 pDesired_ht_phy->bHtEnable = TRUE;
1897 // Decide desired Tx MCS
1901 if (DesiredMcs == MCS_AUTO)
1903 pDesired_ht_phy->MCSSet[0]= 0xff;
1904 pDesired_ht_phy->MCSSet[1]= 0x00;
1906 else if (DesiredMcs <= MCS_7)
1908 pDesired_ht_phy->MCSSet[0]= 1<<DesiredMcs;
1909 pDesired_ht_phy->MCSSet[1]= 0x00;
1914 if (DesiredMcs == MCS_AUTO)
1916 pDesired_ht_phy->MCSSet[0]= 0xff;
1917 pDesired_ht_phy->MCSSet[1]= 0xff;
1919 else if (DesiredMcs <= MCS_15)
1923 mode = DesiredMcs / 8;
1925 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1930 if (DesiredMcs == MCS_AUTO)
1932 /* MCS0 ~ MCS23, 3 bytes */
1933 pDesired_ht_phy->MCSSet[0]= 0xff;
1934 pDesired_ht_phy->MCSSet[1]= 0xff;
1935 pDesired_ht_phy->MCSSet[2]= 0xff;
1937 else if (DesiredMcs <= MCS_23)
1941 mode = DesiredMcs / 8;
1943 pDesired_ht_phy->MCSSet[mode] = (1 << (DesiredMcs - mode * 8));
1948 if(pAd->CommonCfg.DesiredHtPhy.ChannelWidth == BW_40)
1950 if (DesiredMcs == MCS_AUTO || DesiredMcs == MCS_32)
1951 pDesired_ht_phy->MCSSet[4] = 0x1;
1954 // update HT Rate setting
1955 if (pAd->OpMode == OPMODE_STA)
1956 MlmeUpdateHtTxRates(pAd, BSS0);
1958 MlmeUpdateHtTxRates(pAd, apidx);
1963 ========================================================================
1964 Routine Description:
1965 Update HT IE from our capability.
1968 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1971 ========================================================================
1973 VOID RTMPUpdateHTIE(
1974 IN RT_HT_CAPABILITY *pRtHt,
1976 OUT HT_CAPABILITY_IE *pHtCapability,
1977 OUT ADD_HT_INFO_IE *pAddHtInfo)
1979 RTMPZeroMemory(pHtCapability, sizeof(HT_CAPABILITY_IE));
1980 RTMPZeroMemory(pAddHtInfo, sizeof(ADD_HT_INFO_IE));
1982 pHtCapability->HtCapInfo.ChannelWidth = pRtHt->ChannelWidth;
1983 pHtCapability->HtCapInfo.MimoPs = pRtHt->MimoPs;
1984 pHtCapability->HtCapInfo.GF = pRtHt->GF;
1985 pHtCapability->HtCapInfo.ShortGIfor20 = pRtHt->ShortGIfor20;
1986 pHtCapability->HtCapInfo.ShortGIfor40 = pRtHt->ShortGIfor40;
1987 pHtCapability->HtCapInfo.TxSTBC = pRtHt->TxSTBC;
1988 pHtCapability->HtCapInfo.RxSTBC = pRtHt->RxSTBC;
1989 pHtCapability->HtCapInfo.AMsduSize = pRtHt->AmsduSize;
1990 pHtCapability->HtCapParm.MaxRAmpduFactor = pRtHt->MaxRAmpduFactor;
1991 pHtCapability->HtCapParm.MpduDensity = pRtHt->MpduDensity;
1993 pAddHtInfo->AddHtInfo.ExtChanOffset = pRtHt->ExtChanOffset ;
1994 pAddHtInfo->AddHtInfo.RecomWidth = pRtHt->RecomWidth;
1995 pAddHtInfo->AddHtInfo2.OperaionMode = pRtHt->OperaionMode;
1996 pAddHtInfo->AddHtInfo2.NonGfPresent = pRtHt->NonGfPresent;
1997 RTMPMoveMemory(pAddHtInfo->MCSSet, /*pRtHt->MCSSet*/pMcsSet, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1999 DBGPRINT(RT_DEBUG_TRACE,("RTMPUpdateHTIE <== \n"));
2001 #endif // DOT11_N_SUPPORT //
2004 ========================================================================
2006 Add Client security information into ASIC WCID table and IVEIV table.
2008 ========================================================================
2010 VOID RTMPAddWcidAttributeEntry(
2011 IN PRTMP_ADAPTER pAd,
2015 IN MAC_TABLE_ENTRY *pEntry)
2017 UINT32 WCIDAttri = 0;
2023 #ifdef CONFIG_STA_SUPPORT
2024 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2028 DBGPRINT(RT_DEBUG_ERROR, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx));
2032 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
2033 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
2034 // the AID:2~ assign to mesh link entry.
2035 if (pEntry && ADHOC_ON(pAd))
2037 else if (pEntry && INFRA_ON(pAd))
2044 #endif // CONFIG_STA_SUPPORT //
2047 // Update WCID attribute table
2048 offset = MAC_WCID_ATTRIBUTE_BASE + (Wcid * HW_WCID_ATTRI_SIZE);
2050 #ifdef CONFIG_STA_SUPPORT
2051 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2053 if (pEntry && pEntry->ValidAsMesh)
2054 WCIDAttri = (CipherAlg<<1) | PAIRWISEKEYTABLE;
2056 WCIDAttri = (CipherAlg<<1) | SHAREDKEYTABLE;
2058 #endif // CONFIG_STA_SUPPORT //
2060 RTMP_IO_WRITE32(pAd, offset, WCIDAttri);
2063 // Update IV/EIV table
2064 offset = MAC_IVEIV_TABLE_BASE + (Wcid * HW_IVEIV_ENTRY_SIZE);
2067 if ((CipherAlg == CIPHER_TKIP) || (CipherAlg == CIPHER_TKIP_NO_MIC) || (CipherAlg == CIPHER_AES))
2069 // Eiv bit on. keyid always is 0 for pairwise key
2070 IVEIV = (KeyIdx <<6) | 0x20;
2074 // WEP KeyIdx is default tx key.
2075 IVEIV = (KeyIdx << 6);
2078 // For key index and ext IV bit, so only need to update the position(offset+3).
2080 RTUSBMultiWrite_OneByte(pAd, offset+3, &IVEIV);
2083 DBGPRINT(RT_DEBUG_TRACE,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid, KeyIdx, CipherName[CipherAlg]));
2084 DBGPRINT(RT_DEBUG_TRACE,(" WCIDAttri = 0x%x \n", WCIDAttri));
2089 ==========================================================================
2091 Parse encryption type
2093 pAdapter Pointer to our adapter
2094 wrq Pointer to the ioctl argument
2100 ==========================================================================
2102 CHAR *GetEncryptType(CHAR enc)
2104 if(enc == Ndis802_11WEPDisabled)
2106 if(enc == Ndis802_11WEPEnabled)
2108 if(enc == Ndis802_11Encryption2Enabled)
2110 if(enc == Ndis802_11Encryption3Enabled)
2112 if(enc == Ndis802_11Encryption4Enabled)
2118 CHAR *GetAuthMode(CHAR auth)
2120 if(auth == Ndis802_11AuthModeOpen)
2122 if(auth == Ndis802_11AuthModeShared)
2124 if(auth == Ndis802_11AuthModeAutoSwitch)
2126 if(auth == Ndis802_11AuthModeWPA)
2128 if(auth == Ndis802_11AuthModeWPAPSK)
2130 if(auth == Ndis802_11AuthModeWPANone)
2132 if(auth == Ndis802_11AuthModeWPA2)
2134 if(auth == Ndis802_11AuthModeWPA2PSK)
2136 if(auth == Ndis802_11AuthModeWPA1WPA2)
2138 if(auth == Ndis802_11AuthModeWPA1PSKWPA2PSK)
2139 return "WPA1PSKWPA2PSK";
2145 ==========================================================================
2147 Get site survey results
2149 pAdapter Pointer to our adapter
2150 wrq Pointer to the ioctl argument
2157 1.) UI needs to wait 4 seconds after issue a site survey command
2158 2.) iwpriv ra0 get_site_survey
2159 3.) UI needs to prepare at least 4096bytes to get the results
2160 ==========================================================================
2162 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
2163 VOID RTMPIoctlGetSiteSurvey(
2164 IN PRTMP_ADAPTER pAdapter,
2165 IN struct iwreq *wrq)
2171 CHAR Ssid[MAX_LEN_OF_SSID +1];
2172 INT Rssi = 0, max_len = LINE_LEN;
2173 UINT Rssi_Quality = 0;
2174 NDIS_802_11_NETWORK_TYPE wireless_mode;
2176 os_alloc_mem(NULL, (PUCHAR *)&msg, sizeof(CHAR)*((MAX_LEN_OF_BSS_TABLE)*max_len));
2180 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
2184 memset(msg, 0 ,(MAX_LEN_OF_BSS_TABLE)*max_len );
2185 memset(Ssid, 0 ,(MAX_LEN_OF_SSID +1));
2186 sprintf(msg,"%s","\n");
2187 sprintf(msg+strlen(msg),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
2188 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
2192 #ifdef CONFIG_STA_SUPPORT
2193 pAdapter->StaCfg.bScanReqIsFromWebUI = TRUE;
2194 while ((ScanRunning(pAdapter) == TRUE) && (WaitCnt++ < 200))
2196 #endif // CONFIG_STA_SUPPORT //
2198 for(i=0; i<pAdapter->ScanTab.BssNr ;i++)
2200 if( pAdapter->ScanTab.BssEntry[i].Channel==0)
2203 if((strlen(msg)+max_len ) >= IW_SCAN_MAX_DATA)
2207 sprintf(msg+strlen(msg),"%-4d", pAdapter->ScanTab.BssEntry[i].Channel);
2209 memcpy(Ssid, pAdapter->ScanTab.BssEntry[i].Ssid, pAdapter->ScanTab.BssEntry[i].SsidLen);
2210 Ssid[pAdapter->ScanTab.BssEntry[i].SsidLen] = '\0';
2211 sprintf(msg+strlen(msg),"%-33s", Ssid);
2213 sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x ",
2214 pAdapter->ScanTab.BssEntry[i].Bssid[0],
2215 pAdapter->ScanTab.BssEntry[i].Bssid[1],
2216 pAdapter->ScanTab.BssEntry[i].Bssid[2],
2217 pAdapter->ScanTab.BssEntry[i].Bssid[3],
2218 pAdapter->ScanTab.BssEntry[i].Bssid[4],
2219 pAdapter->ScanTab.BssEntry[i].Bssid[5]);
2221 sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus));
2222 //Authentication Mode
2223 if (pAdapter->ScanTab.BssEntry[i].WepStatus == Ndis802_11WEPEnabled)
2224 sprintf(msg+strlen(msg),"%-10s", "UNKNOW");
2226 sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode));
2228 Rssi = (INT)pAdapter->ScanTab.BssEntry[i].Rssi;
2231 else if (Rssi >= -80) // between -50 ~ -80dbm
2232 Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10);
2233 else if (Rssi >= -90) // between -80 ~ -90dbm
2234 Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10);
2237 sprintf(msg+strlen(msg),"%-9d", Rssi_Quality);
2239 wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]);
2240 if (wireless_mode == Ndis802_11FH ||
2241 wireless_mode == Ndis802_11DS)
2242 sprintf(msg+strlen(msg),"%-7s", "11b");
2243 else if (wireless_mode == Ndis802_11OFDM5)
2244 sprintf(msg+strlen(msg),"%-7s", "11a");
2245 else if (wireless_mode == Ndis802_11OFDM5_N)
2246 sprintf(msg+strlen(msg),"%-7s", "11a/n");
2247 else if (wireless_mode == Ndis802_11OFDM24)
2248 sprintf(msg+strlen(msg),"%-7s", "11b/g");
2249 else if (wireless_mode == Ndis802_11OFDM24_N)
2250 sprintf(msg+strlen(msg),"%-7s", "11b/g/n");
2252 sprintf(msg+strlen(msg),"%-7s", "unknow");
2254 if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC)
2255 sprintf(msg+strlen(msg),"%-3s", " Ad");
2257 sprintf(msg+strlen(msg),"%-3s", " In");
2259 sprintf(msg+strlen(msg),"\n");
2262 #ifdef CONFIG_STA_SUPPORT
2263 pAdapter->StaCfg.bScanReqIsFromWebUI = FALSE;
2264 #endif // CONFIG_STA_SUPPORT //
2265 wrq->u.data.length = strlen(msg);
2266 Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);
2268 DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length));
2269 os_free_mem(NULL, (PUCHAR)msg);
2273 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
2274 VOID RTMPIoctlGetMacTable(
2275 IN PRTMP_ADAPTER pAd,
2276 IN struct iwreq *wrq)
2279 RT_802_11_MAC_TABLE MacTab;
2283 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
2285 if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC))
2287 COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr);
2288 MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid;
2289 MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode;
2290 #ifdef DOT11_N_SUPPORT
2291 MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode;
2292 #endif // DOT11_N_SUPPORT //
2294 // Fill in RSSI per entry
2295 MacTab.Entry[MacTab.Num].AvgRssi0 = pAd->MacTab.Content[i].RssiSample.AvgRssi0;
2296 MacTab.Entry[MacTab.Num].AvgRssi1 = pAd->MacTab.Content[i].RssiSample.AvgRssi1;
2297 MacTab.Entry[MacTab.Num].AvgRssi2 = pAd->MacTab.Content[i].RssiSample.AvgRssi2;
2299 // the connected time per entry
2300 MacTab.Entry[MacTab.Num].ConnectedTime = pAd->MacTab.Content[i].StaConnectTime;
2302 MacTab.Entry[MacTab.Num].HSCounter.LastDataPacketTime = pAd->MacTab.Content[i].HSCounter.LastDataPacketTime;
2303 MacTab.Entry[MacTab.Num].HSCounter.TotalRxByteCount = pAd->MacTab.Content[i].HSCounter.TotalRxByteCount;
2304 MacTab.Entry[MacTab.Num].HSCounter.TotalTxByteCount = pAd->MacTab.Content[i].HSCounter.TotalTxByteCount;
2306 MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS;
2307 MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW;
2308 MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI;
2309 MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC;
2310 MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv;
2311 MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE;
2312 MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word;
2317 wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE);
2318 if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length))
2320 DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __func__));
2323 msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG);
2324 memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN );
2325 sprintf(msg,"%s","\n");
2326 sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
2327 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
2329 for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)
2331 PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];
2332 if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC))
2334 if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) )
2336 sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x ",
2337 pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],
2338 pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);
2339 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid);
2340 sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode);
2341 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
2342 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
2343 sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
2344 sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]);
2345 sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
2348 // for compatible with old API just do the printk to console
2349 //wrq->u.data.length = strlen(msg);
2350 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
2352 DBGPRINT(RT_DEBUG_TRACE, ("%s", msg));
2358 #ifdef DOT11_N_SUPPORT
2359 INT Set_BASetup_Proc(
2360 IN PRTMP_ADAPTER pAd,
2364 char *token, sepValue[] = ":", DASH = '-';
2366 MAC_TABLE_ENTRY *pEntry;
2369 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
2370 =>The six 2 digit hex-decimal number previous are the Mac address,
2371 =>The seventh decimal number is the tid value.
2373 //printk("\n%s\n", arg);
2375 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2378 token = strchr(arg, DASH);
2379 if ((token != NULL) && (strlen(token)>1))
2381 tid = simple_strtol((token+1), 0, 10);
2386 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2388 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2390 AtoH(token, (PUCHAR)(&mac[i]), 1);
2395 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1],
2396 mac[2], mac[3], mac[4], mac[5], tid);
2398 pEntry = MacTableLookup(pAd, mac);
2401 printk("\nSetup BA Session: Tid = %d\n", tid);
2402 BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE);
2412 INT Set_BADecline_Proc(
2413 IN PRTMP_ADAPTER pAd,
2418 bBADecline = simple_strtol(arg, 0, 10);
2420 if (bBADecline == 0)
2422 pAd->CommonCfg.bBADecline = FALSE;
2424 else if (bBADecline == 1)
2426 pAd->CommonCfg.bBADecline = TRUE;
2430 return FALSE; //Invalid argument
2433 DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline));
2438 INT Set_BAOriTearDown_Proc(
2439 IN PRTMP_ADAPTER pAd,
2443 char *token, sepValue[] = ":", DASH = '-';
2445 MAC_TABLE_ENTRY *pEntry;
2447 //printk("\n%s\n", arg);
2449 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2450 =>The six 2 digit hex-decimal number previous are the Mac address,
2451 =>The seventh decimal number is the tid value.
2453 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2456 token = strchr(arg, DASH);
2457 if ((token != NULL) && (strlen(token)>1))
2459 tid = simple_strtol((token+1), 0, 10);
2460 if (tid > NUM_OF_TID)
2464 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2466 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2468 AtoH(token, (PUCHAR)(&mac[i]), 1);
2473 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2474 mac[2], mac[3], mac[4], mac[5], tid);
2476 pEntry = MacTableLookup(pAd, mac);
2479 printk("\nTear down Ori BA Session: Tid = %d\n", tid);
2480 BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE);
2490 INT Set_BARecTearDown_Proc(
2491 IN PRTMP_ADAPTER pAd,
2495 char *token, sepValue[] = ":", DASH = '-';
2497 MAC_TABLE_ENTRY *pEntry;
2499 //printk("\n%s\n", arg);
2501 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2502 =>The six 2 digit hex-decimal number previous are the Mac address,
2503 =>The seventh decimal number is the tid value.
2505 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2508 token = strchr(arg, DASH);
2509 if ((token != NULL) && (strlen(token)>1))
2511 tid = simple_strtol((token+1), 0, 10);
2512 if (tid > NUM_OF_TID)
2516 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2518 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2520 AtoH(token, (PUCHAR)(&mac[i]), 1);
2525 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2526 mac[2], mac[3], mac[4], mac[5], tid);
2528 pEntry = MacTableLookup(pAd, mac);
2531 printk("\nTear down Rec BA Session: Tid = %d\n", tid);
2532 BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE);
2543 IN PRTMP_ADAPTER pAd,
2548 HtBw = simple_strtol(arg, 0, 10);
2550 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_40;
2551 else if (HtBw == BW_20)
2552 pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
2554 return FALSE; //Invalid argument
2558 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW));
2564 IN PRTMP_ADAPTER pAd,
2567 ULONG HtMcs, Mcs_tmp;
2568 #ifdef CONFIG_STA_SUPPORT
2569 BOOLEAN bAutoRate = FALSE;
2570 #endif // CONFIG_STA_SUPPORT //
2572 Mcs_tmp = simple_strtol(arg, 0, 10);
2574 if (Mcs_tmp <= 15 || Mcs_tmp == 32)
2579 #ifdef CONFIG_STA_SUPPORT
2580 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
2582 pAd->StaCfg.DesiredTransmitSetting.field.MCS = HtMcs;
2583 pAd->StaCfg.bAutoTxRateSwitch = (HtMcs == MCS_AUTO) ? TRUE:FALSE;
2584 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2585 pAd->StaCfg.DesiredTransmitSetting.field.MCS, pAd->StaCfg.bAutoTxRateSwitch));
2587 if ((pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED) ||
2588 (pAd->MacTab.Content[BSSID_WCID].HTPhyMode.field.MODE < MODE_HTMIX))
2590 if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2591 (HtMcs >= 0 && HtMcs <= 3) &&
2592 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_CCK))
2594 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs] * 1000000));
2596 else if ((pAd->StaCfg.DesiredTransmitSetting.field.MCS != MCS_AUTO) &&
2597 (HtMcs >= 0 && HtMcs <= 7) &&
2598 (pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode == FIXED_TXMODE_OFDM))
2600 RTMPSetDesiredRates(pAd, (LONG) (RateIdToMbps[HtMcs+4] * 1000000));
2607 pAd->StaCfg.DesiredTransmitSetting.field.MCS = MCS_AUTO;
2608 RTMPSetDesiredRates(pAd, -1);
2610 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode));
2615 #endif // CONFIG_STA_SUPPORT //
2623 IN PRTMP_ADAPTER pAd,
2628 HtGi = simple_strtol(arg, 0, 10);
2630 if ( HtGi == GI_400)
2631 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400;
2632 else if ( HtGi == GI_800 )
2633 pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800;
2635 return FALSE; //Invalid argument
2639 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI));
2645 INT Set_HtTxBASize_Proc(
2646 IN PRTMP_ADAPTER pAd,
2651 Size = simple_strtol(arg, 0, 10);
2653 if (Size <=0 || Size >=64)
2657 pAd->CommonCfg.TxBASize = Size-1;
2658 DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size));
2664 INT Set_HtOpMode_Proc(
2665 IN PRTMP_ADAPTER pAd,
2671 Value = simple_strtol(arg, 0, 10);
2673 if (Value == HTMODE_GF)
2674 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_GF;
2675 else if ( Value == HTMODE_MM )
2676 pAd->CommonCfg.RegTransmitSetting.field.HTMODE = HTMODE_MM;
2678 return FALSE; //Invalid argument
2682 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.HTMODE));
2688 INT Set_HtStbc_Proc(
2689 IN PRTMP_ADAPTER pAd,
2695 Value = simple_strtol(arg, 0, 10);
2697 if (Value == STBC_USE)
2698 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_USE;
2699 else if ( Value == STBC_NONE )
2700 pAd->CommonCfg.RegTransmitSetting.field.STBC = STBC_NONE;
2702 return FALSE; //Invalid argument
2706 DBGPRINT(RT_DEBUG_TRACE, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.STBC));
2712 IN PRTMP_ADAPTER pAd,
2718 Value = simple_strtol(arg, 0, 10);
2720 pAd->HTCEnable = FALSE;
2721 else if ( Value ==1 )
2722 pAd->HTCEnable = TRUE;
2724 return FALSE; //Invalid argument
2726 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd->HTCEnable));
2731 INT Set_HtExtcha_Proc(
2732 IN PRTMP_ADAPTER pAd,
2738 Value = simple_strtol(arg, 0, 10);
2741 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_BELOW;
2742 else if ( Value ==1 )
2743 pAd->CommonCfg.RegTransmitSetting.field.EXTCHA = EXTCHA_ABOVE;
2745 return FALSE; //Invalid argument
2749 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.EXTCHA));
2754 INT Set_HtMpduDensity_Proc(
2755 IN PRTMP_ADAPTER pAd,
2760 Value = simple_strtol(arg, 0, 10);
2762 if (Value <=7 && Value >= 0)
2763 pAd->CommonCfg.BACapability.field.MpduDensity = Value;
2765 pAd->CommonCfg.BACapability.field.MpduDensity = 4;
2769 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd->CommonCfg.BACapability.field.MpduDensity));
2774 INT Set_HtBaWinSize_Proc(
2775 IN PRTMP_ADAPTER pAd,
2780 Value = simple_strtol(arg, 0, 10);
2783 if (Value >=1 && Value <= 64)
2785 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = Value;
2786 pAd->CommonCfg.BACapability.field.RxBAWinLimit = Value;
2790 pAd->CommonCfg.REGBACapability.field.RxBAWinLimit = 64;
2791 pAd->CommonCfg.BACapability.field.RxBAWinLimit = 64;
2796 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd->CommonCfg.BACapability.field.RxBAWinLimit));
2802 IN PRTMP_ADAPTER pAd,
2807 Value = simple_strtol(arg, 0, 10);
2810 pAd->CommonCfg.bRdg = FALSE;
2811 else if ( Value ==1 )
2813 pAd->HTCEnable = TRUE;
2814 pAd->CommonCfg.bRdg = TRUE;
2817 return FALSE; //Invalid argument
2821 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd->CommonCfg.bRdg));
2826 INT Set_HtLinkAdapt_Proc(
2827 IN PRTMP_ADAPTER pAd,
2832 Value = simple_strtol(arg, 0, 10);
2834 pAd->bLinkAdapt = FALSE;
2835 else if ( Value ==1 )
2837 pAd->HTCEnable = TRUE;
2838 pAd->bLinkAdapt = TRUE;
2841 return FALSE; //Invalid argument
2843 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd->bLinkAdapt));
2848 INT Set_HtAmsdu_Proc(
2849 IN PRTMP_ADAPTER pAd,
2854 Value = simple_strtol(arg, 0, 10);
2856 pAd->CommonCfg.BACapability.field.AmsduEnable = FALSE;
2857 else if ( Value == 1 )
2858 pAd->CommonCfg.BACapability.field.AmsduEnable = TRUE;
2860 return FALSE; //Invalid argument
2864 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd->CommonCfg.BACapability.field.AmsduEnable));
2869 INT Set_HtAutoBa_Proc(
2870 IN PRTMP_ADAPTER pAd,
2875 Value = simple_strtol(arg, 0, 10);
2877 pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
2878 else if (Value == 1)
2879 pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
2881 return FALSE; //Invalid argument
2883 pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
2886 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA));
2892 INT Set_HtProtect_Proc(
2893 IN PRTMP_ADAPTER pAd,
2898 Value = simple_strtol(arg, 0, 10);
2900 pAd->CommonCfg.bHTProtect = FALSE;
2901 else if (Value == 1)
2902 pAd->CommonCfg.bHTProtect = TRUE;
2904 return FALSE; //Invalid argument
2906 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd->CommonCfg.bHTProtect));
2911 INT Set_SendPSMPAction_Proc(
2912 IN PRTMP_ADAPTER pAd,
2916 char *token, sepValue[] = ":", DASH = '-';
2918 MAC_TABLE_ENTRY *pEntry;
2920 //printk("\n%s\n", arg);
2922 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2923 =>The six 2 digit hex-decimal number previous are the Mac address,
2924 =>The seventh decimal number is the mode value.
2926 if(strlen(arg) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2929 token = strchr(arg, DASH);
2930 if ((token != NULL) && (strlen(token)>1))
2932 mode = simple_strtol((token+1), 0, 10);
2933 if (mode > MMPS_ENABLE)
2937 for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)
2939 if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))
2941 AtoH(token, (PUCHAR)(&mac[i]), 1);
2946 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],
2947 mac[2], mac[3], mac[4], mac[5], mode);
2949 pEntry = MacTableLookup(pAd, mac);
2952 printk("\nSendPSMPAction MIPS mode = %d\n", mode);
2953 SendPSMPAction(pAd, pEntry->Aid, mode);
2964 INT Set_HtMIMOPSmode_Proc(
2965 IN PRTMP_ADAPTER pAd,
2970 Value = simple_strtol(arg, 0, 10);
2972 if (Value <=3 && Value >= 0)
2973 pAd->CommonCfg.BACapability.field.MMPSmode = Value;
2975 pAd->CommonCfg.BACapability.field.MMPSmode = 3;
2979 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd->CommonCfg.BACapability.field.MMPSmode));
2985 INT Set_ForceShortGI_Proc(
2986 IN PRTMP_ADAPTER pAd,
2991 Value = simple_strtol(arg, 0, 10);
2993 pAd->WIFItestbed.bShortGI = FALSE;
2994 else if (Value == 1)
2995 pAd->WIFItestbed.bShortGI = TRUE;
2997 return FALSE; //Invalid argument
3001 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd->WIFItestbed.bShortGI));
3008 INT Set_ForceGF_Proc(
3009 IN PRTMP_ADAPTER pAd,
3014 Value = simple_strtol(arg, 0, 10);
3016 pAd->WIFItestbed.bGreenField = FALSE;
3017 else if (Value == 1)
3018 pAd->WIFItestbed.bGreenField = TRUE;
3020 return FALSE; //Invalid argument
3024 DBGPRINT(RT_DEBUG_TRACE, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd->WIFItestbed.bGreenField));
3029 INT Set_HtMimoPs_Proc(
3030 IN PRTMP_ADAPTER pAd,
3035 Value = simple_strtol(arg, 0, 10);
3037 pAd->CommonCfg.bMIMOPSEnable = FALSE;
3038 else if (Value == 1)
3039 pAd->CommonCfg.bMIMOPSEnable = TRUE;
3041 return FALSE; //Invalid argument
3043 DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd->CommonCfg.bMIMOPSEnable));
3047 #endif // DOT11_N_SUPPORT //
3050 #ifdef DOT11_N_SUPPORT
3052 IN PRTMP_ADAPTER pAd)
3054 OID_SET_HT_PHYMODE SetHT;
3056 if (pAd->CommonCfg.PhyMode < PHY_11ABGN_MIXED)
3059 SetHT.PhyMode = pAd->CommonCfg.PhyMode;
3060 SetHT.TransmitNo = ((UCHAR)pAd->Antenna.field.TxPath);
3061 SetHT.HtMode = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.HTMODE;
3062 SetHT.ExtOffset = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
3063 SetHT.MCS = MCS_AUTO;
3064 SetHT.BW = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.BW;
3065 SetHT.STBC = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.STBC;
3066 SetHT.SHORTGI = (UCHAR)pAd->CommonCfg.RegTransmitSetting.field.ShortGI;
3068 RTMPSetHT(pAd, &SetHT);
3072 #endif // DOT11_N_SUPPORT //
3074 INT Set_FixedTxMode_Proc(
3075 IN PRTMP_ADAPTER pAd,
3078 UCHAR fix_tx_mode = FIXED_TXMODE_HT;
3080 if (strcmp(arg, "OFDM") == 0 || strcmp(arg, "ofdm") == 0)
3082 fix_tx_mode = FIXED_TXMODE_OFDM;
3084 else if (strcmp(arg, "CCK") == 0 || strcmp(arg, "cck") == 0)
3086 fix_tx_mode = FIXED_TXMODE_CCK;
3089 #ifdef CONFIG_STA_SUPPORT
3090 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3091 pAd->StaCfg.DesiredTransmitSetting.field.FixedTxMode = fix_tx_mode;
3092 #endif // CONFIG_STA_SUPPORT //
3094 DBGPRINT(RT_DEBUG_TRACE, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode));
3099 /////////////////////////////////////////////////////////////////////////
3100 PCHAR RTMPGetRalinkAuthModeStr(
3101 IN NDIS_802_11_AUTHENTICATION_MODE authMode)
3105 case Ndis802_11AuthModeOpen:
3107 case Ndis802_11AuthModeWPAPSK:
3109 case Ndis802_11AuthModeShared:
3111 case Ndis802_11AuthModeWPA:
3113 case Ndis802_11AuthModeWPA2:
3115 case Ndis802_11AuthModeWPA2PSK:
3117 case Ndis802_11AuthModeWPA1PSKWPA2PSK:
3118 return "WPAPSKWPA2PSK";
3119 case Ndis802_11AuthModeWPA1WPA2:
3121 case Ndis802_11AuthModeWPANone:
3128 PCHAR RTMPGetRalinkEncryModeStr(
3129 IN USHORT encryMode)
3133 case Ndis802_11WEPDisabled:
3135 case Ndis802_11WEPEnabled:
3137 case Ndis802_11Encryption2Enabled:
3139 case Ndis802_11Encryption3Enabled:
3141 case Ndis802_11Encryption4Enabled:
3148 INT RTMPShowCfgValue(
3149 IN PRTMP_ADAPTER pAd,
3155 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++)
3157 if (!strcmp(pName, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name))
3159 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->show_proc(pAd, pBuf))
3161 break; //Exit for loop.
3165 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name == NULL)
3167 sprintf(pBuf, "\n");
3168 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++)
3169 sprintf(pBuf + strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
3176 IN PRTMP_ADAPTER pAd,
3180 #ifdef CONFIG_STA_SUPPORT
3181 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3182 sprintf(pBuf, "\t%s", pAd->CommonCfg.Ssid);
3183 #endif // CONFIG_STA_SUPPORT //
3187 INT Show_WirelessMode_Proc(
3188 IN PRTMP_ADAPTER pAd,
3191 switch(pAd->CommonCfg.PhyMode)
3193 case PHY_11BG_MIXED:
3194 sprintf(pBuf, "\t11B/G");
3197 sprintf(pBuf, "\t11B");
3200 sprintf(pBuf, "\t11A");
3202 case PHY_11ABG_MIXED:
3203 sprintf(pBuf, "\t11A/B/G");
3206 sprintf(pBuf, "\t11G");
3208 #ifdef DOT11_N_SUPPORT
3209 case PHY_11ABGN_MIXED:
3210 sprintf(pBuf, "\t11A/B/G/N");
3213 sprintf(pBuf, "\t11N only with 2.4G");
3215 case PHY_11GN_MIXED:
3216 sprintf(pBuf, "\t11G/N");
3218 case PHY_11AN_MIXED:
3219 sprintf(pBuf, "\t11A/N");
3221 case PHY_11BGN_MIXED:
3222 sprintf(pBuf, "\t11B/G/N");
3224 case PHY_11AGN_MIXED:
3225 sprintf(pBuf, "\t11A/G/N");
3228 sprintf(pBuf, "\t11N only with 5G");
3230 #endif // DOT11_N_SUPPORT //
3232 sprintf(pBuf, "\tUnknow Value(%d)", pAd->CommonCfg.PhyMode);
3239 INT Show_TxBurst_Proc(
3240 IN PRTMP_ADAPTER pAd,
3243 sprintf(pBuf, "\t%s", pAd->CommonCfg.bEnableTxBurst ? "TRUE":"FALSE");
3247 INT Show_TxPreamble_Proc(
3248 IN PRTMP_ADAPTER pAd,
3251 switch(pAd->CommonCfg.TxPreamble)
3253 case Rt802_11PreambleShort:
3254 sprintf(pBuf, "\tShort");
3256 case Rt802_11PreambleLong:
3257 sprintf(pBuf, "\tLong");
3259 case Rt802_11PreambleAuto:
3260 sprintf(pBuf, "\tAuto");
3263 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.TxPreamble);
3270 INT Show_TxPower_Proc(
3271 IN PRTMP_ADAPTER pAd,
3274 sprintf(pBuf, "\t%lu", pAd->CommonCfg.TxPowerPercentage);
3278 INT Show_Channel_Proc(
3279 IN PRTMP_ADAPTER pAd,
3282 sprintf(pBuf, "\t%d", pAd->CommonCfg.Channel);
3286 INT Show_BGProtection_Proc(
3287 IN PRTMP_ADAPTER pAd,
3290 switch(pAd->CommonCfg.UseBGProtection)
3293 sprintf(pBuf, "\tON");
3295 case 2: //Always OFF
3296 sprintf(pBuf, "\tOFF");
3299 sprintf(pBuf, "\tAuto");
3302 sprintf(pBuf, "\tUnknow Value(%lu)", pAd->CommonCfg.UseBGProtection);
3308 INT Show_RTSThreshold_Proc(
3309 IN PRTMP_ADAPTER pAd,
3312 sprintf(pBuf, "\t%u", pAd->CommonCfg.RtsThreshold);
3316 INT Show_FragThreshold_Proc(
3317 IN PRTMP_ADAPTER pAd,
3320 sprintf(pBuf, "\t%u", pAd->CommonCfg.FragmentThreshold);
3324 #ifdef DOT11_N_SUPPORT
3326 IN PRTMP_ADAPTER pAd,
3329 if (pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
3331 sprintf(pBuf, "\t40 MHz");
3335 sprintf(pBuf, "\t20 MHz");
3340 INT Show_HtMcs_Proc(
3341 IN PRTMP_ADAPTER pAd,
3345 #ifdef CONFIG_STA_SUPPORT
3346 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3347 sprintf(pBuf, "\t%u", pAd->StaCfg.DesiredTransmitSetting.field.MCS);
3348 #endif // CONFIG_STA_SUPPORT //
3353 IN PRTMP_ADAPTER pAd,
3356 switch(pAd->CommonCfg.RegTransmitSetting.field.ShortGI)
3359 sprintf(pBuf, "\tGI_400");
3362 sprintf(pBuf, "\tGI_800");
3365 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.ShortGI);
3371 INT Show_HtOpMode_Proc(
3372 IN PRTMP_ADAPTER pAd,
3375 switch(pAd->CommonCfg.RegTransmitSetting.field.HTMODE)
3378 sprintf(pBuf, "\tGF");
3381 sprintf(pBuf, "\tMM");
3384 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.HTMODE);
3390 INT Show_HtExtcha_Proc(
3391 IN PRTMP_ADAPTER pAd,
3394 switch(pAd->CommonCfg.RegTransmitSetting.field.EXTCHA)
3397 sprintf(pBuf, "\tBelow");
3400 sprintf(pBuf, "\tAbove");
3403 sprintf(pBuf, "\tUnknow Value(%u)", pAd->CommonCfg.RegTransmitSetting.field.EXTCHA);
3410 INT Show_HtMpduDensity_Proc(
3411 IN PRTMP_ADAPTER pAd,
3414 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.MpduDensity);
3418 INT Show_HtBaWinSize_Proc(
3419 IN PRTMP_ADAPTER pAd,
3422 sprintf(pBuf, "\t%u", pAd->CommonCfg.BACapability.field.RxBAWinLimit);
3426 INT Show_HtRdg_Proc(
3427 IN PRTMP_ADAPTER pAd,
3430 sprintf(pBuf, "\t%s", pAd->CommonCfg.bRdg ? "TRUE":"FALSE");
3434 INT Show_HtAmsdu_Proc(
3435 IN PRTMP_ADAPTER pAd,
3438 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AmsduEnable ? "TRUE":"FALSE");
3442 INT Show_HtAutoBa_Proc(
3443 IN PRTMP_ADAPTER pAd,
3446 sprintf(pBuf, "\t%s", pAd->CommonCfg.BACapability.field.AutoBA ? "TRUE":"FALSE");
3449 #endif // DOT11_N_SUPPORT //
3451 INT Show_CountryRegion_Proc(
3452 IN PRTMP_ADAPTER pAd,
3455 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegion);
3459 INT Show_CountryRegionABand_Proc(
3460 IN PRTMP_ADAPTER pAd,
3463 sprintf(pBuf, "\t%d", pAd->CommonCfg.CountryRegionForABand);
3467 INT Show_CountryCode_Proc(
3468 IN PRTMP_ADAPTER pAd,
3471 sprintf(pBuf, "\t%s", pAd->CommonCfg.CountryCode);
3475 #ifdef AGGREGATION_SUPPORT
3476 INT Show_PktAggregate_Proc(
3477 IN PRTMP_ADAPTER pAd,
3480 sprintf(pBuf, "\t%s", pAd->CommonCfg.bAggregationCapable ? "TRUE":"FALSE");
3483 #endif // AGGREGATION_SUPPORT //
3486 INT Show_WmmCapable_Proc(
3487 IN PRTMP_ADAPTER pAd,
3491 #ifdef CONFIG_STA_SUPPORT
3492 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3493 sprintf(pBuf, "\t%s", pAd->CommonCfg.bWmmCapable ? "TRUE":"FALSE");
3494 #endif // CONFIG_STA_SUPPORT //
3498 #endif // WMM_SUPPORT //
3500 INT Show_IEEE80211H_Proc(
3501 IN PRTMP_ADAPTER pAd,
3504 sprintf(pBuf, "\t%s", pAd->CommonCfg.bIEEE80211H ? "TRUE":"FALSE");
3508 #ifdef CONFIG_STA_SUPPORT
3509 INT Show_NetworkType_Proc(
3510 IN PRTMP_ADAPTER pAd,
3513 switch(pAd->StaCfg.BssType)
3516 sprintf(pBuf, "\tAdhoc");
3519 sprintf(pBuf, "\tInfra");
3522 sprintf(pBuf, "\tAny");
3525 sprintf(pBuf, "\tMonitor");
3528 sprintf(pBuf, "\tUnknow Value(%d)", pAd->StaCfg.BssType);
3533 #endif // CONFIG_STA_SUPPORT //
3535 INT Show_AuthMode_Proc(
3536 IN PRTMP_ADAPTER pAd,
3539 NDIS_802_11_AUTHENTICATION_MODE AuthMode = Ndis802_11AuthModeOpen;
3541 #ifdef CONFIG_STA_SUPPORT
3542 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3543 AuthMode = pAd->StaCfg.AuthMode;
3544 #endif // CONFIG_STA_SUPPORT //
3546 if ((AuthMode >= Ndis802_11AuthModeOpen) &&
3547 (AuthMode <= Ndis802_11AuthModeWPA1PSKWPA2PSK))
3548 sprintf(pBuf, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode));
3550 sprintf(pBuf, "\tUnknow Value(%d)", AuthMode);
3555 INT Show_EncrypType_Proc(
3556 IN PRTMP_ADAPTER pAd,
3559 NDIS_802_11_WEP_STATUS WepStatus = Ndis802_11WEPDisabled;
3561 #ifdef CONFIG_STA_SUPPORT
3562 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3563 WepStatus = pAd->StaCfg.WepStatus;
3564 #endif // CONFIG_STA_SUPPORT //
3566 if ((WepStatus >= Ndis802_11WEPEnabled) &&
3567 (WepStatus <= Ndis802_11Encryption4KeyAbsent))
3568 sprintf(pBuf, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus));
3570 sprintf(pBuf, "\tUnknow Value(%d)", WepStatus);
3575 INT Show_DefaultKeyID_Proc(
3576 IN PRTMP_ADAPTER pAd,
3579 UCHAR DefaultKeyId = 0;
3581 #ifdef CONFIG_STA_SUPPORT
3582 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3583 DefaultKeyId = pAd->StaCfg.DefaultKeyId;
3584 #endif // CONFIG_STA_SUPPORT //
3586 sprintf(pBuf, "\t%d", DefaultKeyId);
3591 INT Show_WepKey_Proc(
3592 IN PRTMP_ADAPTER pAd,
3596 UCHAR Key[16] = {0}, KeyLength = 0;
3599 KeyLength = pAd->SharedKey[index][KeyIdx].KeyLen;
3600 NdisMoveMemory(Key, pAd->SharedKey[index][KeyIdx].Key, KeyLength);
3602 //check key string is ASCII or not
3603 if (RTMPCheckStrPrintAble(Key, KeyLength))
3604 sprintf(pBuf, "\t%s", Key);
3608 sprintf(pBuf, "\t");
3609 for (idx = 0; idx < KeyLength; idx++)
3610 sprintf(pBuf+strlen(pBuf), "%02X", Key[idx]);
3616 IN PRTMP_ADAPTER pAd,
3619 Show_WepKey_Proc(pAd, 0, pBuf);
3624 IN PRTMP_ADAPTER pAd,
3627 Show_WepKey_Proc(pAd, 1, pBuf);
3632 IN PRTMP_ADAPTER pAd,
3635 Show_WepKey_Proc(pAd, 2, pBuf);
3640 IN PRTMP_ADAPTER pAd,
3643 Show_WepKey_Proc(pAd, 3, pBuf);
3647 INT Show_WPAPSK_Proc(
3648 IN PRTMP_ADAPTER pAd,
3652 UCHAR PMK[32] = {0};
3655 #ifdef CONFIG_STA_SUPPORT
3656 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
3657 NdisMoveMemory(PMK, pAd->StaCfg.PMK, 32);
3658 #endif // CONFIG_STA_SUPPORT //
3660 sprintf(pBuf, "\tPMK = ");
3661 for (idx = 0; idx < 32; idx++)
3662 sprintf(pBuf+strlen(pBuf), "%02X", PMK[idx]);