-
Notifications
You must be signed in to change notification settings - Fork 620
/
wifi.h
2927 lines (2549 loc) · 68.8 KB
/
wifi.h
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
/******************************************************************************
*
* Copyright(c) 2009-2010 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
*****************************************************************************/
#ifndef __RTL_WIFI_H__
#define __RTL_WIFI_H__
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/firmware.h>
#include <linux/version.h>
#include <linux/etherdevice.h>
#include <linux/usb.h>
#include <net/mac80211.h>
#include "debug.h"
#define RF_CHANGE_BY_INIT 0
#define RF_CHANGE_BY_IPS BIT(28)
#define RF_CHANGE_BY_PS BIT(29)
#define RF_CHANGE_BY_HW BIT(30)
#define RF_CHANGE_BY_SW BIT(31)
#define IQK_ADDA_REG_NUM 16
#define IQK_MAC_REG_NUM 4
#define IQK_THRESHOLD 8
#define MAX_KEY_LEN 61
#define KEY_BUF_SIZE 5
/* QoS related. */
/*aci: 0x00 Best Effort*/
/*aci: 0x01 Background*/
/*aci: 0x10 Video*/
/*aci: 0x11 Voice*/
/*Max: define total number.*/
#define AC0_BE 0
#define AC1_BK 1
#define AC2_VI 2
#define AC3_VO 3
#define AC_MAX 4
#define QOS_QUEUE_NUM 4
#define RTL_MAC80211_NUM_QUEUE 5
#define REALTEK_USB_VENQT_MAX_BUF_SIZE 254
#define RTL_USB_MAX_RX_COUNT 100
#define QBSS_LOAD_SIZE 5
#define MAX_WMMELE_LENGTH 64
#define TOTAL_CAM_ENTRY 32
/*slot time for 11g. */
#define RTL_SLOT_TIME_9 9
#define RTL_SLOT_TIME_20 20
/*related with tcp/ip. */
/*if_ehther.h*/
#define ETH_P_PAE 0x888E /*Port Access Entity
*(IEEE 802.1X) */
#define ETH_P_IP 0x0800 /*Internet Protocol packet */
#define ETH_P_ARP 0x0806 /*Address Resolution packet */
#define SNAP_SIZE 6
#define PROTOC_TYPE_SIZE 2
/*related with 802.11 frame*/
#define MAC80211_3ADDR_LEN 24
#define MAC80211_4ADDR_LEN 30
#define CHANNEL_MAX_NUMBER (14 + 24 + 21) /* 14 is the max
* channel number */
#define CHANNEL_MAX_NUMBER_2G 14
#define CHANNEL_MAX_NUMBER_5G 54 /* Please refer to
*"phy_GetChnlGroup8812A" and
* "Hal_ReadTxPowerInfo8812A"*/
#define MAX_REGULATION_NUM 4
#define MAX_RF_PATH_NUM 2
#define MAX_RATE_SECTION_NUM 6
#define MAX_2_4G_BANDWITH_NUM 4
#define MAX_5G_BANDWITH_NUM 4
#define CHANNEL_MAX_NUMBER_5G_80M 7
#define CHANNEL_GROUP_MAX (3 + 9) /* ch1~3, ch4~9, ch10~14
* total three groups */
#define MAX_PG_GROUP 13
#define CHANNEL_GROUP_MAX_2G 3
#define CHANNEL_GROUP_IDX_5GL 3
#define CHANNEL_GROUP_IDX_5GM 6
#define CHANNEL_GROUP_IDX_5GH 9
#define CHANNEL_GROUP_MAX_5G 9
#define CHANNEL_MAX_NUMBER_2G 14
#define AVG_THERMAL_NUM 8
#define AVG_THERMAL_NUM_92E 4
#define AVG_THERMAL_NUM_88E 4
#define AVG_THERMAL_NUM_8723BE 4
#define MAX_TID_COUNT 9
#define MAX_NUM_RATES 264
/*for 88E use*/
/*It must always set to 4, otherwise read efuse table secquence will be wrong.*/
#define MAX_TX_COUNT 4
#define MAX_RF_PATH 4
#define MAX_CHNL_GROUP_24G 6
#define MAX_CHNL_GROUP_5G 14
/* BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON. */
#define MAX_TX_QUEUE 9
#define TX_PWR_BY_RATE_NUM_BAND 2
#define TX_PWR_BY_RATE_NUM_RF 4
#define TX_PWR_BY_RATE_NUM_SECTION 12
#define MAX_BASE_NUM_IN_PHY_REG_PG_24G 6
#define MAX_BASE_NUM_IN_PHY_REG_PG_5G 5
#define DELTA_SWINGIDX_SIZE 30
#define BAND_NUM 3
/*Now, it's just for 8192ee
*not OK yet, keep it 0*/
#define DMA_IS_64BIT 0
#define RTL8192EE_SEG_NUM 1 /* 0:2 seg, 1: 4 seg, 2: 8 seg */
#define PACKET_NORMAL 0
#define PACKET_DHCP 1
#define PACKET_ARP 2
#define PACKET_EAPOL 3
#define MAX_SUPPORT_WOL_PATTERN_NUM 16
#define RSVD_WOL_PATTERN_NUM 1
#define WKFMCAM_ADDR_NUM 6
#define WKFMCAM_SIZE 24
#define MAX_WOL_BIT_MASK_SIZE 16
/* MIN LEN keeps 13 here */
#define MIN_WOL_PATTERN_SIZE 13
#define MAX_WOL_PATTERN_SIZE 128
#define WAKE_ON_MAGIC_PACKET BIT(0)
#define WAKE_ON_PATTERN_MATCH BIT(1)
#define WOL_REASON_PTK_UPDATE BIT(0)
#define WOL_REASON_GTK_UPDATE BIT(1)
#define WOL_REASON_DISASSOC BIT(2)
#define WOL_REASON_DEAUTH BIT(3)
#define WOL_REASON_AP_LOST BIT(4)
#define WOL_REASON_MAGIC_PKT BIT(5)
#define WOL_REASON_UNICAST_PKT BIT(6)
#define WOL_REASON_PATTERN_PKT BIT(7)
#define WOL_REASON_RTD3_SSID_MATCH BIT(8)
#define WOL_REASON_REALWOW_V2_WAKEUPPKT BIT(9)
#define WOL_REASON_REALWOW_V2_ACKLOST BIT(10)
struct txpower_info_2g {
u8 index_cck_base[MAX_RF_PATH][MAX_CHNL_GROUP_24G];
u8 index_bw40_base[MAX_RF_PATH][MAX_CHNL_GROUP_24G];
/*If only one tx, only BW20 and OFDM are used.*/
u8 cck_diff[MAX_RF_PATH][MAX_TX_COUNT];
u8 ofdm_diff[MAX_RF_PATH][MAX_TX_COUNT];
u8 bw20_diff[MAX_RF_PATH][MAX_TX_COUNT];
u8 bw40_diff[MAX_RF_PATH][MAX_TX_COUNT];
};
struct txpower_info_5g {
u8 index_bw40_base[MAX_RF_PATH][MAX_CHNL_GROUP_5G];
/*If only one tx, only BW20, OFDM, BW80 and BW160 are used.*/
u8 ofdm_diff[MAX_RF_PATH][MAX_TX_COUNT];
u8 bw20_diff[MAX_RF_PATH][MAX_TX_COUNT];
u8 bw40_diff[MAX_RF_PATH][MAX_TX_COUNT];
u8 bw80_diff[MAX_RF_PATH][MAX_TX_COUNT];
u8 bw160_diff[MAX_RF_PATH][MAX_TX_COUNT];
};
/* for early mode */
#define EM_HDR_LEN 8
#define FCS_LEN 4
#define MAX_VIRTUAL_MAC 1
enum rtl8192c_h2c_cmd {
H2C_AP_OFFLOAD = 0,
H2C_SETPWRMODE = 1,
H2C_JOINBSSRPT = 2,
H2C_RSVDPAGE = 3,
H2C_RSSI_REPORT = 5,
H2C_RA_MASK = 6,
H2C_MACID_PS_MODE = 7,
H2C_P2P_PS_OFFLOAD = 8,
H2C_MAC_MODE_SEL = 9,
H2C_PWRM = 15,
H2C_P2P_PS_CTW_CMD = 24,
MAX_H2CCMD
};
enum rf_tx_num {
RF_1TX = 0,
RF_2TX,
RF_MAX_TX_NUM,
RF_TX_NUM_NONIMPLEMENT,
};
enum rate_section {
CCK = 0,
OFDM,
HT_MCS0_MCS7,
HT_MCS8_MCS15,
VHT_1SSMCS0_1SSMCS9,
VHT_2SSMCS0_2SSMCS9,
};
enum intf_type {
INTF_PCI = 0,
INTF_USB = 1,
};
enum radio_path {
RF90_PATH_A = 0,
RF90_PATH_B = 1,
RF90_PATH_C = 2,
RF90_PATH_D = 3,
};
enum regulation_txpwr_lmt {
TXPWR_LMT_FCC = 0,
TXPWR_LMT_MKK = 1,
TXPWR_LMT_ETSI = 2,
TXPWR_LMT_WW = 3,
TXPWR_LMT_MAX_REGULATION_NUM = 4
};
enum rt_eeprom_type {
EEPROM_93C46,
EEPROM_93C56,
EEPROM_BOOT_EFUSE,
};
enum rtl_status {
RTL_STATUS_INTERFACE_START = 0,
};
enum hardware_type {
HARDWARE_TYPE_RTL8192E,
HARDWARE_TYPE_RTL8192U,
HARDWARE_TYPE_RTL8192SE,
HARDWARE_TYPE_RTL8192SU,
HARDWARE_TYPE_RTL8192CE,
HARDWARE_TYPE_RTL8192CU,
HARDWARE_TYPE_RTL8192DE,
HARDWARE_TYPE_RTL8192DU,
HARDWARE_TYPE_RTL8723AE,
HARDWARE_TYPE_RTL8188EE,
HARDWARE_TYPE_RTL8723BE,
HARDWARE_TYPE_RTL8192EE,
HARDWARE_TYPE_RTL8821AE,
HARDWARE_TYPE_RTL8812AE,
/* keep it last */
HARDWARE_TYPE_NUM
};
enum scan_operation_backup_opt {
SCAN_OPT_BACKUP = 0,
SCAN_OPT_BACKUP_BAND0 = 0,
SCAN_OPT_BACKUP_BAND1,
SCAN_OPT_RESTORE,
SCAN_OPT_MAX
};
/*RF state.*/
enum rf_pwrstate {
ERFON,
ERFSLEEP,
ERFOFF
};
struct bb_reg_def {
u32 rfintfs;
u32 rfintfi;
u32 rfintfo;
u32 rfintfe;
u32 rf3wire_offset;
u32 rflssi_select;
u32 rftxgain_stage;
u32 rfhssi_para1;
u32 rfhssi_para2;
u32 rfswitch_control;
u32 rfagc_control1;
u32 rfagc_control2;
u32 rfrxiq_imbalance;
u32 rfrx_afe;
u32 rftxiq_imbalance;
u32 rftx_afe;
u32 rflssi_readback;
u32 rflssi_readbackpi;
};
enum io_type {
IO_CMD_PAUSE_DM_BY_SCAN = 0,
IO_CMD_PAUSE_BAND0_DM_BY_SCAN = 0,
IO_CMD_PAUSE_BAND1_DM_BY_SCAN = 1,
IO_CMD_RESUME_DM_BY_SCAN = 2,
};
enum hw_variables {
HW_VAR_ETHER_ADDR,
HW_VAR_MULTICAST_REG,
HW_VAR_BASIC_RATE,
HW_VAR_BSSID,
HW_VAR_MEDIA_STATUS,
HW_VAR_SECURITY_CONF,
HW_VAR_BEACON_INTERVAL,
HW_VAR_ATIM_WINDOW,
HW_VAR_LISTEN_INTERVAL,
HW_VAR_CS_COUNTER,
HW_VAR_DEFAULTKEY0,
HW_VAR_DEFAULTKEY1,
HW_VAR_DEFAULTKEY2,
HW_VAR_DEFAULTKEY3,
HW_VAR_SIFS,
HW_VAR_R2T_SIFS,
HW_VAR_DIFS,
HW_VAR_EIFS,
HW_VAR_SLOT_TIME,
HW_VAR_ACK_PREAMBLE,
HW_VAR_CW_CONFIG,
HW_VAR_CW_VALUES,
HW_VAR_RATE_FALLBACK_CONTROL,
HW_VAR_CONTENTION_WINDOW,
HW_VAR_RETRY_COUNT,
HW_VAR_TR_SWITCH,
HW_VAR_COMMAND,
HW_VAR_WPA_CONFIG,
HW_VAR_AMPDU_MIN_SPACE,
HW_VAR_SHORTGI_DENSITY,
HW_VAR_AMPDU_FACTOR,
HW_VAR_MCS_RATE_AVAILABLE,
HW_VAR_AC_PARAM,
HW_VAR_ACM_CTRL,
HW_VAR_DIS_Req_Qsize,
HW_VAR_CCX_CHNL_LOAD,
HW_VAR_CCX_NOISE_HISTOGRAM,
HW_VAR_CCX_CLM_NHM,
HW_VAR_TxOPLimit,
HW_VAR_TURBO_MODE,
HW_VAR_RF_STATE,
HW_VAR_RF_OFF_BY_HW,
HW_VAR_BUS_SPEED,
HW_VAR_SET_DEV_POWER,
HW_VAR_RCR,
HW_VAR_RATR_0,
HW_VAR_RRSR,
HW_VAR_CPU_RST,
HW_VAR_CECHK_BSSID,
HW_VAR_LBK_MODE,
HW_VAR_AES_11N_FIX,
HW_VAR_USB_RX_AGGR,
HW_VAR_USER_CONTROL_TURBO_MODE,
HW_VAR_RETRY_LIMIT,
HW_VAR_INIT_TX_RATE,
HW_VAR_TX_RATE_REG,
HW_VAR_EFUSE_USAGE,
HW_VAR_EFUSE_BYTES,
HW_VAR_AUTOLOAD_STATUS,
HW_VAR_RF_2R_DISABLE,
HW_VAR_SET_RPWM,
HW_VAR_H2C_FW_PWRMODE,
HW_VAR_H2C_FW_JOINBSSRPT,
HW_VAR_H2C_FW_MEDIASTATUSRPT,
HW_VAR_H2C_FW_P2P_PS_OFFLOAD,
HW_VAR_FW_PSMODE_STATUS,
HW_VAR_INIT_RTS_RATE,
HW_VAR_RESUME_CLK_ON,
HW_VAR_FW_LPS_ACTION,
HW_VAR_1X1_RECV_COMBINE,
HW_VAR_STOP_SEND_BEACON,
HW_VAR_TSF_TIMER,
HW_VAR_IO_CMD,
HW_VAR_RF_RECOVERY,
HW_VAR_H2C_FW_UPDATE_GTK,
HW_VAR_WF_MASK,
HW_VAR_WF_CRC,
HW_VAR_WF_IS_MAC_ADDR,
HW_VAR_H2C_FW_OFFLOAD,
HW_VAR_RESET_WFCRC,
HW_VAR_HANDLE_FW_C2H,
HW_VAR_DL_FW_RSVD_PAGE,
HW_VAR_AID,
HW_VAR_HW_SEQ_ENABLE,
HW_VAR_CORRECT_TSF,
HW_VAR_BCN_VALID,
HW_VAR_FWLPS_RF_ON,
HW_VAR_DUAL_TSF_RST,
HW_VAR_SWITCH_EPHY_WoWLAN,
HW_VAR_INT_MIGRATION,
HW_VAR_INT_AC,
HW_VAR_RF_TIMING,
HAL_DEF_WOWLAN,
HW_VAR_MRC,
HW_VAR_KEEP_ALIVE,
HW_VAR_NAV_UPPER,
HW_VAR_MGT_FILTER,
HW_VAR_CTRL_FILTER,
HW_VAR_DATA_FILTER,
};
enum rt_media_status {
RT_MEDIA_DISCONNECT = 0,
RT_MEDIA_CONNECT = 1
};
enum rt_oem_id {
RT_CID_DEFAULT = 0,
RT_CID_8187_ALPHA0 = 1,
RT_CID_8187_SERCOMM_PS = 2,
RT_CID_8187_HW_LED = 3,
RT_CID_8187_NETGEAR = 4,
RT_CID_WHQL = 5,
RT_CID_819x_CAMEO = 6,
RT_CID_819x_RUNTOP = 7,
RT_CID_819x_Senao = 8,
RT_CID_TOSHIBA = 9,
RT_CID_819x_Netcore = 10,
RT_CID_Nettronix = 11,
RT_CID_DLINK = 12,
RT_CID_PRONET = 13,
RT_CID_COREGA = 14,
RT_CID_819x_ALPHA = 15,
RT_CID_819x_Sitecom = 16,
RT_CID_CCX = 17,
RT_CID_819x_Lenovo = 18,
RT_CID_819x_QMI = 19,
RT_CID_819x_Edimax_Belkin = 20,
RT_CID_819x_Sercomm_Belkin = 21,
RT_CID_819x_CAMEO1 = 22,
RT_CID_819x_MSI = 23,
RT_CID_819x_Acer = 24,
RT_CID_819x_HP = 27,
RT_CID_819x_CLEVO = 28,
RT_CID_819x_Arcadyan_Belkin = 29,
RT_CID_819x_SAMSUNG = 30,
RT_CID_819x_WNC_COREGA = 31,
RT_CID_819x_Foxcoon = 32,
RT_CID_819x_DELL = 33,
RT_CID_819x_PRONETS = 34,
RT_CID_819x_Edimax_ASUS = 35,
RT_CID_NETGEAR = 36,
RT_CID_PLANEX = 37,
RT_CID_CC_C = 38,
};
enum hw_descs {
HW_DESC_OWN,
HW_DESC_RXOWN,
HW_DESC_TX_NEXTDESC_ADDR,
HW_DESC_TXBUFF_ADDR,
HW_DESC_RXBUFF_ADDR,
HW_DESC_RXPKT_LEN,
HW_DESC_RXERO,
HW_DESC_RX_PREPARE,
};
enum prime_sc {
PRIME_CHNL_OFFSET_DONT_CARE = 0,
PRIME_CHNL_OFFSET_LOWER = 1,
PRIME_CHNL_OFFSET_UPPER = 2,
};
enum rf_type {
RF_1T1R = 0,
RF_1T2R = 1,
RF_2T2R = 2,
RF_2T2R_GREEN = 3,
};
enum ht_channel_width {
HT_CHANNEL_WIDTH_20 = 0,
HT_CHANNEL_WIDTH_20_40 = 1,
HT_CHANNEL_WIDTH_80 = 2,
};
/* Ref: 802.11i sepc D10.0 7.3.2.25.1
Cipher Suites Encryption Algorithms */
enum rt_enc_alg {
NO_ENCRYPTION = 0,
WEP40_ENCRYPTION = 1,
TKIP_ENCRYPTION = 2,
RSERVED_ENCRYPTION = 3,
AESCCMP_ENCRYPTION = 4,
WEP104_ENCRYPTION = 5,
AESCMAC_ENCRYPTION = 6, /*IEEE802.11w */
};
enum rtl_hal_state {
_HAL_STATE_STOP = 0,
_HAL_STATE_START = 1,
};
enum rtl_desc92_rate {
DESC92_RATE1M = 0x00,
DESC92_RATE2M = 0x01,
DESC92_RATE5_5M = 0x02,
DESC92_RATE11M = 0x03,
DESC92_RATE6M = 0x04,
DESC92_RATE9M = 0x05,
DESC92_RATE12M = 0x06,
DESC92_RATE18M = 0x07,
DESC92_RATE24M = 0x08,
DESC92_RATE36M = 0x09,
DESC92_RATE48M = 0x0a,
DESC92_RATE54M = 0x0b,
DESC92_RATEMCS0 = 0x0c,
DESC92_RATEMCS1 = 0x0d,
DESC92_RATEMCS2 = 0x0e,
DESC92_RATEMCS3 = 0x0f,
DESC92_RATEMCS4 = 0x10,
DESC92_RATEMCS5 = 0x11,
DESC92_RATEMCS6 = 0x12,
DESC92_RATEMCS7 = 0x13,
DESC92_RATEMCS8 = 0x14,
DESC92_RATEMCS9 = 0x15,
DESC92_RATEMCS10 = 0x16,
DESC92_RATEMCS11 = 0x17,
DESC92_RATEMCS12 = 0x18,
DESC92_RATEMCS13 = 0x19,
DESC92_RATEMCS14 = 0x1a,
DESC92_RATEMCS15 = 0x1b,
DESC92_RATEMCS15_SG = 0x1c,
DESC92_RATEMCS32 = 0x20,
};
enum rtl_var_map {
/*reg map */
SYS_ISO_CTRL = 0,
SYS_FUNC_EN,
SYS_CLK,
MAC_RCR_AM,
MAC_RCR_AB,
MAC_RCR_ACRC32,
MAC_RCR_ACF,
MAC_RCR_AAP,
MAC_HIMR,
MAC_HIMRE,
MAC_HSISR,
/*efuse map */
EFUSE_TEST,
EFUSE_CTRL,
EFUSE_CLK,
EFUSE_CLK_CTRL,
EFUSE_PWC_EV12V,
EFUSE_FEN_ELDR,
EFUSE_LOADER_CLK_EN,
EFUSE_ANA8M,
EFUSE_HWSET_MAX_SIZE,
EFUSE_MAX_SECTION_MAP,
EFUSE_REAL_CONTENT_SIZE,
EFUSE_OOB_PROTECT_BYTES_LEN,
EFUSE_ACCESS,
/*CAM map */
RWCAM,
WCAMI,
RCAMO,
CAMDBG,
SECR,
SEC_CAM_NONE,
SEC_CAM_WEP40,
SEC_CAM_TKIP,
SEC_CAM_AES,
SEC_CAM_WEP104,
/*IMR map */
RTL_IMR_BCNDMAINT6, /*Beacon DMA Interrupt 6 */
RTL_IMR_BCNDMAINT5, /*Beacon DMA Interrupt 5 */
RTL_IMR_BCNDMAINT4, /*Beacon DMA Interrupt 4 */
RTL_IMR_BCNDMAINT3, /*Beacon DMA Interrupt 3 */
RTL_IMR_BCNDMAINT2, /*Beacon DMA Interrupt 2 */
RTL_IMR_BCNDMAINT1, /*Beacon DMA Interrupt 1 */
RTL_IMR_BCNDOK8, /*Beacon Queue DMA OK Interrup 8 */
RTL_IMR_BCNDOK7, /*Beacon Queue DMA OK Interrup 7 */
RTL_IMR_BCNDOK6, /*Beacon Queue DMA OK Interrup 6 */
RTL_IMR_BCNDOK5, /*Beacon Queue DMA OK Interrup 5 */
RTL_IMR_BCNDOK4, /*Beacon Queue DMA OK Interrup 4 */
RTL_IMR_BCNDOK3, /*Beacon Queue DMA OK Interrup 3 */
RTL_IMR_BCNDOK2, /*Beacon Queue DMA OK Interrup 2 */
RTL_IMR_BCNDOK1, /*Beacon Queue DMA OK Interrup 1 */
RTL_IMR_TIMEOUT2, /*Timeout interrupt 2 */
RTL_IMR_TIMEOUT1, /*Timeout interrupt 1 */
RTL_IMR_TXFOVW, /*Transmit FIFO Overflow */
RTL_IMR_PSTIMEOUT, /*Power save time out interrupt */
RTL_IMR_BcnInt, /*Beacon DMA Interrupt 0 */
RTL_IMR_RXFOVW, /*Receive FIFO Overflow */
RTL_IMR_RDU, /*Receive Descriptor Unavailable */
RTL_IMR_ATIMEND, /*For 92C,ATIM Window End Interrupt */
RTL_IMR_BDOK, /*Beacon Queue DMA OK Interrup */
RTL_IMR_HIGHDOK, /*High Queue DMA OK Interrupt */
RTL_IMR_COMDOK, /*Command Queue DMA OK Interrupt*/
RTL_IMR_TBDOK, /*Transmit Beacon OK interrup */
RTL_IMR_MGNTDOK, /*Management Queue DMA OK Interrupt */
RTL_IMR_TBDER, /*For 92C,Transmit Beacon Error Interrupt */
RTL_IMR_BKDOK, /*AC_BK DMA OK Interrupt */
RTL_IMR_BEDOK, /*AC_BE DMA OK Interrupt */
RTL_IMR_VIDOK, /*AC_VI DMA OK Interrupt */
RTL_IMR_VODOK, /*AC_VO DMA Interrupt */
RTL_IMR_ROK, /*Receive DMA OK Interrupt */
RTL_IMR_HSISR_IND, /*HSISR Interrupt*/
RTL_IBSS_INT_MASKS, /*(RTL_IMR_BcnInt | RTL_IMR_TBDOK |
* RTL_IMR_TBDER) */
RTL_IMR_C2HCMD, /*fw interrupt*/
/*CCK Rates, TxHT = 0 */
RTL_RC_CCK_RATE1M,
RTL_RC_CCK_RATE2M,
RTL_RC_CCK_RATE5_5M,
RTL_RC_CCK_RATE11M,
/*OFDM Rates, TxHT = 0 */
RTL_RC_OFDM_RATE6M,
RTL_RC_OFDM_RATE9M,
RTL_RC_OFDM_RATE12M,
RTL_RC_OFDM_RATE18M,
RTL_RC_OFDM_RATE24M,
RTL_RC_OFDM_RATE36M,
RTL_RC_OFDM_RATE48M,
RTL_RC_OFDM_RATE54M,
RTL_RC_HT_RATEMCS7,
RTL_RC_HT_RATEMCS15,
RTL_RC_VHT_RATE_1SS_MCS7,
RTL_RC_VHT_RATE_1SS_MCS8,
RTL_RC_VHT_RATE_1SS_MCS9,
RTL_RC_VHT_RATE_2SS_MCS7,
RTL_RC_VHT_RATE_2SS_MCS8,
RTL_RC_VHT_RATE_2SS_MCS9,
/*keep it last */
RTL_VAR_MAP_MAX,
};
/*Firmware PS mode for control LPS.*/
enum _fw_ps_mode {
FW_PS_ACTIVE_MODE = 0,
FW_PS_MIN_MODE = 1,
FW_PS_MAX_MODE = 2,
FW_PS_DTIM_MODE = 3,
FW_PS_VOIP_MODE = 4,
FW_PS_UAPSD_WMM_MODE = 5,
FW_PS_UAPSD_MODE = 6,
FW_PS_IBSS_MODE = 7,
FW_PS_WWLAN_MODE = 8,
FW_PS_PM_Radio_Off = 9,
FW_PS_PM_Card_Disable = 10,
};
enum rt_psmode {
EACTIVE, /*Active/Continuous access. */
EMAXPS, /*Max power save mode. */
EFASTPS, /*Fast power save mode. */
EAUTOPS, /*Auto power save mode. */
};
/*LED related.*/
enum led_ctl_mode {
LED_CTL_POWER_ON = 1,
LED_CTL_LINK = 2,
LED_CTL_NO_LINK = 3,
LED_CTL_TX = 4,
LED_CTL_RX = 5,
LED_CTL_SITE_SURVEY = 6,
LED_CTL_POWER_OFF = 7,
LED_CTL_START_TO_LINK = 8,
LED_CTL_START_WPS = 9,
LED_CTL_STOP_WPS = 10,
};
enum rtl_led_pin {
LED_PIN_GPIO0,
LED_PIN_LED0,
LED_PIN_LED1,
LED_PIN_LED2
};
/*QoS related.*/
/*acm implementation method.*/
enum acm_method {
eAcmWay0_SwAndHw = 0,
eAcmWay1_HW = 1,
EACMWAY2_SW = 2,
};
enum macphy_mode {
SINGLEMAC_SINGLEPHY = 0,
DUALMAC_DUALPHY,
DUALMAC_SINGLEPHY,
};
enum band_type {
BAND_ON_2_4G = 0,
BAND_ON_5G,
BAND_ON_BOTH,
BANDMAX
};
/*aci/aifsn Field.
Ref: WMM spec 2.2.2: WME Parameter Element, p.12.*/
union aci_aifsn {
u8 char_data;
struct {
u8 aifsn:4;
u8 acm:1;
u8 aci:2;
u8 reserved:1;
} f; /* Field */
};
/*mlme related.*/
enum wireless_mode {
WIRELESS_MODE_UNKNOWN = 0x00,
WIRELESS_MODE_A = 0x01,
WIRELESS_MODE_B = 0x02,
WIRELESS_MODE_G = 0x04,
WIRELESS_MODE_AUTO = 0x08,
WIRELESS_MODE_N_24G = 0x10,
WIRELESS_MODE_N_5G = 0x20,
WIRELESS_MODE_AC_5G = 0x40,
WIRELESS_MODE_AC_24G = 0x80,
WIRELESS_MODE_AC_ONLY = 0x100,
WIRELESS_MODE_MAX = 0x800
};
enum ratr_table_mode {
RATR_INX_WIRELESS_NGB = 0,
RATR_INX_WIRELESS_NG = 1,
RATR_INX_WIRELESS_NB = 2,
RATR_INX_WIRELESS_N = 3,
RATR_INX_WIRELESS_GB = 4,
RATR_INX_WIRELESS_G = 5,
RATR_INX_WIRELESS_B = 6,
RATR_INX_WIRELESS_MC = 7,
RATR_INX_WIRELESS_AC_5N = 8,
RATR_INX_WIRELESS_AC_24N = 9,
};
enum rtl_link_state {
MAC80211_NOLINK = 0,
MAC80211_LINKING = 1,
MAC80211_LINKED = 2,
MAC80211_LINKED_SCANNING = 3,
};
enum act_category {
ACT_CAT_QOS = 1,
ACT_CAT_DLS = 2,
ACT_CAT_BA = 3,
ACT_CAT_HT = 7,
ACT_CAT_WMM = 17,
};
enum ba_action {
ACT_ADDBAREQ = 0,
ACT_ADDBARSP = 1,
ACT_DELBA = 2,
};
enum rt_polarity_ctl {
RT_POLARITY_LOW_ACT = 0,
RT_POLARITY_HIGH_ACT = 1,
};
/* After 8188E, we use V2 reason define. 88C/8723A use V1 reason. */
enum fw_wow_reason_v2 {
FW_WOW_V2_PTK_UPDATE_EVENT = 0x01,
FW_WOW_V2_GTK_UPDATE_EVENT = 0x02,
FW_WOW_V2_DISASSOC_EVENT = 0x04,
FW_WOW_V2_DEAUTH_EVENT = 0x08,
FW_WOW_V2_FW_DISCONNECT_EVENT = 0x10,
FW_WOW_V2_MAGIC_PKT_EVENT = 0x21,
FW_WOW_V2_UNICAST_PKT_EVENT = 0x22,
FW_WOW_V2_PATTERN_PKT_EVENT = 0x23,
FW_WOW_V2_RTD3_SSID_MATCH_EVENT = 0x24,
FW_WOW_V2_REALWOW_V2_WAKEUPPKT = 0x30,
FW_WOW_V2_REALWOW_V2_ACKLOST = 0x31,
FW_WOW_V2_REASON_MAX = 0xff,
};
enum wolpattern_type {
UNICAST_PATTERN = 0,
MULTICAST_PATTERN = 1,
BROADCAST_PATTERN = 2,
DONT_CARE_DA = 3,
UNKNOWN_TYPE = 4,
};
struct octet_string {
u8 *octet;
u16 length;
};
struct rtl_hdr_3addr {
__le16 frame_ctl;
__le16 duration_id;
u8 addr1[ETH_ALEN];
u8 addr2[ETH_ALEN];
u8 addr3[ETH_ALEN];
__le16 seq_ctl;
u8 payload[0];
} __packed;
struct rtl_info_element {
u8 id;
u8 len;
u8 data[0];
} __packed;
struct rtl_probe_rsp {
struct rtl_hdr_3addr header;
u32 time_stamp[2];
__le16 beacon_interval;
__le16 capability;
/*SSID, supported rates, FH params, DS params,
CF params, IBSS params, TIM (if beacon), RSN */
struct rtl_info_element info_element[0];
} __packed;
/*LED related.*/
/*ledpin Identify how to implement this SW led.*/
struct rtl_led {
void *hw;
enum rtl_led_pin ledpin;
bool ledon;
};
struct rtl_led_ctl {
bool led_opendrain;
struct rtl_led sw_led0;
struct rtl_led sw_led1;
};
struct rtl_qos_parameters {
__le16 cw_min;
__le16 cw_max;
u8 aifs;
u8 flag;
__le16 tx_op;
} __packed;
struct rt_smooth_data {
u32 elements[100]; /*array to store values */
u32 index; /*index to current array to store */
u32 total_num; /*num of valid elements */
u32 total_val; /*sum of valid elements */
};
struct rtl_ht_agg {
u16 txq_id;
u16 wait_for_ba;
u16 start_idx;
u64 bitmap;
u32 rate_n_flags;
u8 agg_state;
u8 rx_agg_state;
};
struct rtl_tid_data {
u16 seq_number;
struct rtl_ht_agg agg;
};
struct rssi_sta {
long undec_sm_pwdb;
};
struct rtl_sta_info {
struct list_head list;
u8 ratr_index;
u8 wireless_mode;
u8 mimo_ps;
u8 mac_addr[6];
struct rtl_tid_data tids[MAX_TID_COUNT];
/* just used for ap adhoc or mesh*/
struct rssi_sta rssi_stat;
} __packed;
#ifdef VIF_TODO
struct rtl_vif {
unsigned int id;
/* struct ieee80211_vif __rcu *vif; */
struct ieee80211_vif *vif;
};
struct rtl_vif_info {
struct list_head list;
bool active;
unsigned int id;
struct sk_buff *beacon;
bool enable_beacon;
};
struct vif_priv {
struct list_head vif_list;
/* interface mode settings */
unsigned long vif_bitmap;
unsigned int vifs;
struct rtl_vif vif[MAX_VIRTUAL_MAC];
/* beaconing */
spinlock_t beacon_lock;
unsigned int global_pretbtt;
unsigned int global_beacon_int;
/* struct rtl_vif_info __rcu *beacon_iter; */
struct rtl_vif_info *beacon_iter;
unsigned int beacon_enabled;
};
#endif
struct false_alarm_statistics {
u32 cnt_parity_fail;
u32 cnt_rate_illegal;
u32 cnt_crc8_fail;
u32 cnt_mcs_fail;
u32 cnt_fast_fsync_fail;
u32 cnt_sb_search_fail;
u32 cnt_ofdm_fail;
u32 cnt_cck_fail;
u32 cnt_all;
u32 cnt_ofdm_cca;
u32 cnt_cck_cca;
u32 cnt_cca_all;
u32 cnt_bw_usc;
u32 cnt_bw_lsc;
};
struct init_gain {
u8 xaagccore1;
u8 xbagccore1;
u8 xcagccore1;
u8 xdagccore1;
u8 cca;
};
struct wireless_stats {
unsigned long txbytesunicast;
unsigned long txbytesmulticast;
unsigned long txbytesbroadcast;
unsigned long rxbytesunicast;
long rx_snr_db[4];
/*Correct smoothed ss in Dbm, only used
in driver to report real power now. */
long recv_signal_power;
long signal_quality;
long last_sigstrength_inpercent;
u32 rssi_calculate_cnt;
u32 pwdb_all_cnt;
/*Transformed, in dbm. Beautified signal
strength for UI, not correct. */
long signal_strength;