2 * Linux cfg80211 driver
4 * Copyright (C) 1999-2019, Broadcom.
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 796900 2018-12-27 09:37:28Z $
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>
41 #include <linux/wireless.h>
42 #include <net/cfg80211.h>
43 #include <linux/rfkill.h>
46 #include <wl_cfgp2p.h>
48 #include <wl_cfgnan.h>
51 #include <wl_bigdata.h>
67 #define htodchanspec(i) (i)
68 #define dtohchanspec(i) (i)
71 #define WL_DBG_P2P_ACTION (1 << 5)
72 #define WL_DBG_TRACE (1 << 4)
73 #define WL_DBG_SCAN (1 << 3)
74 #define WL_DBG_DBG (1 << 2)
75 #define WL_DBG_INFO (1 << 1)
76 #define WL_DBG_ERR (1 << 0)
78 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
79 /* Newer kernels use defines from nl80211.h */
80 #define NL80211_BAND_2GHZ NL80211_BAND_2GHZ
81 #define NL80211_BAND_5GHZ NL80211_BAND_5GHZ
82 #define IEEE80211_NUM_BANDS NUM_NL80211_BANDS
83 #endif /* LINUX_VER >= 4.7 */
86 extern void dhd_log_dump_write(int type
, char *binary_data
,
87 int binary_len
, const char *fmt
, ...);
88 extern char *dhd_log_dump_get_timestamp(void);
89 #ifndef _DHD_LOG_DUMP_DEFINITIONS_
90 #define DLD_BUF_TYPE_GENERAL 0
91 #define DLD_BUF_TYPE_SPECIAL 1
92 #define DHD_LOG_DUMP_WRITE(fmt, ...) \
93 dhd_log_dump_write(DLD_BUF_TYPE_GENERAL, NULL, 0, fmt, ##__VA_ARGS__)
94 #define DHD_LOG_DUMP_WRITE_EX(fmt, ...) \
95 dhd_log_dump_write(DLD_BUF_TYPE_SPECIAL, NULL, 0, fmt, ##__VA_ARGS__)
96 #endif /* !_DHD_LOG_DUMP_DEFINITIONS_ */
97 #endif /* DHD_LOG_DUMP */
99 /* 0 invalidates all debug messages. default is 1 */
100 #define WL_DBG_LEVEL 0xFF
102 #define CFG80211_INFO_TEXT "CFG80211-INFO) "
103 #ifdef CUSTOMER_HW4_DEBUG
104 #define CFG80211_ERROR_TEXT "CFG80211-INFO2) "
106 #define CFG80211_ERROR_TEXT "CFG80211-ERROR) "
107 #endif /* CUSTOMER_HW4_DEBUG */
109 #if defined(DHD_DEBUG)
111 #define WL_ERR(args) \
113 if (wl_dbg_level & WL_DBG_ERR) { \
114 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
116 DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
117 DHD_LOG_DUMP_WRITE args; \
120 #define WL_ERR_KERN(args) \
122 if (wl_dbg_level & WL_DBG_ERR) { \
123 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
127 #define WL_ERR_MEM(args) \
129 if (wl_dbg_level & WL_DBG_ERR) { \
130 DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
131 DHD_LOG_DUMP_WRITE args; \
134 #define WL_INFORM_MEM(args) \
136 if (wl_dbg_level & WL_DBG_INFO) { \
137 printk(KERN_INFO CFG80211_INFO_TEXT "%s : ", __func__); \
139 DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
140 DHD_LOG_DUMP_WRITE args; \
143 #define WL_ERR_EX(args) \
145 if (wl_dbg_level & WL_DBG_ERR) { \
146 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
148 DHD_LOG_DUMP_WRITE_EX("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
149 DHD_LOG_DUMP_WRITE_EX args; \
152 #define WL_MEM(args) \
154 DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
155 DHD_LOG_DUMP_WRITE args; \
158 #define WL_ERR(args) \
160 if (wl_dbg_level & WL_DBG_ERR) { \
161 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
165 #define WL_ERR_KERN(args) WL_ERR(args)
166 #define WL_ERR_MEM(args) WL_ERR(args)
167 #define WL_INFORM_MEM(args) WL_INFORM(args)
168 #define WL_ERR_EX(args) WL_ERR(args)
169 #define WL_MEM(args) WL_DBG(args)
170 #endif /* DHD_LOG_DUMP */
171 #else /* defined(DHD_DEBUG) */
172 #define WL_ERR(args) \
174 if ((wl_dbg_level & WL_DBG_ERR) && net_ratelimit()) { \
175 printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
179 #define WL_ERR_KERN(args) WL_ERR(args)
180 #define WL_ERR_MEM(args) WL_ERR(args)
181 #define WL_INFORM_MEM(args) WL_INFORM(args)
182 #define WL_ERR_EX(args) WL_ERR(args)
183 #define WL_MEM(args) WL_DBG(args)
184 #endif /* defined(DHD_DEBUG) */
186 #define WL_PRINT_RATE_LIMIT_PERIOD 4000000000u /* 4s in units of ns */
187 #define WL_ERR_RLMT(args) \
189 if (wl_dbg_level & WL_DBG_ERR) { \
190 static uint64 __err_ts = 0; \
191 static uint32 __err_cnt = 0; \
192 uint64 __cur_ts = 0; \
193 __cur_ts = local_clock(); \
194 if (__err_ts == 0 || (__cur_ts > __err_ts && \
195 (__cur_ts - __err_ts > WL_PRINT_RATE_LIMIT_PERIOD))) { \
196 __err_ts = __cur_ts; \
198 WL_ERR(("[Repeats %u times]\n", __err_cnt)); \
210 #define WL_INFORM(args) \
212 if (wl_dbg_level & WL_DBG_INFO) { \
213 printk(KERN_INFO "CFG80211-INFO) %s : ", __func__); \
221 #define WL_SCAN(args) \
223 if (wl_dbg_level & WL_DBG_SCAN) { \
224 printk(KERN_INFO "CFG80211-SCAN) %s :", __func__); \
231 #define WL_TRACE(args) \
233 if (wl_dbg_level & WL_DBG_TRACE) { \
234 printk(KERN_INFO "CFG80211-TRACE) %s :", __func__); \
241 #ifdef CUSTOMER_HW4_DEBUG
242 #define WL_TRACE_HW4(args) \
244 if (wl_dbg_level & WL_DBG_ERR) { \
245 printk(KERN_INFO "CFG80211-TRACE) %s : ", __func__); \
250 #define WL_TRACE_HW4 WL_TRACE
251 #endif /* CUSTOMER_HW4_DEBUG */
252 #if (WL_DBG_LEVEL > 0)
253 #define WL_DBG(args) \
255 if (wl_dbg_level & WL_DBG_DBG) { \
256 printk(KERN_INFO "CFG80211-DEBUG) %s :", __func__); \
260 #else /* !(WL_DBG_LEVEL > 0) */
262 #endif /* (WL_DBG_LEVEL > 0) */
266 #define WL_SCAN_RETRY_MAX 3
267 #define WL_NUM_PMKIDS_MAX MAXPMKID
268 #define WL_SCAN_BUF_MAX (1024 * 8)
269 #define WL_TLV_INFO_MAX 1500
270 #define WL_SCAN_IE_LEN_MAX 2048
271 #define WL_BSS_INFO_MAX 2048
272 #define WL_ASSOC_INFO_MAX 512
273 #define WL_IOCTL_LEN_MAX 2048
274 #define WL_EXTRA_BUF_MAX 2048
275 #define WL_SCAN_ERSULTS_LAST (WL_SCAN_RESULTS_NO_MEM+1)
276 #define WL_AP_MAX 256
277 #define WL_FILE_NAME_MAX 256
278 #define WL_DWELL_TIME 200
279 #define WL_MED_DWELL_TIME 400
280 #define WL_MIN_DWELL_TIME 100
281 #define WL_LONG_DWELL_TIME 1000
282 #define IFACE_MAX_CNT 4
283 #define WL_SCAN_CONNECT_DWELL_TIME_MS 200
284 #define WL_SCAN_JOIN_PROBE_INTERVAL_MS 20
285 #define WL_SCAN_JOIN_ACTIVE_DWELL_TIME_MS 320
286 #define WL_SCAN_JOIN_PASSIVE_DWELL_TIME_MS 400
287 #define WL_AF_TX_MAX_RETRY 5
289 #define WL_AF_SEARCH_TIME_MAX 450
290 #define WL_AF_TX_EXTRA_TIME_MAX 200
292 #define WL_SCAN_TIMER_INTERVAL_MS 10000 /* Scan timeout */
294 #define WL_SCAN_TIMER_INTERVAL_MS_NAN 15000 /* Scan timeout */
296 #define WL_CHANNEL_SYNC_RETRY 5
297 #define WL_INVALID -1
299 #ifdef DHD_LOSSLESS_ROAMING
300 #define WL_ROAM_TIMEOUT_MS 1000 /* Roam timeout */
302 /* Bring down SCB Timeout to 20secs from 60secs default */
303 #ifndef WL_SCB_TIMEOUT
304 #define WL_SCB_TIMEOUT 20
307 #if defined(ROAM_ENABLE) || defined(ROAM_CHANNEL_CACHE)
308 #define ESCAN_CHANNEL_CACHE
311 #ifndef WL_SCB_ACTIVITY_TIME
312 #define WL_SCB_ACTIVITY_TIME 5
315 #ifndef WL_SCB_MAX_PROBE
316 #define WL_SCB_MAX_PROBE 3
319 #ifndef WL_PSPRETEND_RETRY_LIMIT
320 #define WL_PSPRETEND_RETRY_LIMIT 1
323 #ifndef WL_MIN_PSPRETEND_THRESHOLD
324 #define WL_MIN_PSPRETEND_THRESHOLD 2
328 #ifndef WLAN_CIPHER_SUITE_PMK
329 #define WLAN_CIPHER_SUITE_PMK 0x00904C00
330 #endif /* WLAN_CIPHER_SUITE_PMK */
332 #ifndef WLAN_AKM_SUITE_FT_8021X
333 #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03
334 #endif /* WLAN_AKM_SUITE_FT_8021X */
336 #ifndef WLAN_AKM_SUITE_FT_PSK
337 #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04
338 #endif /* WLAN_AKM_SUITE_FT_PSK */
340 #ifndef WLAN_AKM_SUITE_FILS_SHA256
341 #define WLAN_AKM_SUITE_FILS_SHA256 0x000FAC0E
342 #define WLAN_AKM_SUITE_FILS_SHA384 0x000FAC0F
343 #define WLAN_AKM_SUITE_FT_FILS_SHA256 0x000FAC10
344 #define WLAN_AKM_SUITE_FT_FILS_SHA384 0x000FAC11
345 #endif /* WLAN_AKM_SUITE_FILS_SHA256 */
349 * Use a high number that's unlikely to clash with linux upstream for a while until we can
350 * submit these changes to the community.
352 #define NL80211_FEATURE_FW_4WAY_HANDSHAKE (1<<31)
354 /* SCAN_SUPPRESS timer values in ms */
355 #define WL_SCAN_SUPPRESS_TIMEOUT 31000 /* default Framwork DHCP timeout is 30 sec */
356 #define WL_SCAN_SUPPRESS_RETRY 3000
358 #define WL_PM_ENABLE_TIMEOUT 10000
360 /* cfg80211 wowlan definitions */
361 #define WL_WOWLAN_MAX_PATTERNS 8
362 #define WL_WOWLAN_MIN_PATTERN_LEN 1
363 #define WL_WOWLAN_MAX_PATTERN_LEN 255
364 #define WL_WOWLAN_PKT_FILTER_ID_FIRST 201
365 #define WL_WOWLAN_PKT_FILTER_ID_LAST (WL_WOWLAN_PKT_FILTER_ID_FIRST + \
366 WL_WOWLAN_MAX_PATTERNS - 1)
368 #define IBSS_COALESCE_DEFAULT 0
369 #define IBSS_INITIAL_SCAN_ALLOWED_DEFAULT 0
371 #define IBSS_COALESCE_DEFAULT 1
372 #define IBSS_INITIAL_SCAN_ALLOWED_DEFAULT 1
376 #define TDLS_TUNNELED_PRB_REQ "\x7f\x50\x6f\x9a\04"
377 #define TDLS_TUNNELED_PRB_RESP "\x7f\x50\x6f\x9a\05"
378 #define TDLS_MAX_IFACE_FOR_ENABLE 1
382 /* Custom AIBSS beacon parameters */
383 #define AIBSS_INITIAL_MIN_BCN_DUR 500
384 #define AIBSS_MIN_BCN_DUR 5000
385 #define AIBSS_BCN_FLOOD_DUR 5000
386 #define AIBSS_PEER_FREE 3
389 #ifndef FILS_INDICATION_IE_TAG_FIXED_LEN
390 #define FILS_INDICATION_IE_TAG_FIXED_LEN 2
397 WL_STATUS_SCAN_ABORTING
,
398 WL_STATUS_CONNECTING
,
400 WL_STATUS_DISCONNECTING
,
401 WL_STATUS_AP_CREATING
,
402 WL_STATUS_AP_CREATED
,
403 /* whole sending action frame procedure:
404 * includes a) 'finding common channel' for public action request frame
405 * and b) 'sending af via 'actframe' iovar'
407 WL_STATUS_SENDING_ACT_FRM
,
408 /* find a peer to go to a common channel before sending public action req frame */
409 WL_STATUS_FINDING_COMMON_CHANNEL
,
410 /* waiting for next af to sync time of supplicant.
411 * it includes SENDING_ACT_FRM and WAITING_NEXT_ACT_FRM_LISTEN
413 WL_STATUS_WAITING_NEXT_ACT_FRM
,
414 #ifdef WL_CFG80211_SYNC_GON
415 /* go to listen state to wait for next af after SENDING_ACT_FRM */
416 WL_STATUS_WAITING_NEXT_ACT_FRM_LISTEN
,
417 #endif /* WL_CFG80211_SYNC_GON */
418 /* it will be set when upper layer requests listen and succeed in setting listen mode.
419 * if set, other scan request can abort current listen state
421 WL_STATUS_REMAINING_ON_CHANNEL
,
422 #ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
423 /* it's fake listen state to keep current scan state.
424 * it will be set when upper layer requests listen but scan is running. then just run
425 * a expire timer without actual listen state.
426 * if set, other scan request does not need to abort scan.
428 WL_STATUS_FAKE_REMAINING_ON_CHANNEL
,
429 #endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
430 WL_STATUS_NESTED_CONNECT
,
431 WL_STATUS_CFG80211_CONNECT
434 typedef enum wl_iftype
{
438 WL_IF_TYPE_NAN_NMI
= 3,
440 WL_IF_TYPE_P2P_GO
= 5,
441 WL_IF_TYPE_P2P_GC
= 6,
442 WL_IF_TYPE_P2P_DISC
= 7,
444 WL_IF_TYPE_MONITOR
= 9,
445 WL_IF_TYPE_AIBSS
= 10,
449 typedef enum wl_interface_state
{
456 WL_IF_STATE_MAX
, /* Retain as last one */
457 } wl_interface_state_t
;
468 /* driver profile list */
482 /* donlge escan state */
483 enum wl_escan_state
{
485 WL_ESCAN_STATE_SCANING
487 /* fw downloading status */
490 WL_NVRAM_LOADING_DONE
493 enum wl_management_type
{
499 enum wl_pm_workq_act_type
{
505 enum wl_tdls_config
{
506 TDLS_STATE_AP_CREATE
,
507 TDLS_STATE_AP_DELETE
,
509 TDLS_STATE_DISCONNECT
,
512 TDLS_STATE_IF_CREATE
,
513 TDLS_STATE_IF_DELETE
,
514 TDLS_STATE_NDI_CREATE
517 /* beacon / probe_response */
518 struct beacon_proberesp
{
523 } __attribute__ ((packed
));
525 /* driver configuration */
532 struct ieee80211_channel channel
;
535 typedef s32(*EVENT_HANDLER
) (struct bcm_cfg80211
*cfg
, bcm_struct_cfgdev
*cfgdev
,
536 const wl_event_msg_t
*e
, void *data
);
538 /* bss inform structure for cfg80211 interface */
539 struct wl_cfg80211_bss_info
{
547 /* basic structure of scan request */
549 struct wlc_ssid ssid
;
552 /* basic structure of information element */
555 u8 buf
[WL_TLV_INFO_MAX
];
558 /* event queue for cfg80211 main event */
560 struct list_head eq_list
;
567 /* security information with currently associated ap */
574 u32 auth_assoc_res_status
;
577 /* ibss information for currently joined ibss network */
579 u8 beacon_interval
; /* in millisecond */
580 u8 atim
; /* in millisecond */
586 typedef struct wl_bss_vndr_ies
{
587 u8 probe_req_ie
[VNDR_IES_BUF_LEN
];
588 u8 probe_res_ie
[VNDR_IES_MAX_BUF_LEN
];
589 u8 assoc_req_ie
[VNDR_IES_BUF_LEN
];
590 u8 assoc_res_ie
[VNDR_IES_BUF_LEN
];
591 u8 beacon_ie
[VNDR_IES_MAX_BUF_LEN
];
592 u32 probe_req_ie_len
;
593 u32 probe_res_ie_len
;
594 u32 assoc_req_ie_len
;
595 u32 assoc_res_ie_len
;
599 typedef struct wl_cfgbss
{
605 struct wl_bss_vndr_ies ies
; /* Common for STA, P2P GC, GO, AP, P2P Disc Interface */
608 /* cfg driver profile */
613 struct wlc_ssid ssid
;
614 struct wl_security sec
;
616 u8 bssid
[ETHER_ADDR_LEN
];
623 uint8 id
; /* IE ID: 0xDD */
624 uint8 len
; /* IE length */
625 uint8 OUI
[3]; /* WiFi WPS specific OUI */
626 uint8 oui_type
; /* Vendor specific OUI Type */
627 uint8 attrib
[1]; /* variable length attributes */
628 } __attribute__ ((packed
));
629 typedef struct wl_wps_ie wl_wps_ie_t
;
635 } __attribute__ ((packed
));
636 typedef struct wl_eap_msg wl_eap_msg_t
;
644 } __attribute__ ((packed
));
645 typedef struct wl_eap_exp wl_eap_exp_t
;
648 struct net_device
*ndev
;
649 struct wireless_dev
*wdev
;
650 struct wl_profile profile
;
653 unsigned long sme_state
;
660 struct list_head list
; /* list of all net_info structure */
663 /* association inform */
664 #define MAX_REQ_LINE 1024u
665 struct wl_connect_info
{
666 u8 req_ie
[MAX_REQ_LINE
];
668 u8 resp_ie
[MAX_REQ_LINE
];
672 /* firmware /nvram downloading controller */
674 const struct firmware
*fw_entry
;
675 unsigned long status
;
677 s8 fw_name
[WL_FILE_NAME_MAX
];
678 s8 nvram_name
[WL_FILE_NAME_MAX
];
681 /* assoc ie length */
682 struct wl_assoc_ielen
{
690 pmkid_t foo
[MAXPMKID
- 1];
694 #define WL_MAX_IFS DHD_MAX_IFS
696 #define WL_MAX_IFS 16
699 #define ESCAN_BUF_SIZE (64 * 1024)
703 #ifdef STATIC_WL_PRIV_STRUCT
704 #ifndef CONFIG_DHD_USE_STATIC_BUF
705 #error STATIC_WL_PRIV_STRUCT should be used with CONFIG_DHD_USE_STATIC_BUF
706 #endif /* CONFIG_DHD_USE_STATIC_BUF */
707 #ifdef DUAL_ESCAN_RESULT_BUFFER
711 #endif /* DUAL_ESCAN_RESULT_BUFFER */
713 #ifdef DUAL_ESCAN_RESULT_BUFFER
714 u8 escan_buf
[2][ESCAN_BUF_SIZE
];
716 u8 escan_buf
[ESCAN_BUF_SIZE
];
717 #endif /* DUAL_ESCAN_RESULT_BUFFER */
718 #endif /* STATIC_WL_PRIV_STRUCT */
719 #ifdef DUAL_ESCAN_RESULT_BUFFER
722 #endif /* DUAL_ESCAN_RESULT_BUFFER */
724 struct net_device
*ndev
;
727 #ifdef ESCAN_BUF_OVERFLOW_MGMT
728 #define BUF_OVERFLOW_MGMT_COUNT 3
732 struct ether_addr BSSID
;
734 #endif /* ESCAN_BUF_OVERFLOW_MGMT */
737 wl_af_params_t
*pending_tx_act_frm
;
738 struct ether_addr tx_dst_addr
;
739 struct net_device
*dev
;
740 struct work_struct work
;
744 s32 peer_listen_chan
; /* search channel: configured by upper layer */
745 s32 my_listen_chan
; /* listen chanel: extract it from prb req or gon req */
752 const wpa_ie_fixed_t
*wps_ie
;
754 const wpa_ie_fixed_t
*wpa_ie
;
756 const bcm_tlv_t
*wpa2_ie
;
758 const bcm_tlv_t
*fils_ind_ie
;
762 #ifdef P2P_LISTEN_OFFLOADING
764 uint16 period
; /* listen offload period */
765 uint16 interval
; /* listen offload interval */
766 uint16 count
; /* listen offload count */
767 uint16 pad
; /* pad for 32bit align */
769 #endif /* P2P_LISTEN_OFFLOADING */
772 /* Max length of Interworking element */
773 #define IW_IES_MAX_BUF_LEN 9
776 #define FBT_KEYLEN 32
778 #define MAX_EVENT_BUF_NUM 16
779 typedef struct wl_eventmsg_buf
{
784 } event
[MAX_EVENT_BUF_NUM
];
787 typedef struct wl_if_event_info
{
791 uint8 mac
[ETHER_ADDR_LEN
];
792 char name
[IFNAMSIZ
+1];
796 #ifdef SUPPORT_AP_RADIO_PWRSAVE
797 typedef struct ap_rps_info
{
804 #endif /* SUPPORT_AP_RADIO_PWRSAVE */
806 #ifdef SUPPORT_RSSI_SUM_REPORT
807 #define RSSILOG_FLAG_FEATURE_SW 0x1
808 #define RSSILOG_FLAG_REPORT_READY 0x2
809 typedef struct rssilog_set_param
{
811 uint8 rssi_threshold
;
812 uint8 time_threshold
;
814 } rssilog_set_param_t
;
816 typedef struct rssilog_get_param
{
819 uint8 rssi_threshold
;
820 uint8 time_threshold
;
821 } rssilog_get_param_t
;
823 typedef struct rssi_ant_param
{
824 struct ether_addr ea
;
828 typedef struct wl_rssi_ant_mimo
{
831 int8 rssi_ant
[WL_RSSI_ANT_MAX
];
834 } wl_rssi_ant_mimo_t
;
835 #endif /* SUPPORT_RSSI_SUM_REPORT */
837 #if defined(DHD_ENABLE_BIGDATA_LOGGING)
838 #define GET_BSS_INFO_LEN 90
839 #endif /* DHD_ENABLE_BIGDATA_LOGGING */
842 #ifdef CUSTOMER_SCAN_TIMEOUT_SETTING
843 #define CUSTOMER_WL_SCAN_TIMER_INTERVAL_MS 25000 /* Scan timeout */
844 enum wl_custom_scan_time_type
{
845 WL_CUSTOM_SCAN_CHANNEL_TIME
= 0,
846 WL_CUSTOM_SCAN_UNASSOC_TIME
,
847 WL_CUSTOM_SCAN_PASSIVE_TIME
,
848 WL_CUSTOM_SCAN_HOME_TIME
,
849 WL_CUSTOM_SCAN_HOME_AWAY_TIME
851 extern s32
wl_cfg80211_custom_scan_time(struct net_device
*dev
,
852 enum wl_custom_scan_time_type type
, int time
);
853 #endif /* CUSTOMER_SCAN_TIMEOUT_SETTING */
854 #endif /* WES_SUPPORT */
857 #define NAN_MAX_NDI 2
858 typedef struct wl_ndi_data
864 typedef struct wl_nancfg
866 wl_ndi_data_t ndi
[NAN_MAX_NDI
];
867 struct mutex nan_sync
;
868 uint8 svc_inst_id_mask
[NAN_SVC_INST_SIZE
];
870 /* wait queue and condition variable for nan event */
871 bool nan_event_recvd
;
872 wait_queue_head_t nan_event_wait
;
873 nan_stop_reason_code_t disable_reason
;
880 #define EAP_EXPANDED_TYPE 254
881 #define EAP_EXP_OPCODE_OFFSET 7
882 #define EAP_EXP_FRAGMENT_LEN_OFFSET 2
883 #define EAP_EXP_FLAGS_FRAGMENTED_DATA 2
884 #define EAP_EXP_FLAGS_MORE_DATA 1
885 #define EAPOL_EAP_HDR_LEN 5
886 #define EAP_EXP_HDR_MIN_LENGTH (EAPOL_EAP_HDR_LEN + EAP_EXP_OPCODE_OFFSET)
887 #define EAP_ATTRIB_MSGTYPE 0x1022
888 #define EAP_WSC_UPNP 0
889 #define EAP_WSC_START 1
890 #define EAP_WSC_ACK 2
891 #define EAP_WSC_NACK 3
892 #define EAP_WSC_MSG 4
893 #define EAP_WSC_DONE 5
894 #define EAP_WSC_MSG_M8 12
895 #define EAP_CODE_FAILURE 4
896 #define WL_WPS_REAUTH_TIMEOUT 10000
898 struct wl_eap_header
{
899 unsigned char code
; /* EAP code */
900 unsigned char id
; /* Current request ID */
901 unsigned short length
; /* Length including header */
902 unsigned char type
; /* EAP type (optional) */
903 unsigned char data
[1]; /* Type data (optional) */
904 } __attribute__ ((packed
));
905 typedef struct wl_eap_header wl_eap_header_t
;
907 typedef enum wl_wps_state
{
912 WPS_STATE_REAUTH_WAIT
,
915 WPS_STATE_DISCONNECT
,
916 WPS_STATE_DISCONNECT_CLIENT
,
917 WPS_STATE_CONNECT_FAIL
,
923 #define WPS_MAX_SESSIONS 2
924 typedef struct wl_wps_session
{
926 struct timer_list timer
;
927 struct net_device
*ndev
;
928 wl_wps_state_t state
;
930 u8 peer_mac
[ETHER_ADDR_LEN
];
932 #endif /* WL_WPS_SYNC */
934 #ifndef WL_STATIC_IFNAME_PREFIX
935 #define WL_STATIC_IFNAME_PREFIX "wlan%d"
936 #endif /* WL_STATIC_IFNAME */
938 /* private data of cfg80211 interface */
939 struct bcm_cfg80211
{
940 struct wireless_dev
*wdev
; /* representing cfg cfg80211 device */
942 struct wireless_dev
*p2p_wdev
; /* representing cfg cfg80211 device for P2P */
943 struct net_device
*p2p_net
; /* reference to p2p0 interface */
945 struct wl_conf
*conf
;
946 struct cfg80211_scan_request
*scan_request
; /* scan request object */
947 EVENT_HANDLER evt_handler
[WLC_E_LAST
];
948 struct list_head eq_list
; /* used for event queue */
949 struct list_head net_list
; /* used for struct net_info */
950 spinlock_t net_list_sync
; /* to protect scan status (and others if needed) */
951 spinlock_t eq_lock
; /* for event queue synchronization */
952 spinlock_t cfgdrv_lock
; /* to protect scan status (and others if needed) */
953 struct completion act_frm_scan
;
954 struct completion iface_disable
;
955 struct completion wait_next_af
;
956 struct mutex usr_sync
; /* maily for up/down synchronization */
957 struct mutex if_sync
; /* maily for iface op synchronization */
958 struct mutex scan_complete
; /* serialize scan_complete call */
959 struct wl_scan_results
*bss_list
;
960 struct wl_scan_results
*scan_results
;
962 /* scan request object for internal purpose */
963 struct wl_scan_req
*scan_req_int
;
964 /* information element object for internal purpose */
965 #if defined(STATIC_WL_PRIV_STRUCT)
971 /* association information container */
972 #if defined(STATIC_WL_PRIV_STRUCT)
973 struct wl_connect_info
*conn_info
;
975 struct wl_connect_info conn_info
;
977 #ifdef DEBUGFS_CFG80211
978 struct dentry
*debugfs
;
979 #endif /* DEBUGFS_CFG80211 */
980 struct wl_pmk_list
*pmk_list
; /* wpa2 pmk list */
981 tsk_ctl_t event_tsk
; /* task of main event handler thread */
984 u32 channel
; /* current channel */
985 u32 af_sent_channel
; /* channel action frame is sent */
986 /* next af subtype to cancel the remained dwell time in rx process */
988 #ifdef WL_CFG80211_SYNC_GON
989 ulong af_tx_sent_jiffies
;
990 #endif /* WL_CFG80211_SYNC_GON */
991 struct escan_info escan_info
; /* escan information */
992 bool active_scan
; /* current scan mode */
993 bool ibss_starter
; /* indicates this sta is ibss starter */
994 bool link_up
; /* link/connection up flag */
996 /* indicate whether chip to support power save mode */
998 bool roam_on
; /* on/off switch for self-roaming */
999 bool scan_tried
; /* indicates if first scan attempted */
1000 #if defined(BCMSDIO) || defined(BCMPCIE)
1004 #define WL_ROAM_OFF_ON_CONCURRENT 0x0001
1005 #define WL_ROAM_REVERT_STATUS 0x0002
1007 u8
*ioctl_buf
; /* ioctl buffer */
1008 struct mutex ioctl_buf_sync
;
1009 u8
*escan_ioctl_buf
;
1010 u8
*extra_buf
; /* maily to grab assoc information */
1011 struct dentry
*debugfsdir
;
1012 struct rfkill
*rfkill
;
1014 struct ieee80211_channel remain_on_chan
;
1015 enum nl80211_channel_type remain_on_chan_type
;
1018 wait_queue_head_t netif_change_event
;
1019 wl_if_event_info if_event_info
;
1020 struct completion send_af_done
;
1021 struct afx_hdl
*afx_hdl
;
1022 struct p2p_info
*p2p
;
1025 struct timer_list scan_timeout
; /* Timer for catch scan event timeout */
1026 #ifdef WL_CFG80211_GON_COLLISION
1027 u8 block_gon_req_tx_count
;
1028 u8 block_gon_req_rx_count
;
1029 #endif /* WL_CFG80211_GON_COLLISION */
1030 #if defined(P2P_IE_MISSING_FIX)
1033 s32(*state_notifier
) (struct bcm_cfg80211
*cfg
,
1034 struct net_info
*_net_info
, enum wl_status state
, bool set
);
1035 unsigned long interrested_state
;
1036 wlc_ssid_t hostapd_ssid
;
1040 bool sched_scan_running
; /* scheduled scan req status */
1041 struct cfg80211_sched_scan_request
*sched_scan_req
; /* scheduled scan req */
1042 #ifdef WL_HOST_BAND_MGMT
1044 #endif /* WL_HOST_BAND_MGMT */
1045 bool scan_suppressed
;
1046 struct timer_list scan_supp_timer
;
1047 struct work_struct wlan_work
;
1048 struct mutex event_sync
; /* maily for up/down synchronization */
1049 bool disable_roam_event
;
1050 struct delayed_work pm_enable_work
;
1051 struct workqueue_struct
*event_workq
; /* workqueue for event */
1052 struct work_struct event_work
; /* work item for event */
1053 struct mutex pm_sync
; /* mainly for pm work synchronization */
1055 vndr_ie_setbuf_t
*ibss_vsie
; /* keep the VSIE for IBSS */
1058 u32 aibss_txfail_pid
;
1059 u32 aibss_txfail_seq
;
1060 #endif /* WLAIBSS */
1064 #endif /* WL_RELMCAST */
1065 #ifdef WLAIBSS_MCHAN
1066 struct ether_addr ibss_if_addr
;
1067 bcm_struct_cfgdev
*ibss_cfgdev
; /* For AIBSS */
1068 #endif /* WLAIBSS_MCHAN */
1069 bool bss_pending_op
; /* indicate where there is a pending IF operation */
1071 uint8 fbt_key
[FBT_KEYLEN
];
1076 nan_svc_inst_t nan_inst_ctrl
[NAN_ID_CTRL_SIZE
];
1077 struct ether_addr initiator_ndi
;
1079 bool nan_init_state
; /* nan initialization state */
1080 wait_queue_head_t ndp_if_change_event
;
1082 u8 nan_nmi_mac
[ETH_ALEN
];
1085 #ifdef WL_NAN_DISC_CACHE
1087 nan_disc_result_cache
*nan_disc_cache
;
1088 nan_svc_info_t svc_info
[NAN_MAX_SVC_INST
];
1089 nan_ranging_inst_t nan_ranging_info
[NAN_MAX_RANGING_INST
];
1090 #endif /* WL_NAN_DISC_CACHE */
1092 #ifdef WL_CFG80211_P2P_DEV_IF
1094 #endif /* WL_CFG80211_P2P_DEV_IF */
1095 #ifdef P2PLISTEN_AP_SAMECHN
1096 bool p2p_resp_apchn_status
;
1097 #endif /* P2PLISTEN_AP_SAMECHN */
1098 struct wl_wsec_key wep_key
;
1100 u8
*tdls_mgmt_frame
;
1101 u32 tdls_mgmt_frame_len
;
1104 bool need_wait_afrx
;
1106 uint8
*up_table
; /* user priority table, size is UP_TABLE_MAX */
1107 #endif /* QOS_MAP_SET */
1108 struct ether_addr last_roamed_addr
;
1109 bool rcc_enabled
; /* flag for Roam channel cache feature */
1110 #if defined(DHD_ENABLE_BIGDATA_LOGGING)
1111 char bss_info
[GET_BSS_INFO_LEN
];
1112 wl_event_msg_t event_auth_assoc
;
1113 u32 assoc_reject_status
;
1115 #endif /* DHD_ENABLE_BIGDATA_LOGGING */
1116 u16 ap_oper_channel
;
1117 #if defined(DHD_RANDOM_MAC_SCAN)
1118 bool random_mac_running
;
1119 #endif /* DHD_RANDOM_MAC_SCAN */
1120 #ifdef DHD_LOSSLESS_ROAMING
1121 struct timer_list roam_timeout
; /* Timer for catch roam timeout */
1123 #ifndef DUAL_ESCAN_RESULT_BUFFER
1124 uint16 escan_sync_id_cntr
;
1127 uint8 tdls_supported
;
1128 struct mutex tdls_sync
; /* protect tdls config operations */
1131 const uint8
*bip_pos
;
1135 #ifdef CUSTOMER_SCAN_TIMEOUT_SETTING
1136 int custom_scan_channel_time
;
1137 int custom_scan_unassoc_time
;
1138 int custom_scan_passive_time
;
1139 int custom_scan_home_time
;
1140 int custom_scan_home_away_time
;
1141 #endif /* CUSTOMER_SCAN_TIMEOUT_SETTING */
1142 #endif /* WES_SUPPORT */
1143 uint8 vif_count
; /* Virtual Interface count */
1145 struct list_head wbtext_bssid_list
;
1147 #ifdef SUPPORT_AP_RADIO_PWRSAVE
1148 ap_rps_info_t ap_rps_info
;
1149 #endif /* SUPPORT_AP_RADIO_PWRSAVE */
1150 u16 vif_macaddr_mask
;
1151 struct list_head vndr_oui_list
;
1152 spinlock_t vndr_oui_sync
; /* to protect vndr_oui_list */
1154 #ifdef BIGDATA_SOFTAP
1155 struct wl_ap_sta_info
*ap_sta_info
;
1156 #endif /* BIGDATA_SOFTAP */
1157 bool rssi_sum_report
;
1158 int rssi
; /* previous RSSI (backup) of get_station */
1159 uint64 scan_enq_time
;
1160 uint64 scan_deq_time
;
1161 uint64 scan_hdlr_cmplt_time
;
1162 uint64 scan_cmplt_time
;
1163 uint64 wl_evt_deq_time
;
1164 uint64 wl_evt_hdlr_entry_time
;
1165 uint64 wl_evt_hdlr_exit_time
;
1167 wl_wps_session_t wps_session
[WPS_MAX_SESSIONS
];
1168 spinlock_t wps_sync
; /* to protect wps states (and others if needed) */
1169 #endif /* WL_WPS_SYNC */
1171 wl_bad_ap_mngr_t bad_ap_mngr
;
1173 struct net_device
*static_ndev
;
1174 uint8 static_ndev_state
;
1175 #ifdef SUPPORT_CUSTOM_SET_CAC
1177 #endif /* SUPPORT_CUSTOM_SET_CAC */
1180 #define WL_STATIC_IFIDX (DHD_MAX_IFS + DHD_MAX_STATIC_IFS - 1)
1181 enum static_ndev_states
{
1183 NDEV_STATE_OS_IF_CREATED
,
1184 NDEV_STATE_FW_IF_CREATED
,
1185 NDEV_STATE_FW_IF_FAILED
,
1186 NDEV_STATE_FW_IF_DELETED
1188 #define IS_CFG80211_STATIC_IF(cfg, ndev) \
1189 ((cfg && (cfg->static_ndev == ndev)) ? true : false)
1190 #define IS_CFG80211_STATIC_IF_ACTIVE(cfg) \
1191 ((cfg && cfg->static_ndev && \
1192 (cfg->static_ndev_state & NDEV_STATE_FW_IF_CREATED)) ? true : false)
1193 #define IS_CFG80211_STATIC_IF_NAME(cfg, name) \
1194 ((cfg && !strcmp(cfg->static_ndev->name, name)))
1196 s32
wl_iftype_to_mode(wl_iftype_t iftype
);
1198 #if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == \
1199 4 && __GNUC_MINOR__ >= 6))
1200 #define GCC_DIAGNOSTIC_PUSH() \
1201 _Pragma("GCC diagnostic push") \
1202 _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
1203 #define GCC_DIAGNOSTIC_POP() \
1204 _Pragma("GCC diagnostic pop")
1206 #define GCC_DIAGNOSTIC_PUSH()
1207 #define GCC_DIAGNOSTIC_POP()
1208 #endif /* STRICT_GCC_WARNINGS */
1210 #define BCM_LIST_FOR_EACH_ENTRY_SAFE(pos, next, head, member) \
1211 list_for_each_entry_safe((pos), (next), (head), member)
1212 extern int ioctl_version
;
1214 static inline wl_bss_info_t
*next_bss(struct wl_scan_results
*list
, wl_bss_info_t
*bss
)
1217 (wl_bss_info_t
*)((uintptr
) bss
+ dtoh32(bss
->length
)) : list
->bss_info
;
1221 wl_probe_wdev_all(struct bcm_cfg80211
*cfg
)
1223 struct net_info
*_net_info
, *next
;
1224 unsigned long int flags
;
1226 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1227 GCC_DIAGNOSTIC_PUSH();
1228 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
,
1229 &cfg
->net_list
, list
) {
1230 WL_INFORM_MEM(("%s: net_list[%d] bssidx: %d\n",
1231 __FUNCTION__
, idx
++, _net_info
->bssidx
));
1233 GCC_DIAGNOSTIC_POP();
1234 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1238 static inline struct net_info
*
1239 wl_get_netinfo_by_fw_idx(struct bcm_cfg80211
*cfg
, s32 bssidx
, u8 ifidx
)
1241 struct net_info
*_net_info
, *next
, *info
= NULL
;
1242 unsigned long int flags
;
1244 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1245 GCC_DIAGNOSTIC_PUSH();
1246 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1247 if ((bssidx
>= 0) && (_net_info
->bssidx
== bssidx
) &&
1248 (_net_info
->ifidx
== ifidx
)) {
1253 GCC_DIAGNOSTIC_POP();
1254 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1259 wl_dealloc_netinfo_by_wdev(struct bcm_cfg80211
*cfg
, struct wireless_dev
*wdev
)
1261 struct net_info
*_net_info
, *next
;
1262 unsigned long int flags
;
1265 WL_INFORM_MEM(("dealloc_netinfo enter wdev=%p \n", OSL_OBFUSCATE_BUF(wdev
)));
1267 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1268 GCC_DIAGNOSTIC_PUSH();
1269 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1270 if (wdev
&& (_net_info
->wdev
== wdev
)) {
1271 wl_cfgbss_t
*bss
= &_net_info
->bss
;
1274 MFREE(cfg
->osh
, bss
->wpa_ie
, bss
->wpa_ie
[1]
1275 + WPA_RSN_IE_TAG_FIXED_LEN
);
1280 MFREE(cfg
->osh
, bss
->rsn_ie
,
1281 bss
->rsn_ie
[1] + WPA_RSN_IE_TAG_FIXED_LEN
);
1286 MFREE(cfg
->osh
, bss
->wps_ie
, bss
->wps_ie
[1] + 2);
1289 list_del(&_net_info
->list
);
1291 MFREE(cfg
->osh
, _net_info
, sizeof(struct net_info
));
1294 GCC_DIAGNOSTIC_POP();
1295 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1297 WL_INFORM_MEM(("dealloc_netinfo exit iface_cnt=%d \n", cfg
->iface_cnt
));
1302 wl_alloc_netinfo(struct bcm_cfg80211
*cfg
, struct net_device
*ndev
,
1303 struct wireless_dev
* wdev
, wl_iftype_t iftype
, bool pm_block
, u8 bssidx
, u8 ifidx
)
1305 struct net_info
*_net_info
;
1307 unsigned long int flags
;
1309 WL_INFORM_MEM(("alloc_netinfo enter bssidx=%d wdev=%p\n",
1310 bssidx
, OSL_OBFUSCATE_BUF(wdev
)));
1312 /* Check whether there is any duplicate entry for the
1313 * same bssidx && ifidx.
1315 if ((_net_info
= wl_get_netinfo_by_fw_idx(cfg
, bssidx
, ifidx
))) {
1316 /* We have a duplicate entry for the same bssidx
1317 * already present which shouldn't have been the case.
1320 WL_ERR(("Duplicate entry for bssidx=%d ifidx=%d present."
1321 " Can't add new entry\n", bssidx
, ifidx
));
1322 wl_probe_wdev_all(cfg
);
1325 #endif /* DHD_DEBUG */
1328 if (cfg
->iface_cnt
== IFACE_MAX_CNT
)
1330 _net_info
= (struct net_info
*)MALLOCZ(cfg
->osh
, sizeof(struct net_info
));
1334 _net_info
->iftype
= iftype
;
1335 _net_info
->ndev
= ndev
;
1336 _net_info
->wdev
= wdev
;
1337 _net_info
->pm_restore
= 0;
1339 _net_info
->pm_block
= pm_block
;
1340 _net_info
->roam_off
= WL_INVALID
;
1341 _net_info
->bssidx
= bssidx
;
1342 _net_info
->ifidx
= ifidx
;
1343 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1345 list_add(&_net_info
->list
, &cfg
->net_list
);
1346 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1349 WL_DBG(("alloc_netinfo exit iface_cnt=%d \n", cfg
->iface_cnt
));
1355 wl_delete_all_netinfo(struct bcm_cfg80211
*cfg
)
1357 struct net_info
*_net_info
, *next
;
1358 unsigned long int flags
;
1360 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1361 GCC_DIAGNOSTIC_PUSH();
1362 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1363 wl_cfgbss_t
*bss
= &_net_info
->bss
;
1366 MFREE(cfg
->osh
, bss
->wpa_ie
, bss
->wpa_ie
[1]
1367 + WPA_RSN_IE_TAG_FIXED_LEN
);
1372 MFREE(cfg
->osh
, bss
->rsn_ie
, bss
->rsn_ie
[1]
1373 + WPA_RSN_IE_TAG_FIXED_LEN
);
1378 MFREE(cfg
->osh
, bss
->wps_ie
, bss
->wps_ie
[1] + 2);
1382 if (bss
->fils_ind_ie
) {
1383 MFREE(cfg
->osh
, bss
->fils_ind_ie
, bss
->fils_ind_ie
[1]
1384 + FILS_INDICATION_IE_TAG_FIXED_LEN
);
1385 bss
->fils_ind_ie
= NULL
;
1387 list_del(&_net_info
->list
);
1388 if (_net_info
->wdev
) {
1389 MFREE(cfg
->osh
, _net_info
->wdev
, sizeof(struct wireless_dev
));
1391 MFREE(cfg
->osh
, _net_info
, sizeof(struct net_info
));
1394 GCC_DIAGNOSTIC_POP();
1395 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1398 wl_get_status_all(struct bcm_cfg80211
*cfg
, s32 status
)
1401 struct net_info
*_net_info
, *next
;
1403 unsigned long int flags
;
1405 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1406 GCC_DIAGNOSTIC_PUSH();
1407 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1408 if (_net_info
->ndev
&&
1409 test_bit(status
, &_net_info
->sme_state
))
1412 GCC_DIAGNOSTIC_POP();
1413 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1417 wl_set_status_all(struct bcm_cfg80211
*cfg
, s32 status
, u32 op
)
1419 struct net_info
*_net_info
, *next
;
1420 unsigned long int flags
;
1422 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1423 GCC_DIAGNOSTIC_PUSH();
1424 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1427 break; /* set all status is not allowed */
1430 * Release the spinlock before calling notifier. Else there
1431 * will be nested calls
1433 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1434 clear_bit(status
, &_net_info
->sme_state
);
1435 if (cfg
->state_notifier
&&
1436 test_bit(status
, &(cfg
->interrested_state
)))
1437 cfg
->state_notifier(cfg
, _net_info
, status
, false);
1440 break; /* change all status is not allowed */
1442 break; /* unknown operation */
1445 GCC_DIAGNOSTIC_POP();
1446 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1449 wl_set_status_by_netdev(struct bcm_cfg80211
*cfg
, s32 status
,
1450 struct net_device
*ndev
, u32 op
)
1453 struct net_info
*_net_info
, *next
;
1454 unsigned long int flags
;
1456 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1457 GCC_DIAGNOSTIC_PUSH();
1458 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1459 if (ndev
&& (_net_info
->ndev
== ndev
)) {
1463 * Release the spinlock before calling notifier. Else there
1464 * will be nested calls
1466 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1467 set_bit(status
, &_net_info
->sme_state
);
1468 if (cfg
->state_notifier
&&
1469 test_bit(status
, &(cfg
->interrested_state
)))
1470 cfg
->state_notifier(cfg
, _net_info
, status
, true);
1474 * Release the spinlock before calling notifier. Else there
1475 * will be nested calls
1477 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1478 clear_bit(status
, &_net_info
->sme_state
);
1479 if (cfg
->state_notifier
&&
1480 test_bit(status
, &(cfg
->interrested_state
)))
1481 cfg
->state_notifier(cfg
, _net_info
, status
, false);
1484 change_bit(status
, &_net_info
->sme_state
);
1490 GCC_DIAGNOSTIC_POP();
1491 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1495 static inline wl_cfgbss_t
*
1496 wl_get_cfgbss_by_wdev(struct bcm_cfg80211
*cfg
,
1497 struct wireless_dev
*wdev
)
1499 struct net_info
*_net_info
, *next
;
1500 wl_cfgbss_t
*bss
= NULL
;
1501 unsigned long int flags
;
1503 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1504 GCC_DIAGNOSTIC_PUSH();
1505 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1506 if (wdev
&& (_net_info
->wdev
== wdev
)) {
1507 bss
= &_net_info
->bss
;
1511 GCC_DIAGNOSTIC_POP();
1513 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1518 wl_get_status_by_netdev(struct bcm_cfg80211
*cfg
, s32 status
,
1519 struct net_device
*ndev
)
1521 struct net_info
*_net_info
, *next
;
1523 unsigned long int flags
;
1525 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1526 GCC_DIAGNOSTIC_PUSH();
1527 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1528 if (ndev
&& (_net_info
->ndev
== ndev
)) {
1529 stat
= test_bit(status
, &_net_info
->sme_state
);
1533 GCC_DIAGNOSTIC_POP();
1534 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1539 wl_get_mode_by_netdev(struct bcm_cfg80211
*cfg
, struct net_device
*ndev
)
1541 struct net_info
*_net_info
, *next
;
1543 unsigned long int flags
;
1545 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1546 GCC_DIAGNOSTIC_PUSH();
1547 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1548 if (_net_info
->ndev
&& (_net_info
->ndev
== ndev
)) {
1549 mode
= wl_iftype_to_mode(_net_info
->iftype
);
1553 GCC_DIAGNOSTIC_POP();
1554 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1559 wl_get_bssidx_by_wdev(struct bcm_cfg80211
*cfg
, struct wireless_dev
*wdev
)
1561 struct net_info
*_net_info
, *next
;
1563 unsigned long int flags
;
1565 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1566 GCC_DIAGNOSTIC_PUSH();
1567 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1568 if (_net_info
->wdev
&& (_net_info
->wdev
== wdev
)) {
1569 bssidx
= _net_info
->bssidx
;
1573 GCC_DIAGNOSTIC_POP();
1574 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1578 static inline struct wireless_dev
*
1579 wl_get_wdev_by_fw_idx(struct bcm_cfg80211
*cfg
, s32 bssidx
, s32 ifidx
)
1581 struct net_info
*_net_info
, *next
;
1582 struct wireless_dev
*wdev
= NULL
;
1583 unsigned long int flags
;
1587 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1588 GCC_DIAGNOSTIC_PUSH();
1589 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1590 if ((_net_info
->bssidx
== bssidx
) && (_net_info
->ifidx
== ifidx
)) {
1591 wdev
= _net_info
->wdev
;
1595 GCC_DIAGNOSTIC_POP();
1596 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1600 static inline struct wl_profile
*
1601 wl_get_profile_by_netdev(struct bcm_cfg80211
*cfg
, struct net_device
*ndev
)
1603 struct net_info
*_net_info
, *next
;
1604 struct wl_profile
*prof
= NULL
;
1605 unsigned long int flags
;
1607 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1608 GCC_DIAGNOSTIC_PUSH();
1609 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1610 if (ndev
&& (_net_info
->ndev
== ndev
)) {
1611 prof
= &_net_info
->profile
;
1615 GCC_DIAGNOSTIC_POP();
1616 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1619 static inline struct net_info
*
1620 wl_get_netinfo_by_netdev(struct bcm_cfg80211
*cfg
, struct net_device
*ndev
)
1622 struct net_info
*_net_info
, *next
, *info
= NULL
;
1623 unsigned long int flags
;
1625 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1626 GCC_DIAGNOSTIC_PUSH();
1627 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1628 if (ndev
&& (_net_info
->ndev
== ndev
)) {
1633 GCC_DIAGNOSTIC_POP();
1634 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1638 static inline struct net_info
*
1639 wl_get_netinfo_by_wdev(struct bcm_cfg80211
*cfg
, struct wireless_dev
*wdev
)
1641 struct net_info
*_net_info
, *next
, *info
= NULL
;
1642 unsigned long int flags
;
1644 spin_lock_irqsave(&cfg
->net_list_sync
, flags
);
1645 GCC_DIAGNOSTIC_PUSH();
1646 BCM_LIST_FOR_EACH_ENTRY_SAFE(_net_info
, next
, &cfg
->net_list
, list
) {
1647 if (wdev
&& (_net_info
->wdev
== wdev
)) {
1652 GCC_DIAGNOSTIC_POP();
1653 spin_unlock_irqrestore(&cfg
->net_list_sync
, flags
);
1657 #define is_p2p_group_iface(wdev) (((wdev->iftype == NL80211_IFTYPE_P2P_GO) || \
1658 (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) ? 1 : 0)
1659 #define bcmcfg_to_wiphy(cfg) (cfg->wdev->wiphy)
1660 #define bcmcfg_to_prmry_ndev(cfg) (cfg->wdev->netdev)
1661 #define bcmcfg_to_prmry_wdev(cfg) (cfg->wdev)
1662 #define bcmcfg_to_p2p_wdev(cfg) (cfg->p2p_wdev)
1663 #define ndev_to_wl(n) (wdev_to_wl(n->ieee80211_ptr))
1664 #define ndev_to_wdev(ndev) (ndev->ieee80211_ptr)
1665 #define wdev_to_ndev(wdev) (wdev->netdev)
1667 #if defined(WL_ENABLE_P2P_IF)
1668 #define ndev_to_wlc_ndev(ndev, cfg) ((ndev == cfg->p2p_net) ? \
1669 bcmcfg_to_prmry_ndev(cfg) : ndev)
1671 #define ndev_to_wlc_ndev(ndev, cfg) (ndev)
1672 #endif /* WL_ENABLE_P2P_IF */
1674 #define wdev_to_wlc_ndev(wdev, cfg) \
1675 (wdev_to_ndev(wdev) ? \
1676 wdev_to_ndev(wdev) : bcmcfg_to_prmry_ndev(cfg))
1677 #if defined(WL_CFG80211_P2P_DEV_IF)
1678 #define cfgdev_to_wlc_ndev(cfgdev, cfg) wdev_to_wlc_ndev(cfgdev, cfg)
1679 #define bcmcfg_to_prmry_cfgdev(cfgdev, cfg) bcmcfg_to_prmry_wdev(cfg)
1680 #elif defined(WL_ENABLE_P2P_IF)
1681 #define cfgdev_to_wlc_ndev(cfgdev, cfg) ndev_to_wlc_ndev(cfgdev, cfg)
1682 #define bcmcfg_to_prmry_cfgdev(cfgdev, cfg) bcmcfg_to_prmry_ndev(cfg)
1684 #define cfgdev_to_wlc_ndev(cfgdev, cfg) (cfgdev)
1685 #define bcmcfg_to_prmry_cfgdev(cfgdev, cfg) (cfgdev)
1686 #endif /* WL_CFG80211_P2P_DEV_IF */
1688 #if defined(WL_CFG80211_P2P_DEV_IF)
1689 #define cfgdev_to_wdev(cfgdev) (cfgdev)
1690 #define ndev_to_cfgdev(ndev) ndev_to_wdev(ndev)
1691 #define cfgdev_to_ndev(cfgdev) (cfgdev ? (cfgdev->netdev) : NULL)
1692 #define wdev_to_cfgdev(cfgdev) (cfgdev)
1693 #define discover_cfgdev(cfgdev, cfg) (cfgdev->iftype == NL80211_IFTYPE_P2P_DEVICE)
1695 #define cfgdev_to_wdev(cfgdev) (cfgdev->ieee80211_ptr)
1696 #define wdev_to_cfgdev(cfgdev) cfgdev ? (cfgdev->netdev) : NULL
1697 #define ndev_to_cfgdev(ndev) (ndev)
1698 #define cfgdev_to_ndev(cfgdev) (cfgdev)
1699 #define discover_cfgdev(cfgdev, cfg) (cfgdev == cfg->p2p_net)
1700 #endif /* WL_CFG80211_P2P_DEV_IF */
1702 #if defined(WL_CFG80211_P2P_DEV_IF)
1703 #define scan_req_match(cfg) (((cfg) && (cfg->scan_request) && \
1704 (cfg->scan_request->wdev == cfg->p2p_wdev)) ? true : false)
1705 #elif defined(WL_ENABLE_P2P_IF)
1706 #define scan_req_match(cfg) (((cfg) && (cfg->scan_request) && \
1707 (cfg->scan_request->dev == cfg->p2p_net)) ? true : false)
1709 #define scan_req_match(cfg) (((cfg) && p2p_is_on(cfg) && p2p_scan(cfg)) ? \
1711 #endif /* WL_CFG80211_P2P_DEV_IF */
1713 #define PRINT_WDEV_INFO(cfgdev) \
1715 struct wireless_dev *wdev = cfgdev_to_wdev(cfgdev); \
1716 struct net_device *netdev = wdev ? wdev->netdev : NULL; \
1717 WL_DBG(("wdev_ptr:%p ndev_ptr:%p ifname:%s iftype:%d\n", OSL_OBFUSCATE_BUF(wdev), \
1718 OSL_OBFUSCATE_BUF(netdev), \
1719 netdev ? netdev->name : "NULL (non-ndev device)", \
1720 wdev ? wdev->iftype : 0xff)); \
1723 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
1724 #define scan_req_iftype(req) (req->dev->ieee80211_ptr->iftype)
1726 #define scan_req_iftype(req) (req->wdev->iftype)
1727 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) */
1729 #define wl_to_sr(w) (w->scan_req_int)
1730 #if defined(STATIC_WL_PRIV_STRUCT)
1731 #define wl_to_ie(w) (w->ie)
1732 #define wl_to_conn(w) (w->conn_info)
1734 #define wl_to_ie(w) (&w->ie)
1735 #define wl_to_conn(w) (&w->conn_info)
1737 #define wiphy_from_scan(w) (w->escan_info.wiphy)
1738 #define wl_get_drv_status_all(cfg, stat) \
1739 (wl_get_status_all(cfg, WL_STATUS_ ## stat))
1740 #define wl_get_drv_status(cfg, stat, ndev) \
1741 (wl_get_status_by_netdev(cfg, WL_STATUS_ ## stat, ndev))
1742 #define wl_set_drv_status(cfg, stat, ndev) \
1743 (wl_set_status_by_netdev(cfg, WL_STATUS_ ## stat, ndev, 1))
1744 #define wl_clr_drv_status(cfg, stat, ndev) \
1745 (wl_set_status_by_netdev(cfg, WL_STATUS_ ## stat, ndev, 2))
1746 #define wl_clr_drv_status_all(cfg, stat) \
1747 (wl_set_status_all(cfg, WL_STATUS_ ## stat, 2))
1748 #define wl_chg_drv_status(cfg, stat, ndev) \
1749 (wl_set_status_by_netdev(cfg, WL_STATUS_ ## stat, ndev, 4))
1751 #define for_each_bss(list, bss, __i) \
1752 for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, bss = next_bss(list, bss))
1754 #define for_each_ndev(cfg, iter, next) \
1755 list_for_each_entry_safe(iter, next, &cfg->net_list, list)
1757 /* In case of WPS from wpa_supplicant, pairwise siute and group suite is 0.
1758 * In addtion to that, wpa_version is WPA_VERSION_1
1760 #define is_wps_conn(_sme) \
1761 ((wl_cfgp2p_find_wpsie(_sme->ie, _sme->ie_len) != NULL) && \
1762 (!_sme->crypto.n_ciphers_pairwise) && \
1763 (!_sme->crypto.cipher_group))
1766 #if defined(WLAN_AKM_SUITE_FT_8021X) && defined(WLAN_AKM_SUITE_FT_PSK)
1767 #define IS_AKM_SUITE_FT(sec) (sec->wpa_auth == WLAN_AKM_SUITE_FT_8021X || \
1768 sec->wpa_auth == WLAN_AKM_SUITE_FT_PSK)
1769 #elif defined(WLAN_AKM_SUITE_FT_8021X)
1770 #define IS_AKM_SUITE_FT(sec) (sec->wpa_auth == WLAN_AKM_SUITE_FT_8021X)
1771 #elif defined(WLAN_AKM_SUITE_FT_PSK)
1772 #define IS_AKM_SUITE_FT(sec) (sec->wpa_auth == WLAN_AKM_SUITE_FT_PSK)
1774 #define IS_AKM_SUITE_FT(sec) ({BCM_REFERENCE(sec); FALSE;})
1775 #endif /* WLAN_AKM_SUITE_FT_8021X && WLAN_AKM_SUITE_FT_PSK */
1777 #define IS_AKM_SUITE_FT(sec) ({BCM_REFERENCE(sec); FALSE;})
1781 #define IS_AKM_SUITE_CCKM(sec) (sec->wpa_auth == WLAN_AKM_SUITE_CCKM)
1783 #define IS_AKM_SUITE_CCKM(sec) ({BCM_REFERENCE(sec); FALSE;})
1786 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
1787 #define STA_INFO_BIT(info) (1ul << NL80211_STA_ ## info)
1790 #endif /* strnicmp */
1791 #define strnicmp(str1, str2, len) strncasecmp((str1), (str2), (len))
1793 #define STA_INFO_BIT(info) (STATION_ ## info)
1794 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) */
1796 extern s32
wl_cfg80211_attach(struct net_device
*ndev
, void *context
);
1797 extern void wl_cfg80211_detach(struct bcm_cfg80211
*cfg
);
1799 extern void wl_cfg80211_event(struct net_device
*ndev
, const wl_event_msg_t
*e
,
1801 void wl_cfg80211_set_parent_dev(void *dev
);
1802 struct device
*wl_cfg80211_get_parent_dev(void);
1803 struct bcm_cfg80211
*wl_cfg80211_get_bcmcfg(void);
1804 void wl_cfg80211_set_bcmcfg(struct bcm_cfg80211
*cfg
);
1807 extern s32
wl_cfg80211_clear_mgmt_vndr_ies(struct bcm_cfg80211
*cfg
);
1808 extern s32
wl_cfg80211_clear_per_bss_ies(struct bcm_cfg80211
*cfg
, struct wireless_dev
*wdev
);
1809 extern void wl_cfg80211_clear_p2p_disc_ies(struct bcm_cfg80211
*cfg
);
1811 extern int32
wl_cfg80211_update_iflist_info(struct bcm_cfg80211
*cfg
, struct net_device
*ndev
,
1812 int ifidx
, uint8
*addr
, int bssidx
, char *name
, int if_state
);
1813 #endif /* WL_STATIC_IF */
1814 extern s32
wl_cfg80211_up(struct net_device
*net
);
1815 extern s32
wl_cfg80211_down(struct net_device
*net
);
1816 extern void wl_cfg80211_sta_ifdown(struct net_device
*net
);
1817 extern s32
wl_cfg80211_notify_ifadd(struct net_device
* dev
, int ifidx
, char *name
, uint8
*mac
,
1818 uint8 bssidx
, uint8 role
);
1819 extern s32
wl_cfg80211_notify_ifdel(struct net_device
* dev
, int ifidx
, char *name
, uint8
*mac
,
1821 extern s32
wl_cfg80211_notify_ifchange(struct net_device
* dev
, int ifidx
, char *name
, uint8
*mac
,
1823 extern struct net_device
* wl_cfg80211_allocate_if(struct bcm_cfg80211
*cfg
, int ifidx
,
1824 const char *name
, uint8
*mac
, uint8 bssidx
, const char *dngl_name
);
1825 extern int wl_cfg80211_register_if(struct bcm_cfg80211
*cfg
,
1826 int ifidx
, struct net_device
* ndev
, bool rtnl_lock_reqd
);
1827 extern int wl_cfg80211_remove_if(struct bcm_cfg80211
*cfg
,
1828 int ifidx
, struct net_device
* ndev
, bool rtnl_lock_reqd
);
1829 extern void wl_cfg80211_cleanup_if(struct net_device
*dev
);
1830 extern int wl_cfg80211_scan_stop(struct bcm_cfg80211
*cfg
, bcm_struct_cfgdev
*cfgdev
);
1831 extern void wl_cfg80211_scan_abort(struct bcm_cfg80211
*cfg
);
1832 extern bool wl_cfg80211_is_concurrent_mode(struct net_device
* dev
);
1833 extern void wl_cfg80211_disassoc(struct net_device
*ndev
);
1834 extern void wl_cfg80211_del_all_sta(struct net_device
*ndev
, uint32 reason
);
1835 extern void* wl_cfg80211_get_dhdp(struct net_device
* dev
);
1836 extern bool wl_cfg80211_is_p2p_active(struct net_device
* dev
);
1837 extern bool wl_cfg80211_is_roam_offload(struct net_device
* dev
);
1838 extern bool wl_cfg80211_is_event_from_connected_bssid(struct net_device
* dev
,
1839 const wl_event_msg_t
*e
, int ifidx
);
1840 extern void wl_cfg80211_dbg_level(u32 level
);
1841 extern s32
wl_cfg80211_get_p2p_dev_addr(struct net_device
*net
, struct ether_addr
*p2pdev_addr
);
1842 extern s32
wl_cfg80211_set_p2p_noa(struct net_device
*net
, char* buf
, int len
);
1843 extern s32
wl_cfg80211_get_p2p_noa(struct net_device
*net
, char* buf
, int len
);
1844 extern s32
wl_cfg80211_set_wps_p2p_ie(struct net_device
*net
, char *buf
, int len
,
1845 enum wl_management_type type
);
1846 extern s32
wl_cfg80211_set_p2p_ps(struct net_device
*net
, char* buf
, int len
);
1847 extern s32
wl_cfg80211_set_p2p_ecsa(struct net_device
*net
, char* buf
, int len
);
1848 extern s32
wl_cfg80211_increase_p2p_bw(struct net_device
*net
, char* buf
, int len
);
1849 #ifdef P2PLISTEN_AP_SAMECHN
1850 extern s32
wl_cfg80211_set_p2p_resp_ap_chn(struct net_device
*net
, s32 enable
);
1851 #endif /* P2PLISTEN_AP_SAMECHN */
1853 /* btcoex functions */
1854 void* wl_cfg80211_btcoex_init(struct net_device
*ndev
);
1855 void wl_cfg80211_btcoex_deinit(void);
1857 extern chanspec_t
wl_chspec_from_legacy(chanspec_t legacy_chspec
);
1858 extern chanspec_t
wl_chspec_driver_to_host(chanspec_t chanspec
);
1860 #ifdef WL_SUPPORT_AUTO_CHANNEL
1861 #define CHANSPEC_BUF_SIZE 1024
1862 #define CHAN_SEL_IOCTL_DELAY 300
1863 #define CHAN_SEL_RETRY_COUNT 15
1864 #define CHANNEL_IS_RADAR(channel) (((channel & WL_CHAN_RADAR) || \
1865 (channel & WL_CHAN_PASSIVE)) ? true : false)
1866 #define CHANNEL_IS_2G(channel) (((channel >= 1) && (channel <= 14)) ? \
1868 #define CHANNEL_IS_5G(channel) (((channel >= 36) && (channel <= 165)) ? \
1870 extern s32
wl_cfg80211_get_best_channels(struct net_device
*dev
, char* command
,
1872 #endif /* WL_SUPPORT_AUTO_CHANNEL */
1873 extern int wl_cfg80211_ether_atoe(const char *a
, struct ether_addr
*n
);
1874 extern int wl_cfg80211_hang(struct net_device
*dev
, u16 reason
);
1875 extern s32
wl_mode_to_nl80211_iftype(s32 mode
);
1876 int wl_cfg80211_do_driver_init(struct net_device
*net
);
1877 void wl_cfg80211_enable_trace(bool set
, u32 level
);
1878 extern s32
wl_update_wiphybands(struct bcm_cfg80211
*cfg
, bool notify
);
1879 extern s32
wl_cfg80211_if_is_group_owner(void);
1880 extern chanspec_t
wl_chspec_host_to_driver(chanspec_t chanspec
);
1881 extern chanspec_t
wl_ch_host_to_driver(u16 channel
);
1882 extern s32
wl_set_tx_power(struct net_device
*dev
,
1883 enum nl80211_tx_power_setting type
, s32 dbm
);
1884 extern s32
wl_get_tx_power(struct net_device
*dev
, s32
*dbm
);
1885 extern s32
wl_add_remove_eventmsg(struct net_device
*ndev
, u16 event
, bool add
);
1886 extern void wl_stop_wait_next_action_frame(struct bcm_cfg80211
*cfg
, struct net_device
*ndev
,
1888 #ifdef WL_HOST_BAND_MGMT
1889 extern s32
wl_cfg80211_set_band(struct net_device
*ndev
, int band
);
1890 #endif /* WL_HOST_BAND_MGMT */
1891 extern void wl_cfg80211_add_to_eventbuffer(wl_eventmsg_buf_t
*ev
, u16 event
, bool set
);
1892 extern s32
wl_cfg80211_apply_eventbuffer(struct net_device
*ndev
,
1893 struct bcm_cfg80211
*cfg
, wl_eventmsg_buf_t
*ev
);
1894 extern void get_primary_mac(struct bcm_cfg80211
*cfg
, struct ether_addr
*mac
);
1895 extern void wl_cfg80211_update_power_mode(struct net_device
*dev
);
1896 extern void wl_cfg80211_set_passive_scan(struct net_device
*dev
, char *command
);
1897 extern void wl_terminate_event_handler(struct net_device
*dev
);
1898 #if defined(DHD_ENABLE_BIGDATA_LOGGING)
1899 extern s32
wl_cfg80211_get_bss_info(struct net_device
*dev
, char* cmd
, int total_len
);
1900 extern s32
wl_cfg80211_get_connect_failed_status(struct net_device
*dev
, char* cmd
, int total_len
);
1901 #endif /* DHD_ENABLE_BIGDATA_LOGGING */
1902 extern struct bcm_cfg80211
*wl_get_cfg(struct net_device
*ndev
);
1903 extern s32
wl_cfg80211_set_if_band(struct net_device
*ndev
, int band
);
1905 #define SCAN_BUF_CNT 2
1906 #define SCAN_BUF_NEXT 1
1907 #define WL_SCANTYPE_LEGACY 0x1
1908 #define WL_SCANTYPE_P2P 0x2
1909 #ifdef DUAL_ESCAN_RESULT_BUFFER
1910 #define wl_escan_set_sync_id(a, b) ((a) = (b)->escan_info.cur_sync_id)
1911 #define wl_escan_set_type(a, b) ((a)->escan_info.escan_type\
1912 [((a)->escan_info.cur_sync_id)%SCAN_BUF_CNT] = (b))
1913 static inline wl_scan_results_t
*wl_escan_get_buf(struct bcm_cfg80211
*cfg
, bool aborted
)
1917 if (cfg
->escan_info
.escan_type
[0] == cfg
->escan_info
.escan_type
[1])
1918 index
= (cfg
->escan_info
.cur_sync_id
+ 1)%SCAN_BUF_CNT
;
1920 index
= (cfg
->escan_info
.cur_sync_id
)%SCAN_BUF_CNT
;
1923 index
= (cfg
->escan_info
.cur_sync_id
)%SCAN_BUF_CNT
;
1925 return (wl_scan_results_t
*)cfg
->escan_info
.escan_buf
[index
];
1927 static inline int wl_escan_check_sync_id(s32 status
, u16 result_id
, u16 wl_id
)
1929 if (result_id
!= wl_id
) {
1930 WL_ERR(("ESCAN sync id mismatch :status :%d "
1931 "cur_sync_id:%d coming sync_id:%d\n",
1932 status
, wl_id
, result_id
));
1938 static inline void wl_escan_print_sync_id(s32 status
, u16 result_id
, u16 wl_id
)
1940 if (result_id
!= wl_id
) {
1941 WL_ERR(("ESCAN sync id mismatch :status :%d "
1942 "cur_sync_id:%d coming sync_id:%d\n",
1943 status
, wl_id
, result_id
));
1946 #define wl_escan_increment_sync_id(a, b) ((a)->escan_info.cur_sync_id += b)
1947 #define wl_escan_init_sync_id(a) ((a)->escan_info.cur_sync_id = 0)
1949 #define wl_escan_set_sync_id(a, b) ((a) = htod16((b)->escan_sync_id_cntr++))
1950 #define wl_escan_set_type(a, b)
1951 #define wl_escan_get_buf(a, b) ((wl_scan_results_t *) (a)->escan_info.escan_buf)
1952 #define wl_escan_check_sync_id(a, b, c) 0
1953 #define wl_escan_print_sync_id(a, b, c)
1954 #define wl_escan_increment_sync_id(a, b)
1955 #define wl_escan_init_sync_id(a)
1956 #endif /* DUAL_ESCAN_RESULT_BUFFER */
1957 extern void wl_cfg80211_ibss_vsie_set_buffer(struct net_device
*dev
, vndr_ie_setbuf_t
*ibss_vsie
,
1959 extern s32
wl_cfg80211_ibss_vsie_delete(struct net_device
*dev
);
1961 extern void wl_cfg80211_set_txfail_pid(struct net_device
*dev
, int pid
);
1962 #endif /* WLAIBSS */
1964 extern void wl_cfg80211_set_rmc_pid(struct net_device
*dev
, int pid
);
1965 #endif /* WL_RELMCAST */
1966 extern int wl_cfg80211_set_mgmt_vndr_ies(struct bcm_cfg80211
*cfg
,
1967 bcm_struct_cfgdev
*cfgdev
, s32 bssidx
, s32 pktflag
,
1968 const u8
*vndr_ie
, u32 vndr_ie_len
);
1971 extern int wl_cfg80211_get_fbt_key(struct net_device
*dev
, uint8
*key
, int total_len
);
1974 /* Action frame specific functions */
1975 extern u8
wl_get_action_category(void *frame
, u32 frame_len
);
1976 extern int wl_get_public_action(void *frame
, u32 frame_len
, u8
*ret_action
);
1978 #ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
1979 struct net_device
*wl_cfg80211_get_remain_on_channel_ndev(struct bcm_cfg80211
*cfg
);
1980 #endif /* WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST */
1982 #ifdef WL_SUPPORT_ACS
1983 #define ACS_MSRMNT_DELAY 1000 /* dump_obss delay in ms */
1984 #define IOCTL_RETRY_COUNT 5
1985 #define CHAN_NOISE_DUMMY -80
1986 #define OBSS_TOKEN_IDX 15
1987 #define IBSS_TOKEN_IDX 15
1988 #define TX_TOKEN_IDX 14
1989 #define CTG_TOKEN_IDX 13
1990 #define PKT_TOKEN_IDX 15
1991 #define IDLE_TOKEN_IDX 12
1992 #endif /* WL_SUPPORT_ACS */
1995 #define is_wapi(cipher) (cipher == WLAN_CIPHER_SUITE_SMS4) ? 1 : 0
1996 #endif /* BCMWAPI_WPI */
1998 extern int wl_cfg80211_get_ioctl_version(void);
1999 extern int wl_cfg80211_enable_roam_offload(struct net_device
*dev
, int enable
);
2000 extern s32
wl_cfg80211_dfs_ap_move(struct net_device
*ndev
, char *data
,
2001 char *command
, int total_len
);
2003 extern s32
wl_cfg80211_wbtext_set_default(struct net_device
*ndev
);
2004 extern s32
wl_cfg80211_wbtext_config(struct net_device
*ndev
, char *data
,
2005 char *command
, int total_len
);
2006 extern int wl_cfg80211_wbtext_weight_config(struct net_device
*ndev
, char *data
,
2007 char *command
, int total_len
);
2008 extern int wl_cfg80211_wbtext_table_config(struct net_device
*ndev
, char *data
,
2009 char *command
, int total_len
);
2010 extern s32
wl_cfg80211_wbtext_delta_config(struct net_device
*ndev
, char *data
,
2011 char *command
, int total_len
);
2013 extern s32
wl_cfg80211_get_chanspecs_2g(struct net_device
*ndev
,
2014 void *buf
, s32 buflen
);
2015 extern s32
wl_cfg80211_get_chanspecs_5g(struct net_device
*ndev
,
2016 void *buf
, s32 buflen
);
2018 extern s32
wl_cfg80211_bss_up(struct bcm_cfg80211
*cfg
,
2019 struct net_device
*ndev
, s32 bsscfg_idx
, s32 up
);
2020 extern bool wl_cfg80211_bss_isup(struct net_device
*ndev
, int bsscfg_idx
);
2022 struct net_device
*wl_cfg80211_post_ifcreate(struct net_device
*ndev
,
2023 wl_if_event_info
*event
, u8
*addr
, const char *name
, bool rtnl_lock_reqd
);
2024 extern s32
wl_cfg80211_post_ifdel(struct net_device
*ndev
, bool rtnl_lock_reqd
, s32 ifidx
);
2025 #if defined(PKT_FILTER_SUPPORT) && defined(APSTA_BLOCK_ARP_DURING_DHCP)
2026 extern void wl_cfg80211_block_arp(struct net_device
*dev
, int enable
);
2027 #endif /* PKT_FILTER_SUPPORT && APSTA_BLOCK_ARP_DURING_DHCP */
2030 int wl_cfgvendor_send_nan_event(struct wiphy
* wiphy
,
2031 struct net_device
*dev
, int event_id
,
2032 nan_event_data_t
*nan_event_data
);
2033 extern int wl_cfgnan_init(struct bcm_cfg80211
*cfg
);
2034 extern int wl_cfgnan_deinit(struct bcm_cfg80211
*cfg
, uint8 busstate
);
2035 extern bool wl_cfgnan_check_state(struct bcm_cfg80211
*cfg
);
2038 #ifdef WL_CFG80211_P2P_DEV_IF
2039 extern void wl_cfg80211_del_p2p_wdev(struct net_device
*dev
);
2040 #endif /* WL_CFG80211_P2P_DEV_IF */
2041 #if defined(WL_SUPPORT_AUTO_CHANNEL)
2042 extern int wl_cfg80211_set_spect(struct net_device
*dev
, int spect
);
2043 extern int wl_cfg80211_get_sta_channel(struct bcm_cfg80211
*cfg
);
2044 #endif /* WL_SUPPORT_AUTO_CHANNEL */
2045 #ifdef WL_CFG80211_SYNC_GON
2046 #define WL_DRV_STATUS_SENDING_AF_FRM_EXT(cfg) \
2047 (wl_get_drv_status_all(cfg, SENDING_ACT_FRM) || \
2048 wl_get_drv_status_all(cfg, WAITING_NEXT_ACT_FRM_LISTEN))
2050 #define WL_DRV_STATUS_SENDING_AF_FRM_EXT(cfg) wl_get_drv_status_all(cfg, SENDING_ACT_FRM)
2051 #endif /* WL_CFG80211_SYNC_GON */
2053 #ifdef P2P_LISTEN_OFFLOADING
2054 extern s32
wl_cfg80211_p2plo_deinit(struct bcm_cfg80211
*cfg
);
2055 #endif /* P2P_LISTEN_OFFLOADING */
2057 #define RETURN_EIO_IF_NOT_UP(wlpriv) \
2059 struct net_device *checkSysUpNDev = bcmcfg_to_prmry_ndev(wlpriv); \
2060 if (unlikely(!wl_get_drv_status(wlpriv, READY, checkSysUpNDev))) { \
2061 WL_INFORM(("device is not ready\n")); \
2067 extern uint8
*wl_get_up_table(void);
2068 #endif /* QOS_MAP_SET */
2070 #define P2PO_COOKIE 65535
2071 u64
wl_cfg80211_get_new_roc_id(struct bcm_cfg80211
*cfg
);
2073 #if defined(SUPPORT_RANDOM_MAC_SCAN)
2074 int wl_cfg80211_set_random_mac(struct net_device
*dev
, bool enable
);
2075 int wl_cfg80211_random_mac_enable(struct net_device
*dev
, uint8
*rand_mac
, uint8
*rand_mask
);
2076 int wl_cfg80211_random_mac_disable(struct net_device
*dev
);
2077 int wl_cfg80211_scan_mac_enable(struct net_device
*dev
, uint8
*rand_mac
, uint8
*rand_mask
);
2078 int wl_cfg80211_scan_mac_disable(struct net_device
*dev
);
2079 #endif /* SUPPORT_RANDOM_MAC_SCAN */
2080 #ifdef SUPPORT_AP_HIGHER_BEACONRATE
2081 int wl_set_ap_beacon_rate(struct net_device
*dev
, int val
, char *ifname
);
2082 int wl_get_ap_basic_rate(struct net_device
*dev
, char* command
, char *ifname
, int total_len
);
2083 #endif /* SUPPORT_AP_HIGHER_BEACONRATE */
2084 #ifdef SUPPORT_AP_RADIO_PWRSAVE
2085 int wl_get_ap_rps(struct net_device
*dev
, char* command
, char *ifname
, int total_len
);
2086 int wl_set_ap_rps(struct net_device
*dev
, bool enable
, char *ifname
);
2087 int wl_update_ap_rps_params(struct net_device
*dev
, ap_rps_info_t
* rps
, char *ifname
);
2088 void wl_cfg80211_init_ap_rps(struct bcm_cfg80211
*cfg
);
2089 #endif /* SUPPORT_AP_RADIO_PWRSAVE */
2090 #ifdef SUPPORT_RSSI_SUM_REPORT
2091 int wl_get_rssi_logging(struct net_device
*dev
, void *param
);
2092 int wl_set_rssi_logging(struct net_device
*dev
, void *param
);
2093 int wl_get_rssi_per_ant(struct net_device
*dev
, char *ifname
, char *peer_mac
, void *param
);
2094 #endif /* SUPPORT_RSSI_SUM_REPORT */
2095 #ifdef DYNAMIC_MUMIMO_CONTROL
2096 void wl_set_murx_block_eapol_status(struct bcm_cfg80211
*cfg
, int enable
);
2097 bool wl_get_murx_reassoc_status(struct bcm_cfg80211
*cfg
);
2098 void wl_set_murx_reassoc_status(struct bcm_cfg80211
*cfg
, int enable
);
2099 int wl_check_bss_support_mumimo(struct net_device
*dev
);
2100 int wl_get_murx_bfe_cap(struct net_device
*dev
, int *cap
);
2101 int wl_set_murx_bfe_cap(struct net_device
*dev
, int val
, bool reassoc_req
);
2102 #endif /* DYNAMIC_MUMIMO_CONTROL */
2103 int wl_cfg80211_iface_count(struct net_device
*dev
);
2104 struct net_device
* wl_get_ap_netdev(struct bcm_cfg80211
*cfg
, char *ifname
);
2105 void wl_cfg80211_cleanup_virtual_ifaces(struct bcm_cfg80211
*cfg
, bool rtnl_lock_reqd
);
2106 struct wireless_dev
* wl_cfg80211_add_if(struct bcm_cfg80211
*cfg
, struct net_device
*primary_ndev
,
2107 wl_iftype_t wl_iftype
, const char *name
, u8
*mac
);
2108 extern s32
wl_cfg80211_del_if(struct bcm_cfg80211
*cfg
, struct net_device
*primary_ndev
,
2109 struct wireless_dev
*wdev
, char *name
);
2111 extern struct net_device
*wl_cfg80211_register_static_if(struct bcm_cfg80211
*cfg
,
2112 u16 iftype
, char *ifname
);
2113 extern void wl_cfg80211_unregister_static_if(struct bcm_cfg80211
* cfg
);
2114 extern s32
wl_cfg80211_static_if_open(struct net_device
*net
);
2115 extern s32
wl_cfg80211_static_if_close(struct net_device
*net
);
2116 extern struct net_device
* wl_cfg80211_post_static_ifcreate(struct bcm_cfg80211
*cfg
,
2117 wl_if_event_info
*event
, u8
*addr
, s32 iface_type
);
2118 extern s32
wl_cfg80211_post_static_ifdel(struct bcm_cfg80211
*cfg
, struct net_device
*ndev
);
2119 #endif /* WL_STATIC_IF */
2120 extern struct wireless_dev
*wl_cfg80211_get_wdev_from_ifname(struct bcm_cfg80211
*cfg
,
2122 struct net_device
* wl_get_netdev_by_name(struct bcm_cfg80211
*cfg
, char *ifname
);
2123 extern s32
wl_get_vif_macaddr(struct bcm_cfg80211
*cfg
, u16 wl_iftype
, u8
*mac_addr
);
2124 extern s32
wl_release_vif_macaddr(struct bcm_cfg80211
*cfg
, u8
*mac_addr
, u16 wl_iftype
);
2125 extern int wl_cfg80211_ifstats_counters(struct net_device
*dev
, wl_if_stats_t
*if_stats
);
2126 extern s32
wl_cfg80211_set_dbg_verbose(struct net_device
*ndev
, u32 level
);
2127 extern s32
wl_cfg80211_check_for_nan_support(struct bcm_cfg80211
*cfg
);
2128 extern int wl_cfg80211_deinit_p2p_discovery(struct bcm_cfg80211
* cfg
);
2129 extern int wl_cfg80211_set_frameburst(struct bcm_cfg80211
*cfg
, bool enable
);
2130 extern int wl_cfg80211_determine_p2p_rsdb_mode(struct bcm_cfg80211
*cfg
);
2131 extern s32
cfg80211_to_wl_iftype(uint16 type
, uint16
*role
, uint16
*mode
);
2132 extern s32
wl_cfg80211_net_attach(struct net_device
*primary_ndev
);
2133 extern uint8
wl_cfg80211_get_bus_state(struct bcm_cfg80211
*cfg
);
2135 void wl_handle_wps_states(struct net_device
*ndev
, u8
*dump_data
, u16 len
, bool direction
);
2136 #endif /* WL_WPS_SYNC */
2138 /* Function to flush the FW log buffer content */
2140 extern void wl_flush_fw_log_buffer(struct net_device
*dev
, uint32 logset_mask
);
2142 #define wl_flush_fw_log_buffer(x, y)
2143 #endif /* DHD_LOG_DUMP */
2144 #ifdef DHD_USE_CHECK_DONGLE_IDLE
2145 int wl_check_dongle_idle(struct wiphy
*wiphy
);
2147 static inline int wl_check_dongle_idle(struct wiphy
*wiphy
)
2151 #endif /* DHD_USE_CHECK_DONGLE_IDLE */
2152 #ifdef DHD_ABORT_SCAN_CREATE_INTERFACE
2153 extern int wl_abort_scan_and_check(struct bcm_cfg80211
*cfg
);
2155 static inline int wl_abort_scan_and_check(struct bcm_cfg80211
*cfg
)
2159 #endif /* DHD_ABORT_SCAN_CREATE_INTERFACE */
2160 #ifdef APSTA_RESTRICTED_CHANNEL
2161 extern s32
wl_cfg80211_set_indoor_channels(struct net_device
*ndev
, char *command
, int total_len
);
2162 extern s32
wl_cfg80211_get_indoor_channels(struct net_device
*ndev
, char *command
, int total_len
);
2163 extern s32
wl_cfg80211_read_indoor_channels(struct net_device
*ndev
, void *buf
, int buflen
);
2164 extern bool wl_cfg80211_check_indoor_channels(struct net_device
*ndev
, int channel
);
2165 #endif /* APSTA_RESTRICTED_CHANNEL */
2166 #ifdef SUPPORT_SET_CAC
2167 extern int wl_cfg80211_enable_cac(struct net_device
*dev
, int enable
);
2168 extern void wl_cfg80211_set_cac(struct bcm_cfg80211
*cfg
, int enable
);
2169 #endif /* SUPPORT_SET_CAC */
2170 #endif /* _wl_cfg80211_h_ */