This repository has been archived by the owner on Oct 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmm_info.c
4009 lines (3351 loc) · 107 KB
/
cmm_info.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2010, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************/
#include "rt_config.h"
INT Show_SSID_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_WirelessMode_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_TxBurst_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_TxPreamble_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_TxPower_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_Channel_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_BGProtection_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_RTSThreshold_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_FragThreshold_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
#ifdef DOT11_N_SUPPORT
INT Show_HtBw_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_HtMcs_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_HtGi_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_HtOpMode_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_HtExtcha_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_HtMpduDensity_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_HtBaWinSize_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_HtRdg_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_HtAmsdu_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_HtAutoBa_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
#endif // DOT11_N_SUPPORT //
INT Show_CountryRegion_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_CountryRegionABand_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_CountryCode_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
#ifdef AGGREGATION_SUPPORT
INT Show_PktAggregate_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
#endif // AGGREGATION_SUPPORT //
#ifdef WMM_SUPPORT
INT Show_WmmCapable_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
#endif // WMM_SUPPORT //
INT Show_IEEE80211H_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
#ifdef CONFIG_STA_SUPPORT
INT Show_NetworkType_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_WPAPSK_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_AutoReconnect_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
#endif // CONFIG_STA_SUPPORT //
INT Show_AuthMode_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_EncrypType_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_DefaultKeyID_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_Key1_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_Key2_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_Key3_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_Key4_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
INT Show_PMK_Proc(
IN PRTMP_ADAPTER pAd,
OUT PSTRING pBuf);
extern INT Set_AP_WscConfStatus_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg);
extern INT Set_AP_AuthMode_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg);
extern INT Set_AP_EncrypType_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg);
extern INT Set_AP_SSID_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg);
extern INT Set_AP_WPAPSK_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg);
static struct {
PSTRING name;
INT (*show_proc)(PRTMP_ADAPTER pAdapter, PSTRING arg);
} *PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC, RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC[] = {
#ifdef DBG
{"SSID", Show_SSID_Proc},
{"WirelessMode", Show_WirelessMode_Proc},
{"TxBurst", Show_TxBurst_Proc},
{"TxPreamble", Show_TxPreamble_Proc},
{"TxPower", Show_TxPower_Proc},
{"Channel", Show_Channel_Proc},
{"BGProtection", Show_BGProtection_Proc},
{"RTSThreshold", Show_RTSThreshold_Proc},
{"FragThreshold", Show_FragThreshold_Proc},
#ifdef DOT11_N_SUPPORT
{"HtBw", Show_HtBw_Proc},
{"HtMcs", Show_HtMcs_Proc},
{"HtGi", Show_HtGi_Proc},
{"HtOpMode", Show_HtOpMode_Proc},
{"HtExtcha", Show_HtExtcha_Proc},
{"HtMpduDensity", Show_HtMpduDensity_Proc},
{"HtBaWinSize", Show_HtBaWinSize_Proc},
{"HtRdg", Show_HtRdg_Proc},
{"HtAmsdu", Show_HtAmsdu_Proc},
{"HtAutoBa", Show_HtAutoBa_Proc},
#endif // DOT11_N_SUPPORT //
{"CountryRegion", Show_CountryRegion_Proc},
{"CountryRegionABand", Show_CountryRegionABand_Proc},
{"CountryCode", Show_CountryCode_Proc},
#ifdef AGGREGATION_SUPPORT
{"PktAggregate", Show_PktAggregate_Proc},
#endif
#ifdef WMM_SUPPORT
{"WmmCapable", Show_WmmCapable_Proc},
#endif
{"IEEE80211H", Show_IEEE80211H_Proc},
#ifdef CONFIG_STA_SUPPORT
{"NetworkType", Show_NetworkType_Proc},
{"WPAPSK", Show_WPAPSK_Proc},
{"AutoReconnect", Show_AutoReconnect_Proc},
#endif // CONFIG_STA_SUPPORT //
{"AuthMode", Show_AuthMode_Proc},
{"EncrypType", Show_EncrypType_Proc},
{"DefaultKeyID", Show_DefaultKeyID_Proc},
{"Key1", Show_Key1_Proc},
{"Key2", Show_Key2_Proc},
{"Key3", Show_Key3_Proc},
{"Key4", Show_Key4_Proc},
{"PMK", Show_PMK_Proc},
#endif // DBG //
{NULL, NULL}
};
/*
==========================================================================
Description:
Get Driver version.
Return:
==========================================================================
*/
INT Set_DriverVersion_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
DBGPRINT(RT_DEBUG_TRACE, ("Driver version-%s\n", STA_DRIVER_VERSION));
#endif // CONFIG_STA_SUPPORT //
return TRUE;
}
/*
==========================================================================
Description:
Set Country Region.
This command will not work, if the field of CountryRegion in eeprom is programmed.
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_CountryRegion_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
int retval;
#ifdef EXT_BUILD_CHANNEL_LIST
return -EOPNOTSUPP;
#endif // EXT_BUILD_CHANNEL_LIST //
retval = RT_CfgSetCountryRegion(pAd, arg, BAND_24G);
if (retval == FALSE)
return FALSE;
// if set country region, driver needs to be reset
BuildChannelList(pAd);
DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegion_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegion));
return TRUE;
}
/*
==========================================================================
Description:
Set Country Region for A band.
This command will not work, if the field of CountryRegion in eeprom is programmed.
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_CountryRegionABand_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
int retval;
#ifdef EXT_BUILD_CHANNEL_LIST
return -EOPNOTSUPP;
#endif // EXT_BUILD_CHANNEL_LIST //
retval = RT_CfgSetCountryRegion(pAd, arg, BAND_5G);
if (retval == FALSE)
return FALSE;
// if set country region, driver needs to be reset
BuildChannelList(pAd);
DBGPRINT(RT_DEBUG_TRACE, ("Set_CountryRegionABand_Proc::(CountryRegion=%d)\n", pAd->CommonCfg.CountryRegionForABand));
return TRUE;
}
INT Set_Cmm_WirelessMode_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg,
IN BOOLEAN FlgIsDiffMbssModeUsed)
{
INT success = TRUE;
#ifdef CONFIG_STA_SUPPORT
success = RT_CfgSetWirelessMode(pAd, arg);
#endif // CONFIG_STA_SUPPORT //
if (success)
{
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
{
LONG WirelessMode = pAd->CommonCfg.PhyMode;
/* clean up previous SCAN result */
BssTableInit(&pAd->ScanTab);
if (pAd->StaCfg.LastScanTime > 10 * OS_HZ)
pAd->StaCfg.LastScanTime -= (10 * OS_HZ);
RTMPSetPhyMode(pAd, WirelessMode);
#ifdef DOT11_N_SUPPORT
if (WirelessMode >= PHY_11ABGN_MIXED)
{
pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
pAd->CommonCfg.REGBACapability.field.AutoBA = TRUE;
}
else
{
pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
pAd->CommonCfg.REGBACapability.field.AutoBA = FALSE;
}
#endif // DOT11_N_SUPPORT //
// Set AdhocMode rates
if (pAd->StaCfg.BssType == BSS_ADHOC)
{
MlmeUpdateTxRates(pAd, FALSE, 0);
MakeIbssBeacon(pAd); // re-build BEACON frame
AsicEnableIbssSync(pAd); // copy to on-chip memory
}
}
#endif // CONFIG_STA_SUPPORT //
// it is needed to set SSID to take effect
#ifdef DOT11_N_SUPPORT
SetCommonHT(pAd);
#endif // DOT11_N_SUPPORT //
}
else
{
DBGPRINT(RT_DEBUG_ERROR, ("Set_WirelessMode_Proc::parameters out of range\n"));
}
return success;
}
/*
==========================================================================
Description:
Set Wireless Mode
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_WirelessMode_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
return Set_Cmm_WirelessMode_Proc(pAd, arg, 0);
}
/*
==========================================================================
Description:
Set Channel
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_Channel_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
INT success = TRUE;
UCHAR Channel;
Channel = (UCHAR) simple_strtol(arg, 0, 10);
// check if this channel is valid
if (ChannelSanity(pAd, Channel) == TRUE)
{
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
{
pAd->CommonCfg.Channel = Channel;
/*
Save the channel on MlmeAux for CntlOidRTBssidProc used.
*/
pAd->MlmeAux.Channel = pAd->CommonCfg.Channel;
if (MONITOR_ON(pAd))
{
#ifdef DOT11_N_SUPPORT
N_ChannelCheck(pAd);
if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED &&
pAd->CommonCfg.RegTransmitSetting.field.BW == BW_40)
{
N_SetCenCh(pAd);
AsicSwitchChannel(pAd, pAd->CommonCfg.CentralChannel, FALSE);
AsicLockChannel(pAd, pAd->CommonCfg.CentralChannel);
DBGPRINT(RT_DEBUG_TRACE, ("BW_40, control_channel(%d), CentralChannel(%d) \n",
pAd->CommonCfg.Channel, pAd->CommonCfg.CentralChannel));
}
else
#endif // DOT11_N_SUPPORT //
{
AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
AsicLockChannel(pAd, pAd->CommonCfg.Channel);
DBGPRINT(RT_DEBUG_TRACE, ("BW_20, Channel(%d)\n", pAd->CommonCfg.Channel));
}
}
}
#endif // CONFIG_STA_SUPPORT //
success = TRUE;
}
else
{
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
success = FALSE;
DBGPRINT(RT_DEBUG_WARN,("This channel is out of channel list, nothing to do!\n "));
#endif // CONFIG_STA_SUPPORT //
}
if (success == TRUE)
DBGPRINT(RT_DEBUG_TRACE, ("Set_Channel_Proc::(Channel=%d)\n", pAd->CommonCfg.Channel));
return success;
}
/*
==========================================================================
Description:
Set Short Slot Time Enable or Disable
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_ShortSlot_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
int retval;
retval = RT_CfgSetShortSlot(pAd, arg);
if (retval == TRUE)
DBGPRINT(RT_DEBUG_TRACE, ("Set_ShortSlot_Proc::(ShortSlot=%d)\n", pAd->CommonCfg.bUseShortSlotTime));
return retval;
}
/*
==========================================================================
Description:
Set Tx power
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_TxPower_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
LONG TxPower;
INT success = FALSE;
TxPower = simple_strtol(arg, 0, 10);
if (TxPower <= 100)
{
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
{
pAd->CommonCfg.TxPowerDefault = TxPower;
pAd->CommonCfg.TxPowerPercentage = pAd->CommonCfg.TxPowerDefault;
}
#endif // CONFIG_STA_SUPPORT //
success = TRUE;
}
else
success = FALSE;
DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPower_Proc::(TxPowerPercentage=%ld)\n", pAd->CommonCfg.TxPowerPercentage));
return success;
}
/*
==========================================================================
Description:
Set 11B/11G Protection
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_BGProtection_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
switch (simple_strtol(arg, 0, 10))
{
case 0: //AUTO
pAd->CommonCfg.UseBGProtection = 0;
break;
case 1: //Always On
pAd->CommonCfg.UseBGProtection = 1;
break;
case 2: //Always OFF
pAd->CommonCfg.UseBGProtection = 2;
break;
default: //Invalid argument
return FALSE;
}
DBGPRINT(RT_DEBUG_TRACE, ("Set_BGProtection_Proc::(BGProtection=%ld)\n", pAd->CommonCfg.UseBGProtection));
return TRUE;
}
/*
==========================================================================
Description:
Set TxPreamble
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_TxPreamble_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
RT_802_11_PREAMBLE Preamble;
Preamble = (RT_802_11_PREAMBLE)simple_strtol(arg, 0, 10);
switch (Preamble)
{
case Rt802_11PreambleShort:
pAd->CommonCfg.TxPreamble = Preamble;
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
MlmeSetTxPreamble(pAd, Rt802_11PreambleShort);
#endif // CONFIG_STA_SUPPORT //
break;
case Rt802_11PreambleLong:
#ifdef CONFIG_STA_SUPPORT
case Rt802_11PreambleAuto:
// if user wants AUTO, initialize to LONG here, then change according to AP's
// capability upon association.
#endif // CONFIG_STA_SUPPORT //
pAd->CommonCfg.TxPreamble = Preamble;
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
MlmeSetTxPreamble(pAd, Rt802_11PreambleLong);
#endif // CONFIG_STA_SUPPORT //
break;
default: //Invalid argument
return FALSE;
}
DBGPRINT(RT_DEBUG_TRACE, ("Set_TxPreamble_Proc::(TxPreamble=%ld)\n", pAd->CommonCfg.TxPreamble));
return TRUE;
}
/*
==========================================================================
Description:
Set RTS Threshold
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_RTSThreshold_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
NDIS_802_11_RTS_THRESHOLD RtsThresh;
RtsThresh = simple_strtol(arg, 0, 10);
if((RtsThresh > 0) && (RtsThresh <= MAX_RTS_THRESHOLD))
pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
#ifdef CONFIG_STA_SUPPORT
else if (RtsThresh == 0)
pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;
#endif // CONFIG_STA_SUPPORT //
else
return FALSE; //Invalid argument
DBGPRINT(RT_DEBUG_TRACE, ("Set_RTSThreshold_Proc::(RTSThreshold=%d)\n", pAd->CommonCfg.RtsThreshold));
return TRUE;
}
/*
==========================================================================
Description:
Set Fragment Threshold
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_FragThreshold_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
NDIS_802_11_FRAGMENTATION_THRESHOLD FragThresh;
FragThresh = simple_strtol(arg, 0, 10);
if (FragThresh > MAX_FRAG_THRESHOLD || FragThresh < MIN_FRAG_THRESHOLD)
{
//Illegal FragThresh so we set it to default
pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
}
else if (FragThresh % 2 == 1)
{
// The length of each fragment shall always be an even number of octets, except for the last fragment
// of an MSDU or MMPDU, which may be either an even or an odd number of octets.
pAd->CommonCfg.FragmentThreshold = (USHORT)(FragThresh - 1);
}
else
{
pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
}
#ifdef CONFIG_STA_SUPPORT
IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
{
if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)
pAd->CommonCfg.bUseZeroToDisableFragment = TRUE;
else
pAd->CommonCfg.bUseZeroToDisableFragment = FALSE;
}
#endif // CONFIG_STA_SUPPORT //
DBGPRINT(RT_DEBUG_TRACE, ("Set_FragThreshold_Proc::(FragThreshold=%d)\n", pAd->CommonCfg.FragmentThreshold));
return TRUE;
}
/*
==========================================================================
Description:
Set TxBurst
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_TxBurst_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
LONG TxBurst;
TxBurst = simple_strtol(arg, 0, 10);
if (TxBurst == 1)
pAd->CommonCfg.bEnableTxBurst = TRUE;
else if (TxBurst == 0)
pAd->CommonCfg.bEnableTxBurst = FALSE;
else
return FALSE; //Invalid argument
DBGPRINT(RT_DEBUG_TRACE, ("Set_TxBurst_Proc::(TxBurst=%d)\n", pAd->CommonCfg.bEnableTxBurst));
return TRUE;
}
#ifdef RTMP_MAC_PCI
INT Set_ShowRF_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
int ShowRF = simple_strtol(arg, 0, 10);
if (ShowRF == 1)
pAd->ShowRf = TRUE;
else
pAd->ShowRf = FALSE;
return TRUE;
}
#endif // RTMP_MAC_PCI //
#ifdef AGGREGATION_SUPPORT
/*
==========================================================================
Description:
Set TxBurst
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_PktAggregate_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
LONG aggre;
aggre = simple_strtol(arg, 0, 10);
if (aggre == 1)
pAd->CommonCfg.bAggregationCapable = TRUE;
else if (aggre == 0)
pAd->CommonCfg.bAggregationCapable = FALSE;
else
return FALSE; //Invalid argument
DBGPRINT(RT_DEBUG_TRACE, ("Set_PktAggregate_Proc::(AGGRE=%d)\n", pAd->CommonCfg.bAggregationCapable));
return TRUE;
}
#endif
#ifdef INF_PPA_SUPPORT
INT Set_INF_AMAZON_SE_PPA_Proc(
IN PRTMP_ADAPTER pAd,
IN PUCHAR arg)
{
ULONG aggre;
UINT status;
aggre = simple_strtol(arg, 0, 10);
if (aggre == 1)
{
if(pAd->PPAEnable==TRUE)
{
DBGPRINT(RT_DEBUG_TRACE, ("INF_AMAZON_SE_PPA already enabled \n"));
}
else
{
if (ppa_hook_directpath_register_dev_fn)
{
UINT32 g_if_id;
if (pAd->pDirectpathCb == NULL)
{
pAd->pDirectpathCb = (PPA_DIRECTPATH_CB *) kmalloc (sizeof(PPA_DIRECTPATH_CB), GFP_ATOMIC);
DBGPRINT(RT_DEBUG_TRACE, ("Realloc memory for pDirectpathCb ??\n"));
}
/* register callback */
pAd->pDirectpathCb->rx_fn = NULL;
pAd->pDirectpathCb->stop_tx_fn = NULL;
pAd->pDirectpathCb->start_tx_fn = NULL;
status = ppa_hook_directpath_register_dev_fn(&g_if_id, pAd->net_dev, pAd->pDirectpathCb, PPA_F_DIRECTPATH_ETH_IF);
if(status==1)
{
pAd->g_if_id=g_if_id;
DBGPRINT(RT_DEBUG_TRACE, ("register INF_AMAZON_SE_PPA success :ret:%d id:%d:%d\n",status,pAd->g_if_id,g_if_id));
pAd->PPAEnable=TRUE;
}
else
{
DBGPRINT(RT_DEBUG_TRACE, ("register INF_AMAZON_SE_PPA fail :ret:%d\n",status));
}
}
else
{
DBGPRINT(RT_DEBUG_TRACE, ("INF_AMAZON_SE_PPA enable fail : there is no INF_AMAZON_SE_PPA module . \n"));
}
}
}
else if (aggre == 0)
{
if(pAd->PPAEnable==FALSE)
{
DBGPRINT(RT_DEBUG_TRACE, ("INF_AMAZON_SE_PPA already disable \n"));
}
else
{
if (ppa_hook_directpath_register_dev_fn)
{
UINT32 g_if_id;
g_if_id=pAd->g_if_id;
DBGPRINT(RT_DEBUG_TRACE, ("g_if_id=%d \n",pAd->g_if_id));
status=ppa_hook_directpath_register_dev_fn(&g_if_id, pAd->net_dev, NULL, PPA_F_DIRECTPATH_REGISTER);
if(status==1)
{
pAd->g_if_id=0;
DBGPRINT(RT_DEBUG_TRACE, ("unregister INF_AMAZON_SE_PPA success :ret:%d\n",status));
pAd->PPAEnable=FALSE;
}
else
{
DBGPRINT(RT_DEBUG_TRACE, ("unregister INF_AMAZON_SE_PPA fail :ret:%d\n",status));
}
}
else
{
DBGPRINT(RT_DEBUG_TRACE, ("INF_AMAZON_SE_PPA enable fail : there is no INF_AMAZON_SE_PPA module . \n"));
}
}
}
else
{
DBGPRINT(RT_DEBUG_TRACE, ("Invalid argument %d \n",aggre));
return FALSE; //Invalid argument
}
return TRUE;
}
#endif // INF_PPA_SUPPORT //
/*
==========================================================================
Description:
Set IEEE80211H.
This parameter is 1 when needs radar detection, otherwise 0
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_IEEE80211H_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
LONG ieee80211h;
ieee80211h = simple_strtol(arg, 0, 10);
if (ieee80211h == 1)
pAd->CommonCfg.bIEEE80211H = TRUE;
else if (ieee80211h == 0)
pAd->CommonCfg.bIEEE80211H = FALSE;
else
return FALSE; //Invalid argument
DBGPRINT(RT_DEBUG_TRACE, ("Set_IEEE80211H_Proc::(IEEE80211H=%d)\n", pAd->CommonCfg.bIEEE80211H));
return TRUE;
}
#ifdef DBG
/*
==========================================================================
Description:
For Debug information
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT Set_Debug_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
DBGPRINT(RT_DEBUG_TRACE, ("==> Set_Debug_Proc *******************\n"));
if(simple_strtol(arg, 0, 10) <= RT_DEBUG_LOUD)
RTDebugLevel = simple_strtol(arg, 0, 10);
DBGPRINT(RT_DEBUG_TRACE, ("<== Set_Debug_Proc(RTDebugLevel = %ld)\n", RTDebugLevel));
return TRUE;
}
#endif
INT Show_DescInfo_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
#ifdef RTMP_MAC_PCI
INT i, QueIdx=0;
// ULONG RegValue;
PRT28XX_RXD_STRUC pRxD;
PTXD_STRUC pTxD;
PRTMP_TX_RING pTxRing = &pAd->TxRing[QueIdx];
PRTMP_MGMT_RING pMgmtRing = &pAd->MgmtRing;
PRTMP_RX_RING pRxRing = &pAd->RxRing;
for(i=0;i<TX_RING_SIZE;i++)
{
pTxD = (PTXD_STRUC) pTxRing->Cell[i].AllocVa;
DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i));
hex_dump("Tx Descriptor", (PUCHAR)pTxD, 16);
DBGPRINT(RT_DEBUG_OFF, ("pTxD->DMADONE = %x\n", pTxD->DMADONE));
}
DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n"));
for(i=0;i<MGMT_RING_SIZE;i++)
{
pTxD = (PTXD_STRUC) pMgmtRing->Cell[i].AllocVa;
DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i));
hex_dump("Mgmt Descriptor", (PUCHAR)pTxD, 16);
DBGPRINT(RT_DEBUG_OFF, ("pMgmt->DMADONE = %x\n", pTxD->DMADONE));
}
DBGPRINT(RT_DEBUG_OFF, ("---------------------------------------------------\n"));
for(i=0;i<RX_RING_SIZE;i++)
{
pRxD = (PRT28XX_RXD_STRUC) pRxRing->Cell[i].AllocVa;
DBGPRINT(RT_DEBUG_OFF, ("Desc #%d\n",i));
hex_dump("Rx Descriptor", (PUCHAR)pRxD, 16);
DBGPRINT(RT_DEBUG_OFF, ("pRxD->DDONE = %x\n", pRxD->DDONE));
}
#endif // RTMP_MAC_PCI //
return TRUE;
}
/*
==========================================================================
Description:
Reset statistics counter
Arguments:
pAdapter Pointer to our adapter
arg
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/