mwifiex: add SDIO rx single port aggregation
[deliverable/linux.git] / drivers / net / wireless / mwifiex / main.h
CommitLineData
5e6e3a92
BZ
1/*
2 * Marvell Wireless LAN device driver: major data structures and prototypes
3 *
65da33f5 4 * Copyright (C) 2011-2014, Marvell International Ltd.
5e6e3a92
BZ
5 *
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13 *
14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
17 * this warranty disclaimer.
18 */
19
20#ifndef _MWIFIEX_MAIN_H_
21#define _MWIFIEX_MAIN_H_
22
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/sched.h>
26#include <linux/semaphore.h>
27#include <linux/ip.h>
28#include <linux/skbuff.h>
29#include <linux/if_arp.h>
30#include <linux/etherdevice.h>
31#include <net/sock.h>
32#include <net/lib80211.h>
92c2538f 33#include <linux/vmalloc.h>
5e6e3a92
BZ
34#include <linux/firmware.h>
35#include <linux/ctype.h>
699b027b 36#include <linux/of.h>
808bbebc 37#include <linux/idr.h>
b533be18 38#include <linux/inetdevice.h>
5e6e3a92
BZ
39
40#include "decl.h"
41#include "ioctl.h"
42#include "util.h"
43#include "fw.h"
d930faee 44#include "pcie.h"
11cd07a9
XH
45#include "usb.h"
46#include "sdio.h"
5e6e3a92
BZ
47
48extern const char driver_version[];
5e6e3a92
BZ
49
50enum {
600f5d90
AK
51 MWIFIEX_ASYNC_CMD,
52 MWIFIEX_SYNC_CMD
5e6e3a92
BZ
53};
54
0013c7ce
AP
55#define MWIFIEX_DRIVER_MODE_STA BIT(0)
56#define MWIFIEX_DRIVER_MODE_UAP BIT(1)
57#define MWIFIEX_DRIVER_MODE_P2P BIT(2)
58#define MWIFIEX_DRIVER_MODE_BITMASK (BIT(0) | BIT(1) | BIT(2))
59
67a50035
BZ
60#define MWIFIEX_MAX_AP 64
61
e35000ea
ZL
62#define MWIFIEX_MAX_PKTS_TXQ 16
63
5e6e3a92
BZ
64#define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT (5 * HZ)
65
66#define MWIFIEX_TIMER_10S 10000
67#define MWIFIEX_TIMER_1S 1000
68
62a5b7dc
MY
69#define MAX_TX_PENDING 100
70#define LOW_TX_PENDING 80
5e6e3a92 71
6e251174
AP
72#define HIGH_RX_PENDING 50
73#define LOW_RX_PENDING 20
74
5e6e3a92
BZ
75#define MWIFIEX_UPLD_SIZE (2312)
76
21f58d20 77#define MAX_EVENT_SIZE 2048
5e6e3a92
BZ
78
79#define ARP_FILTER_MAX_BUF_SIZE 68
80
81#define MWIFIEX_KEY_BUFFER_SIZE 16
82#define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
83#define MWIFIEX_MAX_REGION_CODE 7
84
85#define DEFAULT_BCN_AVG_FACTOR 8
86#define DEFAULT_DATA_AVG_FACTOR 8
87
88#define FIRST_VALID_CHANNEL 0xff
89#define DEFAULT_AD_HOC_CHANNEL 6
90#define DEFAULT_AD_HOC_CHANNEL_A 36
91
92#define DEFAULT_BCN_MISS_TIMEOUT 5
93
94#define MAX_SCAN_BEACON_BUFFER 8000
95
96#define SCAN_BEACON_ENTRY_PAD 6
97
38e8b7d9
BZ
98#define MWIFIEX_PASSIVE_SCAN_CHAN_TIME 110
99#define MWIFIEX_ACTIVE_SCAN_CHAN_TIME 30
100#define MWIFIEX_SPECIFIC_SCAN_CHAN_TIME 30
cb91be87 101#define MWIFIEX_DEF_SCAN_CHAN_GAP_TIME 50
5e6e3a92
BZ
102
103#define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI)))
104
105#define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S)
106
107#define RSN_GTK_OUI_OFFSET 2
108
109#define MWIFIEX_OUI_NOT_PRESENT 0
110#define MWIFIEX_OUI_PRESENT 1
111
e39faa73
SP
112#define PKT_TYPE_MGMT 0xE5
113
4daffe35
AK
114/*
115 * Do not check for data_received for USB, as data_received
116 * is handled in mwifiex_usb_recv for USB
117 */
5e6e3a92 118#define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \
4daffe35 119 adapter->event_received || \
ec4a16b4 120 adapter->data_received)
5e6e3a92
BZ
121
122#define MWIFIEX_TYPE_CMD 1
123#define MWIFIEX_TYPE_DATA 0
92263a84 124#define MWIFIEX_TYPE_AGGR_DATA 10
5e6e3a92
BZ
125#define MWIFIEX_TYPE_EVENT 3
126
a0b7315a 127#define MAX_BITMAP_RATES_SIZE 18
5e6e3a92
BZ
128
129#define MAX_CHANNEL_BAND_BG 14
a3c2c4f6 130#define MAX_CHANNEL_BAND_A 165
5e6e3a92
BZ
131
132#define MAX_FREQUENCY_BAND_BG 2484
133
d930faee 134#define MWIFIEX_EVENT_HEADER_LEN 4
e568634a 135#define MWIFIEX_UAP_EVENT_EXTRA_HEADER 2
d930faee 136
4daffe35
AK
137#define MWIFIEX_TYPE_LEN 4
138#define MWIFIEX_USB_TYPE_CMD 0xF00DFACE
139#define MWIFIEX_USB_TYPE_DATA 0xBEADC0DE
140#define MWIFIEX_USB_TYPE_EVENT 0xBEEFFACE
141
8908c7d5
AN
142/* Threshold for tx_timeout_cnt before we trigger a card reset */
143#define TX_TIMEOUT_THRESHOLD 6
144
11cd07a9
XH
145#define MWIFIEX_DRV_INFO_SIZE_MAX 0x40000
146
31def91b
AP
147/* Address alignment */
148#define MWIFIEX_ALIGN_ADDR(p, a) (((long)(p) + (a) - 1) & ~((a) - 1))
149
5e6e3a92
BZ
150struct mwifiex_dbg {
151 u32 num_cmd_host_to_card_failure;
152 u32 num_cmd_sleep_cfm_host_to_card_failure;
153 u32 num_tx_host_to_card_failure;
154 u32 num_event_deauth;
155 u32 num_event_disassoc;
156 u32 num_event_link_lost;
157 u32 num_cmd_deauth;
158 u32 num_cmd_assoc_success;
159 u32 num_cmd_assoc_failure;
160 u32 num_tx_timeout;
5e6e3a92
BZ
161 u16 timeout_cmd_id;
162 u16 timeout_cmd_act;
163 u16 last_cmd_id[DBG_CMD_NUM];
164 u16 last_cmd_act[DBG_CMD_NUM];
165 u16 last_cmd_index;
166 u16 last_cmd_resp_id[DBG_CMD_NUM];
167 u16 last_cmd_resp_index;
168 u16 last_event[DBG_CMD_NUM];
169 u16 last_event_index;
170};
171
172enum MWIFIEX_HARDWARE_STATUS {
173 MWIFIEX_HW_STATUS_READY,
174 MWIFIEX_HW_STATUS_INITIALIZING,
5e6e3a92
BZ
175 MWIFIEX_HW_STATUS_INIT_DONE,
176 MWIFIEX_HW_STATUS_RESET,
177 MWIFIEX_HW_STATUS_CLOSING,
178 MWIFIEX_HW_STATUS_NOT_READY
179};
180
181enum MWIFIEX_802_11_POWER_MODE {
182 MWIFIEX_802_11_POWER_MODE_CAM,
183 MWIFIEX_802_11_POWER_MODE_PSP
184};
185
186struct mwifiex_tx_param {
187 u32 next_pkt_len;
188};
189
190enum MWIFIEX_PS_STATE {
191 PS_STATE_AWAKE,
192 PS_STATE_PRE_SLEEP,
193 PS_STATE_SLEEP_CFM,
194 PS_STATE_SLEEP
195};
196
d930faee
AK
197enum mwifiex_iface_type {
198 MWIFIEX_SDIO,
199 MWIFIEX_PCIE,
4daffe35 200 MWIFIEX_USB
d930faee
AK
201};
202
5e6e3a92
BZ
203struct mwifiex_add_ba_param {
204 u32 tx_win_size;
205 u32 rx_win_size;
206 u32 timeout;
4c9f9fb2
AK
207 u8 tx_amsdu;
208 u8 rx_amsdu;
5e6e3a92
BZ
209};
210
211struct mwifiex_tx_aggr {
212 u8 ampdu_user;
213 u8 ampdu_ap;
214 u8 amsdu;
215};
216
39df5e82
ZL
217enum mwifiex_ba_status {
218 BA_SETUP_NONE = 0,
219 BA_SETUP_INPROGRESS,
220 BA_SETUP_COMPLETE
221};
222
5e6e3a92
BZ
223struct mwifiex_ra_list_tbl {
224 struct list_head list;
225 struct sk_buff_head skb_head;
226 u8 ra[ETH_ALEN];
5e6e3a92 227 u32 is_11n_enabled;
5a009adf 228 u16 max_amsdu;
f0cb84f8 229 u16 ba_pkt_count;
5a009adf 230 u8 ba_packet_thr;
39df5e82
ZL
231 enum mwifiex_ba_status ba_status;
232 u8 amsdu_in_ampdu;
c7d9ed9e 233 u16 total_pkt_count;
daeb5bb4 234 bool tdls_link;
5e6e3a92
BZ
235};
236
237struct mwifiex_tid_tbl {
238 struct list_head ra_list;
5e6e3a92
BZ
239};
240
241#define WMM_HIGHEST_PRIORITY 7
242#define HIGH_PRIO_TID 7
243#define LOW_PRIO_TID 0
244
245struct mwifiex_wmm_desc {
246 struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID];
247 u32 packets_out[MAX_NUM_TID];
248 /* spin lock to protect ra_list */
249 spinlock_t ra_list_spinlock;
99fec5de
JB
250 struct mwifiex_wmm_ac_status ac_status[IEEE80211_NUM_ACS];
251 enum mwifiex_wmm_ac_e ac_down_graded_vals[IEEE80211_NUM_ACS];
5e6e3a92 252 u32 drv_pkt_delay_max;
99fec5de 253 u8 queue_priority[IEEE80211_NUM_ACS];
5e6e3a92 254 u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */
f699254c
MY
255 /* Number of transmit packets queued */
256 atomic_t tx_pkts_queued;
49729ff6
MY
257 /* Tracks highest priority with a packet queued */
258 atomic_t highest_queued_prio;
5e6e3a92
BZ
259};
260
261struct mwifiex_802_11_security {
262 u8 wpa_enabled;
263 u8 wpa2_enabled;
264 u8 wapi_enabled;
265 u8 wapi_key_on;
5eb02e44 266 u8 wep_enabled;
5e6e3a92 267 u32 authentication_mode;
a0f6d6ca 268 u8 is_authtype_auto;
5e6e3a92
BZ
269 u32 encryption_mode;
270};
271
272struct ieee_types_header {
273 u8 element_id;
274 u8 len;
275} __packed;
276
5e6e3a92
BZ
277struct ieee_types_vendor_specific {
278 struct ieee_types_vendor_header vend_hdr;
279 u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_vendor_header)];
280} __packed;
281
282struct ieee_types_generic {
283 struct ieee_types_header ieee_hdr;
284 u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_header)];
285} __packed;
286
b23bce29
AP
287struct ieee_types_bss_co_2040 {
288 struct ieee_types_header ieee_hdr;
289 u8 bss_2040co;
290} __packed;
291
292struct ieee_types_extcap {
293 struct ieee_types_header ieee_hdr;
294 u8 ext_capab[8];
295} __packed;
296
5f6d5983
AP
297struct ieee_types_vht_cap {
298 struct ieee_types_header ieee_hdr;
299 struct ieee80211_vht_cap vhtcap;
300} __packed;
301
302struct ieee_types_vht_oper {
303 struct ieee_types_header ieee_hdr;
304 struct ieee80211_vht_operation vhtoper;
305} __packed;
306
307struct ieee_types_aid {
308 struct ieee_types_header ieee_hdr;
309 u16 aid;
310} __packed;
311
5e6e3a92
BZ
312struct mwifiex_bssdescriptor {
313 u8 mac_address[ETH_ALEN];
b9be5f39 314 struct cfg80211_ssid ssid;
5e6e3a92
BZ
315 u32 privacy;
316 s32 rssi;
317 u32 channel;
318 u32 freq;
319 u16 beacon_period;
320 u8 erp_flags;
321 u32 bss_mode;
322 u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
323 u8 data_rates[MWIFIEX_SUPPORTED_RATES];
324 /* Network band.
325 * BAND_B(0x01): 'b' band
326 * BAND_G(0x02): 'g' band
327 * BAND_A(0X04): 'a' band
328 */
329 u16 bss_band;
b5abcf02
AK
330 u64 fw_tsf;
331 u64 timestamp;
5e6e3a92
BZ
332 union ieee_types_phy_param_set phy_param_set;
333 union ieee_types_ss_param_set ss_param_set;
334 u16 cap_info_bitmap;
335 struct ieee_types_wmm_parameter wmm_ie;
336 u8 disable_11n;
337 struct ieee80211_ht_cap *bcn_ht_cap;
338 u16 ht_cap_offset;
074d46d1 339 struct ieee80211_ht_operation *bcn_ht_oper;
5e6e3a92
BZ
340 u16 ht_info_offset;
341 u8 *bcn_bss_co_2040;
342 u16 bss_co_2040_offset;
343 u8 *bcn_ext_cap;
344 u16 ext_cap_offset;
a5f39056
YAP
345 struct ieee80211_vht_cap *bcn_vht_cap;
346 u16 vht_cap_offset;
347 struct ieee80211_vht_operation *bcn_vht_oper;
348 u16 vht_info_offset;
349 struct ieee_types_oper_mode_ntf *oper_mode;
350 u16 oper_mode_offset;
351 u8 disable_11ac;
5e6e3a92
BZ
352 struct ieee_types_vendor_specific *bcn_wpa_ie;
353 u16 wpa_offset;
354 struct ieee_types_generic *bcn_rsn_ie;
355 u16 rsn_offset;
356 struct ieee_types_generic *bcn_wapi_ie;
357 u16 wapi_offset;
358 u8 *beacon_buf;
359 u32 beacon_buf_size;
2a7305c8
AK
360 u8 sensed_11h;
361 u8 local_constraint;
362 u8 chan_sw_ie_present;
5e6e3a92
BZ
363};
364
365struct mwifiex_current_bss_params {
366 struct mwifiex_bssdescriptor bss_descriptor;
367 u8 wmm_enabled;
368 u8 wmm_uapsd_enabled;
369 u8 band;
370 u32 num_of_rates;
371 u8 data_rates[MWIFIEX_SUPPORTED_RATES];
372};
373
374struct mwifiex_sleep_params {
375 u16 sp_error;
376 u16 sp_offset;
377 u16 sp_stable_time;
378 u8 sp_cal_control;
379 u8 sp_ext_sleep_clk;
380 u16 sp_reserved;
381};
382
383struct mwifiex_sleep_period {
384 u16 period;
385 u16 reserved;
386};
387
388struct mwifiex_wep_key {
389 u32 length;
390 u32 key_index;
391 u32 key_length;
392 u8 key_material[MWIFIEX_KEY_BUFFER_SIZE];
393};
394
395#define MAX_REGION_CHANNEL_NUM 2
396
397struct mwifiex_chan_freq_power {
398 u16 channel;
399 u32 freq;
400 u16 max_tx_power;
401 u8 unsupported;
402};
403
404enum state_11d_t {
405 DISABLE_11D = 0,
406 ENABLE_11D = 1,
407};
408
409#define MWIFIEX_MAX_TRIPLET_802_11D 83
410
411struct mwifiex_802_11d_domain_reg {
412 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
413 u8 no_of_triplet;
414 struct ieee80211_country_ie_triplet
415 triplet[MWIFIEX_MAX_TRIPLET_802_11D];
416};
417
418struct mwifiex_vendor_spec_cfg_ie {
419 u16 mask;
420 u16 flag;
421 u8 ie[MWIFIEX_MAX_VSIE_LEN];
422};
423
424struct wps {
425 u8 session_enable;
426};
427
7feb4c48
SP
428struct mwifiex_roc_cfg {
429 u64 cookie;
430 struct ieee80211_channel chan;
7feb4c48
SP
431};
432
92c2538f 433#define MWIFIEX_FW_DUMP_IDX 0xff
11cd07a9 434#define MWIFIEX_DRV_INFO_IDX 20
92c2538f
AK
435#define FW_DUMP_MAX_NAME_LEN 8
436#define FW_DUMP_HOST_READY 0xEE
437#define FW_DUMP_DONE 0xFF
7e174833 438#define FW_DUMP_READ_DONE 0xFE
92c2538f
AK
439
440struct memory_type_mapping {
441 u8 mem_name[FW_DUMP_MAX_NAME_LEN];
442 u8 *mem_ptr;
443 u32 mem_size;
444 u8 done_flag;
445};
446
447enum rdwr_status {
448 RDWR_STATUS_SUCCESS = 0,
449 RDWR_STATUS_FAILURE = 1,
450 RDWR_STATUS_DONE = 2
451};
452
453enum mwifiex_iface_work_flags {
454 MWIFIEX_IFACE_WORK_FW_DUMP,
8915d738 455 MWIFIEX_IFACE_WORK_CARD_RESET,
92c2538f
AK
456};
457
5e6e3a92
BZ
458struct mwifiex_adapter;
459struct mwifiex_private;
460
461struct mwifiex_private {
462 struct mwifiex_adapter *adapter;
5e6e3a92
BZ
463 u8 bss_type;
464 u8 bss_role;
465 u8 bss_priority;
466 u8 bss_num;
d6bffe8b 467 u8 bss_started;
5e6e3a92
BZ
468 u8 frame_type;
469 u8 curr_addr[ETH_ALEN];
470 u8 media_connected;
471 u32 num_tx_timeout;
8908c7d5
AN
472 /* track consecutive timeout */
473 u8 tx_timeout_cnt;
5e6e3a92
BZ
474 struct net_device *netdev;
475 struct net_device_stats stats;
476 u16 curr_pkt_filter;
477 u32 bss_mode;
478 u32 pkt_tx_ctrl;
479 u16 tx_power_level;
480 u8 max_tx_power_level;
481 u8 min_tx_power_level;
482 u8 tx_rate;
483 u8 tx_htinfo;
484 u8 rxpd_htinfo;
485 u8 rxpd_rate;
486 u16 rate_bitmap;
487 u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
488 u32 data_rate;
489 u8 is_data_rate_auto;
490 u16 bcn_avg_factor;
491 u16 data_avg_factor;
492 s16 data_rssi_last;
493 s16 data_nf_last;
494 s16 data_rssi_avg;
495 s16 data_nf_avg;
496 s16 bcn_rssi_last;
497 s16 bcn_nf_last;
498 s16 bcn_rssi_avg;
499 s16 bcn_nf_avg;
500 struct mwifiex_bssdescriptor *attempted_bss_desc;
b9be5f39 501 struct cfg80211_ssid prev_ssid;
5e6e3a92
BZ
502 u8 prev_bssid[ETH_ALEN];
503 struct mwifiex_current_bss_params curr_bss_params;
504 u16 beacon_period;
caf60a6c 505 u8 dtim_period;
5e6e3a92
BZ
506 u16 listen_interval;
507 u16 atim_window;
508 u8 adhoc_channel;
509 u8 adhoc_is_link_sensed;
510 u8 adhoc_state;
511 struct mwifiex_802_11_security sec_info;
512 struct mwifiex_wep_key wep_key[NUM_WEP_KEYS];
513 u16 wep_key_curr_index;
514 u8 wpa_ie[256];
515 u8 wpa_ie_len;
516 u8 wpa_is_gtk_set;
517 struct host_cmd_ds_802_11_key_material aes_key;
e57f1734 518 struct host_cmd_ds_802_11_key_material_v2 aes_key_v2;
5e6e3a92
BZ
519 u8 wapi_ie[256];
520 u8 wapi_ie_len;
13d7ba78
AP
521 u8 *wps_ie;
522 u8 wps_ie_len;
5e6e3a92
BZ
523 u8 wmm_required;
524 u8 wmm_enabled;
525 u8 wmm_qosinfo;
526 struct mwifiex_wmm_desc wmm;
47411a06 527 atomic_t wmm_tx_pending[IEEE80211_NUM_ACS];
017a92a1 528 struct list_head sta_list;
9927baa3 529 /* spin lock for associated station/TDLS peers list */
017a92a1 530 spinlock_t sta_list_spinlock;
9927baa3
AP
531 struct list_head auto_tdls_list;
532 /* spin lock for auto TDLS peer list */
533 spinlock_t auto_tdls_lock;
5e6e3a92
BZ
534 struct list_head tx_ba_stream_tbl_ptr;
535 /* spin lock for tx_ba_stream_tbl_ptr queue */
536 spinlock_t tx_ba_stream_tbl_lock;
537 struct mwifiex_tx_aggr aggr_prio_tbl[MAX_NUM_TID];
538 struct mwifiex_add_ba_param add_ba_param;
539 u16 rx_seq[MAX_NUM_TID];
41a24a29 540 u8 tos_to_tid_inv[MAX_NUM_TID];
5e6e3a92
BZ
541 struct list_head rx_reorder_tbl_ptr;
542 /* spin lock for rx_reorder_tbl_ptr queue */
543 spinlock_t rx_reorder_tbl_lock;
544 /* spin lock for Rx packets */
545 spinlock_t rx_pkt_lock;
546
547#define MWIFIEX_ASSOC_RSP_BUF_SIZE 500
548 u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE];
549 u32 assoc_rsp_size;
550
551#define MWIFIEX_GENIE_BUF_SIZE 256
552 u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE];
553 u8 gen_ie_buf_len;
554
555 struct mwifiex_vendor_spec_cfg_ie vs_ie[MWIFIEX_MAX_VSIE_NUM];
556
557#define MWIFIEX_ASSOC_TLV_BUF_SIZE 256
558 u8 assoc_tlv_buf[MWIFIEX_ASSOC_TLV_BUF_SIZE];
559 u8 assoc_tlv_buf_len;
560
561 u8 *curr_bcn_buf;
562 u32 curr_bcn_size;
563 /* spin lock for beacon buffer */
564 spinlock_t curr_bcn_buf_lock;
4facc34a 565 struct wireless_dev wdev;
5e6e3a92
BZ
566 struct mwifiex_chan_freq_power cfp;
567 char version_str[128];
568#ifdef CONFIG_DEBUG_FS
569 struct dentry *dfs_dev_dir;
570#endif
5e6e3a92
BZ
571 u16 current_key_index;
572 struct semaphore async_sem;
5e6e3a92 573 struct cfg80211_scan_request *scan_request;
5e6e3a92 574 u8 cfg_bssid[6];
5e6e3a92
BZ
575 struct wps wps;
576 u8 scan_block;
fa444bf8
AK
577 s32 cqm_rssi_thold;
578 u32 cqm_rssi_hyst;
579 u8 subsc_evt_rssi_state;
908fe113 580 struct mwifiex_ds_misc_subsc_evt async_subsc_evt_storage;
ede98bfa 581 struct mwifiex_ie mgmt_ie[MAX_MGMT_IE_INDEX];
f31acabe
AP
582 u16 beacon_idx;
583 u16 proberesp_idx;
584 u16 assocresp_idx;
2ade5667 585 u16 gen_idx;
c8258913 586 u8 ap_11n_enabled;
a5f39056 587 u8 ap_11ac_enabled;
3cec6870 588 u32 mgmt_frame_mask;
7feb4c48 589 struct mwifiex_roc_cfg roc_cfg;
75ab753d 590 bool scan_aborting;
b887664d
AK
591 u8 csa_chan;
592 unsigned long csa_expire_time;
61c87304 593 u8 del_list_idx;
587b36d3 594 bool hs2_enabled;
35c739b5 595 struct mwifiex_uap_bss_param bss_cfg;
1f4dfd8a 596 struct station_parameters *sta_params;
56bd24a1 597 struct sk_buff_head tdls_txq;
9927baa3
AP
598 u8 check_tdls_tx;
599 struct timer_list auto_tdls_timer;
600 bool auto_tdls_timer_active;
808bbebc
AK
601 struct idr ack_status_frames;
602 /* spin lock for ack status */
603 spinlock_t ack_status_lock;
cbf6e055
XH
604 /** rx histogram data */
605 struct mwifiex_histogram_data *hist_data;
85afb186
AP
606 struct cfg80211_chan_def dfs_chandef;
607 struct workqueue_struct *dfs_cac_workqueue;
608 struct delayed_work dfs_cac_work;
7d652034
AP
609 struct timer_list dfs_chan_switch_timer;
610 struct workqueue_struct *dfs_chan_sw_workqueue;
611 struct delayed_work dfs_chan_sw_work;
612 struct cfg80211_beacon_data beacon_after;
cf075eac 613 struct mwifiex_11h_intf_state state_11h;
5e6e3a92
BZ
614};
615
5e6e3a92
BZ
616
617struct mwifiex_tx_ba_stream_tbl {
618 struct list_head list;
619 int tid;
620 u8 ra[ETH_ALEN];
621 enum mwifiex_ba_status ba_status;
4c9f9fb2 622 u8 amsdu;
5e6e3a92
BZ
623};
624
625struct mwifiex_rx_reorder_tbl;
626
627struct reorder_tmr_cnxt {
628 struct timer_list timer;
629 struct mwifiex_rx_reorder_tbl *ptr;
630 struct mwifiex_private *priv;
3a8fede1 631 u8 timer_is_set;
5e6e3a92
BZ
632};
633
634struct mwifiex_rx_reorder_tbl {
635 struct list_head list;
636 int tid;
637 u8 ta[ETH_ALEN];
8acbea61 638 int init_win;
5e6e3a92
BZ
639 int start_win;
640 int win_size;
641 void **rx_reorder_ptr;
642 struct reorder_tmr_cnxt timer_context;
4c9f9fb2 643 u8 amsdu;
2db96c3d 644 u8 flags;
5e6e3a92
BZ
645};
646
647struct mwifiex_bss_prio_node {
648 struct list_head list;
649 struct mwifiex_private *priv;
650};
651
652struct mwifiex_bss_prio_tbl {
653 struct list_head bss_prio_head;
654 /* spin lock for bss priority */
655 spinlock_t bss_prio_lock;
656 struct mwifiex_bss_prio_node *bss_prio_cur;
657};
658
659struct cmd_ctrl_node {
660 struct list_head list;
661 struct mwifiex_private *priv;
662 u32 cmd_oid;
663 u32 cmd_flag;
664 struct sk_buff *cmd_skb;
665 struct sk_buff *resp_skb;
666 void *data_buf;
600f5d90 667 u32 wait_q_enabled;
5e6e3a92 668 struct sk_buff *skb;
efaaa8b8
AK
669 u8 *condition;
670 u8 cmd_wait_q_woken;
5e6e3a92
BZ
671};
672
b5abcf02
AK
673struct mwifiex_bss_priv {
674 u8 band;
675 u64 fw_tsf;
676};
677
5f2caaf3
AP
678struct mwifiex_tdls_capab {
679 __le16 capab;
680 u8 rates[32];
681 u8 rates_len;
682 u8 qos_info;
683 u8 coex_2040;
5f6d5983 684 u16 aid;
5f2caaf3
AP
685 struct ieee80211_ht_cap ht_capb;
686 struct ieee80211_ht_operation ht_oper;
687 struct ieee_types_extcap extcap;
688 struct ieee_types_generic rsn_ie;
5f6d5983
AP
689 struct ieee80211_vht_cap vhtcap;
690 struct ieee80211_vht_operation vhtoper;
5f2caaf3
AP
691};
692
693/* This is AP/TDLS specific structure which stores information
694 * about associated/peer STA
017a92a1
AP
695 */
696struct mwifiex_sta_node {
697 struct list_head list;
698 u8 mac_addr[ETH_ALEN];
699 u8 is_wmm_enabled;
700 u8 is_11n_enabled;
5f6d5983 701 u8 is_11ac_enabled;
017a92a1
AP
702 u8 ampdu_sta[MAX_NUM_TID];
703 u16 rx_seq[MAX_NUM_TID];
704 u16 max_amsdu;
429d90d2 705 u8 tdls_status;
5f2caaf3 706 struct mwifiex_tdls_capab tdls_cap;
017a92a1
AP
707};
708
9927baa3
AP
709struct mwifiex_auto_tdls_peer {
710 struct list_head list;
711 u8 mac_addr[ETH_ALEN];
712 u8 tdls_status;
713 int rssi;
714 long rssi_jiffies;
715 u8 failure_count;
716 u8 do_discover;
717 u8 do_setup;
718};
719
5e6e3a92
BZ
720struct mwifiex_if_ops {
721 int (*init_if) (struct mwifiex_adapter *);
722 void (*cleanup_if) (struct mwifiex_adapter *);
d930faee 723 int (*check_fw_status) (struct mwifiex_adapter *, u32);
5e6e3a92
BZ
724 int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
725 int (*register_dev) (struct mwifiex_adapter *);
726 void (*unregister_dev) (struct mwifiex_adapter *);
727 int (*enable_int) (struct mwifiex_adapter *);
232fde06 728 void (*disable_int) (struct mwifiex_adapter *);
5e6e3a92 729 int (*process_int_status) (struct mwifiex_adapter *);
d930faee 730 int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *,
5e6e3a92
BZ
731 struct mwifiex_tx_param *);
732 int (*wakeup) (struct mwifiex_adapter *);
733 int (*wakeup_complete) (struct mwifiex_adapter *);
734
d930faee 735 /* Interface specific functions */
5e6e3a92
BZ
736 void (*update_mp_end_port) (struct mwifiex_adapter *, u16);
737 void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
d930faee
AK
738 int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *);
739 int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
c6d1d87a 740 int (*init_fw_port) (struct mwifiex_adapter *);
4daffe35 741 int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
d31ab357 742 void (*card_reset) (struct mwifiex_adapter *);
1c09bf68 743 void (*fw_dump)(struct mwifiex_adapter *);
809c6ea8 744 int (*reg_dump)(struct mwifiex_adapter *, char *);
fbd7e7ac 745 int (*clean_pcie_ring) (struct mwifiex_adapter *adapter);
92c2538f 746 void (*iface_work)(struct work_struct *work);
cf6a64fd 747 void (*submit_rem_rx_urbs)(struct mwifiex_adapter *adapter);
92263a84 748 void (*deaggr_pkt)(struct mwifiex_adapter *, struct sk_buff *);
5e6e3a92
BZ
749};
750
751struct mwifiex_adapter {
d930faee 752 u8 iface_type;
cf052335
AP
753 struct mwifiex_iface_comb iface_limit;
754 struct mwifiex_iface_comb curr_iface_comb;
5e6e3a92
BZ
755 struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM];
756 u8 priv_num;
5e6e3a92 757 const struct firmware *firmware;
4a7f5db1 758 char fw_name[32];
d930faee 759 int winner;
5e6e3a92 760 struct device *dev;
d6bffe8b 761 struct wiphy *wiphy;
8d05eb22 762 u8 perm_addr[ETH_ALEN];
5e6e3a92
BZ
763 bool surprise_removed;
764 u32 fw_release_number;
5e6e3a92
BZ
765 u16 init_wait_q_woken;
766 wait_queue_head_t init_wait_q;
767 void *card;
768 struct mwifiex_if_ops if_ops;
769 atomic_t rx_pending;
770 atomic_t tx_pending;
600f5d90 771 atomic_t cmd_pending;
5e6e3a92
BZ
772 struct workqueue_struct *workqueue;
773 struct work_struct main_work;
6e251174
AP
774 struct workqueue_struct *rx_workqueue;
775 struct work_struct rx_work;
85afb186
AP
776 struct workqueue_struct *dfs_workqueue;
777 struct work_struct dfs_work;
6e251174
AP
778 bool rx_work_enabled;
779 bool rx_processing;
780 bool delay_main_work;
781 bool rx_locked;
a9adbcb3 782 bool main_locked;
5e6e3a92
BZ
783 struct mwifiex_bss_prio_tbl bss_prio_tbl[MWIFIEX_MAX_BSS_NUM];
784 /* spin lock for init/shutdown */
785 spinlock_t mwifiex_lock;
786 /* spin lock for main process */
787 spinlock_t main_proc_lock;
788 u32 mwifiex_processing;
04c7b363 789 u8 more_task_flag;
5e6e3a92
BZ
790 u16 tx_buf_size;
791 u16 curr_tx_buf_size;
92263a84
ZL
792 bool sdio_rx_aggr_enable;
793 u16 sdio_rx_block_size;
5e6e3a92
BZ
794 u32 ioport;
795 enum MWIFIEX_HARDWARE_STATUS hw_status;
5e6e3a92
BZ
796 u16 number_of_antenna;
797 u32 fw_cap_info;
798 /* spin lock for interrupt handling */
799 spinlock_t int_lock;
800 u8 int_status;
801 u32 event_cause;
802 struct sk_buff *event_skb;
803 u8 upld_buf[MWIFIEX_UPLD_SIZE];
804 u8 data_sent;
805 u8 cmd_sent;
806 u8 cmd_resp_received;
807 u8 event_received;
808 u8 data_received;
809 u16 seq_num;
810 struct cmd_ctrl_node *cmd_pool;
811 struct cmd_ctrl_node *curr_cmd;
812 /* spin lock for command */
813 spinlock_t mwifiex_cmd_lock;
0c9c4a09 814 u8 is_cmd_timedout;
5e6e3a92
BZ
815 u16 last_init_cmd;
816 struct timer_list cmd_timer;
817 struct list_head cmd_free_q;
818 /* spin lock for cmd_free_q */
819 spinlock_t cmd_free_q_lock;
820 struct list_head cmd_pending_q;
821 /* spin lock for cmd_pending_q */
822 spinlock_t cmd_pending_q_lock;
823 struct list_head scan_pending_q;
824 /* spin lock for scan_pending_q */
825 spinlock_t scan_pending_q_lock;
6e251174
AP
826 /* spin lock for RX processing routine */
827 spinlock_t rx_proc_lock;
e35000ea
ZL
828 struct sk_buff_head tx_data_q;
829 atomic_t tx_queued;
5e6e3a92
BZ
830 u32 scan_processing;
831 u16 region_code;
832 struct mwifiex_802_11d_domain_reg domain_reg;
5e6e3a92
BZ
833 u16 scan_probes;
834 u32 scan_mode;
835 u16 specific_scan_time;
836 u16 active_scan_time;
837 u16 passive_scan_time;
cb91be87 838 u16 scan_chan_gap_time;
5e6e3a92
BZ
839 u8 fw_bands;
840 u8 adhoc_start_band;
841 u8 config_bands;
842 struct mwifiex_chan_scan_param_set *scan_channels;
843 u8 tx_lock_flag;
844 struct mwifiex_sleep_params sleep_params;
845 struct mwifiex_sleep_period sleep_period;
846 u16 ps_mode;
847 u32 ps_state;
848 u8 need_to_wakeup;
849 u16 multiple_dtim;
850 u16 local_listen_interval;
851 u16 null_pkt_interval;
852 struct sk_buff *sleep_cfm;
853 u16 bcn_miss_time_out;
854 u16 adhoc_awake_period;
855 u8 is_deep_sleep;
856 u8 delay_null_pkt;
857 u16 delay_to_ps;
858 u16 enhanced_ps_mode;
859 u8 pm_wakeup_card_req;
860 u16 gen_null_pkt;
861 u16 pps_uapsd_mode;
862 u32 pm_wakeup_fw_try;
4636187d 863 struct timer_list wakeup_timer;
5e6e3a92
BZ
864 u8 is_hs_configured;
865 struct mwifiex_hs_config_param hs_cfg;
866 u8 hs_activated;
867 u16 hs_activate_wait_q_woken;
868 wait_queue_head_t hs_activate_wait_q;
869 bool is_suspended;
c0dbba66 870 bool hs_enabling;
5e6e3a92
BZ
871 u8 event_body[MAX_EVENT_SIZE];
872 u32 hw_dot_11n_dev_cap;
873 u8 hw_dev_mcs_support;
a5333914 874 u8 user_dev_mcs_support;
5e6e3a92 875 u8 adhoc_11n_enabled;
21c3ba34 876 u8 sec_chan_offset;
5e6e3a92
BZ
877 struct mwifiex_dbg dbg;
878 u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
879 u32 arp_filter_size;
600f5d90 880 struct mwifiex_wait_queue cmd_wait_q;
efaaa8b8 881 u8 scan_wait_q_woken;
bbea3bc4 882 spinlock_t queue_lock; /* lock for tx queues */
67fdf39e 883 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
ede98bfa 884 u16 max_mgmt_ie_index;
388ec385 885 const struct firmware *cal_data;
699b027b 886 struct device_node *dt_node;
a5f39056
YAP
887
888 /* 11AC */
889 u32 is_hw_11ac_capable;
890 u32 hw_dot_11ac_dev_cap;
891 u32 hw_dot_11ac_mcs_support;
892 u32 usr_dot_11ac_dev_cap_bg;
893 u32 usr_dot_11ac_dev_cap_a;
894 u32 usr_dot_11ac_mcs_support;
895
838e4f44 896 atomic_t pending_bridged_pkts;
6b41f941 897 struct semaphore *card_sem;
21f58d20 898 bool ext_scan;
8e17ea25 899 u8 fw_api_ver;
4b9fede5 900 u8 key_api_major_ver, key_api_minor_ver;
92c2538f
AK
901 struct work_struct iface_work;
902 unsigned long iface_work_flags;
903 struct memory_type_mapping *mem_type_mapping_tbl;
904 u8 num_mem_types;
905 u8 curr_mem_idx;
11cd07a9
XH
906 void *drv_info_dump;
907 u32 drv_info_size;
cb91be87 908 bool scan_chan_gap_enabled;
6e251174 909 struct sk_buff_head rx_data_q;
bf354433
AP
910 struct mwifiex_chan_stats *chan_stats;
911 u32 num_in_chan_stats;
912 int survey_idx;
9927baa3 913 bool auto_tdls;
5e6e3a92
BZ
914};
915
e35000ea
ZL
916void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
917
5e6e3a92 918int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
5e6e3a92 919
bbea3bc4
AP
920void mwifiex_set_trans_start(struct net_device *dev);
921
922void mwifiex_stop_net_dev_queue(struct net_device *netdev,
923 struct mwifiex_adapter *adapter);
924
925void mwifiex_wake_up_net_dev_queue(struct net_device *netdev,
926 struct mwifiex_adapter *adapter);
927
9197ab9e
SP
928int mwifiex_init_priv(struct mwifiex_private *priv);
929void mwifiex_free_priv(struct mwifiex_private *priv);
930
5e6e3a92
BZ
931int mwifiex_init_fw(struct mwifiex_adapter *adapter);
932
933int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter);
934
935int mwifiex_shutdown_drv(struct mwifiex_adapter *adapter);
936
937int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter);
938
939int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *);
940
f3b369e4 941int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb);
5e6e3a92 942
f3b369e4 943int mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
2dbaf751
SP
944 struct sk_buff *skb);
945
5e6e3a92
BZ
946int mwifiex_process_event(struct mwifiex_adapter *adapter);
947
efaaa8b8
AK
948int mwifiex_complete_cmd(struct mwifiex_adapter *adapter,
949 struct cmd_ctrl_node *cmd_node);
5e6e3a92 950
fa0ecbb9
BZ
951int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
952 u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync);
5e6e3a92
BZ
953
954void mwifiex_cmd_timeout_func(unsigned long function_context);
955
5e6e3a92
BZ
956int mwifiex_get_debug_info(struct mwifiex_private *,
957 struct mwifiex_debug_info *);
958
959int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter);
960int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter);
961void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter);
600f5d90 962void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter);
5e6e3a92
BZ
963
964void mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter,
965 struct cmd_ctrl_node *cmd_node);
9908b074
BZ
966void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter,
967 struct cmd_ctrl_node *cmd_node);
5e6e3a92
BZ
968
969void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
970 struct cmd_ctrl_node *cmd_node,
971 u32 addtail);
972
973int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter);
974int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter);
975int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
976 struct sk_buff *skb);
977int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
978 struct mwifiex_tx_param *tx_param);
979int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags);
980int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
47411a06 981 struct sk_buff *skb, int aggr, int status);
5e6e3a92
BZ
982void mwifiex_clean_txrx(struct mwifiex_private *priv);
983u8 mwifiex_check_last_packet_indication(struct mwifiex_private *priv);
984void mwifiex_check_ps_cond(struct mwifiex_adapter *adapter);
985void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *, u8 *,
986 u32);
987int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
988 struct host_cmd_ds_command *cmd,
989 u16 cmd_action, uint16_t ps_bitmap,
a5ffddb7 990 struct mwifiex_ds_auto_ds *auto_ds);
5e6e3a92
BZ
991int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
992 struct host_cmd_ds_command *resp,
a5ffddb7 993 struct mwifiex_ds_pm_cfg *pm_cfg);
5e6e3a92
BZ
994void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
995void mwifiex_hs_activated_event(struct mwifiex_private *priv,
996 u8 activated);
937a5045
XH
997int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
998 int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg);
5e6e3a92
BZ
999int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
1000 struct host_cmd_ds_command *resp);
f3b369e4 1001int mwifiex_process_rx_packet(struct mwifiex_private *priv,
5e6e3a92
BZ
1002 struct sk_buff *skb);
1003int mwifiex_sta_prepare_cmd(struct mwifiex_private *, uint16_t cmd_no,
1004 u16 cmd_action, u32 cmd_oid,
1005 void *data_buf, void *cmd_buf);
40d07030
AP
1006int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
1007 u16 cmd_action, u32 cmd_oid,
1008 void *data_buf, void *cmd_buf);
5e6e3a92 1009int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no,
a5ffddb7 1010 struct host_cmd_ds_command *resp);
f3b369e4 1011int mwifiex_process_sta_rx_packet(struct mwifiex_private *,
5e6e3a92 1012 struct sk_buff *skb);
f3b369e4 1013int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
838e4f44
AP
1014 struct sk_buff *skb);
1015int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv,
1016 struct sk_buff *skb);
5e6e3a92 1017int mwifiex_process_sta_event(struct mwifiex_private *);
3d99d987 1018int mwifiex_process_uap_event(struct mwifiex_private *);
017a92a1 1019void mwifiex_delete_all_station_list(struct mwifiex_private *priv);
9817fffb
AP
1020void mwifiex_wmm_del_peer_ra_list(struct mwifiex_private *priv,
1021 const u8 *ra_addr);
5e6e3a92 1022void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb);
4ac8764a 1023void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb);
1247cc1f 1024int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta, bool init);
572e8f3e 1025int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd,
a5ffddb7 1026 struct mwifiex_scan_cmd_config *scan_cfg);
5e6e3a92
BZ
1027void mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
1028 struct cmd_ctrl_node *cmd_node);
1029int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
600f5d90 1030 struct host_cmd_ds_command *resp);
b9be5f39 1031s32 mwifiex_ssid_cmp(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2);
600f5d90 1032int mwifiex_associate(struct mwifiex_private *priv,
5e6e3a92
BZ
1033 struct mwifiex_bssdescriptor *bss_desc);
1034int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
a5ffddb7
AK
1035 struct host_cmd_ds_command *cmd,
1036 struct mwifiex_bssdescriptor *bss_desc);
5e6e3a92 1037int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
600f5d90 1038 struct host_cmd_ds_command *resp);
8cc1d523 1039void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason);
5e6e3a92 1040u8 mwifiex_band_to_radio_type(u8 band);
600f5d90 1041int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
848819f4 1042void mwifiex_deauthenticate_all(struct mwifiex_adapter *adapter);
600f5d90 1043int mwifiex_adhoc_start(struct mwifiex_private *priv,
b9be5f39 1044 struct cfg80211_ssid *adhoc_ssid);
600f5d90 1045int mwifiex_adhoc_join(struct mwifiex_private *priv,
5e6e3a92
BZ
1046 struct mwifiex_bssdescriptor *bss_desc);
1047int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
1048 struct host_cmd_ds_command *cmd,
b9be5f39 1049 struct cfg80211_ssid *req_ssid);
5e6e3a92
BZ
1050int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1051 struct host_cmd_ds_command *cmd,
a5ffddb7 1052 struct mwifiex_bssdescriptor *bss_desc);
5e6e3a92 1053int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
600f5d90 1054 struct host_cmd_ds_command *resp);
572e8f3e 1055int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd);
6685d109
YAP
1056struct mwifiex_chan_freq_power *mwifiex_get_cfp(struct mwifiex_private *priv,
1057 u8 band, u16 channel, u32 freq);
a5f39056
YAP
1058u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv,
1059 u8 index, u8 ht_info);
1060u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv,
1061 u8 index, u8 ht_info);
5e6e3a92
BZ
1062u32 mwifiex_find_freq_from_band_chan(u8, u8);
1063int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask,
1064 u8 **buffer);
5e6e3a92
BZ
1065u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv,
1066 u8 *rates);
1067u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates);
78dfca62
AP
1068u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv,
1069 u8 *rates, u8 radio_type);
5e6e3a92 1070u8 mwifiex_is_rate_auto(struct mwifiex_private *priv);
5e6e3a92
BZ
1071extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE];
1072void mwifiex_save_curr_bcn(struct mwifiex_private *priv);
1073void mwifiex_free_curr_bcn(struct mwifiex_private *priv);
1074int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv,
1075 struct host_cmd_ds_command *cmd);
1076int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
1077 struct host_cmd_ds_command *resp);
1078int is_command_pending(struct mwifiex_adapter *adapter);
93a1df48
YAP
1079void mwifiex_init_priv_params(struct mwifiex_private *priv,
1080 struct net_device *dev);
f752dcd5
AP
1081int mwifiex_set_secure_params(struct mwifiex_private *priv,
1082 struct mwifiex_uap_bss_param *bss_config,
1083 struct cfg80211_ap_settings *params);
22281256
AP
1084void mwifiex_set_ht_params(struct mwifiex_private *priv,
1085 struct mwifiex_uap_bss_param *bss_cfg,
1086 struct cfg80211_ap_settings *params);
83c78da9
YAP
1087void mwifiex_set_vht_params(struct mwifiex_private *priv,
1088 struct mwifiex_uap_bss_param *bss_cfg,
1089 struct cfg80211_ap_settings *params);
a3c2c4f6
AP
1090void mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
1091 struct cfg80211_ap_settings *params);
83c78da9
YAP
1092void mwifiex_set_vht_width(struct mwifiex_private *priv,
1093 enum nl80211_chan_width width,
1094 bool ap_11ac_disable);
54428c57
AP
1095void
1096mwifiex_set_wmm_params(struct mwifiex_private *priv,
1097 struct mwifiex_uap_bss_param *bss_cfg,
1098 struct cfg80211_ap_settings *params);
04abc0a3 1099void mwifiex_set_ba_params(struct mwifiex_private *priv);
2b6254da 1100void mwifiex_set_11ac_ba_params(struct mwifiex_private *priv);
21f58d20
AK
1101int mwifiex_cmd_802_11_scan_ext(struct mwifiex_private *priv,
1102 struct host_cmd_ds_command *cmd,
1103 void *data_buf);
bf354433
AP
1104int mwifiex_ret_802_11_scan_ext(struct mwifiex_private *priv,
1105 struct host_cmd_ds_command *resp);
21f58d20
AK
1106int mwifiex_handle_event_ext_scan_report(struct mwifiex_private *priv,
1107 void *buf);
5e6e3a92
BZ
1108
1109/*
1110 * This function checks if the queuing is RA based or not.
1111 */
1112static inline u8
1113mwifiex_queuing_ra_based(struct mwifiex_private *priv)
1114{
1115 /*
1116 * Currently we assume if we are in Infra, then DA=RA. This might not be
1117 * true in the future
1118 */
eecd8250 1119 if ((priv->bss_mode == NL80211_IFTYPE_STATION) &&
5e6e3a92
BZ
1120 (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA))
1121 return false;
1122
1123 return true;
1124}
1125
1126/*
1127 * This function copies rates.
1128 */
1129static inline u32
1130mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len)
1131{
1132 int i;
1133
1134 for (i = 0; i < len && src[i]; i++, pos++) {
1135 if (pos >= MWIFIEX_SUPPORTED_RATES)
1136 break;
1137 dest[pos] = src[i];
1138 }
1139
1140 return pos;
1141}
1142
1143/*
1144 * This function returns the correct private structure pointer based
1145 * upon the BSS type and BSS number.
1146 */
1147static inline struct mwifiex_private *
1148mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter,
2be7859f 1149 u8 bss_num, u8 bss_type)
5e6e3a92
BZ
1150{
1151 int i;
1152
1153 for (i = 0; i < adapter->priv_num; i++) {
1154 if (adapter->priv[i]) {
f57c1edc
YAP
1155 if ((adapter->priv[i]->bss_num == bss_num) &&
1156 (adapter->priv[i]->bss_type == bss_type))
5e6e3a92
BZ
1157 break;
1158 }
1159 }
1160 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
1161}
1162
1163/*
1164 * This function returns the first available private structure pointer
1165 * based upon the BSS role.
1166 */
1167static inline struct mwifiex_private *
1168mwifiex_get_priv(struct mwifiex_adapter *adapter,
1169 enum mwifiex_bss_role bss_role)
1170{
1171 int i;
1172
1173 for (i = 0; i < adapter->priv_num; i++) {
1174 if (adapter->priv[i]) {
1175 if (bss_role == MWIFIEX_BSS_ROLE_ANY ||
1176 GET_BSS_ROLE(adapter->priv[i]) == bss_role)
1177 break;
1178 }
1179 }
1180
1181 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
1182}
1183
cf052335
AP
1184/*
1185 * This function returns the first available unused private structure pointer.
1186 */
1187static inline struct mwifiex_private *
1188mwifiex_get_unused_priv(struct mwifiex_adapter *adapter)
1189{
1190 int i;
1191
1192 for (i = 0; i < adapter->priv_num; i++) {
1193 if (adapter->priv[i]) {
1194 if (adapter->priv[i]->bss_mode ==
1195 NL80211_IFTYPE_UNSPECIFIED)
1196 break;
1197 }
1198 }
1199
1200 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
1201}
1202
5e6e3a92
BZ
1203/*
1204 * This function returns the driver private structure of a network device.
1205 */
1206static inline struct mwifiex_private *
1207mwifiex_netdev_get_priv(struct net_device *dev)
1208{
1209 return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev));
1210}
1211
e39faa73
SP
1212/*
1213 * This function checks if a skb holds a management frame.
1214 */
1215static inline bool mwifiex_is_skb_mgmt_frame(struct sk_buff *skb)
1216{
cfcd926e 1217 return (le32_to_cpu(*(__le32 *)skb->data) == PKT_TYPE_MGMT);
e39faa73
SP
1218}
1219
b887664d
AK
1220/* This function retrieves channel closed for operation by Channel
1221 * Switch Announcement.
1222 */
1223static inline u8
1224mwifiex_11h_get_csa_closed_channel(struct mwifiex_private *priv)
1225{
1226 if (!priv->csa_chan)
1227 return 0;
1228
1229 /* Clear csa channel, if DFS channel move time has passed */
55fdb858 1230 if (time_after(jiffies, priv->csa_expire_time)) {
b887664d
AK
1231 priv->csa_chan = 0;
1232 priv->csa_expire_time = 0;
1233 }
1234
1235 return priv->csa_chan;
1236}
1237
cb91be87
AP
1238static inline u8 mwifiex_is_any_intf_active(struct mwifiex_private *priv)
1239{
1240 struct mwifiex_private *priv_num;
1241 int i;
1242
1243 for (i = 0; i < priv->adapter->priv_num; i++) {
1244 priv_num = priv->adapter->priv[i];
1245 if (priv_num) {
1246 if ((GET_BSS_ROLE(priv_num) == MWIFIEX_BSS_ROLE_UAP &&
1247 priv_num->bss_started) ||
1248 (GET_BSS_ROLE(priv_num) == MWIFIEX_BSS_ROLE_STA &&
1249 priv_num->media_connected))
1250 return 1;
1251 }
1252 }
1253
1254 return 0;
1255}
1256
600f5d90
AK
1257int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
1258 u32 func_init_shutdown);
d930faee 1259int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8);
5e6e3a92
BZ
1260int mwifiex_remove_card(struct mwifiex_adapter *, struct semaphore *);
1261
1262void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version,
1263 int maxlen);
600f5d90
AK
1264int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
1265 struct mwifiex_multicast_list *mcast_list);
1266int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
1267 struct net_device *dev);
00d7ea11
AK
1268int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
1269 struct cmd_ctrl_node *cmd_queued);
7c6fa2a8 1270int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
b9be5f39 1271 struct cfg80211_ssid *req_ssid);
600f5d90 1272int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
5e6e3a92 1273int mwifiex_enable_hs(struct mwifiex_adapter *adapter);
a0490936 1274int mwifiex_disable_auto_ds(struct mwifiex_private *priv);
006606c0 1275int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate);
5e6e3a92 1276int mwifiex_request_scan(struct mwifiex_private *priv,
b9be5f39 1277 struct cfg80211_ssid *req_ssid);
1a1fb970
AK
1278int mwifiex_scan_networks(struct mwifiex_private *priv,
1279 const struct mwifiex_user_scan_cfg *user_scan_in);
5e6e3a92
BZ
1280int mwifiex_set_radio(struct mwifiex_private *priv, u8 option);
1281
53b11231
YL
1282int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp,
1283 const u8 *key, int key_len, u8 key_index,
1284 const u8 *mac_addr, int disable);
5e6e3a92 1285
4b5800fe 1286int mwifiex_set_gen_ie(struct mwifiex_private *priv, const u8 *ie, int ie_len);
5e6e3a92
BZ
1287
1288int mwifiex_get_ver_ext(struct mwifiex_private *priv);
1289
7feb4c48
SP
1290int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action,
1291 struct ieee80211_channel *chan,
7feb4c48
SP
1292 unsigned int duration);
1293
5e6e3a92
BZ
1294int mwifiex_get_stats_info(struct mwifiex_private *priv,
1295 struct mwifiex_ds_get_stats *log);
1296
1297int mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type,
1298 u32 reg_offset, u32 reg_value);
1299
1300int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type,
1301 u32 reg_offset, u32 *value);
1302
1303int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes,
1304 u8 *value);
1305
1306int mwifiex_set_11n_httx_cfg(struct mwifiex_private *priv, int data);
1307
1308int mwifiex_get_11n_httx_cfg(struct mwifiex_private *priv, int *data);
1309
1310int mwifiex_set_tx_rate_cfg(struct mwifiex_private *priv, int tx_rate_index);
1311
1312int mwifiex_get_tx_rate_cfg(struct mwifiex_private *priv, int *tx_rate_index);
1313
600f5d90 1314int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode);
5e6e3a92
BZ
1315
1316int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter,
1317 char *version, int max_len);
1318
600f5d90
AK
1319int mwifiex_set_tx_power(struct mwifiex_private *priv,
1320 struct mwifiex_power_cfg *power_cfg);
5e6e3a92
BZ
1321
1322int mwifiex_main_process(struct mwifiex_adapter *);
1323
e39faa73
SP
1324int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb);
1325
5e6e3a92
BZ
1326int mwifiex_get_bss_info(struct mwifiex_private *,
1327 struct mwifiex_bss_info *);
7c6fa2a8 1328int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
9558a407 1329 struct cfg80211_bss *bss,
7c6fa2a8
AK
1330 struct mwifiex_bssdescriptor *bss_desc);
1331int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
9558a407 1332 struct mwifiex_bssdescriptor *bss_entry);
7c6fa2a8
AK
1333int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
1334 struct mwifiex_bssdescriptor *bss_desc);
5e6e3a92 1335
7feb4c48
SP
1336u8 mwifiex_chan_type_to_sec_chan_offset(enum nl80211_channel_type chan_type);
1337
84efbb84 1338struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
552bff0c 1339 const char *name,
84efbb84
JB
1340 enum nl80211_iftype type,
1341 u32 *flags,
1342 struct vif_params *params);
1343int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
93a1df48 1344
9b930eae
AP
1345void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config);
1346
7da060c1
AK
1347int mwifiex_add_wowlan_magic_pkt_filter(struct mwifiex_adapter *adapter);
1348
f31acabe 1349int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
adb6ed0c 1350 struct cfg80211_beacon_data *data);
40bbc21a 1351int mwifiex_del_mgmt_ies(struct mwifiex_private *priv);
9e04a7c6 1352u8 *mwifiex_11d_code_2_region(u8 code);
b654ca18
AP
1353void mwifiex_uap_set_channel(struct mwifiex_uap_bss_param *bss_cfg,
1354 struct cfg80211_chan_def chandef);
1355int mwifiex_config_start_uap(struct mwifiex_private *priv,
1356 struct mwifiex_uap_bss_param *bss_cfg);
0f9e9b8b
AP
1357void mwifiex_uap_del_sta_data(struct mwifiex_private *priv,
1358 struct mwifiex_sta_node *node);
93a1df48 1359
cf075eac
AP
1360void mwifiex_init_11h_params(struct mwifiex_private *priv);
1361int mwifiex_is_11h_active(struct mwifiex_private *priv);
1362int mwifiex_11h_activate(struct mwifiex_private *priv, bool flag);
1363
2a7305c8
AK
1364void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer,
1365 struct mwifiex_bssdescriptor *bss_desc);
1366int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv);
82efa16a
BZ
1367int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv,
1368 struct device_node *node, const char *prefix);
b58df446 1369void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv);
2a7305c8 1370
0d7f53e3
AK
1371extern const struct ethtool_ops mwifiex_ethtool_ops;
1372
4bcf93d3 1373void mwifiex_del_all_sta_list(struct mwifiex_private *priv);
3b3a0162 1374void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac);
4bcf93d3
AP
1375void
1376mwifiex_set_sta_ht_cap(struct mwifiex_private *priv, const u8 *ies,
1377 int ies_len, struct mwifiex_sta_node *node);
1378struct mwifiex_sta_node *
3b3a0162 1379mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac);
4bcf93d3 1380struct mwifiex_sta_node *
3b3a0162
JB
1381mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac);
1382int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer,
b23bce29
AP
1383 u8 action_code, u8 dialog_token,
1384 u16 status_code, const u8 *extra_ies,
1385 size_t extra_ies_len);
3b3a0162
JB
1386int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer,
1387 u8 action_code, u8 dialog_token,
1388 u16 status_code, const u8 *extra_ies,
1389 size_t extra_ies_len);
5f2caaf3
AP
1390void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
1391 u8 *buf, int len);
3b3a0162
JB
1392int mwifiex_tdls_oper(struct mwifiex_private *priv, const u8 *peer, u8 action);
1393int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac);
72df6310
XH
1394int mwifiex_get_tdls_list(struct mwifiex_private *priv,
1395 struct tdls_peer_info *buf);
be104b91 1396void mwifiex_disable_all_tdls_links(struct mwifiex_private *priv);
5f6d5983
AP
1397bool mwifiex_is_bss_in_11ac_mode(struct mwifiex_private *priv);
1398u8 mwifiex_get_center_freq_index(struct mwifiex_private *priv, u8 band,
1399 u32 pri_chan, u8 chan_bw);
cb91be87 1400int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter);
4bcf93d3 1401
9927baa3
AP
1402int mwifiex_tdls_check_tx(struct mwifiex_private *priv, struct sk_buff *skb);
1403void mwifiex_flush_auto_tdls_list(struct mwifiex_private *priv);
1404void mwifiex_auto_tdls_update_peer_status(struct mwifiex_private *priv,
1405 const u8 *mac, u8 link_status);
1406void mwifiex_auto_tdls_update_peer_signal(struct mwifiex_private *priv,
1407 u8 *mac, s8 snr, s8 nflr);
1408void mwifiex_check_auto_tdls(unsigned long context);
1409void mwifiex_add_auto_tdls_peer(struct mwifiex_private *priv, const u8 *mac);
1410void mwifiex_setup_auto_tdls_timer(struct mwifiex_private *priv);
1411void mwifiex_clean_auto_tdls(struct mwifiex_private *priv);
85afb186
AP
1412int mwifiex_cmd_issue_chan_report_request(struct mwifiex_private *priv,
1413 struct host_cmd_ds_command *cmd,
1414 void *data_buf);
0a694d68
AP
1415int mwifiex_11h_handle_chanrpt_ready(struct mwifiex_private *priv,
1416 struct sk_buff *skb);
9927baa3 1417
808bbebc
AK
1418void mwifiex_parse_tx_status_event(struct mwifiex_private *priv,
1419 void *event_body);
1420
18ca4382
AK
1421struct sk_buff *
1422mwifiex_clone_skb_for_tx_status(struct mwifiex_private *priv,
1423 struct sk_buff *skb, u8 flag, u64 *cookie);
85afb186 1424void mwifiex_dfs_cac_work_queue(struct work_struct *work);
7d652034 1425void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work);
85afb186 1426void mwifiex_abort_cac(struct mwifiex_private *priv);
3b57c1a7
AP
1427int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
1428 struct sk_buff *skb);
18ca4382 1429
cbf6e055
XH
1430void mwifiex_hist_data_set(struct mwifiex_private *priv, u8 rx_rate, s8 snr,
1431 s8 nflr);
1432void mwifiex_hist_data_reset(struct mwifiex_private *priv);
1433void mwifiex_hist_data_add(struct mwifiex_private *priv,
1434 u8 rx_rate, s8 snr, s8 nflr);
1435u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv,
1436 u8 rx_rate, u8 ht_info);
1437
11cd07a9 1438void mwifiex_dump_drv_info(struct mwifiex_adapter *adapter);
62159944 1439void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
b2713f67 1440void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
11cd07a9 1441
5e6e3a92
BZ
1442#ifdef CONFIG_DEBUG_FS
1443void mwifiex_debugfs_init(void);
1444void mwifiex_debugfs_remove(void);
1445
1446void mwifiex_dev_debugfs_init(struct mwifiex_private *priv);
1447void mwifiex_dev_debugfs_remove(struct mwifiex_private *priv);
1448#endif
1449#endif /* !_MWIFIEX_MAIN_H_ */
This page took 0.479383 seconds and 5 git commands to generate.