2 * Linux cfg80211 driver
4 * $Copyright Open Broadcom Corporation$
6 * $Id: wl_cfg80211.h 418267 2013-08-14 12:49:52Z $
9 #ifndef _wl_cfg80211_h_
10 #define _wl_cfg80211_h_
12 #include <linux/wireless.h>
14 #include <proto/ethernet.h>
16 #include <linux/wireless.h>
17 #include <net/cfg80211.h>
18 #include <linux/rfkill.h>
20 #include <wl_cfgp2p.h>
33 #define htodchanspec(i) i
34 #define dtohchanspec(i) i
37 #define WL_DBG_P2P_ACTION (1 << 5)
38 #define WL_DBG_TRACE (1 << 4)
39 #define WL_DBG_SCAN (1 << 3)
40 #define WL_DBG_DBG (1 << 2)
41 #define WL_DBG_INFO (1 << 1)
42 #define WL_DBG_ERR (1 << 0)
44 /* 0 invalidates all debug messages. default is 1 */
45 #define WL_DBG_LEVEL 0xFF
47 #define CFG80211_ERROR_TEXT "CFG80211-ERROR) "
49 #if defined(DHD_DEBUG)
50 #define WL_ERR(args) \
52 if (wl_dbg_level & WL_DBG_ERR) { \
53 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
57 #else /* defined(DHD_DEBUG) */
58 #define WL_ERR(args) \
60 if ((wl_dbg_level & WL_DBG_ERR) && net_ratelimit()) { \
61 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
65 #endif /* defined(DHD_DEBUG) */
70 #define WL_INFO(args) \
72 if (wl_dbg_level & WL_DBG_INFO) { \
73 printk(KERN_INFO "CFG80211-INFO) %s : ", __func__); \
80 #define WL_SCAN(args) \
82 if (wl_dbg_level & WL_DBG_SCAN) { \
83 printk(KERN_INFO "CFG80211-SCAN) %s :", __func__); \
90 #define WL_TRACE(args) \
92 if (wl_dbg_level & WL_DBG_TRACE) { \
93 printk(KERN_INFO "CFG80211-TRACE) %s :", __func__); \
100 #define WL_TRACE_HW4 WL_TRACE
101 #if (WL_DBG_LEVEL > 0)
102 #define WL_DBG(args) \
104 if (wl_dbg_level & WL_DBG_DBG) { \
105 printk(KERN_INFO "CFG80211-DEBUG) %s :", __func__); \
109 #else /* !(WL_DBG_LEVEL > 0) */
111 #endif /* (WL_DBG_LEVEL > 0) */
116 #define WL_SCAN_RETRY_MAX 3
117 #define WL_NUM_PMKIDS_MAX MAXPMKID
118 #define WL_SCAN_BUF_MAX (1024 * 8)
119 #define WL_TLV_INFO_MAX 1500
120 #define WL_SCAN_IE_LEN_MAX 2048
121 #define WL_BSS_INFO_MAX 2048
122 #define WL_ASSOC_INFO_MAX 512
123 #define WL_IOCTL_LEN_MAX 2048
124 #define WL_EXTRA_BUF_MAX 2048
125 #define WL_ISCAN_BUF_MAX 2048
126 #define WL_ISCAN_TIMER_INTERVAL_MS 3000
127 #define WL_SCAN_ERSULTS_LAST (WL_SCAN_RESULTS_NO_MEM+1)
128 #define WL_AP_MAX 256
129 #define WL_FILE_NAME_MAX 256
130 #define WL_DWELL_TIME 200
131 #define WL_MED_DWELL_TIME 400
132 #define WL_MIN_DWELL_TIME 100
133 #define WL_LONG_DWELL_TIME 1000
134 #define IFACE_MAX_CNT 2
135 #define WL_SCAN_CONNECT_DWELL_TIME_MS 200
136 #define WL_SCAN_JOIN_PROBE_INTERVAL_MS 20
137 #define WL_SCAN_JOIN_ACTIVE_DWELL_TIME_MS 320
138 #define WL_SCAN_JOIN_PASSIVE_DWELL_TIME_MS 400
139 #define WL_AF_TX_MAX_RETRY 5
141 #define WL_AF_SEARCH_TIME_MAX 450
142 #define WL_AF_TX_EXTRA_TIME_MAX 200
144 #define WL_SCAN_TIMER_INTERVAL_MS 8000 /* Scan timeout */
145 #define WL_CHANNEL_SYNC_RETRY 5
146 #define WL_INVALID -1
148 /* Bring down SCB Timeout to 20secs from 60secs default */
149 #ifndef WL_SCB_TIMEOUT
150 #define WL_SCB_TIMEOUT 20
153 /* SCAN_SUPPRESS timer values in ms */
154 #define WL_SCAN_SUPPRESS_TIMEOUT 31000 /* default Framwork DHCP timeout is 30 sec */
155 #define WL_SCAN_SUPPRESS_RETRY 3000
157 #define WL_PM_ENABLE_TIMEOUT 3000
163 WL_STATUS_SCAN_ABORTING,
164 WL_STATUS_CONNECTING,
166 WL_STATUS_DISCONNECTING,
167 WL_STATUS_AP_CREATING,
168 WL_STATUS_AP_CREATED,
169 /* whole sending action frame procedure:
170 * includes a) 'finding common channel' for public action request frame
171 * and b) 'sending af via 'actframe' iovar'
173 WL_STATUS_SENDING_ACT_FRM,
174 /* find a peer to go to a common channel before sending public action req frame */
175 WL_STATUS_FINDING_COMMON_CHANNEL,
176 /* waiting for next af to sync time of supplicant.
177 * it includes SENDING_ACT_FRM and WAITING_NEXT_ACT_FRM_LISTEN
179 WL_STATUS_WAITING_NEXT_ACT_FRM,
180 #ifdef WL_CFG80211_SYNC_GON
181 /* go to listen state to wait for next af after SENDING_ACT_FRM */
182 WL_STATUS_WAITING_NEXT_ACT_FRM_LISTEN,
183 #endif /* WL_CFG80211_SYNC_GON */
184 /* it will be set when upper layer requests listen and succeed in setting listen mode.
185 * if set, other scan request can abort current listen state
187 WL_STATUS_REMAINING_ON_CHANNEL,
188 #ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
189 /* it's fake listen state to keep current scan state.
190 * it will be set when upper layer requests listen but scan is running. then just run
191 * a expire timer without actual listen state.
192 * if set, other scan request does not need to abort scan.
194 WL_STATUS_FAKE_REMAINING_ON_CHANNEL
195 #endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
205 /* driver profile list */
219 /* driver iscan state */
220 enum wl_iscan_state {
222 WL_ISCAN_STATE_SCANING
225 /* donlge escan state */
226 enum wl_escan_state {
228 WL_ESCAN_STATE_SCANING
230 /* fw downloading status */
233 WL_NVRAM_LOADING_DONE
236 enum wl_management_type {
241 /* beacon / probe_response */
242 struct beacon_proberesp {
247 } __attribute__ ((packed));
249 /* driver configuration */
256 struct ieee80211_channel channel;
259 typedef s32(*EVENT_HANDLER) (struct wl_priv *wl, bcm_struct_cfgdev *cfgdev,
260 const wl_event_msg_t *e, void *data);
262 /* bss inform structure for cfg80211 interface */
263 struct wl_cfg80211_bss_info {
271 /* basic structure of scan request */
273 struct wlc_ssid ssid;
276 /* basic structure of information element */
279 u8 buf[WL_TLV_INFO_MAX];
282 /* event queue for cfg80211 main event */
284 struct list_head eq_list;
290 /* security information with currently associated ap */
297 u32 auth_assoc_res_status;
300 /* ibss information for currently joined ibss network */
302 u8 beacon_interval; /* in millisecond */
303 u8 atim; /* in millisecond */
309 /* wl driver profile */
314 struct wlc_ssid ssid;
315 struct wl_security sec;
317 u8 bssid[ETHER_ADDR_LEN];
324 struct net_device *ndev;
325 struct wireless_dev *wdev;
326 struct wl_profile profile;
329 unsigned long sme_state;
333 struct list_head list; /* list of all net_info structure */
335 typedef s32(*ISCAN_HANDLER) (struct wl_priv *wl);
337 /* iscan controller */
338 struct wl_iscan_ctrl {
339 struct net_device *dev;
340 struct timer_list timer;
344 struct task_struct *tsk;
345 struct semaphore sync;
346 ISCAN_HANDLER iscan_handler[WL_SCAN_ERSULTS_LAST];
348 s8 ioctl_buf[WLC_IOCTL_SMLEN];
349 s8 scan_buf[WL_ISCAN_BUF_MAX];
352 /* association inform */
353 #define MAX_REQ_LINE 1024
354 struct wl_connect_info {
355 u8 req_ie[MAX_REQ_LINE];
357 u8 resp_ie[MAX_REQ_LINE];
361 /* firmware /nvram downloading controller */
363 const struct firmware *fw_entry;
364 unsigned long status;
366 s8 fw_name[WL_FILE_NAME_MAX];
367 s8 nvram_name[WL_FILE_NAME_MAX];
370 /* assoc ie length */
371 struct wl_assoc_ielen {
379 pmkid_t foo[MAXPMKID - 1];
383 #define ESCAN_BUF_SIZE (64 * 1024)
387 #if defined(STATIC_WL_PRIV_STRUCT)
388 #ifndef CONFIG_DHD_USE_STATIC_BUF
389 #error STATIC_WL_PRIV_STRUCT should be used with CONFIG_DHD_USE_STATIC_BUF
390 #endif /* CONFIG_DHD_USE_STATIC_BUF */
393 u8 escan_buf[ESCAN_BUF_SIZE];
394 #endif /* STATIC_WL_PRIV_STRUCT */
396 struct net_device *ndev;
400 /* Structure to hold WPS, WPA IEs for a AP */
401 u8 probe_res_ie[VNDR_IES_MAX_BUF_LEN];
402 u8 beacon_ie[VNDR_IES_MAX_BUF_LEN];
403 u32 probe_res_ie_len;
411 struct timer_list timer;
414 u32 ts_dhcp_start; /* ms ts ecord time stats */
415 u32 ts_dhcp_ok; /* ms ts ecord time stats */
416 bool dhcp_done; /* flag, indicates that host done with
417 * dhcp before t1/t2 expiration
420 struct work_struct work;
421 struct net_device *dev;
425 /* Structure to hold WPS IE for a STA */
426 u8 probe_req_ie[VNDR_IES_BUF_LEN];
427 u8 assoc_req_ie[VNDR_IES_BUF_LEN];
428 u32 probe_req_ie_len;
429 u32 assoc_req_ie_len;
433 wl_af_params_t *pending_tx_act_frm;
434 struct ether_addr tx_dst_addr;
435 struct net_device *dev;
436 struct work_struct work;
440 s32 peer_listen_chan; /* search channel: configured by upper layer */
441 s32 my_listen_chan; /* listen chanel: extract it from prb req or gon req */
448 wpa_ie_fixed_t *wps_ie;
450 wpa_ie_fixed_t *wpa_ie;
457 /* Service discovery */
459 uint8 transaction_id; /* Transaction ID */
460 uint8 protocol; /* Service protocol type */
461 uint16 query_len; /* Length of query */
462 uint16 response_len; /* Length of response */
467 uint16 period; /* extended listen period */
468 uint16 interval; /* extended listen interval */
471 #define WL_SD_STATE_IDLE 0x0000
472 #define WL_SD_SEARCH_SVC 0x0001
473 #define WL_SD_ADV_SVC 0x0002
481 #define MAX_SDO_PROTO_STR_LEN 20
482 typedef struct wl_sdo_proto {
483 char str[MAX_SDO_PROTO_STR_LEN];
487 typedef struct sd_offload {
489 enum wl_dd_state dd_state;
490 wl_sd_listen_t sd_listen;
493 typedef struct sdo_event {
495 uint16 freq; /* channel Freq */
496 uint8 count; /* Tlv count */
502 /* Max length of Interworking element */
503 #define IW_IES_MAX_BUF_LEN 9
506 #define MAX_EVENT_BUF_NUM 16
507 typedef struct wl_eventmsg_buf {
512 } event [MAX_EVENT_BUF_NUM];
515 /* private data of cfg80211 interface */
517 struct wireless_dev *wdev; /* representing wl cfg80211 device */
519 struct wireless_dev *p2p_wdev; /* representing wl cfg80211 device for P2P */
521 struct net_device *p2p_net; /* reference to p2p0 interface */
523 struct wl_conf *conf;
524 struct cfg80211_scan_request *scan_request; /* scan request object */
525 EVENT_HANDLER evt_handler[WLC_E_LAST];
526 struct list_head eq_list; /* used for event queue */
527 struct list_head net_list; /* used for struct net_info */
528 spinlock_t eq_lock; /* for event queue synchronization */
529 spinlock_t cfgdrv_lock; /* to protect scan status (and others if needed) */
530 struct completion act_frm_scan;
531 struct completion iface_disable;
532 struct completion wait_next_af;
533 struct mutex usr_sync; /* maily for up/down synchronization */
534 struct wl_scan_results *bss_list;
535 struct wl_scan_results *scan_results;
537 /* scan request object for internal purpose */
538 struct wl_scan_req *scan_req_int;
539 /* information element object for internal purpose */
540 #if defined(STATIC_WL_PRIV_STRUCT)
545 struct wl_iscan_ctrl *iscan; /* iscan controller */
547 /* association information container */
548 #if defined(STATIC_WL_PRIV_STRUCT)
549 struct wl_connect_info *conn_info;
551 struct wl_connect_info conn_info;
553 #ifdef DEBUGFS_CFG80211
554 struct dentry *debugfs;
555 #endif /* DEBUGFS_CFG80211 */
556 struct wl_pmk_list *pmk_list; /* wpa2 pmk list */
557 tsk_ctl_t event_tsk; /* task of main event handler thread */
560 u32 channel; /* current channel */
561 u32 af_sent_channel; /* channel action frame is sent */
562 /* next af subtype to cancel the remained dwell time in rx process */
564 #ifdef WL_CFG80211_SYNC_GON
565 ulong af_tx_sent_jiffies;
566 #endif /* WL_CFG80211_SYNC_GON */
567 bool iscan_on; /* iscan on/off switch */
568 bool iscan_kickstart; /* indicate iscan already started */
569 bool escan_on; /* escan on/off switch */
570 struct escan_info escan_info; /* escan information */
571 bool active_scan; /* current scan mode */
572 bool ibss_starter; /* indicates this sta is ibss starter */
573 bool link_up; /* link/connection up flag */
575 /* indicate whether chip to support power save mode */
577 bool roam_on; /* on/off switch for self-roaming */
578 bool scan_tried; /* indicates if first scan attempted */
581 bool roamoff_on_concurrent;
582 u8 *ioctl_buf; /* ioctl buffer */
583 struct mutex ioctl_buf_sync;
585 u8 *extra_buf; /* maily to grab assoc information */
586 struct dentry *debugfsdir;
587 struct rfkill *rfkill;
589 struct ieee80211_channel remain_on_chan;
590 enum nl80211_channel_type remain_on_chan_type;
593 wait_queue_head_t netif_change_event;
594 struct completion send_af_done;
595 struct afx_hdl *afx_hdl;
596 struct ap_info *ap_info;
597 struct sta_info *sta_info;
598 struct p2p_info *p2p;
600 struct btcoex_info *btcoex_info;
601 struct timer_list scan_timeout; /* Timer for catch scan event timeout */
602 s32(*state_notifier) (struct wl_priv *wl,
603 struct net_info *_net_info, enum wl_status state, bool set);
604 unsigned long interrested_state;
605 wlc_ssid_t hostapd_ssid;
611 u8 iw_ie[IW_IES_MAX_BUF_LEN];
614 bool sched_scan_running; /* scheduled scan req status */
616 struct cfg80211_sched_scan_request *sched_scan_req; /* scheduled scan req */
617 #endif /* WL_SCHED_SCAN */
618 #ifdef WL_HOST_BAND_MGMT
620 #endif /* WL_HOST_BAND_MGMT */
621 bool scan_suppressed;
622 struct timer_list scan_supp_timer;
623 struct work_struct wlan_work;
624 struct mutex event_sync; /* maily for up/down synchronization */
625 bool pm_enable_work_on;
626 struct delayed_work pm_enable_work;
627 vndr_ie_setbuf_t *ibss_vsie; /* keep the VSIE for IBSS */
632 static inline struct wl_bss_info *next_bss(struct wl_scan_results *list, struct wl_bss_info *bss)
635 (struct wl_bss_info *)((uintptr) bss + dtoh32(bss->length)) : list->bss_info;
638 wl_alloc_netinfo(struct wl_priv *wl, struct net_device *ndev,
639 struct wireless_dev * wdev, s32 mode, bool pm_block)
641 struct net_info *_net_info;
643 if (wl->iface_cnt == IFACE_MAX_CNT)
645 _net_info = kzalloc(sizeof(struct net_info), GFP_KERNEL);
649 _net_info->mode = mode;
650 _net_info->ndev = ndev;
651 _net_info->wdev = wdev;
652 _net_info->pm_restore = 0;
654 _net_info->pm_block = pm_block;
655 _net_info->roam_off = WL_INVALID;
657 list_add(&_net_info->list, &wl->net_list);
662 wl_dealloc_netinfo(struct wl_priv *wl, struct net_device *ndev)
664 struct net_info *_net_info, *next;
666 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
667 if (ndev && (_net_info->ndev == ndev)) {
668 list_del(&_net_info->list);
670 if (_net_info->wdev) {
671 kfree(_net_info->wdev);
672 ndev->ieee80211_ptr = NULL;
680 wl_delete_all_netinfo(struct wl_priv *wl)
682 struct net_info *_net_info, *next;
684 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
685 list_del(&_net_info->list);
687 kfree(_net_info->wdev);
693 wl_get_status_all(struct wl_priv *wl, s32 status)
696 struct net_info *_net_info, *next;
698 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
699 if (_net_info->ndev &&
700 test_bit(status, &_net_info->sme_state))
706 wl_set_status_all(struct wl_priv *wl, s32 status, u32 op)
708 struct net_info *_net_info, *next;
709 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
712 return; /* set all status is not allowed */
714 clear_bit(status, &_net_info->sme_state);
715 if (wl->state_notifier &&
716 test_bit(status, &(wl->interrested_state)))
717 wl->state_notifier(wl, _net_info, status, false);
720 return; /* change all status is not allowed */
722 return; /* unknown operation */
727 wl_set_status_by_netdev(struct wl_priv *wl, s32 status,
728 struct net_device *ndev, u32 op)
731 struct net_info *_net_info, *next;
733 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
734 if (ndev && (_net_info->ndev == ndev)) {
737 set_bit(status, &_net_info->sme_state);
738 if (wl->state_notifier &&
739 test_bit(status, &(wl->interrested_state)))
740 wl->state_notifier(wl, _net_info, status, true);
743 clear_bit(status, &_net_info->sme_state);
744 if (wl->state_notifier &&
745 test_bit(status, &(wl->interrested_state)))
746 wl->state_notifier(wl, _net_info, status, false);
749 change_bit(status, &_net_info->sme_state);
759 wl_get_status_by_netdev(struct wl_priv *wl, s32 status,
760 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 return test_bit(status, &_net_info->sme_state);
772 wl_get_mode_by_netdev(struct wl_priv *wl, struct net_device *ndev)
774 struct net_info *_net_info, *next;
776 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
777 if (ndev && (_net_info->ndev == ndev))
778 return _net_info->mode;
785 wl_set_mode_by_netdev(struct wl_priv *wl, struct net_device *ndev,
788 struct net_info *_net_info, *next;
790 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
791 if (ndev && (_net_info->ndev == ndev))
792 _net_info->mode = mode;
795 static inline struct wl_profile *
796 wl_get_profile_by_netdev(struct wl_priv *wl, struct net_device *ndev)
798 struct net_info *_net_info, *next;
800 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
801 if (ndev && (_net_info->ndev == ndev))
802 return &_net_info->profile;
806 static inline struct net_info *
807 wl_get_netinfo_by_netdev(struct wl_priv *wl, struct net_device *ndev)
809 struct net_info *_net_info, *next;
811 list_for_each_entry_safe(_net_info, next, &wl->net_list, list) {
812 if (ndev && (_net_info->ndev == ndev))
817 #define wl_to_wiphy(w) (w->wdev->wiphy)
818 #define wl_to_prmry_ndev(w) (w->wdev->netdev)
819 #define wl_to_prmry_wdev(w) (w->wdev)
820 #define wl_to_p2p_wdev(w) (w->p2p_wdev)
821 #define ndev_to_wl(n) (wdev_to_wl(n->ieee80211_ptr))
822 #define ndev_to_wdev(ndev) (ndev->ieee80211_ptr)
823 #define wdev_to_ndev(wdev) (wdev->netdev)
825 #if defined(WL_ENABLE_P2P_IF)
826 #define ndev_to_wlc_ndev(ndev, wl) ((ndev == wl->p2p_net) ? \
827 wl_to_prmry_ndev(wl) : ndev)
829 #define ndev_to_wlc_ndev(ndev, wl) (ndev)
830 #endif /* WL_ENABLE_P2P_IF */
832 #if defined(WL_CFG80211_P2P_DEV_IF)
833 #define wdev_to_wlc_ndev(wdev, wl) \
834 ((wdev->iftype == NL80211_IFTYPE_P2P_DEVICE) ? \
835 wl_to_prmry_ndev(wl) : wdev_to_ndev(wdev))
836 #define cfgdev_to_wlc_ndev(cfgdev, wl) wdev_to_wlc_ndev(cfgdev, wl)
837 #elif defined(WL_ENABLE_P2P_IF)
838 #define cfgdev_to_wlc_ndev(cfgdev, wl) ndev_to_wlc_ndev(cfgdev, wl)
840 #define cfgdev_to_wlc_ndev(cfgdev, wl) (cfgdev)
841 #endif /* WL_CFG80211_P2P_DEV_IF */
843 #if defined(WL_CFG80211_P2P_DEV_IF)
844 #define ndev_to_cfgdev(ndev) ndev_to_wdev(ndev)
846 #define ndev_to_cfgdev(ndev) (ndev)
847 #endif /* WL_CFG80211_P2P_DEV_IF */
849 #if defined(WL_CFG80211_P2P_DEV_IF)
850 #define scan_req_match(wl) (((wl) && (wl->scan_request) && \
851 (wl->scan_request->wdev == wl->p2p_wdev)) ? true : false)
852 #elif defined(WL_ENABLE_P2P_IF)
853 #define scan_req_match(wl) (((wl) && (wl->scan_request) && \
854 (wl->scan_request->dev == wl->p2p_net)) ? true : false)
856 #define scan_req_match(wl) (((wl) && p2p_is_on(wl) && p2p_scan(wl)) ? \
858 #endif /* WL_CFG80211_P2P_DEV_IF */
860 #define wl_to_sr(w) (w->scan_req_int)
861 #if defined(STATIC_WL_PRIV_STRUCT)
862 #define wl_to_ie(w) (w->ie)
863 #define wl_to_conn(w) (w->conn_info)
865 #define wl_to_ie(w) (&w->ie)
866 #define wl_to_conn(w) (&w->conn_info)
868 #define iscan_to_wl(i) ((struct wl_priv *)(i->data))
869 #define wl_to_iscan(w) (w->iscan)
870 #define wiphy_from_scan(w) (w->escan_info.wiphy)
871 #define wl_get_drv_status_all(wl, stat) \
872 (wl_get_status_all(wl, WL_STATUS_ ## stat))
873 #define wl_get_drv_status(wl, stat, ndev) \
874 (wl_get_status_by_netdev(wl, WL_STATUS_ ## stat, ndev))
875 #define wl_set_drv_status(wl, stat, ndev) \
876 (wl_set_status_by_netdev(wl, WL_STATUS_ ## stat, ndev, 1))
877 #define wl_clr_drv_status(wl, stat, ndev) \
878 (wl_set_status_by_netdev(wl, WL_STATUS_ ## stat, ndev, 2))
879 #define wl_clr_drv_status_all(wl, stat) \
880 (wl_set_status_all(wl, WL_STATUS_ ## stat, 2))
881 #define wl_chg_drv_status(wl, stat, ndev) \
882 (wl_set_status_by_netdev(wl, WL_STATUS_ ## stat, ndev, 4))
884 #define for_each_bss(list, bss, __i) \
885 for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, bss = next_bss(list, bss))
887 #define for_each_ndev(wl, iter, next) \
888 list_for_each_entry_safe(iter, next, &wl->net_list, list)
891 /* In case of WPS from wpa_supplicant, pairwise siute and group suite is 0.
892 * In addtion to that, wpa_version is WPA_VERSION_1
894 #define is_wps_conn(_sme) \
895 ((wl_cfgp2p_find_wpsie((u8 *)_sme->ie, _sme->ie_len) != NULL) && \
896 (!_sme->crypto.n_ciphers_pairwise) && \
897 (!_sme->crypto.cipher_group))
898 extern s32 wl_cfg80211_attach(struct net_device *ndev, void *data);
899 extern s32 wl_cfg80211_attach_post(struct net_device *ndev);
900 extern void wl_cfg80211_detach(void *para);
902 extern void wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t *e,
904 void wl_cfg80211_set_parent_dev(void *dev);
905 struct device *wl_cfg80211_get_parent_dev(void);
907 extern s32 wl_cfg80211_up(void *para);
908 extern s32 wl_cfg80211_down(void *para);
909 extern s32 wl_cfg80211_notify_ifadd(struct net_device *ndev, s32 idx, s32 bssidx,
911 extern s32 wl_cfg80211_ifdel_ops(struct net_device *net);
912 extern s32 wl_cfg80211_notify_ifdel(void);
913 extern s32 wl_cfg80211_is_progress_ifadd(void);
914 extern s32 wl_cfg80211_is_progress_ifchange(void);
915 extern s32 wl_cfg80211_is_progress_ifadd(void);
916 extern s32 wl_cfg80211_notify_ifchange(void);
917 extern void wl_cfg80211_dbg_level(u32 level);
918 extern s32 wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr);
919 extern s32 wl_cfg80211_set_p2p_noa(struct net_device *net, char* buf, int len);
920 extern s32 wl_cfg80211_get_p2p_noa(struct net_device *net, char* buf, int len);
921 extern s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len,
922 enum wl_management_type type);
923 extern s32 wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len);
925 extern s32 wl_cfg80211_sdo_init(struct wl_priv *wl);
926 extern s32 wl_cfg80211_sdo_deinit(struct wl_priv *wl);
927 extern s32 wl_cfg80211_sd_offload(struct net_device *net, char *cmd, char* buf, int len);
928 extern s32 wl_cfg80211_pause_sdo(struct net_device *dev, struct wl_priv *wl);
929 extern s32 wl_cfg80211_resume_sdo(struct net_device *dev, struct wl_priv *wl);
931 #ifdef WL_SUPPORT_AUTO_CHANNEL
932 #define CHANSPEC_BUF_SIZE 1024
933 #define CHAN_SEL_IOCTL_DELAY 300
934 #define CHAN_SEL_RETRY_COUNT 15
935 #define CHANNEL_IS_RADAR(channel) (((channel & WL_CHAN_RADAR) || \
936 (channel & WL_CHAN_PASSIVE)) ? true : false)
937 #define CHANNEL_IS_2G(channel) (((channel >= 1) && (channel <= 14)) ? \
939 #define CHANNEL_IS_5G(channel) (((channel >= 36) && (channel <= 165)) ? \
941 extern s32 wl_cfg80211_get_best_channels(struct net_device *dev, char* command,
943 #endif /* WL_SUPPORT_AUTO_CHANNEL */
944 extern int wl_cfg80211_hang(struct net_device *dev, u16 reason);
945 extern s32 wl_mode_to_nl80211_iftype(s32 mode);
946 int wl_cfg80211_do_driver_init(struct net_device *net);
947 void wl_cfg80211_enable_trace(u32 level);
948 extern s32 wl_update_wiphybands(struct wl_priv *wl, bool notify);
949 extern s32 wl_cfg80211_if_is_group_owner(void);
950 extern chanspec_t wl_ch_host_to_driver(u16 channel);
951 extern s32 wl_add_remove_eventmsg(struct net_device *ndev, u16 event, bool add);
952 extern void wl_stop_wait_next_action_frame(struct wl_priv *wl);
953 extern int wl_cfg80211_update_power_mode(struct net_device *dev);
954 #ifdef WL_HOST_BAND_MGMT
955 extern s32 wl_cfg80211_set_band(struct net_device *ndev, int band);
956 #endif /* WL_HOST_BAND_MGMT */
957 #if defined(DHCP_SCAN_SUPPRESS)
958 extern int wl_cfg80211_scan_suppress(struct net_device *dev, int suppress);
959 #endif /* OEM_ANDROID */
960 extern void wl_cfg80211_add_to_eventbuffer(wl_eventmsg_buf_t *ev, u16 event, bool set);
961 extern s32 wl_cfg80211_apply_eventbuffer(struct net_device *ndev,
962 struct wl_priv *wl, wl_eventmsg_buf_t *ev);
963 extern void get_primary_mac(struct wl_priv *wl, struct ether_addr *mac);
964 #define SCAN_BUF_CNT 2
965 #define SCAN_BUF_NEXT 1
966 #define wl_escan_set_sync_id(a, b) ((a) = htod16(0x1234))
967 #define wl_escan_get_buf(a, b) ((wl_scan_results_t *) (a)->escan_info.escan_buf)
968 #define wl_escan_check_sync_id(a, b, c) 0
969 #define wl_escan_print_sync_id(a, b, c)
970 #define wl_escan_increment_sync_id(a, b)
971 #define wl_escan_init_sync_id(a)
972 extern void wl_cfg80211_ibss_vsie_set_buffer(vndr_ie_setbuf_t *ibss_vsie, int ibss_vsie_len);
973 extern s32 wl_cfg80211_ibss_vsie_delete(struct net_device *dev);
975 /* Action frame specific functions */
976 extern u8 wl_get_action_category(void *frame, u32 frame_len);
977 extern int wl_get_public_action(void *frame, u32 frame_len, u8 *ret_action);
979 #endif /* _wl_cfg80211_h_ */