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