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