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