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
,
819 PRT28XX_RXD_STRUC pRxD
;
821 PRTMP_TX_RING pTxRing
= &pAd
->TxRing
[QueIdx
];
822 PRTMP_MGMT_RING pMgmtRing
= &pAd
->MgmtRing
;
823 PRTMP_RX_RING pRxRing
= &pAd
->RxRing
;
825 for(i
=0;i
<TX_RING_SIZE
;i
++)
827 pTxD
= (PTXD_STRUC
) pTxRing
->Cell
[i
].AllocVa
;
828 printk("Desc #%d\n",i
);
829 hex_dump("Tx Descriptor", (char *)pTxD
, 16);
830 printk("pTxD->DMADONE = %x\n", pTxD
->DMADONE
);
832 printk("---------------------------------------------------\n");
833 for(i
=0;i
<MGMT_RING_SIZE
;i
++)
835 pTxD
= (PTXD_STRUC
) pMgmtRing
->Cell
[i
].AllocVa
;
836 printk("Desc #%d\n",i
);
837 hex_dump("Mgmt Descriptor", (char *)pTxD
, 16);
838 printk("pMgmt->DMADONE = %x\n", pTxD
->DMADONE
);
840 printk("---------------------------------------------------\n");
841 for(i
=0;i
<RX_RING_SIZE
;i
++)
843 pRxD
= (PRT28XX_RXD_STRUC
) pRxRing
->Cell
[i
].AllocVa
;
844 printk("Desc #%d\n",i
);
845 hex_dump("Rx Descriptor", (char *)pRxD
, 16);
846 printk("pRxD->DDONE = %x\n", pRxD
->DDONE
);
854 ==========================================================================
856 Reset statistics counter
859 pAdapter Pointer to our adapter
863 TRUE if all parameters are OK, FALSE otherwise
864 ==========================================================================
866 INT
Set_ResetStatCounter_Proc(
867 IN PRTMP_ADAPTER pAd
,
870 DBGPRINT(RT_DEBUG_TRACE
, ("==>Set_ResetStatCounter_Proc\n"));
872 // add the most up-to-date h/w raw counters into software counters
873 NICUpdateRawCounters(pAd
);
875 NdisZeroMemory(&pAd
->WlanCounters
, sizeof(COUNTER_802_11
));
876 NdisZeroMemory(&pAd
->Counters8023
, sizeof(COUNTER_802_3
));
877 NdisZeroMemory(&pAd
->RalinkCounters
, sizeof(COUNTER_RALINK
));
882 BOOLEAN
RTMPCheckStrPrintAble(
888 for (i
=0; i
<strLen
; i
++)
890 if ((pInPutStr
[i
] < 0x21) ||
891 (pInPutStr
[i
] > 0x7E))
899 ========================================================================
902 Remove WPA Key process
905 pAd Pointer to our adapter
906 pBuf Pointer to the where the key stored
909 NDIS_SUCCESS Add key successfully
911 IRQL = DISPATCH_LEVEL
915 ========================================================================
917 #ifdef CONFIG_STA_SUPPORT
918 VOID
RTMPSetDesiredRates(
919 IN PRTMP_ADAPTER pAdapter
,
922 NDIS_802_11_RATES aryRates
;
924 memset(&aryRates
, 0x00, sizeof(NDIS_802_11_RATES
));
925 switch (pAdapter
->CommonCfg
.PhyMode
)
927 case PHY_11A
: // A only
931 aryRates
[0] = 0x0c; // 6M
932 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_0
;
935 aryRates
[0] = 0x12; // 9M
936 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_1
;
939 aryRates
[0] = 0x18; // 12M
940 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_2
;
943 aryRates
[0] = 0x24; // 18M
944 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_3
;
947 aryRates
[0] = 0x30; // 24M
948 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_4
;
951 aryRates
[0] = 0x48; // 36M
952 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_5
;
955 aryRates
[0] = 0x60; // 48M
956 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_6
;
959 aryRates
[0] = 0x6c; // 54M
960 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_7
;
964 aryRates
[0] = 0x6c; // 54Mbps
965 aryRates
[1] = 0x60; // 48Mbps
966 aryRates
[2] = 0x48; // 36Mbps
967 aryRates
[3] = 0x30; // 24Mbps
968 aryRates
[4] = 0x24; // 18M
969 aryRates
[5] = 0x18; // 12M
970 aryRates
[6] = 0x12; // 9M
971 aryRates
[7] = 0x0c; // 6M
972 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_AUTO
;
976 case PHY_11BG_MIXED
: // B/G Mixed
977 case PHY_11B
: // B only
978 case PHY_11ABG_MIXED
: // A/B/G Mixed
984 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_0
;
988 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_1
;
991 aryRates
[0] = 0x0b; // 5.5M
992 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_2
;
995 aryRates
[0] = 0x16; // 11M
996 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_3
;
999 aryRates
[0] = 0x0c; // 6M
1000 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_0
;
1003 aryRates
[0] = 0x12; // 9M
1004 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_1
;
1006 case 12000000: //12M
1007 aryRates
[0] = 0x18; // 12M
1008 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_2
;
1010 case 18000000: //18M
1011 aryRates
[0] = 0x24; // 18M
1012 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_3
;
1014 case 24000000: //24M
1015 aryRates
[0] = 0x30; // 24M
1016 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_4
;
1018 case 36000000: //36M
1019 aryRates
[0] = 0x48; // 36M
1020 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_5
;
1022 case 48000000: //48M
1023 aryRates
[0] = 0x60; // 48M
1024 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_6
;
1026 case 54000000: //54M
1027 aryRates
[0] = 0x6c; // 54M
1028 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_7
;
1032 if (pAdapter
->CommonCfg
.PhyMode
== PHY_11B
)
1034 aryRates
[0] = 0x16; // 11Mbps
1035 aryRates
[1] = 0x0b; // 5.5Mbps
1036 aryRates
[2] = 0x04; // 2Mbps
1037 aryRates
[3] = 0x02; // 1Mbps
1040 { //(B/G) Mixed or (A/B/G) Mixed
1041 aryRates
[0] = 0x6c; // 54Mbps
1042 aryRates
[1] = 0x60; // 48Mbps
1043 aryRates
[2] = 0x48; // 36Mbps
1044 aryRates
[3] = 0x30; // 24Mbps
1045 aryRates
[4] = 0x16; // 11Mbps
1046 aryRates
[5] = 0x0b; // 5.5Mbps
1047 aryRates
[6] = 0x04; // 2Mbps
1048 aryRates
[7] = 0x02; // 1Mbps
1050 pAdapter
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_AUTO
;
1056 NdisZeroMemory(pAdapter
->CommonCfg
.DesireRate
, MAX_LEN_OF_SUPPORTED_RATES
);
1057 NdisMoveMemory(pAdapter
->CommonCfg
.DesireRate
, &aryRates
, sizeof(NDIS_802_11_RATES
));
1058 DBGPRINT(RT_DEBUG_TRACE
, (" RTMPSetDesiredRates (%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x)\n",
1059 pAdapter
->CommonCfg
.DesireRate
[0],pAdapter
->CommonCfg
.DesireRate
[1],
1060 pAdapter
->CommonCfg
.DesireRate
[2],pAdapter
->CommonCfg
.DesireRate
[3],
1061 pAdapter
->CommonCfg
.DesireRate
[4],pAdapter
->CommonCfg
.DesireRate
[5],
1062 pAdapter
->CommonCfg
.DesireRate
[6],pAdapter
->CommonCfg
.DesireRate
[7] ));
1063 // Changing DesiredRate may affect the MAX TX rate we used to TX frames out
1064 MlmeUpdateTxRates(pAdapter
, FALSE
, 0);
1067 NDIS_STATUS
RTMPWPARemoveKeyProc(
1068 IN PRTMP_ADAPTER pAd
,
1071 PNDIS_802_11_REMOVE_KEY pKey
;
1073 NDIS_STATUS Status
= NDIS_STATUS_FAILURE
;
1074 BOOLEAN bTxKey
; // Set the key as transmit key
1075 BOOLEAN bPairwise
; // Indicate the key is pairwise key
1076 BOOLEAN bKeyRSC
; // indicate the receive SC set by KeyRSC value.
1077 // Otherwise, it will set by the NIC.
1078 BOOLEAN bAuthenticator
; // indicate key is set by authenticator.
1081 DBGPRINT(RT_DEBUG_TRACE
,("---> RTMPWPARemoveKeyProc\n"));
1083 pKey
= (PNDIS_802_11_REMOVE_KEY
) pBuf
;
1084 KeyIdx
= pKey
->KeyIndex
& 0xff;
1085 // Bit 31 of Add-key, Tx Key
1086 bTxKey
= (pKey
->KeyIndex
& 0x80000000) ? TRUE
: FALSE
;
1087 // Bit 30 of Add-key PairwiseKey
1088 bPairwise
= (pKey
->KeyIndex
& 0x40000000) ? TRUE
: FALSE
;
1089 // Bit 29 of Add-key KeyRSC
1090 bKeyRSC
= (pKey
->KeyIndex
& 0x20000000) ? TRUE
: FALSE
;
1091 // Bit 28 of Add-key Authenticator
1092 bAuthenticator
= (pKey
->KeyIndex
& 0x10000000) ? TRUE
: FALSE
;
1094 // 1. If bTx is TRUE, return failure information
1096 return(NDIS_STATUS_INVALID_DATA
);
1098 // 2. Check Pairwise Key
1101 // a. If BSSID is broadcast, remove all pairwise keys.
1102 // b. If not broadcast, remove the pairwise specified by BSSID
1103 for (i
= 0; i
< SHARE_KEY_NUM
; i
++)
1105 if (MAC_ADDR_EQUAL(pAd
->SharedKey
[BSS0
][i
].BssId
, pKey
->BSSID
))
1107 DBGPRINT(RT_DEBUG_TRACE
,("RTMPWPARemoveKeyProc(KeyIdx=%d)\n", i
));
1108 pAd
->SharedKey
[BSS0
][i
].KeyLen
= 0;
1109 pAd
->SharedKey
[BSS0
][i
].CipherAlg
= CIPHER_NONE
;
1110 AsicRemoveSharedKeyEntry(pAd
, BSS0
, (UCHAR
)i
);
1111 Status
= NDIS_STATUS_SUCCESS
;
1119 // a. If BSSID is broadcast, remove all group keys indexed
1120 // b. If BSSID matched, delete the group key indexed.
1121 DBGPRINT(RT_DEBUG_TRACE
,("RTMPWPARemoveKeyProc(KeyIdx=%ld)\n", KeyIdx
));
1122 pAd
->SharedKey
[BSS0
][KeyIdx
].KeyLen
= 0;
1123 pAd
->SharedKey
[BSS0
][KeyIdx
].CipherAlg
= CIPHER_NONE
;
1124 AsicRemoveSharedKeyEntry(pAd
, BSS0
, (UCHAR
)KeyIdx
);
1125 Status
= NDIS_STATUS_SUCCESS
;
1130 #endif // CONFIG_STA_SUPPORT //
1133 #ifdef CONFIG_STA_SUPPORT
1135 ========================================================================
1137 Routine Description:
1141 pAd Pointer to our adapter
1146 IRQL = DISPATCH_LEVEL
1150 ========================================================================
1152 VOID
RTMPWPARemoveAllKeys(
1153 IN PRTMP_ADAPTER pAd
)
1158 DBGPRINT(RT_DEBUG_TRACE
,("RTMPWPARemoveAllKeys(AuthMode=%d, WepStatus=%d)\n", pAd
->StaCfg
.AuthMode
, pAd
->StaCfg
.WepStatus
));
1160 // For WEP/CKIP, there is no need to remove it, since WinXP won't set it again after
1161 // Link up. And it will be replaced if user changed it.
1162 if (pAd
->StaCfg
.AuthMode
< Ndis802_11AuthModeWPA
)
1165 // For WPA-None, there is no need to remove it, since WinXP won't set it again after
1166 // Link up. And it will be replaced if user changed it.
1167 if (pAd
->StaCfg
.AuthMode
== Ndis802_11AuthModeWPANone
)
1170 // set BSSID wcid entry of the Pair-wise Key table as no-security mode
1171 AsicRemovePairwiseKeyEntry(pAd
, BSS0
, BSSID_WCID
);
1173 // set all shared key mode as no-security.
1174 for (i
= 0; i
< SHARE_KEY_NUM
; i
++)
1176 DBGPRINT(RT_DEBUG_TRACE
,("remove %s key #%d\n", CipherName
[pAd
->SharedKey
[BSS0
][i
].CipherAlg
], i
));
1177 NdisZeroMemory(&pAd
->SharedKey
[BSS0
][i
], sizeof(CIPHER_KEY
));
1179 AsicRemoveSharedKeyEntry(pAd
, BSS0
, i
);
1183 #endif // CONFIG_STA_SUPPORT //
1186 ========================================================================
1187 Routine Description:
1188 Change NIC PHY mode. Re-association may be necessary. possible settings
1189 include - PHY_11B, PHY_11BG_MIXED, PHY_11A, and PHY_11ABG_MIXED
1192 pAd - Pointer to our adapter
1195 IRQL = PASSIVE_LEVEL
1196 IRQL = DISPATCH_LEVEL
1198 ========================================================================
1200 VOID
RTMPSetPhyMode(
1201 IN PRTMP_ADAPTER pAd
,
1205 // the selected phymode must be supported by the RF IC encoded in E2PROM
1207 // if no change, do nothing
1209 if (pAd->CommonCfg.PhyMode == phymode)
1212 pAd
->CommonCfg
.PhyMode
= (UCHAR
)phymode
;
1214 DBGPRINT(RT_DEBUG_TRACE
,("RTMPSetPhyMode : PhyMode=%d, channel=%d \n", pAd
->CommonCfg
.PhyMode
, pAd
->CommonCfg
.Channel
));
1215 #ifdef EXT_BUILD_CHANNEL_LIST
1216 BuildChannelListEx(pAd
);
1218 BuildChannelList(pAd
);
1219 #endif // EXT_BUILD_CHANNEL_LIST //
1221 // sanity check user setting
1222 for (i
= 0; i
< pAd
->ChannelListNum
; i
++)
1224 if (pAd
->CommonCfg
.Channel
== pAd
->ChannelList
[i
].Channel
)
1228 if (i
== pAd
->ChannelListNum
)
1230 #ifdef CONFIG_STA_SUPPORT
1231 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1232 pAd
->CommonCfg
.Channel
= FirstChannel(pAd
);
1233 #endif // CONFIG_STA_SUPPORT //
1234 DBGPRINT(RT_DEBUG_ERROR
, ("RTMPSetPhyMode: channel is out of range, use first channel=%d \n", pAd
->CommonCfg
.Channel
));
1237 NdisZeroMemory(pAd
->CommonCfg
.SupRate
, MAX_LEN_OF_SUPPORTED_RATES
);
1238 NdisZeroMemory(pAd
->CommonCfg
.ExtRate
, MAX_LEN_OF_SUPPORTED_RATES
);
1239 NdisZeroMemory(pAd
->CommonCfg
.DesireRate
, MAX_LEN_OF_SUPPORTED_RATES
);
1242 pAd
->CommonCfg
.SupRate
[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1243 pAd
->CommonCfg
.SupRate
[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1244 pAd
->CommonCfg
.SupRate
[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1245 pAd
->CommonCfg
.SupRate
[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1246 pAd
->CommonCfg
.SupRateLen
= 4;
1247 pAd
->CommonCfg
.ExtRateLen
= 0;
1248 pAd
->CommonCfg
.DesireRate
[0] = 2; // 1 mbps, in units of 0.5 Mbps
1249 pAd
->CommonCfg
.DesireRate
[1] = 4; // 2 mbps, in units of 0.5 Mbps
1250 pAd
->CommonCfg
.DesireRate
[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1251 pAd
->CommonCfg
.DesireRate
[3] = 22; // 11 mbps, in units of 0.5 Mbps
1252 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_CCK; // This MODE is only FYI. not use
1256 case PHY_11BG_MIXED
:
1257 case PHY_11ABG_MIXED
:
1258 #ifdef DOT11_N_SUPPORT
1260 case PHY_11ABGN_MIXED
:
1261 case PHY_11BGN_MIXED
:
1262 case PHY_11GN_MIXED
:
1263 #endif // DOT11_N_SUPPORT //
1264 pAd
->CommonCfg
.SupRate
[0] = 0x82; // 1 mbps, in units of 0.5 Mbps, basic rate
1265 pAd
->CommonCfg
.SupRate
[1] = 0x84; // 2 mbps, in units of 0.5 Mbps, basic rate
1266 pAd
->CommonCfg
.SupRate
[2] = 0x8B; // 5.5 mbps, in units of 0.5 Mbps, basic rate
1267 pAd
->CommonCfg
.SupRate
[3] = 0x96; // 11 mbps, in units of 0.5 Mbps, basic rate
1268 pAd
->CommonCfg
.SupRate
[4] = 0x12; // 9 mbps, in units of 0.5 Mbps
1269 pAd
->CommonCfg
.SupRate
[5] = 0x24; // 18 mbps, in units of 0.5 Mbps
1270 pAd
->CommonCfg
.SupRate
[6] = 0x48; // 36 mbps, in units of 0.5 Mbps
1271 pAd
->CommonCfg
.SupRate
[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1272 pAd
->CommonCfg
.SupRateLen
= 8;
1273 pAd
->CommonCfg
.ExtRate
[0] = 0x0C; // 6 mbps, in units of 0.5 Mbps
1274 pAd
->CommonCfg
.ExtRate
[1] = 0x18; // 12 mbps, in units of 0.5 Mbps
1275 pAd
->CommonCfg
.ExtRate
[2] = 0x30; // 24 mbps, in units of 0.5 Mbps
1276 pAd
->CommonCfg
.ExtRate
[3] = 0x60; // 48 mbps, in units of 0.5 Mbps
1277 pAd
->CommonCfg
.ExtRateLen
= 4;
1278 pAd
->CommonCfg
.DesireRate
[0] = 2; // 1 mbps, in units of 0.5 Mbps
1279 pAd
->CommonCfg
.DesireRate
[1] = 4; // 2 mbps, in units of 0.5 Mbps
1280 pAd
->CommonCfg
.DesireRate
[2] = 11; // 5.5 mbps, in units of 0.5 Mbps
1281 pAd
->CommonCfg
.DesireRate
[3] = 22; // 11 mbps, in units of 0.5 Mbps
1282 pAd
->CommonCfg
.DesireRate
[4] = 12; // 6 mbps, in units of 0.5 Mbps
1283 pAd
->CommonCfg
.DesireRate
[5] = 18; // 9 mbps, in units of 0.5 Mbps
1284 pAd
->CommonCfg
.DesireRate
[6] = 24; // 12 mbps, in units of 0.5 Mbps
1285 pAd
->CommonCfg
.DesireRate
[7] = 36; // 18 mbps, in units of 0.5 Mbps
1286 pAd
->CommonCfg
.DesireRate
[8] = 48; // 24 mbps, in units of 0.5 Mbps
1287 pAd
->CommonCfg
.DesireRate
[9] = 72; // 36 mbps, in units of 0.5 Mbps
1288 pAd
->CommonCfg
.DesireRate
[10] = 96; // 48 mbps, in units of 0.5 Mbps
1289 pAd
->CommonCfg
.DesireRate
[11] = 108; // 54 mbps, in units of 0.5 Mbps
1293 #ifdef DOT11_N_SUPPORT
1294 case PHY_11AN_MIXED
:
1295 case PHY_11AGN_MIXED
:
1297 #endif // DOT11_N_SUPPORT //
1298 pAd
->CommonCfg
.SupRate
[0] = 0x8C; // 6 mbps, in units of 0.5 Mbps, basic rate
1299 pAd
->CommonCfg
.SupRate
[1] = 0x12; // 9 mbps, in units of 0.5 Mbps
1300 pAd
->CommonCfg
.SupRate
[2] = 0x98; // 12 mbps, in units of 0.5 Mbps, basic rate
1301 pAd
->CommonCfg
.SupRate
[3] = 0x24; // 18 mbps, in units of 0.5 Mbps
1302 pAd
->CommonCfg
.SupRate
[4] = 0xb0; // 24 mbps, in units of 0.5 Mbps, basic rate
1303 pAd
->CommonCfg
.SupRate
[5] = 0x48; // 36 mbps, in units of 0.5 Mbps
1304 pAd
->CommonCfg
.SupRate
[6] = 0x60; // 48 mbps, in units of 0.5 Mbps
1305 pAd
->CommonCfg
.SupRate
[7] = 0x6c; // 54 mbps, in units of 0.5 Mbps
1306 pAd
->CommonCfg
.SupRateLen
= 8;
1307 pAd
->CommonCfg
.ExtRateLen
= 0;
1308 pAd
->CommonCfg
.DesireRate
[0] = 12; // 6 mbps, in units of 0.5 Mbps
1309 pAd
->CommonCfg
.DesireRate
[1] = 18; // 9 mbps, in units of 0.5 Mbps
1310 pAd
->CommonCfg
.DesireRate
[2] = 24; // 12 mbps, in units of 0.5 Mbps
1311 pAd
->CommonCfg
.DesireRate
[3] = 36; // 18 mbps, in units of 0.5 Mbps
1312 pAd
->CommonCfg
.DesireRate
[4] = 48; // 24 mbps, in units of 0.5 Mbps
1313 pAd
->CommonCfg
.DesireRate
[5] = 72; // 36 mbps, in units of 0.5 Mbps
1314 pAd
->CommonCfg
.DesireRate
[6] = 96; // 48 mbps, in units of 0.5 Mbps
1315 pAd
->CommonCfg
.DesireRate
[7] = 108; // 54 mbps, in units of 0.5 Mbps
1316 //pAd->CommonCfg.HTPhyMode.field.MODE = MODE_OFDM; // This MODE is only FYI. not use
1324 pAd
->CommonCfg
.BandState
= UNKNOWN_BAND
;
1328 #ifdef DOT11_N_SUPPORT
1330 ========================================================================
1331 Routine Description:
1332 Caller ensures we has 802.11n support.
1333 Calls at setting HT from AP/STASetinformation
1336 pAd - Pointer to our adapter
1339 ========================================================================
1342 IN PRTMP_ADAPTER pAd
,
1343 IN OID_SET_HT_PHYMODE
*pHTPhyMode
)
1348 UCHAR BBP3Value
= 0;
1349 UCHAR RxStream
= pAd
->CommonCfg
.RxStream
;
1351 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPSetHT : HT_mode(%d), ExtOffset(%d), MCS(%d), BW(%d), STBC(%d), SHORTGI(%d)\n",
1352 pHTPhyMode
->HtMode
, pHTPhyMode
->ExtOffset
,
1353 pHTPhyMode
->MCS
, pHTPhyMode
->BW
,
1354 pHTPhyMode
->STBC
, pHTPhyMode
->SHORTGI
));
1356 // Don't zero supportedHyPhy structure.
1357 RTMPZeroMemory(&pAd
->CommonCfg
.HtCapability
, sizeof(pAd
->CommonCfg
.HtCapability
));
1358 RTMPZeroMemory(&pAd
->CommonCfg
.AddHTInfo
, sizeof(pAd
->CommonCfg
.AddHTInfo
));
1359 RTMPZeroMemory(&pAd
->CommonCfg
.NewExtChanOffset
, sizeof(pAd
->CommonCfg
.NewExtChanOffset
));
1360 RTMPZeroMemory(&pAd
->CommonCfg
.DesiredHtPhy
, sizeof(pAd
->CommonCfg
.DesiredHtPhy
));
1362 if (pAd
->CommonCfg
.bRdg
)
1364 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.PlusHTC
= 1;
1365 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.RDGSupport
= 1;
1369 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.PlusHTC
= 0;
1370 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.RDGSupport
= 0;
1373 pAd
->CommonCfg
.HtCapability
.HtCapParm
.MaxRAmpduFactor
= 3;
1374 pAd
->CommonCfg
.DesiredHtPhy
.MaxRAmpduFactor
= 3;
1376 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPSetHT : RxBAWinLimit = %d\n", pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
));
1378 // Mimo power save, A-MSDU size,
1379 pAd
->CommonCfg
.DesiredHtPhy
.AmsduEnable
= (USHORT
)pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
;
1380 pAd
->CommonCfg
.DesiredHtPhy
.AmsduSize
= (UCHAR
)pAd
->CommonCfg
.BACapability
.field
.AmsduSize
;
1381 pAd
->CommonCfg
.DesiredHtPhy
.MimoPs
= (UCHAR
)pAd
->CommonCfg
.BACapability
.field
.MMPSmode
;
1382 pAd
->CommonCfg
.DesiredHtPhy
.MpduDensity
= (UCHAR
)pAd
->CommonCfg
.BACapability
.field
.MpduDensity
;
1384 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.AMsduSize
= (USHORT
)pAd
->CommonCfg
.BACapability
.field
.AmsduSize
;
1385 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.MimoPs
= (USHORT
)pAd
->CommonCfg
.BACapability
.field
.MMPSmode
;
1386 pAd
->CommonCfg
.HtCapability
.HtCapParm
.MpduDensity
= (UCHAR
)pAd
->CommonCfg
.BACapability
.field
.MpduDensity
;
1388 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPSetHT : AMsduSize = %d, MimoPs = %d, MpduDensity = %d, MaxRAmpduFactor = %d\n",
1389 pAd
->CommonCfg
.DesiredHtPhy
.AmsduSize
,
1390 pAd
->CommonCfg
.DesiredHtPhy
.MimoPs
,
1391 pAd
->CommonCfg
.DesiredHtPhy
.MpduDensity
,
1392 pAd
->CommonCfg
.DesiredHtPhy
.MaxRAmpduFactor
));
1394 if(pHTPhyMode
->HtMode
== HTMODE_GF
)
1396 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.GF
= 1;
1397 pAd
->CommonCfg
.DesiredHtPhy
.GF
= 1;
1400 pAd
->CommonCfg
.DesiredHtPhy
.GF
= 0;
1406 pAd
->CommonCfg
.HtCapability
.MCSSet
[0] = 0xff;
1407 pAd
->CommonCfg
.HtCapability
.MCSSet
[1] = 0x00;
1411 pAd
->CommonCfg
.HtCapability
.MCSSet
[0] = 0xff;
1412 pAd
->CommonCfg
.HtCapability
.MCSSet
[1] = 0xff;
1416 pAd
->CommonCfg
.HtCapability
.MCSSet
[0] = 0xff;
1417 pAd
->CommonCfg
.HtCapability
.MCSSet
[1] = 0xff;
1418 pAd
->CommonCfg
.HtCapability
.MCSSet
[2] = 0xff;
1422 if (pAd
->CommonCfg
.bForty_Mhz_Intolerant
&& (pAd
->CommonCfg
.Channel
<= 14) && (pHTPhyMode
->BW
== BW_40
) )
1424 pHTPhyMode
->BW
= BW_20
;
1425 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.Forty_Mhz_Intolerant
= 1;
1428 if(pHTPhyMode
->BW
== BW_40
)
1430 pAd
->CommonCfg
.HtCapability
.MCSSet
[4] = 0x1; // MCS 32
1431 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ChannelWidth
= 1;
1432 if (pAd
->CommonCfg
.Channel
<= 14)
1433 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.CCKmodein40
= 1;
1435 pAd
->CommonCfg
.DesiredHtPhy
.ChannelWidth
= 1;
1436 pAd
->CommonCfg
.AddHTInfo
.AddHtInfo
.RecomWidth
= 1;
1437 pAd
->CommonCfg
.AddHTInfo
.AddHtInfo
.ExtChanOffset
= (pHTPhyMode
->ExtOffset
== EXTCHA_BELOW
)? (EXTCHA_BELOW
): EXTCHA_ABOVE
;
1438 // Set Regsiter for extension channel position.
1439 RTMP_IO_READ32(pAd
, TX_BAND_CFG
, &Value
);
1440 RTMP_BBP_IO_READ8_BY_REG_ID(pAd
, BBP_R3
, &BBP3Value
);
1441 if ((pHTPhyMode
->ExtOffset
== EXTCHA_BELOW
))
1444 BBP3Value
|= (0x20);
1445 RTMP_IO_WRITE32(pAd
, TX_BAND_CFG
, Value
);
1447 else if ((pHTPhyMode
->ExtOffset
== EXTCHA_ABOVE
))
1450 BBP3Value
&= (~0x20);
1451 RTMP_IO_WRITE32(pAd
, TX_BAND_CFG
, Value
);
1454 // Turn on BBP 40MHz mode now only as AP .
1455 // Sta can turn on BBP 40MHz after connection with 40MHz AP. Sta only broadcast 40MHz capability before connection.
1456 if ((pAd
->OpMode
== OPMODE_AP
) || INFRA_ON(pAd
) || ADHOC_ON(pAd
)
1459 RTMP_BBP_IO_READ8_BY_REG_ID(pAd
, BBP_R4
, &BBPValue
);
1460 BBPValue
&= (~0x18);
1462 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd
, BBP_R4
, BBPValue
);
1464 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd
, BBP_R3
, BBP3Value
);
1465 pAd
->CommonCfg
.BBPCurrentBW
= BW_40
;
1470 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ChannelWidth
= 0;
1471 pAd
->CommonCfg
.DesiredHtPhy
.ChannelWidth
= 0;
1472 pAd
->CommonCfg
.AddHTInfo
.AddHtInfo
.RecomWidth
= 0;
1473 pAd
->CommonCfg
.AddHTInfo
.AddHtInfo
.ExtChanOffset
= EXTCHA_NONE
;
1474 pAd
->CommonCfg
.CentralChannel
= pAd
->CommonCfg
.Channel
;
1475 // Turn on BBP 20MHz mode by request here.
1477 RTMP_BBP_IO_READ8_BY_REG_ID(pAd
, BBP_R4
, &BBPValue
);
1478 BBPValue
&= (~0x18);
1479 RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd
, BBP_R4
, BBPValue
);
1480 pAd
->CommonCfg
.BBPCurrentBW
= BW_20
;
1484 if(pHTPhyMode
->STBC
== STBC_USE
)
1486 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.TxSTBC
= 1;
1487 pAd
->CommonCfg
.DesiredHtPhy
.TxSTBC
= 1;
1488 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.RxSTBC
= 1;
1489 pAd
->CommonCfg
.DesiredHtPhy
.RxSTBC
= 1;
1493 pAd
->CommonCfg
.DesiredHtPhy
.TxSTBC
= 0;
1494 pAd
->CommonCfg
.DesiredHtPhy
.RxSTBC
= 0;
1498 if(pHTPhyMode
->SHORTGI
== GI_400
)
1500 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ShortGIfor20
= 1;
1501 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ShortGIfor40
= 1;
1502 pAd
->CommonCfg
.DesiredHtPhy
.ShortGIfor20
= 1;
1503 pAd
->CommonCfg
.DesiredHtPhy
.ShortGIfor40
= 1;
1507 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ShortGIfor20
= 0;
1508 pAd
->CommonCfg
.HtCapability
.HtCapInfo
.ShortGIfor40
= 0;
1509 pAd
->CommonCfg
.DesiredHtPhy
.ShortGIfor20
= 0;
1510 pAd
->CommonCfg
.DesiredHtPhy
.ShortGIfor40
= 0;
1513 // We support link adaptation for unsolicit MCS feedback, set to 2.
1514 pAd
->CommonCfg
.HtCapability
.ExtHtCapInfo
.MCSFeedback
= MCSFBK_NONE
; //MCSFBK_UNSOLICIT;
1515 pAd
->CommonCfg
.AddHTInfo
.ControlChan
= pAd
->CommonCfg
.Channel
;
1516 // 1, the extension channel above the control channel.
1518 // EDCA parameters used for AP's own transmission
1519 if (pAd
->CommonCfg
.APEdcaParm
.bValid
== FALSE
)
1521 pAd
->CommonCfg
.APEdcaParm
.bValid
= TRUE
;
1522 pAd
->CommonCfg
.APEdcaParm
.Aifsn
[0] = 3;
1523 pAd
->CommonCfg
.APEdcaParm
.Aifsn
[1] = 7;
1524 pAd
->CommonCfg
.APEdcaParm
.Aifsn
[2] = 1;
1525 pAd
->CommonCfg
.APEdcaParm
.Aifsn
[3] = 1;
1527 pAd
->CommonCfg
.APEdcaParm
.Cwmin
[0] = 4;
1528 pAd
->CommonCfg
.APEdcaParm
.Cwmin
[1] = 4;
1529 pAd
->CommonCfg
.APEdcaParm
.Cwmin
[2] = 3;
1530 pAd
->CommonCfg
.APEdcaParm
.Cwmin
[3] = 2;
1532 pAd
->CommonCfg
.APEdcaParm
.Cwmax
[0] = 6;
1533 pAd
->CommonCfg
.APEdcaParm
.Cwmax
[1] = 10;
1534 pAd
->CommonCfg
.APEdcaParm
.Cwmax
[2] = 4;
1535 pAd
->CommonCfg
.APEdcaParm
.Cwmax
[3] = 3;
1537 pAd
->CommonCfg
.APEdcaParm
.Txop
[0] = 0;
1538 pAd
->CommonCfg
.APEdcaParm
.Txop
[1] = 0;
1539 pAd
->CommonCfg
.APEdcaParm
.Txop
[2] = 94;
1540 pAd
->CommonCfg
.APEdcaParm
.Txop
[3] = 47;
1542 AsicSetEdcaParm(pAd
, &pAd
->CommonCfg
.APEdcaParm
);
1545 #ifdef CONFIG_STA_SUPPORT
1546 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1548 RTMPSetIndividualHT(pAd
, 0);
1550 #endif // CONFIG_STA_SUPPORT //
1555 ========================================================================
1556 Routine Description:
1557 Caller ensures we has 802.11n support.
1558 Calls at setting HT from AP/STASetinformation
1561 pAd - Pointer to our adapter
1564 ========================================================================
1566 VOID
RTMPSetIndividualHT(
1567 IN PRTMP_ADAPTER pAd
,
1570 PRT_HT_PHY_INFO pDesired_ht_phy
= NULL
;
1571 UCHAR TxStream
= pAd
->CommonCfg
.TxStream
;
1572 UCHAR DesiredMcs
= MCS_AUTO
;
1577 #ifdef CONFIG_STA_SUPPORT
1578 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1580 pDesired_ht_phy
= &pAd
->StaCfg
.DesiredHtPhyInfo
;
1581 DesiredMcs
= pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
;
1582 //pAd->StaCfg.bAutoTxRateSwitch = (DesiredMcs == MCS_AUTO) ? TRUE : FALSE;
1585 #endif // CONFIG_STA_SUPPORT //
1588 if (pDesired_ht_phy
== NULL
)
1590 DBGPRINT(RT_DEBUG_ERROR
, ("RTMPSetIndividualHT: invalid apidx(%d)\n", apidx
));
1593 RTMPZeroMemory(pDesired_ht_phy
, sizeof(RT_HT_PHY_INFO
));
1595 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPSetIndividualHT : Desired MCS = %d\n", DesiredMcs
));
1596 // Check the validity of MCS
1597 if ((TxStream
== 1) && ((DesiredMcs
>= MCS_8
) && (DesiredMcs
<= MCS_15
)))
1599 DBGPRINT(RT_DEBUG_WARN
, ("RTMPSetIndividualHT: MCS(%d) is invalid in 1S, reset it as MCS_7\n", DesiredMcs
));
1603 if ((pAd
->CommonCfg
.DesiredHtPhy
.ChannelWidth
== BW_20
) && (DesiredMcs
== MCS_32
))
1605 DBGPRINT(RT_DEBUG_WARN
, ("RTMPSetIndividualHT: MCS_32 is only supported in 40-MHz, reset it as MCS_0\n"));
1609 pDesired_ht_phy
->bHtEnable
= TRUE
;
1611 // Decide desired Tx MCS
1615 if (DesiredMcs
== MCS_AUTO
)
1617 pDesired_ht_phy
->MCSSet
[0]= 0xff;
1618 pDesired_ht_phy
->MCSSet
[1]= 0x00;
1620 else if (DesiredMcs
<= MCS_7
)
1622 pDesired_ht_phy
->MCSSet
[0]= 1<<DesiredMcs
;
1623 pDesired_ht_phy
->MCSSet
[1]= 0x00;
1628 if (DesiredMcs
== MCS_AUTO
)
1630 pDesired_ht_phy
->MCSSet
[0]= 0xff;
1631 pDesired_ht_phy
->MCSSet
[1]= 0xff;
1633 else if (DesiredMcs
<= MCS_15
)
1637 mode
= DesiredMcs
/ 8;
1639 pDesired_ht_phy
->MCSSet
[mode
] = (1 << (DesiredMcs
- mode
* 8));
1644 if (DesiredMcs
== MCS_AUTO
)
1646 /* MCS0 ~ MCS23, 3 bytes */
1647 pDesired_ht_phy
->MCSSet
[0]= 0xff;
1648 pDesired_ht_phy
->MCSSet
[1]= 0xff;
1649 pDesired_ht_phy
->MCSSet
[2]= 0xff;
1651 else if (DesiredMcs
<= MCS_23
)
1655 mode
= DesiredMcs
/ 8;
1657 pDesired_ht_phy
->MCSSet
[mode
] = (1 << (DesiredMcs
- mode
* 8));
1662 if(pAd
->CommonCfg
.DesiredHtPhy
.ChannelWidth
== BW_40
)
1664 if (DesiredMcs
== MCS_AUTO
|| DesiredMcs
== MCS_32
)
1665 pDesired_ht_phy
->MCSSet
[4] = 0x1;
1668 // update HT Rate setting
1669 if (pAd
->OpMode
== OPMODE_STA
)
1670 MlmeUpdateHtTxRates(pAd
, BSS0
);
1672 MlmeUpdateHtTxRates(pAd
, apidx
);
1677 ========================================================================
1678 Routine Description:
1679 Update HT IE from our capability.
1682 Send all HT IE in beacon/probe rsp/assoc rsp/action frame.
1685 ========================================================================
1687 VOID
RTMPUpdateHTIE(
1688 IN RT_HT_CAPABILITY
*pRtHt
,
1690 OUT HT_CAPABILITY_IE
*pHtCapability
,
1691 OUT ADD_HT_INFO_IE
*pAddHtInfo
)
1693 RTMPZeroMemory(pHtCapability
, sizeof(HT_CAPABILITY_IE
));
1694 RTMPZeroMemory(pAddHtInfo
, sizeof(ADD_HT_INFO_IE
));
1696 pHtCapability
->HtCapInfo
.ChannelWidth
= pRtHt
->ChannelWidth
;
1697 pHtCapability
->HtCapInfo
.MimoPs
= pRtHt
->MimoPs
;
1698 pHtCapability
->HtCapInfo
.GF
= pRtHt
->GF
;
1699 pHtCapability
->HtCapInfo
.ShortGIfor20
= pRtHt
->ShortGIfor20
;
1700 pHtCapability
->HtCapInfo
.ShortGIfor40
= pRtHt
->ShortGIfor40
;
1701 pHtCapability
->HtCapInfo
.TxSTBC
= pRtHt
->TxSTBC
;
1702 pHtCapability
->HtCapInfo
.RxSTBC
= pRtHt
->RxSTBC
;
1703 pHtCapability
->HtCapInfo
.AMsduSize
= pRtHt
->AmsduSize
;
1704 pHtCapability
->HtCapParm
.MaxRAmpduFactor
= pRtHt
->MaxRAmpduFactor
;
1705 pHtCapability
->HtCapParm
.MpduDensity
= pRtHt
->MpduDensity
;
1707 pAddHtInfo
->AddHtInfo
.ExtChanOffset
= pRtHt
->ExtChanOffset
;
1708 pAddHtInfo
->AddHtInfo
.RecomWidth
= pRtHt
->RecomWidth
;
1709 pAddHtInfo
->AddHtInfo2
.OperaionMode
= pRtHt
->OperaionMode
;
1710 pAddHtInfo
->AddHtInfo2
.NonGfPresent
= pRtHt
->NonGfPresent
;
1711 RTMPMoveMemory(pAddHtInfo
->MCSSet
, /*pRtHt->MCSSet*/pMcsSet
, 4); // rt2860 only support MCS max=32, no need to copy all 16 uchar.
1713 DBGPRINT(RT_DEBUG_TRACE
,("RTMPUpdateHTIE <== \n"));
1715 #endif // DOT11_N_SUPPORT //
1718 ========================================================================
1720 Add Client security information into ASIC WCID table and IVEIV table.
1722 ========================================================================
1724 VOID
RTMPAddWcidAttributeEntry(
1725 IN PRTMP_ADAPTER pAd
,
1729 IN MAC_TABLE_ENTRY
*pEntry
)
1731 UINT32 WCIDAttri
= 0;
1737 #ifdef CONFIG_STA_SUPPORT
1738 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1742 DBGPRINT(RT_DEBUG_ERROR
, ("RTMPAddWcidAttributeEntry: The BSS-index(%d) is out of range for Infra link. \n", BssIdx
));
1746 // 1. In ADHOC mode, the AID is wcid number. And NO mesh link exists.
1747 // 2. In Infra mode, the AID:1 MUST be wcid of infra STA.
1748 // the AID:2~ assign to mesh link entry.
1749 if (pEntry
&& ADHOC_ON(pAd
))
1751 else if (pEntry
&& INFRA_ON(pAd
))
1753 #ifdef QOS_DLS_SUPPORT
1754 if (pEntry
->ValidAsDls
== TRUE
)
1757 #endif // QOS_DLS_SUPPORT //
1763 #endif // CONFIG_STA_SUPPORT //
1766 // Update WCID attribute table
1767 offset
= MAC_WCID_ATTRIBUTE_BASE
+ (Wcid
* HW_WCID_ATTRI_SIZE
);
1769 #ifdef CONFIG_STA_SUPPORT
1770 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
1772 if (pEntry
&& pEntry
->ValidAsMesh
)
1773 WCIDAttri
= (CipherAlg
<<1) | PAIRWISEKEYTABLE
;
1774 #ifdef QOS_DLS_SUPPORT
1775 else if ((pEntry
) && (pEntry
->ValidAsDls
) &&
1776 ((CipherAlg
== CIPHER_TKIP
) ||
1777 (CipherAlg
== CIPHER_TKIP_NO_MIC
) ||
1778 (CipherAlg
== CIPHER_AES
) ||
1779 (CipherAlg
== CIPHER_NONE
)))
1780 WCIDAttri
= (CipherAlg
<<1) | PAIRWISEKEYTABLE
;
1781 #endif // QOS_DLS_SUPPORT //
1783 WCIDAttri
= (CipherAlg
<<1) | SHAREDKEYTABLE
;
1785 #endif // CONFIG_STA_SUPPORT //
1787 RTMP_IO_WRITE32(pAd
, offset
, WCIDAttri
);
1790 // Update IV/EIV table
1791 offset
= MAC_IVEIV_TABLE_BASE
+ (Wcid
* HW_IVEIV_ENTRY_SIZE
);
1794 if ((CipherAlg
== CIPHER_TKIP
) || (CipherAlg
== CIPHER_TKIP_NO_MIC
) || (CipherAlg
== CIPHER_AES
))
1796 // Eiv bit on. keyid always is 0 for pairwise key
1797 IVEIV
= (KeyIdx
<<6) | 0x20;
1801 // WEP KeyIdx is default tx key.
1802 IVEIV
= (KeyIdx
<< 6);
1805 // For key index and ext IV bit, so only need to update the position(offset+3).
1807 RTMP_IO_WRITE8(pAd
, offset
+3, IVEIV
);
1810 DBGPRINT(RT_DEBUG_TRACE
,("RTMPAddWcidAttributeEntry: WCID #%d, KeyIndex #%d, Alg=%s\n",Wcid
, KeyIdx
, CipherName
[CipherAlg
]));
1811 DBGPRINT(RT_DEBUG_TRACE
,(" WCIDAttri = 0x%x \n", WCIDAttri
));
1816 ==========================================================================
1818 Parse encryption type
1820 pAdapter Pointer to our adapter
1821 wrq Pointer to the ioctl argument
1827 ==========================================================================
1829 CHAR
*GetEncryptType(CHAR enc
)
1831 if(enc
== Ndis802_11WEPDisabled
)
1833 if(enc
== Ndis802_11WEPEnabled
)
1835 if(enc
== Ndis802_11Encryption2Enabled
)
1837 if(enc
== Ndis802_11Encryption3Enabled
)
1839 if(enc
== Ndis802_11Encryption4Enabled
)
1845 CHAR
*GetAuthMode(CHAR auth
)
1847 if(auth
== Ndis802_11AuthModeOpen
)
1849 if(auth
== Ndis802_11AuthModeShared
)
1851 if(auth
== Ndis802_11AuthModeAutoSwitch
)
1853 if(auth
== Ndis802_11AuthModeWPA
)
1855 if(auth
== Ndis802_11AuthModeWPAPSK
)
1857 if(auth
== Ndis802_11AuthModeWPANone
)
1859 if(auth
== Ndis802_11AuthModeWPA2
)
1861 if(auth
== Ndis802_11AuthModeWPA2PSK
)
1863 if(auth
== Ndis802_11AuthModeWPA1WPA2
)
1865 if(auth
== Ndis802_11AuthModeWPA1PSKWPA2PSK
)
1866 return "WPA1PSKWPA2PSK";
1871 #if 1 //#ifndef UCOS
1873 ==========================================================================
1875 Get site survey results
1877 pAdapter Pointer to our adapter
1878 wrq Pointer to the ioctl argument
1885 1.) UI needs to wait 4 seconds after issue a site survey command
1886 2.) iwpriv ra0 get_site_survey
1887 3.) UI needs to prepare at least 4096bytes to get the results
1888 ==========================================================================
1890 #define LINE_LEN (4+33+20+8+10+9+7+3) // Channel+SSID+Bssid+WepStatus+AuthMode+Signal+WiressMode+NetworkType
1891 VOID
RTMPIoctlGetSiteSurvey(
1892 IN PRTMP_ADAPTER pAdapter
,
1893 IN
struct iwreq
*wrq
)
1899 CHAR Ssid
[MAX_LEN_OF_SSID
+1];
1900 INT Rssi
= 0, max_len
= LINE_LEN
;
1901 UINT Rssi_Quality
= 0;
1902 NDIS_802_11_NETWORK_TYPE wireless_mode
;
1904 os_alloc_mem(NULL
, (PUCHAR
*)&msg
, sizeof(CHAR
)*((MAX_LEN_OF_BSS_TABLE
)*max_len
));
1908 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPIoctlGetSiteSurvey - msg memory alloc fail.\n"));
1912 memset(msg
, 0 ,(MAX_LEN_OF_BSS_TABLE
)*max_len
);
1913 memset(Ssid
, 0 ,(MAX_LEN_OF_SSID
+1));
1914 sprintf(msg
,"%s","\n");
1915 sprintf(msg
+strlen(msg
),"%-4s%-33s%-20s%-8s%-10s%-9s%-7s%-3s\n",
1916 "Ch", "SSID", "BSSID", "Enc", "Auth", "Siganl(%)", "W-Mode", " NT");
1919 #ifdef CONFIG_STA_SUPPORT
1920 pAdapter
->StaCfg
.bScanReqIsFromWebUI
= TRUE
;
1921 while ((ScanRunning(pAdapter
) == TRUE
) && (WaitCnt
++ < 200))
1923 #endif // CONFIG_STA_SUPPORT //
1925 for(i
=0; i
<pAdapter
->ScanTab
.BssNr
;i
++)
1927 if( pAdapter
->ScanTab
.BssEntry
[i
].Channel
==0)
1930 if((strlen(msg
)+max_len
) >= IW_SCAN_MAX_DATA
)
1934 sprintf(msg
+strlen(msg
),"%-4d", pAdapter
->ScanTab
.BssEntry
[i
].Channel
);
1936 memcpy(Ssid
, pAdapter
->ScanTab
.BssEntry
[i
].Ssid
, pAdapter
->ScanTab
.BssEntry
[i
].SsidLen
);
1937 Ssid
[pAdapter
->ScanTab
.BssEntry
[i
].SsidLen
] = '\0';
1938 sprintf(msg
+strlen(msg
),"%-33s", Ssid
);
1940 sprintf(msg
+strlen(msg
),"%02x:%02x:%02x:%02x:%02x:%02x ",
1941 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[0],
1942 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[1],
1943 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[2],
1944 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[3],
1945 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[4],
1946 pAdapter
->ScanTab
.BssEntry
[i
].Bssid
[5]);
1948 sprintf(msg
+strlen(msg
),"%-8s",GetEncryptType(pAdapter
->ScanTab
.BssEntry
[i
].WepStatus
));
1949 //Authentication Mode
1950 if (pAdapter
->ScanTab
.BssEntry
[i
].WepStatus
== Ndis802_11WEPEnabled
)
1951 sprintf(msg
+strlen(msg
),"%-10s", "UNKNOW");
1953 sprintf(msg
+strlen(msg
),"%-10s",GetAuthMode(pAdapter
->ScanTab
.BssEntry
[i
].AuthMode
));
1955 Rssi
= (INT
)pAdapter
->ScanTab
.BssEntry
[i
].Rssi
;
1958 else if (Rssi
>= -80) // between -50 ~ -80dbm
1959 Rssi_Quality
= (UINT
)(24 + ((Rssi
+ 80) * 26)/10);
1960 else if (Rssi
>= -90) // between -80 ~ -90dbm
1961 Rssi_Quality
= (UINT
)(((Rssi
+ 90) * 26)/10);
1964 sprintf(msg
+strlen(msg
),"%-9d", Rssi_Quality
);
1966 wireless_mode
= NetworkTypeInUseSanity(&pAdapter
->ScanTab
.BssEntry
[i
]);
1967 if (wireless_mode
== Ndis802_11FH
||
1968 wireless_mode
== Ndis802_11DS
)
1969 sprintf(msg
+strlen(msg
),"%-7s", "11b");
1970 else if (wireless_mode
== Ndis802_11OFDM5
)
1971 sprintf(msg
+strlen(msg
),"%-7s", "11a");
1972 else if (wireless_mode
== Ndis802_11OFDM5_N
)
1973 sprintf(msg
+strlen(msg
),"%-7s", "11a/n");
1974 else if (wireless_mode
== Ndis802_11OFDM24
)
1975 sprintf(msg
+strlen(msg
),"%-7s", "11b/g");
1976 else if (wireless_mode
== Ndis802_11OFDM24_N
)
1977 sprintf(msg
+strlen(msg
),"%-7s", "11b/g/n");
1979 sprintf(msg
+strlen(msg
),"%-7s", "unknow");
1981 if (pAdapter
->ScanTab
.BssEntry
[i
].BssType
== BSS_ADHOC
)
1982 sprintf(msg
+strlen(msg
),"%-3s", " Ad");
1984 sprintf(msg
+strlen(msg
),"%-3s", " In");
1986 sprintf(msg
+strlen(msg
),"\n");
1989 #ifdef CONFIG_STA_SUPPORT
1990 pAdapter
->StaCfg
.bScanReqIsFromWebUI
= FALSE
;
1991 #endif // CONFIG_STA_SUPPORT //
1992 wrq
->u
.data
.length
= strlen(msg
);
1993 Status
= copy_to_user(wrq
->u
.data
.pointer
, msg
, wrq
->u
.data
.length
);
1995 DBGPRINT(RT_DEBUG_TRACE
, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq
->u
.data
.length
));
1996 os_free_mem(NULL
, (PUCHAR
)msg
);
2000 #define MAC_LINE_LEN (14+4+4+10+10+10+6+6) // Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rate
2001 VOID
RTMPIoctlGetMacTable(
2002 IN PRTMP_ADAPTER pAd
,
2003 IN
struct iwreq
*wrq
)
2006 RT_802_11_MAC_TABLE MacTab
;
2010 for (i
=0; i
<MAX_LEN_OF_MAC_TABLE
; i
++)
2012 if (pAd
->MacTab
.Content
[i
].ValidAsCLI
&& (pAd
->MacTab
.Content
[i
].Sst
== SST_ASSOC
))
2014 COPY_MAC_ADDR(MacTab
.Entry
[MacTab
.Num
].Addr
, &pAd
->MacTab
.Content
[i
].Addr
);
2015 MacTab
.Entry
[MacTab
.Num
].Aid
= (UCHAR
)pAd
->MacTab
.Content
[i
].Aid
;
2016 MacTab
.Entry
[MacTab
.Num
].Psm
= pAd
->MacTab
.Content
[i
].PsMode
;
2017 #ifdef DOT11_N_SUPPORT
2018 MacTab
.Entry
[MacTab
.Num
].MimoPs
= pAd
->MacTab
.Content
[i
].MmpsMode
;
2019 #endif // DOT11_N_SUPPORT //
2021 // Fill in RSSI per entry
2022 MacTab
.Entry
[MacTab
.Num
].AvgRssi0
= pAd
->MacTab
.Content
[i
].RssiSample
.AvgRssi0
;
2023 MacTab
.Entry
[MacTab
.Num
].AvgRssi1
= pAd
->MacTab
.Content
[i
].RssiSample
.AvgRssi1
;
2024 MacTab
.Entry
[MacTab
.Num
].AvgRssi2
= pAd
->MacTab
.Content
[i
].RssiSample
.AvgRssi2
;
2026 // the connected time per entry
2027 MacTab
.Entry
[MacTab
.Num
].ConnectedTime
= pAd
->MacTab
.Content
[i
].StaConnectTime
;
2028 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.MCS
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.MCS
;
2029 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.BW
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.BW
;
2030 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.ShortGI
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.ShortGI
;
2031 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.STBC
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.STBC
;
2032 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.rsv
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.rsv
;
2033 MacTab
.Entry
[MacTab
.Num
].TxRate
.field
.MODE
= pAd
->MacTab
.Content
[i
].HTPhyMode
.field
.MODE
;
2034 MacTab
.Entry
[MacTab
.Num
].TxRate
.word
= pAd
->MacTab
.Content
[i
].HTPhyMode
.word
;
2039 wrq
->u
.data
.length
= sizeof(RT_802_11_MAC_TABLE
);
2040 if (copy_to_user(wrq
->u
.data
.pointer
, &MacTab
, wrq
->u
.data
.length
))
2042 DBGPRINT(RT_DEBUG_TRACE
, ("%s: copy_to_user() fail\n", __func__
));
2045 msg
= (CHAR
*) kmalloc(sizeof(CHAR
)*(MAX_LEN_OF_MAC_TABLE
*MAC_LINE_LEN
), MEM_ALLOC_FLAG
);
2046 memset(msg
, 0 ,MAX_LEN_OF_MAC_TABLE
*MAC_LINE_LEN
);
2047 sprintf(msg
,"%s","\n");
2048 sprintf(msg
+strlen(msg
),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",
2049 "MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");
2051 for (i
=0; i
<MAX_LEN_OF_MAC_TABLE
; i
++)
2053 PMAC_TABLE_ENTRY pEntry
= &pAd
->MacTab
.Content
[i
];
2054 if (pEntry
->ValidAsCLI
&& (pEntry
->Sst
== SST_ASSOC
))
2056 if((strlen(msg
)+MAC_LINE_LEN
) >= (MAX_LEN_OF_MAC_TABLE
*MAC_LINE_LEN
) )
2058 sprintf(msg
+strlen(msg
),"%02x%02x%02x%02x%02x%02x ",
2059 pEntry
->Addr
[0], pEntry
->Addr
[1], pEntry
->Addr
[2],
2060 pEntry
->Addr
[3], pEntry
->Addr
[4], pEntry
->Addr
[5]);
2061 sprintf(msg
+strlen(msg
),"%-4d", (int)pEntry
->Aid
);
2062 sprintf(msg
+strlen(msg
),"%-4d", (int)pEntry
->PsMode
);
2063 sprintf(msg
+strlen(msg
),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo
2064 sprintf(msg
+strlen(msg
),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo
2065 sprintf(msg
+strlen(msg
),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo
2066 sprintf(msg
+strlen(msg
),"%-6d",RateIdToMbps
[pAd
->MacTab
.Content
[i
].CurrTxRate
]);
2067 sprintf(msg
+strlen(msg
),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo
2070 // for compatible with old API just do the printk to console
2071 //wrq->u.data.length = strlen(msg);
2072 //if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))
2074 DBGPRINT(RT_DEBUG_TRACE
, ("%s", msg
));
2081 #ifdef DOT11_N_SUPPORT
2082 INT
Set_BASetup_Proc(
2083 IN PRTMP_ADAPTER pAd
,
2087 char *token
, sepValue
[] = ":", DASH
= '-';
2089 MAC_TABLE_ENTRY
*pEntry
;
2092 The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d,
2093 =>The six 2 digit hex-decimal number previous are the Mac address,
2094 =>The seventh decimal number is the tid value.
2096 //printk("\n%s\n", arg);
2098 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2101 token
= strchr(arg
, DASH
);
2102 if ((token
!= NULL
) && (strlen(token
)>1))
2104 tid
= simple_strtol((token
+1), 0, 10);
2109 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2111 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2113 AtoH(token
, (PUCHAR
)(&mac
[i
]), 1);
2118 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac
[0], mac
[1],
2119 mac
[2], mac
[3], mac
[4], mac
[5], tid
);
2121 pEntry
= MacTableLookup(pAd
, mac
);
2124 printk("\nSetup BA Session: Tid = %d\n", tid
);
2125 BAOriSessionSetUp(pAd
, pEntry
, tid
, 0, 100, TRUE
);
2135 INT
Set_BADecline_Proc(
2136 IN PRTMP_ADAPTER pAd
,
2141 bBADecline
= simple_strtol(arg
, 0, 10);
2143 if (bBADecline
== 0)
2145 pAd
->CommonCfg
.bBADecline
= FALSE
;
2147 else if (bBADecline
== 1)
2149 pAd
->CommonCfg
.bBADecline
= TRUE
;
2153 return FALSE
; //Invalid argument
2156 DBGPRINT(RT_DEBUG_TRACE
, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd
->CommonCfg
.bBADecline
));
2161 INT
Set_BAOriTearDown_Proc(
2162 IN PRTMP_ADAPTER pAd
,
2166 char *token
, sepValue
[] = ":", DASH
= '-';
2168 MAC_TABLE_ENTRY
*pEntry
;
2171 The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2172 =>The six 2 digit hex-decimal number previous are the Mac address,
2173 =>The seventh decimal number is the tid value.
2175 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2178 token
= strchr(arg
, DASH
);
2179 if ((token
!= NULL
) && (strlen(token
)>1))
2181 tid
= simple_strtol((token
+1), 0, 10);
2182 if (tid
> NUM_OF_TID
)
2186 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2188 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2190 AtoH(token
, (PUCHAR
)(&mac
[i
]), 1);
2195 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac
[0], mac
[1],
2196 mac
[2], mac
[3], mac
[4], mac
[5], tid
);
2198 pEntry
= MacTableLookup(pAd
, mac
);
2201 printk("\nTear down Ori BA Session: Tid = %d\n", tid
);
2202 BAOriSessionTearDown(pAd
, pEntry
->Aid
, tid
, FALSE
, TRUE
);
2212 INT
Set_BARecTearDown_Proc(
2213 IN PRTMP_ADAPTER pAd
,
2217 char *token
, sepValue
[] = ":", DASH
= '-';
2219 MAC_TABLE_ENTRY
*pEntry
;
2221 //printk("\n%s\n", arg);
2223 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2224 =>The six 2 digit hex-decimal number previous are the Mac address,
2225 =>The seventh decimal number is the tid value.
2227 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.
2230 token
= strchr(arg
, DASH
);
2231 if ((token
!= NULL
) && (strlen(token
)>1))
2233 tid
= simple_strtol((token
+1), 0, 10);
2234 if (tid
> NUM_OF_TID
)
2238 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2240 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2242 AtoH(token
, (PUCHAR
)(&mac
[i
]), 1);
2247 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac
[0], mac
[1],
2248 mac
[2], mac
[3], mac
[4], mac
[5], tid
);
2250 pEntry
= MacTableLookup(pAd
, mac
);
2253 printk("\nTear down Rec BA Session: Tid = %d\n", tid
);
2254 BARecSessionTearDown(pAd
, pEntry
->Aid
, tid
, FALSE
);
2265 IN PRTMP_ADAPTER pAd
,
2270 HtBw
= simple_strtol(arg
, 0, 10);
2272 pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
= BW_40
;
2273 else if (HtBw
== BW_20
)
2274 pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
= BW_20
;
2276 return FALSE
; //Invalid argument
2280 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
));
2286 IN PRTMP_ADAPTER pAd
,
2289 ULONG HtMcs
, Mcs_tmp
;
2290 #ifdef CONFIG_STA_SUPPORT
2291 BOOLEAN bAutoRate
= FALSE
;
2292 #endif // CONFIG_STA_SUPPORT //
2294 Mcs_tmp
= simple_strtol(arg
, 0, 10);
2296 if (Mcs_tmp
<= 15 || Mcs_tmp
== 32)
2301 #ifdef CONFIG_STA_SUPPORT
2302 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
2304 pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= HtMcs
;
2305 pAd
->StaCfg
.bAutoTxRateSwitch
= (HtMcs
== MCS_AUTO
) ? TRUE
:FALSE
;
2306 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMcs_Proc::(HtMcs=%d, bAutoTxRateSwitch = %d)\n",
2307 pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
, pAd
->StaCfg
.bAutoTxRateSwitch
));
2309 if ((pAd
->CommonCfg
.PhyMode
< PHY_11ABGN_MIXED
) ||
2310 (pAd
->MacTab
.Content
[BSSID_WCID
].HTPhyMode
.field
.MODE
< MODE_HTMIX
))
2312 if ((pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
!= MCS_AUTO
) &&
2313 (HtMcs
>= 0 && HtMcs
<= 3) &&
2314 (pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
== FIXED_TXMODE_CCK
))
2316 RTMPSetDesiredRates(pAd
, (LONG
) (RateIdToMbps
[HtMcs
] * 1000000));
2318 else if ((pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
!= MCS_AUTO
) &&
2319 (HtMcs
>= 0 && HtMcs
<= 7) &&
2320 (pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
== FIXED_TXMODE_OFDM
))
2322 RTMPSetDesiredRates(pAd
, (LONG
) (RateIdToMbps
[HtMcs
+4] * 1000000));
2329 pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
= MCS_AUTO
;
2330 RTMPSetDesiredRates(pAd
, -1);
2332 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMcs_Proc::(FixedTxMode=%d)\n",pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
));
2337 #endif // CONFIG_STA_SUPPORT //
2345 IN PRTMP_ADAPTER pAd
,
2350 HtGi
= simple_strtol(arg
, 0, 10);
2352 if ( HtGi
== GI_400
)
2353 pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
= GI_400
;
2354 else if ( HtGi
== GI_800
)
2355 pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
= GI_800
;
2357 return FALSE
; //Invalid argument
2361 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
));
2367 INT
Set_HtTxBASize_Proc(
2368 IN PRTMP_ADAPTER pAd
,
2373 Size
= simple_strtol(arg
, 0, 10);
2375 if (Size
<=0 || Size
>=64)
2379 pAd
->CommonCfg
.TxBASize
= Size
-1;
2380 DBGPRINT(RT_DEBUG_ERROR
, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size
));
2386 INT
Set_HtOpMode_Proc(
2387 IN PRTMP_ADAPTER pAd
,
2393 Value
= simple_strtol(arg
, 0, 10);
2395 if (Value
== HTMODE_GF
)
2396 pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
= HTMODE_GF
;
2397 else if ( Value
== HTMODE_MM
)
2398 pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
= HTMODE_MM
;
2400 return FALSE
; //Invalid argument
2404 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtOpMode_Proc::(HtOpMode=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
));
2410 INT
Set_HtStbc_Proc(
2411 IN PRTMP_ADAPTER pAd
,
2417 Value
= simple_strtol(arg
, 0, 10);
2419 if (Value
== STBC_USE
)
2420 pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
= STBC_USE
;
2421 else if ( Value
== STBC_NONE
)
2422 pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
= STBC_NONE
;
2424 return FALSE
; //Invalid argument
2428 DBGPRINT(RT_DEBUG_TRACE
, ("Set_Stbc_Proc::(HtStbc=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
));
2434 IN PRTMP_ADAPTER pAd
,
2440 Value
= simple_strtol(arg
, 0, 10);
2442 pAd
->HTCEnable
= FALSE
;
2443 else if ( Value
==1 )
2444 pAd
->HTCEnable
= TRUE
;
2446 return FALSE
; //Invalid argument
2448 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtHtc_Proc::(HtHtc=%d)\n",pAd
->HTCEnable
));
2453 INT
Set_HtExtcha_Proc(
2454 IN PRTMP_ADAPTER pAd
,
2460 Value
= simple_strtol(arg
, 0, 10);
2463 pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
= EXTCHA_BELOW
;
2464 else if ( Value
==1 )
2465 pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
= EXTCHA_ABOVE
;
2467 return FALSE
; //Invalid argument
2471 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtExtcha_Proc::(HtExtcha=%d)\n",pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
));
2476 INT
Set_HtMpduDensity_Proc(
2477 IN PRTMP_ADAPTER pAd
,
2482 Value
= simple_strtol(arg
, 0, 10);
2484 if (Value
<=7 && Value
>= 0)
2485 pAd
->CommonCfg
.BACapability
.field
.MpduDensity
= Value
;
2487 pAd
->CommonCfg
.BACapability
.field
.MpduDensity
= 4;
2491 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMpduDensity_Proc::(HtMpduDensity=%d)\n",pAd
->CommonCfg
.BACapability
.field
.MpduDensity
));
2496 INT
Set_HtBaWinSize_Proc(
2497 IN PRTMP_ADAPTER pAd
,
2502 Value
= simple_strtol(arg
, 0, 10);
2505 if (Value
>=1 && Value
<= 64)
2507 pAd
->CommonCfg
.REGBACapability
.field
.RxBAWinLimit
= Value
;
2508 pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
= Value
;
2512 pAd
->CommonCfg
.REGBACapability
.field
.RxBAWinLimit
= 64;
2513 pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
= 64;
2518 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtBaWinSize_Proc::(HtBaWinSize=%d)\n",pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
));
2524 IN PRTMP_ADAPTER pAd
,
2529 Value
= simple_strtol(arg
, 0, 10);
2532 pAd
->CommonCfg
.bRdg
= FALSE
;
2533 else if ( Value
==1 )
2535 pAd
->HTCEnable
= TRUE
;
2536 pAd
->CommonCfg
.bRdg
= TRUE
;
2539 return FALSE
; //Invalid argument
2543 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtRdg_Proc::(HtRdg=%d)\n",pAd
->CommonCfg
.bRdg
));
2548 INT
Set_HtLinkAdapt_Proc(
2549 IN PRTMP_ADAPTER pAd
,
2554 Value
= simple_strtol(arg
, 0, 10);
2556 pAd
->bLinkAdapt
= FALSE
;
2557 else if ( Value
==1 )
2559 pAd
->HTCEnable
= TRUE
;
2560 pAd
->bLinkAdapt
= TRUE
;
2563 return FALSE
; //Invalid argument
2565 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtLinkAdapt_Proc::(HtLinkAdapt=%d)\n",pAd
->bLinkAdapt
));
2570 INT
Set_HtAmsdu_Proc(
2571 IN PRTMP_ADAPTER pAd
,
2576 Value
= simple_strtol(arg
, 0, 10);
2578 pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
= FALSE
;
2579 else if ( Value
== 1 )
2580 pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
= TRUE
;
2582 return FALSE
; //Invalid argument
2586 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtAmsdu_Proc::(HtAmsdu=%d)\n",pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
));
2591 INT
Set_HtAutoBa_Proc(
2592 IN PRTMP_ADAPTER pAd
,
2597 Value
= simple_strtol(arg
, 0, 10);
2599 pAd
->CommonCfg
.BACapability
.field
.AutoBA
= FALSE
;
2600 else if (Value
== 1)
2601 pAd
->CommonCfg
.BACapability
.field
.AutoBA
= TRUE
;
2603 return FALSE
; //Invalid argument
2605 pAd
->CommonCfg
.REGBACapability
.field
.AutoBA
= pAd
->CommonCfg
.BACapability
.field
.AutoBA
;
2608 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd
->CommonCfg
.BACapability
.field
.AutoBA
));
2614 INT
Set_HtProtect_Proc(
2615 IN PRTMP_ADAPTER pAd
,
2620 Value
= simple_strtol(arg
, 0, 10);
2622 pAd
->CommonCfg
.bHTProtect
= FALSE
;
2623 else if (Value
== 1)
2624 pAd
->CommonCfg
.bHTProtect
= TRUE
;
2626 return FALSE
; //Invalid argument
2628 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtProtect_Proc::(HtProtect=%d)\n",pAd
->CommonCfg
.bHTProtect
));
2633 INT
Set_SendPSMPAction_Proc(
2634 IN PRTMP_ADAPTER pAd
,
2638 char *token
, sepValue
[] = ":", DASH
= '-';
2640 MAC_TABLE_ENTRY
*pEntry
;
2642 //printk("\n%s\n", arg);
2644 The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d,
2645 =>The six 2 digit hex-decimal number previous are the Mac address,
2646 =>The seventh decimal number is the mode value.
2648 if(strlen(arg
) < 19) //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and mode value in decimal format.
2651 token
= strchr(arg
, DASH
);
2652 if ((token
!= NULL
) && (strlen(token
)>1))
2654 mode
= simple_strtol((token
+1), 0, 10);
2655 if (mode
> MMPS_ENABLE
)
2659 for (i
= 0, token
= rstrtok(arg
, &sepValue
[0]); token
; token
= rstrtok(NULL
, &sepValue
[0]), i
++)
2661 if((strlen(token
) != 2) || (!isxdigit(*token
)) || (!isxdigit(*(token
+1))))
2663 AtoH(token
, (PUCHAR
)(&mac
[i
]), 1);
2668 printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac
[0], mac
[1],
2669 mac
[2], mac
[3], mac
[4], mac
[5], mode
);
2671 pEntry
= MacTableLookup(pAd
, mac
);
2674 printk("\nSendPSMPAction MIPS mode = %d\n", mode
);
2675 SendPSMPAction(pAd
, pEntry
->Aid
, mode
);
2686 INT
Set_HtMIMOPSmode_Proc(
2687 IN PRTMP_ADAPTER pAd
,
2692 Value
= simple_strtol(arg
, 0, 10);
2694 if (Value
<=3 && Value
>= 0)
2695 pAd
->CommonCfg
.BACapability
.field
.MMPSmode
= Value
;
2697 pAd
->CommonCfg
.BACapability
.field
.MMPSmode
= 3;
2701 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMIMOPSmode_Proc::(MIMOPS mode=%d)\n",pAd
->CommonCfg
.BACapability
.field
.MMPSmode
));
2707 INT
Set_ForceShortGI_Proc(
2708 IN PRTMP_ADAPTER pAd
,
2713 Value
= simple_strtol(arg
, 0, 10);
2715 pAd
->WIFItestbed
.bShortGI
= FALSE
;
2716 else if (Value
== 1)
2717 pAd
->WIFItestbed
.bShortGI
= TRUE
;
2719 return FALSE
; //Invalid argument
2723 DBGPRINT(RT_DEBUG_TRACE
, ("Set_ForceShortGI_Proc::(ForceShortGI=%d)\n", pAd
->WIFItestbed
.bShortGI
));
2730 INT
Set_ForceGF_Proc(
2731 IN PRTMP_ADAPTER pAd
,
2736 Value
= simple_strtol(arg
, 0, 10);
2738 pAd
->WIFItestbed
.bGreenField
= FALSE
;
2739 else if (Value
== 1)
2740 pAd
->WIFItestbed
.bGreenField
= TRUE
;
2742 return FALSE
; //Invalid argument
2746 DBGPRINT(RT_DEBUG_TRACE
, ("Set_ForceGF_Proc::(ForceGF=%d)\n", pAd
->WIFItestbed
.bGreenField
));
2751 INT
Set_HtMimoPs_Proc(
2752 IN PRTMP_ADAPTER pAd
,
2757 Value
= simple_strtol(arg
, 0, 10);
2759 pAd
->CommonCfg
.bMIMOPSEnable
= FALSE
;
2760 else if (Value
== 1)
2761 pAd
->CommonCfg
.bMIMOPSEnable
= TRUE
;
2763 return FALSE
; //Invalid argument
2765 DBGPRINT(RT_DEBUG_TRACE
, ("Set_HtMimoPs_Proc::(HtMimoPs=%d)\n",pAd
->CommonCfg
.bMIMOPSEnable
));
2769 #endif // DOT11_N_SUPPORT //
2772 #ifdef DOT11_N_SUPPORT
2774 IN PRTMP_ADAPTER pAd
)
2776 OID_SET_HT_PHYMODE SetHT
;
2778 if (pAd
->CommonCfg
.PhyMode
< PHY_11ABGN_MIXED
)
2781 SetHT
.PhyMode
= pAd
->CommonCfg
.PhyMode
;
2782 SetHT
.TransmitNo
= ((UCHAR
)pAd
->Antenna
.field
.TxPath
);
2783 SetHT
.HtMode
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
;
2784 SetHT
.ExtOffset
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
;
2785 SetHT
.MCS
= MCS_AUTO
;
2786 SetHT
.BW
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
;
2787 SetHT
.STBC
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.STBC
;
2788 SetHT
.SHORTGI
= (UCHAR
)pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
;
2790 RTMPSetHT(pAd
, &SetHT
);
2794 #endif // DOT11_N_SUPPORT //
2796 INT
Set_FixedTxMode_Proc(
2797 IN PRTMP_ADAPTER pAd
,
2800 UCHAR fix_tx_mode
= FIXED_TXMODE_HT
;
2802 if (strcmp(arg
, "OFDM") == 0 || strcmp(arg
, "ofdm") == 0)
2804 fix_tx_mode
= FIXED_TXMODE_OFDM
;
2806 else if (strcmp(arg
, "CCK") == 0 || strcmp(arg
, "cck") == 0)
2808 fix_tx_mode
= FIXED_TXMODE_CCK
;
2811 #ifdef CONFIG_STA_SUPPORT
2812 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
2813 pAd
->StaCfg
.DesiredTransmitSetting
.field
.FixedTxMode
= fix_tx_mode
;
2814 #endif // CONFIG_STA_SUPPORT //
2816 DBGPRINT(RT_DEBUG_TRACE
, ("Set_FixedTxMode_Proc::(FixedTxMode=%d)\n", fix_tx_mode
));
2821 #ifdef CONFIG_APSTA_MIXED_SUPPORT
2822 INT
Set_OpMode_Proc(
2823 IN PRTMP_ADAPTER pAd
,
2828 Value
= simple_strtol(arg
, 0, 10);
2831 if (RTMP_TEST_FLAG(pAd
, fRTMP_ADAPTER_INTERRUPT_IN_USE
))
2834 DBGPRINT(RT_DEBUG_ERROR
, ("Can not switch operate mode on interface up !! \n"));
2839 pAd
->OpMode
= OPMODE_STA
;
2840 else if (Value
== 1)
2841 pAd
->OpMode
= OPMODE_AP
;
2843 return FALSE
; //Invalid argument
2845 DBGPRINT(RT_DEBUG_TRACE
, ("Set_OpMode_Proc::(OpMode=%s)\n", pAd
->OpMode
== 1 ? "AP Mode" : "STA Mode"));
2849 #endif // CONFIG_APSTA_MIXED_SUPPORT //
2852 /////////////////////////////////////////////////////////////////////////
2853 PCHAR
RTMPGetRalinkAuthModeStr(
2854 IN NDIS_802_11_AUTHENTICATION_MODE authMode
)
2858 case Ndis802_11AuthModeOpen
:
2861 case Ndis802_11AuthModeWPAPSK
:
2863 case Ndis802_11AuthModeShared
:
2865 case Ndis802_11AuthModeWPA
:
2867 case Ndis802_11AuthModeWPA2
:
2869 case Ndis802_11AuthModeWPA2PSK
:
2871 case Ndis802_11AuthModeWPA1PSKWPA2PSK
:
2872 return "WPAPSKWPA2PSK";
2873 case Ndis802_11AuthModeWPA1WPA2
:
2875 case Ndis802_11AuthModeWPANone
:
2880 PCHAR
RTMPGetRalinkEncryModeStr(
2881 IN USHORT encryMode
)
2886 case Ndis802_11WEPDisabled
:
2888 case Ndis802_11WEPEnabled
:
2890 case Ndis802_11Encryption2Enabled
:
2892 case Ndis802_11Encryption3Enabled
:
2894 case Ndis802_11Encryption4Enabled
:
2899 INT
RTMPShowCfgValue(
2900 IN PRTMP_ADAPTER pAd
,
2906 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
++)
2908 if (!strcmp(pName
, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
))
2910 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->show_proc(pAd
, pBuf
))
2912 break; //Exit for loop.
2916 if(PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
== NULL
)
2918 sprintf(pBuf
, "\n");
2919 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
++)
2920 sprintf(pBuf
, "%s%s\n", pBuf
, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC
->name
);
2927 IN PRTMP_ADAPTER pAd
,
2931 #ifdef CONFIG_STA_SUPPORT
2932 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
2933 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.Ssid
);
2934 #endif // CONFIG_STA_SUPPORT //
2938 INT
Show_WirelessMode_Proc(
2939 IN PRTMP_ADAPTER pAd
,
2942 switch(pAd
->CommonCfg
.PhyMode
)
2944 case PHY_11BG_MIXED
:
2945 sprintf(pBuf
, "\t11B/G");
2948 sprintf(pBuf
, "\t11B");
2951 sprintf(pBuf
, "\t11A");
2953 case PHY_11ABG_MIXED
:
2954 sprintf(pBuf
, "\t11A/B/G");
2957 sprintf(pBuf
, "\t11G");
2959 #ifdef DOT11_N_SUPPORT
2960 case PHY_11ABGN_MIXED
:
2961 sprintf(pBuf
, "\t11A/B/G/N");
2964 sprintf(pBuf
, "\t11N only with 2.4G");
2966 case PHY_11GN_MIXED
:
2967 sprintf(pBuf
, "\t11G/N");
2969 case PHY_11AN_MIXED
:
2970 sprintf(pBuf
, "\t11A/N");
2972 case PHY_11BGN_MIXED
:
2973 sprintf(pBuf
, "\t11B/G/N");
2975 case PHY_11AGN_MIXED
:
2976 sprintf(pBuf
, "\t11A/G/N");
2979 sprintf(pBuf
, "\t11N only with 5G");
2981 #endif // DOT11_N_SUPPORT //
2983 sprintf(pBuf
, "\tUnknow Value(%d)", pAd
->CommonCfg
.PhyMode
);
2990 INT
Show_TxBurst_Proc(
2991 IN PRTMP_ADAPTER pAd
,
2994 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bEnableTxBurst
? "TRUE":"FALSE");
2998 INT
Show_TxPreamble_Proc(
2999 IN PRTMP_ADAPTER pAd
,
3002 switch(pAd
->CommonCfg
.TxPreamble
)
3004 case Rt802_11PreambleShort
:
3005 sprintf(pBuf
, "\tShort");
3007 case Rt802_11PreambleLong
:
3008 sprintf(pBuf
, "\tLong");
3010 case Rt802_11PreambleAuto
:
3011 sprintf(pBuf
, "\tAuto");
3014 sprintf(pBuf
, "\tUnknow Value(%lu)", pAd
->CommonCfg
.TxPreamble
);
3021 INT
Show_TxPower_Proc(
3022 IN PRTMP_ADAPTER pAd
,
3025 sprintf(pBuf
, "\t%lu", pAd
->CommonCfg
.TxPowerPercentage
);
3029 INT
Show_Channel_Proc(
3030 IN PRTMP_ADAPTER pAd
,
3033 sprintf(pBuf
, "\t%d", pAd
->CommonCfg
.Channel
);
3037 INT
Show_BGProtection_Proc(
3038 IN PRTMP_ADAPTER pAd
,
3041 switch(pAd
->CommonCfg
.UseBGProtection
)
3044 sprintf(pBuf
, "\tON");
3046 case 2: //Always OFF
3047 sprintf(pBuf
, "\tOFF");
3050 sprintf(pBuf
, "\tAuto");
3053 sprintf(pBuf
, "\tUnknow Value(%lu)", pAd
->CommonCfg
.UseBGProtection
);
3059 INT
Show_RTSThreshold_Proc(
3060 IN PRTMP_ADAPTER pAd
,
3063 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.RtsThreshold
);
3067 INT
Show_FragThreshold_Proc(
3068 IN PRTMP_ADAPTER pAd
,
3071 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.FragmentThreshold
);
3075 #ifdef DOT11_N_SUPPORT
3077 IN PRTMP_ADAPTER pAd
,
3080 if (pAd
->CommonCfg
.RegTransmitSetting
.field
.BW
== BW_40
)
3082 sprintf(pBuf
, "\t40 MHz");
3086 sprintf(pBuf
, "\t20 MHz");
3091 INT
Show_HtMcs_Proc(
3092 IN PRTMP_ADAPTER pAd
,
3096 #ifdef CONFIG_STA_SUPPORT
3097 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3098 sprintf(pBuf
, "\t%u", pAd
->StaCfg
.DesiredTransmitSetting
.field
.MCS
);
3099 #endif // CONFIG_STA_SUPPORT //
3104 IN PRTMP_ADAPTER pAd
,
3107 switch(pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
)
3110 sprintf(pBuf
, "\tGI_400");
3113 sprintf(pBuf
, "\tGI_800");
3116 sprintf(pBuf
, "\tUnknow Value(%u)", pAd
->CommonCfg
.RegTransmitSetting
.field
.ShortGI
);
3122 INT
Show_HtOpMode_Proc(
3123 IN PRTMP_ADAPTER pAd
,
3126 switch(pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
)
3129 sprintf(pBuf
, "\tGF");
3132 sprintf(pBuf
, "\tMM");
3135 sprintf(pBuf
, "\tUnknow Value(%u)", pAd
->CommonCfg
.RegTransmitSetting
.field
.HTMODE
);
3141 INT
Show_HtExtcha_Proc(
3142 IN PRTMP_ADAPTER pAd
,
3145 switch(pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
)
3148 sprintf(pBuf
, "\tBelow");
3151 sprintf(pBuf
, "\tAbove");
3154 sprintf(pBuf
, "\tUnknow Value(%u)", pAd
->CommonCfg
.RegTransmitSetting
.field
.EXTCHA
);
3161 INT
Show_HtMpduDensity_Proc(
3162 IN PRTMP_ADAPTER pAd
,
3165 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.BACapability
.field
.MpduDensity
);
3169 INT
Show_HtBaWinSize_Proc(
3170 IN PRTMP_ADAPTER pAd
,
3173 sprintf(pBuf
, "\t%u", pAd
->CommonCfg
.BACapability
.field
.RxBAWinLimit
);
3177 INT
Show_HtRdg_Proc(
3178 IN PRTMP_ADAPTER pAd
,
3181 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bRdg
? "TRUE":"FALSE");
3185 INT
Show_HtAmsdu_Proc(
3186 IN PRTMP_ADAPTER pAd
,
3189 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.BACapability
.field
.AmsduEnable
? "TRUE":"FALSE");
3193 INT
Show_HtAutoBa_Proc(
3194 IN PRTMP_ADAPTER pAd
,
3197 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.BACapability
.field
.AutoBA
? "TRUE":"FALSE");
3200 #endif // DOT11_N_SUPPORT //
3202 INT
Show_CountryRegion_Proc(
3203 IN PRTMP_ADAPTER pAd
,
3206 sprintf(pBuf
, "\t%d", pAd
->CommonCfg
.CountryRegion
);
3210 INT
Show_CountryRegionABand_Proc(
3211 IN PRTMP_ADAPTER pAd
,
3214 sprintf(pBuf
, "\t%d", pAd
->CommonCfg
.CountryRegionForABand
);
3218 INT
Show_CountryCode_Proc(
3219 IN PRTMP_ADAPTER pAd
,
3222 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.CountryCode
);
3226 #ifdef AGGREGATION_SUPPORT
3227 INT
Show_PktAggregate_Proc(
3228 IN PRTMP_ADAPTER pAd
,
3231 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bAggregationCapable
? "TRUE":"FALSE");
3234 #endif // AGGREGATION_SUPPORT //
3237 INT
Show_WmmCapable_Proc(
3238 IN PRTMP_ADAPTER pAd
,
3242 #ifdef CONFIG_STA_SUPPORT
3243 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3244 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bWmmCapable
? "TRUE":"FALSE");
3245 #endif // CONFIG_STA_SUPPORT //
3249 #endif // WMM_SUPPORT //
3251 INT
Show_IEEE80211H_Proc(
3252 IN PRTMP_ADAPTER pAd
,
3255 sprintf(pBuf
, "\t%s", pAd
->CommonCfg
.bIEEE80211H
? "TRUE":"FALSE");
3259 #ifdef CONFIG_STA_SUPPORT
3260 INT
Show_NetworkType_Proc(
3261 IN PRTMP_ADAPTER pAd
,
3264 switch(pAd
->StaCfg
.BssType
)
3267 sprintf(pBuf
, "\tAdhoc");
3270 sprintf(pBuf
, "\tInfra");
3273 sprintf(pBuf
, "\tAny");
3276 sprintf(pBuf
, "\tMonitor");
3279 sprintf(pBuf
, "\tUnknow Value(%d)", pAd
->StaCfg
.BssType
);
3284 #endif // CONFIG_STA_SUPPORT //
3286 INT
Show_AuthMode_Proc(
3287 IN PRTMP_ADAPTER pAd
,
3290 NDIS_802_11_AUTHENTICATION_MODE AuthMode
= Ndis802_11AuthModeOpen
;
3292 #ifdef CONFIG_STA_SUPPORT
3293 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3294 AuthMode
= pAd
->StaCfg
.AuthMode
;
3295 #endif // CONFIG_STA_SUPPORT //
3297 if ((AuthMode
>= Ndis802_11AuthModeOpen
) &&
3298 (AuthMode
<= Ndis802_11AuthModeWPA1PSKWPA2PSK
))
3299 sprintf(pBuf
, "\t%s", RTMPGetRalinkAuthModeStr(AuthMode
));
3301 sprintf(pBuf
, "\tUnknow Value(%d)", AuthMode
);
3306 INT
Show_EncrypType_Proc(
3307 IN PRTMP_ADAPTER pAd
,
3310 NDIS_802_11_WEP_STATUS WepStatus
= Ndis802_11WEPDisabled
;
3312 #ifdef CONFIG_STA_SUPPORT
3313 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3314 WepStatus
= pAd
->StaCfg
.WepStatus
;
3315 #endif // CONFIG_STA_SUPPORT //
3317 if ((WepStatus
>= Ndis802_11WEPEnabled
) &&
3318 (WepStatus
<= Ndis802_11Encryption4KeyAbsent
))
3319 sprintf(pBuf
, "\t%s", RTMPGetRalinkEncryModeStr(WepStatus
));
3321 sprintf(pBuf
, "\tUnknow Value(%d)", WepStatus
);
3326 INT
Show_DefaultKeyID_Proc(
3327 IN PRTMP_ADAPTER pAd
,
3330 UCHAR DefaultKeyId
= 0;
3332 #ifdef CONFIG_STA_SUPPORT
3333 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3334 DefaultKeyId
= pAd
->StaCfg
.DefaultKeyId
;
3335 #endif // CONFIG_STA_SUPPORT //
3337 sprintf(pBuf
, "\t%d", DefaultKeyId
);
3342 INT
Show_WepKey_Proc(
3343 IN PRTMP_ADAPTER pAd
,
3347 UCHAR Key
[16] = {0}, KeyLength
= 0;
3350 KeyLength
= pAd
->SharedKey
[index
][KeyIdx
].KeyLen
;
3351 NdisMoveMemory(Key
, pAd
->SharedKey
[index
][KeyIdx
].Key
, KeyLength
);
3353 //check key string is ASCII or not
3354 if (RTMPCheckStrPrintAble(Key
, KeyLength
))
3355 sprintf(pBuf
, "\t%s", Key
);
3359 sprintf(pBuf
, "\t");
3360 for (idx
= 0; idx
< KeyLength
; idx
++)
3361 sprintf(pBuf
+strlen(pBuf
), "%02X", Key
[idx
]);
3367 IN PRTMP_ADAPTER pAd
,
3370 Show_WepKey_Proc(pAd
, 0, pBuf
);
3375 IN PRTMP_ADAPTER pAd
,
3378 Show_WepKey_Proc(pAd
, 1, pBuf
);
3383 IN PRTMP_ADAPTER pAd
,
3386 Show_WepKey_Proc(pAd
, 2, pBuf
);
3391 IN PRTMP_ADAPTER pAd
,
3394 Show_WepKey_Proc(pAd
, 3, pBuf
);
3398 INT
Show_WPAPSK_Proc(
3399 IN PRTMP_ADAPTER pAd
,
3403 UCHAR PMK
[32] = {0};
3406 #ifdef CONFIG_STA_SUPPORT
3407 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
3408 NdisMoveMemory(PMK
, pAd
->StaCfg
.PMK
, 32);
3409 #endif // CONFIG_STA_SUPPORT //
3411 sprintf(pBuf
, "\tPMK = ");
3412 for (idx
= 0; idx
< 32; idx
++)
3413 sprintf(pBuf
+strlen(pBuf
), "%02X", PMK
[idx
]);