2 * Linux cfg80211 driver
4 * Copyright (C) 1999-2013, Broadcom Corporation
6 * Unless you and Broadcom execute a separate written software license
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
12 * As a special exception, the copyright holders of this software give you
13 * permission to link this software with independent modules, and to copy and
14 * distribute the resulting executable under terms of your choice, provided that
15 * you also meet, for each linked independent module, the terms and conditions of
16 * the license of that module. An independent module is a module which is not
17 * derived from this software. The special exception does not apply to any
18 * modifications of the software.
20 * Notwithstanding the above, under no circumstances may you combine this
21 * software in any way with any other Broadcom software provided under a license
22 * other than the GPL, without Broadcom's express prior written consent.
24 * $Id: wl_cfg80211.h 431563 2013-10-24 01:50:16Z $
27 #ifndef _wl_cfg80211_h_
28 #define _wl_cfg80211_h_
30 #include <linux/wireless.h>
32 #include <proto/ethernet.h>
34 #include <linux/wireless.h>
35 #include <linux/workqueue.h>
36 #include <net/cfg80211.h>
37 #include <linux/rfkill.h>
39 #include <wl_cfgp2p.h>
52 #define htodchanspec(i) i
53 #define dtohchanspec(i) i
56 #define WL_DBG_P2P_ACTION (1 << 5)
57 #define WL_DBG_TRACE (1 << 4)
58 #define WL_DBG_SCAN (1 << 3)
59 #define WL_DBG_DBG (1 << 2)
60 #define WL_DBG_INFO (1 << 1)
61 #define WL_DBG_ERR (1 << 0)
63 /* 0 invalidates all debug messages. default is 1 */
64 #define WL_DBG_LEVEL 0xFF
66 #define CFG80211_ERROR_TEXT "CFG80211-ERROR) "
68 #if defined(DHD_DEBUG)
69 #define WL_ERR(args) \
71 if (wl_dbg_level & WL_DBG_ERR) { \
72 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
76 #else /* defined(DHD_DEBUG) */
77 #define WL_ERR(args) \
79 if ((wl_dbg_level & WL_DBG_ERR) && net_ratelimit()) { \
80 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
84 #endif /* defined(DHD_DEBUG) */
89 #define WL_INFO(args) \
91 if (wl_dbg_level & WL_DBG_INFO) { \
92 printk(KERN_INFO "CFG80211-INFO) %s : ", __func__); \
99 #define WL_SCAN(args) \
101 if (wl_dbg_level & WL_DBG_SCAN) { \
102 printk(KERN_INFO "CFG80211-SCAN) %s :", __func__); \
109 #define WL_TRACE(args) \
111 if (wl_dbg_level & WL_DBG_TRACE) { \
112 printk(KERN_INFO "CFG80211-TRACE) %s :", __func__); \
119 #define WL_TRACE_HW4 WL_TRACE
120 #if (WL_DBG_LEVEL > 0)
121 #define WL_DBG(args) \
123 if (wl_dbg_level & WL_DBG_DBG) { \
124 printk(KERN_DEBUG "CFG80211-DEBUG) %s :", __func__); \
128 #else /* !(WL_DBG_LEVEL > 0) */
130 #endif /* (WL_DBG_LEVEL > 0) */
135 #define WL_SCAN_RETRY_MAX 3
136 #define WL_NUM_PMKIDS_MAX MAXPMKID
137 #define WL_SCAN_BUF_MAX (1024 * 8)
138 #define WL_TLV_INFO_MAX 1500
139 #define WL_SCAN_IE_LEN_MAX 2048
140 #define WL_BSS_INFO_MAX 2048
141 #define WL_ASSOC_INFO_MAX 512
142 #define WL_IOCTL_LEN_MAX 2048
143 #define WL_EXTRA_BUF_MAX 2048
144 #define WL_ISCAN_BUF_MAX 2048
145 #define WL_ISCAN_TIMER_INTERVAL_MS 3000
146 #define WL_SCAN_ERSULTS_LAST (WL_SCAN_RESULTS_NO_MEM+1)
147 #define WL_AP_MAX 256
148 #define WL_FILE_NAME_MAX 256
149 #define WL_DWELL_TIME 200
150 #define WL_MED_DWELL_TIME 400
151 #define WL_MIN_DWELL_TIME 100
152 #define WL_LONG_DWELL_TIME 1000
153 #define IFACE_MAX_CNT 2
154 #define WL_SCAN_CONNECT_DWELL_TIME_MS 200
155 #define WL_SCAN_JOIN_PROBE_INTERVAL_MS 20
156 #define WL_SCAN_JOIN_ACTIVE_DWELL_TIME_MS 320
157 #define WL_SCAN_JOIN_PASSIVE_DWELL_TIME_MS 400
158 #define WL_AF_TX_MAX_RETRY 5
160 #define WL_AF_SEARCH_TIME_MAX 450
161 #define WL_AF_TX_EXTRA_TIME_MAX 200
163 #define WL_SCAN_TIMER_INTERVAL_MS 10000 /* Scan timeout */
164 #define WL_CHANNEL_SYNC_RETRY 5
165 #define WL_INVALID -1
167 /* Bring down SCB Timeout to 20secs from 60secs default */
168 #ifndef WL_SCB_TIMEOUT
169 #define WL_SCB_TIMEOUT 20
172 /* SCAN_SUPPRESS timer values in ms */
173 #define WL_SCAN_SUPPRESS_TIMEOUT 31000 /* default Framwork DHCP timeout is 30 sec */
174 #define WL_SCAN_SUPPRESS_RETRY 3000
176 #define WL_PM_ENABLE_TIMEOUT 10000
182 WL_STATUS_SCAN_ABORTING,
183 WL_STATUS_CONNECTING,
185 WL_STATUS_DISCONNECTING,
186 WL_STATUS_AP_CREATING,
187 WL_STATUS_AP_CREATED,
188 /* whole sending action frame procedure:
189 * includes a) 'finding common channel' for public action request frame
190 * and b) 'sending af via 'actframe' iovar'
192 WL_STATUS_SENDING_ACT_FRM,
193 /* find a peer to go to a common channel before sending public action req frame */
194 WL_STATUS_FINDING_COMMON_CHANNEL,
195 /* waiting for next af to sync time of supplicant.
196 * it includes SENDING_ACT_FRM and WAITING_NEXT_ACT_FRM_LISTEN
198 WL_STATUS_WAITING_NEXT_ACT_FRM,
199 #ifdef WL_CFG80211_SYNC_GON
200 /* go to listen state to wait for next af after SENDING_ACT_FRM */
201 WL_STATUS_WAITING_NEXT_ACT_FRM_LISTEN,
202 #endif /* WL_CFG80211_SYNC_GON */
203 /* it will be set when upper layer requests listen and succeed in setting listen mode.
204 * if set, other scan request can abort current listen state
206 WL_STATUS_REMAINING_ON_CHANNEL,
207 #ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
208 /* it's fake listen state to keep current scan state.
209 * it will be set when upper layer requests listen but scan is running. then just run
210 * a expire timer without actual listen state.
211 * if set, other scan request does not need to abort scan.
213 WL_STATUS_FAKE_REMAINING_ON_CHANNEL
214 #endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
224 /* driver profile list */
238 /* driver iscan state */
239 enum wl_iscan_state {
241 WL_ISCAN_STATE_SCANING
244 /* donlge escan state */
245 enum wl_escan_state {
247 WL_ESCAN_STATE_SCANING
249 /* fw downloading status */
252 WL_NVRAM_LOADING_DONE
255 enum wl_management_type {
261 enum wl_handler_del_type {
268 /* beacon / probe_response */
269 struct beacon_proberesp {
274 } __attribute__ ((packed));
276 /* driver configuration */
283 struct ieee80211_channel channel;
286 typedef s32(*EVENT_HANDLER) (struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
287 const wl_event_msg_t *e, void *data);
289 /* bss inform structure for cfg80211 interface */
290 struct wl_cfg80211_bss_info {
298 /* basic structure of scan request */
300 struct wlc_ssid ssid;
303 /* basic structure of information element */
306 u8 buf[WL_TLV_INFO_MAX];
309 /* event queue for cfg80211 main event */
311 struct list_head eq_list;
317 /* security information with currently associated ap */
324 u32 auth_assoc_res_status;
327 /* ibss information for currently joined ibss network */
329 u8 beacon_interval; /* in millisecond */
330 u8 atim; /* in millisecond */
336 /* wl driver profile */
341 struct wlc_ssid ssid;
342 struct wl_security sec;
344 u8 bssid[ETHER_ADDR_LEN];
351 struct net_device *ndev;
352 struct wireless_dev *wdev;
353 struct wl_profile profile;
356 unsigned long sme_state;
360 struct list_head list; /* list of all net_info structure */
362 typedef s32(*ISCAN_HANDLER) (struct wl_priv *wl);
364 /* iscan controller */
365 struct wl_iscan_ctrl {
366 struct net_device *dev;
367 struct timer_list timer;
371 struct task_struct *tsk;
372 struct semaphore sync;
373 ISCAN_HANDLER iscan_handler[WL_SCAN_ERSULTS_LAST];
375 s8 ioctl_buf[WLC_IOCTL_SMLEN];
376 s8 scan_buf[WL_ISCAN_BUF_MAX];
379 /* association inform */
380 #define MAX_REQ_LINE 1024
381 struct wl_connect_info {
382 u8 req_ie[MAX_REQ_LINE];
384 u8 resp_ie[MAX_REQ_LINE];
388 /* firmware /nvram downloading controller */
390 const struct firmware *fw_entry;
391 unsigned long status;
393 s8 fw_name[WL_FILE_NAME_MAX];
394 s8 nvram_name[WL_FILE_NAME_MAX];
397 /* assoc ie length */
398 struct wl_assoc_ielen {
406 pmkid_t foo[MAXPMKID - 1];
410 #define ESCAN_BUF_SIZE (64 * 1024)
414 #if defined(STATIC_WL_PRIV_STRUCT)
415 #ifndef CONFIG_DHD_USE_STATIC_BUF
416 #error STATIC_WL_PRIV_STRUCT should be used with CONFIG_DHD_USE_STATIC_BUF
417 #endif /* CONFIG_DHD_USE_STATIC_BUF */
420 u8 escan_buf[ESCAN_BUF_SIZE];
421 #endif /* STATIC_WL_PRIV_STRUCT */
423 struct net_device *ndev;
427 /* Structure to hold WPS, WPA IEs for a AP */
428 u8 probe_res_ie[VNDR_IES_MAX_BUF_LEN];
429 u8 beacon_ie[VNDR_IES_MAX_BUF_LEN];
430 u32 probe_res_ie_len;
438 struct timer_list timer;
441 u32 ts_dhcp_start; /* ms ts ecord time stats */
442 u32 ts_dhcp_ok; /* ms ts ecord time stats */
443 bool dhcp_done; /* flag, indicates that host done with
444 * dhcp before t1/t2 expiration
447 struct work_struct work;
448 struct net_device *dev;
452 /* Structure to hold WPS IE for a STA */
453 u8 probe_req_ie[VNDR_IES_BUF_LEN];
454 u8 assoc_req_ie[VNDR_IES_BUF_LEN];
455 u32 probe_req_ie_len;
456 u32 assoc_req_ie_len;
460 wl_af_params_t *pending_tx_act_frm;
461 struct ether_addr tx_dst_addr;
462 struct net_device *dev;
463 struct work_struct work;
467 s32 peer_listen_chan; /* search channel: configured by upper layer */
468 s32 my_listen_chan; /* listen chanel: extract it from prb req or gon req */
475 wpa_ie_fixed_t *wps_ie;
477 wpa_ie_fixed_t *wpa_ie;
484 #define MAX_EVENT_BUF_NUM 16
485 typedef struct wl_eventmsg_buf {
490 } event [MAX_EVENT_BUF_NUM];
493 /* private data of cfg80211 interface */
495 struct wireless_dev *wdev; /* representing wl cfg80211 device */
497 struct wireless_dev *p2p_wdev; /* representing wl cfg80211 device for P2P */
499 struct net_device *p2p_net; /* reference to p2p0 interface */
501 struct wl_conf *conf;
502 struct cfg80211_scan_request *scan_request; /* scan request object */
503 EVENT_HANDLER evt_handler[WLC_E_LAST];
504 struct list_head eq_list; /* used for event queue */
505 struct list_head net_list; /* used for struct net_info */
506 struct list_head dealloc_list; /* used for struct net_info which can be freed */
507 spinlock_t eq_lock; /* for event queue synchronization */
508 spinlock_t cfgdrv_lock; /* to protect scan status (and others if needed) */
509 struct completion act_frm_scan;
510 struct completion iface_disable;
511 struct completion wait_next_af;
512 struct mutex usr_sync; /* maily for up/down synchronization */
513 struct wl_scan_results *bss_list;
514 struct wl_scan_results *scan_results;
516 /* scan request object for internal purpose */
517 struct wl_scan_req *scan_req_int;
518 /* information element object for internal purpose */
519 #if defined(STATIC_WL_PRIV_STRUCT)
524 struct wl_iscan_ctrl *iscan; /* iscan controller */
526 /* association information container */
527 #if defined(STATIC_WL_PRIV_STRUCT)
528 struct wl_connect_info *conn_info;
530 struct wl_connect_info conn_info;
532 #ifdef DEBUGFS_CFG80211
533 struct dentry *debugfs;
534 #endif /* DEBUGFS_CFG80211 */
535 struct wl_pmk_list *pmk_list; /* wpa2 pmk list */
536 tsk_ctl_t event_tsk; /* task of main event handler thread */
539 u32 channel; /* current channel */
540 u32 af_sent_channel; /* channel action frame is sent */
541 /* next af subtype to cancel the remained dwell time in rx process */
543 #ifdef WL_CFG80211_SYNC_GON
544 ulong af_tx_sent_jiffies;
545 #endif /* WL_CFG80211_SYNC_GON */
546 bool iscan_on; /* iscan on/off switch */
547 bool iscan_kickstart; /* indicate iscan already started */
548 bool escan_on; /* escan on/off switch */
549 struct escan_info escan_info; /* escan information */
550 bool active_scan; /* current scan mode */
551 bool ibss_starter; /* indicates this sta is ibss starter */
552 bool link_up; /* link/connection up flag */
554 /* indicate whether chip to support power save mode */
556 bool roam_on; /* on/off switch for self-roaming */
557 bool scan_tried; /* indicates if first scan attempted */
560 bool roamoff_on_concurrent;
561 u8 *ioctl_buf; /* ioctl buffer */
562 struct mutex ioctl_buf_sync;
564 u8 *extra_buf; /* maily to grab assoc information */
565 struct dentry *debugfsdir;
566 struct rfkill *rfkill;
568 struct ieee80211_channel remain_on_chan;
569 enum nl80211_channel_type remain_on_chan_type;
572 wait_queue_head_t netif_change_event;
573 struct completion send_af_done;
574 struct afx_hdl *afx_hdl;
575 struct ap_info *ap_info;
576 struct sta_info *sta_info;
577 struct p2p_info *p2p;
579 struct btcoex_info *btcoex_info;
580 struct timer_list scan_timeout; /* Timer for catch scan event timeout */
581 s32(*state_notifier) (struct wl_priv *wl,
582 struct net_info *_net_info, enum wl_status state, bool set);
583 unsigned long interrested_state;
584 wlc_ssid_t hostapd_ssid;
585 bool sched_scan_running; /* scheduled scan req status */
587 struct cfg80211_sched_scan_request *sched_scan_req; /* scheduled scan req */
588 #endif /* WL_SCHED_SCAN */
589 bool scan_suppressed;
590 struct timer_list scan_supp_timer;
591 struct work_struct wlan_work;
592 struct work_struct dealloc_work;
593 struct mutex event_sync; /* maily for up/down synchronization */
594 bool pm_enable_work_on;
595 struct delayed_work pm_enable_work;
596 vndr_ie_setbuf_t *ibss_vsie; /* keep the VSIE for IBSS */
602 static inline struct wl_bss_info *next_bss(struct wl_scan_results *list, struct wl_bss_info *bss)
605 (struct wl_bss_info *)((uintptr) bss + dtoh32(bss->length)) : list->bss_info;
608 wl_alloc_netinfo(struct wl_priv *wl, struct net_device *ndev,
609 struct wireless_dev * wdev, s32 mode, bool pm_block)
611 struct net_info *_net_info;
613 if (wl->iface_cnt == IFACE_MAX_CNT)
615 _net_info = kzalloc(sizeof(struct net_info), GFP_KERNEL);
619 _net_info->mode = mode;
620 _net_info->ndev = ndev;
621 _net_info->wdev = wdev;
622 _net_info->pm_restore = 0;
624 _net_info->pm_block = pm_block;
625 _net_info->roam_off = WL_INVALID;
627 list_add(&_net_info->list, &wl->net_list);
632 wl_remove_netinfo(struct wl_priv *wl, struct net_device *ndev)
634 struct net_info *_net_info, *next;
635 bool dealloc_needed = false;
637 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
638 if (ndev && (_net_info->ndev == ndev)) {
639 list_del(&_net_info->list);
641 if (_net_info->wdev) {
642 ndev->ieee80211_ptr = NULL;
644 INIT_LIST_HEAD(&_net_info->list);
645 list_add(&_net_info->list, &wl->dealloc_list);
646 dealloc_needed = true;
650 schedule_work(&wl->dealloc_work);
654 wl_delete_all_netinfo(struct wl_priv *wl)
656 struct net_info *_net_info, *next;
658 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
659 list_del(&_net_info->list);
661 kfree(_net_info->wdev);
667 wl_get_status_all(struct wl_priv *wl, s32 status)
670 struct net_info *_net_info, *next;
672 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
673 if (_net_info->ndev &&
674 test_bit(status, &_net_info->sme_state))
680 wl_set_status_all(struct wl_priv *wl, s32 status, u32 op)
682 struct net_info *_net_info, *next;
683 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
686 return; /* set all status is not allowed */
688 clear_bit(status, &_net_info->sme_state);
689 if (wl->state_notifier &&
690 test_bit(status, &(wl->interrested_state)))
691 wl->state_notifier(wl, _net_info, status, false);
694 return; /* change all status is not allowed */
696 return; /* unknown operation */
701 wl_set_status_by_netdev(struct wl_priv *wl, s32 status,
702 struct net_device *ndev, u32 op)
705 struct net_info *_net_info, *next;
707 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
708 if (ndev && (_net_info->ndev == ndev)) {
711 set_bit(status, &_net_info->sme_state);
712 if (wl->state_notifier &&
713 test_bit(status, &(wl->interrested_state)))
714 wl->state_notifier(wl, _net_info, status, true);
717 clear_bit(status, &_net_info->sme_state);
718 if (wl->state_notifier &&
719 test_bit(status, &(wl->interrested_state)))
720 wl->state_notifier(wl, _net_info, status, false);
723 change_bit(status, &_net_info->sme_state);
733 wl_get_status_by_netdev(struct wl_priv *wl, s32 status,
734 struct net_device *ndev)
736 struct net_info *_net_info, *next;
738 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
739 if (ndev && (_net_info->ndev == ndev))
740 return test_bit(status, &_net_info->sme_state);
746 wl_get_mode_by_netdev(struct wl_priv *wl, struct net_device *ndev)
748 struct net_info *_net_info, *next;
750 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
751 if (ndev && (_net_info->ndev == ndev))
752 return _net_info->mode;
759 wl_set_mode_by_netdev(struct wl_priv *wl, struct net_device *ndev,
762 struct net_info *_net_info, *next;
764 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
765 if (ndev && (_net_info->ndev == ndev))
766 _net_info->mode = mode;
769 static inline struct wl_profile *
770 wl_get_profile_by_netdev(struct wl_priv *wl, struct net_device *ndev)
772 struct net_info *_net_info, *next;
774 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
775 if (ndev && (_net_info->ndev == ndev))
776 return &_net_info->profile;
780 static inline struct net_info *
781 wl_get_netinfo_by_netdev(struct wl_priv *wl, struct net_device *ndev)
783 struct net_info *_net_info, *next;
785 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
786 if (ndev && (_net_info->ndev == ndev))
791 #define wl_to_wiphy(w) (w->wdev->wiphy)
792 #define wl_to_prmry_ndev(w) (w->wdev->netdev)
793 #define wl_to_prmry_wdev(w) (w->wdev)
794 #define wl_to_p2p_wdev(w) (w->p2p_wdev)
795 #define ndev_to_wl(n) (wdev_to_wl(n->ieee80211_ptr))
796 #define ndev_to_wdev(ndev) (ndev->ieee80211_ptr)
797 #define wdev_to_ndev(wdev) (wdev->netdev)
799 #if defined(WL_ENABLE_P2P_IF)
800 #define ndev_to_wlc_ndev(ndev, wl) ((ndev == wl->p2p_net) ? \
801 wl_to_prmry_ndev(wl) : ndev)
803 #define ndev_to_wlc_ndev(ndev, wl) (ndev)
804 #endif /* WL_ENABLE_P2P_IF */
806 #if defined(WL_CFG80211_P2P_DEV_IF)
807 #define wdev_to_wlc_ndev(wdev, wl) \
808 ((wdev->iftype == NL80211_IFTYPE_P2P_DEVICE) ? \
809 wl_to_prmry_ndev(wl) : wdev_to_ndev(wdev))
810 #define cfgdev_to_wlc_ndev(cfgdev, wl) wdev_to_wlc_ndev(cfgdev, wl)
811 #elif defined(WL_ENABLE_P2P_IF)
812 #define cfgdev_to_wlc_ndev(cfgdev, wl) ndev_to_wlc_ndev(cfgdev, wl)
814 #define cfgdev_to_wlc_ndev(cfgdev, wl) (cfgdev)
815 #endif /* WL_CFG80211_P2P_DEV_IF */
817 #if defined(WL_CFG80211_P2P_DEV_IF)
818 #define ndev_to_cfgdev(ndev) ndev_to_wdev(ndev)
820 #define ndev_to_cfgdev(ndev) (ndev)
821 #endif /* WL_CFG80211_P2P_DEV_IF */
823 #if defined(WL_CFG80211_P2P_DEV_IF)
824 #define scan_req_match(wl) (((wl) && (wl->scan_request) && \
825 (wl->scan_request->wdev == wl->p2p_wdev)) ? true : false)
826 #elif defined(WL_ENABLE_P2P_IF)
827 #define scan_req_match(wl) (((wl) && (wl->scan_request) && \
828 (wl->scan_request->dev == wl->p2p_net)) ? true : false)
830 #define scan_req_match(wl) (((wl) && p2p_is_on(wl) && p2p_scan(wl)) ? \
832 #endif /* WL_CFG80211_P2P_DEV_IF */
834 #define wl_to_sr(w) (w->scan_req_int)
835 #if defined(STATIC_WL_PRIV_STRUCT)
836 #define wl_to_ie(w) (w->ie)
837 #define wl_to_conn(w) (w->conn_info)
839 #define wl_to_ie(w) (&w->ie)
840 #define wl_to_conn(w) (&w->conn_info)
842 #define iscan_to_wl(i) ((struct wl_priv *)(i->data))
843 #define wl_to_iscan(w) (w->iscan)
844 #define wiphy_from_scan(w) (w->escan_info.wiphy)
845 #define wl_get_drv_status_all(wl, stat) \
846 (wl_get_status_all(wl, WL_STATUS_ ## stat))
847 #define wl_get_drv_status(wl, stat, ndev) \
848 (wl_get_status_by_netdev(wl, WL_STATUS_ ## stat, ndev))
849 #define wl_set_drv_status(wl, stat, ndev) \
850 (wl_set_status_by_netdev(wl, WL_STATUS_ ## stat, ndev, 1))
851 #define wl_clr_drv_status(wl, stat, ndev) \
852 (wl_set_status_by_netdev(wl, WL_STATUS_ ## stat, ndev, 2))
853 #define wl_clr_drv_status_all(wl, stat) \
854 (wl_set_status_all(wl, WL_STATUS_ ## stat, 2))
855 #define wl_chg_drv_status(wl, stat, ndev) \
856 (wl_set_status_by_netdev(wl, WL_STATUS_ ## stat, ndev, 4))
858 #define for_each_bss(list, bss, __i) \
859 for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, bss = next_bss(list, bss))
861 #define for_each_ndev(wl, iter, next) \
862 list_for_each_entry_safe(iter, next, &wl->net_list, list)
865 /* In case of WPS from wpa_supplicant, pairwise siute and group suite is 0.
866 * In addtion to that, wpa_version is WPA_VERSION_1
868 #define is_wps_conn(_sme) \
869 ((wl_cfgp2p_find_wpsie((u8 *)_sme->ie, _sme->ie_len) != NULL) && \
870 (!_sme->crypto.n_ciphers_pairwise) && \
871 (!_sme->crypto.cipher_group))
872 extern s32 wl_cfg80211_attach(struct net_device *ndev, void *data);
873 extern s32 wl_cfg80211_attach_post(struct net_device *ndev);
874 extern void wl_cfg80211_detach(void *para);
876 extern void wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t *e,
878 void wl_cfg80211_set_parent_dev(void *dev);
879 struct device *wl_cfg80211_get_parent_dev(void);
881 extern s32 wl_cfg80211_up(void *para);
882 extern s32 wl_cfg80211_down(void *para);
883 extern s32 wl_cfg80211_notify_ifadd(struct net_device *ndev, s32 idx, s32 bssidx,
885 extern s32 wl_cfg80211_ifdel_ops(struct net_device *net);
886 extern s32 wl_cfg80211_notify_ifdel(void);
887 extern s32 wl_cfg80211_is_progress_ifadd(void);
888 extern s32 wl_cfg80211_is_progress_ifchange(void);
889 extern s32 wl_cfg80211_is_progress_ifadd(void);
890 extern s32 wl_cfg80211_notify_ifchange(void);
891 extern void wl_cfg80211_dbg_level(u32 level);
892 extern s32 wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr);
893 extern s32 wl_cfg80211_set_p2p_noa(struct net_device *net, char* buf, int len);
894 extern s32 wl_cfg80211_get_p2p_noa(struct net_device *net, char* buf, int len);
895 extern s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len,
896 enum wl_management_type type);
897 extern s32 wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len);
898 #ifdef WL_SUPPORT_AUTO_CHANNEL
899 #define CHANSPEC_BUF_SIZE 1024
900 #define CHAN_SEL_IOCTL_DELAY 300
901 #define CHAN_SEL_RETRY_COUNT 15
902 #define CHANNEL_IS_RADAR(channel) (((channel & WL_CHAN_RADAR) || \
903 (channel & WL_CHAN_PASSIVE)) ? true : false)
904 #define CHANNEL_IS_2G(channel) (((channel >= 1) && (channel <= 14)) ? \
906 #define CHANNEL_IS_5G(channel) (((channel >= 36) && (channel <= 165)) ? \
908 extern s32 wl_cfg80211_get_best_channels(struct net_device *dev, char* command,
910 #endif /* WL_SUPPORT_AUTO_CHANNEL */
911 extern int wl_cfg80211_hang(struct net_device *dev, u16 reason);
912 extern s32 wl_mode_to_nl80211_iftype(s32 mode);
913 int wl_cfg80211_do_driver_init(struct net_device *net);
914 void wl_cfg80211_enable_trace(bool set, u32 level);
915 extern s32 wl_update_wiphybands(struct wl_priv *wl, bool notify);
916 extern s32 wl_cfg80211_if_is_group_owner(void);
917 extern chanspec_t wl_ch_host_to_driver(u16 channel);
918 extern s32 wl_add_remove_eventmsg(struct net_device *ndev, u16 event, bool add);
919 extern void wl_stop_wait_next_action_frame(struct wl_priv *wl);
920 extern int wl_cfg80211_update_power_mode(struct net_device *dev);
921 extern void wl_cfg80211_add_to_eventbuffer(wl_eventmsg_buf_t *ev, u16 event, bool set);
922 extern s32 wl_cfg80211_apply_eventbuffer(struct net_device *ndev,
923 struct wl_priv *wl, wl_eventmsg_buf_t *ev);
924 extern void get_primary_mac(struct wl_priv *wl, struct ether_addr *mac);
925 #define SCAN_BUF_CNT 2
926 #define SCAN_BUF_NEXT 1
927 #define wl_escan_set_sync_id(a, b) ((a) = htod16(0x1234))
928 #define wl_escan_get_buf(a, b) ((wl_scan_results_t *) (a)->escan_info.escan_buf)
929 #define wl_escan_check_sync_id(a, b, c) 0
930 #define wl_escan_print_sync_id(a, b, c)
931 #define wl_escan_increment_sync_id(a, b)
932 #define wl_escan_init_sync_id(a)
933 extern void wl_cfg80211_ibss_vsie_set_buffer(vndr_ie_setbuf_t *ibss_vsie, int ibss_vsie_len);
934 extern s32 wl_cfg80211_ibss_vsie_delete(struct net_device *dev);
936 /* Action frame specific functions */
937 extern u8 wl_get_action_category(void *frame, u32 frame_len);
938 extern int wl_get_public_action(void *frame, u32 frame_len, u8 *ret_action);
939 #endif /* _wl_cfg80211_h_ */