Commit | Line | Data |
---|---|---|
5b435de0 AS |
1 | /* |
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 | ||
17 | #ifndef _wl_cfg80211_h_ | |
18 | #define _wl_cfg80211_h_ | |
19 | ||
5b435de0 AS |
20 | #define WL_DBG_NONE 0 |
21 | #define WL_DBG_CONN (1 << 5) | |
22 | #define WL_DBG_SCAN (1 << 4) | |
23 | #define WL_DBG_TRACE (1 << 3) | |
24 | #define WL_DBG_INFO (1 << 1) | |
25 | #define WL_DBG_ERR (1 << 0) | |
26 | #define WL_DBG_MASK ((WL_DBG_INFO | WL_DBG_ERR | WL_DBG_TRACE) | \ | |
27 | (WL_DBG_SCAN) | (WL_DBG_CONN)) | |
28 | ||
02f77195 | 29 | #define WL_ERR(fmt, ...) \ |
5b435de0 AS |
30 | do { \ |
31 | if (brcmf_dbg_level & WL_DBG_ERR) { \ | |
32 | if (net_ratelimit()) { \ | |
02f77195 JP |
33 | pr_err("ERROR @%s : " fmt, \ |
34 | __func__, ##__VA_ARGS__); \ | |
5b435de0 AS |
35 | } \ |
36 | } \ | |
37 | } while (0) | |
38 | ||
8ae74654 | 39 | #if (defined DEBUG) |
02f77195 | 40 | #define WL_INFO(fmt, ...) \ |
5b435de0 AS |
41 | do { \ |
42 | if (brcmf_dbg_level & WL_DBG_INFO) { \ | |
43 | if (net_ratelimit()) { \ | |
02f77195 JP |
44 | pr_err("INFO @%s : " fmt, \ |
45 | __func__, ##__VA_ARGS__); \ | |
5b435de0 AS |
46 | } \ |
47 | } \ | |
48 | } while (0) | |
49 | ||
02f77195 | 50 | #define WL_TRACE(fmt, ...) \ |
5b435de0 AS |
51 | do { \ |
52 | if (brcmf_dbg_level & WL_DBG_TRACE) { \ | |
53 | if (net_ratelimit()) { \ | |
02f77195 JP |
54 | pr_err("TRACE @%s : " fmt, \ |
55 | __func__, ##__VA_ARGS__); \ | |
5b435de0 AS |
56 | } \ |
57 | } \ | |
58 | } while (0) | |
59 | ||
02f77195 | 60 | #define WL_SCAN(fmt, ...) \ |
5b435de0 AS |
61 | do { \ |
62 | if (brcmf_dbg_level & WL_DBG_SCAN) { \ | |
63 | if (net_ratelimit()) { \ | |
02f77195 JP |
64 | pr_err("SCAN @%s : " fmt, \ |
65 | __func__, ##__VA_ARGS__); \ | |
5b435de0 AS |
66 | } \ |
67 | } \ | |
68 | } while (0) | |
69 | ||
02f77195 | 70 | #define WL_CONN(fmt, ...) \ |
5b435de0 AS |
71 | do { \ |
72 | if (brcmf_dbg_level & WL_DBG_CONN) { \ | |
73 | if (net_ratelimit()) { \ | |
02f77195 JP |
74 | pr_err("CONN @%s : " fmt, \ |
75 | __func__, ##__VA_ARGS__); \ | |
5b435de0 AS |
76 | } \ |
77 | } \ | |
78 | } while (0) | |
79 | ||
8ae74654 | 80 | #else /* (defined DEBUG) */ |
5b435de0 AS |
81 | #define WL_INFO(fmt, args...) |
82 | #define WL_TRACE(fmt, args...) | |
83 | #define WL_SCAN(fmt, args...) | |
84 | #define WL_CONN(fmt, args...) | |
8ae74654 | 85 | #endif /* (defined DEBUG) */ |
5b435de0 AS |
86 | |
87 | #define WL_NUM_SCAN_MAX 1 | |
88 | #define WL_NUM_PMKIDS_MAX MAXPMKID /* will be used | |
89 | * for 2.6.33 kernel | |
90 | * or later | |
91 | */ | |
92 | #define WL_SCAN_BUF_MAX (1024 * 8) | |
93 | #define WL_TLV_INFO_MAX 1024 | |
94 | #define WL_BSS_INFO_MAX 2048 | |
95 | #define WL_ASSOC_INFO_MAX 512 /* | |
96 | * needs to grab assoc info from dongle to | |
97 | * report it to cfg80211 through "connect" | |
98 | * event | |
99 | */ | |
100 | #define WL_DCMD_LEN_MAX 1024 | |
101 | #define WL_EXTRA_BUF_MAX 2048 | |
102 | #define WL_ISCAN_BUF_MAX 2048 /* | |
103 | * the buf length can be BRCMF_DCMD_MAXLEN | |
104 | * to reduce iteration | |
105 | */ | |
106 | #define WL_ISCAN_TIMER_INTERVAL_MS 3000 | |
107 | #define WL_SCAN_ERSULTS_LAST (BRCMF_SCAN_RESULTS_NO_MEM+1) | |
108 | #define WL_AP_MAX 256 /* virtually unlimitted as long | |
109 | * as kernel memory allows | |
110 | */ | |
111 | ||
112 | #define WL_ROAM_TRIGGER_LEVEL -75 | |
113 | #define WL_ROAM_DELTA 20 | |
114 | #define WL_BEACON_TIMEOUT 3 | |
115 | ||
116 | #define WL_SCAN_CHANNEL_TIME 40 | |
117 | #define WL_SCAN_UNASSOC_TIME 40 | |
118 | #define WL_SCAN_PASSIVE_TIME 120 | |
119 | ||
e756af5b HM |
120 | #define WL_ESCAN_BUF_SIZE (1024 * 64) |
121 | #define WL_ESCAN_TIMER_INTERVAL_MS 8000 /* E-Scan timeout */ | |
122 | ||
123 | #define WL_ESCAN_ACTION_START 1 | |
124 | #define WL_ESCAN_ACTION_CONTINUE 2 | |
125 | #define WL_ESCAN_ACTION_ABORT 3 | |
126 | ||
f09d0c02 | 127 | #define WL_AUTH_SHARED_KEY 1 /* d11 shared authentication */ |
1a873342 | 128 | #define IE_MAX_LEN 512 |
f09d0c02 | 129 | |
c1179033 AS |
130 | /** |
131 | * enum brcmf_scan_status - dongle scan status | |
132 | * | |
133 | * @BRCMF_SCAN_STATUS_BUSY: scanning in progress on dongle. | |
134 | * @BRCMF_SCAN_STATUS_ABORT: scan being aborted on dongle. | |
135 | */ | |
136 | enum brcmf_scan_status { | |
137 | BRCMF_SCAN_STATUS_BUSY, | |
138 | BRCMF_SCAN_STATUS_ABORT, | |
5b435de0 AS |
139 | }; |
140 | ||
141 | /* wi-fi mode */ | |
142 | enum wl_mode { | |
143 | WL_MODE_BSS, | |
144 | WL_MODE_IBSS, | |
145 | WL_MODE_AP | |
146 | }; | |
147 | ||
148 | /* dongle profile list */ | |
149 | enum wl_prof_list { | |
150 | WL_PROF_MODE, | |
151 | WL_PROF_SSID, | |
152 | WL_PROF_SEC, | |
153 | WL_PROF_IBSS, | |
154 | WL_PROF_BAND, | |
155 | WL_PROF_BSSID, | |
156 | WL_PROF_ACT, | |
157 | WL_PROF_BEACONINT, | |
158 | WL_PROF_DTIMPERIOD | |
159 | }; | |
160 | ||
161 | /* dongle iscan state */ | |
162 | enum wl_iscan_state { | |
163 | WL_ISCAN_STATE_IDLE, | |
164 | WL_ISCAN_STATE_SCANING | |
165 | }; | |
166 | ||
167 | /* dongle configuration */ | |
168 | struct brcmf_cfg80211_conf { | |
169 | u32 mode; /* adhoc , infrastructure or ap */ | |
170 | u32 frag_threshold; | |
171 | u32 rts_threshold; | |
172 | u32 retry_short; | |
173 | u32 retry_long; | |
174 | s32 tx_power; | |
175 | struct ieee80211_channel channel; | |
176 | }; | |
177 | ||
5db6e956 | 178 | /* forward declaration */ |
27a68fe3 | 179 | struct brcmf_cfg80211_info; |
5db6e956 | 180 | |
5b435de0 AS |
181 | /* cfg80211 main event loop */ |
182 | struct brcmf_cfg80211_event_loop { | |
27a68fe3 | 183 | s32(*handler[BRCMF_E_LAST]) (struct brcmf_cfg80211_info *cfg, |
5b435de0 AS |
184 | struct net_device *ndev, |
185 | const struct brcmf_event_msg *e, | |
186 | void *data); | |
187 | }; | |
188 | ||
5b435de0 AS |
189 | /* basic structure of scan request */ |
190 | struct brcmf_cfg80211_scan_req { | |
191 | struct brcmf_ssid_le ssid_le; | |
192 | }; | |
193 | ||
194 | /* basic structure of information element */ | |
195 | struct brcmf_cfg80211_ie { | |
196 | u16 offset; | |
197 | u8 buf[WL_TLV_INFO_MAX]; | |
198 | }; | |
199 | ||
200 | /* event queue for cfg80211 main event */ | |
201 | struct brcmf_cfg80211_event_q { | |
202 | struct list_head evt_q_list; | |
203 | u32 etype; | |
204 | struct brcmf_event_msg emsg; | |
205 | s8 edata[1]; | |
206 | }; | |
207 | ||
208 | /* security information with currently associated ap */ | |
209 | struct brcmf_cfg80211_security { | |
210 | u32 wpa_versions; | |
211 | u32 auth_type; | |
212 | u32 cipher_pairwise; | |
213 | u32 cipher_group; | |
214 | u32 wpa_auth; | |
215 | }; | |
216 | ||
217 | /* ibss information for currently joined ibss network */ | |
218 | struct brcmf_cfg80211_ibss { | |
219 | u8 beacon_interval; /* in millisecond */ | |
220 | u8 atim; /* in millisecond */ | |
221 | s8 join_only; | |
222 | u8 band; | |
223 | u8 channel; | |
224 | }; | |
225 | ||
226 | /* dongle profile */ | |
227 | struct brcmf_cfg80211_profile { | |
228 | u32 mode; | |
229 | struct brcmf_ssid ssid; | |
230 | u8 bssid[ETH_ALEN]; | |
5b435de0 AS |
231 | struct brcmf_cfg80211_security sec; |
232 | struct brcmf_cfg80211_ibss ibss; | |
233 | s32 band; | |
234 | }; | |
235 | ||
c1179033 AS |
236 | /** |
237 | * enum brcmf_vif_status - bit indices for vif status. | |
238 | * | |
239 | * @BRCMF_VIF_STATUS_READY: ready for operation. | |
240 | * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress. | |
241 | * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully. | |
242 | * @BRCMF_VIF_STATUS_AP_CREATING: interface configured for AP operation. | |
243 | * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started. | |
244 | */ | |
245 | enum brcmf_vif_status { | |
246 | BRCMF_VIF_STATUS_READY, | |
247 | BRCMF_VIF_STATUS_CONNECTING, | |
248 | BRCMF_VIF_STATUS_CONNECTED, | |
249 | BRCMF_VIF_STATUS_AP_CREATING, | |
250 | BRCMF_VIF_STATUS_AP_CREATED | |
251 | }; | |
252 | ||
3eacf866 AS |
253 | /** |
254 | * struct brcmf_cfg80211_vif - virtual interface specific information. | |
255 | * | |
256 | * @ifp: lower layer interface pointer | |
257 | * @wdev: wireless device. | |
6ac4f4ed | 258 | * @profile: profile information. |
3eacf866 AS |
259 | * @mode: operating mode. |
260 | * @roam_off: roaming state. | |
c1179033 | 261 | * @sme_state: SME state using enum brcmf_vif_status bits. |
3eacf866 AS |
262 | * @pm_block: power-management blocked. |
263 | * @list: linked list. | |
264 | */ | |
265 | struct brcmf_cfg80211_vif { | |
266 | struct brcmf_if *ifp; | |
267 | struct wireless_dev wdev; | |
6ac4f4ed | 268 | struct brcmf_cfg80211_profile profile; |
3eacf866 AS |
269 | s32 mode; |
270 | s32 roam_off; | |
c1179033 | 271 | unsigned long sme_state; |
3eacf866 AS |
272 | bool pm_block; |
273 | struct list_head list; | |
274 | }; | |
275 | ||
5b435de0 AS |
276 | /* dongle iscan event loop */ |
277 | struct brcmf_cfg80211_iscan_eloop { | |
278 | s32 (*handler[WL_SCAN_ERSULTS_LAST]) | |
27a68fe3 | 279 | (struct brcmf_cfg80211_info *cfg); |
5b435de0 AS |
280 | }; |
281 | ||
282 | /* dongle iscan controller */ | |
283 | struct brcmf_cfg80211_iscan_ctrl { | |
284 | struct net_device *ndev; | |
285 | struct timer_list timer; | |
286 | u32 timer_ms; | |
287 | u32 timer_on; | |
288 | s32 state; | |
289 | struct work_struct work; | |
290 | struct brcmf_cfg80211_iscan_eloop el; | |
291 | void *data; | |
292 | s8 dcmd_buf[BRCMF_DCMD_SMLEN]; | |
293 | s8 scan_buf[WL_ISCAN_BUF_MAX]; | |
294 | }; | |
295 | ||
296 | /* association inform */ | |
297 | struct brcmf_cfg80211_connect_info { | |
298 | u8 *req_ie; | |
299 | s32 req_ie_len; | |
300 | u8 *resp_ie; | |
301 | s32 resp_ie_len; | |
302 | }; | |
303 | ||
304 | /* assoc ie length */ | |
c4e382d2 AS |
305 | struct brcmf_cfg80211_assoc_ielen_le { |
306 | __le32 req_len; | |
307 | __le32 resp_len; | |
5b435de0 AS |
308 | }; |
309 | ||
310 | /* wpa2 pmk list */ | |
311 | struct brcmf_cfg80211_pmk_list { | |
312 | struct pmkid_list pmkids; | |
313 | struct pmkid foo[MAXPMKID - 1]; | |
314 | }; | |
315 | ||
e756af5b HM |
316 | /* dongle escan state */ |
317 | enum wl_escan_state { | |
318 | WL_ESCAN_STATE_IDLE, | |
319 | WL_ESCAN_STATE_SCANNING | |
320 | }; | |
321 | ||
322 | struct escan_info { | |
323 | u32 escan_state; | |
324 | u8 escan_buf[WL_ESCAN_BUF_SIZE]; | |
325 | struct wiphy *wiphy; | |
326 | struct net_device *ndev; | |
327 | }; | |
328 | ||
1a873342 HM |
329 | /* Structure to hold WPS, WPA IEs for a AP */ |
330 | struct ap_info { | |
331 | u8 probe_res_ie[IE_MAX_LEN]; | |
332 | u8 beacon_ie[IE_MAX_LEN]; | |
333 | u32 probe_res_ie_len; | |
334 | u32 beacon_ie_len; | |
335 | u8 *wpa_ie; | |
336 | u8 *rsn_ie; | |
337 | bool security_mode; | |
338 | }; | |
339 | ||
e5806072 AS |
340 | /** |
341 | * struct brcmf_pno_param_le - PNO scan configuration parameters | |
342 | * | |
343 | * @version: PNO parameters version. | |
344 | * @scan_freq: scan frequency. | |
345 | * @lost_network_timeout: #sec. to declare discovered network as lost. | |
346 | * @flags: Bit field to control features of PFN such as sort criteria auto | |
347 | * enable switch and background scan. | |
348 | * @rssi_margin: Margin to avoid jitter for choosing a PFN based on RSSI sort | |
349 | * criteria. | |
350 | * @bestn: number of best networks in each scan. | |
351 | * @mscan: number of scans recorded. | |
352 | * @repeat: minimum number of scan intervals before scan frequency changes | |
353 | * in adaptive scan. | |
354 | * @exp: exponent of 2 for maximum scan interval. | |
355 | * @slow_freq: slow scan period. | |
356 | */ | |
357 | struct brcmf_pno_param_le { | |
358 | __le32 version; | |
359 | __le32 scan_freq; | |
360 | __le32 lost_network_timeout; | |
361 | __le16 flags; | |
362 | __le16 rssi_margin; | |
363 | u8 bestn; | |
364 | u8 mscan; | |
365 | u8 repeat; | |
366 | u8 exp; | |
367 | __le32 slow_freq; | |
368 | }; | |
369 | ||
370 | /** | |
371 | * struct brcmf_pno_net_param_le - scan parameters per preferred network. | |
372 | * | |
373 | * @ssid: ssid name and its length. | |
374 | * @flags: bit2: hidden. | |
375 | * @infra: BSS vs IBSS. | |
376 | * @auth: Open vs Closed. | |
377 | * @wpa_auth: WPA type. | |
378 | * @wsec: wsec value. | |
379 | */ | |
380 | struct brcmf_pno_net_param_le { | |
381 | struct brcmf_ssid_le ssid; | |
382 | __le32 flags; | |
383 | __le32 infra; | |
384 | __le32 auth; | |
385 | __le32 wpa_auth; | |
386 | __le32 wsec; | |
387 | }; | |
388 | ||
389 | /** | |
390 | * struct brcmf_pno_net_info_le - information per found network. | |
391 | * | |
392 | * @bssid: BSS network identifier. | |
393 | * @channel: channel number only. | |
394 | * @SSID_len: length of ssid. | |
395 | * @SSID: ssid characters. | |
396 | * @RSSI: receive signal strength (in dBm). | |
397 | * @timestamp: age in seconds. | |
398 | */ | |
399 | struct brcmf_pno_net_info_le { | |
400 | u8 bssid[ETH_ALEN]; | |
401 | u8 channel; | |
402 | u8 SSID_len; | |
403 | u8 SSID[32]; | |
404 | __le16 RSSI; | |
405 | __le16 timestamp; | |
406 | }; | |
407 | ||
408 | /** | |
409 | * struct brcmf_pno_scanresults_le - result returned in PNO NET FOUND event. | |
410 | * | |
411 | * @version: PNO version identifier. | |
412 | * @status: indicates completion status of PNO scan. | |
413 | * @count: amount of brcmf_pno_net_info_le entries appended. | |
414 | */ | |
415 | struct brcmf_pno_scanresults_le { | |
416 | __le32 version; | |
417 | __le32 status; | |
418 | __le32 count; | |
419 | }; | |
420 | ||
02030eb6 | 421 | /** |
27a68fe3 | 422 | * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface |
02030eb6 | 423 | * |
3eacf866 | 424 | * @wiphy: wiphy object for cfg80211 interface. |
02030eb6 AS |
425 | * @conf: dongle configuration. |
426 | * @scan_request: cfg80211 scan request object. | |
427 | * @el: main event loop. | |
428 | * @evt_q_list: used for event queue. | |
429 | * @evt_q_lock: for event queue synchronization. | |
430 | * @usr_sync: mainly for dongle up/down synchronization. | |
431 | * @bss_list: bss_list holding scanned ap information. | |
432 | * @scan_results: results of the last scan. | |
433 | * @scan_req_int: internal scan request object. | |
434 | * @bss_info: bss information for cfg80211 layer. | |
435 | * @ie: information element object for internal purpose. | |
02030eb6 AS |
436 | * @iscan: iscan controller information. |
437 | * @conn_info: association info. | |
438 | * @pmk_list: wpa2 pmk list. | |
439 | * @event_work: event handler work struct. | |
c1179033 | 440 | * @scan_status: scan activity on the dongle. |
02030eb6 AS |
441 | * @pub: common driver information. |
442 | * @channel: current channel. | |
443 | * @iscan_on: iscan on/off switch. | |
444 | * @iscan_kickstart: indicate iscan already started. | |
445 | * @active_scan: current scan mode. | |
446 | * @sched_escan: e-scan for scheduled scan support running. | |
447 | * @ibss_starter: indicates this sta is ibss starter. | |
448 | * @link_up: link/connection up flag. | |
449 | * @pwr_save: indicate whether dongle to support power save mode. | |
450 | * @dongle_up: indicate whether dongle up or not. | |
451 | * @roam_on: on/off switch for dongle self-roaming. | |
452 | * @scan_tried: indicates if first scan attempted. | |
453 | * @dcmd_buf: dcmd buffer. | |
454 | * @extra_buf: mainly to grab assoc information. | |
455 | * @debugfsdir: debugfs folder for this device. | |
456 | * @escan_on: escan on/off switch. | |
457 | * @escan_info: escan information. | |
458 | * @escan_timeout: Timer for catch scan timeout. | |
459 | * @escan_timeout_work: scan timeout worker. | |
460 | * @escan_ioctl_buf: dongle command buffer for escan commands. | |
1a873342 | 461 | * @ap_info: host ap information. |
3eacf866 AS |
462 | * @vif_list: linked list of vif instances. |
463 | * @vif_cnt: number of vif instances. | |
02030eb6 | 464 | */ |
27a68fe3 | 465 | struct brcmf_cfg80211_info { |
3eacf866 | 466 | struct wiphy *wiphy; |
02030eb6 AS |
467 | struct brcmf_cfg80211_conf *conf; |
468 | struct cfg80211_scan_request *scan_request; | |
469 | struct brcmf_cfg80211_event_loop el; | |
470 | struct list_head evt_q_list; | |
471 | spinlock_t evt_q_lock; | |
472 | struct mutex usr_sync; | |
473 | struct brcmf_scan_results *bss_list; | |
5b435de0 | 474 | struct brcmf_scan_results *scan_results; |
02030eb6 AS |
475 | struct brcmf_cfg80211_scan_req *scan_req_int; |
476 | struct wl_cfg80211_bss_info *bss_info; | |
477 | struct brcmf_cfg80211_ie ie; | |
02030eb6 AS |
478 | struct brcmf_cfg80211_iscan_ctrl *iscan; |
479 | struct brcmf_cfg80211_connect_info conn_info; | |
480 | struct brcmf_cfg80211_pmk_list *pmk_list; | |
481 | struct work_struct event_work; | |
c1179033 | 482 | unsigned long scan_status; |
ee928381 | 483 | struct brcmf_pub *pub; |
02030eb6 AS |
484 | u32 channel; |
485 | bool iscan_on; | |
486 | bool iscan_kickstart; | |
487 | bool active_scan; | |
488 | bool sched_escan; | |
489 | bool ibss_starter; | |
490 | bool link_up; | |
491 | bool pwr_save; | |
492 | bool dongle_up; | |
493 | bool roam_on; | |
494 | bool scan_tried; | |
495 | u8 *dcmd_buf; | |
496 | u8 *extra_buf; | |
5b435de0 | 497 | struct dentry *debugfsdir; |
02030eb6 AS |
498 | bool escan_on; |
499 | struct escan_info escan_info; | |
500 | struct timer_list escan_timeout; | |
501 | struct work_struct escan_timeout_work; | |
e756af5b | 502 | u8 *escan_ioctl_buf; |
1a873342 | 503 | struct ap_info *ap_info; |
3eacf866 AS |
504 | struct list_head vif_list; |
505 | u8 vif_cnt; | |
5b435de0 AS |
506 | }; |
507 | ||
3eacf866 | 508 | static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg) |
5b435de0 | 509 | { |
3eacf866 | 510 | return cfg->wiphy; |
5b435de0 AS |
511 | } |
512 | ||
27a68fe3 | 513 | static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w) |
5b435de0 | 514 | { |
27a68fe3 | 515 | return (struct brcmf_cfg80211_info *)(wiphy_priv(w)); |
5b435de0 AS |
516 | } |
517 | ||
27a68fe3 | 518 | static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd) |
5b435de0 | 519 | { |
27a68fe3 | 520 | return (struct brcmf_cfg80211_info *)(wdev_priv(wd)); |
5b435de0 AS |
521 | } |
522 | ||
3eacf866 AS |
523 | static inline |
524 | struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg) | |
5b435de0 | 525 | { |
3eacf866 AS |
526 | struct brcmf_cfg80211_vif *vif; |
527 | vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list); | |
528 | return vif->wdev.netdev; | |
5b435de0 AS |
529 | } |
530 | ||
27a68fe3 | 531 | static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev) |
5b435de0 AS |
532 | { |
533 | return wdev_to_cfg(ndev->ieee80211_ptr); | |
534 | } | |
535 | ||
6ac4f4ed AS |
536 | static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd) |
537 | { | |
538 | struct brcmf_if *ifp = netdev_priv(nd); | |
539 | return &ifp->vif->profile; | |
540 | } | |
541 | ||
27a68fe3 | 542 | #define iscan_to_cfg(i) ((struct brcmf_cfg80211_info *)(i->data)) |
5b435de0 AS |
543 | #define cfg_to_iscan(w) (w->iscan) |
544 | ||
545 | static inline struct | |
27a68fe3 | 546 | brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg) |
5b435de0 AS |
547 | { |
548 | return &cfg->conn_info; | |
549 | } | |
550 | ||
1ed9baf0 | 551 | struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr); |
27a68fe3 | 552 | void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); |
5b435de0 AS |
553 | |
554 | /* event handler from dongle */ | |
c3567a04 AS |
555 | void brcmf_cfg80211_event(struct net_device *ndev, |
556 | const struct brcmf_event_msg *e, void *data); | |
27a68fe3 AS |
557 | s32 brcmf_cfg80211_up(struct brcmf_cfg80211_info *cfg); |
558 | s32 brcmf_cfg80211_down(struct brcmf_cfg80211_info *cfg); | |
5b435de0 AS |
559 | |
560 | #endif /* _wl_cfg80211_h_ */ |