2 * Marvell Wireless LAN device driver: major data structures and prototypes
4 * Copyright (C) 2011-2014, Marvell International Ltd.
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.
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.
20 #ifndef _MWIFIEX_MAIN_H_
21 #define _MWIFIEX_MAIN_H_
23 #include <linux/completion.h>
24 #include <linux/kernel.h>
25 #include <linux/module.h>
26 #include <linux/sched.h>
27 #include <linux/semaphore.h>
29 #include <linux/skbuff.h>
30 #include <linux/if_arp.h>
31 #include <linux/etherdevice.h>
33 #include <net/lib80211.h>
34 #include <linux/vmalloc.h>
35 #include <linux/firmware.h>
36 #include <linux/ctype.h>
38 #include <linux/idr.h>
39 #include <linux/inetdevice.h>
40 #include <linux/devcoredump.h>
41 #include <linux/err.h>
42 #include <linux/gpio.h>
43 #include <linux/gfp.h>
44 #include <linux/interrupt.h>
46 #include <linux/of_gpio.h>
47 #include <linux/of_platform.h>
48 #include <linux/platform_device.h>
49 #include <linux/pm_runtime.h>
50 #include <linux/slab.h>
51 #include <linux/of_irq.h>
61 extern const char driver_version[];
63 extern bool aggr_ctrl;
65 struct mwifiex_adapter;
66 struct mwifiex_private;
73 #define MWIFIEX_DRIVER_MODE_STA BIT(0)
74 #define MWIFIEX_DRIVER_MODE_UAP BIT(1)
75 #define MWIFIEX_DRIVER_MODE_P2P BIT(2)
76 #define MWIFIEX_DRIVER_MODE_BITMASK (BIT(0) | BIT(1) | BIT(2))
78 #define MWIFIEX_MAX_AP 64
80 #define MWIFIEX_MAX_PKTS_TXQ 16
82 #define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT (5 * HZ)
84 #define MWIFIEX_TIMER_10S 10000
85 #define MWIFIEX_TIMER_1S 1000
87 #define MAX_TX_PENDING 400
88 #define LOW_TX_PENDING 380
90 #define HIGH_RX_PENDING 50
91 #define LOW_RX_PENDING 20
93 #define MWIFIEX_UPLD_SIZE (2312)
95 #define MAX_EVENT_SIZE 2048
97 #define MWIFIEX_FW_DUMP_SIZE (2 * 1024 * 1024)
99 #define ARP_FILTER_MAX_BUF_SIZE 68
101 #define MWIFIEX_KEY_BUFFER_SIZE 16
102 #define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
103 #define MWIFIEX_MAX_REGION_CODE 9
105 #define DEFAULT_BCN_AVG_FACTOR 8
106 #define DEFAULT_DATA_AVG_FACTOR 8
108 #define FIRST_VALID_CHANNEL 0xff
109 #define DEFAULT_AD_HOC_CHANNEL 6
110 #define DEFAULT_AD_HOC_CHANNEL_A 36
112 #define DEFAULT_BCN_MISS_TIMEOUT 5
114 #define MAX_SCAN_BEACON_BUFFER 8000
116 #define SCAN_BEACON_ENTRY_PAD 6
118 #define MWIFIEX_PASSIVE_SCAN_CHAN_TIME 110
119 #define MWIFIEX_ACTIVE_SCAN_CHAN_TIME 40
120 #define MWIFIEX_SPECIFIC_SCAN_CHAN_TIME 40
121 #define MWIFIEX_DEF_SCAN_CHAN_GAP_TIME 50
123 #define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI)))
125 #define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S)
127 #define RSN_GTK_OUI_OFFSET 2
129 #define MWIFIEX_OUI_NOT_PRESENT 0
130 #define MWIFIEX_OUI_PRESENT 1
132 #define PKT_TYPE_MGMT 0xE5
135 * Do not check for data_received for USB, as data_received
136 * is handled in mwifiex_usb_recv for USB
138 #define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \
139 adapter->event_received || \
140 adapter->data_received)
142 #define MWIFIEX_TYPE_CMD 1
143 #define MWIFIEX_TYPE_DATA 0
144 #define MWIFIEX_TYPE_AGGR_DATA 10
145 #define MWIFIEX_TYPE_EVENT 3
147 #define MAX_BITMAP_RATES_SIZE 18
149 #define MAX_CHANNEL_BAND_BG 14
150 #define MAX_CHANNEL_BAND_A 165
152 #define MAX_FREQUENCY_BAND_BG 2484
154 #define MWIFIEX_EVENT_HEADER_LEN 4
155 #define MWIFIEX_UAP_EVENT_EXTRA_HEADER 2
157 #define MWIFIEX_TYPE_LEN 4
158 #define MWIFIEX_USB_TYPE_CMD 0xF00DFACE
159 #define MWIFIEX_USB_TYPE_DATA 0xBEADC0DE
160 #define MWIFIEX_USB_TYPE_EVENT 0xBEEFFACE
162 /* Threshold for tx_timeout_cnt before we trigger a card reset */
163 #define TX_TIMEOUT_THRESHOLD 6
165 #define MWIFIEX_DRV_INFO_SIZE_MAX 0x40000
167 /* Address alignment */
168 #define MWIFIEX_ALIGN_ADDR(p, a) (((long)(p) + (a) - 1) & ~((a) - 1))
170 #define MWIFIEX_MAC_LOCAL_ADMIN_BIT 41
173 *enum mwifiex_debug_level - marvell wifi debug level
175 enum MWIFIEX_DEBUG_LEVEL {
176 MWIFIEX_DBG_MSG = 0x00000001,
177 MWIFIEX_DBG_FATAL = 0x00000002,
178 MWIFIEX_DBG_ERROR = 0x00000004,
179 MWIFIEX_DBG_DATA = 0x00000008,
180 MWIFIEX_DBG_CMD = 0x00000010,
181 MWIFIEX_DBG_EVENT = 0x00000020,
182 MWIFIEX_DBG_INTR = 0x00000040,
183 MWIFIEX_DBG_IOCTL = 0x00000080,
185 MWIFIEX_DBG_MPA_D = 0x00008000,
186 MWIFIEX_DBG_DAT_D = 0x00010000,
187 MWIFIEX_DBG_CMD_D = 0x00020000,
188 MWIFIEX_DBG_EVT_D = 0x00040000,
189 MWIFIEX_DBG_FW_D = 0x00080000,
190 MWIFIEX_DBG_IF_D = 0x00100000,
192 MWIFIEX_DBG_ENTRY = 0x10000000,
193 MWIFIEX_DBG_WARN = 0x20000000,
194 MWIFIEX_DBG_INFO = 0x40000000,
195 MWIFIEX_DBG_DUMP = 0x80000000,
197 MWIFIEX_DBG_ANY = 0xffffffff
200 #define MWIFIEX_DEFAULT_DEBUG_MASK (MWIFIEX_DBG_MSG | \
201 MWIFIEX_DBG_FATAL | \
205 void _mwifiex_dbg(const struct mwifiex_adapter *adapter, int mask,
206 const char *fmt, ...);
207 #define mwifiex_dbg(adapter, mask, fmt, ...) \
208 _mwifiex_dbg(adapter, MWIFIEX_DBG_##mask, fmt, ##__VA_ARGS__)
210 #define DEBUG_DUMP_DATA_MAX_LEN 128
211 #define mwifiex_dbg_dump(adapter, dbg_mask, str, buf, len) \
213 if ((adapter)->debug_mask & MWIFIEX_DBG_##dbg_mask) \
214 print_hex_dump(KERN_DEBUG, str, \
215 DUMP_PREFIX_OFFSET, 16, 1, \
219 /** Min BGSCAN interval 15 second */
220 #define MWIFIEX_BGSCAN_INTERVAL 15000
221 /** default repeat count */
222 #define MWIFIEX_BGSCAN_REPEAT_COUNT 6
225 u32 num_cmd_host_to_card_failure;
226 u32 num_cmd_sleep_cfm_host_to_card_failure;
227 u32 num_tx_host_to_card_failure;
228 u32 num_event_deauth;
229 u32 num_event_disassoc;
230 u32 num_event_link_lost;
232 u32 num_cmd_assoc_success;
233 u32 num_cmd_assoc_failure;
237 u16 last_cmd_id[DBG_CMD_NUM];
238 u16 last_cmd_act[DBG_CMD_NUM];
240 u16 last_cmd_resp_id[DBG_CMD_NUM];
241 u16 last_cmd_resp_index;
242 u16 last_event[DBG_CMD_NUM];
243 u16 last_event_index;
244 u32 last_mp_wr_bitmap[MWIFIEX_DBG_SDIO_MP_NUM];
245 u32 last_mp_wr_ports[MWIFIEX_DBG_SDIO_MP_NUM];
246 u32 last_mp_wr_len[MWIFIEX_DBG_SDIO_MP_NUM];
247 u32 last_mp_curr_wr_port[MWIFIEX_DBG_SDIO_MP_NUM];
248 u8 last_sdio_mp_index;
251 enum MWIFIEX_HARDWARE_STATUS {
252 MWIFIEX_HW_STATUS_READY,
253 MWIFIEX_HW_STATUS_INITIALIZING,
254 MWIFIEX_HW_STATUS_INIT_DONE,
255 MWIFIEX_HW_STATUS_RESET,
256 MWIFIEX_HW_STATUS_NOT_READY
259 enum MWIFIEX_802_11_POWER_MODE {
260 MWIFIEX_802_11_POWER_MODE_CAM,
261 MWIFIEX_802_11_POWER_MODE_PSP
264 struct mwifiex_tx_param {
268 enum MWIFIEX_PS_STATE {
275 enum mwifiex_iface_type {
281 struct mwifiex_add_ba_param {
289 struct mwifiex_tx_aggr {
295 enum mwifiex_ba_status {
301 struct mwifiex_ra_list_tbl {
302 struct list_head list;
303 struct sk_buff_head skb_head;
309 enum mwifiex_ba_status ba_status;
316 struct mwifiex_tid_tbl {
317 struct list_head ra_list;
320 #define WMM_HIGHEST_PRIORITY 7
321 #define HIGH_PRIO_TID 7
322 #define LOW_PRIO_TID 0
323 #define NO_PKT_PRIO_TID -1
324 #define MWIFIEX_WMM_DRV_DELAY_MAX 510
326 struct mwifiex_wmm_desc {
327 struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID];
328 u32 packets_out[MAX_NUM_TID];
329 u32 pkts_paused[MAX_NUM_TID];
330 /* spin lock to protect ra_list */
331 spinlock_t ra_list_spinlock;
332 struct mwifiex_wmm_ac_status ac_status[IEEE80211_NUM_ACS];
333 enum mwifiex_wmm_ac_e ac_down_graded_vals[IEEE80211_NUM_ACS];
334 u32 drv_pkt_delay_max;
335 u8 queue_priority[IEEE80211_NUM_ACS];
336 u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */
337 /* Number of transmit packets queued */
338 atomic_t tx_pkts_queued;
339 /* Tracks highest priority with a packet queued */
340 atomic_t highest_queued_prio;
343 struct mwifiex_802_11_security {
349 u32 authentication_mode;
354 struct ieee_types_header {
359 struct ieee_types_vendor_specific {
360 struct ieee_types_vendor_header vend_hdr;
361 u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_vendor_header)];
364 struct ieee_types_generic {
365 struct ieee_types_header ieee_hdr;
366 u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_header)];
369 struct ieee_types_bss_co_2040 {
370 struct ieee_types_header ieee_hdr;
374 struct ieee_types_extcap {
375 struct ieee_types_header ieee_hdr;
379 struct ieee_types_vht_cap {
380 struct ieee_types_header ieee_hdr;
381 struct ieee80211_vht_cap vhtcap;
384 struct ieee_types_vht_oper {
385 struct ieee_types_header ieee_hdr;
386 struct ieee80211_vht_operation vhtoper;
389 struct ieee_types_aid {
390 struct ieee_types_header ieee_hdr;
394 struct mwifiex_bssdescriptor {
395 u8 mac_address[ETH_ALEN];
396 struct cfg80211_ssid ssid;
404 u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
405 u8 data_rates[MWIFIEX_SUPPORTED_RATES];
407 * BAND_B(0x01): 'b' band
408 * BAND_G(0x02): 'g' band
409 * BAND_A(0X04): 'a' band
414 union ieee_types_phy_param_set phy_param_set;
415 union ieee_types_ss_param_set ss_param_set;
417 struct ieee_types_wmm_parameter wmm_ie;
419 struct ieee80211_ht_cap *bcn_ht_cap;
421 struct ieee80211_ht_operation *bcn_ht_oper;
424 u16 bss_co_2040_offset;
427 struct ieee80211_vht_cap *bcn_vht_cap;
429 struct ieee80211_vht_operation *bcn_vht_oper;
431 struct ieee_types_oper_mode_ntf *oper_mode;
432 u16 oper_mode_offset;
434 struct ieee_types_vendor_specific *bcn_wpa_ie;
436 struct ieee_types_generic *bcn_rsn_ie;
438 struct ieee_types_generic *bcn_wapi_ie;
444 u8 chan_sw_ie_present;
447 struct mwifiex_current_bss_params {
448 struct mwifiex_bssdescriptor bss_descriptor;
450 u8 wmm_uapsd_enabled;
453 u8 data_rates[MWIFIEX_SUPPORTED_RATES];
456 struct mwifiex_sleep_params {
465 struct mwifiex_sleep_period {
470 struct mwifiex_wep_key {
474 u8 key_material[MWIFIEX_KEY_BUFFER_SIZE];
477 #define MAX_REGION_CHANNEL_NUM 2
479 struct mwifiex_chan_freq_power {
491 #define MWIFIEX_MAX_TRIPLET_802_11D 83
493 struct mwifiex_802_11d_domain_reg {
494 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
496 struct ieee80211_country_ie_triplet
497 triplet[MWIFIEX_MAX_TRIPLET_802_11D];
500 struct mwifiex_vendor_spec_cfg_ie {
503 u8 ie[MWIFIEX_MAX_VSIE_LEN];
510 struct mwifiex_roc_cfg {
512 struct ieee80211_channel chan;
515 enum mwifiex_iface_work_flags {
516 MWIFIEX_IFACE_WORK_DEVICE_DUMP,
517 MWIFIEX_IFACE_WORK_CARD_RESET,
520 enum mwifiex_adapter_work_flags {
521 MWIFIEX_SURPRISE_REMOVED,
522 MWIFIEX_IS_CMD_TIMEDOUT,
523 MWIFIEX_IS_SUSPENDED,
524 MWIFIEX_IS_HS_CONFIGURED,
525 MWIFIEX_IS_HS_ENABLING,
528 struct mwifiex_band_config {
535 struct mwifiex_channel_band {
536 struct mwifiex_band_config band_config;
540 struct mwifiex_private {
541 struct mwifiex_adapter *adapter;
548 u8 curr_addr[ETH_ALEN];
553 /* track consecutive timeout */
555 struct net_device *netdev;
556 struct net_device_stats stats;
561 u8 max_tx_power_level;
562 u8 min_tx_power_level;
570 u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
572 u8 is_data_rate_auto;
583 struct mwifiex_bssdescriptor *attempted_bss_desc;
584 struct cfg80211_ssid prev_ssid;
585 u8 prev_bssid[ETH_ALEN];
586 struct mwifiex_current_bss_params curr_bss_params;
592 u8 adhoc_is_link_sensed;
594 struct mwifiex_802_11_security sec_info;
595 struct mwifiex_wep_key wep_key[NUM_WEP_KEYS];
596 u16 wep_key_curr_index;
600 struct host_cmd_ds_802_11_key_material aes_key;
601 struct host_cmd_ds_802_11_key_material_v2 aes_key_v2;
609 struct mwifiex_wmm_desc wmm;
610 atomic_t wmm_tx_pending[IEEE80211_NUM_ACS];
611 struct list_head sta_list;
612 /* spin lock for associated station/TDLS peers list */
613 spinlock_t sta_list_spinlock;
614 struct list_head auto_tdls_list;
615 /* spin lock for auto TDLS peer list */
616 spinlock_t auto_tdls_lock;
617 struct list_head tx_ba_stream_tbl_ptr;
618 /* spin lock for tx_ba_stream_tbl_ptr queue */
619 spinlock_t tx_ba_stream_tbl_lock;
620 struct mwifiex_tx_aggr aggr_prio_tbl[MAX_NUM_TID];
621 struct mwifiex_add_ba_param add_ba_param;
622 u16 rx_seq[MAX_NUM_TID];
623 u8 tos_to_tid_inv[MAX_NUM_TID];
624 struct list_head rx_reorder_tbl_ptr;
625 /* spin lock for rx_reorder_tbl_ptr queue */
626 spinlock_t rx_reorder_tbl_lock;
627 #define MWIFIEX_ASSOC_RSP_BUF_SIZE 500
628 u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE];
631 #define MWIFIEX_GENIE_BUF_SIZE 256
632 u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE];
635 struct mwifiex_vendor_spec_cfg_ie vs_ie[MWIFIEX_MAX_VSIE_NUM];
637 #define MWIFIEX_ASSOC_TLV_BUF_SIZE 256
638 u8 assoc_tlv_buf[MWIFIEX_ASSOC_TLV_BUF_SIZE];
639 u8 assoc_tlv_buf_len;
643 /* spin lock for beacon buffer */
644 spinlock_t curr_bcn_buf_lock;
645 struct wireless_dev wdev;
646 struct mwifiex_chan_freq_power cfp;
648 char version_str[128];
649 #ifdef CONFIG_DEBUG_FS
650 struct dentry *dfs_dev_dir;
652 u16 current_key_index;
653 struct mutex async_mutex;
654 struct cfg80211_scan_request *scan_request;
660 u8 subsc_evt_rssi_state;
661 struct mwifiex_ds_misc_subsc_evt async_subsc_evt_storage;
662 struct mwifiex_ie mgmt_ie[MAX_MGMT_IE_INDEX];
670 struct mwifiex_roc_cfg roc_cfg;
674 unsigned long csa_expire_time;
677 struct mwifiex_uap_bss_param bss_cfg;
678 struct cfg80211_chan_def bss_chandef;
679 struct station_parameters *sta_params;
680 struct sk_buff_head tdls_txq;
682 struct timer_list auto_tdls_timer;
683 bool auto_tdls_timer_active;
684 struct idr ack_status_frames;
685 /* spin lock for ack status */
686 spinlock_t ack_status_lock;
687 /** rx histogram data */
688 struct mwifiex_histogram_data *hist_data;
689 struct cfg80211_chan_def dfs_chandef;
690 struct workqueue_struct *dfs_cac_workqueue;
691 struct delayed_work dfs_cac_work;
692 struct timer_list dfs_chan_switch_timer;
693 struct workqueue_struct *dfs_chan_sw_workqueue;
694 struct delayed_work dfs_chan_sw_work;
695 struct cfg80211_beacon_data beacon_after;
696 struct mwifiex_11h_intf_state state_11h;
697 struct mwifiex_ds_mem_rw mem_rw;
698 struct sk_buff_head bypass_txq;
699 struct mwifiex_user_scan_chan hidden_chan[MWIFIEX_USER_SCAN_CHAN_MAX];
700 u8 assoc_resp_ht_param;
701 bool ht_param_present;
705 struct mwifiex_tx_ba_stream_tbl {
706 struct list_head list;
709 enum mwifiex_ba_status ba_status;
713 struct mwifiex_rx_reorder_tbl;
715 struct reorder_tmr_cnxt {
716 struct timer_list timer;
717 struct mwifiex_rx_reorder_tbl *ptr;
718 struct mwifiex_private *priv;
722 struct mwifiex_rx_reorder_tbl {
723 struct list_head list;
729 void **rx_reorder_ptr;
730 struct reorder_tmr_cnxt timer_context;
735 struct mwifiex_bss_prio_node {
736 struct list_head list;
737 struct mwifiex_private *priv;
740 struct mwifiex_bss_prio_tbl {
741 struct list_head bss_prio_head;
742 /* spin lock for bss priority */
743 spinlock_t bss_prio_lock;
744 struct mwifiex_bss_prio_node *bss_prio_cur;
747 struct cmd_ctrl_node {
748 struct list_head list;
749 struct mwifiex_private *priv;
752 struct sk_buff *cmd_skb;
753 struct sk_buff *resp_skb;
761 struct mwifiex_bss_priv {
766 struct mwifiex_tdls_capab {
773 struct ieee80211_ht_cap ht_capb;
774 struct ieee80211_ht_operation ht_oper;
775 struct ieee_types_extcap extcap;
776 struct ieee_types_generic rsn_ie;
777 struct ieee80211_vht_cap vhtcap;
778 struct ieee80211_vht_operation vhtoper;
781 struct mwifiex_station_stats {
793 /* This is AP/TDLS specific structure which stores information
794 * about associated/peer STA
796 struct mwifiex_sta_node {
797 struct list_head list;
798 u8 mac_addr[ETH_ALEN];
802 u8 ampdu_sta[MAX_NUM_TID];
803 u16 rx_seq[MAX_NUM_TID];
806 struct mwifiex_tdls_capab tdls_cap;
807 struct mwifiex_station_stats stats;
811 struct mwifiex_auto_tdls_peer {
812 struct list_head list;
813 u8 mac_addr[ETH_ALEN];
822 #define MWIFIEX_TYPE_AGGR_DATA_V2 11
823 #define MWIFIEX_BUS_AGGR_MODE_LEN_V2 (2)
824 #define MWIFIEX_BUS_AGGR_MAX_LEN 16000
825 #define MWIFIEX_BUS_AGGR_MAX_NUM 10
826 struct bus_aggr_params {
829 u16 tx_aggr_max_size;
834 struct mwifiex_if_ops {
835 int (*init_if) (struct mwifiex_adapter *);
836 void (*cleanup_if) (struct mwifiex_adapter *);
837 int (*check_fw_status) (struct mwifiex_adapter *, u32);
838 int (*check_winner_status)(struct mwifiex_adapter *);
839 int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
840 int (*register_dev) (struct mwifiex_adapter *);
841 void (*unregister_dev) (struct mwifiex_adapter *);
842 int (*enable_int) (struct mwifiex_adapter *);
843 void (*disable_int) (struct mwifiex_adapter *);
844 int (*process_int_status) (struct mwifiex_adapter *);
845 int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *,
846 struct mwifiex_tx_param *);
847 int (*wakeup) (struct mwifiex_adapter *);
848 int (*wakeup_complete) (struct mwifiex_adapter *);
850 /* Interface specific functions */
851 void (*update_mp_end_port) (struct mwifiex_adapter *, u16);
852 void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
853 int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *);
854 int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
855 int (*init_fw_port) (struct mwifiex_adapter *);
856 int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
857 void (*card_reset) (struct mwifiex_adapter *);
858 int (*reg_dump)(struct mwifiex_adapter *, char *);
859 void (*device_dump)(struct mwifiex_adapter *);
860 int (*clean_pcie_ring) (struct mwifiex_adapter *adapter);
861 void (*iface_work)(struct work_struct *work);
862 void (*submit_rem_rx_urbs)(struct mwifiex_adapter *adapter);
863 void (*deaggr_pkt)(struct mwifiex_adapter *, struct sk_buff *);
864 void (*multi_port_resync)(struct mwifiex_adapter *);
865 bool (*is_port_ready)(struct mwifiex_private *);
866 void (*down_dev)(struct mwifiex_adapter *);
867 void (*up_dev)(struct mwifiex_adapter *);
870 struct mwifiex_adapter {
872 unsigned int debug_mask;
873 struct mwifiex_iface_comb iface_limit;
874 struct mwifiex_iface_comb curr_iface_comb;
875 struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM];
877 const struct firmware *firmware;
882 u8 perm_addr[ETH_ALEN];
883 unsigned long work_flags;
884 u32 fw_release_number;
886 u16 init_wait_q_woken;
887 wait_queue_head_t init_wait_q;
889 struct mwifiex_if_ops if_ops;
890 atomic_t bypass_tx_pending;
893 atomic_t cmd_pending;
894 atomic_t tx_hw_pending;
895 struct workqueue_struct *workqueue;
896 struct work_struct main_work;
897 struct workqueue_struct *rx_workqueue;
898 struct work_struct rx_work;
899 struct workqueue_struct *dfs_workqueue;
900 struct work_struct dfs_work;
901 bool rx_work_enabled;
903 bool delay_main_work;
906 struct mwifiex_bss_prio_tbl bss_prio_tbl[MWIFIEX_MAX_BSS_NUM];
907 /* spin lock for main process */
908 spinlock_t main_proc_lock;
909 u32 mwifiex_processing;
912 u16 curr_tx_buf_size;
913 /* sdio single port rx aggregation capability */
914 bool host_disable_sdio_rx_aggr;
915 bool sdio_rx_aggr_enable;
916 u16 sdio_rx_block_size;
918 enum MWIFIEX_HARDWARE_STATUS hw_status;
919 u16 number_of_antenna;
921 /* spin lock for interrupt handling */
925 struct sk_buff *event_skb;
926 u8 upld_buf[MWIFIEX_UPLD_SIZE];
929 u8 cmd_resp_received;
933 struct cmd_ctrl_node *cmd_pool;
934 struct cmd_ctrl_node *curr_cmd;
935 /* spin lock for command */
936 spinlock_t mwifiex_cmd_lock;
938 struct timer_list cmd_timer;
939 struct list_head cmd_free_q;
940 /* spin lock for cmd_free_q */
941 spinlock_t cmd_free_q_lock;
942 struct list_head cmd_pending_q;
943 /* spin lock for cmd_pending_q */
944 spinlock_t cmd_pending_q_lock;
945 struct list_head scan_pending_q;
946 /* spin lock for scan_pending_q */
947 spinlock_t scan_pending_q_lock;
948 /* spin lock for RX processing routine */
949 spinlock_t rx_proc_lock;
950 struct sk_buff_head tx_data_q;
954 struct mwifiex_802_11d_domain_reg domain_reg;
957 u16 specific_scan_time;
958 u16 active_scan_time;
959 u16 passive_scan_time;
960 u16 scan_chan_gap_time;
964 struct mwifiex_chan_scan_param_set *scan_channels;
966 struct mwifiex_sleep_params sleep_params;
967 struct mwifiex_sleep_period sleep_period;
972 u16 local_listen_interval;
973 u16 null_pkt_interval;
974 struct sk_buff *sleep_cfm;
975 u16 bcn_miss_time_out;
976 u16 adhoc_awake_period;
980 u16 enhanced_ps_mode;
981 u8 pm_wakeup_card_req;
984 u32 pm_wakeup_fw_try;
985 struct timer_list wakeup_timer;
986 struct mwifiex_hs_config_param hs_cfg;
988 u16 hs_activate_wait_q_woken;
989 wait_queue_head_t hs_activate_wait_q;
990 u8 event_body[MAX_EVENT_SIZE];
991 u32 hw_dot_11n_dev_cap;
992 u8 hw_dev_mcs_support;
993 u8 user_dev_mcs_support;
994 u8 adhoc_11n_enabled;
996 struct mwifiex_dbg dbg;
997 u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
999 struct mwifiex_wait_queue cmd_wait_q;
1000 u8 scan_wait_q_woken;
1001 spinlock_t queue_lock; /* lock for tx queues */
1002 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
1003 u16 max_mgmt_ie_index;
1004 const struct firmware *cal_data;
1005 struct device_node *dt_node;
1008 u32 is_hw_11ac_capable;
1009 u32 hw_dot_11ac_dev_cap;
1010 u32 hw_dot_11ac_mcs_support;
1011 u32 usr_dot_11ac_dev_cap_bg;
1012 u32 usr_dot_11ac_dev_cap_a;
1013 u32 usr_dot_11ac_mcs_support;
1015 atomic_t pending_bridged_pkts;
1017 /* For synchronizing FW initialization with device lifecycle. */
1018 struct completion *fw_done;
1022 u8 key_api_major_ver, key_api_minor_ver;
1023 struct memory_type_mapping *mem_type_mapping_tbl;
1025 bool scan_chan_gap_enabled;
1026 struct sk_buff_head rx_data_q;
1028 struct mwifiex_chan_stats *chan_stats;
1029 u32 num_in_chan_stats;
1033 u8 coex_min_scan_time;
1034 u8 coex_max_scan_time;
1036 u8 coex_tx_win_size;
1037 u8 coex_rx_win_size;
1039 u8 active_scan_triggered;
1042 struct cfg80211_wowlan_nd_info *nd_info;
1043 struct ieee80211_regdomain *regd;
1045 /* Wake-on-WLAN (WoWLAN) */
1048 /* Aggregation parameters*/
1049 struct bus_aggr_params bus_aggr;
1050 /* Device dump data/length */
1053 struct timer_list devdump_timer;
1056 void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
1058 int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
1060 void mwifiex_set_trans_start(struct net_device *dev);
1062 void mwifiex_stop_net_dev_queue(struct net_device *netdev,
1063 struct mwifiex_adapter *adapter);
1065 void mwifiex_wake_up_net_dev_queue(struct net_device *netdev,
1066 struct mwifiex_adapter *adapter);
1068 int mwifiex_init_priv(struct mwifiex_private *priv);
1069 void mwifiex_free_priv(struct mwifiex_private *priv);
1071 int mwifiex_init_fw(struct mwifiex_adapter *adapter);
1073 int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter);
1075 void mwifiex_shutdown_drv(struct mwifiex_adapter *adapter);
1077 int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *);
1079 int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb);
1080 int mwifiex_uap_recv_packet(struct mwifiex_private *priv,
1081 struct sk_buff *skb);
1083 int mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
1084 struct sk_buff *skb);
1086 int mwifiex_process_event(struct mwifiex_adapter *adapter);
1088 int mwifiex_complete_cmd(struct mwifiex_adapter *adapter,
1089 struct cmd_ctrl_node *cmd_node);
1091 int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no,
1092 u16 cmd_action, u32 cmd_oid, void *data_buf, bool sync);
1094 void mwifiex_cmd_timeout_func(struct timer_list *t);
1096 int mwifiex_get_debug_info(struct mwifiex_private *,
1097 struct mwifiex_debug_info *);
1099 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter);
1100 void mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter);
1101 void mwifiex_free_cmd_buffers(struct mwifiex_adapter *adapter);
1102 void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter);
1103 void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter);
1104 void mwifiex_cancel_scan(struct mwifiex_adapter *adapter);
1106 void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter,
1107 struct cmd_ctrl_node *cmd_node);
1109 void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
1110 struct cmd_ctrl_node *cmd_node);
1112 int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter);
1113 int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter);
1114 int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
1115 struct sk_buff *skb);
1116 int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
1117 struct mwifiex_tx_param *tx_param);
1118 int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags);
1119 int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
1120 struct sk_buff *skb, int aggr, int status);
1121 void mwifiex_clean_txrx(struct mwifiex_private *priv);
1122 u8 mwifiex_check_last_packet_indication(struct mwifiex_private *priv);
1123 void mwifiex_check_ps_cond(struct mwifiex_adapter *adapter);
1124 void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *, u8 *,
1126 int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1127 struct host_cmd_ds_command *cmd,
1128 u16 cmd_action, uint16_t ps_bitmap,
1129 struct mwifiex_ds_auto_ds *auto_ds);
1130 int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
1131 struct host_cmd_ds_command *resp,
1132 struct mwifiex_ds_pm_cfg *pm_cfg);
1133 void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
1134 void mwifiex_hs_activated_event(struct mwifiex_private *priv,
1136 int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
1137 int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg);
1138 int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
1139 struct host_cmd_ds_command *resp);
1140 int mwifiex_process_rx_packet(struct mwifiex_private *priv,
1141 struct sk_buff *skb);
1142 int mwifiex_sta_prepare_cmd(struct mwifiex_private *, uint16_t cmd_no,
1143 u16 cmd_action, u32 cmd_oid,
1144 void *data_buf, void *cmd_buf);
1145 int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
1146 u16 cmd_action, u32 cmd_oid,
1147 void *data_buf, void *cmd_buf);
1148 int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no,
1149 struct host_cmd_ds_command *resp);
1150 int mwifiex_process_sta_rx_packet(struct mwifiex_private *,
1151 struct sk_buff *skb);
1152 int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
1153 struct sk_buff *skb);
1154 int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv,
1155 struct sk_buff *skb);
1156 int mwifiex_process_sta_event(struct mwifiex_private *);
1157 int mwifiex_process_uap_event(struct mwifiex_private *);
1158 void mwifiex_delete_all_station_list(struct mwifiex_private *priv);
1159 void mwifiex_wmm_del_peer_ra_list(struct mwifiex_private *priv,
1161 void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb);
1162 void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb);
1163 int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta, bool init);
1164 int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd,
1165 struct mwifiex_scan_cmd_config *scan_cfg);
1166 void mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
1167 struct cmd_ctrl_node *cmd_node);
1168 int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1169 struct host_cmd_ds_command *resp);
1170 s32 mwifiex_ssid_cmp(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2);
1171 int mwifiex_associate(struct mwifiex_private *priv,
1172 struct mwifiex_bssdescriptor *bss_desc);
1173 int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
1174 struct host_cmd_ds_command *cmd,
1175 struct mwifiex_bssdescriptor *bss_desc);
1176 int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
1177 struct host_cmd_ds_command *resp);
1178 void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason,
1180 u8 mwifiex_band_to_radio_type(u8 band);
1181 int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
1182 void mwifiex_deauthenticate_all(struct mwifiex_adapter *adapter);
1183 int mwifiex_adhoc_start(struct mwifiex_private *priv,
1184 struct cfg80211_ssid *adhoc_ssid);
1185 int mwifiex_adhoc_join(struct mwifiex_private *priv,
1186 struct mwifiex_bssdescriptor *bss_desc);
1187 int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
1188 struct host_cmd_ds_command *cmd,
1189 struct cfg80211_ssid *req_ssid);
1190 int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1191 struct host_cmd_ds_command *cmd,
1192 struct mwifiex_bssdescriptor *bss_desc);
1193 int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
1194 struct host_cmd_ds_command *resp);
1195 int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd);
1196 struct mwifiex_chan_freq_power *mwifiex_get_cfp(struct mwifiex_private *priv,
1197 u8 band, u16 channel, u32 freq);
1198 u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv,
1199 u8 index, u8 ht_info);
1200 u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv,
1201 u8 index, u8 ht_info);
1202 u32 mwifiex_find_freq_from_band_chan(u8, u8);
1203 int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask,
1205 u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv,
1207 u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates);
1208 u32 mwifiex_get_rates_from_cfg80211(struct mwifiex_private *priv,
1209 u8 *rates, u8 radio_type);
1210 u8 mwifiex_is_rate_auto(struct mwifiex_private *priv);
1211 extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE];
1212 void mwifiex_save_curr_bcn(struct mwifiex_private *priv);
1213 void mwifiex_free_curr_bcn(struct mwifiex_private *priv);
1214 int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv,
1215 struct host_cmd_ds_command *cmd);
1216 int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
1217 struct host_cmd_ds_command *resp);
1218 int is_command_pending(struct mwifiex_adapter *adapter);
1219 void mwifiex_init_priv_params(struct mwifiex_private *priv,
1220 struct net_device *dev);
1221 int mwifiex_set_secure_params(struct mwifiex_private *priv,
1222 struct mwifiex_uap_bss_param *bss_config,
1223 struct cfg80211_ap_settings *params);
1224 void mwifiex_set_ht_params(struct mwifiex_private *priv,
1225 struct mwifiex_uap_bss_param *bss_cfg,
1226 struct cfg80211_ap_settings *params);
1227 void mwifiex_set_vht_params(struct mwifiex_private *priv,
1228 struct mwifiex_uap_bss_param *bss_cfg,
1229 struct cfg80211_ap_settings *params);
1230 void mwifiex_set_tpc_params(struct mwifiex_private *priv,
1231 struct mwifiex_uap_bss_param *bss_cfg,
1232 struct cfg80211_ap_settings *params);
1233 void mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
1234 struct cfg80211_ap_settings *params);
1235 void mwifiex_set_vht_width(struct mwifiex_private *priv,
1236 enum nl80211_chan_width width,
1237 bool ap_11ac_disable);
1239 mwifiex_set_wmm_params(struct mwifiex_private *priv,
1240 struct mwifiex_uap_bss_param *bss_cfg,
1241 struct cfg80211_ap_settings *params);
1242 void mwifiex_set_ba_params(struct mwifiex_private *priv);
1244 void mwifiex_update_ampdu_txwinsize(struct mwifiex_adapter *pmadapter);
1245 void mwifiex_bt_coex_wlan_param_update_event(struct mwifiex_private *priv,
1246 struct sk_buff *event_skb);
1248 void mwifiex_set_11ac_ba_params(struct mwifiex_private *priv);
1249 int mwifiex_cmd_802_11_scan_ext(struct mwifiex_private *priv,
1250 struct host_cmd_ds_command *cmd,
1252 int mwifiex_ret_802_11_scan_ext(struct mwifiex_private *priv,
1253 struct host_cmd_ds_command *resp);
1254 int mwifiex_handle_event_ext_scan_report(struct mwifiex_private *priv,
1256 int mwifiex_cmd_802_11_bg_scan_config(struct mwifiex_private *priv,
1257 struct host_cmd_ds_command *cmd,
1259 int mwifiex_stop_bg_scan(struct mwifiex_private *priv);
1262 * This function checks if the queuing is RA based or not.
1265 mwifiex_queuing_ra_based(struct mwifiex_private *priv)
1268 * Currently we assume if we are in Infra, then DA=RA. This might not be
1269 * true in the future
1271 if ((priv->bss_mode == NL80211_IFTYPE_STATION ||
1272 priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) &&
1273 (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA))
1280 * This function copies rates.
1283 mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len)
1287 for (i = 0; i < len && src[i]; i++, pos++) {
1288 if (pos >= MWIFIEX_SUPPORTED_RATES)
1296 /* This function return interface number with the same bss_type.
1299 mwifiex_get_intf_num(struct mwifiex_adapter *adapter, u8 bss_type)
1303 for (i = 0; i < adapter->priv_num; i++)
1304 if (adapter->priv[i] && adapter->priv[i]->bss_type == bss_type)
1310 * This function returns the correct private structure pointer based
1311 * upon the BSS type and BSS number.
1313 static inline struct mwifiex_private *
1314 mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter,
1315 u8 bss_num, u8 bss_type)
1319 for (i = 0; i < adapter->priv_num; i++) {
1320 if (adapter->priv[i]) {
1321 if ((adapter->priv[i]->bss_num == bss_num) &&
1322 (adapter->priv[i]->bss_type == bss_type))
1326 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
1330 * This function returns the first available private structure pointer
1331 * based upon the BSS role.
1333 static inline struct mwifiex_private *
1334 mwifiex_get_priv(struct mwifiex_adapter *adapter,
1335 enum mwifiex_bss_role bss_role)
1339 for (i = 0; i < adapter->priv_num; i++) {
1340 if (adapter->priv[i]) {
1341 if (bss_role == MWIFIEX_BSS_ROLE_ANY ||
1342 GET_BSS_ROLE(adapter->priv[i]) == bss_role)
1347 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
1351 * This function checks available bss_num when adding new interface or
1352 * changing interface type.
1355 mwifiex_get_unused_bss_num(struct mwifiex_adapter *adapter, u8 bss_type)
1358 int index[MWIFIEX_MAX_BSS_NUM];
1360 memset(index, 0, sizeof(index));
1361 for (i = 0; i < adapter->priv_num; i++)
1362 if (adapter->priv[i]) {
1363 if (adapter->priv[i]->bss_type == bss_type &&
1364 !(adapter->priv[i]->bss_mode ==
1365 NL80211_IFTYPE_UNSPECIFIED)) {
1366 index[adapter->priv[i]->bss_num] = 1;
1369 for (j = 0; j < MWIFIEX_MAX_BSS_NUM; j++)
1376 * This function returns the first available unused private structure pointer.
1378 static inline struct mwifiex_private *
1379 mwifiex_get_unused_priv_by_bss_type(struct mwifiex_adapter *adapter,
1384 for (i = 0; i < adapter->priv_num; i++)
1385 if (adapter->priv[i]->bss_mode ==
1386 NL80211_IFTYPE_UNSPECIFIED) {
1387 adapter->priv[i]->bss_num =
1388 mwifiex_get_unused_bss_num(adapter, bss_type);
1392 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
1396 * This function returns the driver private structure of a network device.
1398 static inline struct mwifiex_private *
1399 mwifiex_netdev_get_priv(struct net_device *dev)
1401 return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev));
1405 * This function checks if a skb holds a management frame.
1407 static inline bool mwifiex_is_skb_mgmt_frame(struct sk_buff *skb)
1409 return (get_unaligned_le32(skb->data) == PKT_TYPE_MGMT);
1412 /* This function retrieves channel closed for operation by Channel
1413 * Switch Announcement.
1416 mwifiex_11h_get_csa_closed_channel(struct mwifiex_private *priv)
1418 if (!priv->csa_chan)
1421 /* Clear csa channel, if DFS channel move time has passed */
1422 if (time_after(jiffies, priv->csa_expire_time)) {
1424 priv->csa_expire_time = 0;
1427 return priv->csa_chan;
1430 static inline u8 mwifiex_is_any_intf_active(struct mwifiex_private *priv)
1432 struct mwifiex_private *priv_num;
1435 for (i = 0; i < priv->adapter->priv_num; i++) {
1436 priv_num = priv->adapter->priv[i];
1438 if ((GET_BSS_ROLE(priv_num) == MWIFIEX_BSS_ROLE_UAP &&
1439 priv_num->bss_started) ||
1440 (GET_BSS_ROLE(priv_num) == MWIFIEX_BSS_ROLE_STA &&
1441 priv_num->media_connected))
1449 static inline u8 mwifiex_is_tdls_link_setup(u8 status)
1452 case TDLS_SETUP_COMPLETE:
1453 case TDLS_CHAN_SWITCHING:
1454 case TDLS_IN_BASE_CHAN:
1455 case TDLS_IN_OFF_CHAN:
1464 /* Disable platform specific wakeup interrupt */
1465 static inline void mwifiex_disable_wake(struct mwifiex_adapter *adapter)
1467 if (adapter->irq_wakeup >= 0) {
1468 disable_irq_wake(adapter->irq_wakeup);
1469 disable_irq(adapter->irq_wakeup);
1470 if (adapter->wake_by_wifi)
1471 /* Undo our disable, since interrupt handler already
1474 enable_irq(adapter->irq_wakeup);
1479 /* Enable platform specific wakeup interrupt */
1480 static inline void mwifiex_enable_wake(struct mwifiex_adapter *adapter)
1482 /* Enable platform specific wakeup interrupt */
1483 if (adapter->irq_wakeup >= 0) {
1484 adapter->wake_by_wifi = false;
1485 enable_irq(adapter->irq_wakeup);
1486 enable_irq_wake(adapter->irq_wakeup);
1490 int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
1491 u32 func_init_shutdown);
1493 int mwifiex_add_card(void *card, struct completion *fw_done,
1494 struct mwifiex_if_ops *if_ops, u8 iface_type,
1495 struct device *dev);
1496 int mwifiex_remove_card(struct mwifiex_adapter *adapter);
1498 void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version,
1500 int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
1501 struct mwifiex_multicast_list *mcast_list);
1502 int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
1503 struct net_device *dev);
1504 int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter,
1505 struct cmd_ctrl_node *cmd_queued);
1506 int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
1507 struct cfg80211_ssid *req_ssid);
1508 int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
1509 int mwifiex_enable_hs(struct mwifiex_adapter *adapter);
1510 int mwifiex_disable_auto_ds(struct mwifiex_private *priv);
1511 int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate);
1512 int mwifiex_request_scan(struct mwifiex_private *priv,
1513 struct cfg80211_ssid *req_ssid);
1514 int mwifiex_scan_networks(struct mwifiex_private *priv,
1515 const struct mwifiex_user_scan_cfg *user_scan_in);
1516 int mwifiex_set_radio(struct mwifiex_private *priv, u8 option);
1518 int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp,
1519 const u8 *key, int key_len, u8 key_index,
1520 const u8 *mac_addr, int disable);
1522 int mwifiex_set_gen_ie(struct mwifiex_private *priv, const u8 *ie, int ie_len);
1524 int mwifiex_get_ver_ext(struct mwifiex_private *priv, u32 version_str_sel);
1526 int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action,
1527 struct ieee80211_channel *chan,
1528 unsigned int duration);
1530 int mwifiex_get_stats_info(struct mwifiex_private *priv,
1531 struct mwifiex_ds_get_stats *log);
1533 int mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type,
1534 u32 reg_offset, u32 reg_value);
1536 int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type,
1537 u32 reg_offset, u32 *value);
1539 int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes,
1542 int mwifiex_set_11n_httx_cfg(struct mwifiex_private *priv, int data);
1544 int mwifiex_get_11n_httx_cfg(struct mwifiex_private *priv, int *data);
1546 int mwifiex_set_tx_rate_cfg(struct mwifiex_private *priv, int tx_rate_index);
1548 int mwifiex_get_tx_rate_cfg(struct mwifiex_private *priv, int *tx_rate_index);
1550 int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode);
1552 int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter,
1553 char *version, int max_len);
1555 int mwifiex_set_tx_power(struct mwifiex_private *priv,
1556 struct mwifiex_power_cfg *power_cfg);
1558 int mwifiex_main_process(struct mwifiex_adapter *);
1560 int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb);
1562 int mwifiex_get_bss_info(struct mwifiex_private *,
1563 struct mwifiex_bss_info *);
1564 int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
1565 struct cfg80211_bss *bss,
1566 struct mwifiex_bssdescriptor *bss_desc);
1567 int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
1568 struct mwifiex_bssdescriptor *bss_entry);
1569 int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
1570 struct mwifiex_bssdescriptor *bss_desc);
1572 u8 mwifiex_chan_type_to_sec_chan_offset(enum nl80211_channel_type chan_type);
1573 u8 mwifiex_get_chan_type(struct mwifiex_private *priv);
1575 struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1577 unsigned char name_assign_type,
1578 enum nl80211_iftype type,
1579 struct vif_params *params);
1580 int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
1582 void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config);
1584 int mwifiex_add_wowlan_magic_pkt_filter(struct mwifiex_adapter *adapter);
1586 int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
1587 struct cfg80211_beacon_data *data);
1588 int mwifiex_del_mgmt_ies(struct mwifiex_private *priv);
1589 u8 *mwifiex_11d_code_2_region(u8 code);
1590 void mwifiex_uap_set_channel(struct mwifiex_private *priv,
1591 struct mwifiex_uap_bss_param *bss_cfg,
1592 struct cfg80211_chan_def chandef);
1593 int mwifiex_config_start_uap(struct mwifiex_private *priv,
1594 struct mwifiex_uap_bss_param *bss_cfg);
1595 void mwifiex_uap_del_sta_data(struct mwifiex_private *priv,
1596 struct mwifiex_sta_node *node);
1598 void mwifiex_config_uap_11d(struct mwifiex_private *priv,
1599 struct cfg80211_beacon_data *beacon_data);
1601 void mwifiex_init_11h_params(struct mwifiex_private *priv);
1602 int mwifiex_is_11h_active(struct mwifiex_private *priv);
1603 int mwifiex_11h_activate(struct mwifiex_private *priv, bool flag);
1605 void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer,
1606 struct mwifiex_bssdescriptor *bss_desc);
1607 int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv);
1608 int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv,
1609 struct device_node *node, const char *prefix);
1610 void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv);
1612 extern const struct ethtool_ops mwifiex_ethtool_ops;
1614 void mwifiex_del_all_sta_list(struct mwifiex_private *priv);
1615 void mwifiex_del_sta_entry(struct mwifiex_private *priv, const u8 *mac);
1617 mwifiex_set_sta_ht_cap(struct mwifiex_private *priv, const u8 *ies,
1618 int ies_len, struct mwifiex_sta_node *node);
1619 struct mwifiex_sta_node *
1620 mwifiex_add_sta_entry(struct mwifiex_private *priv, const u8 *mac);
1621 struct mwifiex_sta_node *
1622 mwifiex_get_sta_entry(struct mwifiex_private *priv, const u8 *mac);
1623 u8 mwifiex_is_tdls_chan_switching(struct mwifiex_private *priv);
1624 u8 mwifiex_is_tdls_off_chan(struct mwifiex_private *priv);
1625 u8 mwifiex_is_send_cmd_allowed(struct mwifiex_private *priv);
1626 int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer,
1627 u8 action_code, u8 dialog_token,
1628 u16 status_code, const u8 *extra_ies,
1629 size_t extra_ies_len);
1630 int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer,
1631 u8 action_code, u8 dialog_token,
1632 u16 status_code, const u8 *extra_ies,
1633 size_t extra_ies_len);
1634 void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
1636 int mwifiex_tdls_oper(struct mwifiex_private *priv, const u8 *peer, u8 action);
1637 int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, const u8 *mac);
1638 int mwifiex_get_tdls_list(struct mwifiex_private *priv,
1639 struct tdls_peer_info *buf);
1640 void mwifiex_disable_all_tdls_links(struct mwifiex_private *priv);
1641 bool mwifiex_is_bss_in_11ac_mode(struct mwifiex_private *priv);
1642 u8 mwifiex_get_center_freq_index(struct mwifiex_private *priv, u8 band,
1643 u32 pri_chan, u8 chan_bw);
1644 int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter);
1646 int mwifiex_tdls_check_tx(struct mwifiex_private *priv, struct sk_buff *skb);
1647 void mwifiex_flush_auto_tdls_list(struct mwifiex_private *priv);
1648 void mwifiex_auto_tdls_update_peer_status(struct mwifiex_private *priv,
1649 const u8 *mac, u8 link_status);
1650 void mwifiex_auto_tdls_update_peer_signal(struct mwifiex_private *priv,
1651 u8 *mac, s8 snr, s8 nflr);
1652 void mwifiex_check_auto_tdls(struct timer_list *t);
1653 void mwifiex_add_auto_tdls_peer(struct mwifiex_private *priv, const u8 *mac);
1654 void mwifiex_setup_auto_tdls_timer(struct mwifiex_private *priv);
1655 void mwifiex_clean_auto_tdls(struct mwifiex_private *priv);
1656 int mwifiex_config_tdls_enable(struct mwifiex_private *priv);
1657 int mwifiex_config_tdls_disable(struct mwifiex_private *priv);
1658 int mwifiex_config_tdls_cs_params(struct mwifiex_private *priv);
1659 int mwifiex_stop_tdls_cs(struct mwifiex_private *priv, const u8 *peer_mac);
1660 int mwifiex_start_tdls_cs(struct mwifiex_private *priv, const u8 *peer_mac,
1661 u8 primary_chan, u8 second_chan_offset, u8 band);
1663 int mwifiex_cmd_issue_chan_report_request(struct mwifiex_private *priv,
1664 struct host_cmd_ds_command *cmd,
1666 int mwifiex_11h_handle_chanrpt_ready(struct mwifiex_private *priv,
1667 struct sk_buff *skb);
1669 void mwifiex_parse_tx_status_event(struct mwifiex_private *priv,
1673 mwifiex_clone_skb_for_tx_status(struct mwifiex_private *priv,
1674 struct sk_buff *skb, u8 flag, u64 *cookie);
1675 void mwifiex_dfs_cac_work_queue(struct work_struct *work);
1676 void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work);
1677 void mwifiex_abort_cac(struct mwifiex_private *priv);
1678 int mwifiex_stop_radar_detection(struct mwifiex_private *priv,
1679 struct cfg80211_chan_def *chandef);
1680 int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
1681 struct sk_buff *skb);
1683 void mwifiex_hist_data_set(struct mwifiex_private *priv, u8 rx_rate, s8 snr,
1685 void mwifiex_hist_data_reset(struct mwifiex_private *priv);
1686 void mwifiex_hist_data_add(struct mwifiex_private *priv,
1687 u8 rx_rate, s8 snr, s8 nflr);
1688 u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv,
1689 u8 rx_rate, u8 ht_info);
1691 void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter);
1692 void mwifiex_prepare_fw_dump_info(struct mwifiex_adapter *adapter);
1693 void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter);
1694 void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
1695 void mwifiex_fw_dump_event(struct mwifiex_private *priv);
1696 void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
1697 int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
1699 struct mwifiex_ds_wakeup_reason *wakeup_reason);
1700 int mwifiex_get_chan_info(struct mwifiex_private *priv,
1701 struct mwifiex_channel_band *channel_band);
1702 int mwifiex_ret_wakeup_reason(struct mwifiex_private *priv,
1703 struct host_cmd_ds_command *resp,
1704 struct host_cmd_ds_wakeup_reason *wakeup_reason);
1705 void mwifiex_coex_ampdu_rxwinsize(struct mwifiex_adapter *adapter);
1706 void mwifiex_11n_delba(struct mwifiex_private *priv, int tid);
1707 int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy);
1708 void mwifiex_process_tx_pause_event(struct mwifiex_private *priv,
1709 struct sk_buff *event);
1710 void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
1711 struct sk_buff *event_skb);
1712 void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter);
1713 int mwifiex_set_mac_address(struct mwifiex_private *priv,
1714 struct net_device *dev,
1715 bool external, u8 *new_mac);
1716 void mwifiex_devdump_tmo_func(unsigned long function_context);
1718 #ifdef CONFIG_DEBUG_FS
1719 void mwifiex_debugfs_init(void);
1720 void mwifiex_debugfs_remove(void);
1722 void mwifiex_dev_debugfs_init(struct mwifiex_private *priv);
1723 void mwifiex_dev_debugfs_remove(struct mwifiex_private *priv);
1725 int mwifiex_reinit_sw(struct mwifiex_adapter *adapter);
1726 int mwifiex_shutdown_sw(struct mwifiex_adapter *adapter);
1727 #endif /* !_MWIFIEX_MAIN_H_ */