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>
43 extern const char driver_version
[];
50 #define MWIFIEX_MAX_AP 64
52 #define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT (5 * HZ)
54 #define MWIFIEX_TIMER_10S 10000
55 #define MWIFIEX_TIMER_1S 1000
57 #define MAX_TX_PENDING 100
58 #define LOW_TX_PENDING 80
60 #define MWIFIEX_UPLD_SIZE (2312)
62 #define MAX_EVENT_SIZE 2048
64 #define ARP_FILTER_MAX_BUF_SIZE 68
66 #define MWIFIEX_KEY_BUFFER_SIZE 16
67 #define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
68 #define MWIFIEX_MAX_REGION_CODE 7
70 #define DEFAULT_BCN_AVG_FACTOR 8
71 #define DEFAULT_DATA_AVG_FACTOR 8
73 #define FIRST_VALID_CHANNEL 0xff
74 #define DEFAULT_AD_HOC_CHANNEL 6
75 #define DEFAULT_AD_HOC_CHANNEL_A 36
77 #define DEFAULT_BCN_MISS_TIMEOUT 5
79 #define MAX_SCAN_BEACON_BUFFER 8000
81 #define SCAN_BEACON_ENTRY_PAD 6
83 #define MWIFIEX_PASSIVE_SCAN_CHAN_TIME 110
84 #define MWIFIEX_ACTIVE_SCAN_CHAN_TIME 30
85 #define MWIFIEX_SPECIFIC_SCAN_CHAN_TIME 30
87 #define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI)))
89 #define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S)
91 #define MWIFIEX_MAX_SCAN_DELAY_CNT 50
92 #define MWIFIEX_MAX_EMPTY_TX_Q_CNT 10
93 #define MWIFIEX_SCAN_DELAY_MSEC 20
95 #define MWIFIEX_MIN_TX_PENDING_TO_CANCEL_SCAN 2
97 #define RSN_GTK_OUI_OFFSET 2
99 #define MWIFIEX_OUI_NOT_PRESENT 0
100 #define MWIFIEX_OUI_PRESENT 1
102 #define PKT_TYPE_MGMT 0xE5
105 * Do not check for data_received for USB, as data_received
106 * is handled in mwifiex_usb_recv for USB
108 #define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \
109 adapter->event_received || \
110 ((adapter->iface_type != MWIFIEX_USB) && \
111 adapter->data_received) || \
112 ((adapter->iface_type == MWIFIEX_USB) && \
113 !skb_queue_empty(&adapter->usb_rx_data_q)))
115 #define MWIFIEX_TYPE_CMD 1
116 #define MWIFIEX_TYPE_DATA 0
117 #define MWIFIEX_TYPE_EVENT 3
119 #define MAX_BITMAP_RATES_SIZE 18
121 #define MAX_CHANNEL_BAND_BG 14
122 #define MAX_CHANNEL_BAND_A 165
124 #define MAX_FREQUENCY_BAND_BG 2484
126 #define MWIFIEX_EVENT_HEADER_LEN 4
127 #define MWIFIEX_UAP_EVENT_EXTRA_HEADER 2
129 #define MWIFIEX_TYPE_LEN 4
130 #define MWIFIEX_USB_TYPE_CMD 0xF00DFACE
131 #define MWIFIEX_USB_TYPE_DATA 0xBEADC0DE
132 #define MWIFIEX_USB_TYPE_EVENT 0xBEEFFACE
134 /* Threshold for tx_timeout_cnt before we trigger a card reset */
135 #define TX_TIMEOUT_THRESHOLD 6
138 u32 num_cmd_host_to_card_failure
;
139 u32 num_cmd_sleep_cfm_host_to_card_failure
;
140 u32 num_tx_host_to_card_failure
;
141 u32 num_event_deauth
;
142 u32 num_event_disassoc
;
143 u32 num_event_link_lost
;
145 u32 num_cmd_assoc_success
;
146 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 enum mwifiex_iface_type
{
191 struct mwifiex_add_ba_param
{
199 struct mwifiex_tx_aggr
{
205 struct mwifiex_ra_list_tbl
{
206 struct list_head list
;
207 struct sk_buff_head skb_head
;
217 struct mwifiex_tid_tbl
{
218 struct list_head ra_list
;
221 #define WMM_HIGHEST_PRIORITY 7
222 #define HIGH_PRIO_TID 7
223 #define LOW_PRIO_TID 0
225 struct mwifiex_wmm_desc
{
226 struct mwifiex_tid_tbl tid_tbl_ptr
[MAX_NUM_TID
];
227 u32 packets_out
[MAX_NUM_TID
];
228 /* spin lock to protect ra_list */
229 spinlock_t ra_list_spinlock
;
230 struct mwifiex_wmm_ac_status ac_status
[IEEE80211_NUM_ACS
];
231 enum mwifiex_wmm_ac_e ac_down_graded_vals
[IEEE80211_NUM_ACS
];
232 u32 drv_pkt_delay_max
;
233 u8 queue_priority
[IEEE80211_NUM_ACS
];
234 u32 user_pri_pkt_tx_ctrl
[WMM_HIGHEST_PRIORITY
+ 1]; /* UP: 0 to 7 */
235 /* Number of transmit packets queued */
236 atomic_t tx_pkts_queued
;
237 /* Tracks highest priority with a packet queued */
238 atomic_t highest_queued_prio
;
241 struct mwifiex_802_11_security
{
247 u32 authentication_mode
;
252 struct ieee_types_header
{
257 struct ieee_types_vendor_specific
{
258 struct ieee_types_vendor_header vend_hdr
;
259 u8 data
[IEEE_MAX_IE_SIZE
- sizeof(struct ieee_types_vendor_header
)];
262 struct ieee_types_generic
{
263 struct ieee_types_header ieee_hdr
;
264 u8 data
[IEEE_MAX_IE_SIZE
- sizeof(struct ieee_types_header
)];
267 struct ieee_types_bss_co_2040
{
268 struct ieee_types_header ieee_hdr
;
272 struct ieee_types_extcap
{
273 struct ieee_types_header ieee_hdr
;
277 struct ieee_types_vht_cap
{
278 struct ieee_types_header ieee_hdr
;
279 struct ieee80211_vht_cap vhtcap
;
282 struct ieee_types_vht_oper
{
283 struct ieee_types_header ieee_hdr
;
284 struct ieee80211_vht_operation vhtoper
;
287 struct ieee_types_aid
{
288 struct ieee_types_header ieee_hdr
;
292 struct mwifiex_bssdescriptor
{
293 u8 mac_address
[ETH_ALEN
];
294 struct cfg80211_ssid ssid
;
302 u8 supported_rates
[MWIFIEX_SUPPORTED_RATES
];
303 u8 data_rates
[MWIFIEX_SUPPORTED_RATES
];
305 * BAND_B(0x01): 'b' band
306 * BAND_G(0x02): 'g' band
307 * BAND_A(0X04): 'a' band
312 union ieee_types_phy_param_set phy_param_set
;
313 union ieee_types_ss_param_set ss_param_set
;
315 struct ieee_types_wmm_parameter wmm_ie
;
317 struct ieee80211_ht_cap
*bcn_ht_cap
;
319 struct ieee80211_ht_operation
*bcn_ht_oper
;
322 u16 bss_co_2040_offset
;
325 struct ieee80211_vht_cap
*bcn_vht_cap
;
327 struct ieee80211_vht_operation
*bcn_vht_oper
;
329 struct ieee_types_oper_mode_ntf
*oper_mode
;
330 u16 oper_mode_offset
;
332 struct ieee_types_vendor_specific
*bcn_wpa_ie
;
334 struct ieee_types_generic
*bcn_rsn_ie
;
336 struct ieee_types_generic
*bcn_wapi_ie
;
342 u8 chan_sw_ie_present
;
345 struct mwifiex_current_bss_params
{
346 struct mwifiex_bssdescriptor bss_descriptor
;
348 u8 wmm_uapsd_enabled
;
351 u8 data_rates
[MWIFIEX_SUPPORTED_RATES
];
354 struct mwifiex_sleep_params
{
363 struct mwifiex_sleep_period
{
368 struct mwifiex_wep_key
{
372 u8 key_material
[MWIFIEX_KEY_BUFFER_SIZE
];
375 #define MAX_REGION_CHANNEL_NUM 2
377 struct mwifiex_chan_freq_power
{
389 #define MWIFIEX_MAX_TRIPLET_802_11D 83
391 struct mwifiex_802_11d_domain_reg
{
392 u8 country_code
[IEEE80211_COUNTRY_STRING_LEN
];
394 struct ieee80211_country_ie_triplet
395 triplet
[MWIFIEX_MAX_TRIPLET_802_11D
];
398 struct mwifiex_vendor_spec_cfg_ie
{
401 u8 ie
[MWIFIEX_MAX_VSIE_LEN
];
408 struct mwifiex_roc_cfg
{
410 struct ieee80211_channel chan
;
413 struct mwifiex_adapter
;
414 struct mwifiex_private
;
416 struct mwifiex_private
{
417 struct mwifiex_adapter
*adapter
;
424 u8 curr_addr
[ETH_ALEN
];
427 /* track consecutive timeout */
429 struct net_device
*netdev
;
430 struct net_device_stats stats
;
435 u8 max_tx_power_level
;
436 u8 min_tx_power_level
;
442 u16 bitmap_rates
[MAX_BITMAP_RATES_SIZE
];
444 u8 is_data_rate_auto
;
455 struct mwifiex_bssdescriptor
*attempted_bss_desc
;
456 struct cfg80211_ssid prev_ssid
;
457 u8 prev_bssid
[ETH_ALEN
];
458 struct mwifiex_current_bss_params curr_bss_params
;
464 u8 adhoc_is_link_sensed
;
466 struct mwifiex_802_11_security sec_info
;
467 struct mwifiex_wep_key wep_key
[NUM_WEP_KEYS
];
468 u16 wep_key_curr_index
;
472 struct host_cmd_ds_802_11_key_material aes_key
;
473 struct host_cmd_ds_802_11_key_material_v2 aes_key_v2
;
481 struct mwifiex_wmm_desc wmm
;
482 atomic_t wmm_tx_pending
[IEEE80211_NUM_ACS
];
483 struct list_head sta_list
;
484 /* spin lock for associated station list */
485 spinlock_t sta_list_spinlock
;
486 struct list_head tx_ba_stream_tbl_ptr
;
487 /* spin lock for tx_ba_stream_tbl_ptr queue */
488 spinlock_t tx_ba_stream_tbl_lock
;
489 struct mwifiex_tx_aggr aggr_prio_tbl
[MAX_NUM_TID
];
490 struct mwifiex_add_ba_param add_ba_param
;
491 u16 rx_seq
[MAX_NUM_TID
];
492 u8 tos_to_tid_inv
[MAX_NUM_TID
];
493 struct list_head rx_reorder_tbl_ptr
;
494 /* spin lock for rx_reorder_tbl_ptr queue */
495 spinlock_t rx_reorder_tbl_lock
;
496 /* spin lock for Rx packets */
497 spinlock_t rx_pkt_lock
;
499 #define MWIFIEX_ASSOC_RSP_BUF_SIZE 500
500 u8 assoc_rsp_buf
[MWIFIEX_ASSOC_RSP_BUF_SIZE
];
503 #define MWIFIEX_GENIE_BUF_SIZE 256
504 u8 gen_ie_buf
[MWIFIEX_GENIE_BUF_SIZE
];
507 struct mwifiex_vendor_spec_cfg_ie vs_ie
[MWIFIEX_MAX_VSIE_NUM
];
509 #define MWIFIEX_ASSOC_TLV_BUF_SIZE 256
510 u8 assoc_tlv_buf
[MWIFIEX_ASSOC_TLV_BUF_SIZE
];
511 u8 assoc_tlv_buf_len
;
515 /* spin lock for beacon buffer */
516 spinlock_t curr_bcn_buf_lock
;
517 struct wireless_dev
*wdev
;
518 struct mwifiex_chan_freq_power cfp
;
519 char version_str
[128];
520 #ifdef CONFIG_DEBUG_FS
521 struct dentry
*dfs_dev_dir
;
524 u16 current_key_index
;
525 struct semaphore async_sem
;
526 u8 report_scan_result
;
527 struct cfg80211_scan_request
*scan_request
;
533 u8 subsc_evt_rssi_state
;
534 struct mwifiex_ds_misc_subsc_evt async_subsc_evt_storage
;
535 struct mwifiex_ie mgmt_ie
[MAX_MGMT_IE_INDEX
];
540 struct timer_list scan_delay_timer
;
544 struct mwifiex_roc_cfg roc_cfg
;
547 unsigned long csa_expire_time
;
550 struct station_parameters
*sta_params
;
551 struct sk_buff_head tdls_txq
;
554 enum mwifiex_ba_status
{
560 struct mwifiex_tx_ba_stream_tbl
{
561 struct list_head list
;
564 enum mwifiex_ba_status ba_status
;
568 struct mwifiex_rx_reorder_tbl
;
570 struct reorder_tmr_cnxt
{
571 struct timer_list timer
;
572 struct mwifiex_rx_reorder_tbl
*ptr
;
573 struct mwifiex_private
*priv
;
576 struct mwifiex_rx_reorder_tbl
{
577 struct list_head list
;
583 void **rx_reorder_ptr
;
584 struct reorder_tmr_cnxt timer_context
;
589 struct mwifiex_bss_prio_node
{
590 struct list_head list
;
591 struct mwifiex_private
*priv
;
594 struct mwifiex_bss_prio_tbl
{
595 struct list_head bss_prio_head
;
596 /* spin lock for bss priority */
597 spinlock_t bss_prio_lock
;
598 struct mwifiex_bss_prio_node
*bss_prio_cur
;
601 struct cmd_ctrl_node
{
602 struct list_head list
;
603 struct mwifiex_private
*priv
;
606 struct sk_buff
*cmd_skb
;
607 struct sk_buff
*resp_skb
;
615 struct mwifiex_bss_priv
{
620 struct mwifiex_tdls_capab
{
627 struct ieee80211_ht_cap ht_capb
;
628 struct ieee80211_ht_operation ht_oper
;
629 struct ieee_types_extcap extcap
;
630 struct ieee_types_generic rsn_ie
;
631 struct ieee80211_vht_cap vhtcap
;
632 struct ieee80211_vht_operation vhtoper
;
635 /* This is AP/TDLS specific structure which stores information
636 * about associated/peer STA
638 struct mwifiex_sta_node
{
639 struct list_head list
;
640 u8 mac_addr
[ETH_ALEN
];
644 u8 ampdu_sta
[MAX_NUM_TID
];
645 u16 rx_seq
[MAX_NUM_TID
];
648 struct mwifiex_tdls_capab tdls_cap
;
651 struct mwifiex_if_ops
{
652 int (*init_if
) (struct mwifiex_adapter
*);
653 void (*cleanup_if
) (struct mwifiex_adapter
*);
654 int (*check_fw_status
) (struct mwifiex_adapter
*, u32
);
655 int (*prog_fw
) (struct mwifiex_adapter
*, struct mwifiex_fw_image
*);
656 int (*register_dev
) (struct mwifiex_adapter
*);
657 void (*unregister_dev
) (struct mwifiex_adapter
*);
658 int (*enable_int
) (struct mwifiex_adapter
*);
659 void (*disable_int
) (struct mwifiex_adapter
*);
660 int (*process_int_status
) (struct mwifiex_adapter
*);
661 int (*host_to_card
) (struct mwifiex_adapter
*, u8
, struct sk_buff
*,
662 struct mwifiex_tx_param
*);
663 int (*wakeup
) (struct mwifiex_adapter
*);
664 int (*wakeup_complete
) (struct mwifiex_adapter
*);
666 /* Interface specific functions */
667 void (*update_mp_end_port
) (struct mwifiex_adapter
*, u16
);
668 void (*cleanup_mpa_buf
) (struct mwifiex_adapter
*);
669 int (*cmdrsp_complete
) (struct mwifiex_adapter
*, struct sk_buff
*);
670 int (*event_complete
) (struct mwifiex_adapter
*, struct sk_buff
*);
671 int (*data_complete
) (struct mwifiex_adapter
*);
672 int (*init_fw_port
) (struct mwifiex_adapter
*);
673 int (*dnld_fw
) (struct mwifiex_adapter
*, struct mwifiex_fw_image
*);
674 void (*card_reset
) (struct mwifiex_adapter
*);
675 void (*fw_dump
)(struct mwifiex_adapter
*);
676 int (*clean_pcie_ring
) (struct mwifiex_adapter
*adapter
);
679 struct mwifiex_adapter
{
681 struct mwifiex_private
*priv
[MWIFIEX_MAX_BSS_NUM
];
683 const struct firmware
*firmware
;
688 bool surprise_removed
;
689 u32 fw_release_number
;
690 u16 init_wait_q_woken
;
691 wait_queue_head_t init_wait_q
;
693 struct mwifiex_if_ops if_ops
;
696 atomic_t cmd_pending
;
697 struct workqueue_struct
*workqueue
;
698 struct work_struct main_work
;
699 struct mwifiex_bss_prio_tbl bss_prio_tbl
[MWIFIEX_MAX_BSS_NUM
];
700 /* spin lock for init/shutdown */
701 spinlock_t mwifiex_lock
;
702 /* spin lock for main process */
703 spinlock_t main_proc_lock
;
704 u32 mwifiex_processing
;
706 u16 curr_tx_buf_size
;
708 enum MWIFIEX_HARDWARE_STATUS hw_status
;
709 u16 number_of_antenna
;
711 /* spin lock for interrupt handling */
715 struct sk_buff
*event_skb
;
716 u8 upld_buf
[MWIFIEX_UPLD_SIZE
];
719 u8 cmd_resp_received
;
723 struct cmd_ctrl_node
*cmd_pool
;
724 struct cmd_ctrl_node
*curr_cmd
;
725 /* spin lock for command */
726 spinlock_t mwifiex_cmd_lock
;
729 struct timer_list cmd_timer
;
730 struct list_head cmd_free_q
;
731 /* spin lock for cmd_free_q */
732 spinlock_t cmd_free_q_lock
;
733 struct list_head cmd_pending_q
;
734 /* spin lock for cmd_pending_q */
735 spinlock_t cmd_pending_q_lock
;
736 struct list_head scan_pending_q
;
737 /* spin lock for scan_pending_q */
738 spinlock_t scan_pending_q_lock
;
739 struct sk_buff_head usb_rx_data_q
;
742 struct mwifiex_802_11d_domain_reg domain_reg
;
745 u16 specific_scan_time
;
746 u16 active_scan_time
;
747 u16 passive_scan_time
;
751 struct mwifiex_chan_scan_param_set
*scan_channels
;
753 struct mwifiex_sleep_params sleep_params
;
754 struct mwifiex_sleep_period sleep_period
;
759 u16 local_listen_interval
;
760 u16 null_pkt_interval
;
761 struct sk_buff
*sleep_cfm
;
762 u16 bcn_miss_time_out
;
763 u16 adhoc_awake_period
;
767 u16 enhanced_ps_mode
;
768 u8 pm_wakeup_card_req
;
771 u32 pm_wakeup_fw_try
;
773 struct mwifiex_hs_config_param hs_cfg
;
775 u16 hs_activate_wait_q_woken
;
776 wait_queue_head_t hs_activate_wait_q
;
779 u8 event_body
[MAX_EVENT_SIZE
];
780 u32 hw_dot_11n_dev_cap
;
781 u8 hw_dev_mcs_support
;
782 u8 user_dev_mcs_support
;
783 u8 adhoc_11n_enabled
;
785 struct mwifiex_dbg dbg
;
786 u8 arp_filter
[ARP_FILTER_MAX_BUF_SIZE
];
788 struct mwifiex_wait_queue cmd_wait_q
;
789 u8 scan_wait_q_woken
;
790 spinlock_t queue_lock
; /* lock for tx queues */
791 u8 country_code
[IEEE80211_COUNTRY_STRING_LEN
];
792 u16 max_mgmt_ie_index
;
795 const struct firmware
*cal_data
;
796 struct device_node
*dt_node
;
799 u32 is_hw_11ac_capable
;
800 u32 hw_dot_11ac_dev_cap
;
801 u32 hw_dot_11ac_mcs_support
;
802 u32 usr_dot_11ac_dev_cap_bg
;
803 u32 usr_dot_11ac_dev_cap_a
;
804 u32 usr_dot_11ac_mcs_support
;
806 atomic_t is_tx_received
;
807 atomic_t pending_bridged_pkts
;
808 struct semaphore
*card_sem
;
811 u8 fw_key_api_major_ver
, fw_key_api_minor_ver
;
814 int mwifiex_init_lock_list(struct mwifiex_adapter
*adapter
);
816 void mwifiex_set_trans_start(struct net_device
*dev
);
818 void mwifiex_stop_net_dev_queue(struct net_device
*netdev
,
819 struct mwifiex_adapter
*adapter
);
821 void mwifiex_wake_up_net_dev_queue(struct net_device
*netdev
,
822 struct mwifiex_adapter
*adapter
);
824 int mwifiex_init_priv(struct mwifiex_private
*priv
);
825 void mwifiex_free_priv(struct mwifiex_private
*priv
);
827 int mwifiex_init_fw(struct mwifiex_adapter
*adapter
);
829 int mwifiex_init_fw_complete(struct mwifiex_adapter
*adapter
);
831 int mwifiex_shutdown_drv(struct mwifiex_adapter
*adapter
);
833 int mwifiex_shutdown_fw_complete(struct mwifiex_adapter
*adapter
);
835 int mwifiex_dnld_fw(struct mwifiex_adapter
*, struct mwifiex_fw_image
*);
837 int mwifiex_recv_packet(struct mwifiex_private
*priv
, struct sk_buff
*skb
);
839 int mwifiex_process_mgmt_packet(struct mwifiex_private
*priv
,
840 struct sk_buff
*skb
);
842 int mwifiex_process_event(struct mwifiex_adapter
*adapter
);
844 int mwifiex_complete_cmd(struct mwifiex_adapter
*adapter
,
845 struct cmd_ctrl_node
*cmd_node
);
847 int mwifiex_send_cmd(struct mwifiex_private
*priv
, u16 cmd_no
,
848 u16 cmd_action
, u32 cmd_oid
, void *data_buf
, bool sync
);
850 void mwifiex_cmd_timeout_func(unsigned long function_context
);
852 int mwifiex_get_debug_info(struct mwifiex_private
*,
853 struct mwifiex_debug_info
*);
855 int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter
*adapter
);
856 int mwifiex_free_cmd_buffer(struct mwifiex_adapter
*adapter
);
857 void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter
*adapter
);
858 void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter
*adapter
);
860 void mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter
*adapter
,
861 struct cmd_ctrl_node
*cmd_node
);
862 void mwifiex_recycle_cmd_node(struct mwifiex_adapter
*adapter
,
863 struct cmd_ctrl_node
*cmd_node
);
865 void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter
*adapter
,
866 struct cmd_ctrl_node
*cmd_node
,
869 int mwifiex_exec_next_cmd(struct mwifiex_adapter
*adapter
);
870 int mwifiex_process_cmdresp(struct mwifiex_adapter
*adapter
);
871 int mwifiex_handle_rx_packet(struct mwifiex_adapter
*adapter
,
872 struct sk_buff
*skb
);
873 int mwifiex_process_tx(struct mwifiex_private
*priv
, struct sk_buff
*skb
,
874 struct mwifiex_tx_param
*tx_param
);
875 int mwifiex_send_null_packet(struct mwifiex_private
*priv
, u8 flags
);
876 int mwifiex_write_data_complete(struct mwifiex_adapter
*adapter
,
877 struct sk_buff
*skb
, int aggr
, int status
);
878 void mwifiex_clean_txrx(struct mwifiex_private
*priv
);
879 u8
mwifiex_check_last_packet_indication(struct mwifiex_private
*priv
);
880 void mwifiex_check_ps_cond(struct mwifiex_adapter
*adapter
);
881 void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter
*, u8
*,
883 int mwifiex_cmd_enh_power_mode(struct mwifiex_private
*priv
,
884 struct host_cmd_ds_command
*cmd
,
885 u16 cmd_action
, uint16_t ps_bitmap
,
886 struct mwifiex_ds_auto_ds
*auto_ds
);
887 int mwifiex_ret_enh_power_mode(struct mwifiex_private
*priv
,
888 struct host_cmd_ds_command
*resp
,
889 struct mwifiex_ds_pm_cfg
*pm_cfg
);
890 void mwifiex_process_hs_config(struct mwifiex_adapter
*adapter
);
891 void mwifiex_hs_activated_event(struct mwifiex_private
*priv
,
893 int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private
*priv
,
894 struct host_cmd_ds_command
*resp
);
895 int mwifiex_process_rx_packet(struct mwifiex_private
*priv
,
896 struct sk_buff
*skb
);
897 int mwifiex_sta_prepare_cmd(struct mwifiex_private
*, uint16_t cmd_no
,
898 u16 cmd_action
, u32 cmd_oid
,
899 void *data_buf
, void *cmd_buf
);
900 int mwifiex_uap_prepare_cmd(struct mwifiex_private
*priv
, uint16_t cmd_no
,
901 u16 cmd_action
, u32 cmd_oid
,
902 void *data_buf
, void *cmd_buf
);
903 int mwifiex_process_sta_cmdresp(struct mwifiex_private
*, u16 cmdresp_no
,
904 struct host_cmd_ds_command
*resp
);
905 int mwifiex_process_sta_rx_packet(struct mwifiex_private
*,
906 struct sk_buff
*skb
);
907 int mwifiex_process_uap_rx_packet(struct mwifiex_private
*priv
,
908 struct sk_buff
*skb
);
909 int mwifiex_handle_uap_rx_forward(struct mwifiex_private
*priv
,
910 struct sk_buff
*skb
);
911 int mwifiex_process_sta_event(struct mwifiex_private
*);
912 int mwifiex_process_uap_event(struct mwifiex_private
*);
913 void mwifiex_delete_all_station_list(struct mwifiex_private
*priv
);
914 void *mwifiex_process_sta_txpd(struct mwifiex_private
*, struct sk_buff
*skb
);
915 void *mwifiex_process_uap_txpd(struct mwifiex_private
*, struct sk_buff
*skb
);
916 int mwifiex_sta_init_cmd(struct mwifiex_private
*, u8 first_sta
);
917 int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command
*cmd
,
918 struct mwifiex_scan_cmd_config
*scan_cfg
);
919 void mwifiex_queue_scan_cmd(struct mwifiex_private
*priv
,
920 struct cmd_ctrl_node
*cmd_node
);
921 int mwifiex_ret_802_11_scan(struct mwifiex_private
*priv
,
922 struct host_cmd_ds_command
*resp
);
923 s32
mwifiex_ssid_cmp(struct cfg80211_ssid
*ssid1
, struct cfg80211_ssid
*ssid2
);
924 int mwifiex_associate(struct mwifiex_private
*priv
,
925 struct mwifiex_bssdescriptor
*bss_desc
);
926 int mwifiex_cmd_802_11_associate(struct mwifiex_private
*priv
,
927 struct host_cmd_ds_command
*cmd
,
928 struct mwifiex_bssdescriptor
*bss_desc
);
929 int mwifiex_ret_802_11_associate(struct mwifiex_private
*priv
,
930 struct host_cmd_ds_command
*resp
);
931 void mwifiex_reset_connect_state(struct mwifiex_private
*priv
, u16 reason
);
932 u8
mwifiex_band_to_radio_type(u8 band
);
933 int mwifiex_deauthenticate(struct mwifiex_private
*priv
, u8
*mac
);
934 void mwifiex_deauthenticate_all(struct mwifiex_adapter
*adapter
);
935 int mwifiex_adhoc_start(struct mwifiex_private
*priv
,
936 struct cfg80211_ssid
*adhoc_ssid
);
937 int mwifiex_adhoc_join(struct mwifiex_private
*priv
,
938 struct mwifiex_bssdescriptor
*bss_desc
);
939 int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private
*priv
,
940 struct host_cmd_ds_command
*cmd
,
941 struct cfg80211_ssid
*req_ssid
);
942 int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private
*priv
,
943 struct host_cmd_ds_command
*cmd
,
944 struct mwifiex_bssdescriptor
*bss_desc
);
945 int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private
*priv
,
946 struct host_cmd_ds_command
*resp
);
947 int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command
*cmd
);
948 struct mwifiex_chan_freq_power
*mwifiex_get_cfp(struct mwifiex_private
*priv
,
949 u8 band
, u16 channel
, u32 freq
);
950 u32
mwifiex_index_to_data_rate(struct mwifiex_private
*priv
,
951 u8 index
, u8 ht_info
);
952 u32
mwifiex_index_to_acs_data_rate(struct mwifiex_private
*priv
,
953 u8 index
, u8 ht_info
);
954 u32
mwifiex_find_freq_from_band_chan(u8
, u8
);
955 int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private
*priv
, u16 vsie_mask
,
957 u32
mwifiex_get_active_data_rates(struct mwifiex_private
*priv
,
959 u32
mwifiex_get_supported_rates(struct mwifiex_private
*priv
, u8
*rates
);
960 u32
mwifiex_get_rates_from_cfg80211(struct mwifiex_private
*priv
,
961 u8
*rates
, u8 radio_type
);
962 u8
mwifiex_is_rate_auto(struct mwifiex_private
*priv
);
963 extern u16 region_code_index
[MWIFIEX_MAX_REGION_CODE
];
964 void mwifiex_save_curr_bcn(struct mwifiex_private
*priv
);
965 void mwifiex_free_curr_bcn(struct mwifiex_private
*priv
);
966 int mwifiex_cmd_get_hw_spec(struct mwifiex_private
*priv
,
967 struct host_cmd_ds_command
*cmd
);
968 int mwifiex_ret_get_hw_spec(struct mwifiex_private
*priv
,
969 struct host_cmd_ds_command
*resp
);
970 int is_command_pending(struct mwifiex_adapter
*adapter
);
971 void mwifiex_init_priv_params(struct mwifiex_private
*priv
,
972 struct net_device
*dev
);
973 int mwifiex_set_secure_params(struct mwifiex_private
*priv
,
974 struct mwifiex_uap_bss_param
*bss_config
,
975 struct cfg80211_ap_settings
*params
);
976 void mwifiex_set_ht_params(struct mwifiex_private
*priv
,
977 struct mwifiex_uap_bss_param
*bss_cfg
,
978 struct cfg80211_ap_settings
*params
);
979 void mwifiex_set_vht_params(struct mwifiex_private
*priv
,
980 struct mwifiex_uap_bss_param
*bss_cfg
,
981 struct cfg80211_ap_settings
*params
);
982 void mwifiex_set_uap_rates(struct mwifiex_uap_bss_param
*bss_cfg
,
983 struct cfg80211_ap_settings
*params
);
984 void mwifiex_set_vht_width(struct mwifiex_private
*priv
,
985 enum nl80211_chan_width width
,
986 bool ap_11ac_disable
);
988 mwifiex_set_wmm_params(struct mwifiex_private
*priv
,
989 struct mwifiex_uap_bss_param
*bss_cfg
,
990 struct cfg80211_ap_settings
*params
);
991 void mwifiex_set_ba_params(struct mwifiex_private
*priv
);
992 void mwifiex_set_11ac_ba_params(struct mwifiex_private
*priv
);
993 int mwifiex_cmd_802_11_scan_ext(struct mwifiex_private
*priv
,
994 struct host_cmd_ds_command
*cmd
,
996 int mwifiex_ret_802_11_scan_ext(struct mwifiex_private
*priv
);
997 int mwifiex_handle_event_ext_scan_report(struct mwifiex_private
*priv
,
1001 * This function checks if the queuing is RA based or not.
1004 mwifiex_queuing_ra_based(struct mwifiex_private
*priv
)
1007 * Currently we assume if we are in Infra, then DA=RA. This might not be
1008 * true in the future
1010 if ((priv
->bss_mode
== NL80211_IFTYPE_STATION
) &&
1011 (GET_BSS_ROLE(priv
) == MWIFIEX_BSS_ROLE_STA
))
1018 * This function copies rates.
1021 mwifiex_copy_rates(u8
*dest
, u32 pos
, u8
*src
, int len
)
1025 for (i
= 0; i
< len
&& src
[i
]; i
++, pos
++) {
1026 if (pos
>= MWIFIEX_SUPPORTED_RATES
)
1035 * This function returns the correct private structure pointer based
1036 * upon the BSS type and BSS number.
1038 static inline struct mwifiex_private
*
1039 mwifiex_get_priv_by_id(struct mwifiex_adapter
*adapter
,
1040 u8 bss_num
, u8 bss_type
)
1044 for (i
= 0; i
< adapter
->priv_num
; i
++) {
1045 if (adapter
->priv
[i
]) {
1046 if ((adapter
->priv
[i
]->bss_num
== bss_num
) &&
1047 (adapter
->priv
[i
]->bss_type
== bss_type
))
1051 return ((i
< adapter
->priv_num
) ? adapter
->priv
[i
] : NULL
);
1055 * This function returns the first available private structure pointer
1056 * based upon the BSS role.
1058 static inline struct mwifiex_private
*
1059 mwifiex_get_priv(struct mwifiex_adapter
*adapter
,
1060 enum mwifiex_bss_role bss_role
)
1064 for (i
= 0; i
< adapter
->priv_num
; i
++) {
1065 if (adapter
->priv
[i
]) {
1066 if (bss_role
== MWIFIEX_BSS_ROLE_ANY
||
1067 GET_BSS_ROLE(adapter
->priv
[i
]) == bss_role
)
1072 return ((i
< adapter
->priv_num
) ? adapter
->priv
[i
] : NULL
);
1076 * This function returns the driver private structure of a network device.
1078 static inline struct mwifiex_private
*
1079 mwifiex_netdev_get_priv(struct net_device
*dev
)
1081 return (struct mwifiex_private
*) (*(unsigned long *) netdev_priv(dev
));
1085 * This function checks if a skb holds a management frame.
1087 static inline bool mwifiex_is_skb_mgmt_frame(struct sk_buff
*skb
)
1089 return (le32_to_cpu(*(__le32
*)skb
->data
) == PKT_TYPE_MGMT
);
1092 /* This function retrieves channel closed for operation by Channel
1093 * Switch Announcement.
1096 mwifiex_11h_get_csa_closed_channel(struct mwifiex_private
*priv
)
1098 if (!priv
->csa_chan
)
1101 /* Clear csa channel, if DFS channel move time has passed */
1102 if (time_after(jiffies
, priv
->csa_expire_time
)) {
1104 priv
->csa_expire_time
= 0;
1107 return priv
->csa_chan
;
1110 int mwifiex_init_shutdown_fw(struct mwifiex_private
*priv
,
1111 u32 func_init_shutdown
);
1112 int mwifiex_add_card(void *, struct semaphore
*, struct mwifiex_if_ops
*, u8
);
1113 int mwifiex_remove_card(struct mwifiex_adapter
*, struct semaphore
*);
1115 void mwifiex_get_version(struct mwifiex_adapter
*adapter
, char *version
,
1117 int mwifiex_request_set_multicast_list(struct mwifiex_private
*priv
,
1118 struct mwifiex_multicast_list
*mcast_list
);
1119 int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list
*mlist
,
1120 struct net_device
*dev
);
1121 int mwifiex_wait_queue_complete(struct mwifiex_adapter
*adapter
,
1122 struct cmd_ctrl_node
*cmd_queued
);
1123 int mwifiex_bss_start(struct mwifiex_private
*priv
, struct cfg80211_bss
*bss
,
1124 struct cfg80211_ssid
*req_ssid
);
1125 int mwifiex_cancel_hs(struct mwifiex_private
*priv
, int cmd_type
);
1126 int mwifiex_enable_hs(struct mwifiex_adapter
*adapter
);
1127 int mwifiex_disable_auto_ds(struct mwifiex_private
*priv
);
1128 int mwifiex_drv_get_data_rate(struct mwifiex_private
*priv
, u32
*rate
);
1129 int mwifiex_request_scan(struct mwifiex_private
*priv
,
1130 struct cfg80211_ssid
*req_ssid
);
1131 int mwifiex_scan_networks(struct mwifiex_private
*priv
,
1132 const struct mwifiex_user_scan_cfg
*user_scan_in
);
1133 int mwifiex_set_radio(struct mwifiex_private
*priv
, u8 option
);
1135 int mwifiex_set_encode(struct mwifiex_private
*priv
, struct key_params
*kp
,
1136 const u8
*key
, int key_len
, u8 key_index
,
1137 const u8
*mac_addr
, int disable
);
1139 int mwifiex_set_gen_ie(struct mwifiex_private
*priv
, const u8
*ie
, int ie_len
);
1141 int mwifiex_get_ver_ext(struct mwifiex_private
*priv
);
1143 int mwifiex_remain_on_chan_cfg(struct mwifiex_private
*priv
, u16 action
,
1144 struct ieee80211_channel
*chan
,
1145 unsigned int duration
);
1147 int mwifiex_set_bss_role(struct mwifiex_private
*priv
, u8 bss_role
);
1149 int mwifiex_get_stats_info(struct mwifiex_private
*priv
,
1150 struct mwifiex_ds_get_stats
*log
);
1152 int mwifiex_reg_write(struct mwifiex_private
*priv
, u32 reg_type
,
1153 u32 reg_offset
, u32 reg_value
);
1155 int mwifiex_reg_read(struct mwifiex_private
*priv
, u32 reg_type
,
1156 u32 reg_offset
, u32
*value
);
1158 int mwifiex_eeprom_read(struct mwifiex_private
*priv
, u16 offset
, u16 bytes
,
1161 int mwifiex_set_11n_httx_cfg(struct mwifiex_private
*priv
, int data
);
1163 int mwifiex_get_11n_httx_cfg(struct mwifiex_private
*priv
, int *data
);
1165 int mwifiex_set_tx_rate_cfg(struct mwifiex_private
*priv
, int tx_rate_index
);
1167 int mwifiex_get_tx_rate_cfg(struct mwifiex_private
*priv
, int *tx_rate_index
);
1169 int mwifiex_drv_set_power(struct mwifiex_private
*priv
, u32
*ps_mode
);
1171 int mwifiex_drv_get_driver_version(struct mwifiex_adapter
*adapter
,
1172 char *version
, int max_len
);
1174 int mwifiex_set_tx_power(struct mwifiex_private
*priv
,
1175 struct mwifiex_power_cfg
*power_cfg
);
1177 int mwifiex_main_process(struct mwifiex_adapter
*);
1179 int mwifiex_queue_tx_pkt(struct mwifiex_private
*priv
, struct sk_buff
*skb
);
1181 int mwifiex_get_bss_info(struct mwifiex_private
*,
1182 struct mwifiex_bss_info
*);
1183 int mwifiex_fill_new_bss_desc(struct mwifiex_private
*priv
,
1184 struct cfg80211_bss
*bss
,
1185 struct mwifiex_bssdescriptor
*bss_desc
);
1186 int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter
*adapter
,
1187 struct mwifiex_bssdescriptor
*bss_entry
);
1188 int mwifiex_check_network_compatibility(struct mwifiex_private
*priv
,
1189 struct mwifiex_bssdescriptor
*bss_desc
);
1191 u8
mwifiex_chan_type_to_sec_chan_offset(enum nl80211_channel_type chan_type
);
1193 struct wireless_dev
*mwifiex_add_virtual_intf(struct wiphy
*wiphy
,
1195 enum nl80211_iftype type
,
1197 struct vif_params
*params
);
1198 int mwifiex_del_virtual_intf(struct wiphy
*wiphy
, struct wireless_dev
*wdev
);
1200 void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param
*config
);
1202 int mwifiex_add_wowlan_magic_pkt_filter(struct mwifiex_adapter
*adapter
);
1204 int mwifiex_set_mgmt_ies(struct mwifiex_private
*priv
,
1205 struct cfg80211_beacon_data
*data
);
1206 int mwifiex_del_mgmt_ies(struct mwifiex_private
*priv
);
1207 u8
*mwifiex_11d_code_2_region(u8 code
);
1208 void mwifiex_uap_del_sta_data(struct mwifiex_private
*priv
,
1209 struct mwifiex_sta_node
*node
);
1211 void mwifiex_11h_process_join(struct mwifiex_private
*priv
, u8
**buffer
,
1212 struct mwifiex_bssdescriptor
*bss_desc
);
1213 int mwifiex_11h_handle_event_chanswann(struct mwifiex_private
*priv
);
1214 int mwifiex_dnld_dt_cfgdata(struct mwifiex_private
*priv
,
1215 struct device_node
*node
, const char *prefix
);
1216 void mwifiex_dnld_txpwr_table(struct mwifiex_private
*priv
);
1218 extern const struct ethtool_ops mwifiex_ethtool_ops
;
1220 void mwifiex_del_all_sta_list(struct mwifiex_private
*priv
);
1221 void mwifiex_del_sta_entry(struct mwifiex_private
*priv
, const u8
*mac
);
1223 mwifiex_set_sta_ht_cap(struct mwifiex_private
*priv
, const u8
*ies
,
1224 int ies_len
, struct mwifiex_sta_node
*node
);
1225 struct mwifiex_sta_node
*
1226 mwifiex_add_sta_entry(struct mwifiex_private
*priv
, const u8
*mac
);
1227 struct mwifiex_sta_node
*
1228 mwifiex_get_sta_entry(struct mwifiex_private
*priv
, const u8
*mac
);
1229 int mwifiex_send_tdls_data_frame(struct mwifiex_private
*priv
, const u8
*peer
,
1230 u8 action_code
, u8 dialog_token
,
1231 u16 status_code
, const u8
*extra_ies
,
1232 size_t extra_ies_len
);
1233 int mwifiex_send_tdls_action_frame(struct mwifiex_private
*priv
, const u8
*peer
,
1234 u8 action_code
, u8 dialog_token
,
1235 u16 status_code
, const u8
*extra_ies
,
1236 size_t extra_ies_len
);
1237 void mwifiex_process_tdls_action_frame(struct mwifiex_private
*priv
,
1239 int mwifiex_tdls_oper(struct mwifiex_private
*priv
, const u8
*peer
, u8 action
);
1240 int mwifiex_get_tdls_link_status(struct mwifiex_private
*priv
, const u8
*mac
);
1241 void mwifiex_disable_all_tdls_links(struct mwifiex_private
*priv
);
1242 bool mwifiex_is_bss_in_11ac_mode(struct mwifiex_private
*priv
);
1243 u8
mwifiex_get_center_freq_index(struct mwifiex_private
*priv
, u8 band
,
1244 u32 pri_chan
, u8 chan_bw
);
1246 #ifdef CONFIG_DEBUG_FS
1247 void mwifiex_debugfs_init(void);
1248 void mwifiex_debugfs_remove(void);
1250 void mwifiex_dev_debugfs_init(struct mwifiex_private
*priv
);
1251 void mwifiex_dev_debugfs_remove(struct mwifiex_private
*priv
);
1253 #endif /* !_MWIFIEX_MAIN_H_ */