1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * NXP Wireless LAN device driver: major data structures and prototypes
4  *
5  * Copyright 2011-2020 NXP
6  */
7 
8 #ifndef _MWIFIEX_MAIN_H_
9 #define _MWIFIEX_MAIN_H_
10 
11 #include <linux/completion.h>
12 #include <linux/kernel.h>
13 #include <linux/kstrtox.h>
14 #include <linux/module.h>
15 #include <linux/sched.h>
16 #include <linux/semaphore.h>
17 #include <linux/ip.h>
18 #include <linux/skbuff.h>
19 #include <linux/if_arp.h>
20 #include <linux/etherdevice.h>
21 #include <net/sock.h>
22 #include <net/lib80211.h>
23 #include <linux/vmalloc.h>
24 #include <linux/firmware.h>
25 #include <linux/ctype.h>
26 #include <linux/of.h>
27 #include <linux/idr.h>
28 #include <linux/inetdevice.h>
29 #include <linux/devcoredump.h>
30 #include <linux/err.h>
31 #include <linux/gpio.h>
32 #include <linux/gfp.h>
33 #include <linux/interrupt.h>
34 #include <linux/io.h>
35 #include <linux/of_gpio.h>
36 #include <linux/of_platform.h>
37 #include <linux/platform_device.h>
38 #include <linux/pm_runtime.h>
39 #include <linux/slab.h>
40 #include <linux/of_irq.h>
41 #include <linux/workqueue.h>
42 
43 #include "decl.h"
44 #include "ioctl.h"
45 #include "util.h"
46 #include "fw.h"
47 #include "pcie.h"
48 #include "usb.h"
49 #include "sdio.h"
50 
51 extern const char driver_version[];
52 extern bool mfg_mode;
53 extern bool aggr_ctrl;
54 
55 struct mwifiex_adapter;
56 struct mwifiex_private;
57 
58 enum {
59 	MWIFIEX_ASYNC_CMD,
60 	MWIFIEX_SYNC_CMD
61 };
62 
63 #define MWIFIEX_DRIVER_MODE_STA			BIT(0)
64 #define MWIFIEX_DRIVER_MODE_UAP			BIT(1)
65 #define MWIFIEX_DRIVER_MODE_P2P			BIT(2)
66 #define MWIFIEX_DRIVER_MODE_BITMASK		(BIT(0) | BIT(1) | BIT(2))
67 
68 #define MWIFIEX_MAX_AP				64
69 
70 #define MWIFIEX_MAX_PKTS_TXQ			16
71 
72 #define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT	(5 * HZ)
73 
74 #define MWIFIEX_TIMER_10S			10000
75 #define MWIFIEX_TIMER_1S			1000
76 
77 #define MAX_TX_PENDING      400
78 #define LOW_TX_PENDING      380
79 
80 #define HIGH_RX_PENDING     50
81 #define LOW_RX_PENDING      20
82 
83 #define MWIFIEX_UPLD_SIZE               (2312)
84 
85 #define MAX_EVENT_SIZE                  2048
86 
87 #define MWIFIEX_FW_DUMP_SIZE       (2 * 1024 * 1024)
88 
89 #define ARP_FILTER_MAX_BUF_SIZE         68
90 
91 #define MWIFIEX_KEY_BUFFER_SIZE			16
92 #define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
93 #define MWIFIEX_MAX_REGION_CODE         9
94 
95 #define DEFAULT_BCN_AVG_FACTOR          8
96 #define DEFAULT_DATA_AVG_FACTOR         8
97 
98 #define FIRST_VALID_CHANNEL				0xff
99 #define DEFAULT_AD_HOC_CHANNEL			6
100 #define DEFAULT_AD_HOC_CHANNEL_A		36
101 
102 #define DEFAULT_BCN_MISS_TIMEOUT		5
103 
104 #define MAX_SCAN_BEACON_BUFFER			8000
105 
106 #define SCAN_BEACON_ENTRY_PAD			6
107 
108 #define MWIFIEX_PASSIVE_SCAN_CHAN_TIME	110
109 #define MWIFIEX_ACTIVE_SCAN_CHAN_TIME	40
110 #define MWIFIEX_SPECIFIC_SCAN_CHAN_TIME	40
111 #define MWIFIEX_DEF_SCAN_CHAN_GAP_TIME  50
112 
113 #define SCAN_RSSI(RSSI)					(0x100 - ((u8)(RSSI)))
114 
115 #define MWIFIEX_MAX_TOTAL_SCAN_TIME	(MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S)
116 
117 #define WPA_GTK_OUI_OFFSET				2
118 #define RSN_GTK_OUI_OFFSET				2
119 
120 #define MWIFIEX_OUI_NOT_PRESENT			0
121 #define MWIFIEX_OUI_PRESENT				1
122 
123 #define PKT_TYPE_MGMT	0xE5
124 
125 /*
126  * Do not check for data_received for USB, as data_received
127  * is handled in mwifiex_usb_recv for USB
128  */
129 #define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \
130 				adapter->event_received || \
131 				adapter->data_received)
132 
133 #define MWIFIEX_TYPE_CMD				1
134 #define MWIFIEX_TYPE_DATA				0
135 #define MWIFIEX_TYPE_AGGR_DATA				10
136 #define MWIFIEX_TYPE_EVENT				3
137 
138 #define MAX_BITMAP_RATES_SIZE			18
139 
140 #define MAX_CHANNEL_BAND_BG     14
141 #define MAX_CHANNEL_BAND_A      165
142 
143 #define MAX_FREQUENCY_BAND_BG   2484
144 
145 #define MWIFIEX_EVENT_HEADER_LEN           4
146 #define MWIFIEX_UAP_EVENT_EXTRA_HEADER	   2
147 
148 #define MWIFIEX_TYPE_LEN			4
149 #define MWIFIEX_USB_TYPE_CMD			0xF00DFACE
150 #define MWIFIEX_USB_TYPE_DATA			0xBEADC0DE
151 #define MWIFIEX_USB_TYPE_EVENT			0xBEEFFACE
152 
153 /* Threshold for tx_timeout_cnt before we trigger a card reset */
154 #define TX_TIMEOUT_THRESHOLD	6
155 
156 #define MWIFIEX_DRV_INFO_SIZE_MAX 0x40000
157 
158 /* Address alignment */
159 #define MWIFIEX_ALIGN_ADDR(p, a) (((long)(p) + (a) - 1) & ~((a) - 1))
160 
161 #define MWIFIEX_MAC_LOCAL_ADMIN_BIT		41
162 
163 /**
164  *enum mwifiex_debug_level  -  marvell wifi debug level
165  */
166 enum MWIFIEX_DEBUG_LEVEL {
167 	MWIFIEX_DBG_MSG		= 0x00000001,
168 	MWIFIEX_DBG_FATAL	= 0x00000002,
169 	MWIFIEX_DBG_ERROR	= 0x00000004,
170 	MWIFIEX_DBG_DATA	= 0x00000008,
171 	MWIFIEX_DBG_CMD		= 0x00000010,
172 	MWIFIEX_DBG_EVENT	= 0x00000020,
173 	MWIFIEX_DBG_INTR	= 0x00000040,
174 	MWIFIEX_DBG_IOCTL	= 0x00000080,
175 
176 	MWIFIEX_DBG_MPA_D	= 0x00008000,
177 	MWIFIEX_DBG_DAT_D	= 0x00010000,
178 	MWIFIEX_DBG_CMD_D	= 0x00020000,
179 	MWIFIEX_DBG_EVT_D	= 0x00040000,
180 	MWIFIEX_DBG_FW_D	= 0x00080000,
181 	MWIFIEX_DBG_IF_D	= 0x00100000,
182 
183 	MWIFIEX_DBG_ENTRY	= 0x10000000,
184 	MWIFIEX_DBG_WARN	= 0x20000000,
185 	MWIFIEX_DBG_INFO	= 0x40000000,
186 	MWIFIEX_DBG_DUMP	= 0x80000000,
187 
188 	MWIFIEX_DBG_ANY		= 0xffffffff
189 };
190 
191 #define MWIFIEX_DEFAULT_DEBUG_MASK	(MWIFIEX_DBG_MSG | \
192 					MWIFIEX_DBG_FATAL | \
193 					MWIFIEX_DBG_ERROR)
194 
195 __printf(3, 4)
196 void _mwifiex_dbg(const struct mwifiex_adapter *adapter, int mask,
197 		  const char *fmt, ...);
198 #define mwifiex_dbg(adapter, mask, fmt, ...)				\
199 	_mwifiex_dbg(adapter, MWIFIEX_DBG_##mask, fmt, ##__VA_ARGS__)
200 
201 #define DEBUG_DUMP_DATA_MAX_LEN		128
202 #define mwifiex_dbg_dump(adapter, dbg_mask, str, buf, len)	\
203 do {								\
204 	if ((adapter)->debug_mask & MWIFIEX_DBG_##dbg_mask)	\
205 		print_hex_dump(KERN_DEBUG, str,			\
206 			       DUMP_PREFIX_OFFSET, 16, 1,	\
207 			       buf, len, false);		\
208 } while (0)
209 
210 /** Min BGSCAN interval 15 second */
211 #define MWIFIEX_BGSCAN_INTERVAL 15000
212 /** default repeat count */
213 #define MWIFIEX_BGSCAN_REPEAT_COUNT 6
214 
215 struct mwifiex_dbg {
216 	u32 num_cmd_host_to_card_failure;
217 	u32 num_cmd_sleep_cfm_host_to_card_failure;
218 	u32 num_tx_host_to_card_failure;
219 	u32 num_event_deauth;
220 	u32 num_event_disassoc;
221 	u32 num_event_link_lost;
222 	u32 num_cmd_deauth;
223 	u32 num_cmd_assoc_success;
224 	u32 num_cmd_assoc_failure;
225 	u32 num_tx_timeout;
226 	u16 timeout_cmd_id;
227 	u16 timeout_cmd_act;
228 	u16 last_cmd_id[DBG_CMD_NUM];
229 	u16 last_cmd_act[DBG_CMD_NUM];
230 	u16 last_cmd_index;
231 	u16 last_cmd_resp_id[DBG_CMD_NUM];
232 	u16 last_cmd_resp_index;
233 	u16 last_event[DBG_CMD_NUM];
234 	u16 last_event_index;
235 	u32 last_mp_wr_bitmap[MWIFIEX_DBG_SDIO_MP_NUM];
236 	u32 last_mp_wr_ports[MWIFIEX_DBG_SDIO_MP_NUM];
237 	u32 last_mp_wr_len[MWIFIEX_DBG_SDIO_MP_NUM];
238 	u32 last_mp_curr_wr_port[MWIFIEX_DBG_SDIO_MP_NUM];
239 	u8 last_sdio_mp_index;
240 };
241 
242 enum MWIFIEX_HARDWARE_STATUS {
243 	MWIFIEX_HW_STATUS_READY,
244 	MWIFIEX_HW_STATUS_INITIALIZING,
245 	MWIFIEX_HW_STATUS_INIT_DONE,
246 	MWIFIEX_HW_STATUS_RESET,
247 	MWIFIEX_HW_STATUS_NOT_READY
248 };
249 
250 enum MWIFIEX_802_11_POWER_MODE {
251 	MWIFIEX_802_11_POWER_MODE_CAM,
252 	MWIFIEX_802_11_POWER_MODE_PSP
253 };
254 
255 struct mwifiex_tx_param {
256 	u32 next_pkt_len;
257 };
258 
259 enum MWIFIEX_PS_STATE {
260 	PS_STATE_AWAKE,
261 	PS_STATE_PRE_SLEEP,
262 	PS_STATE_SLEEP_CFM,
263 	PS_STATE_SLEEP
264 };
265 
266 enum mwifiex_iface_type {
267 	MWIFIEX_SDIO,
268 	MWIFIEX_PCIE,
269 	MWIFIEX_USB
270 };
271 
272 struct mwifiex_add_ba_param {
273 	u32 tx_win_size;
274 	u32 rx_win_size;
275 	u32 timeout;
276 	u8 tx_amsdu;
277 	u8 rx_amsdu;
278 };
279 
280 struct mwifiex_tx_aggr {
281 	u8 ampdu_user;
282 	u8 ampdu_ap;
283 	u8 amsdu;
284 };
285 
286 enum mwifiex_ba_status {
287 	BA_SETUP_NONE = 0,
288 	BA_SETUP_INPROGRESS,
289 	BA_SETUP_COMPLETE
290 };
291 
292 struct mwifiex_ra_list_tbl {
293 	struct list_head list;
294 	struct sk_buff_head skb_head;
295 	u8 ra[ETH_ALEN];
296 	u32 is_11n_enabled;
297 	u16 max_amsdu;
298 	u16 ba_pkt_count;
299 	u8 ba_packet_thr;
300 	enum mwifiex_ba_status ba_status;
301 	u8 amsdu_in_ampdu;
302 	u16 total_pkt_count;
303 	bool tdls_link;
304 	bool tx_paused;
305 };
306 
307 struct mwifiex_tid_tbl {
308 	struct list_head ra_list;
309 };
310 
311 #define WMM_HIGHEST_PRIORITY		7
312 #define HIGH_PRIO_TID				7
313 #define LOW_PRIO_TID				0
314 #define NO_PKT_PRIO_TID				-1
315 #define MWIFIEX_WMM_DRV_DELAY_MAX 510
316 
317 struct mwifiex_wmm_desc {
318 	struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID];
319 	u32 packets_out[MAX_NUM_TID];
320 	u32 pkts_paused[MAX_NUM_TID];
321 	/* spin lock to protect ra_list */
322 	spinlock_t ra_list_spinlock;
323 	struct mwifiex_wmm_ac_status ac_status[IEEE80211_NUM_ACS];
324 	enum mwifiex_wmm_ac_e ac_down_graded_vals[IEEE80211_NUM_ACS];
325 	u32 drv_pkt_delay_max;
326 	u8 queue_priority[IEEE80211_NUM_ACS];
327 	u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1];	/* UP: 0 to 7 */
328 	/* Number of transmit packets queued */
329 	atomic_t tx_pkts_queued;
330 	/* Tracks highest priority with a packet queued */
331 	atomic_t highest_queued_prio;
332 };
333 
334 struct mwifiex_802_11_security {
335 	u8 wpa_enabled;
336 	u8 wpa2_enabled;
337 	u8 wapi_enabled;
338 	u8 wapi_key_on;
339 	u8 wep_enabled;
340 	u32 authentication_mode;
341 	u8 is_authtype_auto;
342 	u32 encryption_mode;
343 };
344 
345 struct ieee_types_header {
346 	u8 element_id;
347 	u8 len;
348 } __packed;
349 
350 struct ieee_types_vendor_specific {
351 	struct ieee_types_vendor_header vend_hdr;
352 	u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_vendor_header)];
353 } __packed;
354 
355 struct ieee_types_generic {
356 	struct ieee_types_header ieee_hdr;
357 	u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_header)];
358 } __packed;
359 
360 struct ieee_types_bss_co_2040 {
361 	struct ieee_types_header ieee_hdr;
362 	u8 bss_2040co;
363 } __packed;
364 
365 struct ieee_types_extcap {
366 	struct ieee_types_header ieee_hdr;
367 	u8 ext_capab[8];
368 } __packed;
369 
370 struct ieee_types_vht_cap {
371 	struct ieee_types_header ieee_hdr;
372 	struct ieee80211_vht_cap vhtcap;
373 } __packed;
374 
375 struct ieee_types_vht_oper {
376 	struct ieee_types_header ieee_hdr;
377 	struct ieee80211_vht_operation vhtoper;
378 } __packed;
379 
380 struct ieee_types_aid {
381 	struct ieee_types_header ieee_hdr;
382 	u16 aid;
383 } __packed;
384 
385 struct mwifiex_bssdescriptor {
386 	u8 mac_address[ETH_ALEN];
387 	struct cfg80211_ssid ssid;
388 	u32 privacy;
389 	s32 rssi;
390 	u32 channel;
391 	u32 freq;
392 	u16 beacon_period;
393 	u8 erp_flags;
394 	u32 bss_mode;
395 	u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
396 	u8 data_rates[MWIFIEX_SUPPORTED_RATES];
397 	/* Network band.
398 	 * BAND_B(0x01): 'b' band
399 	 * BAND_G(0x02): 'g' band
400 	 * BAND_A(0X04): 'a' band
401 	 */
402 	u16 bss_band;
403 	u64 fw_tsf;
404 	u64 timestamp;
405 	union ieee_types_phy_param_set phy_param_set;
406 	union ieee_types_ss_param_set ss_param_set;
407 	u16 cap_info_bitmap;
408 	struct ieee_types_wmm_parameter wmm_ie;
409 	u8  disable_11n;
410 	struct ieee80211_ht_cap *bcn_ht_cap;
411 	u16 ht_cap_offset;
412 	struct ieee80211_ht_operation *bcn_ht_oper;
413 	u16 ht_info_offset;
414 	u8 *bcn_bss_co_2040;
415 	u16 bss_co_2040_offset;
416 	u8 *bcn_ext_cap;
417 	u16 ext_cap_offset;
418 	struct ieee80211_vht_cap *bcn_vht_cap;
419 	u16 vht_cap_offset;
420 	struct ieee80211_vht_operation *bcn_vht_oper;
421 	u16 vht_info_offset;
422 	struct ieee_types_oper_mode_ntf *oper_mode;
423 	u16 oper_mode_offset;
424 	u8 disable_11ac;
425 	struct ieee_types_vendor_specific *bcn_wpa_ie;
426 	u16 wpa_offset;
427 	struct ieee_types_generic *bcn_rsn_ie;
428 	u16 rsn_offset;
429 	struct ieee_types_generic *bcn_wapi_ie;
430 	u16 wapi_offset;
431 	u8 *beacon_buf;
432 	u32 beacon_buf_size;
433 	u8 sensed_11h;
434 	u8 local_constraint;
435 	u8 chan_sw_ie_present;
436 };
437 
438 struct mwifiex_current_bss_params {
439 	struct mwifiex_bssdescriptor bss_descriptor;
440 	u8 wmm_enabled;
441 	u8 wmm_uapsd_enabled;
442 	u8 band;
443 	u32 num_of_rates;
444 	u8 data_rates[MWIFIEX_SUPPORTED_RATES];
445 };
446 
447 struct mwifiex_sleep_params {
448 	u16 sp_error;
449 	u16 sp_offset;
450 	u16 sp_stable_time;
451 	u8 sp_cal_control;
452 	u8 sp_ext_sleep_clk;
453 	u16 sp_reserved;
454 };
455 
456 struct mwifiex_sleep_period {
457 	u16 period;
458 	u16 reserved;
459 };
460 
461 struct mwifiex_wep_key {
462 	u32 length;
463 	u32 key_index;
464 	u32 key_length;
465 	u8 key_material[MWIFIEX_KEY_BUFFER_SIZE];
466 };
467 
468 #define MAX_REGION_CHANNEL_NUM  2
469 
470 struct mwifiex_chan_freq_power {
471 	u16 channel;
472 	u32 freq;
473 	u16 max_tx_power;
474 	u8 unsupported;
475 };
476 
477 enum state_11d_t {
478 	DISABLE_11D = 0,
479 	ENABLE_11D = 1,
480 };
481 
482 #define MWIFIEX_MAX_TRIPLET_802_11D		83
483 
484 struct mwifiex_802_11d_domain_reg {
485 	u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
486 	u8 no_of_triplet;
487 	struct ieee80211_country_ie_triplet
488 		triplet[MWIFIEX_MAX_TRIPLET_802_11D];
489 };
490 
491 struct mwifiex_vendor_spec_cfg_ie {
492 	u16 mask;
493 	u16 flag;
494 	u8 ie[MWIFIEX_MAX_VSIE_LEN];
495 };
496 
497 struct wps {
498 	u8 session_enable;
499 };
500 
501 struct mwifiex_roc_cfg {
502 	u64 cookie;
503 	struct ieee80211_channel chan;
504 };
505 
506 enum mwifiex_iface_work_flags {
507 	MWIFIEX_IFACE_WORK_DEVICE_DUMP,
508 	MWIFIEX_IFACE_WORK_CARD_RESET,
509 };
510 
511 enum mwifiex_adapter_work_flags {
512 	MWIFIEX_SURPRISE_REMOVED,
513 	MWIFIEX_IS_CMD_TIMEDOUT,
514 	MWIFIEX_IS_SUSPENDED,
515 	MWIFIEX_IS_HS_CONFIGURED,
516 	MWIFIEX_IS_HS_ENABLING,
517 	MWIFIEX_IS_REQUESTING_FW_VEREXT,
518 };
519 
520 struct mwifiex_band_config {
521 	u8 chan_band:2;
522 	u8 chan_width:2;
523 	u8 chan2_offset:2;
524 	u8 scan_mode:2;
525 } __packed;
526 
527 struct mwifiex_channel_band {
528 	struct mwifiex_band_config band_config;
529 	u8 channel;
530 };
531 
532 struct mwifiex_private {
533 	struct mwifiex_adapter *adapter;
534 	u8 bss_type;
535 	u8 bss_role;
536 	u8 bss_priority;
537 	u8 bss_num;
538 	u8 bss_started;
539 	u8 frame_type;
540 	u8 curr_addr[ETH_ALEN];
541 	u8 media_connected;
542 	u8 port_open;
543 	u8 usb_port;
544 	u32 num_tx_timeout;
545 	/* track consecutive timeout */
546 	u8 tx_timeout_cnt;
547 	struct net_device *netdev;
548 	struct net_device_stats stats;
549 	u32 curr_pkt_filter;
550 	u32 bss_mode;
551 	u32 pkt_tx_ctrl;
552 	u16 tx_power_level;
553 	u8 max_tx_power_level;
554 	u8 min_tx_power_level;
555 	u32 tx_ant;
556 	u32 rx_ant;
557 	u8 tx_rate;
558 	u8 tx_htinfo;
559 	u8 rxpd_htinfo;
560 	u8 rxpd_rate;
561 	u16 rate_bitmap;
562 	u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
563 	u32 data_rate;
564 	u8 is_data_rate_auto;
565 	u16 bcn_avg_factor;
566 	u16 data_avg_factor;
567 	s16 data_rssi_last;
568 	s16 data_nf_last;
569 	s16 data_rssi_avg;
570 	s16 data_nf_avg;
571 	s16 bcn_rssi_last;
572 	s16 bcn_nf_last;
573 	s16 bcn_rssi_avg;
574 	s16 bcn_nf_avg;
575 	struct mwifiex_bssdescriptor *attempted_bss_desc;
576 	struct cfg80211_ssid prev_ssid;
577 	u8 prev_bssid[ETH_ALEN];
578 	struct mwifiex_current_bss_params curr_bss_params;
579 	u16 beacon_period;
580 	u8 dtim_period;
581 	u16 listen_interval;
582 	u16 atim_window;
583 	u8 adhoc_channel;
584 	u8 adhoc_is_link_sensed;
585 	u8 adhoc_state;
586 	struct mwifiex_802_11_security sec_info;
587 	struct mwifiex_wep_key wep_key[NUM_WEP_KEYS];
588 	u16 wep_key_curr_index;
589 	u8 wpa_ie[256];
590 	u16 wpa_ie_len;
591 	u8 wpa_is_gtk_set;
592 	struct host_cmd_ds_802_11_key_material aes_key;
593 	struct host_cmd_ds_802_11_key_material_v2 aes_key_v2;
594 	u8 wapi_ie[256];
595 	u16 wapi_ie_len;
596 	u8 *wps_ie;
597 	u16 wps_ie_len;
598 	u8 wmm_required;
599 	u8 wmm_enabled;
600 	u8 wmm_qosinfo;
601 	struct mwifiex_wmm_desc wmm;
602 	atomic_t wmm_tx_pending[IEEE80211_NUM_ACS];
603 	struct list_head sta_list;
604 	/* spin lock for associated station/TDLS peers list */
605 	spinlock_t sta_list_spinlock;
606 	struct list_head auto_tdls_list;
607 	/* spin lock for auto TDLS peer list */
608 	spinlock_t auto_tdls_lock;
609 	struct list_head tx_ba_stream_tbl_ptr;
610 	/* spin lock for tx_ba_stream_tbl_ptr queue */
611 	spinlock_t tx_ba_stream_tbl_lock;
612 	struct mwifiex_tx_aggr aggr_prio_tbl[MAX_NUM_TID];
613 	struct mwifiex_add_ba_param add_ba_param;
614 	u16 rx_seq[MAX_NUM_TID];
615 	u8 tos_to_tid_inv[MAX_NUM_TID];
616 	struct list_head rx_reorder_tbl_ptr;
617 	/* spin lock for rx_reorder_tbl_ptr queue */
618 	spinlock_t rx_reorder_tbl_lock;
619 #define MWIFIEX_ASSOC_RSP_BUF_SIZE  500
620 	u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE];
621 	u32 assoc_rsp_size;
622 
623 #define MWIFIEX_GENIE_BUF_SIZE      256
624 	u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE];
625 	u8 gen_ie_buf_len;
626 
627 	struct mwifiex_vendor_spec_cfg_ie vs_ie[MWIFIEX_MAX_VSIE_NUM];
628 
629 #define MWIFIEX_ASSOC_TLV_BUF_SIZE  256
630 	u8 assoc_tlv_buf[MWIFIEX_ASSOC_TLV_BUF_SIZE];
631 	u8 assoc_tlv_buf_len;
632 
633 	u8 *curr_bcn_buf;
634 	u32 curr_bcn_size;
635 	/* spin lock for beacon buffer */
636 	spinlock_t curr_bcn_buf_lock;
637 	struct wireless_dev wdev;
638 	struct mwifiex_chan_freq_power cfp;
639 	u32 versionstrsel;
640 	char version_str[MWIFIEX_VERSION_STR_LENGTH];
641 #ifdef CONFIG_DEBUG_FS
642 	struct dentry *dfs_dev_dir;
643 #endif
644 	u16 current_key_index;
645 	struct mutex async_mutex;
646 	struct cfg80211_scan_request *scan_request;
647 	u8 cfg_bssid[6];
648 	struct wps wps;
649 	u8 scan_block;
650 	s32 cqm_rssi_thold;
651 	u32 cqm_rssi_hyst;
652 	u8 subsc_evt_rssi_state;
653 	struct mwifiex_ds_misc_subsc_evt async_subsc_evt_storage;
654 	struct mwifiex_ie mgmt_ie[MAX_MGMT_IE_INDEX];
655 	u16 beacon_idx;
656 	u16 proberesp_idx;
657 	u16 assocresp_idx;
658 	u16 gen_idx;
659 	u8 ap_11n_enabled;
660 	u8 ap_11ac_enabled;
661 	u32 mgmt_frame_mask;
662 	struct mwifiex_roc_cfg roc_cfg;
663 	bool scan_aborting;
664 	u8 sched_scanning;
665 	u8 csa_chan;
666 	unsigned long csa_expire_time;
667 	u8 del_list_idx;
668 	bool hs2_enabled;
669 	struct mwifiex_uap_bss_param bss_cfg;
670 	struct cfg80211_chan_def bss_chandef;
671 	struct station_parameters *sta_params;
672 	struct sk_buff_head tdls_txq;
673 	u8 check_tdls_tx;
674 	struct timer_list auto_tdls_timer;
675 	bool auto_tdls_timer_active;
676 	struct idr ack_status_frames;
677 	/* spin lock for ack status */
678 	spinlock_t ack_status_lock;
679 	/** rx histogram data */
680 	struct mwifiex_histogram_data *hist_data;
681 	struct cfg80211_chan_def dfs_chandef;
682 	struct workqueue_struct *dfs_cac_workqueue;
683 	struct delayed_work dfs_cac_work;
684 	struct timer_list dfs_chan_switch_timer;
685 	struct workqueue_struct *dfs_chan_sw_workqueue;
686 	struct delayed_work dfs_chan_sw_work;
687 	struct cfg80211_beacon_data beacon_after;
688 	struct mwifiex_11h_intf_state state_11h;
689 	struct mwifiex_ds_mem_rw mem_rw;
690 	struct sk_buff_head bypass_txq;
691 	struct mwifiex_user_scan_chan hidden_chan[MWIFIEX_USER_SCAN_CHAN_MAX];
692 	u8 assoc_resp_ht_param;
693 	bool ht_param_present;
694 };
695 
696 
697 struct mwifiex_tx_ba_stream_tbl {
698 	struct list_head list;
699 	int tid;
700 	u8 ra[ETH_ALEN];
701 	enum mwifiex_ba_status ba_status;
702 	u8 amsdu;
703 };
704 
705 struct mwifiex_rx_reorder_tbl;
706 
707 struct reorder_tmr_cnxt {
708 	struct timer_list timer;
709 	struct mwifiex_rx_reorder_tbl *ptr;
710 	struct mwifiex_private *priv;
711 	u8 timer_is_set;
712 };
713 
714 struct mwifiex_rx_reorder_tbl {
715 	struct list_head list;
716 	int tid;
717 	u8 ta[ETH_ALEN];
718 	int init_win;
719 	int start_win;
720 	int win_size;
721 	void **rx_reorder_ptr;
722 	struct reorder_tmr_cnxt timer_context;
723 	u8 amsdu;
724 	u8 flags;
725 };
726 
727 struct mwifiex_bss_prio_node {
728 	struct list_head list;
729 	struct mwifiex_private *priv;
730 };
731 
732 struct mwifiex_bss_prio_tbl {
733 	struct list_head bss_prio_head;
734 	/* spin lock for bss priority  */
735 	spinlock_t bss_prio_lock;
736 	struct mwifiex_bss_prio_node *bss_prio_cur;
737 };
738 
739 struct cmd_ctrl_node {
740 	struct list_head list;
741 	struct mwifiex_private *priv;
742 	u32 cmd_no;
743 	u32 cmd_flag;
744 	struct sk_buff *cmd_skb;
745 	struct sk_buff *resp_skb;
746 	void *data_buf;
747 	u32 wait_q_enabled;
748 	struct sk_buff *skb;
749 	u8 *condition;
750 	u8 cmd_wait_q_woken;
751 };
752 
753 struct mwifiex_bss_priv {
754 	u8 band;
755 	u64 fw_tsf;
756 };
757 
758 struct mwifiex_tdls_capab {
759 	__le16 capab;
760 	u8 rates[32];
761 	u8 rates_len;
762 	u8 qos_info;
763 	u8 coex_2040;
764 	u16 aid;
765 	struct ieee80211_ht_cap ht_capb;
766 	struct ieee80211_ht_operation ht_oper;
767 	struct ieee_types_extcap extcap;
768 	struct ieee_types_generic rsn_ie;
769 	struct ieee80211_vht_cap vhtcap;
770 	struct ieee80211_vht_operation vhtoper;
771 };
772 
773 struct mwifiex_station_stats {
774 	u64 last_rx;
775 	s8 rssi;
776 	u64 rx_bytes;
777 	u64 tx_bytes;
778 	u32 rx_packets;
779 	u32 tx_packets;
780 	u32 tx_failed;
781 	u8 last_tx_rate;
782 	u8 last_tx_htinfo;
783 };
784 
785 /* This is AP/TDLS specific structure which stores information
786  * about associated/peer STA
787  */
788 struct mwifiex_sta_node {
789 	struct list_head list;
790 	u8 mac_addr[ETH_ALEN];
791 	u8 is_wmm_enabled;
792 	u8 is_11n_enabled;
793 	u8 is_11ac_enabled;
794 	u8 ampdu_sta[MAX_NUM_TID];
795 	u16 rx_seq[MAX_NUM_TID];
796 	u16 max_amsdu;
797 	u8 tdls_status;
798 	struct mwifiex_tdls_capab tdls_cap;
799 	struct mwifiex_station_stats stats;
800 	u8 tx_pause;
801 };
802 
803 struct mwifiex_auto_tdls_peer {
804 	struct list_head list;
805 	u8 mac_addr[ETH_ALEN];
806 	u8 tdls_status;
807 	int rssi;
808 	long rssi_jiffies;
809 	u8 failure_count;
810 	u8 do_discover;
811 	u8 do_setup;
812 };
813 
814 #define MWIFIEX_TYPE_AGGR_DATA_V2 11
815 #define MWIFIEX_BUS_AGGR_MODE_LEN_V2 (2)
816 #define MWIFIEX_BUS_AGGR_MAX_LEN 16000
817 #define MWIFIEX_BUS_AGGR_MAX_NUM 10
818 struct bus_aggr_params {
819 	u16 enable;
820 	u16 mode;
821 	u16 tx_aggr_max_size;
822 	u16 tx_aggr_max_num;
823 	u16 tx_aggr_align;
824 };
825 
826 struct mwifiex_if_ops {
827 	int (*init_if) (struct mwifiex_adapter *);
828 	void (*cleanup_if) (struct mwifiex_adapter *);
829 	int (*check_fw_status) (struct mwifiex_adapter *, u32);
830 	int (*check_winner_status)(struct mwifiex_adapter *);
831 	int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
832 	int (*register_dev) (struct mwifiex_adapter *);
833 	void (*unregister_dev) (struct mwifiex_adapter *);
834 	int (*enable_int) (struct mwifiex_adapter *);
835 	void (*disable_int) (struct mwifiex_adapter *);
836 	int (*process_int_status) (struct mwifiex_adapter *);
837 	int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *,
838 			     struct mwifiex_tx_param *);
839 	int (*wakeup) (struct mwifiex_adapter *);
840 	int (*wakeup_complete) (struct mwifiex_adapter *);
841 
842 	/* Interface specific functions */
843 	void (*update_mp_end_port) (struct mwifiex_adapter *, u16);
844 	void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
845 	int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *);
846 	int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
847 	int (*init_fw_port) (struct mwifiex_adapter *);
848 	int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
849 	void (*card_reset) (struct mwifiex_adapter *);
850 	int (*reg_dump)(struct mwifiex_adapter *, char *);
851 	void (*device_dump)(struct mwifiex_adapter *);
852 	int (*clean_pcie_ring) (struct mwifiex_adapter *adapter);
853 	void (*iface_work)(struct work_struct *work);
854 	void (*submit_rem_rx_urbs)(struct mwifiex_adapter *adapter);
855 	void (*deaggr_pkt)(struct mwifiex_adapter *, struct sk_buff *);
856 	void (*multi_port_resync)(struct mwifiex_adapter *);
857 	bool (*is_port_ready)(struct mwifiex_private *);
858 	void (*down_dev)(struct mwifiex_adapter *);
859 	void (*up_dev)(struct mwifiex_adapter *);
860 };
861 
862 struct mwifiex_adapter {
863 	u8 iface_type;
864 	unsigned int debug_mask;
865 	struct mwifiex_iface_comb iface_limit;
866 	struct mwifiex_iface_comb curr_iface_comb;
867 	struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM];
868 	u8 priv_num;
869 	const struct firmware *firmware;
870 	char fw_name[32];
871 	int winner;
872 	struct device *dev;
873 	struct wiphy *wiphy;
874 	u8 perm_addr[ETH_ALEN];
875 	unsigned long work_flags;
876 	u32 fw_release_number;
877 	u8 intf_hdr_len;
878 	u16 init_wait_q_woken;
879 	wait_queue_head_t init_wait_q;
880 	void *card;
881 	struct mwifiex_if_ops if_ops;
882 	atomic_t bypass_tx_pending;
883 	atomic_t rx_pending;
884 	atomic_t tx_pending;
885 	atomic_t cmd_pending;
886 	atomic_t tx_hw_pending;
887 	struct workqueue_struct *workqueue;
888 	struct work_struct main_work;
889 	struct workqueue_struct *rx_workqueue;
890 	struct work_struct rx_work;
891 	struct workqueue_struct *dfs_workqueue;
892 	struct work_struct dfs_work;
893 	bool rx_work_enabled;
894 	bool rx_processing;
895 	bool delay_main_work;
896 	bool rx_locked;
897 	bool main_locked;
898 	struct mwifiex_bss_prio_tbl bss_prio_tbl[MWIFIEX_MAX_BSS_NUM];
899 	/* spin lock for main process */
900 	spinlock_t main_proc_lock;
901 	u32 mwifiex_processing;
902 	u8 more_task_flag;
903 	u16 tx_buf_size;
904 	u16 curr_tx_buf_size;
905 	/* sdio single port rx aggregation capability */
906 	bool host_disable_sdio_rx_aggr;
907 	bool sdio_rx_aggr_enable;
908 	u16 sdio_rx_block_size;
909 	u32 ioport;
910 	enum MWIFIEX_HARDWARE_STATUS hw_status;
911 	u16 number_of_antenna;
912 	u32 fw_cap_info;
913 	/* spin lock for interrupt handling */
914 	spinlock_t int_lock;
915 	u8 int_status;
916 	u32 event_cause;
917 	struct sk_buff *event_skb;
918 	u8 upld_buf[MWIFIEX_UPLD_SIZE];
919 	u8 data_sent;
920 	u8 cmd_sent;
921 	u8 cmd_resp_received;
922 	u8 event_received;
923 	u8 data_received;
924 	u16 seq_num;
925 	struct cmd_ctrl_node *cmd_pool;
926 	struct cmd_ctrl_node *curr_cmd;
927 	/* spin lock for command */
928 	spinlock_t mwifiex_cmd_lock;
929 	u16 last_init_cmd;
930 	struct timer_list cmd_timer;
931 	struct list_head cmd_free_q;
932 	/* spin lock for cmd_free_q */
933 	spinlock_t cmd_free_q_lock;
934 	struct list_head cmd_pending_q;
935 	/* spin lock for cmd_pending_q */
936 	spinlock_t cmd_pending_q_lock;
937 	struct list_head scan_pending_q;
938 	/* spin lock for scan_pending_q */
939 	spinlock_t scan_pending_q_lock;
940 	/* spin lock for RX processing routine */
941 	spinlock_t rx_proc_lock;
942 	struct sk_buff_head tx_data_q;
943 	atomic_t tx_queued;
944 	u32 scan_processing;
945 	u16 region_code;
946 	struct mwifiex_802_11d_domain_reg domain_reg;
947 	u16 scan_probes;
948 	u32 scan_mode;
949 	u16 specific_scan_time;
950 	u16 active_scan_time;
951 	u16 passive_scan_time;
952 	u16 scan_chan_gap_time;
953 	u8 fw_bands;
954 	u8 adhoc_start_band;
955 	u8 config_bands;
956 	struct mwifiex_chan_scan_param_set *scan_channels;
957 	u8 tx_lock_flag;
958 	struct mwifiex_sleep_params sleep_params;
959 	struct mwifiex_sleep_period sleep_period;
960 	u16 ps_mode;
961 	u32 ps_state;
962 	u8 need_to_wakeup;
963 	u16 multiple_dtim;
964 	u16 local_listen_interval;
965 	u16 null_pkt_interval;
966 	struct sk_buff *sleep_cfm;
967 	u16 bcn_miss_time_out;
968 	u16 adhoc_awake_period;
969 	u8 is_deep_sleep;
970 	u8 delay_null_pkt;
971 	u16 delay_to_ps;
972 	u16 enhanced_ps_mode;
973 	u8 pm_wakeup_card_req;
974 	u16 gen_null_pkt;
975 	u16 pps_uapsd_mode;
976 	u32 pm_wakeup_fw_try;
977 	struct timer_list wakeup_timer;
978 	struct mwifiex_hs_config_param hs_cfg;
979 	u8 hs_activated;
980 	u8 hs_activated_manually;
981 	u16 hs_activate_wait_q_woken;
982 	wait_queue_head_t hs_activate_wait_q;
983 	u8 event_body[MAX_EVENT_SIZE];
984 	u32 hw_dot_11n_dev_cap;
985 	u8 hw_dev_mcs_support;
986 	u8 user_dev_mcs_support;
987 	u8 adhoc_11n_enabled;
988 	u8 sec_chan_offset;
989 	struct mwifiex_dbg dbg;
990 	u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
991 	u32 arp_filter_size;
992 	struct mwifiex_wait_queue cmd_wait_q;
993 	u8 scan_wait_q_woken;
994 	spinlock_t queue_lock;		/* lock for tx queues */
995 	u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
996 	u16 max_mgmt_ie_index;
997 	const struct firmware *cal_data;
998 	struct device_node *dt_node;
999 
1000 	/* 11AC */
1001 	u32 is_hw_11ac_capable;
1002 	u32 hw_dot_11ac_dev_cap;
1003 	u32 hw_dot_11ac_mcs_support;
1004 	u32 usr_dot_11ac_dev_cap_bg;
1005 	u32 usr_dot_11ac_dev_cap_a;
1006 	u32 usr_dot_11ac_mcs_support;
1007 
1008 	atomic_t pending_bridged_pkts;
1009 
1010 	/* For synchronizing FW initialization with device lifecycle. */
1011 	struct completion *fw_done;
1012 	bool is_up;
1013 
1014 	bool ext_scan;
1015 	u8 fw_api_ver;
1016 	u8 key_api_major_ver, key_api_minor_ver;
1017 	u8 max_p2p_conn, max_sta_conn;
1018 	struct memory_type_mapping *mem_type_mapping_tbl;
1019 	u8 num_mem_types;
1020 	bool scan_chan_gap_enabled;
1021 	struct sk_buff_head rx_data_q;
1022 	bool mfg_mode;
1023 	struct mwifiex_chan_stats *chan_stats;
1024 	u32 num_in_chan_stats;
1025 	int survey_idx;
1026 	bool auto_tdls;
1027 	u8 coex_scan;
1028 	u8 coex_min_scan_time;
1029 	u8 coex_max_scan_time;
1030 	u8 coex_win_size;
1031 	u8 coex_tx_win_size;
1032 	u8 coex_rx_win_size;
1033 	bool drcs_enabled;
1034 	u8 active_scan_triggered;
1035 	bool usb_mc_status;
1036 	bool usb_mc_setup;
1037 	struct cfg80211_wowlan_nd_info *nd_info;
1038 	struct ieee80211_regdomain *regd;
1039 
1040 	/* Wake-on-WLAN (WoWLAN) */
1041 	int irq_wakeup;
1042 	bool wake_by_wifi;
1043 	/* Aggregation parameters*/
1044 	struct bus_aggr_params bus_aggr;
1045 	/* Device dump data/length */
1046 	void *devdump_data;
1047 	int devdump_len;
1048 	struct delayed_work devdump_work;
1049 
1050 	bool ignore_btcoex_events;
1051 };
1052 
1053 void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
1054 
1055 int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
1056 
1057 void mwifiex_set_trans_start(struct net_device *dev);
1058 
1059 void mwifiex_stop_net_dev_queue(struct net_device *netdev,
1060 		struct mwifiex_adapter *adapter);
1061 
1062 void mwifiex_wake_up_net_dev_queue(struct net_device *netdev,
1063 		struct mwifiex_adapter *adapter);
1064 
1065 int mwifiex_init_priv(struct mwifiex_private *priv);
1066 void mwifiex_free_priv(struct mwifiex_private *priv);
1067 
1068 int mwifiex_init_fw(struct mwifiex_adapter *adapter);
1069 
1070 int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter);
1071 
1072 void mwifiex_shutdown_drv(struct mwifiex_adapter *adapter);
1073 
1074 int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *);
1075 
1076 int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb);
1077 int mwifiex_uap_recv_packet(struct mwifiex_private *priv,
1078 			    struct sk_buff *skb);
1079 
1080 int mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
1081 				struct sk_buff *skb);
1082 
1083 int mwifiex_process_event(struct mwifiex_adapter *adapter);
1084 
1085 int mwifiex_complete_cmd(struct mwifiex_adapter *adapter,
1086 			 struct cmd_ctrl_node *cmd_node);
1087 
1088 int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
1089 		     u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync);
1090 
1091 void mwifiex_cmd_timeout_func(struct timer_list *t);
1092 
1093 int mwifiex_get_debug_info(struct mwifiex_private *,
1094 			   struct mwifiex_debug_info *);
1095 
1096 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter);
1097 void mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter);
1098 void mwifiex_free_cmd_buffers(struct mwifiex_adapter *adapter);
1099 void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter);
1100 void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter);
1101 void mwifiex_cancel_scan(struct mwifiex_adapter *adapter);
1102 
1103 void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter,
1104 			      struct cmd_ctrl_node *cmd_node);
1105 
1106 void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
1107 				     struct cmd_ctrl_node *cmd_node);
1108 
1109 int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter);
1110 int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter);
1111 int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
1112 			     struct sk_buff *skb);
1113 int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
1114 		       struct mwifiex_tx_param *tx_param);
1115 int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags);
1116 int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
1117 				struct sk_buff *skb, int aggr, int status);
1118 void mwifiex_clean_txrx(struct mwifiex_private *priv);
1119 u8 mwifiex_check_last_packet_indication(struct mwifiex_private *priv);
1120 void mwifiex_check_ps_cond(struct mwifiex_adapter *adapter);
1121 void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *, u8 *,
1122 					u32);
1123 int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1124 			       struct host_cmd_ds_command *cmd,
1125 			       u16 cmd_action, uint16_t ps_bitmap,
1126 			       struct mwifiex_ds_auto_ds *auto_ds);
1127 int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
1128 			       struct host_cmd_ds_command *resp,
1129 			       struct mwifiex_ds_pm_cfg *pm_cfg);
1130 void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
1131 void mwifiex_hs_activated_event(struct mwifiex_private *priv,
1132 					u8 activated);
1133 int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
1134 			  int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg);
1135 int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
1136 			      struct host_cmd_ds_command *resp);
1137 int mwifiex_process_rx_packet(struct mwifiex_private *priv,
1138 			      struct sk_buff *skb);
1139 int mwifiex_sta_prepare_cmd(struct mwifiex_private *, uint16_t cmd_no,
1140 			    u16 cmd_action, u32 cmd_oid,
1141 			    void *data_buf, void *cmd_buf);
1142 int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
1143 			    u16 cmd_action, u32 cmd_oid,
1144 			    void *data_buf, void *cmd_buf);
1145 int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no,
1146 				struct host_cmd_ds_command *resp);
1147 int mwifiex_process_sta_rx_packet(struct mwifiex_private *,
1148 				  struct sk_buff *skb);
1149 int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
1150 				  struct sk_buff *skb);
1151 int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv,
1152 				  struct sk_buff *skb);
1153 int mwifiex_process_sta_event(struct mwifiex_private *);
1154 int mwifiex_process_uap_event(struct mwifiex_private *);
1155 void mwifiex_delete_all_station_list(struct mwifiex_private *priv);
1156 void mwifiex_wmm_del_peer_ra_list(struct mwifiex_private *priv,
1157 				  const u8 *ra_addr);
1158 void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb);
1159 void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb);
1160 int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta, bool init);
1161 int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd,
1162 			    struct mwifiex_scan_cmd_config *scan_cfg);
1163 void mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
1164 			    struct cmd_ctrl_node *cmd_node);
1165 int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1166 			    struct host_cmd_ds_command *resp);
1167 s32 mwifiex_ssid_cmp(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2);
1168 int mwifiex_associate(struct mwifiex_private *priv,
1169 		      struct mwifiex_bssdescriptor *bss_desc);
1170 int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
1171 				 struct host_cmd_ds_command *cmd,
1172 				 struct mwifiex_bssdescriptor *bss_desc);
1173 int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
1174 				 struct host_cmd_ds_command *resp);
1175 void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason,
1176 				 bool from_ap);
1177 u8 mwifiex_band_to_radio_type(u8 band);
1178 int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
1179 void mwifiex_deauthenticate_all(struct mwifiex_adapter *adapter);
1180 int mwifiex_adhoc_start(struct mwifiex_private *priv,
1181 			struct cfg80211_ssid *adhoc_ssid);
1182 int mwifiex_adhoc_join(struct mwifiex_private *priv,
1183 		       struct mwifiex_bssdescriptor *bss_desc);
1184 int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
1185 				    struct host_cmd_ds_command *cmd,
1186 				    struct cfg80211_ssid *req_ssid);
1187 int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1188 				   struct host_cmd_ds_command *cmd,
1189 				   struct mwifiex_bssdescriptor *bss_desc);
1190 int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
1191 			      struct host_cmd_ds_command *resp);
1192 int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd);
1193 struct mwifiex_chan_freq_power *mwifiex_get_cfp(struct mwifiex_private *priv,
1194 						u8 band, u16 channel, u32 freq);
1195 u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv,
1196 			       u8 index, u8 ht_info);
1197 u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv,
1198 				   u8 index, u8 ht_info);
1199 u32 mwifiex_find_freq_from_band_chan(u8, u8);
1200 int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask,
1201 				u8 **buffer);
1202 u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv,
1203 				    u8 *rates);
1204 u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates);
1205 u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv,
1206 				    u8 *rates, u8 radio_type);
1207 u8 mwifiex_is_rate_auto(struct mwifiex_private *priv);
1208 extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE];
1209 void mwifiex_save_curr_bcn(struct mwifiex_private *priv);
1210 void mwifiex_free_curr_bcn(struct mwifiex_private *priv);
1211 int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv,
1212 			    struct host_cmd_ds_command *cmd);
1213 int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
1214 			    struct host_cmd_ds_command *resp);
1215 int is_command_pending(struct mwifiex_adapter *adapter);
1216 void mwifiex_init_priv_params(struct mwifiex_private *priv,
1217 						struct net_device *dev);
1218 int mwifiex_set_secure_params(struct mwifiex_private *priv,
1219 			      struct mwifiex_uap_bss_param *bss_config,
1220 			      struct cfg80211_ap_settings *params);
1221 void mwifiex_set_ht_params(struct mwifiex_private *priv,
1222 			   struct mwifiex_uap_bss_param *bss_cfg,
1223 			   struct cfg80211_ap_settings *params);
1224 void mwifiex_set_vht_params(struct mwifiex_private *priv,
1225 			    struct mwifiex_uap_bss_param *bss_cfg,
1226 			    struct cfg80211_ap_settings *params);
1227 void mwifiex_set_tpc_params(struct mwifiex_private *priv,
1228 			    struct mwifiex_uap_bss_param *bss_cfg,
1229 			    struct cfg80211_ap_settings *params);
1230 void mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
1231 			   struct cfg80211_ap_settings *params);
1232 void mwifiex_set_vht_width(struct mwifiex_private *priv,
1233 			   enum nl80211_chan_width width,
1234 			   bool ap_11ac_disable);
1235 void
1236 mwifiex_set_wmm_params(struct mwifiex_private *priv,
1237 		       struct mwifiex_uap_bss_param *bss_cfg,
1238 		       struct cfg80211_ap_settings *params);
1239 void mwifiex_set_ba_params(struct mwifiex_private *priv);
1240 
1241 void mwifiex_update_ampdu_txwinsize(struct mwifiex_adapter *pmadapter);
1242 void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv,
1243 					     struct sk_buff *event_skb);
1244 
1245 void mwifiex_set_11ac_ba_params(struct mwifiex_private *priv);
1246 int mwifiex_cmd_802_11_scan_ext(struct mwifiex_private *priv,
1247 				struct host_cmd_ds_command *cmd,
1248 				void *data_buf);
1249 int mwifiex_ret_802_11_scan_ext(struct mwifiex_private *priv,
1250 				struct host_cmd_ds_command *resp);
1251 int mwifiex_handle_event_ext_scan_report(struct mwifiex_private *priv,
1252 					 void *buf);
1253 int mwifiex_cmd_802_11_bg_scan_config(struct mwifiex_private *priv,
1254 				      struct host_cmd_ds_command *cmd,
1255 				      void *data_buf);
1256 int mwifiex_stop_bg_scan(struct mwifiex_private *priv);
1257 
1258 /*
1259  * This function checks if the queuing is RA based or not.
1260  */
1261 static inline u8
1262 mwifiex_queuing_ra_based(struct mwifiex_private *priv)
1263 {
1264 	/*
1265 	 * Currently we assume if we are in Infra, then DA=RA. This might not be
1266 	 * true in the future
1267 	 */
1268 	if ((priv->bss_mode == NL80211_IFTYPE_STATION ||
1269 	     priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) &&
1270 	    (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA))
1271 		return false;
1272 
1273 	return true;
1274 }
1275 
1276 /*
1277  * This function copies rates.
1278  */
1279 static inline u32
1280 mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len)
1281 {
1282 	int i;
1283 
1284 	for (i = 0; i < len && src[i]; i++, pos++) {
1285 		if (pos >= MWIFIEX_SUPPORTED_RATES)
1286 			break;
1287 		dest[pos] = src[i];
1288 	}
1289 
1290 	return pos;
1291 }
1292 
1293 /*
1294  * This function returns the correct private structure pointer based
1295  * upon the BSS type and BSS number.
1296  */
1297 static inline struct mwifiex_private *
1298 mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter,
1299 		       u8 bss_num, u8 bss_type)
1300 {
1301 	int i;
1302 
1303 	for (i = 0; i < adapter->priv_num; i++) {
1304 		if (adapter->priv[i]) {
1305 			if ((adapter->priv[i]->bss_num == bss_num) &&
1306 			    (adapter->priv[i]->bss_type == bss_type))
1307 				break;
1308 		}
1309 	}
1310 	return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
1311 }
1312 
1313 /*
1314  * This function returns the first available private structure pointer
1315  * based upon the BSS role.
1316  */
1317 static inline struct mwifiex_private *
1318 mwifiex_get_priv(struct mwifiex_adapter *adapter,
1319 		 enum mwifiex_bss_role bss_role)
1320 {
1321 	int i;
1322 
1323 	for (i = 0; i < adapter->priv_num; i++) {
1324 		if (adapter->priv[i]) {
1325 			if (bss_role == MWIFIEX_BSS_ROLE_ANY ||
1326 			    GET_BSS_ROLE(adapter->priv[i]) == bss_role)
1327 				break;
1328 		}
1329 	}
1330 
1331 	return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
1332 }
1333 
1334 /*
1335  * This function checks available bss_num when adding new interface or
1336  * changing interface type.
1337  */
1338 static inline u8
1339 mwifiex_get_unused_bss_num(struct mwifiex_adapter *adapter, u8 bss_type)
1340 {
1341 	u8 i, j;
1342 	int index[MWIFIEX_MAX_BSS_NUM];
1343 
1344 	memset(index, 0, sizeof(index));
1345 	for (i = 0; i < adapter->priv_num; i++)
1346 		if (adapter->priv[i]) {
1347 			if (adapter->priv[i]->bss_type == bss_type &&
1348 			    !(adapter->priv[i]->bss_mode ==
1349 			      NL80211_IFTYPE_UNSPECIFIED)) {
1350 				index[adapter->priv[i]->bss_num] = 1;
1351 			}
1352 		}
1353 	for (j = 0; j < MWIFIEX_MAX_BSS_NUM; j++)
1354 		if (!index[j])
1355 			return j;
1356 	return -1;
1357 }
1358 
1359 /*
1360  * This function returns the first available unused private structure pointer.
1361  */
1362 static inline struct mwifiex_private *
1363 mwifiex_get_unused_priv_by_bss_type(struct mwifiex_adapter *adapter,
1364 				    u8 bss_type)
1365 {
1366 	u8 i;
1367 
1368 	for (i = 0; i < adapter->priv_num; i++)
1369 		if (adapter->priv[i]->bss_mode ==
1370 		   NL80211_IFTYPE_UNSPECIFIED) {
1371 			adapter->priv[i]->bss_num =
1372 			mwifiex_get_unused_bss_num(adapter, bss_type);
1373 			break;
1374 		}
1375 
1376 	return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
1377 }
1378 
1379 /*
1380  * This function returns the driver private structure of a network device.
1381  */
1382 static inline struct mwifiex_private *
1383 mwifiex_netdev_get_priv(struct net_device *dev)
1384 {
1385 	return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev));
1386 }
1387 
1388 /*
1389  * This function checks if a skb holds a management frame.
1390  */
1391 static inline bool mwifiex_is_skb_mgmt_frame(struct sk_buff *skb)
1392 {
1393 	return (get_unaligned_le32(skb->data) == PKT_TYPE_MGMT);
1394 }
1395 
1396 /* This function retrieves channel closed for operation by Channel
1397  * Switch Announcement.
1398  */
1399 static inline u8
1400 mwifiex_11h_get_csa_closed_channel(struct mwifiex_private *priv)
1401 {
1402 	if (!priv->csa_chan)
1403 		return 0;
1404 
1405 	/* Clear csa channel, if DFS channel move time has passed */
1406 	if (time_after(jiffies, priv->csa_expire_time)) {
1407 		priv->csa_chan = 0;
1408 		priv->csa_expire_time = 0;
1409 	}
1410 
1411 	return priv->csa_chan;
1412 }
1413 
1414 static inline u8 mwifiex_is_any_intf_active(struct mwifiex_private *priv)
1415 {
1416 	struct mwifiex_private *priv_num;
1417 	int i;
1418 
1419 	for (i = 0; i < priv->adapter->priv_num; i++) {
1420 		priv_num = priv->adapter->priv[i];
1421 		if (priv_num) {
1422 			if ((GET_BSS_ROLE(priv_num) == MWIFIEX_BSS_ROLE_UAP &&
1423 			     priv_num->bss_started) ||
1424 			    (GET_BSS_ROLE(priv_num) == MWIFIEX_BSS_ROLE_STA &&
1425 			     priv_num->media_connected))
1426 				return 1;
1427 		}
1428 	}
1429 
1430 	return 0;
1431 }
1432 
1433 static inline u8 mwifiex_is_tdls_link_setup(u8 status)
1434 {
1435 	switch (status) {
1436 	case TDLS_SETUP_COMPLETE:
1437 	case TDLS_CHAN_SWITCHING:
1438 	case TDLS_IN_BASE_CHAN:
1439 	case TDLS_IN_OFF_CHAN:
1440 		return true;
1441 	default:
1442 		break;
1443 	}
1444 
1445 	return false;
1446 }
1447 
1448 /* Disable platform specific wakeup interrupt */
1449 static inline void mwifiex_disable_wake(struct mwifiex_adapter *adapter)
1450 {
1451 	if (adapter->irq_wakeup >= 0) {
1452 		disable_irq_wake(adapter->irq_wakeup);
1453 		disable_irq(adapter->irq_wakeup);
1454 		if (adapter->wake_by_wifi)
1455 			/* Undo our disable, since interrupt handler already
1456 			 * did this.
1457 			 */
1458 			enable_irq(adapter->irq_wakeup);
1459 
1460 	}
1461 }
1462 
1463 /* Enable platform specific wakeup interrupt */
1464 static inline void mwifiex_enable_wake(struct mwifiex_adapter *adapter)
1465 {
1466 	/* Enable platform specific wakeup interrupt */
1467 	if (adapter->irq_wakeup >= 0) {
1468 		adapter->wake_by_wifi = false;
1469 		enable_irq(adapter->irq_wakeup);
1470 		enable_irq_wake(adapter->irq_wakeup);
1471 	}
1472 }
1473 
1474 int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
1475 			     u32 func_init_shutdown);
1476 
1477 int mwifiex_add_card(void *card, struct completion *fw_done,
1478 		     struct mwifiex_if_ops *if_ops, u8 iface_type,
1479 		     struct device *dev);
1480 int mwifiex_remove_card(struct mwifiex_adapter *adapter);
1481 
1482 void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version,
1483 			 int maxlen);
1484 int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
1485 			struct mwifiex_multicast_list *mcast_list);
1486 int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
1487 			    struct net_device *dev);
1488 int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
1489 				struct cmd_ctrl_node *cmd_queued);
1490 int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
1491 		      struct cfg80211_ssid *req_ssid);
1492 int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
1493 int mwifiex_enable_hs(struct mwifiex_adapter *adapter);
1494 int mwifiex_disable_auto_ds(struct mwifiex_private *priv);
1495 int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate);
1496 int mwifiex_request_scan(struct mwifiex_private *priv,
1497 			 struct cfg80211_ssid *req_ssid);
1498 int mwifiex_scan_networks(struct mwifiex_private *priv,
1499 			  const struct mwifiex_user_scan_cfg *user_scan_in);
1500 int mwifiex_set_radio(struct mwifiex_private *priv, u8 option);
1501 
1502 int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp,
1503 		       const u8 *key, int key_len, u8 key_index,
1504 		       const u8 *mac_addr, int disable);
1505 
1506 int mwifiex_set_gen_ie(struct mwifiex_private *priv, const u8 *ie, int ie_len);
1507 
1508 int mwifiex_get_ver_ext(struct mwifiex_private *priv, u32 version_str_sel);
1509 
1510 int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action,
1511 			       struct ieee80211_channel *chan,
1512 			       unsigned int duration);
1513 
1514 int mwifiex_get_stats_info(struct mwifiex_private *priv,
1515 			   struct mwifiex_ds_get_stats *log);
1516 
1517 int mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type,
1518 		      u32 reg_offset, u32 reg_value);
1519 
1520 int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type,
1521 		     u32 reg_offset, u32 *value);
1522 
1523 int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes,
1524 			u8 *value);
1525 
1526 int mwifiex_set_11n_httx_cfg(struct mwifiex_private *priv, int data);
1527 
1528 int mwifiex_get_11n_httx_cfg(struct mwifiex_private *priv, int *data);
1529 
1530 int mwifiex_set_tx_rate_cfg(struct mwifiex_private *priv, int tx_rate_index);
1531 
1532 int mwifiex_get_tx_rate_cfg(struct mwifiex_private *priv, int *tx_rate_index);
1533 
1534 int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode);
1535 
1536 int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter,
1537 				   char *version, int max_len);
1538 
1539 int mwifiex_set_tx_power(struct mwifiex_private *priv,
1540 			 struct mwifiex_power_cfg *power_cfg);
1541 
1542 int mwifiex_main_process(struct mwifiex_adapter *);
1543 
1544 int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb);
1545 
1546 int mwifiex_get_bss_info(struct mwifiex_private *,
1547 			 struct mwifiex_bss_info *);
1548 int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
1549 			      struct cfg80211_bss *bss,
1550 			      struct mwifiex_bssdescriptor *bss_desc);
1551 int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
1552 				    struct mwifiex_bssdescriptor *bss_entry);
1553 int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
1554 					struct mwifiex_bssdescriptor *bss_desc);
1555 
1556 u8 mwifiex_chan_type_to_sec_chan_offset(enum nl80211_channel_type chan_type);
1557 u8 mwifiex_get_chan_type(struct mwifiex_private *priv);
1558 
1559 struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1560 					      const char *name,
1561 					      unsigned char name_assign_type,
1562 					      enum nl80211_iftype type,
1563 					      struct vif_params *params);
1564 int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
1565 
1566 void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config);
1567 
1568 int mwifiex_add_wowlan_magic_pkt_filter(struct mwifiex_adapter *adapter);
1569 
1570 int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
1571 			 struct cfg80211_beacon_data *data);
1572 int mwifiex_del_mgmt_ies(struct mwifiex_private *priv);
1573 u8 *mwifiex_11d_code_2_region(u8 code);
1574 void mwifiex_uap_set_channel(struct mwifiex_private *priv,
1575 			     struct mwifiex_uap_bss_param *bss_cfg,
1576 			     struct cfg80211_chan_def chandef);
1577 int mwifiex_config_start_uap(struct mwifiex_private *priv,
1578 			     struct mwifiex_uap_bss_param *bss_cfg);
1579 void mwifiex_uap_del_sta_data(struct mwifiex_private *priv,
1580 			      struct mwifiex_sta_node *node);
1581 
1582 void mwifiex_config_uap_11d(struct mwifiex_private *priv,
1583 			    struct cfg80211_beacon_data *beacon_data);
1584 
1585 void mwifiex_init_11h_params(struct mwifiex_private *priv);
1586 int mwifiex_is_11h_active(struct mwifiex_private *priv);
1587 int mwifiex_11h_activate(struct mwifiex_private *priv, bool flag);
1588 
1589 void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer,
1590 			      struct mwifiex_bssdescriptor *bss_desc);
1591 int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv);
1592 int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv,
1593 			    struct device_node *node, const char *prefix);
1594 void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv);
1595 
1596 extern const struct ethtool_ops mwifiex_ethtool_ops;
1597 
1598 void mwifiex_del_all_sta_list(struct mwifiex_private *priv);
1599 void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac);
1600 void
1601 mwifiex_set_sta_ht_cap(struct mwifiex_private *priv, const u8 *ies,
1602 		       int ies_len, struct mwifiex_sta_node *node);
1603 struct mwifiex_sta_node *
1604 mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac);
1605 struct mwifiex_sta_node *
1606 mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac);
1607 u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv);
1608 u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv);
1609 u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv);
1610 int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer,
1611 				 u8 action_code, u8 dialog_token,
1612 				 u16 status_code, const u8 *extra_ies,
1613 				 size_t extra_ies_len);
1614 int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer,
1615 				   u8 action_code, u8 dialog_token,
1616 				   u16 status_code, const u8 *extra_ies,
1617 				   size_t extra_ies_len);
1618 void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
1619 				       u8 *buf, int len);
1620 int mwifiex_tdls_oper(struct mwifiex_private *priv, const u8 *peer, u8 action);
1621 int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac);
1622 int mwifiex_get_tdls_list(struct mwifiex_private *priv,
1623 			  struct tdls_peer_info *buf);
1624 void mwifiex_disable_all_tdls_links(struct mwifiex_private *priv);
1625 bool mwifiex_is_bss_in_11ac_mode(struct mwifiex_private *priv);
1626 u8 mwifiex_get_center_freq_index(struct mwifiex_private *priv, u8 band,
1627 				 u32 pri_chan, u8 chan_bw);
1628 int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter);
1629 
1630 int mwifiex_tdls_check_tx(struct mwifiex_private *priv, struct sk_buff *skb);
1631 void mwifiex_flush_auto_tdls_list(struct mwifiex_private *priv);
1632 void mwifiex_auto_tdls_update_peer_status(struct mwifiex_private *priv,
1633 					  const u8 *mac, u8 link_status);
1634 void mwifiex_auto_tdls_update_peer_signal(struct mwifiex_private *priv,
1635 					  u8 *mac, s8 snr, s8 nflr);
1636 void mwifiex_check_auto_tdls(struct timer_list *t);
1637 void mwifiex_add_auto_tdls_peer(struct mwifiex_private *priv, const u8 *mac);
1638 void mwifiex_setup_auto_tdls_timer(struct mwifiex_private *priv);
1639 void mwifiex_clean_auto_tdls(struct mwifiex_private *priv);
1640 int mwifiex_config_tdls_enable(struct mwifiex_private *priv);
1641 int mwifiex_config_tdls_disable(struct mwifiex_private *priv);
1642 int mwifiex_config_tdls_cs_params(struct mwifiex_private *priv);
1643 int mwifiex_stop_tdls_cs(struct mwifiex_private *priv, const u8 *peer_mac);
1644 int mwifiex_start_tdls_cs(struct mwifiex_private *priv, const u8 *peer_mac,
1645 			  u8 primary_chan, u8 second_chan_offset, u8 band);
1646 
1647 int mwifiex_cmd_issue_chan_report_request(struct mwifiex_private *priv,
1648 					  struct host_cmd_ds_command *cmd,
1649 					  void *data_buf);
1650 int mwifiex_11h_handle_chanrpt_ready(struct mwifiex_private *priv,
1651 				     struct sk_buff *skb);
1652 
1653 void mwifiex_parse_tx_status_event(struct mwifiex_private *priv,
1654 				   void *event_body);
1655 
1656 struct sk_buff *
1657 mwifiex_clone_skb_for_tx_status(struct mwifiex_private *priv,
1658 				struct sk_buff *skb, u8 flag, u64 *cookie);
1659 void mwifiex_dfs_cac_work_queue(struct work_struct *work);
1660 void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work);
1661 void mwifiex_abort_cac(struct mwifiex_private *priv);
1662 int mwifiex_stop_radar_detection(struct mwifiex_private *priv,
1663 				 struct cfg80211_chan_def *chandef);
1664 int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
1665 				      struct sk_buff *skb);
1666 
1667 void mwifiex_hist_data_set(struct mwifiex_private *priv, u8 rx_rate, s8 snr,
1668 			   s8 nflr);
1669 void mwifiex_hist_data_reset(struct mwifiex_private *priv);
1670 void mwifiex_hist_data_add(struct mwifiex_private *priv,
1671 			   u8 rx_rate, s8 snr, s8 nflr);
1672 u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv,
1673 			    u8 rx_rate, u8 ht_info);
1674 
1675 void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter);
1676 void mwifiex_prepare_fw_dump_info(struct mwifiex_adapter *adapter);
1677 void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter);
1678 void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
1679 void mwifiex_fw_dump_event(struct mwifiex_private *priv);
1680 void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
1681 int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
1682 			      int cmd_type,
1683 			      struct mwifiex_ds_wakeup_reason *wakeup_reason);
1684 int mwifiex_get_chan_info(struct mwifiex_private *priv,
1685 			  struct mwifiex_channel_band *channel_band);
1686 int mwifiex_ret_wakeup_reason(struct mwifiex_private *priv,
1687 			      struct host_cmd_ds_command *resp,
1688 			      struct host_cmd_ds_wakeup_reason *wakeup_reason);
1689 void mwifiex_coex_ampdu_rxwinsize(struct mwifiex_adapter *adapter);
1690 void mwifiex_11n_delba(struct mwifiex_private *priv, int tid);
1691 int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy);
1692 void mwifiex_process_tx_pause_event(struct mwifiex_private *priv,
1693 				    struct sk_buff *event);
1694 void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
1695 				      struct sk_buff *event_skb);
1696 void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter);
1697 int mwifiex_set_mac_address(struct mwifiex_private *priv,
1698 			    struct net_device *dev,
1699 			    bool external, u8 *new_mac);
1700 void mwifiex_devdump_tmo_func(unsigned long function_context);
1701 
1702 #ifdef CONFIG_DEBUG_FS
1703 void mwifiex_debugfs_init(void);
1704 void mwifiex_debugfs_remove(void);
1705 
1706 void mwifiex_dev_debugfs_init(struct mwifiex_private *priv);
1707 void mwifiex_dev_debugfs_remove(struct mwifiex_private *priv);
1708 #endif
1709 int mwifiex_reinit_sw(struct mwifiex_adapter *adapter);
1710 int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter);
1711 #endif /* !_MWIFIEX_MAIN_H_ */
1712