1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Merged with mainline rtllib.h in Aug 2004. Original ieee802_11
4 * remains copyright by the original authors
5 *
6 * Portions of the merged code are based on Host AP (software wireless
7 * LAN access point) driver for Intersil Prism2/2.5/3.
8 *
9 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
10 * <jkmaline@cc.hut.fi>
11 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
12 *
13 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
14 * <jketreno@linux.intel.com>
15 * Copyright (c) 2004, Intel Corporation
16 *
17 * Modified for Realtek's wi-fi cards by Andrea Merello
18 * <andrea.merello@gmail.com>
19 */
20 #ifndef RTLLIB_H
21 #define RTLLIB_H
22 #include <linux/if_ether.h> /* ETH_ALEN */
23 #include <linux/kernel.h> /* ARRAY_SIZE */
24 #include <linux/module.h>
25 #include <linux/interrupt.h>
26 #include <linux/jiffies.h>
27 #include <linux/timer.h>
28 #include <linux/sched.h>
29 #include <linux/mutex.h>
30
31 #include <linux/delay.h>
32 #include <linux/wireless.h>
33
34 #include "rtl819x_HT.h"
35 #include "rtl819x_BA.h"
36 #include "rtl819x_TS.h"
37
38 #include <linux/netdevice.h>
39 #include <linux/if_arp.h> /* ARPHRD_ETHER */
40 #include <net/cfg80211.h>
41 #include <net/lib80211.h>
42
43 #define MAX_PRECMD_CNT 16
44 #define MAX_RFDEPENDCMD_CNT 16
45 #define MAX_POSTCMD_CNT 16
46
47 #ifndef WIRELESS_SPY
48 #define WIRELESS_SPY
49 #endif
50 #include <net/iw_handler.h>
51
52 #ifndef IW_MODE_MONITOR
53 #define IW_MODE_MONITOR 6
54 #endif
55
56 #ifndef IWEVCUSTOM
57 #define IWEVCUSTOM 0x8c02
58 #endif
59
60 #ifndef IW_CUSTOM_MAX
61 /* Max number of char in custom event - use multiple of them if needed */
62 #define IW_CUSTOM_MAX 256 /* In bytes */
63 #endif
64
65 #define container_of_dwork_rsl(x, y, z) \
66 container_of(to_delayed_work(x), y, z)
67
netdev_priv_rsl(struct net_device * dev)68 static inline void *netdev_priv_rsl(struct net_device *dev)
69 {
70 return netdev_priv(dev);
71 }
72
73 #define KEY_TYPE_NA 0x0
74 #define KEY_TYPE_WEP40 0x1
75 #define KEY_TYPE_TKIP 0x2
76 #define KEY_TYPE_CCMP 0x4
77 #define KEY_TYPE_WEP104 0x5
78 /* added for rtl819x tx procedure */
79 #define MAX_QUEUE_SIZE 0x10
80
81 #define BK_QUEUE 0
82 #define BE_QUEUE 1
83 #define VI_QUEUE 2
84 #define VO_QUEUE 3
85 #define HCCA_QUEUE 4
86 #define TXCMD_QUEUE 5
87 #define MGNT_QUEUE 6
88 #define HIGH_QUEUE 7
89 #define BEACON_QUEUE 8
90
91 #define IE_CISCO_FLAG_POSITION 0x08
92 #define SUPPORT_CKIP_MIC 0x08
93 #define SUPPORT_CKIP_PK 0x10
94 #define RT_RF_OFF_LEVL_HALT_NIC BIT(3)
95 #define RT_IN_PS_LEVEL(psc, _PS_FLAG) \
96 ((psc->cur_ps_level & _PS_FLAG) ? true : false)
97 #define RT_CLEAR_PS_LEVEL(psc, _PS_FLAG) \
98 (psc->cur_ps_level &= (~(_PS_FLAG)))
99
100 /* defined for skb cb field */
101 /* At most 28 byte */
102 struct cb_desc {
103 /* Tx Desc Related flags (8-9) */
104 u8 last_ini_pkt:1;
105 u8 cmd_or_init:1;
106 u8 tx_dis_rate_fallback:1;
107 u8 tx_use_drv_assinged_rate:1;
108 u8 hw_sec:1;
109
110 u8 stuck_count;
111
112 /* Tx Firmware Related flags (10-11)*/
113 u8 cts_enable:1;
114 u8 rts_enable:1;
115 u8 use_short_gi:1;
116 u8 use_short_preamble:1;
117 u8 tx_enable_fw_calc_dur:1;
118 u8 ampdu_enable:1;
119 u8 rtsstbc:1;
120 u8 RTSSC:1;
121
122 u8 rts_bw:1;
123 u8 packet_bw:1;
124 u8 rts_use_short_preamble:1;
125 u8 rts_use_short_gi:1;
126 u8 multicast:1;
127 u8 broadcast:1;
128 u8 drv_agg_enable:1;
129 u8 reserved2:1;
130
131 /* Tx Desc related element(12-19) */
132 u8 rata_index;
133 u8 queue_index;
134 u16 txbuf_size;
135 u8 ratr_index;
136 u8 bAMSDU:1;
137 u8 bFromAggrQ:1;
138 u8 reserved6:6;
139 u8 priority;
140
141 /* Tx firmware related element(20-27) */
142 u8 data_rate;
143 u8 rts_rate;
144 u8 ampdu_factor;
145 u8 ampdu_density;
146 u8 DrvAggrNum;
147 u8 bdhcp;
148 u16 pkt_size;
149 u8 bIsSpecialDataFrame;
150
151 u8 bBTTxPacket;
152 u8 bIsBTProbRsp;
153 };
154
155 enum sw_chnl_cmd_id {
156 cmd_id_end,
157 cmd_id_set_tx_power_level,
158 cmd_id_bbreg_write10,
159 cmd_id_write_port_ulong,
160 cmd_id_write_port_ushort,
161 cmd_id_write_port_uchar,
162 cmd_id_rf_write_reg,
163 };
164
165 struct sw_chnl_cmd {
166 enum sw_chnl_cmd_id cmd_id;
167 u32 para1;
168 u32 para2;
169 u32 ms_delay;
170 };
171
172 /*--------------------------Define -------------------------------------------*/
173 #define MGN_1M 0x02
174 #define MGN_2M 0x04
175 #define MGN_5_5M 0x0b
176 #define MGN_11M 0x16
177
178 #define MGN_6M 0x0c
179 #define MGN_9M 0x12
180 #define MGN_12M 0x18
181 #define MGN_18M 0x24
182 #define MGN_24M 0x30
183 #define MGN_36M 0x48
184 #define MGN_48M 0x60
185 #define MGN_54M 0x6c
186
187 #define MGN_MCS0 0x80
188 #define MGN_MCS1 0x81
189 #define MGN_MCS2 0x82
190 #define MGN_MCS3 0x83
191 #define MGN_MCS4 0x84
192 #define MGN_MCS5 0x85
193 #define MGN_MCS6 0x86
194 #define MGN_MCS7 0x87
195 #define MGN_MCS8 0x88
196 #define MGN_MCS9 0x89
197 #define MGN_MCS10 0x8a
198 #define MGN_MCS11 0x8b
199 #define MGN_MCS12 0x8c
200 #define MGN_MCS13 0x8d
201 #define MGN_MCS14 0x8e
202 #define MGN_MCS15 0x8f
203
204 enum hw_variables {
205 HW_VAR_ETHER_ADDR,
206 HW_VAR_MULTICAST_REG,
207 HW_VAR_BASIC_RATE,
208 HW_VAR_BSSID,
209 HW_VAR_MEDIA_STATUS,
210 HW_VAR_SECURITY_CONF,
211 HW_VAR_BEACON_INTERVAL,
212 HW_VAR_ATIM_WINDOW,
213 HW_VAR_LISTEN_INTERVAL,
214 HW_VAR_CS_COUNTER,
215 HW_VAR_DEFAULTKEY0,
216 HW_VAR_DEFAULTKEY1,
217 HW_VAR_DEFAULTKEY2,
218 HW_VAR_DEFAULTKEY3,
219 HW_VAR_SIFS,
220 HW_VAR_DIFS,
221 HW_VAR_EIFS,
222 HW_VAR_SLOT_TIME,
223 HW_VAR_ACK_PREAMBLE,
224 HW_VAR_CW_CONFIG,
225 HW_VAR_CW_VALUES,
226 HW_VAR_RATE_FALLBACK_CONTROL,
227 HW_VAR_CONTENTION_WINDOW,
228 HW_VAR_RETRY_COUNT,
229 HW_VAR_TR_SWITCH,
230 HW_VAR_COMMAND,
231 HW_VAR_WPA_CONFIG,
232 HW_VAR_AMPDU_MIN_SPACE,
233 HW_VAR_SHORTGI_DENSITY,
234 HW_VAR_AMPDU_FACTOR,
235 HW_VAR_MCS_RATE_AVAILABLE,
236 HW_VAR_AC_PARAM,
237 HW_VAR_ACM_CTRL,
238 HW_VAR_DIS_Req_Qsize,
239 HW_VAR_CCX_CHNL_LOAD,
240 HW_VAR_CCX_NOISE_HISTOGRAM,
241 HW_VAR_CCX_CLM_NHM,
242 HW_VAR_TxOPLimit,
243 HW_VAR_TURBO_MODE,
244 HW_VAR_RF_STATE,
245 HW_VAR_RF_OFF_BY_HW,
246 HW_VAR_BUS_SPEED,
247 HW_VAR_SET_DEV_POWER,
248
249 HW_VAR_RCR,
250 HW_VAR_RATR_0,
251 HW_VAR_RRSR,
252 HW_VAR_CPU_RST,
253 HW_VAR_CECHK_BSSID,
254 HW_VAR_LBK_MODE,
255 HW_VAR_AES_11N_FIX,
256 HW_VAR_USB_RX_AGGR,
257 HW_VAR_USER_CONTROL_TURBO_MODE,
258 HW_VAR_RETRY_LIMIT,
259 HW_VAR_INIT_TX_RATE,
260 HW_VAR_TX_RATE_REG,
261 HW_VAR_EFUSE_USAGE,
262 HW_VAR_EFUSE_BYTES,
263 HW_VAR_AUTOLOAD_STATUS,
264 HW_VAR_RF_2R_DISABLE,
265 HW_VAR_SET_RPWM,
266 HW_VAR_H2C_FW_PWRMODE,
267 HW_VAR_H2C_FW_JOINBSSRPT,
268 HW_VAR_1X1_RECV_COMBINE,
269 HW_VAR_STOP_SEND_BEACON,
270 HW_VAR_TSF_TIMER,
271 HW_VAR_IO_CMD,
272
273 HW_VAR_RF_RECOVERY,
274 HW_VAR_H2C_FW_UPDATE_GTK,
275 HW_VAR_WF_MASK,
276 HW_VAR_WF_CRC,
277 HW_VAR_WF_IS_MAC_ADDR,
278 HW_VAR_H2C_FW_OFFLOAD,
279 HW_VAR_RESET_WFCRC,
280
281 HW_VAR_HANDLE_FW_C2H,
282 HW_VAR_DL_FW_RSVD_PAGE,
283 HW_VAR_AID,
284 HW_VAR_HW_SEQ_ENABLE,
285 HW_VAR_CORRECT_TSF,
286 HW_VAR_BCN_VALID,
287 HW_VAR_FWLPS_RF_ON,
288 HW_VAR_DUAL_TSF_RST,
289 HW_VAR_SWITCH_EPHY_WoWLAN,
290 HW_VAR_INT_MIGRATION,
291 HW_VAR_INT_AC,
292 HW_VAR_RF_TIMING,
293 };
294
295 enum rt_op_mode {
296 RT_OP_MODE_AP,
297 RT_OP_MODE_INFRASTRUCTURE,
298 RT_OP_MODE_IBSS,
299 RT_OP_MODE_NO_LINK,
300 };
301
302 #define asifs_time \
303 ((priv->rtllib->current_network.mode == WIRELESS_MODE_N_24G) ? 16 : 10)
304
305 #define MGMT_QUEUE_NUM 5
306
307 #define MAX_IE_LEN 0xff
308
309 #define msleep_interruptible_rsl msleep_interruptible
310
311 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
312 * 6.2.1.1.2.
313 *
314 * The figure in section 7.1.2 suggests a body size of up to 2312
315 * bytes is allowed, which is a bit confusing, I suspect this
316 * represents the 2304 bytes of real data, plus a possible 8 bytes of
317 * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
318 */
319 #define RTLLIB_1ADDR_LEN 10
320 #define RTLLIB_2ADDR_LEN 16
321 #define RTLLIB_3ADDR_LEN 24
322 #define RTLLIB_4ADDR_LEN 30
323 #define RTLLIB_FCS_LEN 4
324
325 #define RTLLIB_SKBBUFFER_SIZE 2500
326
327 #define MIN_FRAG_THRESHOLD 256U
328 #define MAX_FRAG_THRESHOLD 2346U
329
330 #define RTLLIB_FTYPE_MGMT 0x0000
331 #define RTLLIB_FTYPE_CTL 0x0004
332 #define RTLLIB_FTYPE_DATA 0x0008
333
334 #define RTLLIB_SCTL_FRAG 0x000F
335 #define RTLLIB_SCTL_SEQ 0xFFF0
336
337 /* QOS control */
338 #define RTLLIB_QCTL_TID 0x000F
339
340 #define FC_QOS_BIT BIT(7)
341 #define is_data_frame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false)
342 #define is_legacy_data_frame(pdu) (is_data_frame(pdu) && (!(pdu[0] & FC_QOS_BIT)))
343 #define is_qos_data_frame(pframe) \
344 ((*(u16 *)pframe & (IEEE80211_STYPE_QOS_DATA | RTLLIB_FTYPE_DATA)) == \
345 (IEEE80211_STYPE_QOS_DATA | RTLLIB_FTYPE_DATA))
346 #define frame_order(pframe) (*(u16 *)pframe & IEEE80211_FCTL_ORDER)
347 #define SN_LESS(a, b) (((a - b) & 0x800) != 0)
348 #define SN_EQUAL(a, b) (a == b)
349 #define MAX_DEV_ADDR_SIZE 8
350
351 enum act_category {
352 ACT_CAT_QOS = 1,
353 ACT_CAT_DLS = 2,
354 ACT_CAT_BA = 3,
355 ACT_CAT_HT = 7,
356 ACT_CAT_WMM = 17,
357 };
358
359 enum ba_action {
360 ACT_ADDBAREQ = 0,
361 ACT_ADDBARSP = 1,
362 ACT_DELBA = 2,
363 };
364
365 enum init_gain_op_type {
366 IG_Backup = 0,
367 IG_Restore,
368 IG_Max
369 };
370
371 enum wireless_mode {
372 WIRELESS_MODE_UNKNOWN = 0x00,
373 WIRELESS_MODE_A = 0x01,
374 WIRELESS_MODE_B = 0x02,
375 WIRELESS_MODE_G = 0x04,
376 WIRELESS_MODE_AUTO = 0x08,
377 WIRELESS_MODE_N_24G = 0x10,
378 };
379
380 #ifndef ETH_P_PAE
381 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
382 #define ETH_P_IP 0x0800 /* Internet Protocol packet */
383 #define ETH_P_ARP 0x0806 /* Address Resolution packet */
384 #endif /* ETH_P_PAE */
385
386 #ifndef ETH_P_80211_RAW
387 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
388 #endif
389
390 /* IEEE 802.11 defines */
391
392 #define P80211_OUI_LEN 3
393
394 struct rtllib_snap_hdr {
395 u8 dsap; /* always 0xAA */
396 u8 ssap; /* always 0xAA */
397 u8 ctrl; /* always 0x03 */
398 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
399
400 } __packed;
401
402 enum _REG_PREAMBLE_MODE {
403 PREAMBLE_LONG = 1,
404 PREAMBLE_AUTO = 2,
405 PREAMBLE_SHORT = 3,
406 };
407
408 #define SNAP_SIZE sizeof(struct rtllib_snap_hdr)
409
410 #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
411 #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
412 #define WLAN_FC_MORE_DATA(fc) ((fc) & IEEE80211_FCTL_MOREDATA)
413
414 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG)
415 #define WLAN_GET_SEQ_SEQ(seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4)
416
417 #define RTLLIB_STATMASK_SIGNAL (1 << 0)
418 #define RTLLIB_STATMASK_RSSI (1 << 1)
419 #define RTLLIB_STATMASK_NOISE (1 << 2)
420 #define RTLLIB_STATMASK_WEMASK 0x7
421
422 #define RTLLIB_CCK_MODULATION (1 << 0)
423 #define RTLLIB_OFDM_MODULATION (1 << 1)
424
425 #define RTLLIB_CCK_RATE_LEN 4
426 #define RTLLIB_CCK_RATE_1MB 0x02
427 #define RTLLIB_CCK_RATE_2MB 0x04
428 #define RTLLIB_CCK_RATE_5MB 0x0B
429 #define RTLLIB_CCK_RATE_11MB 0x16
430 #define RTLLIB_OFDM_RATE_LEN 8
431 #define RTLLIB_OFDM_RATE_6MB 0x0C
432 #define RTLLIB_OFDM_RATE_9MB 0x12
433 #define RTLLIB_OFDM_RATE_12MB 0x18
434 #define RTLLIB_OFDM_RATE_18MB 0x24
435 #define RTLLIB_OFDM_RATE_24MB 0x30
436 #define RTLLIB_OFDM_RATE_36MB 0x48
437 #define RTLLIB_OFDM_RATE_48MB 0x60
438 #define RTLLIB_OFDM_RATE_54MB 0x6C
439 #define RTLLIB_BASIC_RATE_MASK 0x80
440
441 /* this is stolen and modified from the madwifi driver*/
442 #define RTLLIB_FC0_TYPE_MASK 0x0c
443 #define RTLLIB_FC0_TYPE_DATA 0x08
444 #define RTLLIB_FC0_SUBTYPE_MASK 0xB0
445 #define RTLLIB_FC0_SUBTYPE_QOS 0x80
446
447 #define RTLLIB_QOS_HAS_SEQ(fc) \
448 (((fc) & (RTLLIB_FC0_TYPE_MASK | RTLLIB_FC0_SUBTYPE_MASK)) == \
449 (RTLLIB_FC0_TYPE_DATA | RTLLIB_FC0_SUBTYPE_QOS))
450
451 /* this is stolen from ipw2200 driver */
452 #define IEEE_IBSS_MAC_HASH_SIZE 31
453
454 /* NOTE: This data is for statistical purposes; not all hardware provides this
455 * information for frames received. Not setting these will not cause
456 * any adverse affects.
457 */
458 struct rtllib_rx_stats {
459 s8 rssi;
460 u8 signal;
461 u8 noise;
462 u16 rate; /* in 100 kbps */
463 u8 control;
464 u8 mask;
465 u16 len;
466 u16 Length;
467 u8 signal_quality;
468 s32 RecvSignalPower;
469 u8 signal_strength;
470 u16 hw_error:1;
471 u16 bCRC:1;
472 u16 bICV:1;
473 u16 decrypted:1;
474 u32 time_stamp_low;
475 u32 time_stamp_high;
476
477 u8 rx_drv_info_size;
478 u8 rx_buf_shift;
479 bool bIsAMPDU;
480 bool bFirstMPDU;
481 bool contain_htc;
482 u32 RxPWDBAll;
483 u8 RxMIMOSignalStrength[2];
484 s8 RxMIMOSignalQuality[2];
485 bool bPacketMatchBSSID;
486 bool bIsCCK;
487 bool packet_to_self;
488 bool bPacketBeacon;
489 bool bToSelfBA;
490 };
491
492 /* IEEE 802.11 requires that STA supports concurrent reception of at least
493 * three fragmented frames. This define can be increased to support more
494 * concurrent frames, but it should be noted that each entry can consume about
495 * 2 kB of RAM and increasing cache size will slow down frame reassembly.
496 */
497 #define RTLLIB_FRAG_CACHE_LEN 4
498
499 struct rtllib_frag_entry {
500 unsigned long first_frag_time;
501 unsigned int seq;
502 unsigned int last_frag;
503 struct sk_buff *skb;
504 u8 src_addr[ETH_ALEN];
505 u8 dst_addr[ETH_ALEN];
506 };
507
508 struct rtllib_device;
509
510 #define SEC_ACTIVE_KEY (1 << 4)
511 #define SEC_AUTH_MODE (1 << 5)
512 #define SEC_UNICAST_GROUP (1 << 6)
513 #define SEC_LEVEL (1 << 7)
514 #define SEC_ENABLED (1 << 8)
515
516 #define SEC_LEVEL_0 0 /* None */
517 #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
518 #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
519 #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
520 #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
521
522 #define SEC_ALG_NONE 0
523 #define SEC_ALG_WEP 1
524 #define SEC_ALG_TKIP 2
525 #define SEC_ALG_CCMP 4
526
527 #define WEP_KEY_LEN 13
528 #define SCM_KEY_LEN 32
529
530 struct rtllib_security {
531 u16 active_key:2,
532 enabled:1,
533 auth_mode:2,
534 auth_algo:4,
535 unicast_uses_group:1,
536 encrypt:1;
537 u8 key_sizes[NUM_WEP_KEYS];
538 u8 keys[NUM_WEP_KEYS][SCM_KEY_LEN];
539 u8 level;
540 u16 flags;
541 } __packed;
542
543 /* 802.11 data frame from AP
544 * ,-------------------------------------------------------------------.
545 * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
546 * |------|------|---------|---------|---------|------|---------|------|
547 * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
548 * | | tion | (BSSID) | | | ence | data | |
549 * `-------------------------------------------------------------------'
550 * Total: 28-2340 bytes
551 */
552
553 /* Management Frame Information Element Types */
554 enum rtllib_mfie {
555 MFIE_TYPE_SSID = 0,
556 MFIE_TYPE_RATES = 1,
557 MFIE_TYPE_FH_SET = 2,
558 MFIE_TYPE_DS_SET = 3,
559 MFIE_TYPE_CF_SET = 4,
560 MFIE_TYPE_TIM = 5,
561 MFIE_TYPE_IBSS_SET = 6,
562 MFIE_TYPE_COUNTRY = 7,
563 MFIE_TYPE_HOP_PARAMS = 8,
564 MFIE_TYPE_HOP_TABLE = 9,
565 MFIE_TYPE_REQUEST = 10,
566 MFIE_TYPE_CHALLENGE = 16,
567 MFIE_TYPE_POWER_CONSTRAINT = 32,
568 MFIE_TYPE_POWER_CAPABILITY = 33,
569 MFIE_TYPE_TPC_REQUEST = 34,
570 MFIE_TYPE_TPC_REPORT = 35,
571 MFIE_TYPE_SUPP_CHANNELS = 36,
572 MFIE_TYPE_CSA = 37,
573 MFIE_TYPE_MEASURE_REQUEST = 38,
574 MFIE_TYPE_MEASURE_REPORT = 39,
575 MFIE_TYPE_QUIET = 40,
576 MFIE_TYPE_IBSS_DFS = 41,
577 MFIE_TYPE_ERP = 42,
578 MFIE_TYPE_HT_CAP = 45,
579 MFIE_TYPE_RSN = 48,
580 MFIE_TYPE_RATES_EX = 50,
581 MFIE_TYPE_HT_INFO = 61,
582 MFIE_TYPE_AIRONET = 133,
583 MFIE_TYPE_GENERIC = 221,
584 MFIE_TYPE_QOS_PARAMETER = 222,
585 };
586
587 /* Minimal header; can be used for passing 802.11 frames with sufficient
588 * information to determine what type of underlying data type is actually
589 * stored in the data.
590 */
591 struct rtllib_info_element {
592 u8 id;
593 u8 len;
594 u8 data[];
595 } __packed;
596
597 struct rtllib_authentication {
598 struct ieee80211_hdr_3addr header;
599 __le16 algorithm;
600 __le16 transaction;
601 __le16 status;
602 /*challenge*/
603 struct rtllib_info_element info_element[];
604 } __packed __aligned(2);
605
606 struct rtllib_disauth {
607 struct ieee80211_hdr_3addr header;
608 __le16 reason;
609 } __packed __aligned(2);
610
611 struct rtllib_disassoc {
612 struct ieee80211_hdr_3addr header;
613 __le16 reason;
614 } __packed __aligned(2);
615
616 struct rtllib_probe_request {
617 struct ieee80211_hdr_3addr header;
618 /* SSID, supported rates */
619 struct rtllib_info_element info_element[];
620 } __packed __aligned(2);
621
622 struct rtllib_probe_response {
623 struct ieee80211_hdr_3addr header;
624 u32 time_stamp[2];
625 __le16 beacon_interval;
626 __le16 capability;
627 /* SSID, supported rates, FH params, DS params,
628 * CF params, IBSS params, TIM (if beacon), RSN
629 */
630 struct rtllib_info_element info_element[];
631 } __packed __aligned(2);
632
633 /* Alias beacon for probe_response */
634 #define rtllib_beacon rtllib_probe_response
635
636 struct rtllib_assoc_request_frame {
637 struct ieee80211_hdr_3addr header;
638 __le16 capability;
639 __le16 listen_interval;
640 /* SSID, supported rates, RSN */
641 struct rtllib_info_element info_element[];
642 } __packed __aligned(2);
643
644 struct rtllib_assoc_response_frame {
645 struct ieee80211_hdr_3addr header;
646 __le16 capability;
647 __le16 status;
648 __le16 aid;
649 struct rtllib_info_element info_element[]; /* supported rates */
650 } __packed __aligned(2);
651
652 struct rtllib_txb {
653 u8 nr_frags;
654 u8 encrypted;
655 u8 queue_index;
656 u8 rts_included;
657 u16 reserved;
658 __le16 frag_size;
659 __le16 payload_size;
660 struct sk_buff *fragments[] __counted_by(nr_frags);
661 };
662
663 #define MAX_SUBFRAME_COUNT 64
664 struct rtllib_rxb {
665 u8 nr_subframes;
666 struct sk_buff *subframes[MAX_SUBFRAME_COUNT];
667 u8 dst[ETH_ALEN];
668 u8 src[ETH_ALEN];
669 };
670
671 union frameqos {
672 u16 shortdata;
673 u8 chardata[2];
674 struct {
675 u16 tid:4;
676 u16 eosp:1;
677 u16 ack_policy:2;
678 u16 reserved:1;
679 u16 txop:8;
680 } field;
681 };
682
683 /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
684 * only use 8, and then use extended rates for the remaining supported
685 * rates. Other APs, however, stick all of their supported rates on the
686 * main rates information element...
687 */
688 #define MAX_RATES_LENGTH ((u8)12)
689 #define MAX_RATES_EX_LENGTH ((u8)16)
690 #define MAX_NETWORK_COUNT 96
691
692 #define MAX_CHANNEL_NUMBER 161
693 #define RTLLIB_SOFTMAC_SCAN_TIME 100
694 #define RTLLIB_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
695
696 #define MAX_WPA_IE_LEN 64
697 #define MAX_WZC_IE_LEN 256
698
699 #define NETWORK_EMPTY_ESSID (1 << 0)
700 #define NETWORK_HAS_OFDM (1 << 1)
701 #define NETWORK_HAS_CCK (1 << 2)
702
703 /* QoS structure */
704 #define NETWORK_HAS_QOS_PARAMETERS (1 << 3)
705 #define NETWORK_HAS_QOS_INFORMATION (1 << 4)
706 #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
707 NETWORK_HAS_QOS_INFORMATION)
708 /* 802.11h */
709 #define NETWORK_HAS_ERP_VALUE (1 << 10)
710
711 #define QOS_QUEUE_NUM 4
712 #define QOS_OUI_LEN 3
713 #define QOS_OUI_TYPE 2
714 #define QOS_ELEMENT_ID 221
715 #define QOS_OUI_INFO_SUB_TYPE 0
716 #define QOS_OUI_PARAM_SUB_TYPE 1
717 #define QOS_VERSION_1 1
718
719 struct rtllib_qos_information_element {
720 u8 element_id;
721 u8 length;
722 u8 qui[QOS_OUI_LEN];
723 u8 qui_type;
724 u8 qui_subtype;
725 u8 version;
726 u8 ac_info;
727 } __packed;
728
729 struct rtllib_qos_ac_parameter {
730 u8 aci_aifsn;
731 u8 ecw_min_max;
732 __le16 tx_op_limit;
733 } __packed;
734
735 struct rtllib_qos_parameter_info {
736 struct rtllib_qos_information_element info_element;
737 u8 reserved;
738 struct rtllib_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
739 } __packed;
740
741 struct rtllib_qos_parameters {
742 __le16 cw_min[QOS_QUEUE_NUM];
743 __le16 cw_max[QOS_QUEUE_NUM];
744 u8 aifs[QOS_QUEUE_NUM];
745 u8 flag[QOS_QUEUE_NUM];
746 __le16 tx_op_limit[QOS_QUEUE_NUM];
747 } __packed;
748
749 struct rtllib_qos_data {
750 struct rtllib_qos_parameters parameters;
751 unsigned int wmm_acm;
752 int active;
753 int supported;
754 u8 param_count;
755 u8 old_param_count;
756 };
757
758 struct rtllib_tim_parameters {
759 u8 tim_count;
760 u8 tim_period;
761 } __packed;
762
763 struct rtllib_wmm_ac_param {
764 u8 ac_aci_acm_aifsn;
765 u8 ac_ecwmin_ecwmax;
766 u16 ac_txop_limit;
767 };
768
769 enum eap_type {
770 EAP_PACKET = 0,
771 EAPOL_START,
772 EAPOL_LOGOFF,
773 EAPOL_KEY,
774 EAPOL_ENCAP_ASF_ALERT
775 };
776
777 static const char * const eap_types[] = {
778 [EAP_PACKET] = "EAP-Packet",
779 [EAPOL_START] = "EAPOL-Start",
780 [EAPOL_LOGOFF] = "EAPOL-Logoff",
781 [EAPOL_KEY] = "EAPOL-Key",
782 [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
783 };
784
eap_get_type(int type)785 static inline const char *eap_get_type(int type)
786 {
787 return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" :
788 eap_types[type];
789 }
790
frame_qos_tid(u8 * buf)791 static inline u8 frame_qos_tid(u8 *buf)
792 {
793 struct ieee80211_hdr_3addr *hdr;
794 u16 fc;
795
796 hdr = (struct ieee80211_hdr_3addr *)buf;
797 fc = le16_to_cpu(hdr->frame_control);
798 return (u8)((union frameqos *)(buf + (((fc & IEEE80211_FCTL_TODS) &&
799 (fc & IEEE80211_FCTL_FROMDS)) ? 30 : 24)))->field.tid;
800 }
801
802 struct eapol {
803 u8 snap[6];
804 u16 ethertype;
805 u8 version;
806 u8 type;
807 u16 length;
808 } __packed;
809
810 struct rtllib_softmac_stats {
811 unsigned int rx_ass_ok;
812 unsigned int rx_ass_err;
813 unsigned int rx_probe_rq;
814 unsigned int tx_probe_rs;
815 unsigned int tx_beacons;
816 unsigned int rx_auth_rq;
817 unsigned int rx_auth_rs_ok;
818 unsigned int rx_auth_rs_err;
819 unsigned int tx_auth_rq;
820 unsigned int no_auth_rs;
821 unsigned int no_ass_rs;
822 unsigned int tx_ass_rq;
823 unsigned int rx_ass_rq;
824 unsigned int tx_probe_rq;
825 unsigned int reassoc;
826 unsigned int swtxstop;
827 unsigned int swtxawake;
828 unsigned char CurrentShowTxate;
829 unsigned char last_packet_rate;
830 unsigned int txretrycount;
831 };
832
833 /* These are the data types that can make up management packets
834 *
835 * u16 auth_algorithm;
836 * u16 auth_sequence;
837 * u16 beacon_interval;
838 * u16 capability;
839 * u8 current_ap[ETH_ALEN];
840 * u16 listen_interval;
841 * struct {
842 * u16 association_id:14, reserved:2;
843 * } __packed;
844 * u32 time_stamp[2];
845 * u16 reason;
846 * u16 status;
847 */
848
849 #define RTLLIB_DEFAULT_TX_ESSID "Penguin"
850 #define RTLLIB_DEFAULT_BASIC_RATE 2
851
852 enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
853 #define MAX_SP_Len (WMM_all_frame << 4)
854 #define RTLLIB_QOS_TID 0x0f
855 #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
856
857 #define RTLLIB_DTIM_MBCAST 4
858 #define RTLLIB_DTIM_UCAST 2
859 #define RTLLIB_DTIM_VALID 1
860 #define RTLLIB_DTIM_INVALID 0
861
862 #define RTLLIB_PS_DISABLED 0
863 #define RTLLIB_PS_UNICAST RTLLIB_DTIM_UCAST
864 #define RTLLIB_PS_MBCAST RTLLIB_DTIM_MBCAST
865
866 #define WME_AC_BK 0x00
867 #define WME_AC_BE 0x01
868 #define WME_AC_VI 0x02
869 #define WME_AC_VO 0x03
870 #define WME_AC_PRAM_LEN 16
871
872 #define MAX_RECEIVE_BUFFER_SIZE 9100
873
874 #define UP2AC(up) ( \
875 ((up) < 1) ? WME_AC_BE : \
876 ((up) < 3) ? WME_AC_BK : \
877 ((up) < 4) ? WME_AC_BE : \
878 ((up) < 6) ? WME_AC_VI : \
879 WME_AC_VO)
880
881 #define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address
882 * plus ether type
883 */
884
885 enum erp_t {
886 ERP_NonERPpresent = 0x01,
887 ERP_UseProtection = 0x02,
888 ERP_BarkerPreambleMode = 0x04,
889 };
890
891 struct rtllib_network {
892 /* These entries are used to identify a unique network */
893 u8 bssid[ETH_ALEN];
894 u8 channel;
895 /* Ensure null-terminated for any debug msgs */
896 u8 ssid[IW_ESSID_MAX_SIZE + 1];
897 u8 ssid_len;
898 u8 hidden_ssid[IW_ESSID_MAX_SIZE + 1];
899 u8 hidden_ssid_len;
900 struct rtllib_qos_data qos_data;
901
902 bool with_aironet_ie;
903 bool ckip_supported;
904 bool ccx_rm_enable;
905 u8 ccx_rm_state[2];
906 bool mb_ssid_valid;
907 u8 mb_ssid_mask;
908 u8 mb_ssid[ETH_ALEN];
909 bool with_ccx_ver_num;
910 u8 bss_ccx_ver_number;
911 /* These are network statistics */
912 struct rtllib_rx_stats stats;
913 u16 capability;
914 u8 rates[MAX_RATES_LENGTH];
915 u8 rates_len;
916 u8 rates_ex[MAX_RATES_EX_LENGTH];
917 u8 rates_ex_len;
918 unsigned long last_scanned;
919 u8 mode;
920 u32 flags;
921 u32 time_stamp[2];
922 u16 beacon_interval;
923 u16 listen_interval;
924 u16 atim_window;
925 u8 erp_value;
926 u8 wpa_ie[MAX_WPA_IE_LEN];
927 size_t wpa_ie_len;
928 u8 rsn_ie[MAX_WPA_IE_LEN];
929 size_t rsn_ie_len;
930 u8 wzc_ie[MAX_WZC_IE_LEN];
931 size_t wzc_ie_len;
932
933 struct rtllib_tim_parameters tim;
934 u8 dtim_period;
935 u8 dtim_data;
936 u64 last_dtim_sta_time;
937
938 u8 wmm_info;
939 struct rtllib_wmm_ac_param wmm_param[4];
940 u8 turbo_enable;
941 u16 country_ie_len;
942 u8 country_ie_buf[MAX_IE_LEN];
943 struct bss_ht bssht;
944 bool broadcom_cap_exist;
945 bool realtek_cap_exit;
946 bool marvell_cap_exist;
947 bool ralink_cap_exist;
948 bool atheros_cap_exist;
949 bool cisco_cap_exist;
950 bool airgo_cap_exist;
951 bool unknown_cap_exist;
952 bool berp_info_valid;
953 bool buseprotection;
954 u8 signal_strength;
955 u8 RSSI;
956 struct list_head list;
957 };
958
959 enum rtl_link_state {
960 /* the card is not linked at all */
961 MAC80211_NOLINK = 0,
962
963 /* RTLLIB_ASSOCIATING* are for BSS client mode
964 * the driver shall not perform RX filtering unless
965 * the state is LINKED.
966 * The driver shall just check for the state LINKED and
967 * defaults to NOLINK for ALL the other states (including
968 * LINKED_SCANNING)
969 */
970
971 /* the association procedure will start (wq scheduling)*/
972 RTLLIB_ASSOCIATING,
973 RTLLIB_ASSOCIATING_RETRY,
974
975 /* the association procedure is sending AUTH request*/
976 RTLLIB_ASSOCIATING_AUTHENTICATING,
977
978 /* the association procedure has successfully authenticated
979 * and is sending association request
980 */
981 RTLLIB_ASSOCIATING_AUTHENTICATED,
982
983 /* the link is ok. the card associated to a BSS or linked
984 * to a ibss cell or acting as an AP and creating the bss
985 */
986 MAC80211_LINKED,
987
988 /* same as LINKED, but the driver shall apply RX filter
989 * rules as we are in NO_LINK mode. As the card is still
990 * logically linked, but it is doing a syncro site survey
991 * then it will be back to LINKED state.
992 */
993 MAC80211_LINKED_SCANNING,
994 };
995
996 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
997 #define DEFAULT_FTS 2346
998
999 #define CFG_RTLLIB_RESERVE_FCS (1 << 0)
1000 #define CFG_RTLLIB_COMPUTE_FCS (1 << 1)
1001
1002 struct tx_pending {
1003 int frag;
1004 struct rtllib_txb *txb;
1005 };
1006
1007 struct bandwidth_autoswitch {
1008 long threshold_20Mhzto40Mhz;
1009 long threshold_40Mhzto20Mhz;
1010 bool forced_tx_20MHz;
1011 bool bautoswitch_enable;
1012 };
1013
1014 #define REORDER_WIN_SIZE 128
1015 #define REORDER_ENTRY_NUM 128
1016 struct rx_reorder_entry {
1017 struct list_head list;
1018 u16 seq_num;
1019 struct rtllib_rxb *prxb;
1020 };
1021
1022 enum fsync_state {
1023 DEFAULT_FSYNC,
1024 HW_FSYNC,
1025 SW_FSYNC
1026 };
1027
1028 enum ips_callback_function {
1029 IPS_CALLBACK_NONE = 0,
1030 IPS_CALLBACK_MGNT_LINK_REQUEST = 1,
1031 IPS_CALLBACK_JOIN_REQUEST = 2,
1032 };
1033
1034 enum rt_rf_power_state {
1035 rf_on,
1036 rf_sleep,
1037 rf_off
1038 };
1039
1040 struct rt_pwr_save_ctrl {
1041 bool bSwRfProcessing;
1042 enum rt_rf_power_state eInactivePowerState;
1043 enum ips_callback_function return_point;
1044
1045 bool bLeisurePs;
1046 u8 lps_idle_count;
1047 u8 lps_awake_intvl;
1048
1049 u32 cur_ps_level;
1050 };
1051
1052 #define RT_RF_CHANGE_SOURCE u32
1053
1054 #define RF_CHANGE_BY_SW BIT(31)
1055 #define RF_CHANGE_BY_HW BIT(30)
1056 #define RF_CHANGE_BY_PS BIT(29)
1057 #define RF_CHANGE_BY_IPS BIT(28)
1058 #define RF_CHANGE_BY_INIT 0
1059
1060 enum country_code_type {
1061 COUNTRY_CODE_FCC = 0,
1062 COUNTRY_CODE_IC = 1,
1063 COUNTRY_CODE_ETSI = 2,
1064 COUNTRY_CODE_SPAIN = 3,
1065 COUNTRY_CODE_FRANCE = 4,
1066 COUNTRY_CODE_MKK = 5,
1067 COUNTRY_CODE_MKK1 = 6,
1068 COUNTRY_CODE_ISRAEL = 7,
1069 COUNTRY_CODE_TELEC = 8,
1070 COUNTRY_CODE_MIC = 9,
1071 COUNTRY_CODE_GLOBAL_DOMAIN = 10,
1072 COUNTRY_CODE_WORLD_WIDE_13 = 11,
1073 COUNTRY_CODE_TELEC_NETGEAR = 12,
1074 COUNTRY_CODE_MAX
1075 };
1076
1077 enum scan_op_backup_opt {
1078 SCAN_OPT_BACKUP = 0,
1079 SCAN_OPT_RESTORE,
1080 SCAN_OPT_MAX
1081 };
1082
1083 #define RT_MAX_LD_SLOT_NUM 10
1084 struct rt_link_detect {
1085 u32 num_recv_bcn_in_period;
1086 u32 num_recv_data_in_period;
1087
1088 u32 RxBcnNum[RT_MAX_LD_SLOT_NUM];
1089 u32 RxDataNum[RT_MAX_LD_SLOT_NUM];
1090 u16 slot_num;
1091 u16 slot_index;
1092
1093 u32 num_tx_ok_in_period;
1094 u32 num_rx_ok_in_period;
1095 u32 num_rx_unicast_ok_in_period;
1096 bool busy_traffic;
1097 bool bHigherBusyTraffic;
1098 bool bHigherBusyRxTraffic;
1099 };
1100
1101 struct sw_cam_table {
1102 u8 macaddr[ETH_ALEN];
1103 bool bused;
1104 u8 key_buf[16];
1105 u16 key_type;
1106 u8 useDK;
1107 u8 key_index;
1108
1109 };
1110
1111 #define TOTAL_CAM_ENTRY 32
1112 struct rate_adaptive {
1113 u8 ratr_state;
1114 u16 reserve;
1115
1116 u32 high_rssi_thresh_for_ra;
1117 u32 high2low_rssi_thresh_for_ra;
1118 u8 low2high_rssi_thresh_for_ra40M;
1119 u32 low_rssi_thresh_for_ra40M;
1120 u8 low2high_rssi_thresh_for_ra20M;
1121 u32 low_rssi_thresh_for_ra20M;
1122 u32 upper_rssi_threshold_ratr;
1123 u32 middle_rssi_threshold_ratr;
1124 u32 low_rssi_threshold_ratr;
1125 u32 low_rssi_threshold_ratr_40M;
1126 u32 low_rssi_threshold_ratr_20M;
1127 u8 ping_rssi_enable;
1128 u32 ping_rssi_ratr;
1129 u32 ping_rssi_thresh_for_ra;
1130 u8 PreRATRState;
1131
1132 };
1133
1134 #define NUM_PMKID_CACHE 16
1135 struct rt_pmkid_list {
1136 u8 bssid[ETH_ALEN];
1137 u8 PMKID[16];
1138 u8 SsidBuf[33];
1139 u8 used;
1140 };
1141
1142 /*************** DRIVER STATUS *****/
1143 #define STATUS_SCANNING 0
1144 /*************** DRIVER STATUS *****/
1145
1146 enum {
1147 LPS_IS_WAKE = 0,
1148 LPS_IS_SLEEP = 1,
1149 LPS_WAIT_NULL_DATA_SEND = 2,
1150 };
1151
1152 struct rtllib_device {
1153 struct pci_dev *pdev;
1154 struct net_device *dev;
1155 struct rtllib_security sec;
1156
1157 bool disable_mgnt_queue;
1158
1159 unsigned long status;
1160 u8 cnt_after_link;
1161
1162 enum rt_op_mode op_mode;
1163
1164 /* The last AssocReq/Resp IEs */
1165 u8 *assocreq_ies, *assocresp_ies;
1166 size_t assocreq_ies_len, assocresp_ies_len;
1167
1168 bool forced_bg_mode;
1169
1170 u8 hwsec_active;
1171 bool is_roaming;
1172 bool ieee_up;
1173 bool cannot_notify;
1174 bool bSupportRemoteWakeUp;
1175 bool actscanning;
1176 bool first_ie_in_scan;
1177 bool be_scan_inprogress;
1178 bool beinretry;
1179 enum rt_rf_power_state rf_power_state;
1180 RT_RF_CHANGE_SOURCE rf_off_reason;
1181 bool is_set_key;
1182 bool wx_set_enc;
1183 struct rt_hi_throughput *ht_info;
1184
1185 spinlock_t reorder_spinlock;
1186 u8 reg_dot11ht_oper_rate_set[16];
1187 u8 reg_dot11tx_ht_oper_rate_set[16];
1188 u8 dot11ht_oper_rate_set[16];
1189 u8 reg_ht_supp_rate_set[16];
1190 u8 ht_curr_op_rate;
1191 u8 HTHighestOperaRate;
1192 u8 tx_dis_rate_fallback;
1193 u8 tx_use_drv_assinged_rate;
1194 u8 tx_enable_fw_calc_dur;
1195 atomic_t atm_swbw;
1196
1197 struct list_head Tx_TS_Admit_List;
1198 struct list_head Tx_TS_Pending_List;
1199 struct list_head Tx_TS_Unused_List;
1200 struct tx_ts_record tx_ts_records[TOTAL_TS_NUM];
1201 struct list_head Rx_TS_Admit_List;
1202 struct list_head Rx_TS_Pending_List;
1203 struct list_head Rx_TS_Unused_List;
1204 struct rx_ts_record rx_ts_records[TOTAL_TS_NUM];
1205 struct rx_reorder_entry RxReorderEntry[128];
1206 struct list_head RxReorder_Unused_List;
1207
1208 /* Bookkeeping structures */
1209 struct net_device_stats stats;
1210 struct rtllib_softmac_stats softmac_stats;
1211
1212 /* Probe / Beacon management */
1213 struct list_head network_free_list;
1214 struct list_head network_list;
1215 struct rtllib_network *networks;
1216 int scans;
1217 int scan_age;
1218
1219 int iw_mode; /* operating mode (IW_MODE_*) */
1220
1221 spinlock_t lock;
1222 spinlock_t wpax_suitlist_lock;
1223
1224 int tx_headroom; /* Set to size of any additional room needed at front
1225 * of allocated Tx SKBs
1226 */
1227 u32 config;
1228
1229 /* WEP and other encryption related settings at the device level */
1230 int open_wep; /* Set to 1 to allow unencrypted frames */
1231 int auth_mode;
1232 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
1233 * WEP key changes
1234 */
1235
1236 int ieee802_1x; /* is IEEE 802.1X used */
1237
1238 /* WPA data */
1239 bool half_wireless_n24g_mode;
1240 int wpa_enabled;
1241 int drop_unencrypted;
1242 int tkip_countermeasures;
1243 int privacy_invoked;
1244 size_t wpa_ie_len;
1245 u8 *wpa_ie;
1246 size_t wps_ie_len;
1247 u8 *wps_ie;
1248 u8 ap_mac_addr[ETH_ALEN];
1249 u16 pairwise_key_type;
1250 u16 group_key_type;
1251
1252 struct lib80211_crypt_info crypt_info;
1253
1254 struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY];
1255
1256 struct rt_pmkid_list pmkid_list[NUM_PMKID_CACHE];
1257
1258 /* Fragmentation structures */
1259 struct rtllib_frag_entry frag_cache[17][RTLLIB_FRAG_CACHE_LEN];
1260 unsigned int frag_next_idx[17];
1261 u16 fts; /* Fragmentation Threshold */
1262 #define DEFAULT_RTS_THRESHOLD 2346U
1263 #define MIN_RTS_THRESHOLD 1
1264 #define MAX_RTS_THRESHOLD 2346U
1265 u16 rts; /* RTS threshold */
1266
1267 /* Association info */
1268 u8 bssid[ETH_ALEN];
1269
1270 /* This stores infos for the current network.
1271 * Either the network we are associated in INFRASTRUCTURE
1272 * or the network that we are creating in MASTER mode.
1273 * ad-hoc is a mixture ;-).
1274 * Note that in infrastructure mode, even when not associated,
1275 * fields bssid and essid may be valid (if wpa_set and essid_set
1276 * are true) as thy carry the value set by the user via iwconfig
1277 */
1278 struct rtllib_network current_network;
1279
1280 enum rtl_link_state link_state;
1281
1282 int mode; /* A, B, G */
1283
1284 /* used for forcing the ibss workqueue to terminate
1285 * without wait for the syncro scan to terminate
1286 */
1287 short sync_scan_hurryup;
1288 u16 scan_watch_dog;
1289
1290 /* map of allowed channels. 0 is dummy */
1291 u8 active_channel_map[MAX_CHANNEL_NUMBER + 1];
1292
1293 int rate; /* current rate */
1294 int basic_rate;
1295
1296 /* this contains flags for selectively enable softmac support */
1297 u16 softmac_features;
1298
1299 /* if the sequence control field is not filled by HW */
1300 u16 seq_ctrl[5];
1301
1302 /* association procedure transaction sequence number */
1303 u16 associate_seq;
1304
1305 /* AID for RTXed association responses */
1306 u16 assoc_id;
1307
1308 /* power save mode related*/
1309 u8 ack_tx_to_ieee;
1310 short ps;
1311 short sta_sleep;
1312 int ps_timeout;
1313 int ps_period;
1314 struct work_struct ps_task;
1315 u64 ps_time;
1316 bool polling;
1317
1318 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
1319 short queue_stop;
1320 short scanning_continue;
1321 short proto_started;
1322 short proto_stoppping;
1323
1324 struct mutex wx_mutex;
1325 struct mutex scan_mutex;
1326 struct mutex ips_mutex;
1327
1328 spinlock_t mgmt_tx_lock;
1329 spinlock_t beacon_lock;
1330
1331 short beacon_txing;
1332
1333 short wap_set;
1334 short ssid_set;
1335
1336 /* set on initialization */
1337 unsigned int wmm_acm;
1338
1339 /* for discarding duplicated packets in IBSS */
1340 struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
1341
1342 /* for discarding duplicated packets in BSS */
1343 u16 last_rxseq_num[17]; /* rx seq previous per-tid */
1344 u16 last_rxfrag_num[17];/* tx frag previous per-tid */
1345 unsigned long last_packet_time[17];
1346
1347 /* for PS mode */
1348 unsigned long last_rx_ps_time;
1349 bool awake_pkt_sent;
1350 u8 lps_delay_cnt;
1351
1352 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
1353 struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
1354 int mgmt_queue_head;
1355 int mgmt_queue_tail;
1356 u8 asoc_retry_count;
1357 struct sk_buff_head skb_waitq[MAX_QUEUE_SIZE];
1358
1359 bool bdynamic_txpower_enable;
1360
1361 bool bCTSToSelfEnable;
1362
1363 u32 fsync_time_interval;
1364 u32 fsync_rate_bitmap;
1365 u8 fsync_rssi_threshold;
1366 bool bfsync_enable;
1367
1368 u8 fsync_multiple_timeinterval;
1369 u32 fsync_firstdiff_ratethreshold;
1370 u32 fsync_seconddiff_ratethreshold;
1371 enum fsync_state fsync_state;
1372 bool bis_any_nonbepkts;
1373 struct bandwidth_autoswitch bandwidth_auto_switch;
1374 bool FwRWRF;
1375
1376 struct rt_link_detect link_detect_info;
1377 bool is_aggregate_frame;
1378 struct rt_pwr_save_ctrl pwr_save_ctrl;
1379
1380 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
1381 struct tx_pending tx_pending;
1382
1383 /* used if IEEE_SOFTMAC_ASSOCIATE is set */
1384 struct timer_list associate_timer;
1385
1386 /* used if IEEE_SOFTMAC_BEACONS is set */
1387 u8 need_sw_enc;
1388 struct work_struct associate_complete_wq;
1389 struct work_struct ips_leave_wq;
1390 struct delayed_work associate_procedure_wq;
1391 struct delayed_work softmac_scan_wq;
1392 struct delayed_work associate_retry_wq;
1393 struct delayed_work hw_wakeup_wq;
1394 struct delayed_work hw_sleep_wq;
1395 struct delayed_work link_change_wq;
1396 struct work_struct wx_sync_scan_wq;
1397
1398 union {
1399 struct rtllib_rxb *rfd_array[REORDER_WIN_SIZE];
1400 struct rtllib_rxb *stats_IndicateArray[REORDER_WIN_SIZE];
1401 struct rtllib_rxb *prxb_indicate_array[REORDER_WIN_SIZE];
1402 struct {
1403 struct sw_chnl_cmd PreCommonCmd[MAX_PRECMD_CNT];
1404 struct sw_chnl_cmd PostCommonCmd[MAX_POSTCMD_CNT];
1405 struct sw_chnl_cmd RfDependCmd[MAX_RFDEPENDCMD_CNT];
1406 };
1407 };
1408
1409 /* Callback functions */
1410
1411 /* Softmac-generated frames (management) are TXed via this
1412 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
1413 * not set. As some cards may have different HW queues that
1414 * one might want to use for data and management frames
1415 * the option to have two callbacks might be useful.
1416 * This function can't sleep.
1417 */
1418 int (*softmac_hard_start_xmit)(struct sk_buff *skb,
1419 struct net_device *dev);
1420
1421 /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
1422 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
1423 * frames. If the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
1424 * then also management frames are sent via this callback.
1425 * This function can't sleep.
1426 */
1427 void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
1428 struct net_device *dev, int rate);
1429
1430 /* ask to the driver to retune the radio.
1431 * This function can sleep. the driver should ensure
1432 * the radio has been switched before return.
1433 */
1434 void (*set_chan)(struct net_device *dev, u8 ch);
1435
1436 /* indicate the driver that the link state is changed
1437 * for example it may indicate the card is associated now.
1438 * Driver might be interested in this to apply RX filter
1439 * rules or simply light the LINK led
1440 */
1441 void (*link_change)(struct net_device *dev);
1442
1443 /* power save mode related */
1444 void (*sta_wake_up)(struct net_device *dev);
1445 void (*enter_sleep_state)(struct net_device *dev, u64 time);
1446 short (*ps_is_queue_empty)(struct net_device *dev);
1447 int (*handle_beacon)(struct net_device *dev,
1448 struct rtllib_beacon *beacon,
1449 struct rtllib_network *network);
1450 int (*handle_assoc_response)(struct net_device *dev,
1451 struct rtllib_assoc_response_frame *resp,
1452 struct rtllib_network *network);
1453
1454 /* check whether Tx hw resource available */
1455 short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
1456 void (*set_bw_mode_handler)(struct net_device *dev,
1457 enum ht_channel_width bandwidth,
1458 enum ht_extchnl_offset Offset);
1459 bool (*get_nmode_support_by_sec_cfg)(struct net_device *dev);
1460 void (*set_wireless_mode)(struct net_device *dev, u8 wireless_mode);
1461 bool (*get_half_nmode_support_by_aps_handler)(struct net_device *dev);
1462 u8 (*rtllib_ap_sec_type)(struct rtllib_device *ieee);
1463 void (*init_gain_handler)(struct net_device *dev, u8 operation);
1464 void (*scan_operation_backup_handler)(struct net_device *dev,
1465 u8 operation);
1466 void (*set_hw_reg_handler)(struct net_device *dev, u8 variable, u8 *val);
1467
1468 void (*allow_all_dest_addr_handler)(struct net_device *dev,
1469 bool allow_all_da,
1470 bool write_into_reg);
1471
1472 void (*rtllib_ips_leave_wq)(struct net_device *dev);
1473 void (*rtllib_ips_leave)(struct net_device *dev);
1474 void (*leisure_ps_leave)(struct net_device *dev);
1475
1476 /* This must be the last item so that it points to the data
1477 * allocated beyond this structure by alloc_rtllib
1478 */
1479 u8 priv[];
1480 };
1481
1482 #define IEEE_MODE_MASK (WIRELESS_MODE_B | WIRELESS_MODE_G)
1483
1484 /* Generate a 802.11 header */
1485
1486 /* Uses the channel change callback directly
1487 * instead of [start/stop] scan callbacks
1488 */
1489 #define IEEE_SOFTMAC_SCAN (1 << 2)
1490
1491 /* Perform authentication and association handshake */
1492 #define IEEE_SOFTMAC_ASSOCIATE (1 << 3)
1493
1494 /* Generate probe requests */
1495 #define IEEE_SOFTMAC_PROBERQ (1 << 4)
1496
1497 /* Generate response to probe requests */
1498 #define IEEE_SOFTMAC_PROBERS (1 << 5)
1499
1500 /* The ieee802.11 stack will manage the netif queue
1501 * wake/stop for the driver, taking care of 802.11
1502 * fragmentation. See softmac.c for details.
1503 */
1504 #define IEEE_SOFTMAC_TX_QUEUE (1 << 7)
1505
1506 /* Uses only the softmac_data_hard_start_xmit
1507 * even for TX management frames.
1508 */
1509 #define IEEE_SOFTMAC_SINGLE_QUEUE (1 << 8)
1510
1511 /* Generate beacons. The stack will enqueue beacons
1512 * to the card
1513 */
1514 #define IEEE_SOFTMAC_BEACONS (1 << 6)
1515
rtllib_priv(struct net_device * dev)1516 static inline void *rtllib_priv(struct net_device *dev)
1517 {
1518 return ((struct rtllib_device *)netdev_priv(dev))->priv;
1519 }
1520
rtllib_is_empty_essid(const char * essid,int essid_len)1521 static inline int rtllib_is_empty_essid(const char *essid, int essid_len)
1522 {
1523 /* Single white space is for Linksys APs */
1524 if (essid_len == 1 && essid[0] == ' ')
1525 return 1;
1526
1527 /* Otherwise, if the entire essid is 0, we assume it is hidden */
1528 while (essid_len) {
1529 essid_len--;
1530 if (essid[essid_len] != '\0')
1531 return 0;
1532 }
1533
1534 return 1;
1535 }
1536
rtllib_get_hdrlen(u16 fc)1537 static inline int rtllib_get_hdrlen(u16 fc)
1538 {
1539 int hdrlen = RTLLIB_3ADDR_LEN;
1540
1541 switch (WLAN_FC_GET_TYPE(fc)) {
1542 case RTLLIB_FTYPE_DATA:
1543 if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
1544 hdrlen = RTLLIB_4ADDR_LEN; /* Addr4 */
1545 if (RTLLIB_QOS_HAS_SEQ(fc))
1546 hdrlen += 2; /* QOS ctrl*/
1547 break;
1548 case RTLLIB_FTYPE_CTL:
1549 switch (WLAN_FC_GET_STYPE(fc)) {
1550 case IEEE80211_STYPE_CTS:
1551 case IEEE80211_STYPE_ACK:
1552 hdrlen = RTLLIB_1ADDR_LEN;
1553 break;
1554 default:
1555 hdrlen = RTLLIB_2ADDR_LEN;
1556 break;
1557 }
1558 break;
1559 }
1560
1561 return hdrlen;
1562 }
1563
rtllib_is_ofdm_rate(u8 rate)1564 static inline int rtllib_is_ofdm_rate(u8 rate)
1565 {
1566 switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
1567 case RTLLIB_OFDM_RATE_6MB:
1568 case RTLLIB_OFDM_RATE_9MB:
1569 case RTLLIB_OFDM_RATE_12MB:
1570 case RTLLIB_OFDM_RATE_18MB:
1571 case RTLLIB_OFDM_RATE_24MB:
1572 case RTLLIB_OFDM_RATE_36MB:
1573 case RTLLIB_OFDM_RATE_48MB:
1574 case RTLLIB_OFDM_RATE_54MB:
1575 return 1;
1576 }
1577 return 0;
1578 }
1579
rtllib_is_cck_rate(u8 rate)1580 static inline int rtllib_is_cck_rate(u8 rate)
1581 {
1582 switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
1583 case RTLLIB_CCK_RATE_1MB:
1584 case RTLLIB_CCK_RATE_2MB:
1585 case RTLLIB_CCK_RATE_5MB:
1586 case RTLLIB_CCK_RATE_11MB:
1587 return 1;
1588 }
1589 return 0;
1590 }
1591
1592 /* rtllib.c */
1593 void free_rtllib(struct net_device *dev);
1594 struct net_device *alloc_rtllib(int sizeof_priv);
1595
1596 /* rtllib_tx.c */
1597
1598 int rtllib_encrypt_fragment(struct rtllib_device *ieee,
1599 struct sk_buff *frag,
1600 int hdr_len);
1601
1602 netdev_tx_t rtllib_xmit(struct sk_buff *skb, struct net_device *dev);
1603 void rtllib_txb_free(struct rtllib_txb *txb);
1604
1605 /* rtllib_rx.c */
1606 int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
1607 struct rtllib_rx_stats *rx_stats);
1608 int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel);
1609
1610 /* rtllib_wx.c */
1611 int rtllib_wx_get_scan(struct rtllib_device *ieee,
1612 struct iw_request_info *info,
1613 union iwreq_data *wrqu, char *key);
1614 int rtllib_wx_set_encode(struct rtllib_device *ieee,
1615 struct iw_request_info *info,
1616 union iwreq_data *wrqu, char *key);
1617 int rtllib_wx_get_encode(struct rtllib_device *ieee,
1618 struct iw_request_info *info,
1619 union iwreq_data *wrqu, char *key);
1620 int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
1621 struct iw_request_info *info,
1622 union iwreq_data *wrqu, char *extra);
1623 int rtllib_wx_set_auth(struct rtllib_device *ieee,
1624 struct iw_request_info *info,
1625 struct iw_param *data, char *extra);
1626 int rtllib_wx_set_mlme(struct rtllib_device *ieee,
1627 struct iw_request_info *info,
1628 union iwreq_data *wrqu, char *extra);
1629 int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len);
1630
1631 /* rtllib_softmac.c */
1632 int rtllib_rx_frame_softmac(struct rtllib_device *ieee, struct sk_buff *skb,
1633 struct rtllib_rx_stats *rx_stats, u16 type,
1634 u16 stype);
1635 void rtllib_softmac_new_net(struct rtllib_device *ieee,
1636 struct rtllib_network *net);
1637
1638 void send_disassociation(struct rtllib_device *ieee, bool deauth, u16 rsn);
1639 void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee);
1640
1641 int rtllib_softmac_init(struct rtllib_device *ieee);
1642 void rtllib_softmac_free(struct rtllib_device *ieee);
1643 void rtllib_disassociate(struct rtllib_device *ieee);
1644 void rtllib_stop_scan(struct rtllib_device *ieee);
1645 bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan);
1646 void rtllib_stop_scan_syncro(struct rtllib_device *ieee);
1647 void rtllib_start_scan_syncro(struct rtllib_device *ieee);
1648 void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr);
1649 void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee);
1650 void rtllib_start_protocol(struct rtllib_device *ieee);
1651 void rtllib_stop_protocol(struct rtllib_device *ieee);
1652
1653 void rtllib_enable_net_monitor_mode(struct net_device *dev, bool init_state);
1654 void rtllib_disable_net_monitor_mode(struct net_device *dev, bool init_state);
1655
1656 void rtllib_softmac_stop_protocol(struct rtllib_device *ieee);
1657 void rtllib_softmac_start_protocol(struct rtllib_device *ieee);
1658
1659 void rtllib_reset_queue(struct rtllib_device *ieee);
1660 void rtllib_wake_all_queues(struct rtllib_device *ieee);
1661 void rtllib_stop_all_queues(struct rtllib_device *ieee);
1662
1663 void notify_wx_assoc_event(struct rtllib_device *ieee);
1664 void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success);
1665
1666 void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee);
1667 u8 rtllib_ap_sec_type(struct rtllib_device *ieee);
1668
1669 /* rtllib_softmac_wx.c */
1670
1671 int rtllib_wx_get_wap(struct rtllib_device *ieee, struct iw_request_info *info,
1672 union iwreq_data *wrqu, char *ext);
1673
1674 int rtllib_wx_set_wap(struct rtllib_device *ieee, struct iw_request_info *info,
1675 union iwreq_data *awrq, char *extra);
1676
1677 int rtllib_wx_get_essid(struct rtllib_device *ieee, struct iw_request_info *a,
1678 union iwreq_data *wrqu, char *b);
1679
1680 int rtllib_wx_set_rate(struct rtllib_device *ieee, struct iw_request_info *info,
1681 union iwreq_data *wrqu, char *extra);
1682
1683 int rtllib_wx_get_rate(struct rtllib_device *ieee, struct iw_request_info *info,
1684 union iwreq_data *wrqu, char *extra);
1685
1686 int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a,
1687 union iwreq_data *wrqu, char *b);
1688
1689 int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a,
1690 union iwreq_data *wrqu, char *b);
1691
1692 int rtllib_wx_set_essid(struct rtllib_device *ieee, struct iw_request_info *a,
1693 union iwreq_data *wrqu, char *extra);
1694
1695 int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a,
1696 union iwreq_data *wrqu, char *b);
1697
1698 int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a,
1699 union iwreq_data *wrqu, char *b);
1700
1701 int rtllib_wx_get_freq(struct rtllib_device *ieee, struct iw_request_info *a,
1702 union iwreq_data *wrqu, char *b);
1703 void rtllib_wx_sync_scan_wq(void *data);
1704
1705 int rtllib_wx_get_name(struct rtllib_device *ieee, struct iw_request_info *info,
1706 union iwreq_data *wrqu, char *extra);
1707
1708 int rtllib_wx_set_power(struct rtllib_device *ieee,
1709 struct iw_request_info *info,
1710 union iwreq_data *wrqu, char *extra);
1711
1712 int rtllib_wx_get_power(struct rtllib_device *ieee,
1713 struct iw_request_info *info,
1714 union iwreq_data *wrqu, char *extra);
1715
1716 int rtllib_wx_set_rts(struct rtllib_device *ieee, struct iw_request_info *info,
1717 union iwreq_data *wrqu, char *extra);
1718
1719 int rtllib_wx_get_rts(struct rtllib_device *ieee, struct iw_request_info *info,
1720 union iwreq_data *wrqu, char *extra);
1721 #define MAX_RECEIVE_BUFFER_SIZE 9100
1722
1723 void ht_set_connect_bw_mode(struct rtllib_device *ieee,
1724 enum ht_channel_width bandwidth,
1725 enum ht_extchnl_offset Offset);
1726 void ht_update_default_setting(struct rtllib_device *ieee);
1727 void ht_construct_capability_element(struct rtllib_device *ieee,
1728 u8 *pos_ht_cap, u8 *len,
1729 u8 is_encrypt, bool assoc);
1730 void ht_construct_rt2rt_agg_element(struct rtllib_device *ieee,
1731 u8 *posRT2RTAgg, u8 *len);
1732 void ht_on_assoc_rsp(struct rtllib_device *ieee);
1733 void ht_initialize_ht_info(struct rtllib_device *ieee);
1734 void ht_initialize_bss_desc(struct bss_ht *bss_ht);
1735 void ht_reset_self_and_save_peer_setting(struct rtllib_device *ieee,
1736 struct rtllib_network *network);
1737 void HT_update_self_and_peer_setting(struct rtllib_device *ieee,
1738 struct rtllib_network *network);
1739 u8 ht_get_highest_mcs_rate(struct rtllib_device *ieee, u8 *pMCSRateSet,
1740 u8 *pMCSFilter);
1741 extern u8 MCS_FILTER_ALL[];
1742 extern u16 MCS_DATA_RATE[2][2][77];
1743 u8 ht_c_check(struct rtllib_device *ieee, u8 *frame);
1744 void ht_reset_iot_setting(struct rt_hi_throughput *ht_info);
1745 bool is_ht_half_nmode_aps(struct rtllib_device *ieee);
1746 u16 tx_count_to_data_rate(struct rtllib_device *ieee, u8 nDataRate);
1747 int rtllib_rx_add_ba_req(struct rtllib_device *ieee, struct sk_buff *skb);
1748 int rtllib_rx_add_ba_rsp(struct rtllib_device *ieee, struct sk_buff *skb);
1749 int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb);
1750 void rtllib_ts_init_add_ba(struct rtllib_device *ieee, struct tx_ts_record *ts,
1751 u8 policy, u8 overwrite_pending);
1752 void rtllib_ts_init_del_ba(struct rtllib_device *ieee,
1753 struct ts_common_info *ts_common_info,
1754 enum tr_select tx_rx_select);
1755 void rtllib_ba_setup_timeout(struct timer_list *t);
1756 void rtllib_tx_ba_inact_timeout(struct timer_list *t);
1757 void rtllib_rx_ba_inact_timeout(struct timer_list *t);
1758 void rtllib_reset_ba_entry(struct ba_record *ba);
1759 bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *addr,
1760 u8 TID, enum tr_select tx_rx_select, bool add_new_ts);
1761 void rtllib_ts_init(struct rtllib_device *ieee);
1762 void rtllib_ts_start_add_ba_process(struct rtllib_device *ieee,
1763 struct tx_ts_record *pTxTS);
1764 void remove_peer_ts(struct rtllib_device *ieee, u8 *addr);
1765 void remove_all_ts(struct rtllib_device *ieee);
1766
escape_essid(const char * essid,u8 essid_len)1767 static inline const char *escape_essid(const char *essid, u8 essid_len)
1768 {
1769 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
1770
1771 if (rtllib_is_empty_essid(essid, essid_len)) {
1772 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
1773 return escaped;
1774 }
1775
1776 snprintf(escaped, sizeof(escaped), "%*pE", essid_len, essid);
1777 return escaped;
1778 }
1779
1780 /* fun with the built-in rtllib stack... */
1781 bool rtllib_mgnt_disconnect(struct rtllib_device *rtllib, u8 rsn);
1782
1783 /* For the function is more related to hardware setting, it's better to use the
1784 * ieee handler to refer to it.
1785 */
1786 void rtllib_flush_rx_ts_pending_pkts(struct rtllib_device *ieee,
1787 struct rx_ts_record *ts);
1788 int rtllib_parse_info_param(struct rtllib_device *ieee,
1789 struct rtllib_info_element *info_element,
1790 u16 length,
1791 struct rtllib_network *network,
1792 struct rtllib_rx_stats *stats);
1793
1794 void rtllib_indicate_packets(struct rtllib_device *ieee,
1795 struct rtllib_rxb **prxb_indicate_array, u8 index);
1796 #define RT_ASOC_RETRY_LIMIT 5
1797 u8 mgnt_query_tx_rate_exclude_cck_rates(struct rtllib_device *ieee);
1798
1799 #endif /* RTLLIB_H */
1800