mwifiex: reduce CPU usage by tracking tx_pkts_queued
[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 *
4 * Copyright (C) 2011, Marvell International Ltd.
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>
33#include <linux/firmware.h>
34#include <linux/ctype.h>
35
36#include "decl.h"
37#include "ioctl.h"
38#include "util.h"
39#include "fw.h"
40
41extern const char driver_version[];
42extern struct mwifiex_adapter *g_adapter;
43
44enum {
600f5d90
AK
45 MWIFIEX_ASYNC_CMD,
46 MWIFIEX_SYNC_CMD
5e6e3a92
BZ
47};
48
49#define DRV_MODE_STA 0x1
5e6e3a92
BZ
50
51#define SD8787_W0 0x30
52#define SD8787_W1 0x31
53#define SD8787_A0 0x40
54#define SD8787_A1 0x41
55
56#define DEFAULT_FW_NAME "mrvl/sd8787_uapsta.bin"
57#define SD8787_W1_FW_NAME "mrvl/sd8787_uapsta_w1.bin"
58#define SD8787_AX_FW_NAME "mrvl/sd8787_uapsta.bin"
59
60struct mwifiex_drv_mode {
61 u16 drv_mode;
62 u16 intf_num;
63 struct mwifiex_bss_attr *bss_attr;
64};
65
66
67#define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT (5 * HZ)
68
69#define MWIFIEX_TIMER_10S 10000
70#define MWIFIEX_TIMER_1S 1000
71
5e6e3a92
BZ
72#define MAX_TX_PENDING 60
73
5e6e3a92
BZ
74#define MWIFIEX_UPLD_SIZE (2312)
75
76#define MAX_EVENT_SIZE 1024
77
78#define ARP_FILTER_MAX_BUF_SIZE 68
79
80#define MWIFIEX_KEY_BUFFER_SIZE 16
81#define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
82#define MWIFIEX_MAX_REGION_CODE 7
83
84#define DEFAULT_BCN_AVG_FACTOR 8
85#define DEFAULT_DATA_AVG_FACTOR 8
86
87#define FIRST_VALID_CHANNEL 0xff
88#define DEFAULT_AD_HOC_CHANNEL 6
89#define DEFAULT_AD_HOC_CHANNEL_A 36
90
91#define DEFAULT_BCN_MISS_TIMEOUT 5
92
93#define MAX_SCAN_BEACON_BUFFER 8000
94
95#define SCAN_BEACON_ENTRY_PAD 6
96
97#define MWIFIEX_PASSIVE_SCAN_CHAN_TIME 200
98#define MWIFIEX_ACTIVE_SCAN_CHAN_TIME 200
99#define MWIFIEX_SPECIFIC_SCAN_CHAN_TIME 110
100
101#define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI)))
102
103#define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S)
104
105#define RSN_GTK_OUI_OFFSET 2
106
107#define MWIFIEX_OUI_NOT_PRESENT 0
108#define MWIFIEX_OUI_PRESENT 1
109
110#define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \
111 adapter->event_received || \
112 adapter->data_received)
113
114#define MWIFIEX_TYPE_CMD 1
115#define MWIFIEX_TYPE_DATA 0
116#define MWIFIEX_TYPE_EVENT 3
117
118#define DBG_CMD_NUM 5
119
120#define MAX_BITMAP_RATES_SIZE 10
121
122#define MAX_CHANNEL_BAND_BG 14
123
124#define MAX_FREQUENCY_BAND_BG 2484
125
126struct mwifiex_dbg {
127 u32 num_cmd_host_to_card_failure;
128 u32 num_cmd_sleep_cfm_host_to_card_failure;
129 u32 num_tx_host_to_card_failure;
130 u32 num_event_deauth;
131 u32 num_event_disassoc;
132 u32 num_event_link_lost;
133 u32 num_cmd_deauth;
134 u32 num_cmd_assoc_success;
135 u32 num_cmd_assoc_failure;
136 u32 num_tx_timeout;
137 u32 num_cmd_timeout;
138 u16 timeout_cmd_id;
139 u16 timeout_cmd_act;
140 u16 last_cmd_id[DBG_CMD_NUM];
141 u16 last_cmd_act[DBG_CMD_NUM];
142 u16 last_cmd_index;
143 u16 last_cmd_resp_id[DBG_CMD_NUM];
144 u16 last_cmd_resp_index;
145 u16 last_event[DBG_CMD_NUM];
146 u16 last_event_index;
147};
148
149enum MWIFIEX_HARDWARE_STATUS {
150 MWIFIEX_HW_STATUS_READY,
151 MWIFIEX_HW_STATUS_INITIALIZING,
152 MWIFIEX_HW_STATUS_FW_READY,
153 MWIFIEX_HW_STATUS_INIT_DONE,
154 MWIFIEX_HW_STATUS_RESET,
155 MWIFIEX_HW_STATUS_CLOSING,
156 MWIFIEX_HW_STATUS_NOT_READY
157};
158
159enum MWIFIEX_802_11_POWER_MODE {
160 MWIFIEX_802_11_POWER_MODE_CAM,
161 MWIFIEX_802_11_POWER_MODE_PSP
162};
163
164struct mwifiex_tx_param {
165 u32 next_pkt_len;
166};
167
168enum MWIFIEX_PS_STATE {
169 PS_STATE_AWAKE,
170 PS_STATE_PRE_SLEEP,
171 PS_STATE_SLEEP_CFM,
172 PS_STATE_SLEEP
173};
174
175struct mwifiex_add_ba_param {
176 u32 tx_win_size;
177 u32 rx_win_size;
178 u32 timeout;
179};
180
181struct mwifiex_tx_aggr {
182 u8 ampdu_user;
183 u8 ampdu_ap;
184 u8 amsdu;
185};
186
187struct mwifiex_ra_list_tbl {
188 struct list_head list;
189 struct sk_buff_head skb_head;
190 u8 ra[ETH_ALEN];
191 u32 total_pkts_size;
192 u32 is_11n_enabled;
193};
194
195struct mwifiex_tid_tbl {
196 struct list_head ra_list;
197 /* spin lock for tid table */
198 spinlock_t tid_tbl_lock;
199 struct mwifiex_ra_list_tbl *ra_list_curr;
200};
201
202#define WMM_HIGHEST_PRIORITY 7
203#define HIGH_PRIO_TID 7
204#define LOW_PRIO_TID 0
205
206struct mwifiex_wmm_desc {
207 struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID];
208 u32 packets_out[MAX_NUM_TID];
209 /* spin lock to protect ra_list */
210 spinlock_t ra_list_spinlock;
211 struct mwifiex_wmm_ac_status ac_status[IEEE80211_MAX_QUEUES];
212 enum mwifiex_wmm_ac_e ac_down_graded_vals[IEEE80211_MAX_QUEUES];
213 u32 drv_pkt_delay_max;
214 u8 queue_priority[IEEE80211_MAX_QUEUES];
215 u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */
f699254c
MY
216 /* Number of transmit packets queued */
217 atomic_t tx_pkts_queued;
5e6e3a92
BZ
218};
219
220struct mwifiex_802_11_security {
221 u8 wpa_enabled;
222 u8 wpa2_enabled;
223 u8 wapi_enabled;
224 u8 wapi_key_on;
225 enum MWIFIEX_802_11_WEP_STATUS wep_status;
226 u32 authentication_mode;
227 u32 encryption_mode;
228};
229
230struct ieee_types_header {
231 u8 element_id;
232 u8 len;
233} __packed;
234
235struct ieee_obss_scan_param {
236 u16 obss_scan_passive_dwell;
237 u16 obss_scan_active_dwell;
238 u16 bss_chan_width_trigger_scan_int;
239 u16 obss_scan_passive_total;
240 u16 obss_scan_active_total;
241 u16 bss_width_chan_trans_delay;
242 u16 obss_scan_active_threshold;
243} __packed;
244
245struct ieee_types_obss_scan_param {
246 struct ieee_types_header ieee_hdr;
247 struct ieee_obss_scan_param obss_scan;
248} __packed;
249
250#define MWIFIEX_SUPPORTED_RATES 14
251
252#define MWIFIEX_SUPPORTED_RATES_EXT 32
253
254#define IEEE_MAX_IE_SIZE 256
255
256struct ieee_types_vendor_specific {
257 struct ieee_types_vendor_header vend_hdr;
258 u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_vendor_header)];
259} __packed;
260
261struct ieee_types_generic {
262 struct ieee_types_header ieee_hdr;
263 u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_header)];
264} __packed;
265
266struct mwifiex_bssdescriptor {
267 u8 mac_address[ETH_ALEN];
268 struct mwifiex_802_11_ssid ssid;
269 u32 privacy;
270 s32 rssi;
271 u32 channel;
272 u32 freq;
273 u16 beacon_period;
274 u8 erp_flags;
275 u32 bss_mode;
276 u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
277 u8 data_rates[MWIFIEX_SUPPORTED_RATES];
278 /* Network band.
279 * BAND_B(0x01): 'b' band
280 * BAND_G(0x02): 'g' band
281 * BAND_A(0X04): 'a' band
282 */
283 u16 bss_band;
1a5b306f 284 u64 network_tsf;
5e6e3a92
BZ
285 u8 time_stamp[8];
286 union ieee_types_phy_param_set phy_param_set;
287 union ieee_types_ss_param_set ss_param_set;
288 u16 cap_info_bitmap;
289 struct ieee_types_wmm_parameter wmm_ie;
290 u8 disable_11n;
291 struct ieee80211_ht_cap *bcn_ht_cap;
292 u16 ht_cap_offset;
293 struct ieee80211_ht_info *bcn_ht_info;
294 u16 ht_info_offset;
295 u8 *bcn_bss_co_2040;
296 u16 bss_co_2040_offset;
297 u8 *bcn_ext_cap;
298 u16 ext_cap_offset;
299 struct ieee_types_obss_scan_param *bcn_obss_scan;
300 u16 overlap_bss_offset;
301 struct ieee_types_vendor_specific *bcn_wpa_ie;
302 u16 wpa_offset;
303 struct ieee_types_generic *bcn_rsn_ie;
304 u16 rsn_offset;
305 struct ieee_types_generic *bcn_wapi_ie;
306 u16 wapi_offset;
307 u8 *beacon_buf;
308 u32 beacon_buf_size;
309 u32 beacon_buf_size_max;
310
311};
312
313struct mwifiex_current_bss_params {
314 struct mwifiex_bssdescriptor bss_descriptor;
315 u8 wmm_enabled;
316 u8 wmm_uapsd_enabled;
317 u8 band;
318 u32 num_of_rates;
319 u8 data_rates[MWIFIEX_SUPPORTED_RATES];
320};
321
322struct mwifiex_sleep_params {
323 u16 sp_error;
324 u16 sp_offset;
325 u16 sp_stable_time;
326 u8 sp_cal_control;
327 u8 sp_ext_sleep_clk;
328 u16 sp_reserved;
329};
330
331struct mwifiex_sleep_period {
332 u16 period;
333 u16 reserved;
334};
335
336struct mwifiex_wep_key {
337 u32 length;
338 u32 key_index;
339 u32 key_length;
340 u8 key_material[MWIFIEX_KEY_BUFFER_SIZE];
341};
342
343#define MAX_REGION_CHANNEL_NUM 2
344
345struct mwifiex_chan_freq_power {
346 u16 channel;
347 u32 freq;
348 u16 max_tx_power;
349 u8 unsupported;
350};
351
352enum state_11d_t {
353 DISABLE_11D = 0,
354 ENABLE_11D = 1,
355};
356
357#define MWIFIEX_MAX_TRIPLET_802_11D 83
358
359struct mwifiex_802_11d_domain_reg {
360 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
361 u8 no_of_triplet;
362 struct ieee80211_country_ie_triplet
363 triplet[MWIFIEX_MAX_TRIPLET_802_11D];
364};
365
366struct mwifiex_vendor_spec_cfg_ie {
367 u16 mask;
368 u16 flag;
369 u8 ie[MWIFIEX_MAX_VSIE_LEN];
370};
371
372struct wps {
373 u8 session_enable;
374};
375
376struct mwifiex_adapter;
377struct mwifiex_private;
378
379struct mwifiex_private {
380 struct mwifiex_adapter *adapter;
381 u8 bss_index;
382 u8 bss_type;
383 u8 bss_role;
384 u8 bss_priority;
385 u8 bss_num;
386 u8 frame_type;
387 u8 curr_addr[ETH_ALEN];
388 u8 media_connected;
389 u32 num_tx_timeout;
390 struct net_device *netdev;
391 struct net_device_stats stats;
392 u16 curr_pkt_filter;
393 u32 bss_mode;
394 u32 pkt_tx_ctrl;
395 u16 tx_power_level;
396 u8 max_tx_power_level;
397 u8 min_tx_power_level;
398 u8 tx_rate;
399 u8 tx_htinfo;
400 u8 rxpd_htinfo;
401 u8 rxpd_rate;
402 u16 rate_bitmap;
403 u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
404 u32 data_rate;
405 u8 is_data_rate_auto;
406 u16 bcn_avg_factor;
407 u16 data_avg_factor;
408 s16 data_rssi_last;
409 s16 data_nf_last;
410 s16 data_rssi_avg;
411 s16 data_nf_avg;
412 s16 bcn_rssi_last;
413 s16 bcn_nf_last;
414 s16 bcn_rssi_avg;
415 s16 bcn_nf_avg;
416 struct mwifiex_bssdescriptor *attempted_bss_desc;
417 struct mwifiex_802_11_ssid prev_ssid;
418 u8 prev_bssid[ETH_ALEN];
419 struct mwifiex_current_bss_params curr_bss_params;
420 u16 beacon_period;
421 u16 listen_interval;
422 u16 atim_window;
423 u8 adhoc_channel;
424 u8 adhoc_is_link_sensed;
425 u8 adhoc_state;
426 struct mwifiex_802_11_security sec_info;
427 struct mwifiex_wep_key wep_key[NUM_WEP_KEYS];
428 u16 wep_key_curr_index;
429 u8 wpa_ie[256];
430 u8 wpa_ie_len;
431 u8 wpa_is_gtk_set;
432 struct host_cmd_ds_802_11_key_material aes_key;
433 u8 wapi_ie[256];
434 u8 wapi_ie_len;
435 u8 wmm_required;
436 u8 wmm_enabled;
437 u8 wmm_qosinfo;
438 struct mwifiex_wmm_desc wmm;
439 struct list_head tx_ba_stream_tbl_ptr;
440 /* spin lock for tx_ba_stream_tbl_ptr queue */
441 spinlock_t tx_ba_stream_tbl_lock;
442 struct mwifiex_tx_aggr aggr_prio_tbl[MAX_NUM_TID];
443 struct mwifiex_add_ba_param add_ba_param;
444 u16 rx_seq[MAX_NUM_TID];
445 struct list_head rx_reorder_tbl_ptr;
446 /* spin lock for rx_reorder_tbl_ptr queue */
447 spinlock_t rx_reorder_tbl_lock;
448 /* spin lock for Rx packets */
449 spinlock_t rx_pkt_lock;
450
451#define MWIFIEX_ASSOC_RSP_BUF_SIZE 500
452 u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE];
453 u32 assoc_rsp_size;
454
455#define MWIFIEX_GENIE_BUF_SIZE 256
456 u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE];
457 u8 gen_ie_buf_len;
458
459 struct mwifiex_vendor_spec_cfg_ie vs_ie[MWIFIEX_MAX_VSIE_NUM];
460
461#define MWIFIEX_ASSOC_TLV_BUF_SIZE 256
462 u8 assoc_tlv_buf[MWIFIEX_ASSOC_TLV_BUF_SIZE];
463 u8 assoc_tlv_buf_len;
464
465 u8 *curr_bcn_buf;
466 u32 curr_bcn_size;
467 /* spin lock for beacon buffer */
468 spinlock_t curr_bcn_buf_lock;
5e6e3a92
BZ
469 struct wireless_dev *wdev;
470 struct mwifiex_chan_freq_power cfp;
471 char version_str[128];
472#ifdef CONFIG_DEBUG_FS
473 struct dentry *dfs_dev_dir;
474#endif
475 u8 nick_name[16];
476 struct iw_statistics w_stats;
5e6e3a92
BZ
477 u16 current_key_index;
478 struct semaphore async_sem;
479 u8 scan_pending_on_block;
480 u8 report_scan_result;
481 struct cfg80211_scan_request *scan_request;
482 int scan_result_status;
57f16b5d 483 int assoc_request;
5e6e3a92 484 u16 assoc_result;
57f16b5d 485 int ibss_join_request;
5e6e3a92
BZ
486 u16 ibss_join_result;
487 bool disconnect;
488 u8 cfg_bssid[6];
489 struct workqueue_struct *workqueue;
490 struct work_struct cfg_workqueue;
491 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
492 struct wps wps;
493 u8 scan_block;
494};
495
496enum mwifiex_ba_status {
497 BA_STREAM_NOT_SETUP = 0,
498 BA_STREAM_SETUP_INPROGRESS,
499 BA_STREAM_SETUP_COMPLETE
500};
501
502struct mwifiex_tx_ba_stream_tbl {
503 struct list_head list;
504 int tid;
505 u8 ra[ETH_ALEN];
506 enum mwifiex_ba_status ba_status;
507};
508
509struct mwifiex_rx_reorder_tbl;
510
511struct reorder_tmr_cnxt {
512 struct timer_list timer;
513 struct mwifiex_rx_reorder_tbl *ptr;
514 struct mwifiex_private *priv;
515};
516
517struct mwifiex_rx_reorder_tbl {
518 struct list_head list;
519 int tid;
520 u8 ta[ETH_ALEN];
521 int start_win;
522 int win_size;
523 void **rx_reorder_ptr;
524 struct reorder_tmr_cnxt timer_context;
525};
526
527struct mwifiex_bss_prio_node {
528 struct list_head list;
529 struct mwifiex_private *priv;
530};
531
532struct mwifiex_bss_prio_tbl {
533 struct list_head bss_prio_head;
534 /* spin lock for bss priority */
535 spinlock_t bss_prio_lock;
536 struct mwifiex_bss_prio_node *bss_prio_cur;
537};
538
539struct cmd_ctrl_node {
540 struct list_head list;
541 struct mwifiex_private *priv;
542 u32 cmd_oid;
543 u32 cmd_flag;
544 struct sk_buff *cmd_skb;
545 struct sk_buff *resp_skb;
546 void *data_buf;
600f5d90 547 u32 wait_q_enabled;
5e6e3a92
BZ
548 struct sk_buff *skb;
549};
550
551struct mwifiex_if_ops {
552 int (*init_if) (struct mwifiex_adapter *);
553 void (*cleanup_if) (struct mwifiex_adapter *);
554 int (*check_fw_status) (struct mwifiex_adapter *, u32, int *);
555 int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
556 int (*register_dev) (struct mwifiex_adapter *);
557 void (*unregister_dev) (struct mwifiex_adapter *);
558 int (*enable_int) (struct mwifiex_adapter *);
559 int (*process_int_status) (struct mwifiex_adapter *);
560 int (*host_to_card) (struct mwifiex_adapter *, u8,
561 u8 *payload, u32 pkt_len,
562 struct mwifiex_tx_param *);
563 int (*wakeup) (struct mwifiex_adapter *);
564 int (*wakeup_complete) (struct mwifiex_adapter *);
565
566 void (*update_mp_end_port) (struct mwifiex_adapter *, u16);
567 void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
568};
569
570struct mwifiex_adapter {
571 struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM];
572 u8 priv_num;
573 struct mwifiex_drv_mode *drv_mode;
574 const struct firmware *firmware;
575 struct device *dev;
576 bool surprise_removed;
577 u32 fw_release_number;
578 u32 revision_id;
579 u16 init_wait_q_woken;
580 wait_queue_head_t init_wait_q;
581 void *card;
582 struct mwifiex_if_ops if_ops;
583 atomic_t rx_pending;
584 atomic_t tx_pending;
600f5d90 585 atomic_t cmd_pending;
5e6e3a92
BZ
586 struct workqueue_struct *workqueue;
587 struct work_struct main_work;
588 struct mwifiex_bss_prio_tbl bss_prio_tbl[MWIFIEX_MAX_BSS_NUM];
589 /* spin lock for init/shutdown */
590 spinlock_t mwifiex_lock;
591 /* spin lock for main process */
592 spinlock_t main_proc_lock;
593 u32 mwifiex_processing;
594 u16 max_tx_buf_size;
595 u16 tx_buf_size;
596 u16 curr_tx_buf_size;
597 u32 ioport;
598 enum MWIFIEX_HARDWARE_STATUS hw_status;
5e6e3a92
BZ
599 u16 number_of_antenna;
600 u32 fw_cap_info;
601 /* spin lock for interrupt handling */
602 spinlock_t int_lock;
603 u8 int_status;
604 u32 event_cause;
605 struct sk_buff *event_skb;
606 u8 upld_buf[MWIFIEX_UPLD_SIZE];
607 u8 data_sent;
608 u8 cmd_sent;
609 u8 cmd_resp_received;
610 u8 event_received;
611 u8 data_received;
612 u16 seq_num;
613 struct cmd_ctrl_node *cmd_pool;
614 struct cmd_ctrl_node *curr_cmd;
615 /* spin lock for command */
616 spinlock_t mwifiex_cmd_lock;
617 u32 num_cmd_timeout;
618 u16 last_init_cmd;
619 struct timer_list cmd_timer;
620 struct list_head cmd_free_q;
621 /* spin lock for cmd_free_q */
622 spinlock_t cmd_free_q_lock;
623 struct list_head cmd_pending_q;
624 /* spin lock for cmd_pending_q */
625 spinlock_t cmd_pending_q_lock;
626 struct list_head scan_pending_q;
627 /* spin lock for scan_pending_q */
628 spinlock_t scan_pending_q_lock;
629 u32 scan_processing;
630 u16 region_code;
631 struct mwifiex_802_11d_domain_reg domain_reg;
632 struct mwifiex_bssdescriptor *scan_table;
633 u32 num_in_scan_table;
634 u16 scan_probes;
635 u32 scan_mode;
636 u16 specific_scan_time;
637 u16 active_scan_time;
638 u16 passive_scan_time;
639 u8 bcn_buf[MAX_SCAN_BEACON_BUFFER];
640 u8 *bcn_buf_end;
641 u8 fw_bands;
642 u8 adhoc_start_band;
643 u8 config_bands;
644 struct mwifiex_chan_scan_param_set *scan_channels;
645 u8 tx_lock_flag;
646 struct mwifiex_sleep_params sleep_params;
647 struct mwifiex_sleep_period sleep_period;
648 u16 ps_mode;
649 u32 ps_state;
650 u8 need_to_wakeup;
651 u16 multiple_dtim;
652 u16 local_listen_interval;
653 u16 null_pkt_interval;
654 struct sk_buff *sleep_cfm;
655 u16 bcn_miss_time_out;
656 u16 adhoc_awake_period;
657 u8 is_deep_sleep;
658 u8 delay_null_pkt;
659 u16 delay_to_ps;
660 u16 enhanced_ps_mode;
661 u8 pm_wakeup_card_req;
662 u16 gen_null_pkt;
663 u16 pps_uapsd_mode;
664 u32 pm_wakeup_fw_try;
665 u8 is_hs_configured;
666 struct mwifiex_hs_config_param hs_cfg;
667 u8 hs_activated;
668 u16 hs_activate_wait_q_woken;
669 wait_queue_head_t hs_activate_wait_q;
670 bool is_suspended;
671 u8 event_body[MAX_EVENT_SIZE];
672 u32 hw_dot_11n_dev_cap;
673 u8 hw_dev_mcs_support;
5e6e3a92
BZ
674 u8 adhoc_11n_enabled;
675 u8 chan_offset;
676 struct mwifiex_dbg dbg;
677 u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
678 u32 arp_filter_size;
600f5d90
AK
679 u16 cmd_wait_q_required;
680 struct mwifiex_wait_queue cmd_wait_q;
5e6e3a92
BZ
681};
682
683int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
684void mwifiex_free_lock_list(struct mwifiex_adapter *adapter);
685
686int mwifiex_init_fw(struct mwifiex_adapter *adapter);
687
688int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter);
689
690int mwifiex_shutdown_drv(struct mwifiex_adapter *adapter);
691
692int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter);
693
694int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *);
695
5e6e3a92
BZ
696int mwifiex_recv_packet(struct mwifiex_adapter *, struct sk_buff *skb);
697
698int mwifiex_process_event(struct mwifiex_adapter *adapter);
699
600f5d90 700int mwifiex_complete_cmd(struct mwifiex_adapter *adapter);
5e6e3a92 701
600f5d90
AK
702int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no,
703 u16 cmd_action, u32 cmd_oid, void *data_buf);
704
705int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no,
706 u16 cmd_action, u32 cmd_oid, void *data_buf);
5e6e3a92
BZ
707
708void mwifiex_cmd_timeout_func(unsigned long function_context);
709
5e6e3a92
BZ
710int mwifiex_get_debug_info(struct mwifiex_private *,
711 struct mwifiex_debug_info *);
712
713int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter);
714int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter);
715void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter);
600f5d90 716void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter);
5e6e3a92
BZ
717
718void mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter,
719 struct cmd_ctrl_node *cmd_node);
720
721void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
722 struct cmd_ctrl_node *cmd_node,
723 u32 addtail);
724
725int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter);
726int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter);
727int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
728 struct sk_buff *skb);
729int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
730 struct mwifiex_tx_param *tx_param);
731int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags);
732int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
733 struct sk_buff *skb, int status);
734int mwifiex_recv_packet_complete(struct mwifiex_adapter *,
735 struct sk_buff *skb, int status);
736void mwifiex_clean_txrx(struct mwifiex_private *priv);
737u8 mwifiex_check_last_packet_indication(struct mwifiex_private *priv);
738void mwifiex_check_ps_cond(struct mwifiex_adapter *adapter);
739void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *, u8 *,
740 u32);
741int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
742 struct host_cmd_ds_command *cmd,
743 u16 cmd_action, uint16_t ps_bitmap,
744 void *data_buf);
745int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
746 struct host_cmd_ds_command *resp,
747 void *data_buf);
748void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
749void mwifiex_hs_activated_event(struct mwifiex_private *priv,
750 u8 activated);
751int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
752 struct host_cmd_ds_command *resp);
753int mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
754 struct sk_buff *skb);
755int mwifiex_sta_prepare_cmd(struct mwifiex_private *, uint16_t cmd_no,
756 u16 cmd_action, u32 cmd_oid,
757 void *data_buf, void *cmd_buf);
758int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no,
600f5d90 759 void *cmd_buf);
5e6e3a92
BZ
760int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *,
761 struct sk_buff *skb);
762int mwifiex_process_sta_event(struct mwifiex_private *);
763void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb);
764int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta);
600f5d90
AK
765int mwifiex_scan_networks(struct mwifiex_private *priv,
766 const struct mwifiex_user_scan_cfg *user_scan_in);
572e8f3e 767int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd,
5e6e3a92
BZ
768 void *data_buf);
769void mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
770 struct cmd_ctrl_node *cmd_node);
771int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
600f5d90 772 struct host_cmd_ds_command *resp);
5e6e3a92
BZ
773s32 mwifiex_find_ssid_in_list(struct mwifiex_private *priv,
774 struct mwifiex_802_11_ssid *ssid, u8 *bssid,
775 u32 mode);
776s32 mwifiex_find_bssid_in_list(struct mwifiex_private *priv, u8 *bssid,
777 u32 mode);
778int mwifiex_find_best_network(struct mwifiex_private *priv,
779 struct mwifiex_ssid_bssid *req_ssid_bssid);
780s32 mwifiex_ssid_cmp(struct mwifiex_802_11_ssid *ssid1,
781 struct mwifiex_802_11_ssid *ssid2);
600f5d90 782int mwifiex_associate(struct mwifiex_private *priv,
5e6e3a92
BZ
783 struct mwifiex_bssdescriptor *bss_desc);
784int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
785 struct host_cmd_ds_command
786 *cmd, void *data_buf);
787int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
600f5d90 788 struct host_cmd_ds_command *resp);
5e6e3a92
BZ
789void mwifiex_reset_connect_state(struct mwifiex_private *priv);
790void mwifiex_2040_coex_event(struct mwifiex_private *priv);
791u8 mwifiex_band_to_radio_type(u8 band);
600f5d90
AK
792int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
793int mwifiex_adhoc_start(struct mwifiex_private *priv,
5e6e3a92 794 struct mwifiex_802_11_ssid *adhoc_ssid);
600f5d90 795int mwifiex_adhoc_join(struct mwifiex_private *priv,
5e6e3a92
BZ
796 struct mwifiex_bssdescriptor *bss_desc);
797int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
798 struct host_cmd_ds_command *cmd,
799 void *data_buf);
800int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
801 struct host_cmd_ds_command *cmd,
802 void *data_buf);
803int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
600f5d90 804 struct host_cmd_ds_command *resp);
572e8f3e 805int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd);
5e6e3a92
BZ
806struct mwifiex_chan_freq_power *
807 mwifiex_get_cfp_by_band_and_channel_from_cfg80211(
808 struct mwifiex_private *priv,
809 u8 band, u16 channel);
810struct mwifiex_chan_freq_power *mwifiex_get_cfp_by_band_and_freq_from_cfg80211(
811 struct mwifiex_private *priv,
812 u8 band, u32 freq);
572e8f3e 813u32 mwifiex_index_to_data_rate(u8 index, u8 ht_info);
5e6e3a92
BZ
814u32 mwifiex_find_freq_from_band_chan(u8, u8);
815int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask,
816 u8 **buffer);
5e6e3a92
BZ
817u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv,
818 u8 *rates);
819u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates);
572e8f3e 820u8 mwifiex_data_rate_to_index(u32 rate);
5e6e3a92 821u8 mwifiex_is_rate_auto(struct mwifiex_private *priv);
572e8f3e 822int mwifiex_get_rate_index(u16 *rateBitmap, int size);
5e6e3a92
BZ
823extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE];
824void mwifiex_save_curr_bcn(struct mwifiex_private *priv);
825void mwifiex_free_curr_bcn(struct mwifiex_private *priv);
826int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv,
827 struct host_cmd_ds_command *cmd);
828int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
829 struct host_cmd_ds_command *resp);
830int is_command_pending(struct mwifiex_adapter *adapter);
831
832/*
833 * This function checks if the queuing is RA based or not.
834 */
835static inline u8
836mwifiex_queuing_ra_based(struct mwifiex_private *priv)
837{
838 /*
839 * Currently we assume if we are in Infra, then DA=RA. This might not be
840 * true in the future
841 */
eecd8250 842 if ((priv->bss_mode == NL80211_IFTYPE_STATION) &&
5e6e3a92
BZ
843 (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA))
844 return false;
845
846 return true;
847}
848
849/*
850 * This function copies rates.
851 */
852static inline u32
853mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len)
854{
855 int i;
856
857 for (i = 0; i < len && src[i]; i++, pos++) {
858 if (pos >= MWIFIEX_SUPPORTED_RATES)
859 break;
860 dest[pos] = src[i];
861 }
862
863 return pos;
864}
865
866/*
867 * This function returns the correct private structure pointer based
868 * upon the BSS type and BSS number.
869 */
870static inline struct mwifiex_private *
871mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter,
2be7859f 872 u8 bss_num, u8 bss_type)
5e6e3a92
BZ
873{
874 int i;
875
876 for (i = 0; i < adapter->priv_num; i++) {
877 if (adapter->priv[i]) {
878 if ((adapter->priv[i]->bss_num == bss_num)
879 && (adapter->priv[i]->bss_type == bss_type))
880 break;
881 }
882 }
883 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
884}
885
886/*
887 * This function returns the first available private structure pointer
888 * based upon the BSS role.
889 */
890static inline struct mwifiex_private *
891mwifiex_get_priv(struct mwifiex_adapter *adapter,
892 enum mwifiex_bss_role bss_role)
893{
894 int i;
895
896 for (i = 0; i < adapter->priv_num; i++) {
897 if (adapter->priv[i]) {
898 if (bss_role == MWIFIEX_BSS_ROLE_ANY ||
899 GET_BSS_ROLE(adapter->priv[i]) == bss_role)
900 break;
901 }
902 }
903
904 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
905}
906
907/*
908 * This function returns the driver private structure of a network device.
909 */
910static inline struct mwifiex_private *
911mwifiex_netdev_get_priv(struct net_device *dev)
912{
913 return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev));
914}
915
5e6e3a92
BZ
916struct mwifiex_private *mwifiex_bss_index_to_priv(struct mwifiex_adapter
917 *adapter, u8 bss_index);
600f5d90
AK
918int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
919 u32 func_init_shutdown);
5e6e3a92
BZ
920int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *);
921int mwifiex_remove_card(struct mwifiex_adapter *, struct semaphore *);
922
923void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version,
924 int maxlen);
600f5d90
AK
925int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
926 struct mwifiex_multicast_list *mcast_list);
927int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
928 struct net_device *dev);
929int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter);
5e6e3a92 930int mwifiex_bss_start(struct mwifiex_private *priv,
5e6e3a92
BZ
931 struct mwifiex_ssid_bssid *ssid_bssid);
932int mwifiex_set_hs_params(struct mwifiex_private *priv,
600f5d90 933 u16 action, int cmd_type,
5e6e3a92 934 struct mwifiex_ds_hs_cfg *hscfg);
600f5d90 935int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
5e6e3a92 936int mwifiex_enable_hs(struct mwifiex_adapter *adapter);
5e6e3a92 937int mwifiex_get_signal_info(struct mwifiex_private *priv,
5e6e3a92
BZ
938 struct mwifiex_ds_get_signal *signal);
939int mwifiex_drv_get_data_rate(struct mwifiex_private *priv,
940 struct mwifiex_rate_cfg *rate);
600f5d90 941int mwifiex_find_best_bss(struct mwifiex_private *priv,
5e6e3a92
BZ
942 struct mwifiex_ssid_bssid *ssid_bssid);
943int mwifiex_request_scan(struct mwifiex_private *priv,
5e6e3a92
BZ
944 struct mwifiex_802_11_ssid *req_ssid);
945int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv,
946 struct mwifiex_user_scan_cfg *scan_req);
947int mwifiex_change_adhoc_chan(struct mwifiex_private *priv, int channel);
948int mwifiex_set_radio(struct mwifiex_private *priv, u8 option);
949
5e6e3a92
BZ
950int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, int channel);
951
5e6e3a92
BZ
952int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
953 int key_len, u8 key_index, int disable);
954
955int mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len);
956
957int mwifiex_get_ver_ext(struct mwifiex_private *priv);
958
959int mwifiex_get_stats_info(struct mwifiex_private *priv,
960 struct mwifiex_ds_get_stats *log);
961
962int mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type,
963 u32 reg_offset, u32 reg_value);
964
965int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type,
966 u32 reg_offset, u32 *value);
967
968int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes,
969 u8 *value);
970
971int mwifiex_set_11n_httx_cfg(struct mwifiex_private *priv, int data);
972
973int mwifiex_get_11n_httx_cfg(struct mwifiex_private *priv, int *data);
974
975int mwifiex_set_tx_rate_cfg(struct mwifiex_private *priv, int tx_rate_index);
976
977int mwifiex_get_tx_rate_cfg(struct mwifiex_private *priv, int *tx_rate_index);
978
600f5d90 979int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode);
5e6e3a92
BZ
980
981int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter,
982 char *version, int max_len);
983
600f5d90
AK
984int mwifiex_set_tx_power(struct mwifiex_private *priv,
985 struct mwifiex_power_cfg *power_cfg);
5e6e3a92
BZ
986
987int mwifiex_main_process(struct mwifiex_adapter *);
988
600f5d90
AK
989int mwifiex_bss_set_channel(struct mwifiex_private *,
990 struct mwifiex_chan_freq_power *cfp);
5e6e3a92 991int mwifiex_bss_ioctl_find_bss(struct mwifiex_private *,
5e6e3a92 992 struct mwifiex_ssid_bssid *);
600f5d90
AK
993int mwifiex_set_radio_band_cfg(struct mwifiex_private *,
994 struct mwifiex_ds_band_cfg *);
5e6e3a92
BZ
995int mwifiex_get_bss_info(struct mwifiex_private *,
996 struct mwifiex_bss_info *);
997
998#ifdef CONFIG_DEBUG_FS
999void mwifiex_debugfs_init(void);
1000void mwifiex_debugfs_remove(void);
1001
1002void mwifiex_dev_debugfs_init(struct mwifiex_private *priv);
1003void mwifiex_dev_debugfs_remove(struct mwifiex_private *priv);
1004#endif
1005#endif /* !_MWIFIEX_MAIN_H_ */
This page took 0.14533 seconds and 5 git commands to generate.