blob: 01f096f7a08941f049e0804b96becfc08a8b24a6 [file] [log] [blame]
Arend van Spriel5b435de2011-10-05 13:19:03 +02001/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
Hante Meulemanbfe81972014-10-28 14:56:16 +010017#ifndef BRCMFMAC_CFG80211_H
18#define BRCMFMAC_CFG80211_H
Arend van Spriel5b435de2011-10-05 13:19:03 +020019
Franky Lin83cf17a2013-04-11 13:28:50 +020020/* for brcmu_d11inf */
21#include <brcmu_d11.h>
22
Hante Meulemanf07998952012-11-05 16:22:13 -080023#define WL_NUM_SCAN_MAX 10
Arend van Spriel5b435de2011-10-05 13:19:03 +020024#define WL_TLV_INFO_MAX 1024
25#define WL_BSS_INFO_MAX 2048
Hante Meulemanf07998952012-11-05 16:22:13 -080026#define WL_ASSOC_INFO_MAX 512 /* assoc related fil max buf */
27#define WL_EXTRA_BUF_MAX 2048
Arend van Spriel5b435de2011-10-05 13:19:03 +020028#define WL_ROAM_TRIGGER_LEVEL -75
29#define WL_ROAM_DELTA 20
Arend van Spriel5b435de2011-10-05 13:19:03 +020030
Hante Meulemand5367332016-02-17 11:26:51 +010031/* Keep BRCMF_ESCAN_BUF_SIZE below 64K (65536). Allocing over 64K can be
32 * problematic on some systems and should be avoided.
33 */
34#define BRCMF_ESCAN_BUF_SIZE 65000
35#define BRCMF_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */
Hante Meulemane756af52012-09-11 21:18:52 +020036
37#define WL_ESCAN_ACTION_START 1
38#define WL_ESCAN_ACTION_CONTINUE 2
39#define WL_ESCAN_ACTION_ABORT 3
40
Hante Meulemanf09d0c02012-09-27 14:17:48 +020041#define WL_AUTH_SHARED_KEY 1 /* d11 shared authentication */
Hante Meuleman1a873342012-09-27 14:17:54 +020042#define IE_MAX_LEN 512
Hante Meulemanf09d0c02012-09-27 14:17:48 +020043
Arend van Spriel9f440b72013-02-08 15:53:36 +010044/* IE TLV processing */
45#define TLV_LEN_OFF 1 /* length offset */
46#define TLV_HDR_LEN 2 /* header length */
47#define TLV_BODY_OFF 2 /* body offset */
48#define TLV_OUI_LEN 3 /* oui id length */
49
50/* 802.11 Mgmt Packet flags */
51#define BRCMF_VNDR_IE_BEACON_FLAG 0x1
52#define BRCMF_VNDR_IE_PRBRSP_FLAG 0x2
53#define BRCMF_VNDR_IE_ASSOCRSP_FLAG 0x4
54#define BRCMF_VNDR_IE_AUTHRSP_FLAG 0x8
55#define BRCMF_VNDR_IE_PRBREQ_FLAG 0x10
56#define BRCMF_VNDR_IE_ASSOCREQ_FLAG 0x20
57/* vendor IE in IW advertisement protocol ID field */
58#define BRCMF_VNDR_IE_IWAPID_FLAG 0x40
59/* allow custom IE id */
60#define BRCMF_VNDR_IE_CUSTOM_FLAG 0x100
61
62/* P2P Action Frames flags (spec ordered) */
63#define BRCMF_VNDR_IE_GONREQ_FLAG 0x001000
64#define BRCMF_VNDR_IE_GONRSP_FLAG 0x002000
65#define BRCMF_VNDR_IE_GONCFM_FLAG 0x004000
66#define BRCMF_VNDR_IE_INVREQ_FLAG 0x008000
67#define BRCMF_VNDR_IE_INVRSP_FLAG 0x010000
68#define BRCMF_VNDR_IE_DISREQ_FLAG 0x020000
69#define BRCMF_VNDR_IE_DISRSP_FLAG 0x040000
70#define BRCMF_VNDR_IE_PRDREQ_FLAG 0x080000
71#define BRCMF_VNDR_IE_PRDRSP_FLAG 0x100000
72
73#define BRCMF_VNDR_IE_P2PAF_SHIFT 12
74
Hante Meuleman118eb302014-12-21 12:43:49 +010075#define BRCMF_MAX_DEFAULT_KEYS 4
76
Hante Meuleman1119e232015-11-25 11:32:42 +010077/* beacon loss timeout defaults */
78#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2
79#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF 4
Arend van Spriel9f440b72013-02-08 15:53:36 +010080
Arend van Spriel63ce3d52016-01-05 11:05:48 +010081#define BRCMF_VIF_EVENT_TIMEOUT msecs_to_jiffies(1500)
82
Arend van Sprielc1179032012-10-22 13:55:33 -070083/**
Arend van Spriel1687eee2013-04-23 12:53:11 +020084 * enum brcmf_scan_status - scan engine status
Arend van Sprielc1179032012-10-22 13:55:33 -070085 *
86 * @BRCMF_SCAN_STATUS_BUSY: scanning in progress on dongle.
87 * @BRCMF_SCAN_STATUS_ABORT: scan being aborted on dongle.
Arend van Spriel1687eee2013-04-23 12:53:11 +020088 * @BRCMF_SCAN_STATUS_SUPPRESS: scanning is suppressed in driver.
Arend van Sprielc1179032012-10-22 13:55:33 -070089 */
90enum brcmf_scan_status {
91 BRCMF_SCAN_STATUS_BUSY,
92 BRCMF_SCAN_STATUS_ABORT,
Arend van Spriel1687eee2013-04-23 12:53:11 +020093 BRCMF_SCAN_STATUS_SUPPRESS,
Arend van Spriel5b435de2011-10-05 13:19:03 +020094};
95
Arend van Spriel5b435de2011-10-05 13:19:03 +020096/* dongle configuration */
97struct brcmf_cfg80211_conf {
Arend van Spriel5b435de2011-10-05 13:19:03 +020098 u32 frag_threshold;
99 u32 rts_threshold;
100 u32 retry_short;
101 u32 retry_long;
Arend van Spriel5b435de2011-10-05 13:19:03 +0200102};
103
Arend van Spriel5b435de2011-10-05 13:19:03 +0200104/* security information with currently associated ap */
105struct brcmf_cfg80211_security {
106 u32 wpa_versions;
107 u32 auth_type;
108 u32 cipher_pairwise;
109 u32 cipher_group;
110 u32 wpa_auth;
111};
112
Arend van Spriel3bc0a962012-10-22 13:55:35 -0700113/**
114 * struct brcmf_cfg80211_profile - profile information.
115 *
Arend van Spriel3bc0a962012-10-22 13:55:35 -0700116 * @bssid: bssid of joined/joining ibss.
117 * @sec: security information.
Hante Meuleman118eb302014-12-21 12:43:49 +0100118 * @key: key information
Arend van Spriel3bc0a962012-10-22 13:55:35 -0700119 */
Arend van Spriel5b435de2011-10-05 13:19:03 +0200120struct brcmf_cfg80211_profile {
Arend van Spriel5b435de2011-10-05 13:19:03 +0200121 u8 bssid[ETH_ALEN];
Arend van Spriel5b435de2011-10-05 13:19:03 +0200122 struct brcmf_cfg80211_security sec;
Hante Meuleman118eb302014-12-21 12:43:49 +0100123 struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
Arend van Spriel5b435de2011-10-05 13:19:03 +0200124};
125
Arend van Spriel3eacf862012-10-22 13:55:30 -0700126/**
Arend van Sprielc1179032012-10-22 13:55:33 -0700127 * enum brcmf_vif_status - bit indices for vif status.
128 *
129 * @BRCMF_VIF_STATUS_READY: ready for operation.
130 * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress.
131 * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully.
Arend van Spriel5f4f9f12013-02-08 15:53:41 +0100132 * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress.
Arend van Sprielc1179032012-10-22 13:55:33 -0700133 * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started.
134 */
135enum brcmf_vif_status {
136 BRCMF_VIF_STATUS_READY,
137 BRCMF_VIF_STATUS_CONNECTING,
138 BRCMF_VIF_STATUS_CONNECTED,
Arend van Spriel5f4f9f12013-02-08 15:53:41 +0100139 BRCMF_VIF_STATUS_DISCONNECTING,
Arend van Sprielc1179032012-10-22 13:55:33 -0700140 BRCMF_VIF_STATUS_AP_CREATED
141};
142
143/**
Arend van Spriel8ff5dc92012-10-22 13:55:41 -0700144 * struct vif_saved_ie - holds saved IEs for a virtual interface.
145 *
Arend van Spriel9f440b72013-02-08 15:53:36 +0100146 * @probe_req_ie: IE info for probe request.
Arend van Spriel8ff5dc92012-10-22 13:55:41 -0700147 * @probe_res_ie: IE info for probe response.
148 * @beacon_ie: IE info for beacon frame.
Arend van Spriel9f440b72013-02-08 15:53:36 +0100149 * @probe_req_ie_len: IE info length for probe request.
Arend van Spriel8ff5dc92012-10-22 13:55:41 -0700150 * @probe_res_ie_len: IE info length for probe response.
151 * @beacon_ie_len: IE info length for beacon frame.
152 */
153struct vif_saved_ie {
Hante Meulemandae3a272013-02-08 15:54:00 +0100154 u8 probe_req_ie[IE_MAX_LEN];
Arend van Spriel8ff5dc92012-10-22 13:55:41 -0700155 u8 probe_res_ie[IE_MAX_LEN];
156 u8 beacon_ie[IE_MAX_LEN];
Hante Meuleman89286dc2013-02-08 15:53:46 +0100157 u8 assoc_req_ie[IE_MAX_LEN];
Arend van Spriel9f440b72013-02-08 15:53:36 +0100158 u32 probe_req_ie_len;
Arend van Spriel8ff5dc92012-10-22 13:55:41 -0700159 u32 probe_res_ie_len;
160 u32 beacon_ie_len;
Hante Meuleman89286dc2013-02-08 15:53:46 +0100161 u32 assoc_req_ie_len;
Arend van Spriel8ff5dc92012-10-22 13:55:41 -0700162};
163
164/**
Arend van Spriel3eacf862012-10-22 13:55:30 -0700165 * struct brcmf_cfg80211_vif - virtual interface specific information.
166 *
167 * @ifp: lower layer interface pointer
168 * @wdev: wireless device.
Arend van Spriel6ac4f4e2012-10-22 13:55:31 -0700169 * @profile: profile information.
Arend van Sprielc1179032012-10-22 13:55:33 -0700170 * @sme_state: SME state using enum brcmf_vif_status bits.
Arend van Spriel3eacf862012-10-22 13:55:30 -0700171 * @pm_block: power-management blocked.
172 * @list: linked list.
Hante Meuleman0de8aac2013-02-08 15:53:38 +0100173 * @mgmt_rx_reg: registered rx mgmt frame types.
Hante Meulemana44aa402014-12-03 21:05:33 +0100174 * @mbss: Multiple BSS type, set if not first AP (not relevant for P2P).
Arend van Spriel3eacf862012-10-22 13:55:30 -0700175 */
176struct brcmf_cfg80211_vif {
177 struct brcmf_if *ifp;
178 struct wireless_dev wdev;
Arend van Spriel6ac4f4e2012-10-22 13:55:31 -0700179 struct brcmf_cfg80211_profile profile;
Arend van Sprielc1179032012-10-22 13:55:33 -0700180 unsigned long sme_state;
Arend van Spriel3eacf862012-10-22 13:55:30 -0700181 bool pm_block;
Arend van Spriel8ff5dc92012-10-22 13:55:41 -0700182 struct vif_saved_ie saved_ie;
Arend van Spriel3eacf862012-10-22 13:55:30 -0700183 struct list_head list;
Hante Meuleman0de8aac2013-02-08 15:53:38 +0100184 u16 mgmt_rx_reg;
Hante Meulemana44aa402014-12-03 21:05:33 +0100185 bool mbss;
Arend van Spriel98027762014-12-21 12:43:53 +0100186 int is_11d;
Arend van Spriel3eacf862012-10-22 13:55:30 -0700187};
188
Arend van Spriel5b435de2011-10-05 13:19:03 +0200189/* association inform */
190struct brcmf_cfg80211_connect_info {
191 u8 *req_ie;
192 s32 req_ie_len;
193 u8 *resp_ie;
194 s32 resp_ie_len;
195};
196
197/* assoc ie length */
Arend van Sprielc4e382d2011-10-12 20:51:21 +0200198struct brcmf_cfg80211_assoc_ielen_le {
199 __le32 req_len;
200 __le32 resp_len;
Arend van Spriel5b435de2011-10-05 13:19:03 +0200201};
202
Hante Meulemane756af52012-09-11 21:18:52 +0200203/* dongle escan state */
204enum wl_escan_state {
205 WL_ESCAN_STATE_IDLE,
206 WL_ESCAN_STATE_SCANNING
207};
208
209struct escan_info {
210 u32 escan_state;
Hante Meulemand5367332016-02-17 11:26:51 +0100211 u8 *escan_buf;
Hante Meulemane756af52012-09-11 21:18:52 +0200212 struct wiphy *wiphy;
Arend van Spriela0f472a2013-04-05 10:57:49 +0200213 struct brcmf_if *ifp;
214 s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
Hante Meulemanc4958102015-11-25 11:32:41 +0100215 struct cfg80211_scan_request *request);
Hante Meulemane756af52012-09-11 21:18:52 +0200216};
217
Arend van Spriele5806072012-09-19 22:21:08 +0200218/**
Arend van Sprield3c0b632013-02-08 15:53:37 +0100219 * struct brcmf_cfg80211_vif_event - virtual interface event information.
220 *
221 * @vif_wq: waitqueue awaiting interface event from firmware.
222 * @vif_event_lock: protects other members in this structure.
223 * @vif_complete: completion for net attach.
224 * @action: either add, change, or delete.
225 * @vif: virtual interface object related to the event.
226 */
227struct brcmf_cfg80211_vif_event {
228 wait_queue_head_t vif_wq;
229 struct mutex vif_event_lock;
Arend van Sprield3c0b632013-02-08 15:53:37 +0100230 u8 action;
231 struct brcmf_cfg80211_vif *vif;
232};
233
234/**
Hante Meuleman3021ad92016-01-05 11:05:45 +0100235 * struct brcmf_cfg80211_wowl - wowl related information.
236 *
237 * @active: set on suspend, cleared on resume.
238 * @pre_pmmode: firmware PM mode at entering suspend.
239 * @nd: net dectect data.
240 * @nd_info: helper struct to pass to cfg80211.
241 * @nd_data_wait: wait queue to sync net detect data.
242 * @nd_data_completed: completion for net detect data.
243 * @nd_enabled: net detect enabled.
244 */
245struct brcmf_cfg80211_wowl {
246 bool active;
247 u32 pre_pmmode;
248 struct cfg80211_wowlan_nd_match *nd;
249 struct cfg80211_wowlan_nd_info *nd_info;
250 wait_queue_head_t nd_data_wait;
251 bool nd_data_completed;
252 bool nd_enabled;
253};
254
255/**
Arend van Spriel27a68fe2012-09-27 14:17:55 +0200256 * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface
Arend van Spriel02030eb2012-09-19 22:21:17 +0200257 *
Arend van Spriel3eacf862012-10-22 13:55:30 -0700258 * @wiphy: wiphy object for cfg80211 interface.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200259 * @conf: dongle configuration.
Arend van Spriel9f440b72013-02-08 15:53:36 +0100260 * @p2p: peer-to-peer specific information.
Piotr Haber61730d42013-04-23 12:53:12 +0200261 * @btcoex: Bluetooth coexistence information.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200262 * @scan_request: cfg80211 scan request object.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200263 * @usr_sync: mainly for dongle up/down synchronization.
264 * @bss_list: bss_list holding scanned ap information.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200265 * @bss_info: bss information for cfg80211 layer.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200266 * @conn_info: association info.
267 * @pmk_list: wpa2 pmk list.
Arend van Sprielc1179032012-10-22 13:55:33 -0700268 * @scan_status: scan activity on the dongle.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200269 * @pub: common driver information.
270 * @channel: current channel.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200271 * @active_scan: current scan mode.
272 * @sched_escan: e-scan for scheduled scan support running.
273 * @ibss_starter: indicates this sta is ibss starter.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200274 * @pwr_save: indicate whether dongle to support power save mode.
275 * @dongle_up: indicate whether dongle up or not.
276 * @roam_on: on/off switch for dongle self-roaming.
277 * @scan_tried: indicates if first scan attempted.
278 * @dcmd_buf: dcmd buffer.
279 * @extra_buf: mainly to grab assoc information.
280 * @debugfsdir: debugfs folder for this device.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200281 * @escan_info: escan information.
282 * @escan_timeout: Timer for catch scan timeout.
283 * @escan_timeout_work: scan timeout worker.
Arend van Spriel3eacf862012-10-22 13:55:30 -0700284 * @vif_list: linked list of vif instances.
285 * @vif_cnt: number of vif instances.
Arend van Sprield3c0b632013-02-08 15:53:37 +0100286 * @vif_event: vif event signalling.
Hante Meuleman3021ad92016-01-05 11:05:45 +0100287 * @wowl: wowl related information.
Arend van Spriel02030eb2012-09-19 22:21:17 +0200288 */
Arend van Spriel27a68fe2012-09-27 14:17:55 +0200289struct brcmf_cfg80211_info {
Arend van Spriel3eacf862012-10-22 13:55:30 -0700290 struct wiphy *wiphy;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200291 struct brcmf_cfg80211_conf *conf;
Arend van Spriel9f440b72013-02-08 15:53:36 +0100292 struct brcmf_p2p_info p2p;
Piotr Haber61730d42013-04-23 12:53:12 +0200293 struct brcmf_btcoex_info *btcoex;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200294 struct cfg80211_scan_request *scan_request;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200295 struct mutex usr_sync;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200296 struct wl_cfg80211_bss_info *bss_info;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200297 struct brcmf_cfg80211_connect_info conn_info;
Hante Meuleman6c404f32015-12-10 13:43:03 +0100298 struct brcmf_pmk_list_le pmk_list;
Arend van Sprielc1179032012-10-22 13:55:33 -0700299 unsigned long scan_status;
Arend van Sprielee928382012-09-19 22:21:18 +0200300 struct brcmf_pub *pub;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200301 u32 channel;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200302 bool active_scan;
303 bool sched_escan;
304 bool ibss_starter;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200305 bool pwr_save;
306 bool dongle_up;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200307 bool scan_tried;
308 u8 *dcmd_buf;
309 u8 *extra_buf;
Arend van Spriel5b435de2011-10-05 13:19:03 +0200310 struct dentry *debugfsdir;
Arend van Spriel02030eb2012-09-19 22:21:17 +0200311 struct escan_info escan_info;
312 struct timer_list escan_timeout;
313 struct work_struct escan_timeout_work;
Arend van Spriel3eacf862012-10-22 13:55:30 -0700314 struct list_head vif_list;
Arend van Sprield3c0b632013-02-08 15:53:37 +0100315 struct brcmf_cfg80211_vif_event vif_event;
Arend van Spriel5f4f9f12013-02-08 15:53:41 +0100316 struct completion vif_disabled;
Franky Lin83cf17a2013-04-11 13:28:50 +0200317 struct brcmu_d11inf d11inf;
Hante Meulemanbf2a7e02015-10-08 20:33:18 +0200318 struct brcmf_assoclist_le assoclist;
Hante Meuleman3021ad92016-01-05 11:05:45 +0100319 struct brcmf_cfg80211_wowl wowl;
Arend van Spriel5b435de2011-10-05 13:19:03 +0200320};
321
Arend van Spriel9f440b72013-02-08 15:53:36 +0100322/**
323 * struct brcmf_tlv - tag_ID/length/value_buffer tuple.
324 *
325 * @id: tag identifier.
326 * @len: number of bytes in value buffer.
327 * @data: value buffer.
328 */
329struct brcmf_tlv {
330 u8 id;
331 u8 len;
332 u8 data[1];
333};
334
Arend van Spriel3eacf862012-10-22 13:55:30 -0700335static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg)
Arend van Spriel5b435de2011-10-05 13:19:03 +0200336{
Arend van Spriel3eacf862012-10-22 13:55:30 -0700337 return cfg->wiphy;
Arend van Spriel5b435de2011-10-05 13:19:03 +0200338}
339
Arend van Spriel27a68fe2012-09-27 14:17:55 +0200340static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w)
Arend van Spriel5b435de2011-10-05 13:19:03 +0200341{
Arend van Spriel27a68fe2012-09-27 14:17:55 +0200342 return (struct brcmf_cfg80211_info *)(wiphy_priv(w));
Arend van Spriel5b435de2011-10-05 13:19:03 +0200343}
344
Arend van Spriel27a68fe2012-09-27 14:17:55 +0200345static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd)
Arend van Spriel5b435de2011-10-05 13:19:03 +0200346{
Arend van Spriel27a68fe2012-09-27 14:17:55 +0200347 return (struct brcmf_cfg80211_info *)(wdev_priv(wd));
Arend van Spriel5b435de2011-10-05 13:19:03 +0200348}
349
Arend van Spriel3eacf862012-10-22 13:55:30 -0700350static inline
351struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg)
Arend van Spriel5b435de2011-10-05 13:19:03 +0200352{
Arend van Spriel3eacf862012-10-22 13:55:30 -0700353 struct brcmf_cfg80211_vif *vif;
354 vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list);
355 return vif->wdev.netdev;
Arend van Spriel5b435de2011-10-05 13:19:03 +0200356}
357
Arend van Spriel27a68fe2012-09-27 14:17:55 +0200358static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev)
Arend van Spriel5b435de2011-10-05 13:19:03 +0200359{
360 return wdev_to_cfg(ndev->ieee80211_ptr);
361}
362
Arend van Spriel6ac4f4e2012-10-22 13:55:31 -0700363static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd)
364{
365 struct brcmf_if *ifp = netdev_priv(nd);
366 return &ifp->vif->profile;
367}
368
Arend van Spriel1332e262012-11-05 16:22:18 -0800369static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev)
370{
371 struct brcmf_if *ifp = netdev_priv(ndev);
372 return ifp->vif;
373}
374
Arend van Spriel5b435de2011-10-05 13:19:03 +0200375static inline struct
Arend van Spriel27a68fe2012-09-27 14:17:55 +0200376brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg)
Arend van Spriel5b435de2011-10-05 13:19:03 +0200377{
378 return &cfg->conn_info;
379}
380
Arend van Sprield9cb2592012-12-05 15:25:54 +0100381struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
Hante Meulemanae7c03f2015-09-18 22:08:08 +0200382 struct device *busdev,
383 bool p2pdev_forced);
Arend van Spriel27a68fe2012-09-27 14:17:55 +0200384void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
Arend van Sprielbdf5ff52012-11-14 18:46:09 -0800385s32 brcmf_cfg80211_up(struct net_device *ndev);
386s32 brcmf_cfg80211_down(struct net_device *ndev);
Arend van Spriela7965fb2013-04-11 17:08:37 +0200387enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
Arend van Spriel5b435de2011-10-05 13:19:03 +0200388
Arend van Spriel9f440b72013-02-08 15:53:36 +0100389struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
Arend van Spriel9f440b72013-02-08 15:53:36 +0100390 enum nl80211_iftype type,
391 bool pm_block);
Arend van Spriel427dec52014-01-06 12:40:47 +0100392void brcmf_free_vif(struct brcmf_cfg80211_vif *vif);
Arend van Spriel9f440b72013-02-08 15:53:36 +0100393
394s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
395 const u8 *vndr_ie_buf, u32 vndr_ie_len);
Arend van Spriel5f4f9f12013-02-08 15:53:41 +0100396s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif);
Johannes Berg4b5800f2014-01-15 14:55:59 +0100397const struct brcmf_tlv *
398brcmf_parse_tlvs(const void *buf, int buflen, uint key);
Franky Lin83cf17a2013-04-11 13:28:50 +0200399u16 channel_to_chanspec(struct brcmu_d11inf *d11inf,
400 struct ieee80211_channel *ch);
Hante Meulemanbfe81972014-10-28 14:56:16 +0100401bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg,
402 unsigned long state);
Arend van Sprield3c0b632013-02-08 15:53:37 +0100403void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
404 struct brcmf_cfg80211_vif *vif);
405bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
Arend van Spriela9eb0c42016-02-17 11:26:50 +0100406int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
407 u8 action, ulong timeout);
Hante Meuleman7a5c1f62013-02-08 15:53:44 +0100408s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
Arend van Spriela0f472a2013-04-05 10:57:49 +0200409 struct brcmf_if *ifp, bool aborted,
410 bool fw_abort);
Arend van Sprielf96aa072013-04-05 10:57:48 +0200411void brcmf_set_mpc(struct brcmf_if *ndev, int mpc);
Hante Meuleman18e2f612013-02-08 15:53:49 +0100412void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg);
Arend van Spriel9df4d542014-01-06 12:40:49 +0100413void brcmf_cfg80211_free_netdev(struct net_device *ndev);
Arend van Spriel9f440b72013-02-08 15:53:36 +0100414
Hante Meulemanbfe81972014-10-28 14:56:16 +0100415#endif /* BRCMFMAC_CFG80211_H */