2 * Linux cfg80211 driver
4 * Copyright (C) 1999-2016, 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.
25 * <<Broadcom-WL-IPTag/Open:>>
27 * $Id: wl_cfg80211.h 608788 2015-12-29 10:59:33Z $
31 * Older Linux versions support the 'iw' interface, more recent ones the 'cfg80211' interface.
34 #ifndef _wl_cfg80211_h_
35 #define _wl_cfg80211_h_
37 #include <linux/wireless.h>
39 #include <proto/ethernet.h>
41 #include <linux/wireless.h>
42 #include <net/cfg80211.h>
43 #include <linux/rfkill.h>
45 #include <dngl_stats.h>
47 #include <wl_cfgp2p.h>
48 #include <linux/time.h>
62 #define htodchanspec(i) (i)
63 #define dtohchanspec(i) (i)
66 #define WL_DBG_P2P_ACTION (1 << 5)
67 #define WL_DBG_TRACE (1 << 4)
68 #define WL_DBG_SCAN (1 << 3)
69 #define WL_DBG_DBG (1 << 2)
70 #define WL_DBG_INFO (1 << 1)
71 #define WL_DBG_ERR (1 << 0)
74 extern void dhd_log_dump_print(const char *fmt, ...);
75 extern char *dhd_log_dump_get_timestamp(void);
76 struct bcm_cfg80211 *wl_get_bcm_cfg80211_ptr(void);
77 #endif /* DHD_LOG_DUMP */
79 /* 0 invalidates all debug messages. default is 1 */
80 #define WL_DBG_LEVEL 0xFF
82 #ifdef CUSTOMER_HW4_DEBUG
83 #define CFG80211_ERROR_TEXT "CFG80211-INFO2) "
85 #define CFG80211_ERROR_TEXT "CFG80211-ERROR) "
86 #endif /* CUSTOMER_HW4_DEBUG */
88 #if defined(DHD_DEBUG)
90 #define WL_ERR(args) \
92 if (wl_dbg_level & WL_DBG_ERR) { \
93 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
95 dhd_log_dump_print("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
96 dhd_log_dump_print args; \
100 #define WL_ERR(args) \
102 if (wl_dbg_level & WL_DBG_ERR) { \
103 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
107 #endif /* DHD_LOG_DUMP */
108 #else /* defined(DHD_DEBUG) */
109 #define WL_ERR(args) \
111 if ((wl_dbg_level & WL_DBG_ERR) && net_ratelimit()) { \
112 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
116 #endif /* defined(DHD_DEBUG) */
122 #define WL_INFORM(args) \
124 if (wl_dbg_level & WL_DBG_INFO) { \
125 printk(KERN_INFO "CFG80211-INFO) %s : ", __func__); \
134 #define WL_SCAN(args) \
136 if (wl_dbg_level & WL_DBG_SCAN) { \
137 printk(KERN_INFO "CFG80211-SCAN) %s :", __func__); \
144 #define WL_TRACE(args) \
146 if (wl_dbg_level & WL_DBG_TRACE) { \
147 printk(KERN_INFO "CFG80211-TRACE) %s :", __func__); \
154 #ifdef CUSTOMER_HW4_DEBUG
155 #define WL_TRACE_HW4(args) \
157 if (wl_dbg_level & WL_DBG_ERR) { \
158 printk(KERN_INFO "CFG80211-TRACE) %s : ", __func__); \
163 #define WL_TRACE_HW4 WL_TRACE
164 #endif /* CUSTOMER_HW4_DEBUG */
165 #if (WL_DBG_LEVEL > 0)
166 #define WL_DBG(args) \
168 if (wl_dbg_level & WL_DBG_DBG) { \
169 printk(KERN_INFO "CFG80211-DEBUG) %s :", __func__); \
173 #else /* !(WL_DBG_LEVEL > 0) */
175 #endif /* (WL_DBG_LEVEL > 0) */
180 #define WL_SCAN_RETRY_MAX 3
181 #define WL_NUM_PMKIDS_MAX MAXPMKID
182 #define WL_SCAN_BUF_MAX (1024 * 8)
183 #define WL_TLV_INFO_MAX 1500
184 #define WL_SCAN_IE_LEN_MAX 2048
185 #define WL_BSS_INFO_MAX 2048
186 #define WL_ASSOC_INFO_MAX 512
187 #define WL_IOCTL_LEN_MAX 2048
188 #define WL_EXTRA_BUF_MAX 2048
189 #define WL_SCAN_ERSULTS_LAST (WL_SCAN_RESULTS_NO_MEM+1)
190 #define WL_AP_MAX 256
191 #define WL_FILE_NAME_MAX 256
192 #define WL_DWELL_TIME 200
193 #define WL_MED_DWELL_TIME 400
194 #define WL_MIN_DWELL_TIME 100
195 #define WL_LONG_DWELL_TIME 1000
196 #define IFACE_MAX_CNT 4
197 #define WL_SCAN_CONNECT_DWELL_TIME_MS 200
198 #define WL_SCAN_JOIN_PROBE_INTERVAL_MS 20
199 #define WL_SCAN_JOIN_ACTIVE_DWELL_TIME_MS 320
200 #define WL_SCAN_JOIN_PASSIVE_DWELL_TIME_MS 400
201 #define WL_AF_TX_MAX_RETRY 5
203 #define WL_AF_SEARCH_TIME_MAX 450
204 #define WL_AF_TX_EXTRA_TIME_MAX 200
206 #define WL_SCAN_TIMER_INTERVAL_MS 10000 /* Scan timeout */
207 #define WL_CHANNEL_SYNC_RETRY 5
208 #define WL_INVALID -1
210 #ifdef DHD_LOSSLESS_ROAMING
211 #define WL_ROAM_TIMEOUT_MS 1000 /* Roam timeout */
213 /* Bring down SCB Timeout to 20secs from 60secs default */
214 #ifndef WL_SCB_TIMEOUT
215 #define WL_SCB_TIMEOUT 20
218 #ifndef WL_SCB_ACTIVITY_TIME
219 #define WL_SCB_ACTIVITY_TIME 5
222 #ifndef WL_SCB_MAX_PROBE
223 #define WL_SCB_MAX_PROBE 3
226 #ifndef WL_MIN_PSPRETEND_THRESHOLD
227 #define WL_MIN_PSPRETEND_THRESHOLD 2
230 /* SCAN_SUPPRESS timer values in ms */
231 #define WL_SCAN_SUPPRESS_TIMEOUT 31000 /* default Framwork DHCP timeout is 30 sec */
232 #define WL_SCAN_SUPPRESS_RETRY 3000
234 #define WL_PM_ENABLE_TIMEOUT 10000
236 /* cfg80211 wowlan definitions */
237 #define WL_WOWLAN_MAX_PATTERNS 8
238 #define WL_WOWLAN_MIN_PATTERN_LEN 1
239 #define WL_WOWLAN_MAX_PATTERN_LEN 255
240 #define WL_WOWLAN_PKT_FILTER_ID_FIRST 201
241 #define WL_WOWLAN_PKT_FILTER_ID_LAST (WL_WOWLAN_PKT_FILTER_ID_FIRST + \
242 WL_WOWLAN_MAX_PATTERNS - 1)
245 #define TDLS_TUNNELED_PRB_REQ "\x7f\x50\x6f\x9a\04"
246 #define TDLS_TUNNELED_PRB_RESP "\x7f\x50\x6f\x9a\05"
254 WL_STATUS_SCAN_ABORTING,
255 WL_STATUS_CONNECTING,
257 WL_STATUS_DISCONNECTING,
258 WL_STATUS_AP_CREATING,
259 WL_STATUS_AP_CREATED,
260 /* whole sending action frame procedure:
261 * includes a) 'finding common channel' for public action request frame
262 * and b) 'sending af via 'actframe' iovar'
264 WL_STATUS_SENDING_ACT_FRM,
265 /* find a peer to go to a common channel before sending public action req frame */
266 WL_STATUS_FINDING_COMMON_CHANNEL,
267 /* waiting for next af to sync time of supplicant.
268 * it includes SENDING_ACT_FRM and WAITING_NEXT_ACT_FRM_LISTEN
270 WL_STATUS_WAITING_NEXT_ACT_FRM,
271 #ifdef WL_CFG80211_SYNC_GON
272 /* go to listen state to wait for next af after SENDING_ACT_FRM */
273 WL_STATUS_WAITING_NEXT_ACT_FRM_LISTEN,
274 #endif /* WL_CFG80211_SYNC_GON */
275 /* it will be set when upper layer requests listen and succeed in setting listen mode.
276 * if set, other scan request can abort current listen state
278 WL_STATUS_REMAINING_ON_CHANNEL,
279 #ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
280 /* it's fake listen state to keep current scan state.
281 * it will be set when upper layer requests listen but scan is running. then just run
282 * a expire timer without actual listen state.
283 * if set, other scan request does not need to abort scan.
285 WL_STATUS_FAKE_REMAINING_ON_CHANNEL
286 #endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
296 /* driver profile list */
310 /* donlge escan state */
311 enum wl_escan_state {
313 WL_ESCAN_STATE_SCANING
315 /* fw downloading status */
318 WL_NVRAM_LOADING_DONE
321 enum wl_management_type {
327 enum wl_pm_workq_act_type {
333 /* beacon / probe_response */
334 struct beacon_proberesp {
339 } __attribute__ ((packed));
341 /* driver configuration */
348 struct ieee80211_channel channel;
351 typedef s32(*EVENT_HANDLER) (struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
352 const wl_event_msg_t *e, void *data);
354 /* bss inform structure for cfg80211 interface */
355 struct wl_cfg80211_bss_info {
363 /* basic structure of scan request */
365 struct wlc_ssid ssid;
368 /* basic structure of information element */
371 u8 buf[WL_TLV_INFO_MAX];
374 /* event queue for cfg80211 main event */
376 struct list_head eq_list;
382 /* security information with currently associated ap */
389 u32 auth_assoc_res_status;
392 /* ibss information for currently joined ibss network */
394 u8 beacon_interval; /* in millisecond */
395 u8 atim; /* in millisecond */
401 typedef struct wl_bss_vndr_ies {
402 u8 probe_req_ie[VNDR_IES_BUF_LEN];
403 u8 probe_res_ie[VNDR_IES_MAX_BUF_LEN];
404 u8 assoc_req_ie[VNDR_IES_BUF_LEN];
405 u8 assoc_res_ie[VNDR_IES_BUF_LEN];
406 u8 beacon_ie[VNDR_IES_MAX_BUF_LEN];
407 u32 probe_req_ie_len;
408 u32 probe_res_ie_len;
409 u32 assoc_req_ie_len;
410 u32 assoc_res_ie_len;
414 typedef struct wl_cfgbss {
419 struct wl_bss_vndr_ies ies; /* Common for STA, P2P GC, GO, AP, P2P Disc Interface */
422 /* cfg driver profile */
427 struct wlc_ssid ssid;
428 struct wl_security sec;
430 u8 bssid[ETHER_ADDR_LEN];
437 struct net_device *ndev;
438 struct wireless_dev *wdev;
439 struct wl_profile profile;
442 unsigned long sme_state;
449 struct list_head list; /* list of all net_info structure */
452 /* association inform */
453 #define MAX_REQ_LINE 1024
454 struct wl_connect_info {
455 u8 req_ie[MAX_REQ_LINE];
457 u8 resp_ie[MAX_REQ_LINE];
461 /* firmware /nvram downloading controller */
463 const struct firmware *fw_entry;
464 unsigned long status;
466 s8 fw_name[WL_FILE_NAME_MAX];
467 s8 nvram_name[WL_FILE_NAME_MAX];
470 /* assoc ie length */
471 struct wl_assoc_ielen {
479 pmkid_t foo[MAXPMKID - 1];
483 #define WL_MAX_IFS DHD_MAX_IFS
485 #define WL_MAX_IFS 16
488 #define ESCAN_BUF_SIZE (64 * 1024)
492 #if defined(STATIC_WL_PRIV_STRUCT)
493 #ifndef CONFIG_DHD_USE_STATIC_BUF
494 #error STATIC_WL_PRIV_STRUCT should be used with CONFIG_DHD_USE_STATIC_BUF
495 #endif /* CONFIG_DHD_USE_STATIC_BUF */
498 u8 escan_buf[ESCAN_BUF_SIZE];
499 #endif /* STATIC_WL_PRIV_STRUCT */
501 struct net_device *ndev;
504 #ifdef ESCAN_BUF_OVERFLOW_MGMT
505 #define BUF_OVERFLOW_MGMT_COUNT 3
509 struct ether_addr BSSID;
511 #endif /* ESCAN_BUF_OVERFLOW_MGMT */
514 wl_af_params_t *pending_tx_act_frm;
515 struct ether_addr tx_dst_addr;
516 struct net_device *dev;
517 struct work_struct work;
521 s32 peer_listen_chan; /* search channel: configured by upper layer */
522 s32 my_listen_chan; /* listen chanel: extract it from prb req or gon req */
529 wpa_ie_fixed_t *wps_ie;
531 wpa_ie_fixed_t *wpa_ie;
538 #ifdef P2P_LISTEN_OFFLOADING
540 uint16 period; /* listen offload period */
541 uint16 interval; /* listen offload interval */
542 uint16 count; /* listen offload count */
543 uint16 pad; /* pad for 32bit align */
545 #endif /* P2P_LISTEN_OFFLOADING */
548 /* Max length of Interworking element */
549 #define IW_IES_MAX_BUF_LEN 9
551 #define MAX_EVENT_BUF_NUM 16
552 typedef struct wl_eventmsg_buf {
557 } event [MAX_EVENT_BUF_NUM];
560 typedef struct wl_if_event_info {
564 uint8 mac[ETHER_ADDR_LEN];
565 char name[IFNAMSIZ+1];
568 #if defined(DHD_ENABLE_BIGDATA_LOGGING)
569 #define GET_BSS_INFO_LEN 90
570 #endif /* DHD_ENABLE_BIGDATA_LOGGING */
572 /* private data of cfg80211 interface */
573 struct bcm_cfg80211 {
574 struct wireless_dev *wdev; /* representing cfg cfg80211 device */
576 struct wireless_dev *p2p_wdev; /* representing cfg cfg80211 device for P2P */
577 struct net_device *p2p_net; /* reference to p2p0 interface */
579 struct wl_conf *conf;
580 struct cfg80211_scan_request *scan_request; /* scan request object */
581 EVENT_HANDLER evt_handler[WLC_E_LAST];
582 struct list_head eq_list; /* used for event queue */
583 struct list_head net_list; /* used for struct net_info */
584 spinlock_t net_list_sync; /* to protect scan status (and others if needed) */
585 spinlock_t eq_lock; /* for event queue synchronization */
586 spinlock_t cfgdrv_lock; /* to protect scan status (and others if needed) */
587 struct completion act_frm_scan;
588 struct completion iface_disable;
589 struct completion wait_next_af;
590 struct mutex usr_sync; /* maily for up/down synchronization */
591 struct mutex scan_complete; /* serialize scan_complete call */
592 struct wl_scan_results *bss_list;
593 struct wl_scan_results *scan_results;
595 /* scan request object for internal purpose */
596 struct wl_scan_req *scan_req_int;
597 /* information element object for internal purpose */
598 #if defined(STATIC_WL_PRIV_STRUCT)
604 /* association information container */
605 #if defined(STATIC_WL_PRIV_STRUCT)
606 struct wl_connect_info *conn_info;
608 struct wl_connect_info conn_info;
610 #ifdef DEBUGFS_CFG80211
611 struct dentry *debugfs;
612 #endif /* DEBUGFS_CFG80211 */
613 struct wl_pmk_list *pmk_list; /* wpa2 pmk list */
614 tsk_ctl_t event_tsk; /* task of main event handler thread */
617 u32 channel; /* current channel */
618 u32 af_sent_channel; /* channel action frame is sent */
619 /* next af subtype to cancel the remained dwell time in rx process */
621 #ifdef WL_CFG80211_SYNC_GON
622 ulong af_tx_sent_jiffies;
623 #endif /* WL_CFG80211_SYNC_GON */
624 struct escan_info escan_info; /* escan information */
625 bool active_scan; /* current scan mode */
626 bool ibss_starter; /* indicates this sta is ibss starter */
627 bool link_up; /* link/connection up flag */
629 /* indicate whether chip to support power save mode */
631 bool roam_on; /* on/off switch for self-roaming */
632 bool scan_tried; /* indicates if first scan attempted */
633 #if defined(BCMSDIO) || defined(BCMPCIE)
637 bool roamoff_on_concurrent;
638 u8 *ioctl_buf; /* ioctl buffer */
639 struct mutex ioctl_buf_sync;
641 u8 *extra_buf; /* maily to grab assoc information */
642 struct dentry *debugfsdir;
643 struct rfkill *rfkill;
645 struct ieee80211_channel remain_on_chan;
646 enum nl80211_channel_type remain_on_chan_type;
649 wait_queue_head_t netif_change_event;
650 wl_if_event_info if_event_info;
651 struct completion send_af_done;
652 struct afx_hdl *afx_hdl;
653 struct p2p_info *p2p;
656 struct timer_list scan_timeout; /* Timer for catch scan event timeout */
657 #if defined(P2P_IE_MISSING_FIX)
660 s32(*state_notifier) (struct bcm_cfg80211 *cfg,
661 struct net_info *_net_info, enum wl_status state, bool set);
662 unsigned long interrested_state;
663 wlc_ssid_t hostapd_ssid;
666 u8 iw_ie[IW_IES_MAX_BUF_LEN];
669 bool sched_scan_running; /* scheduled scan req status */
671 struct cfg80211_sched_scan_request *sched_scan_req; /* scheduled scan req */
672 #endif /* WL_SCHED_SCAN */
673 bool scan_suppressed;
674 struct timer_list scan_supp_timer;
675 struct work_struct wlan_work;
676 struct mutex event_sync; /* maily for up/down synchronization */
677 bool disable_roam_event;
678 struct delayed_work pm_enable_work;
679 struct mutex pm_sync; /* mainly for pm work synchronization */
681 vndr_ie_setbuf_t *ibss_vsie; /* keep the VSIE for IBSS */
686 struct ether_addr ibss_if_addr;
687 bcm_struct_cfgdev *ibss_cfgdev; /* For AIBSS */
688 #endif /* WLAIBSS_MCHAN */
689 bcm_struct_cfgdev *bss_cfgdev; /* For DUAL STA/STA+AP */
691 bool bss_pending_op; /* indicate where there is a pending IF operation */
697 #ifdef WL_CFG80211_P2P_DEV_IF
699 #endif /* WL_CFG80211_P2P_DEV_IF */
700 #ifdef P2PLISTEN_AP_SAMECHN
701 bool p2p_resp_apchn_status;
702 #endif /* P2PLISTEN_AP_SAMECHN */
703 struct wl_wsec_key wep_key;
706 u32 tdls_mgmt_frame_len;
711 uint8 *up_table; /* user priority table, size is UP_TABLE_MAX */
712 #endif /* QOS_MAP_SET */
713 struct ether_addr last_roamed_addr;
714 #ifdef DHD_LOSSLESS_ROAMING
715 struct timer_list roam_timeout; /* Timer for catch roam timeout */
717 bool rcc_enabled; /* flag for Roam channel cache feature */
718 #if defined(DHD_ENABLE_BIGDATA_LOGGING)
719 char bss_info[GET_BSS_INFO_LEN];
720 wl_event_msg_t event_auth_assoc;
721 u32 assoc_reject_status;
723 #endif /* DHD_ENABLE_BIGDATA_LOGGING */
725 bool revert_ndo_disable;
726 #if defined(SUPPORT_RANDOM_MAC_SCAN)
727 bool random_mac_enabled;
728 #endif /* SUPPORT_RANDOM_MAC_SCAN */
729 int p2p_disconnected; // terence 20130703: Fix for wrong group_capab (timing issue)
730 struct ether_addr disconnected_bssid;
733 #if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == \
734 4 && __GNUC_MINOR__ >= 6))
736 #define BCM_LIST_FOR_EACH_ENTRY_SAFE(pos, next, head, member) \
737 _Pragma("GCC diagnostic push") \
738 _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") \
739 list_for_each_entry_safe((pos), (next), (head), member) \
740 _Pragma("GCC diagnostic pop") \
743 #define BCM_LIST_FOR_EACH_ENTRY_SAFE(pos, next, head, member) \
744 list_for_each_entry_safe((pos), (next), (head), member) \
746 #endif /* STRICT_GCC_WARNINGS */
748 static inline struct wl_bss_info *next_bss(struct wl_scan_results *list, struct wl_bss_info *bss)
751 (struct wl_bss_info *)((uintptr) bss + dtoh32(bss->length)) : list->bss_info;
755 wl_probe_wdev_all(struct bcm_cfg80211 *cfg)
757 struct net_info *_net_info, *next;
758 unsigned long int flags;
760 spin_lock_irqsave(&cfg->net_list_sync, flags);
761 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next,
762 &cfg->net_list, list) {
763 WL_ERR(("%s: net_list[%d] bssidx: %d, "
764 "ndev: %p, wdev: %p \n", __FUNCTION__,
765 idx++, _net_info->bssidx,
766 _net_info->ndev, _net_info->wdev));
768 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
772 static inline struct net_info *
773 wl_get_netinfo_by_bssidx(struct bcm_cfg80211 *cfg, s32 bssidx)
775 struct net_info *_net_info, *next, *info = NULL;
776 unsigned long int flags;
778 spin_lock_irqsave(&cfg->net_list_sync, flags);
779 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
780 if ((bssidx >= 0) && (_net_info->bssidx == bssidx)) {
785 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
790 wl_dealloc_netinfo_by_wdev(struct bcm_cfg80211 *cfg, struct wireless_dev *wdev)
792 struct net_info *_net_info, *next;
793 unsigned long int flags;
796 WL_ERR(("dealloc_netinfo enter wdev=%p \n", wdev));
798 spin_lock_irqsave(&cfg->net_list_sync, flags);
799 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
800 if (wdev && (_net_info->wdev == wdev)) {
801 wl_cfgbss_t *bss = &_net_info->bss;
809 list_del(&_net_info->list);
814 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
816 WL_ERR(("dealloc_netinfo exit iface_cnt=%d \n", cfg->iface_cnt));
821 wl_alloc_netinfo(struct bcm_cfg80211 *cfg, struct net_device *ndev,
822 struct wireless_dev * wdev, s32 mode, bool pm_block, u8 bssidx)
824 struct net_info *_net_info;
826 unsigned long int flags;
828 WL_ERR(("alloc_netinfo enter bssidx=%d wdev=%p ndev=%p\n", bssidx, wdev, ndev));
830 /* Check whether there is any duplicate entry for the
833 if ((_net_info = wl_get_netinfo_by_bssidx(cfg, bssidx))) {
834 /* We have a duplicate entry for the same bssidx
835 * already present which shouldn't have been the case.
838 WL_ERR(("Duplicate entry for bssidx=%d present\n", bssidx));
839 wl_probe_wdev_all(cfg);
842 #endif /* DHD_DEBUG */
843 WL_ERR(("Removing the Dup entry for bssidx=%d \n", bssidx));
844 wl_dealloc_netinfo_by_wdev(cfg, _net_info->wdev);
846 if (cfg->iface_cnt == IFACE_MAX_CNT)
848 _net_info = kzalloc(sizeof(struct net_info), GFP_KERNEL);
852 _net_info->mode = mode;
853 _net_info->ndev = ndev;
854 _net_info->wdev = wdev;
855 _net_info->pm_restore = 0;
857 _net_info->pm_block = pm_block;
858 _net_info->roam_off = WL_INVALID;
859 _net_info->bssidx = bssidx;
860 spin_lock_irqsave(&cfg->net_list_sync, flags);
862 list_add(&_net_info->list, &cfg->net_list);
863 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
866 WL_ERR(("alloc_netinfo exit iface_cnt=%d \n", cfg->iface_cnt));
872 wl_delete_all_netinfo(struct bcm_cfg80211 *cfg)
874 struct net_info *_net_info, *next;
875 unsigned long int flags;
877 spin_lock_irqsave(&cfg->net_list_sync, flags);
878 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
879 wl_cfgbss_t *bss = &_net_info->bss;
887 list_del(&_net_info->list);
889 kfree(_net_info->wdev);
893 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
896 wl_get_status_all(struct bcm_cfg80211 *cfg, s32 status)
899 struct net_info *_net_info, *next;
901 unsigned long int flags;
903 spin_lock_irqsave(&cfg->net_list_sync, flags);
904 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
905 if (_net_info->ndev &&
906 test_bit(status, &_net_info->sme_state))
909 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
913 wl_set_status_all(struct bcm_cfg80211 *cfg, s32 status, u32 op)
915 struct net_info *_net_info, *next;
916 unsigned long int flags;
918 spin_lock_irqsave(&cfg->net_list_sync, flags);
919 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
922 break; /* set all status is not allowed */
925 * Release the spinlock before calling notifier. Else there
926 * will be nested calls
928 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
929 clear_bit(status, &_net_info->sme_state);
930 if (cfg->state_notifier &&
931 test_bit(status, &(cfg->interrested_state)))
932 cfg->state_notifier(cfg, _net_info, status, false);
935 break; /* change all status is not allowed */
937 break; /* unknown operation */
940 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
943 wl_set_status_by_netdev(struct bcm_cfg80211 *cfg, s32 status,
944 struct net_device *ndev, u32 op)
947 struct net_info *_net_info, *next;
948 unsigned long int flags;
950 spin_lock_irqsave(&cfg->net_list_sync, flags);
951 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
952 if (ndev && (_net_info->ndev == ndev)) {
956 * Release the spinlock before calling notifier. Else there
957 * will be nested calls
959 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
960 set_bit(status, &_net_info->sme_state);
961 if (cfg->state_notifier &&
962 test_bit(status, &(cfg->interrested_state)))
963 cfg->state_notifier(cfg, _net_info, status, true);
967 * Release the spinlock before calling notifier. Else there
968 * will be nested calls
970 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
971 clear_bit(status, &_net_info->sme_state);
972 if (cfg->state_notifier &&
973 test_bit(status, &(cfg->interrested_state)))
974 cfg->state_notifier(cfg, _net_info, status, false);
977 change_bit(status, &_net_info->sme_state);
983 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
987 static inline wl_cfgbss_t *
988 wl_get_cfgbss_by_wdev(struct bcm_cfg80211 *cfg,
989 struct wireless_dev *wdev)
991 struct net_info *_net_info, *next;
992 wl_cfgbss_t *bss = NULL;
993 unsigned long int flags;
995 spin_lock_irqsave(&cfg->net_list_sync, flags);
996 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
997 if (wdev && (_net_info->wdev == wdev)) {
998 bss = &_net_info->bss;
1003 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
1008 wl_get_status_by_netdev(struct bcm_cfg80211 *cfg, s32 status,
1009 struct net_device *ndev)
1011 struct net_info *_net_info, *next;
1013 unsigned long int flags;
1015 spin_lock_irqsave(&cfg->net_list_sync, flags);
1016 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
1017 if (ndev && (_net_info->ndev == ndev)) {
1018 stat = test_bit(status, &_net_info->sme_state);
1022 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
1027 wl_get_mode_by_netdev(struct bcm_cfg80211 *cfg, struct net_device *ndev)
1029 struct net_info *_net_info, *next;
1031 unsigned long int flags;
1033 spin_lock_irqsave(&cfg->net_list_sync, flags);
1034 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
1035 if (ndev && (_net_info->ndev == ndev)) {
1036 mode = _net_info->mode;
1040 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
1045 wl_set_mode_by_netdev(struct bcm_cfg80211 *cfg, struct net_device *ndev,
1048 struct net_info *_net_info, *next;
1049 unsigned long int flags;
1051 spin_lock_irqsave(&cfg->net_list_sync, flags);
1052 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
1053 if (ndev && (_net_info->ndev == ndev))
1054 _net_info->mode = mode;
1056 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
1060 wl_get_bssidx_by_wdev(struct bcm_cfg80211 *cfg, struct wireless_dev *wdev)
1062 struct net_info *_net_info, *next;
1064 unsigned long int flags;
1066 spin_lock_irqsave(&cfg->net_list_sync, flags);
1067 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
1068 if (_net_info->wdev && (_net_info->wdev == wdev)) {
1069 bssidx = _net_info->bssidx;
1073 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
1077 static inline struct wireless_dev *
1078 wl_get_wdev_by_bssidx(struct bcm_cfg80211 *cfg, s32 bssidx)
1080 struct net_info *_net_info, *next;
1081 struct wireless_dev *wdev = NULL;
1082 unsigned long int flags;
1086 spin_lock_irqsave(&cfg->net_list_sync, flags);
1087 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
1088 if (_net_info->bssidx == bssidx) {
1089 wdev = _net_info->wdev;
1093 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
1097 static inline struct wl_profile *
1098 wl_get_profile_by_netdev(struct bcm_cfg80211 *cfg, struct net_device *ndev)
1100 struct net_info *_net_info, *next;
1101 struct wl_profile *prof = NULL;
1102 unsigned long int flags;
1104 spin_lock_irqsave(&cfg->net_list_sync, flags);
1105 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
1106 if (ndev && (_net_info->ndev == ndev)) {
1107 prof = &_net_info->profile;
1111 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
1114 static inline struct net_info *
1115 wl_get_netinfo_by_netdev(struct bcm_cfg80211 *cfg, struct net_device *ndev)
1117 struct net_info *_net_info, *next, *info = NULL;
1118 unsigned long int flags;
1120 spin_lock_irqsave(&cfg->net_list_sync, flags);
1121 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
1122 if (ndev && (_net_info->ndev == ndev)) {
1127 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
1131 static inline struct net_info *
1132 wl_get_netinfo_by_wdev(struct bcm_cfg80211 *cfg, struct wireless_dev *wdev)
1134 struct net_info *_net_info, *next, *info = NULL;
1135 unsigned long int flags;
1137 spin_lock_irqsave(&cfg->net_list_sync, flags);
1138 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info, next, &cfg->net_list, list) {
1139 if (wdev && (_net_info->wdev == wdev)) {
1144 spin_unlock_irqrestore(&cfg->net_list_sync, flags);
1148 #define is_p2p_group_iface(wdev) (((wdev->iftype == NL80211_IFTYPE_P2P_GO) || \
1149 (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) ? 1 : 0)
1150 #define bcmcfg_to_wiphy(cfg) (cfg->wdev->wiphy)
1151 #define bcmcfg_to_prmry_ndev(cfg) (cfg->wdev->netdev)
1152 #define bcmcfg_to_prmry_wdev(cfg) (cfg->wdev)
1153 #define bcmcfg_to_p2p_wdev(cfg) (cfg->p2p_wdev)
1154 #define ndev_to_wl(n) (wdev_to_wl(n->ieee80211_ptr))
1155 #define ndev_to_wdev(ndev) (ndev->ieee80211_ptr)
1156 #define wdev_to_ndev(wdev) (wdev->netdev)
1158 #if defined(WL_ENABLE_P2P_IF)
1159 #define ndev_to_wlc_ndev(ndev, cfg) ((ndev == cfg->p2p_net) ? \
1160 bcmcfg_to_prmry_ndev(cfg) : ndev)
1162 #define ndev_to_wlc_ndev(ndev, cfg) (ndev)
1163 #endif /* WL_ENABLE_P2P_IF */
1165 #define wdev_to_wlc_ndev(wdev, cfg) \
1166 (wdev_to_ndev(wdev) ? \
1167 wdev_to_ndev(wdev) : bcmcfg_to_prmry_ndev(cfg))
1168 #if defined(WL_CFG80211_P2P_DEV_IF)
1169 #define cfgdev_to_wlc_ndev(cfgdev, cfg) wdev_to_wlc_ndev(cfgdev, cfg)
1170 #define bcmcfg_to_prmry_cfgdev(cfgdev, cfg) bcmcfg_to_prmry_wdev(cfg)
1171 #elif defined(WL_ENABLE_P2P_IF)
1172 #define cfgdev_to_wlc_ndev(cfgdev, cfg) ndev_to_wlc_ndev(cfgdev, cfg)
1173 #define bcmcfg_to_prmry_cfgdev(cfgdev, cfg) bcmcfg_to_prmry_ndev(cfg)
1175 #define cfgdev_to_wlc_ndev(cfgdev, cfg) (cfgdev)
1176 #define bcmcfg_to_prmry_cfgdev(cfgdev, cfg) (cfgdev)
1177 #endif /* WL_CFG80211_P2P_DEV_IF */
1179 #if defined(WL_CFG80211_P2P_DEV_IF)
1180 #define cfgdev_to_wdev(cfgdev) (cfgdev)
1181 #define ndev_to_cfgdev(ndev) ndev_to_wdev(ndev)
1182 #define cfgdev_to_ndev(cfgdev) (cfgdev ? (cfgdev->netdev) : NULL)
1183 #define wdev_to_cfgdev(cfgdev) (cfgdev)
1184 #define discover_cfgdev(cfgdev, cfg) (cfgdev->iftype == NL80211_IFTYPE_P2P_DEVICE)
1186 #define cfgdev_to_wdev(cfgdev) (cfgdev->ieee80211_ptr)
1187 #define wdev_to_cfgdev(cfgdev) cfgdev ? (cfgdev->netdev) : NULL
1188 #define ndev_to_cfgdev(ndev) (ndev)
1189 #define cfgdev_to_ndev(cfgdev) (cfgdev)
1190 #define discover_cfgdev(cfgdev, cfg) (cfgdev == cfg->p2p_net)
1191 #endif /* WL_CFG80211_P2P_DEV_IF */
1193 #if defined(WL_CFG80211_P2P_DEV_IF)
1194 #define scan_req_match(cfg) (((cfg) && (cfg->scan_request) && \
1195 (cfg->scan_request->wdev == cfg->p2p_wdev)) ? true : false)
1196 #elif defined(WL_ENABLE_P2P_IF)
1197 #define scan_req_match(cfg) (((cfg) && (cfg->scan_request) && \
1198 (cfg->scan_request->dev == cfg->p2p_net)) ? true : false)
1200 #define scan_req_match(cfg) (((cfg) && p2p_is_on(cfg) && p2p_scan(cfg)) ? \
1202 #endif /* WL_CFG80211_P2P_DEV_IF */
1204 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
1205 #define scan_req_iftype(req) (req->dev->ieee80211_ptr->iftype)
1207 #define scan_req_iftype(req) (req->wdev->iftype)
1208 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) */
1210 #define wl_to_sr(w) (w->scan_req_int)
1211 #if defined(STATIC_WL_PRIV_STRUCT)
1212 #define wl_to_ie(w) (w->ie)
1213 #define wl_to_conn(w) (w->conn_info)
1215 #define wl_to_ie(w) (&w->ie)
1216 #define wl_to_conn(w) (&w->conn_info)
1218 #define wiphy_from_scan(w) (w->escan_info.wiphy)
1219 #define wl_get_drv_status_all(cfg, stat) \
1220 (wl_get_status_all(cfg, WL_STATUS_ ## stat))
1221 #define wl_get_drv_status(cfg, stat, ndev) \
1222 (wl_get_status_by_netdev(cfg, WL_STATUS_ ## stat, ndev))
1223 #define wl_set_drv_status(cfg, stat, ndev) \
1224 (wl_set_status_by_netdev(cfg, WL_STATUS_ ## stat, ndev, 1))
1225 #define wl_clr_drv_status(cfg, stat, ndev) \
1226 (wl_set_status_by_netdev(cfg, WL_STATUS_ ## stat, ndev, 2))
1227 #define wl_clr_drv_status_all(cfg, stat) \
1228 (wl_set_status_all(cfg, WL_STATUS_ ## stat, 2))
1229 #define wl_chg_drv_status(cfg, stat, ndev) \
1230 (wl_set_status_by_netdev(cfg, WL_STATUS_ ## stat, ndev, 4))
1232 #define for_each_bss(list, bss, __i) \
1233 for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, bss = next_bss(list, bss))
1235 #define for_each_ndev(cfg, iter, next) \
1236 list_for_each_entry_safe(iter, next, &cfg->net_list, list)
1238 /* In case of WPS from wpa_supplicant, pairwise siute and group suite is 0.
1239 * In addtion to that, wpa_version is WPA_VERSION_1
1241 #define is_wps_conn(_sme) \
1242 ((wl_cfgp2p_find_wpsie((u8 *)_sme->ie, _sme->ie_len) != NULL) && \
1243 (!_sme->crypto.n_ciphers_pairwise) && \
1244 (!_sme->crypto.cipher_group))
1246 #define IS_AKM_SUITE_FT(sec) false
1248 #define IS_AKM_SUITE_CCKM(sec) false
1250 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
1251 #define STA_INFO_BIT(info) (1ul << NL80211_STA_ ## info)
1252 #define strnicmp(str1, str2, len) strncasecmp((str1), (str2), (len))
1254 #define STA_INFO_BIT(info) (STATION_ ## info)
1255 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) */
1257 extern s32 wl_cfg80211_attach(struct net_device *ndev, void *context);
1258 extern s32 wl_cfg80211_attach_post(struct net_device *ndev);
1259 extern void wl_cfg80211_detach(void *para);
1261 extern void wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t *e,
1263 void wl_cfg80211_set_parent_dev(void *dev);
1264 struct device *wl_cfg80211_get_parent_dev(void);
1267 extern s32 wl_cfg80211_clear_mgmt_vndr_ies(struct bcm_cfg80211 *cfg);
1268 extern s32 wl_cfg80211_clear_per_bss_ies(struct bcm_cfg80211 *cfg, s32 bssidx);
1270 extern s32 wl_cfg80211_up(void *para);
1271 extern s32 wl_cfg80211_down(void *para);
1272 extern s32 wl_cfg80211_notify_ifadd(int ifidx, char *name, uint8 *mac, uint8 bssidx);
1273 extern s32 wl_cfg80211_notify_ifdel(int ifidx, char *name, uint8 *mac, uint8 bssidx);
1274 extern s32 wl_cfg80211_notify_ifchange(int ifidx, char *name, uint8 *mac, uint8 bssidx);
1275 extern struct net_device* wl_cfg80211_allocate_if(struct bcm_cfg80211 *cfg, int ifidx, char *name,
1276 uint8 *mac, uint8 bssidx, char *dngl_name);
1277 extern int wl_cfg80211_register_if(struct bcm_cfg80211 *cfg, int ifidx, struct net_device* ndev);
1278 extern int wl_cfg80211_remove_if(struct bcm_cfg80211 *cfg, int ifidx, struct net_device* ndev);
1279 extern int wl_cfg80211_scan_stop(bcm_struct_cfgdev *cfgdev);
1280 extern bool wl_cfg80211_is_concurrent_mode(void);
1281 extern void* wl_cfg80211_get_dhdp(void);
1282 extern bool wl_cfg80211_is_p2p_active(void);
1283 extern bool wl_cfg80211_is_roam_offload(void);
1284 extern bool wl_cfg80211_is_event_from_connected_bssid(const wl_event_msg_t *e, int ifidx);
1285 extern void wl_cfg80211_dbg_level(u32 level);
1286 extern s32 wl_cfg80211_get_p2p_dev_addr(struct net_device *net, struct ether_addr *p2pdev_addr);
1287 extern s32 wl_cfg80211_set_p2p_noa(struct net_device *net, char* buf, int len);
1288 extern s32 wl_cfg80211_get_p2p_noa(struct net_device *net, char* buf, int len);
1289 extern s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len,
1290 enum wl_management_type type);
1291 extern s32 wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len);
1292 extern s32 wl_cfg80211_set_p2p_ecsa(struct net_device *net, char* buf, int len);
1294 extern s32 wl_cfg80211_set_ulb_mode(struct net_device *dev, int mode);
1295 extern s32 wl_cfg80211_set_ulb_bw(struct net_device *dev,
1296 u32 ulb_bw, char *ifname);
1297 #endif /* WL11ULB */
1298 #ifdef P2PLISTEN_AP_SAMECHN
1299 extern s32 wl_cfg80211_set_p2p_resp_ap_chn(struct net_device *net, s32 enable);
1300 #endif /* P2PLISTEN_AP_SAMECHN */
1302 /* btcoex functions */
1303 void* wl_cfg80211_btcoex_init(struct net_device *ndev);
1304 void wl_cfg80211_btcoex_deinit(void);
1306 #ifdef WL_SUPPORT_AUTO_CHANNEL
1307 #define CHANSPEC_BUF_SIZE 1024
1308 #define CHAN_SEL_IOCTL_DELAY 300
1309 #define CHAN_SEL_RETRY_COUNT 15
1310 #define CHANNEL_IS_RADAR(channel) (((channel & WL_CHAN_RADAR) || \
1311 (channel & WL_CHAN_PASSIVE)) ? true : false)
1312 #define CHANNEL_IS_2G(channel) (((channel >= 1) && (channel <= 14)) ? \
1314 #define CHANNEL_IS_5G(channel) (((channel >= 36) && (channel <= 165)) ? \
1316 extern s32 wl_cfg80211_get_best_channels(struct net_device *dev, char* command,
1318 #endif /* WL_SUPPORT_AUTO_CHANNEL */
1319 extern int wl_cfg80211_ether_atoe(const char *a, struct ether_addr *n);
1320 extern int wl_cfg80211_hang(struct net_device *dev, u16 reason);
1321 extern s32 wl_mode_to_nl80211_iftype(s32 mode);
1322 int wl_cfg80211_do_driver_init(struct net_device *net);
1323 void wl_cfg80211_enable_trace(u32 level);
1324 extern s32 wl_update_wiphybands(struct bcm_cfg80211 *cfg, bool notify);
1325 extern s32 wl_cfg80211_if_is_group_owner(void);
1326 extern chanspec_t wl_chspec_host_to_driver(chanspec_t chanspec);
1327 extern chanspec_t wl_ch_host_to_driver(s32 bssidx, u16 channel);
1328 extern s32 wl_set_tx_power(struct net_device *dev,
1329 enum nl80211_tx_power_setting type, s32 dbm);
1330 extern s32 wl_get_tx_power(struct net_device *dev, s32 *dbm);
1331 extern s32 wl_add_remove_eventmsg(struct net_device *ndev, u16 event, bool add);
1332 extern void wl_stop_wait_next_action_frame(struct bcm_cfg80211 *cfg, struct net_device *ndev);
1333 extern void wl_cfg80211_add_to_eventbuffer(wl_eventmsg_buf_t *ev, u16 event, bool set);
1334 extern s32 wl_cfg80211_apply_eventbuffer(struct net_device *ndev,
1335 struct bcm_cfg80211 *cfg, wl_eventmsg_buf_t *ev);
1336 extern void get_primary_mac(struct bcm_cfg80211 *cfg, struct ether_addr *mac);
1337 extern void wl_cfg80211_update_power_mode(struct net_device *dev);
1338 extern void wl_cfg80211_set_passive_scan(struct net_device *dev, char *command);
1339 extern void wl_terminate_event_handler(void);
1340 #if defined(DHD_ENABLE_BIGDATA_LOGGING)
1341 extern s32 wl_cfg80211_get_bss_info(struct net_device *dev, char* cmd, int total_len);
1342 extern s32 wl_cfg80211_get_connect_failed_status(struct net_device *dev, char* cmd, int total_len);
1343 #endif /* DHD_ENABLE_BIGDATA_LOGGING */
1345 #define SCAN_BUF_CNT 2
1346 #define SCAN_BUF_NEXT 1
1347 #define WL_SCANTYPE_LEGACY 0x1
1348 #define WL_SCANTYPE_P2P 0x2
1349 #define wl_escan_set_sync_id(a, b) ((a) = htod16(0x1234))
1350 #define wl_escan_set_type(a, b)
1351 #define wl_escan_get_buf(a, b) ((wl_scan_results_t *) (a)->escan_info.escan_buf)
1352 #define wl_escan_check_sync_id(a, b, c) 0
1353 #define wl_escan_print_sync_id(a, b, c)
1354 #define wl_escan_increment_sync_id(a, b)
1355 #define wl_escan_init_sync_id(a)
1356 extern void wl_cfg80211_ibss_vsie_set_buffer(vndr_ie_setbuf_t *ibss_vsie, int ibss_vsie_len);
1357 extern s32 wl_cfg80211_ibss_vsie_delete(struct net_device *dev);
1358 extern void wl_cfg80211_set_rmc_pid(int pid);
1359 extern int wl_cfg80211_set_mgmt_vndr_ies(struct bcm_cfg80211 *cfg,
1360 bcm_struct_cfgdev *cfgdev, s32 bssidx, s32 pktflag,
1361 const u8 *vndr_ie, u32 vndr_ie_len);
1364 /* Action frame specific functions */
1365 extern u8 wl_get_action_category(void *frame, u32 frame_len);
1366 extern int wl_get_public_action(void *frame, u32 frame_len, u8 *ret_action);
1368 #ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
1369 struct net_device *wl_cfg80211_get_remain_on_channel_ndev(struct bcm_cfg80211 *cfg);
1370 #endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
1372 #ifdef WL_SUPPORT_ACS
1373 #define ACS_MSRMNT_DELAY 1000 /* dump_obss delay in ms */
1374 #define IOCTL_RETRY_COUNT 5
1375 #define CHAN_NOISE_DUMMY -80
1376 #define OBSS_TOKEN_IDX 15
1377 #define IBSS_TOKEN_IDX 15
1378 #define TX_TOKEN_IDX 14
1379 #define CTG_TOKEN_IDX 13
1380 #define PKT_TOKEN_IDX 15
1381 #define IDLE_TOKEN_IDX 12
1382 #endif /* WL_SUPPORT_ACS */
1384 extern int wl_cfg80211_get_ioctl_version(void);
1385 extern int wl_cfg80211_enable_roam_offload(struct net_device *dev, int enable);
1386 extern s32 wl_cfg80211_dfs_ap_move(struct net_device *ndev, char *data,
1387 char *command, int total_len);
1388 extern s32 wl_cfg80211_wbtext_config(struct net_device *ndev, char *data,
1389 char *command, int total_len);
1390 extern int wl_cfg80211_wbtext_weight_config(struct net_device *ndev, char *data,
1391 char *command, int total_len);
1392 extern int wl_cfg80211_wbtext_table_config(struct net_device *ndev, char *data,
1393 char *command, int total_len);
1394 extern s32 wl_cfg80211_wbtext_delta_config(struct net_device *ndev, char *data,
1395 char *command, int total_len);
1396 extern s32 wl_cfg80211_get_chanspecs_2g(struct net_device *ndev,
1397 void *buf, s32 buflen);
1398 extern s32 wl_cfg80211_get_chanspecs_5g(struct net_device *ndev,
1399 void *buf, s32 buflen);
1400 #if defined(WL_VIRTUAL_APSTA)
1401 extern int wl_cfg80211_interface_create(struct net_device *dev, char *name);
1402 extern int wl_cfg80211_interface_delete(struct net_device *dev, char *name);
1403 #endif /* defined (WL_VIRTUAL_APSTA) */
1406 extern int wl_cfg80211_nan_cmd_handler(struct net_device *ndev, char *cmd,
1410 #ifdef WL_CFG80211_P2P_DEV_IF
1411 extern void wl_cfg80211_del_p2p_wdev(void);
1412 #endif /* WL_CFG80211_P2P_DEV_IF */
1414 #if defined(WL_SUPPORT_AUTO_CHANNEL)
1415 extern int wl_cfg80211_set_spect(struct net_device *dev, int spect);
1416 extern int wl_cfg80211_get_sta_channel(void);
1417 #endif /* WL_SUPPORT_AUTO_CHANNEL */
1419 #ifdef P2P_LISTEN_OFFLOADING
1420 extern s32 wl_cfg80211_p2plo_listen_start(struct net_device *dev, u8 *buf, int len);
1421 extern s32 wl_cfg80211_p2plo_listen_stop(struct net_device *dev);
1422 #endif /* P2P_LISTEN_OFFLOADING */
1424 #define RETURN_EIO_IF_NOT_UP(wlpriv) \
1426 struct net_device *checkSysUpNDev = bcmcfg_to_prmry_ndev(wlpriv); \
1427 if (unlikely(!wl_get_drv_status(wlpriv, READY, checkSysUpNDev))) { \
1428 WL_INFORM(("device is not ready\n")); \
1434 extern uint8 *wl_get_up_table(void);
1435 #endif /* QOS_MAP_SET */
1437 #define P2PO_COOKIE 65535
1438 u64 wl_cfg80211_get_new_roc_id(struct bcm_cfg80211 *cfg);
1439 #if defined(SUPPORT_RANDOM_MAC_SCAN)
1440 int wl_cfg80211_set_random_mac(struct net_device *dev, bool enable);
1441 int wl_cfg80211_random_mac_enable(struct net_device *dev);
1442 int wl_cfg80211_random_mac_disable(struct net_device *dev);
1443 #endif /* SUPPORT_RANDOM_MAC_SCAN */
1444 int wl_cfg80211_iface_count(void);
1445 int wl_check_dongle_idle(struct wiphy *wiphy);
1446 #endif /* _wl_cfg80211_h_ */