2 * Marvell Wireless LAN device driver: major data structures and prototypes
4 * Copyright (C) 2011, 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/kernel.h>
24 #include <linux/module.h>
25 #include <linux/sched.h>
26 #include <linux/semaphore.h>
28 #include <linux/skbuff.h>
29 #include <linux/if_arp.h>
30 #include <linux/etherdevice.h>
32 #include <net/lib80211.h>
33 #include <linux/firmware.h>
34 #include <linux/ctype.h>
41 extern const char driver_version[];
42 extern struct mwifiex_adapter *g_adapter;
52 #define DRV_MODE_STA 0x1
53 #define DRV_MODE_UAP 0x2
54 #define DRV_MODE_UAP_STA 0x3
56 #define SD8787_W0 0x30
57 #define SD8787_W1 0x31
58 #define SD8787_A0 0x40
59 #define SD8787_A1 0x41
61 #define DEFAULT_FW_NAME "mrvl/sd8787_uapsta.bin"
62 #define SD8787_W1_FW_NAME "mrvl/sd8787_uapsta_w1.bin"
63 #define SD8787_AX_FW_NAME "mrvl/sd8787_uapsta.bin"
65 struct mwifiex_drv_mode {
68 struct mwifiex_bss_attr *bss_attr;
72 #define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT (5 * HZ)
74 #define MWIFIEX_TIMER_10S 10000
75 #define MWIFIEX_TIMER_1S 1000
77 #define NL_MAX_PAYLOAD 1024
78 #define NL_MULTICAST_GROUP 1
80 #define MAX_TX_PENDING 60
82 #define HEADER_ALIGNMENT 8
84 #define MWIFIEX_UPLD_SIZE (2312)
86 #define MAX_EVENT_SIZE 1024
88 #define ARP_FILTER_MAX_BUF_SIZE 68
90 #define MWIFIEX_KEY_BUFFER_SIZE 16
91 #define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
92 #define MWIFIEX_MAX_REGION_CODE 7
94 #define DEFAULT_BCN_AVG_FACTOR 8
95 #define DEFAULT_DATA_AVG_FACTOR 8
97 #define FIRST_VALID_CHANNEL 0xff
98 #define DEFAULT_AD_HOC_CHANNEL 6
99 #define DEFAULT_AD_HOC_CHANNEL_A 36
101 #define DEFAULT_BCN_MISS_TIMEOUT 5
103 #define MAX_SCAN_BEACON_BUFFER 8000
105 #define SCAN_BEACON_ENTRY_PAD 6
107 #define MWIFIEX_PASSIVE_SCAN_CHAN_TIME 200
108 #define MWIFIEX_ACTIVE_SCAN_CHAN_TIME 200
109 #define MWIFIEX_SPECIFIC_SCAN_CHAN_TIME 110
111 #define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI)))
113 #define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S)
115 #define RSN_GTK_OUI_OFFSET 2
117 #define MWIFIEX_OUI_NOT_PRESENT 0
118 #define MWIFIEX_OUI_PRESENT 1
120 #define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \
121 adapter->event_received || \
122 adapter->data_received)
124 #define MWIFIEX_TYPE_CMD 1
125 #define MWIFIEX_TYPE_DATA 0
126 #define MWIFIEX_TYPE_EVENT 3
128 #define DBG_CMD_NUM 5
130 #define MAX_BITMAP_RATES_SIZE 10
132 #define MAX_CHANNEL_BAND_BG 14
134 #define MAX_FREQUENCY_BAND_BG 2484
137 u32 num_cmd_host_to_card_failure;
138 u32 num_cmd_sleep_cfm_host_to_card_failure;
139 u32 num_tx_host_to_card_failure;
140 u32 num_event_deauth;
141 u32 num_event_disassoc;
142 u32 num_event_link_lost;
144 u32 num_cmd_assoc_success;
145 u32 num_cmd_assoc_failure;
150 u16 last_cmd_id[DBG_CMD_NUM];
151 u16 last_cmd_act[DBG_CMD_NUM];
153 u16 last_cmd_resp_id[DBG_CMD_NUM];
154 u16 last_cmd_resp_index;
155 u16 last_event[DBG_CMD_NUM];
156 u16 last_event_index;
159 enum MWIFIEX_HARDWARE_STATUS {
160 MWIFIEX_HW_STATUS_READY,
161 MWIFIEX_HW_STATUS_INITIALIZING,
162 MWIFIEX_HW_STATUS_FW_READY,
163 MWIFIEX_HW_STATUS_INIT_DONE,
164 MWIFIEX_HW_STATUS_RESET,
165 MWIFIEX_HW_STATUS_CLOSING,
166 MWIFIEX_HW_STATUS_NOT_READY
169 enum MWIFIEX_802_11_POWER_MODE {
170 MWIFIEX_802_11_POWER_MODE_CAM,
171 MWIFIEX_802_11_POWER_MODE_PSP
174 struct mwifiex_tx_param {
178 enum MWIFIEX_PS_STATE {
185 struct mwifiex_add_ba_param {
191 struct mwifiex_tx_aggr {
197 struct mwifiex_ra_list_tbl {
198 struct list_head list;
199 struct sk_buff_head skb_head;
205 struct mwifiex_tid_tbl {
206 struct list_head ra_list;
207 /* spin lock for tid table */
208 spinlock_t tid_tbl_lock;
209 struct mwifiex_ra_list_tbl *ra_list_curr;
212 #define WMM_HIGHEST_PRIORITY 7
213 #define HIGH_PRIO_TID 7
214 #define LOW_PRIO_TID 0
216 struct mwifiex_wmm_desc {
217 struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID];
218 u32 packets_out[MAX_NUM_TID];
219 /* spin lock to protect ra_list */
220 spinlock_t ra_list_spinlock;
221 struct mwifiex_wmm_ac_status ac_status[IEEE80211_MAX_QUEUES];
222 enum mwifiex_wmm_ac_e ac_down_graded_vals[IEEE80211_MAX_QUEUES];
223 u32 drv_pkt_delay_max;
224 u8 queue_priority[IEEE80211_MAX_QUEUES];
225 u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */
229 struct mwifiex_802_11_security {
234 enum MWIFIEX_802_11_WEP_STATUS wep_status;
235 u32 authentication_mode;
239 struct ieee_types_header {
244 struct ieee_obss_scan_param {
245 u16 obss_scan_passive_dwell;
246 u16 obss_scan_active_dwell;
247 u16 bss_chan_width_trigger_scan_int;
248 u16 obss_scan_passive_total;
249 u16 obss_scan_active_total;
250 u16 bss_width_chan_trans_delay;
251 u16 obss_scan_active_threshold;
254 struct ieee_types_obss_scan_param {
255 struct ieee_types_header ieee_hdr;
256 struct ieee_obss_scan_param obss_scan;
259 #define MWIFIEX_SUPPORTED_RATES 14
261 #define MWIFIEX_SUPPORTED_RATES_EXT 32
263 #define IEEE_MAX_IE_SIZE 256
265 struct ieee_types_vendor_specific {
266 struct ieee_types_vendor_header vend_hdr;
267 u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_vendor_header)];
270 struct ieee_types_generic {
271 struct ieee_types_header ieee_hdr;
272 u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_header)];
275 struct mwifiex_bssdescriptor {
276 u8 mac_address[ETH_ALEN];
277 struct mwifiex_802_11_ssid ssid;
285 u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
286 u8 data_rates[MWIFIEX_SUPPORTED_RATES];
288 * BAND_B(0x01): 'b' band
289 * BAND_G(0x02): 'g' band
290 * BAND_A(0X04): 'a' band
293 long long network_tsf;
295 union ieee_types_phy_param_set phy_param_set;
296 union ieee_types_ss_param_set ss_param_set;
298 struct ieee_types_wmm_parameter wmm_ie;
300 struct ieee80211_ht_cap *bcn_ht_cap;
302 struct ieee80211_ht_info *bcn_ht_info;
305 u16 bss_co_2040_offset;
308 struct ieee_types_obss_scan_param *bcn_obss_scan;
309 u16 overlap_bss_offset;
310 struct ieee_types_vendor_specific *bcn_wpa_ie;
312 struct ieee_types_generic *bcn_rsn_ie;
314 struct ieee_types_generic *bcn_wapi_ie;
318 u32 beacon_buf_size_max;
322 struct mwifiex_current_bss_params {
323 struct mwifiex_bssdescriptor bss_descriptor;
325 u8 wmm_uapsd_enabled;
328 u8 data_rates[MWIFIEX_SUPPORTED_RATES];
331 struct mwifiex_sleep_params {
340 struct mwifiex_sleep_period {
345 struct mwifiex_wep_key {
349 u8 key_material[MWIFIEX_KEY_BUFFER_SIZE];
352 #define MAX_REGION_CHANNEL_NUM 2
354 struct mwifiex_chan_freq_power {
366 #define MWIFIEX_MAX_TRIPLET_802_11D 83
368 struct mwifiex_802_11d_domain_reg {
369 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
371 struct ieee80211_country_ie_triplet
372 triplet[MWIFIEX_MAX_TRIPLET_802_11D];
375 struct mwifiex_vendor_spec_cfg_ie {
378 u8 ie[MWIFIEX_MAX_VSIE_LEN];
385 struct mwifiex_adapter;
386 struct mwifiex_private;
388 struct mwifiex_private {
389 struct mwifiex_adapter *adapter;
396 u8 curr_addr[ETH_ALEN];
399 struct net_device *netdev;
400 struct net_device_stats stats;
405 u8 max_tx_power_level;
406 u8 min_tx_power_level;
412 u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
414 u8 is_data_rate_auto;
425 struct mwifiex_bssdescriptor *attempted_bss_desc;
426 struct mwifiex_802_11_ssid prev_ssid;
427 u8 prev_bssid[ETH_ALEN];
428 struct mwifiex_current_bss_params curr_bss_params;
433 u8 adhoc_is_link_sensed;
435 struct mwifiex_802_11_security sec_info;
436 struct mwifiex_wep_key wep_key[NUM_WEP_KEYS];
437 u16 wep_key_curr_index;
441 struct host_cmd_ds_802_11_key_material aes_key;
447 struct mwifiex_wmm_desc wmm;
448 struct list_head tx_ba_stream_tbl_ptr;
449 /* spin lock for tx_ba_stream_tbl_ptr queue */
450 spinlock_t tx_ba_stream_tbl_lock;
451 struct mwifiex_tx_aggr aggr_prio_tbl[MAX_NUM_TID];
452 struct mwifiex_add_ba_param add_ba_param;
453 u16 rx_seq[MAX_NUM_TID];
454 struct list_head rx_reorder_tbl_ptr;
455 /* spin lock for rx_reorder_tbl_ptr queue */
456 spinlock_t rx_reorder_tbl_lock;
457 /* spin lock for Rx packets */
458 spinlock_t rx_pkt_lock;
460 #define MWIFIEX_ASSOC_RSP_BUF_SIZE 500
461 u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE];
464 #define MWIFIEX_GENIE_BUF_SIZE 256
465 u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE];
468 struct mwifiex_vendor_spec_cfg_ie vs_ie[MWIFIEX_MAX_VSIE_NUM];
470 #define MWIFIEX_ASSOC_TLV_BUF_SIZE 256
471 u8 assoc_tlv_buf[MWIFIEX_ASSOC_TLV_BUF_SIZE];
472 u8 assoc_tlv_buf_len;
476 /* spin lock for beacon buffer */
477 spinlock_t curr_bcn_buf_lock;
478 u16 ioctl_wait_q_woken;
479 wait_queue_head_t ioctl_wait_q;
480 u16 cmd_wait_q_woken;
481 wait_queue_head_t cmd_wait_q;
482 struct wireless_dev *wdev;
483 struct mwifiex_chan_freq_power cfp;
484 char version_str[128];
485 #ifdef CONFIG_DEBUG_FS
486 struct dentry *dfs_dev_dir;
489 struct iw_statistics w_stats;
490 u16 w_stats_wait_q_woken;
491 wait_queue_head_t w_stats_wait_q;
492 u16 current_key_index;
493 struct semaphore async_sem;
494 u8 scan_pending_on_block;
495 u8 report_scan_result;
496 struct cfg80211_scan_request *scan_request;
497 int scan_result_status;
500 bool ibss_join_request;
501 u16 ibss_join_result;
504 struct workqueue_struct *workqueue;
505 struct work_struct cfg_workqueue;
506 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
511 enum mwifiex_ba_status {
512 BA_STREAM_NOT_SETUP = 0,
513 BA_STREAM_SETUP_INPROGRESS,
514 BA_STREAM_SETUP_COMPLETE
517 struct mwifiex_tx_ba_stream_tbl {
518 struct list_head list;
521 enum mwifiex_ba_status ba_status;
524 struct mwifiex_rx_reorder_tbl;
526 struct reorder_tmr_cnxt {
527 struct timer_list timer;
528 struct mwifiex_rx_reorder_tbl *ptr;
529 struct mwifiex_private *priv;
532 struct mwifiex_rx_reorder_tbl {
533 struct list_head list;
538 void **rx_reorder_ptr;
539 struct reorder_tmr_cnxt timer_context;
542 struct mwifiex_bss_prio_node {
543 struct list_head list;
544 struct mwifiex_private *priv;
547 struct mwifiex_bss_prio_tbl {
548 struct list_head bss_prio_head;
549 /* spin lock for bss priority */
550 spinlock_t bss_prio_lock;
551 struct mwifiex_bss_prio_node *bss_prio_cur;
554 struct cmd_ctrl_node {
555 struct list_head list;
556 struct mwifiex_private *priv;
559 struct sk_buff *cmd_skb;
560 struct sk_buff *resp_skb;
566 struct mwifiex_if_ops {
567 int (*init_if) (struct mwifiex_adapter *);
568 void (*cleanup_if) (struct mwifiex_adapter *);
569 int (*check_fw_status) (struct mwifiex_adapter *, u32, int *);
570 int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
571 int (*register_dev) (struct mwifiex_adapter *);
572 void (*unregister_dev) (struct mwifiex_adapter *);
573 int (*enable_int) (struct mwifiex_adapter *);
574 int (*process_int_status) (struct mwifiex_adapter *);
575 int (*host_to_card) (struct mwifiex_adapter *, u8,
576 u8 *payload, u32 pkt_len,
577 struct mwifiex_tx_param *);
578 int (*wakeup) (struct mwifiex_adapter *);
579 int (*wakeup_complete) (struct mwifiex_adapter *);
581 void (*update_mp_end_port) (struct mwifiex_adapter *, u16);
582 void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
585 struct mwifiex_adapter {
586 struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM];
588 struct mwifiex_drv_mode *drv_mode;
589 const struct firmware *firmware;
591 bool surprise_removed;
592 u32 fw_release_number;
594 u16 init_wait_q_woken;
595 wait_queue_head_t init_wait_q;
597 struct mwifiex_if_ops if_ops;
600 atomic_t ioctl_pending;
601 struct workqueue_struct *workqueue;
602 struct work_struct main_work;
603 struct mwifiex_bss_prio_tbl bss_prio_tbl[MWIFIEX_MAX_BSS_NUM];
604 /* spin lock for init/shutdown */
605 spinlock_t mwifiex_lock;
606 /* spin lock for main process */
607 spinlock_t main_proc_lock;
608 u32 mwifiex_processing;
611 u16 curr_tx_buf_size;
613 enum MWIFIEX_HARDWARE_STATUS hw_status;
615 u16 number_of_antenna;
617 /* spin lock for interrupt handling */
621 struct sk_buff *event_skb;
622 u8 upld_buf[MWIFIEX_UPLD_SIZE];
625 u8 cmd_resp_received;
629 struct cmd_ctrl_node *cmd_pool;
630 struct cmd_ctrl_node *curr_cmd;
631 /* spin lock for command */
632 spinlock_t mwifiex_cmd_lock;
635 struct timer_list cmd_timer;
636 struct list_head cmd_free_q;
637 /* spin lock for cmd_free_q */
638 spinlock_t cmd_free_q_lock;
639 struct list_head cmd_pending_q;
640 /* spin lock for cmd_pending_q */
641 spinlock_t cmd_pending_q_lock;
642 struct list_head scan_pending_q;
643 /* spin lock for scan_pending_q */
644 spinlock_t scan_pending_q_lock;
647 struct mwifiex_802_11d_domain_reg domain_reg;
648 struct mwifiex_bssdescriptor *scan_table;
649 u32 num_in_scan_table;
652 u16 specific_scan_time;
653 u16 active_scan_time;
654 u16 passive_scan_time;
655 u8 bcn_buf[MAX_SCAN_BEACON_BUFFER];
660 struct mwifiex_chan_scan_param_set *scan_channels;
662 struct mwifiex_sleep_params sleep_params;
663 struct mwifiex_sleep_period sleep_period;
668 u16 local_listen_interval;
669 u16 null_pkt_interval;
670 struct sk_buff *sleep_cfm;
671 u16 bcn_miss_time_out;
672 u16 adhoc_awake_period;
676 u16 enhanced_ps_mode;
677 u8 pm_wakeup_card_req;
680 u32 pm_wakeup_fw_try;
682 struct mwifiex_hs_config_param hs_cfg;
684 u16 hs_activate_wait_q_woken;
685 wait_queue_head_t hs_activate_wait_q;
687 u8 event_body[MAX_EVENT_SIZE];
688 u32 hw_dot_11n_dev_cap;
689 u8 hw_dev_mcs_support;
690 u32 usr_dot_11n_dev_cap;
691 u8 usr_dev_mcs_support;
692 u8 adhoc_11n_enabled;
694 struct mwifiex_dbg dbg;
695 u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
699 int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
700 void mwifiex_free_lock_list(struct mwifiex_adapter *adapter);
702 int mwifiex_init_fw(struct mwifiex_adapter *adapter);
704 int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter);
706 int mwifiex_shutdown_drv(struct mwifiex_adapter *adapter);
708 int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter);
710 int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *);
712 int mwifiex_recv_complete(struct mwifiex_adapter *,
716 int mwifiex_recv_packet(struct mwifiex_adapter *, struct sk_buff *skb);
718 int mwifiex_process_event(struct mwifiex_adapter *adapter);
720 int mwifiex_ioctl_complete(struct mwifiex_adapter *adapter,
721 struct mwifiex_wait_queue *ioctl_wq,
724 int mwifiex_prepare_cmd(struct mwifiex_private *priv,
728 void *wait_queue, void *data_buf);
730 void mwifiex_cmd_timeout_func(unsigned long function_context);
732 int mwifiex_misc_ioctl_init_shutdown(struct mwifiex_adapter *adapter,
733 struct mwifiex_wait_queue *wait_queue,
734 u32 func_init_shutdown);
735 int mwifiex_get_debug_info(struct mwifiex_private *,
736 struct mwifiex_debug_info *);
738 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter);
739 int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter);
740 void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter);
741 void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter,
742 struct mwifiex_wait_queue *ioctl_wq);
744 void mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter,
745 struct cmd_ctrl_node *cmd_node);
747 void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter,
748 struct cmd_ctrl_node *cmd_node,
751 int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter);
752 int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter);
753 int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
754 struct sk_buff *skb);
755 int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
756 struct mwifiex_tx_param *tx_param);
757 int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags);
758 int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
759 struct sk_buff *skb, int status);
760 int mwifiex_recv_packet_complete(struct mwifiex_adapter *,
761 struct sk_buff *skb, int status);
762 void mwifiex_clean_txrx(struct mwifiex_private *priv);
763 u8 mwifiex_check_last_packet_indication(struct mwifiex_private *priv);
764 void mwifiex_check_ps_cond(struct mwifiex_adapter *adapter);
765 void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *, u8 *,
767 int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
768 struct host_cmd_ds_command *cmd,
769 u16 cmd_action, uint16_t ps_bitmap,
771 int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
772 struct host_cmd_ds_command *resp,
774 void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
775 void mwifiex_hs_activated_event(struct mwifiex_private *priv,
777 int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv,
778 struct host_cmd_ds_command *resp);
779 int mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
780 struct sk_buff *skb);
781 int mwifiex_sta_prepare_cmd(struct mwifiex_private *, uint16_t cmd_no,
782 u16 cmd_action, u32 cmd_oid,
783 void *data_buf, void *cmd_buf);
784 int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no,
785 void *cmd_buf, void *ioctl);
786 int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *,
787 struct sk_buff *skb);
788 int mwifiex_process_sta_event(struct mwifiex_private *);
789 void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb);
790 int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta);
791 int mwifiex_scan_networks(struct mwifiex_private *priv, void *wait_queue,
793 const struct mwifiex_user_scan_cfg
794 *user_scan_in, struct mwifiex_scan_resp *);
795 int mwifiex_cmd_802_11_scan(struct mwifiex_private *priv,
796 struct host_cmd_ds_command *cmd,
798 void mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
799 struct cmd_ctrl_node *cmd_node);
800 int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
801 struct host_cmd_ds_command *resp,
803 s32 mwifiex_find_ssid_in_list(struct mwifiex_private *priv,
804 struct mwifiex_802_11_ssid *ssid, u8 *bssid,
806 s32 mwifiex_find_bssid_in_list(struct mwifiex_private *priv, u8 *bssid,
808 int mwifiex_find_best_network(struct mwifiex_private *priv,
809 struct mwifiex_ssid_bssid *req_ssid_bssid);
810 s32 mwifiex_ssid_cmp(struct mwifiex_802_11_ssid *ssid1,
811 struct mwifiex_802_11_ssid *ssid2);
812 int mwifiex_associate(struct mwifiex_private *priv, void *wait_queue,
813 struct mwifiex_bssdescriptor *bss_desc);
814 int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
815 struct host_cmd_ds_command
816 *cmd, void *data_buf);
817 int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
818 struct host_cmd_ds_command *resp,
820 void mwifiex_reset_connect_state(struct mwifiex_private *priv);
821 void mwifiex_2040_coex_event(struct mwifiex_private *priv);
822 u8 mwifiex_band_to_radio_type(u8 band);
823 int mwifiex_deauthenticate(struct mwifiex_private *priv,
824 struct mwifiex_wait_queue *wait_queue,
826 int mwifiex_adhoc_start(struct mwifiex_private *priv, void *wait_queue,
827 struct mwifiex_802_11_ssid *adhoc_ssid);
828 int mwifiex_adhoc_join(struct mwifiex_private *priv, void *wait_queue,
829 struct mwifiex_bssdescriptor *bss_desc);
830 int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
831 struct host_cmd_ds_command *cmd,
833 int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
834 struct host_cmd_ds_command *cmd,
836 int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
837 struct host_cmd_ds_command *resp,
839 int mwifiex_cmd_802_11_bg_scan_query(struct mwifiex_private *priv,
840 struct host_cmd_ds_command *cmd,
842 struct mwifiex_chan_freq_power *
843 mwifiex_get_cfp_by_band_and_channel_from_cfg80211(
844 struct mwifiex_private *priv,
845 u8 band, u16 channel);
846 struct mwifiex_chan_freq_power *mwifiex_get_cfp_by_band_and_freq_from_cfg80211(
847 struct mwifiex_private *priv,
849 u32 mwifiex_index_to_data_rate(struct mwifiex_adapter *adapter, u8 index,
851 u32 mwifiex_find_freq_from_band_chan(u8, u8);
852 int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask,
854 u32 mwifiex_index_to_data_rate(struct mwifiex_adapter *adapter, u8 index,
856 u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv,
858 u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates);
859 u8 mwifiex_data_rate_to_index(struct mwifiex_adapter *adapter, u32 rate);
860 u8 mwifiex_is_rate_auto(struct mwifiex_private *priv);
861 int mwifiex_get_rate_index(struct mwifiex_adapter *adapter,
862 u16 *rateBitmap, int size);
863 extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE];
864 void mwifiex_save_curr_bcn(struct mwifiex_private *priv);
865 void mwifiex_free_curr_bcn(struct mwifiex_private *priv);
866 int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv,
867 struct host_cmd_ds_command *cmd);
868 int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
869 struct host_cmd_ds_command *resp);
870 int is_command_pending(struct mwifiex_adapter *adapter);
873 * This function checks if the queuing is RA based or not.
876 mwifiex_queuing_ra_based(struct mwifiex_private *priv)
879 * Currently we assume if we are in Infra, then DA=RA. This might not be
882 if ((priv->bss_mode == MWIFIEX_BSS_MODE_INFRA) &&
883 (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA))
890 * This function copies rates.
893 mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len)
897 for (i = 0; i < len && src[i]; i++, pos++) {
898 if (pos >= MWIFIEX_SUPPORTED_RATES)
907 * This function returns the correct private structure pointer based
908 * upon the BSS type and BSS number.
910 static inline struct mwifiex_private *
911 mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter,
912 u32 bss_num, u32 bss_type)
916 for (i = 0; i < adapter->priv_num; i++) {
917 if (adapter->priv[i]) {
918 if ((adapter->priv[i]->bss_num == bss_num)
919 && (adapter->priv[i]->bss_type == bss_type))
923 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
927 * This function returns the first available private structure pointer
928 * based upon the BSS role.
930 static inline struct mwifiex_private *
931 mwifiex_get_priv(struct mwifiex_adapter *adapter,
932 enum mwifiex_bss_role bss_role)
936 for (i = 0; i < adapter->priv_num; i++) {
937 if (adapter->priv[i]) {
938 if (bss_role == MWIFIEX_BSS_ROLE_ANY ||
939 GET_BSS_ROLE(adapter->priv[i]) == bss_role)
944 return ((i < adapter->priv_num) ? adapter->priv[i] : NULL);
948 * This function returns the driver private structure of a network device.
950 static inline struct mwifiex_private *
951 mwifiex_netdev_get_priv(struct net_device *dev)
953 return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev));
956 struct mwifiex_wait_queue *mwifiex_alloc_fill_wait_queue(
957 struct mwifiex_private *,
959 struct mwifiex_private *mwifiex_bss_index_to_priv(struct mwifiex_adapter
960 *adapter, u8 bss_index);
961 int mwifiex_shutdown_fw(struct mwifiex_private *, u8);
963 int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *);
964 int mwifiex_remove_card(struct mwifiex_adapter *, struct semaphore *);
966 void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version,
968 int mwifiex_request_set_mac_address(struct mwifiex_private *priv);
969 void mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
970 struct net_device *dev);
971 int mwifiex_request_ioctl(struct mwifiex_private *priv,
972 struct mwifiex_wait_queue *req,
973 int, u8 wait_option);
974 int mwifiex_disconnect(struct mwifiex_private *, u8, u8 *);
975 int mwifiex_bss_start(struct mwifiex_private *priv,
977 struct mwifiex_ssid_bssid *ssid_bssid);
978 int mwifiex_set_hs_params(struct mwifiex_private *priv,
979 u16 action, u8 wait_option,
980 struct mwifiex_ds_hs_cfg *hscfg);
981 int mwifiex_cancel_hs(struct mwifiex_private *priv, u8 wait_option);
982 int mwifiex_enable_hs(struct mwifiex_adapter *adapter);
983 void mwifiex_process_ioctl_resp(struct mwifiex_private *priv,
984 struct mwifiex_wait_queue *req);
985 u32 mwifiex_get_mode(struct mwifiex_private *priv, u8 wait_option);
986 int mwifiex_get_signal_info(struct mwifiex_private *priv,
988 struct mwifiex_ds_get_signal *signal);
989 int mwifiex_drv_get_data_rate(struct mwifiex_private *priv,
990 struct mwifiex_rate_cfg *rate);
991 int mwifiex_get_channel_list(struct mwifiex_private *priv,
993 struct mwifiex_chan_list *chanlist);
994 int mwifiex_get_scan_table(struct mwifiex_private *priv,
996 struct mwifiex_scan_resp *scanresp);
997 int mwifiex_get_auth_mode(struct mwifiex_private *priv,
998 u8 wait_option, u32 *auth_mode);
999 int mwifiex_get_encrypt_mode(struct mwifiex_private *priv,
1002 int mwifiex_enable_wep_key(struct mwifiex_private *priv, u8 wait_option);
1003 int mwifiex_find_best_bss(struct mwifiex_private *priv, u8 wait_option,
1004 struct mwifiex_ssid_bssid *ssid_bssid);
1005 int mwifiex_request_scan(struct mwifiex_private *priv,
1007 struct mwifiex_802_11_ssid *req_ssid);
1008 int mwifiex_set_user_scan_ioctl(struct mwifiex_private *priv,
1009 struct mwifiex_user_scan_cfg *scan_req);
1010 int mwifiex_change_adhoc_chan(struct mwifiex_private *priv, int channel);
1011 int mwifiex_set_radio(struct mwifiex_private *priv, u8 option);
1013 int mwifiex_drv_get_mode(struct mwifiex_private *priv, u8 wait_option);
1015 int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, int channel);
1017 int mwifiex_set_auth(struct mwifiex_private *priv, int encrypt_mode,
1018 int auth_mode, int wpa_enabled);
1020 int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
1021 int key_len, u8 key_index, int disable);
1023 int mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len);
1025 int mwifiex_get_ver_ext(struct mwifiex_private *priv);
1027 int mwifiex_get_stats_info(struct mwifiex_private *priv,
1028 struct mwifiex_ds_get_stats *log);
1030 int mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type,
1031 u32 reg_offset, u32 reg_value);
1033 int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type,
1034 u32 reg_offset, u32 *value);
1036 int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes,
1039 int mwifiex_set_11n_httx_cfg(struct mwifiex_private *priv, int data);
1041 int mwifiex_get_11n_httx_cfg(struct mwifiex_private *priv, int *data);
1043 int mwifiex_set_tx_rate_cfg(struct mwifiex_private *priv, int tx_rate_index);
1045 int mwifiex_get_tx_rate_cfg(struct mwifiex_private *priv, int *tx_rate_index);
1047 int mwifiex_drv_set_power(struct mwifiex_private *priv, bool power_on);
1049 int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter,
1050 char *version, int max_len);
1052 int mwifiex_set_tx_power(struct mwifiex_private *priv, int type, int dbm);
1054 int mwifiex_main_process(struct mwifiex_adapter *);
1056 int mwifiex_bss_ioctl_mode(struct mwifiex_private *,
1057 struct mwifiex_wait_queue *,
1058 u16 action, int *mode);
1059 int mwifiex_bss_ioctl_channel(struct mwifiex_private *,
1061 struct mwifiex_chan_freq_power *cfp);
1062 int mwifiex_bss_ioctl_find_bss(struct mwifiex_private *,
1063 struct mwifiex_wait_queue *,
1064 struct mwifiex_ssid_bssid *);
1065 int mwifiex_radio_ioctl_band_cfg(struct mwifiex_private *,
1067 struct mwifiex_ds_band_cfg *);
1068 int mwifiex_snmp_mib_ioctl(struct mwifiex_private *,
1069 struct mwifiex_wait_queue *,
1070 u32 cmd_oid, u16 action, u32 *value);
1071 int mwifiex_get_bss_info(struct mwifiex_private *,
1072 struct mwifiex_bss_info *);
1074 #ifdef CONFIG_DEBUG_FS
1075 void mwifiex_debugfs_init(void);
1076 void mwifiex_debugfs_remove(void);
1078 void mwifiex_dev_debugfs_init(struct mwifiex_private *priv);
1079 void mwifiex_dev_debugfs_remove(struct mwifiex_private *priv);
1081 #endif /* !_MWIFIEX_MAIN_H_ */