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