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
))
2039 #ifdef QOS_DLS_SUPPORT
2040 if (pEntry
->ValidAsDls
== TRUE
)
2043 #endif // QOS_DLS_SUPPORT //
2049 #endif // CONFIG_STA_SUPPORT //
2052 // Update WCID attribute table
2053 offset
= MAC_WCID_ATTRIBUTE_BASE
+ (Wcid
* HW_WCID_ATTRI_SIZE
);
2055 #ifdef CONFIG_STA_SUPPORT
2056 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
2058 if (pEntry
&& pEntry
->ValidAsMesh
)
2059 WCIDAttri
= (CipherAlg
<<1) | PAIRWISEKEYTABLE
;
2060 #ifdef QOS_DLS_SUPPORT
2061 else if ((pEntry
) && (pEntry
->ValidAsDls
) &&
2062 ((CipherAlg
== CIPHER_TKIP
) ||
2063 (CipherAlg
== CIPHER_TKIP_NO_MIC
) ||
2064 (CipherAlg
== CIPHER_AES
) ||
2065 (CipherAlg
== CIPHER_NONE
)))
2066 WCIDAttri
= (CipherAlg
<<1) | PAIRWISEKEYTABLE
;
2067 #endif // QOS_DLS_SUPPORT //
2069 WCIDAttri
= (CipherAlg
<<1) | SHAREDKEYTABLE
;
2071 #endif // CONFIG_STA_SUPPORT //
2073 RTMP_IO_WRITE32(pAd
, offset
, WCIDAttri
);
2076 // Update IV/EIV table
2077 offset
= MAC_IVEIV_TABLE_BASE
+ (Wcid
* HW_IVEIV_ENTRY_SIZE
);
2080 if ((CipherAlg
== CIPHER_TKIP
) || (CipherAlg
== CIPHER_TKIP_NO_MIC
) || (CipherAlg
== CIPHER_AES
))
2082 // Eiv bit on. keyid always is 0 for pairwise key
2083 IVEIV
= (KeyIdx
<<6) | 0x20;
2087 // WEP KeyIdx is default tx key.
2088 IVEIV
= (KeyIdx
<< 6);
2091 // For key index and ext IV bit, so only need to update the position(offset+3).
2093 RTUSBMultiWrite_OneByte(pAd
, offset
+3, &IVEIV
);
2096 DBGPRINT(RT_DEBUG_TRACE
,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid
, KeyIdx
, CipherName
[CipherAlg
]));
2097 DBGPRINT(RT_DEBUG_TRACE
,(" WCIDAttri = 0x%x \n", WCIDAttri
));
2102 ==========================================================================
2104 Parse encryption type
2106 pAdapter Pointer to our adapter
2107 wrq Pointer to the ioctl argument
2113 ==========================================================================
2115 CHAR
*GetEncryptType(CHAR enc
)
2117 if(enc
== Ndis802_11WEPDisabled
)
2119 if(enc
== Ndis802_11WEPEnabled
)
2121 if(enc
== Ndis802_11Encryption2Enabled
)
2123 if(enc
== Ndis802_11Encryption3Enabled
)
2125 if(enc
== Ndis802_11Encryption4Enabled
)
2131 CHAR
*GetAuthMode(CHAR auth
)
2133 if(auth
== Ndis802_11AuthModeOpen
)
2135 if(auth
== Ndis802_11AuthModeShared
)
2137 if(auth
== Ndis802_11AuthModeAutoSwitch
)
2139 if(auth
== Ndis802_11AuthModeWPA
)
2141 if(auth
== Ndis802_11AuthModeWPAPSK
)
2143 if(auth
== Ndis802_11AuthModeWPANone
)
2145 if(auth
== Ndis802_11AuthModeWPA2
)
2147 if(auth
== Ndis802_11AuthModeWPA2PSK
)
2149 if(auth
== Ndis802_11AuthModeWPA1WPA2
)
2151 if(auth
== Ndis802_11AuthModeWPA1PSKWPA2PSK
)
2152 return "WPA1PSKWPA2PSK";
2157 #if 1 //#ifndef UCOS
2159 ==========================================================================
2161 Get site survey results
2163 pAdapter Pointer to our adapter
2164 wrq Pointer to the ioctl argument
2171 1.) UI needs to wait 4 seconds after issue a site survey command
2172 2.) iwpriv ra0 get_site_survey
2173 3.) UI needs to prepare at least 4096bytes to get the results
2174 ==========================================================================
2176 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
2177 VOID
RTMPIoctlGetSiteSurvey(
2178 IN PRTMP_ADAPTER pAdapter
,
2179 IN
struct iwreq
*wrq
)
2185 CHAR Ssid
[MAX_LEN_OF_SSID
+1];
2186 INT Rssi
= 0, max_len
= LINE_LEN
;
2187 UINT Rssi_Quality
= 0;
2188 NDIS_802_11_NETWORK_TYPE wireless_mode
;
2190 os_alloc_mem(NULL
, (PUCHAR
*)&msg
, sizeof(CHAR
)*((MAX_LEN_OF_BSS_TABLE
)*max_len
));
2194 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
2198 memset(msg
, 0 ,(MAX_LEN_OF_BSS_TABLE
)*max_len
);
2199 memset(Ssid
, 0 ,(MAX_LEN_OF_SSID
+1));
2200 sprintf(msg
,"%s","\n");
2201 sprintf(msg
+strlen(msg
),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
2202 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
2206 #ifdef CONFIG_STA_SUPPORT
2207 pAdapter
->StaCfg
.bScanReqIsFromWebUI
= TRUE
;
2208 while ((ScanRunning(pAdapter
) == TRUE
) && (WaitCnt
++ < 200))
2210 #endif // CONFIG_STA_SUPPORT //
2212 for(i
=0; i
<pAdapter
->ScanTab
.BssNr
;i
++)
2214 if( pAdapter
->ScanTab
.BssEntry
[i
].Channel
==0)
2217 if((strlen(msg
)+max_len
) >= IW_SCAN_MAX_DATA
)
2221 sprintf(msg
+strlen(msg
),"%-4d", pAdapter
->ScanTab
.BssEntry
[i
].Channel
);
2223 memcpy(Ssid
, pAdapter
->ScanTab
.BssEntry
[i
].Ssid
, pAdapter
->ScanTab
.BssEntry
[i
].SsidLen
);
2224 Ssid
[pAdapter
->ScanTab
.BssEntry
[i
].SsidLen
] = '\0';
2225 sprintf(msg
+strlen(msg
),"%-33s", Ssid
);
2227 sprintf(msg
+strlen(msg
),"%02x:%02x:%02x:%02x:%02x:%02x ",
2228 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[0],
2229 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[1],
2230 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[2],
2231 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[3],
2232 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[4],
2233 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[5]);
2235 sprintf(msg
+strlen(msg
),"%-8s",GetEncryptType(pAdapter
->ScanTab
.BssEntry
[i
].WepStatus
));
2236 //Authentication Mode
2237 if (pAdapter
->ScanTab
.BssEntry
[i
].WepStatus
== Ndis802_11WEPEnabled
)
2238 sprintf(msg
+strlen(msg
),"%-10s", "UNKNOW");
2240 sprintf(msg
+strlen(msg
),"%-10s",GetAuthMode(pAdapter
->ScanTab
.BssEntry
[i
].AuthMode
));
2242 Rssi
= (INT
)pAdapter
->ScanTab
.BssEntry
[i
].Rssi
;
2245 else if (Rssi
>= -80) // between -50 ~ -80dbm
2246 Rssi_Quality
= (UINT
)(24 + ((Rssi
+ 80) * 26)/10);
2247 else if (Rssi
>= -90) // between -80 ~ -90dbm
2248 Rssi_Quality
= (UINT
)(((Rssi
+ 90) * 26)/10);
2251 sprintf(msg
+strlen(msg
),"%-9d", Rssi_Quality
);
2253 wireless_mode
= NetworkTypeInUseSanity(&pAdapter
->ScanTab
.BssEntry
[i
]);
2254 if (wireless_mode
== Ndis802_11FH
||
2255 wireless_mode
== Ndis802_11DS
)
2256 sprintf(msg
+strlen(msg
),"%-7s", "11b");
2257 else if (wireless_mode
== Ndis802_11OFDM5
)
2258 sprintf(msg
+strlen(msg
),"%-7s", "11a");
2259 else if (wireless_mode
== Ndis802_11OFDM5_N
)
2260 sprintf(msg
+strlen(msg
),"%-7s", "11a/n");
2261 else if (wireless_mode
== Ndis802_11OFDM24
)
2262 sprintf(msg
+strlen(msg
),"%-7s", "11b/g");
2263 else if (wireless_mode
== Ndis802_11OFDM24_N
)
2264 sprintf(msg
+strlen(msg
),"%-7s", "11b/g/n");
2266 sprintf(msg
+strlen(msg
),"%-7s", "unknow");
2268 if (pAdapter
->ScanTab
.BssEntry
[i
].BssType
== BSS_ADHOC
)
2269 sprintf(msg
+strlen(msg
),"%-3s", " Ad");
2271 sprintf(msg
+strlen(msg
),"%-3s", " In");
2273 sprintf(msg
+strlen(msg
),"\n");
2276 #ifdef CONFIG_STA_SUPPORT
2277 pAdapter
->StaCfg
.bScanReqIsFromWebUI
= FALSE
;
2278 #endif // CONFIG_STA_SUPPORT //
2279 wrq
->u
.data
.length
= strlen(msg
);
2280 Status
= copy_to_user(wrq
->u
.data
.pointer
, msg
, wrq
->u
.data
.length
);
2282 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq
->u
.data
.length
));
2283 os_free_mem(NULL
, (PUCHAR
)msg
);
2287 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
2288 VOID
RTMPIoctlGetMacTable(
2289 IN PRTMP_ADAPTER pAd
,
2290 IN
struct iwreq
*wrq
)
2293 RT_802_11_MAC_TABLE MacTab
;
2297 for (i
=0; i
<MAX_LEN_OF_MAC_TABLE
; i
++)
2299 if (pAd
->MacTab
.Content
[i
].ValidAsCLI
&& (pAd
->MacTab
.Content
[i
].Sst
== SST_ASSOC
))
2301 COPY_MAC_ADDR(MacTab
.Entry
[MacTab
.Num
].Addr
, &pAd
->MacTab
.Content
[i
].Addr
);
2302 MacTab
.Entry
[MacTab
.Num
].Aid
= (UCHAR
)pAd
->MacTab
.Content
[i
].Aid
;
2303 MacTab
.Entry
[MacTab
.Num
].Psm
= pAd
->MacTab
.Content
[i
].PsMode
;
2304 #ifdef DOT11_N_SUPPORT
2305 MacTab
.Entry
[MacTab
.Num
].MimoPs
= pAd
->MacTab
.Content
[i
].MmpsMode
;
2306 #endif // DOT11_N_SUPPORT //
2308 // Fill in RSSI per entry
2309 MacTab
.Entry
[MacTab
.Num
].AvgRssi0
= pAd
->MacTab
.Content
[i
].RssiSample
.AvgRssi0
;
2310 MacTab
.Entry
[MacTab
.Num
].AvgRssi1
= pAd
->MacTab
.Content
[i
].RssiSample
.AvgRssi1
;
2311 MacTab
.Entry
[MacTab
.Num
].AvgRssi2
= pAd
->MacTab
.Content
[i
].RssiSample
.AvgRssi2
;
2313 // the connected time per entry
2314 MacTab
.Entry
[MacTab
.Num
].ConnectedTime
= pAd
->MacTab
.Content
[i
].StaConnectTime
;
2316 MacTab
.Entry
[MacTab
.Num
].HSCounter
.LastDataPacketTime
= pAd
->MacTab
.Content
[i
].HSCounter
.LastDataPacketTime
;
2317 MacTab
.Entry
[MacTab
.Num
].HSCounter
.TotalRxByteCount
= pAd
->MacTab
.Content
[i
].HSCounter
.TotalRxByteCount
;
2318 MacTab
.Entry
[MacTab
.Num
].HSCounter
.TotalTxByteCount
= pAd
->MacTab
.Content
[i
].HSCounter
.TotalTxByteCount
;
2320 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.MCS
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.MCS
;
2321 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.BW
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.BW
;
2322 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.ShortGI
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.ShortGI
;
2323 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.STBC
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.STBC
;
2324 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.rsv
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.rsv
;
2325 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.MODE
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.MODE
;
2326 MacTab
.Entry
[MacTab
.Num
].TxRate
.word
= pAd
->MacTab
.Content
[i
].HTPhyMode
.word
;
2331 wrq
->u
.data
.length
= sizeof(RT_802_11_MAC_TABLE
);
2332 if (copy_to_user(wrq
->u
.data
.pointer
, &MacTab
, wrq
->u
.data
.length
))
2334 DBGPRINT(RT_DEBUG_TRACE
, ("%s: copy_to_user() fail\n", __FUNCTION__
));
2337 msg
= (CHAR
*) kmalloc(sizeof(CHAR
)*(MAX_LEN_OF_MAC_TABLE
*MAC_LINE_LEN
), MEM_ALLOC_FLAG
);
2338 memset(msg
, 0 ,MAX_LEN_OF_MAC_TABLE
*MAC_LINE_LEN
);
2339 sprintf(msg
,"%s","\n");
2340 sprintf(msg
+strlen(msg
),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
2341 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
2343 for (i
=0; i
<MAX_LEN_OF_MAC_TABLE
; i
++)
2345 PMAC_TABLE_ENTRY pEntry
= &pAd
->MacTab
.Content
[i
];
2346 if (pEntry
->ValidAsCLI
&& (pEntry
->Sst
== SST_ASSOC
))
2348 if((strlen(msg
)+MAC_LINE_LEN
) >= (MAX_LEN_OF_MAC_TABLE
*MAC_LINE_LEN
) )
2350 sprintf(msg
+strlen(msg
),"%02x%02x%02x%02x%02x%02x ",
2351 pEntry
->Addr
[0], pEntry
->Addr
[1], pEntry
->Addr
[2],
2352 pEntry
->Addr
[3], pEntry
->Addr
[4], pEntry
->Addr
[5]);
2353 sprintf(msg
+strlen(msg
),"%-4d", (int)pEntry
->Aid
);
2354 sprintf(msg
+strlen(msg
),"%-4d", (int)pEntry
->PsMode
);
2355 sprintf(msg
+strlen(msg
),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
2356 sprintf(msg
+strlen(msg
),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
2357 sprintf(msg
+strlen(msg
),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
2358 sprintf(msg
+strlen(msg
),"%-6d",RateIdToMbps
[pAd
->MacTab
.Content
[i
].CurrTxRate
]);
2359 sprintf(msg
+strlen(msg
),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
2362 // for compatible with old API just do the printk to console
2363 //wrq->u.data.length = strlen(msg);
2364 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
2366 DBGPRINT(RT_DEBUG_TRACE
, ("%s", msg
));
2373 #ifdef DOT11_N_SUPPORT
2374 INT
Set_BASetup_Proc(
2375 IN PRTMP_ADAPTER pAd
,
2379 char *token
, sepValue
[] = ":", DASH
= '-';
2381 MAC_TABLE_ENTRY
*pEntry
;
2384 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
2385 =>The six 2 digit hex-decimal number previous are the Mac address,
2386 =>The seventh decimal number is the tid value.
2388 //printk("\n%s\n", arg);
2390 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2393 token
= strchr(arg
, DASH
);
2394 if ((token
!= NULL
) && (strlen(token
)>1))
2396 tid
= simple_strtol((token
+1), 0, 10);
2401 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2403 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2405 AtoH(token
, (PUCHAR
)(&mac
[i
]), 1);
2410 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac
[0], mac
[1],
2411 mac
[2], mac
[3], mac
[4], mac
[5], tid
);
2413 pEntry
= MacTableLookup(pAd
, mac
);
2416 printk("\nSetup BA Session: Tid = %d\n", tid
);
2417 BAOriSessionSetUp(pAd
, pEntry
, tid
, 0, 100, TRUE
);
2427 INT
Set_BADecline_Proc(
2428 IN PRTMP_ADAPTER pAd
,
2433 bBADecline
= simple_strtol(arg
, 0, 10);
2435 if (bBADecline
== 0)
2437 pAd
->CommonCfg
.bBADecline
= FALSE
;
2439 else if (bBADecline
== 1)
2441 pAd
->CommonCfg
.bBADecline
= TRUE
;
2445 return FALSE
; //Invalid argument
2448 DBGPRINT(RT_DEBUG_TRACE
, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd
->CommonCfg
.bBADecline
));
2453 INT
Set_BAOriTearDown_Proc(
2454 IN PRTMP_ADAPTER pAd
,
2458 char *token
, sepValue
[] = ":", DASH
= '-';
2460 MAC_TABLE_ENTRY
*pEntry
;
2462 //printk("\n%s\n", arg);
2464 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2465 =>The six 2 digit hex-decimal number previous are the Mac address,
2466 =>The seventh decimal number is the tid value.
2468 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2471 token
= strchr(arg
, DASH
);
2472 if ((token
!= NULL
) && (strlen(token
)>1))
2474 tid
= simple_strtol((token
+1), 0, 10);
2475 if (tid
> NUM_OF_TID
)
2479 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2481 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2483 AtoH(token
, (PUCHAR
)(&mac
[i
]), 1);
2488 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac
[0], mac
[1],
2489 mac
[2], mac
[3], mac
[4], mac
[5], tid
);
2491 pEntry
= MacTableLookup(pAd
, mac
);
2494 printk("\nTear down Ori BA Session: Tid = %d\n", tid
);
2495 BAOriSessionTearDown(pAd
, pEntry
->Aid
, tid
, FALSE
, TRUE
);
2505 INT
Set_BARecTearDown_Proc(
2506 IN PRTMP_ADAPTER pAd
,
2510 char *token
, sepValue
[] = ":", DASH
= '-';
2512 MAC_TABLE_ENTRY
*pEntry
;
2514 //printk("\n%s\n", arg);
2516 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2517 =>The six 2 digit hex-decimal number previous are the Mac address,
2518 =>The seventh decimal number is the tid value.
2520 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2523 token
= strchr(arg
, DASH
);
2524 if ((token
!= NULL
) && (strlen(token
)>1))
2526 tid
= simple_strtol((token
+1), 0, 10);
2527 if (tid
> NUM_OF_TID
)
2531 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2533 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2535 AtoH(token
, (PUCHAR
)(&mac
[i
]), 1);
2540 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac
[0], mac
[1],
2541 mac
[2], mac
[3], mac
[4], mac
[5], tid
);
2543 pEntry
= MacTableLookup(pAd
, mac
);
2546 printk("\nTear down Rec BA Session: Tid = %d\n", tid
);
2547 BARecSessionTearDown(pAd
, pEntry
->Aid
, tid
, FALSE
);
2558 IN PRTMP_ADAPTER pAd
,
2563 HtBw
= simple_strtol(arg
, 0, 10);
2565 pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
= BW_40
;
2566 else if (HtBw
== BW_20
)
2567 pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
= BW_20
;
2569 return FALSE
; //Invalid argument
2573 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
));
2579 IN PRTMP_ADAPTER pAd
,
2582 ULONG HtMcs
, Mcs_tmp
;
2583 #ifdef CONFIG_STA_SUPPORT
2584 BOOLEAN bAutoRate
= FALSE
;
2585 #endif // CONFIG_STA_SUPPORT //
2587 Mcs_tmp
= simple_strtol(arg
, 0, 10);
2589 if (Mcs_tmp
<= 15 || Mcs_tmp
== 32)
2594 #ifdef CONFIG_STA_SUPPORT
2595 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
2597 pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= HtMcs
;
2598 pAd
->StaCfg
.bAutoTxRateSwitch
= (HtMcs
== MCS_AUTO
) ? TRUE
:FALSE
;
2599 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2600 pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
, pAd
->StaCfg
.bAutoTxRateSwitch
));
2602 if ((pAd
->CommonCfg
.PhyMode
< PHY_11ABGN_MIXED
) ||
2603 (pAd
->MacTab
.Content
[BSSID_WCID
].HTPhyMode
.field
.MODE
< MODE_HTMIX
))
2605 if ((pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
!= MCS_AUTO
) &&
2606 (HtMcs
>= 0 && HtMcs
<= 3) &&
2607 (pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
== FIXED_TXMODE_CCK
))
2609 RTMPSetDesiredRates(pAd
, (LONG
) (RateIdToMbps
[HtMcs
] * 1000000));
2611 else if ((pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
!= MCS_AUTO
) &&
2612 (HtMcs
>= 0 && HtMcs
<= 7) &&
2613 (pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
== FIXED_TXMODE_OFDM
))
2615 RTMPSetDesiredRates(pAd
, (LONG
) (RateIdToMbps
[HtMcs
+4] * 1000000));
2622 pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_AUTO
;
2623 RTMPSetDesiredRates(pAd
, -1);
2625 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
));
2630 #endif // CONFIG_STA_SUPPORT //
2638 IN PRTMP_ADAPTER pAd
,
2643 HtGi
= simple_strtol(arg
, 0, 10);
2645 if ( HtGi
== GI_400
)
2646 pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
= GI_400
;
2647 else if ( HtGi
== GI_800
)
2648 pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
= GI_800
;
2650 return FALSE
; //Invalid argument
2654 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
));
2660 INT
Set_HtTxBASize_Proc(
2661 IN PRTMP_ADAPTER pAd
,
2666 Size
= simple_strtol(arg
, 0, 10);
2668 if (Size
<=0 || Size
>=64)
2672 pAd
->CommonCfg
.TxBASize
= Size
-1;
2673 DBGPRINT(RT_DEBUG_ERROR
, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size
));
2679 INT
Set_HtOpMode_Proc(
2680 IN PRTMP_ADAPTER pAd
,
2686 Value
= simple_strtol(arg
, 0, 10);
2688 if (Value
== HTMODE_GF
)
2689 pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
= HTMODE_GF
;
2690 else if ( Value
== HTMODE_MM
)
2691 pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
= HTMODE_MM
;
2693 return FALSE
; //Invalid argument
2697 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
));
2703 INT
Set_HtStbc_Proc(
2704 IN PRTMP_ADAPTER pAd
,
2710 Value
= simple_strtol(arg
, 0, 10);
2712 if (Value
== STBC_USE
)
2713 pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
= STBC_USE
;
2714 else if ( Value
== STBC_NONE
)
2715 pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
= STBC_NONE
;
2717 return FALSE
; //Invalid argument
2721 DBGPRINT(RT_DEBUG_TRACE
, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
));
2727 IN PRTMP_ADAPTER pAd
,
2733 Value
= simple_strtol(arg
, 0, 10);
2735 pAd
->HTCEnable
= FALSE
;
2736 else if ( Value
==1 )
2737 pAd
->HTCEnable
= TRUE
;
2739 return FALSE
; //Invalid argument
2741 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd
->HTCEnable
));
2746 INT
Set_HtExtcha_Proc(
2747 IN PRTMP_ADAPTER pAd
,
2753 Value
= simple_strtol(arg
, 0, 10);
2756 pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
= EXTCHA_BELOW
;
2757 else if ( Value
==1 )
2758 pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
= EXTCHA_ABOVE
;
2760 return FALSE
; //Invalid argument
2764 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
));
2769 INT
Set_HtMpduDensity_Proc(
2770 IN PRTMP_ADAPTER pAd
,
2775 Value
= simple_strtol(arg
, 0, 10);
2777 if (Value
<=7 && Value
>= 0)
2778 pAd
->CommonCfg
.BACapability
.field
.MpduDensity
= Value
;
2780 pAd
->CommonCfg
.BACapability
.field
.MpduDensity
= 4;
2784 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd
->CommonCfg
.BACapability
.field
.MpduDensity
));
2789 INT
Set_HtBaWinSize_Proc(
2790 IN PRTMP_ADAPTER pAd
,
2795 Value
= simple_strtol(arg
, 0, 10);
2798 if (Value
>=1 && Value
<= 64)
2800 pAd
->CommonCfg
.REGBACapability
.field
.RxBAWinLimit
= Value
;
2801 pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
= Value
;
2805 pAd
->CommonCfg
.REGBACapability
.field
.RxBAWinLimit
= 64;
2806 pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
= 64;
2811 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
));
2817 IN PRTMP_ADAPTER pAd
,
2822 Value
= simple_strtol(arg
, 0, 10);
2825 pAd
->CommonCfg
.bRdg
= FALSE
;
2826 else if ( Value
==1 )
2828 pAd
->HTCEnable
= TRUE
;
2829 pAd
->CommonCfg
.bRdg
= TRUE
;
2832 return FALSE
; //Invalid argument
2836 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd
->CommonCfg
.bRdg
));
2841 INT
Set_HtLinkAdapt_Proc(
2842 IN PRTMP_ADAPTER pAd
,
2847 Value
= simple_strtol(arg
, 0, 10);
2849 pAd
->bLinkAdapt
= FALSE
;
2850 else if ( Value
==1 )
2852 pAd
->HTCEnable
= TRUE
;
2853 pAd
->bLinkAdapt
= TRUE
;
2856 return FALSE
; //Invalid argument
2858 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd
->bLinkAdapt
));
2863 INT
Set_HtAmsdu_Proc(
2864 IN PRTMP_ADAPTER pAd
,
2869 Value
= simple_strtol(arg
, 0, 10);
2871 pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
= FALSE
;
2872 else if ( Value
== 1 )
2873 pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
= TRUE
;
2875 return FALSE
; //Invalid argument
2879 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
));
2884 INT
Set_HtAutoBa_Proc(
2885 IN PRTMP_ADAPTER pAd
,
2890 Value
= simple_strtol(arg
, 0, 10);
2892 pAd
->CommonCfg
.BACapability
.field
.AutoBA
= FALSE
;
2893 else if (Value
== 1)
2894 pAd
->CommonCfg
.BACapability
.field
.AutoBA
= TRUE
;
2896 return FALSE
; //Invalid argument
2898 pAd
->CommonCfg
.REGBACapability
.field
.AutoBA
= pAd
->CommonCfg
.BACapability
.field
.AutoBA
;
2901 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd
->CommonCfg
.BACapability
.field
.AutoBA
));
2907 INT
Set_HtProtect_Proc(
2908 IN PRTMP_ADAPTER pAd
,
2913 Value
= simple_strtol(arg
, 0, 10);
2915 pAd
->CommonCfg
.bHTProtect
= FALSE
;
2916 else if (Value
== 1)
2917 pAd
->CommonCfg
.bHTProtect
= TRUE
;
2919 return FALSE
; //Invalid argument
2921 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd
->CommonCfg
.bHTProtect
));
2926 INT
Set_SendPSMPAction_Proc(
2927 IN PRTMP_ADAPTER pAd
,
2931 char *token
, sepValue
[] = ":", DASH
= '-';
2933 MAC_TABLE_ENTRY
*pEntry
;
2935 //printk("\n%s\n", arg);
2937 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2938 =>The six 2 digit hex-decimal number previous are the Mac address,
2939 =>The seventh decimal number is the mode value.
2941 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2944 token
= strchr(arg
, DASH
);
2945 if ((token
!= NULL
) && (strlen(token
)>1))
2947 mode
= simple_strtol((token
+1), 0, 10);
2948 if (mode
> MMPS_ENABLE
)
2952 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2954 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2956 AtoH(token
, (PUCHAR
)(&mac
[i
]), 1);
2961 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac
[0], mac
[1],
2962 mac
[2], mac
[3], mac
[4], mac
[5], mode
);
2964 pEntry
= MacTableLookup(pAd
, mac
);
2967 printk("\nSendPSMPAction MIPS mode = %d\n", mode
);
2968 SendPSMPAction(pAd
, pEntry
->Aid
, mode
);
2979 INT
Set_HtMIMOPSmode_Proc(
2980 IN PRTMP_ADAPTER pAd
,
2985 Value
= simple_strtol(arg
, 0, 10);
2987 if (Value
<=3 && Value
>= 0)
2988 pAd
->CommonCfg
.BACapability
.field
.MMPSmode
= Value
;
2990 pAd
->CommonCfg
.BACapability
.field
.MMPSmode
= 3;
2994 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd
->CommonCfg
.BACapability
.field
.MMPSmode
));
3000 INT
Set_ForceShortGI_Proc(
3001 IN PRTMP_ADAPTER pAd
,
3006 Value
= simple_strtol(arg
, 0, 10);
3008 pAd
->WIFItestbed
.bShortGI
= FALSE
;
3009 else if (Value
== 1)
3010 pAd
->WIFItestbed
.bShortGI
= TRUE
;
3012 return FALSE
; //Invalid argument
3016 DBGPRINT(RT_DEBUG_TRACE
, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd
->WIFItestbed
.bShortGI
));
3023 INT
Set_ForceGF_Proc(
3024 IN PRTMP_ADAPTER pAd
,
3029 Value
= simple_strtol(arg
, 0, 10);
3031 pAd
->WIFItestbed
.bGreenField
= FALSE
;
3032 else if (Value
== 1)
3033 pAd
->WIFItestbed
.bGreenField
= TRUE
;
3035 return FALSE
; //Invalid argument
3039 DBGPRINT(RT_DEBUG_TRACE
, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd
->WIFItestbed
.bGreenField
));
3044 INT
Set_HtMimoPs_Proc(
3045 IN PRTMP_ADAPTER pAd
,
3050 Value
= simple_strtol(arg
, 0, 10);
3052 pAd
->CommonCfg
.bMIMOPSEnable
= FALSE
;
3053 else if (Value
== 1)
3054 pAd
->CommonCfg
.bMIMOPSEnable
= TRUE
;
3056 return FALSE
; //Invalid argument
3058 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd
->CommonCfg
.bMIMOPSEnable
));
3062 #endif // DOT11_N_SUPPORT //
3065 #ifdef DOT11_N_SUPPORT
3067 IN PRTMP_ADAPTER pAd
)
3069 OID_SET_HT_PHYMODE SetHT
;
3071 if (pAd
->CommonCfg
.PhyMode
< PHY_11ABGN_MIXED
)
3074 SetHT
.PhyMode
= pAd
->CommonCfg
.PhyMode
;
3075 SetHT
.TransmitNo
= ((UCHAR
)pAd
->Antenna
.field
.TxPath
);
3076 SetHT
.HtMode
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
;
3077 SetHT
.ExtOffset
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
;
3078 SetHT
.MCS
= MCS_AUTO
;
3079 SetHT
.BW
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
;
3080 SetHT
.STBC
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
;
3081 SetHT
.SHORTGI
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
;
3083 RTMPSetHT(pAd
, &SetHT
);
3087 #endif // DOT11_N_SUPPORT //
3089 INT
Set_FixedTxMode_Proc(
3090 IN PRTMP_ADAPTER pAd
,
3093 UCHAR fix_tx_mode
= FIXED_TXMODE_HT
;
3095 if (strcmp(arg
, "OFDM") == 0 || strcmp(arg
, "ofdm") == 0)
3097 fix_tx_mode
= FIXED_TXMODE_OFDM
;
3099 else if (strcmp(arg
, "CCK") == 0 || strcmp(arg
, "cck") == 0)
3101 fix_tx_mode
= FIXED_TXMODE_CCK
;
3104 #ifdef CONFIG_STA_SUPPORT
3105 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3106 pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
= fix_tx_mode
;
3107 #endif // CONFIG_STA_SUPPORT //
3109 DBGPRINT(RT_DEBUG_TRACE
, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode
));
3114 #ifdef CONFIG_APSTA_MIXED_SUPPORT
3115 INT
Set_OpMode_Proc(
3116 IN PRTMP_ADAPTER pAd
,
3121 Value
= simple_strtol(arg
, 0, 10);
3124 if (RTMP_TEST_FLAG(pAd
, fRTMP_ADAPTER_START_UP
))
3127 DBGPRINT(RT_DEBUG_ERROR
, ("Can not switch operate mode on interface up !! \n"));
3132 pAd
->OpMode
= OPMODE_STA
;
3133 else if (Value
== 1)
3134 pAd
->OpMode
= OPMODE_AP
;
3136 return FALSE
; //Invalid argument
3138 DBGPRINT(RT_DEBUG_TRACE
, ("Set_OpMode_Proc::(OpMode=%s)\n", pAd
->OpMode
== 1 ? "AP Mode" : "STA Mode"));
3142 #endif // CONFIG_APSTA_MIXED_SUPPORT //
3145 /////////////////////////////////////////////////////////////////////////
3146 PCHAR
RTMPGetRalinkAuthModeStr(
3147 IN NDIS_802_11_AUTHENTICATION_MODE authMode
)
3151 case Ndis802_11AuthModeOpen
:
3153 case Ndis802_11AuthModeWPAPSK
:
3155 case Ndis802_11AuthModeShared
:
3157 case Ndis802_11AuthModeWPA
:
3159 case Ndis802_11AuthModeWPA2
:
3161 case Ndis802_11AuthModeWPA2PSK
:
3163 case Ndis802_11AuthModeWPA1PSKWPA2PSK
:
3164 return "WPAPSKWPA2PSK";
3165 case Ndis802_11AuthModeWPA1WPA2
:
3167 case Ndis802_11AuthModeWPANone
:
3174 PCHAR
RTMPGetRalinkEncryModeStr(
3175 IN USHORT encryMode
)
3179 case Ndis802_11WEPDisabled
:
3181 case Ndis802_11WEPEnabled
:
3183 case Ndis802_11Encryption2Enabled
:
3185 case Ndis802_11Encryption3Enabled
:
3187 case Ndis802_11Encryption4Enabled
:
3194 INT
RTMPShowCfgValue(
3195 IN PRTMP_ADAPTER pAd
,
3201 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
++)
3203 if (!strcmp(pName
, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
))
3205 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->show_proc(pAd
, pBuf
))
3207 break; //Exit for loop.
3211 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
== NULL
)
3213 sprintf(pBuf
, "\n");
3214 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
++)
3215 sprintf(pBuf
, "%s%s\n", pBuf
, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
);
3222 IN PRTMP_ADAPTER pAd
,
3226 #ifdef CONFIG_STA_SUPPORT
3227 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3228 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.Ssid
);
3229 #endif // CONFIG_STA_SUPPORT //
3233 INT
Show_WirelessMode_Proc(
3234 IN PRTMP_ADAPTER pAd
,
3237 switch(pAd
->CommonCfg
.PhyMode
)
3239 case PHY_11BG_MIXED
:
3240 sprintf(pBuf
, "\t11B/G");
3243 sprintf(pBuf
, "\t11B");
3246 sprintf(pBuf
, "\t11A");
3248 case PHY_11ABG_MIXED
:
3249 sprintf(pBuf
, "\t11A/B/G");
3252 sprintf(pBuf
, "\t11G");
3254 #ifdef DOT11_N_SUPPORT
3255 case PHY_11ABGN_MIXED
:
3256 sprintf(pBuf
, "\t11A/B/G/N");
3259 sprintf(pBuf
, "\t11N only with 2.4G");
3261 case PHY_11GN_MIXED
:
3262 sprintf(pBuf
, "\t11G/N");
3264 case PHY_11AN_MIXED
:
3265 sprintf(pBuf
, "\t11A/N");
3267 case PHY_11BGN_MIXED
:
3268 sprintf(pBuf
, "\t11B/G/N");
3270 case PHY_11AGN_MIXED
:
3271 sprintf(pBuf
, "\t11A/G/N");
3274 sprintf(pBuf
, "\t11N only with 5G");
3276 #endif // DOT11_N_SUPPORT //
3278 sprintf(pBuf
, "\tUnknow Value(%d)", pAd
->CommonCfg
.PhyMode
);
3285 INT
Show_TxBurst_Proc(
3286 IN PRTMP_ADAPTER pAd
,
3289 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bEnableTxBurst
? "TRUE":"FALSE");
3293 INT
Show_TxPreamble_Proc(
3294 IN PRTMP_ADAPTER pAd
,
3297 switch(pAd
->CommonCfg
.TxPreamble
)
3299 case Rt802_11PreambleShort
:
3300 sprintf(pBuf
, "\tShort");
3302 case Rt802_11PreambleLong
:
3303 sprintf(pBuf
, "\tLong");
3305 case Rt802_11PreambleAuto
:
3306 sprintf(pBuf
, "\tAuto");
3309 sprintf(pBuf
, "\tUnknow Value(%lu)", pAd
->CommonCfg
.TxPreamble
);
3316 INT
Show_TxPower_Proc(
3317 IN PRTMP_ADAPTER pAd
,
3320 sprintf(pBuf
, "\t%lu", pAd
->CommonCfg
.TxPowerPercentage
);
3324 INT
Show_Channel_Proc(
3325 IN PRTMP_ADAPTER pAd
,
3328 sprintf(pBuf
, "\t%d", pAd
->CommonCfg
.Channel
);
3332 INT
Show_BGProtection_Proc(
3333 IN PRTMP_ADAPTER pAd
,
3336 switch(pAd
->CommonCfg
.UseBGProtection
)
3339 sprintf(pBuf
, "\tON");
3341 case 2: //Always OFF
3342 sprintf(pBuf
, "\tOFF");
3345 sprintf(pBuf
, "\tAuto");
3348 sprintf(pBuf
, "\tUnknow Value(%lu)", pAd
->CommonCfg
.UseBGProtection
);
3354 INT
Show_RTSThreshold_Proc(
3355 IN PRTMP_ADAPTER pAd
,
3358 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.RtsThreshold
);
3362 INT
Show_FragThreshold_Proc(
3363 IN PRTMP_ADAPTER pAd
,
3366 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.FragmentThreshold
);
3370 #ifdef DOT11_N_SUPPORT
3372 IN PRTMP_ADAPTER pAd
,
3375 if (pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
== BW_40
)
3377 sprintf(pBuf
, "\t40 MHz");
3381 sprintf(pBuf
, "\t20 MHz");
3386 INT
Show_HtMcs_Proc(
3387 IN PRTMP_ADAPTER pAd
,
3391 #ifdef CONFIG_STA_SUPPORT
3392 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3393 sprintf(pBuf
, "\t%u", pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
);
3394 #endif // CONFIG_STA_SUPPORT //
3399 IN PRTMP_ADAPTER pAd
,
3402 switch(pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
)
3405 sprintf(pBuf
, "\tGI_400");
3408 sprintf(pBuf
, "\tGI_800");
3411 sprintf(pBuf
, "\tUnknow Value(%u)", pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
);
3417 INT
Show_HtOpMode_Proc(
3418 IN PRTMP_ADAPTER pAd
,
3421 switch(pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
)
3424 sprintf(pBuf
, "\tGF");
3427 sprintf(pBuf
, "\tMM");
3430 sprintf(pBuf
, "\tUnknow Value(%u)", pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
);
3436 INT
Show_HtExtcha_Proc(
3437 IN PRTMP_ADAPTER pAd
,
3440 switch(pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
)
3443 sprintf(pBuf
, "\tBelow");
3446 sprintf(pBuf
, "\tAbove");
3449 sprintf(pBuf
, "\tUnknow Value(%u)", pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
);
3456 INT
Show_HtMpduDensity_Proc(
3457 IN PRTMP_ADAPTER pAd
,
3460 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.BACapability
.field
.MpduDensity
);
3464 INT
Show_HtBaWinSize_Proc(
3465 IN PRTMP_ADAPTER pAd
,
3468 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
);
3472 INT
Show_HtRdg_Proc(
3473 IN PRTMP_ADAPTER pAd
,
3476 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bRdg
? "TRUE":"FALSE");
3480 INT
Show_HtAmsdu_Proc(
3481 IN PRTMP_ADAPTER pAd
,
3484 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
? "TRUE":"FALSE");
3488 INT
Show_HtAutoBa_Proc(
3489 IN PRTMP_ADAPTER pAd
,
3492 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.BACapability
.field
.AutoBA
? "TRUE":"FALSE");
3495 #endif // DOT11_N_SUPPORT //
3497 INT
Show_CountryRegion_Proc(
3498 IN PRTMP_ADAPTER pAd
,
3501 sprintf(pBuf
, "\t%d", pAd
->CommonCfg
.CountryRegion
);
3505 INT
Show_CountryRegionABand_Proc(
3506 IN PRTMP_ADAPTER pAd
,
3509 sprintf(pBuf
, "\t%d", pAd
->CommonCfg
.CountryRegionForABand
);
3513 INT
Show_CountryCode_Proc(
3514 IN PRTMP_ADAPTER pAd
,
3517 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.CountryCode
);
3521 #ifdef AGGREGATION_SUPPORT
3522 INT
Show_PktAggregate_Proc(
3523 IN PRTMP_ADAPTER pAd
,
3526 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bAggregationCapable
? "TRUE":"FALSE");
3529 #endif // AGGREGATION_SUPPORT //
3532 INT
Show_WmmCapable_Proc(
3533 IN PRTMP_ADAPTER pAd
,
3537 #ifdef CONFIG_STA_SUPPORT
3538 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3539 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bWmmCapable
? "TRUE":"FALSE");
3540 #endif // CONFIG_STA_SUPPORT //
3544 #endif // WMM_SUPPORT //
3546 INT
Show_IEEE80211H_Proc(
3547 IN PRTMP_ADAPTER pAd
,
3550 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bIEEE80211H
? "TRUE":"FALSE");
3554 #ifdef CONFIG_STA_SUPPORT
3555 INT
Show_NetworkType_Proc(
3556 IN PRTMP_ADAPTER pAd
,
3559 switch(pAd
->StaCfg
.BssType
)
3562 sprintf(pBuf
, "\tAdhoc");
3565 sprintf(pBuf
, "\tInfra");
3568 sprintf(pBuf
, "\tAny");
3571 sprintf(pBuf
, "\tMonitor");
3574 sprintf(pBuf
, "\tUnknow Value(%d)", pAd
->StaCfg
.BssType
);
3579 #endif // CONFIG_STA_SUPPORT //
3581 INT
Show_AuthMode_Proc(
3582 IN PRTMP_ADAPTER pAd
,
3585 NDIS_802_11_AUTHENTICATION_MODE AuthMode
= Ndis802_11AuthModeOpen
;
3587 #ifdef CONFIG_STA_SUPPORT
3588 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3589 AuthMode
= pAd
->StaCfg
.AuthMode
;
3590 #endif // CONFIG_STA_SUPPORT //
3592 if ((AuthMode
>= Ndis802_11AuthModeOpen
) &&
3593 (AuthMode
<= Ndis802_11AuthModeWPA1PSKWPA2PSK
))
3594 sprintf(pBuf
, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode
));
3596 sprintf(pBuf
, "\tUnknow Value(%d)", AuthMode
);
3601 INT
Show_EncrypType_Proc(
3602 IN PRTMP_ADAPTER pAd
,
3605 NDIS_802_11_WEP_STATUS WepStatus
= Ndis802_11WEPDisabled
;
3607 #ifdef CONFIG_STA_SUPPORT
3608 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3609 WepStatus
= pAd
->StaCfg
.WepStatus
;
3610 #endif // CONFIG_STA_SUPPORT //
3612 if ((WepStatus
>= Ndis802_11WEPEnabled
) &&
3613 (WepStatus
<= Ndis802_11Encryption4KeyAbsent
))
3614 sprintf(pBuf
, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus
));
3616 sprintf(pBuf
, "\tUnknow Value(%d)", WepStatus
);
3621 INT
Show_DefaultKeyID_Proc(
3622 IN PRTMP_ADAPTER pAd
,
3625 UCHAR DefaultKeyId
= 0;
3627 #ifdef CONFIG_STA_SUPPORT
3628 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3629 DefaultKeyId
= pAd
->StaCfg
.DefaultKeyId
;
3630 #endif // CONFIG_STA_SUPPORT //
3632 sprintf(pBuf
, "\t%d", DefaultKeyId
);
3637 INT
Show_WepKey_Proc(
3638 IN PRTMP_ADAPTER pAd
,
3642 UCHAR Key
[16] = {0}, KeyLength
= 0;
3645 KeyLength
= pAd
->SharedKey
[index
][KeyIdx
].KeyLen
;
3646 NdisMoveMemory(Key
, pAd
->SharedKey
[index
][KeyIdx
].Key
, KeyLength
);
3648 //check key string is ASCII or not
3649 if (RTMPCheckStrPrintAble(Key
, KeyLength
))
3650 sprintf(pBuf
, "\t%s", Key
);
3654 sprintf(pBuf
, "\t");
3655 for (idx
= 0; idx
< KeyLength
; idx
++)
3656 sprintf(pBuf
+strlen(pBuf
), "%02X", Key
[idx
]);
3662 IN PRTMP_ADAPTER pAd
,
3665 Show_WepKey_Proc(pAd
, 0, pBuf
);
3670 IN PRTMP_ADAPTER pAd
,
3673 Show_WepKey_Proc(pAd
, 1, pBuf
);
3678 IN PRTMP_ADAPTER pAd
,
3681 Show_WepKey_Proc(pAd
, 2, pBuf
);
3686 IN PRTMP_ADAPTER pAd
,
3689 Show_WepKey_Proc(pAd
, 3, pBuf
);
3693 INT
Show_WPAPSK_Proc(
3694 IN PRTMP_ADAPTER pAd
,
3698 UCHAR PMK
[32] = {0};
3701 #ifdef CONFIG_STA_SUPPORT
3702 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3703 NdisMoveMemory(PMK
, pAd
->StaCfg
.PMK
, 32);
3704 #endif // CONFIG_STA_SUPPORT //
3706 sprintf(pBuf
, "\tPMK = ");
3707 for (idx
= 0; idx
< 32; idx
++)
3708 sprintf(pBuf
+strlen(pBuf
), "%02X", PMK
[idx
]);