diff options
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h | 296 |
1 files changed, 222 insertions, 74 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h index b5d9b36df3d0..71ced174748a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h | |||
@@ -17,12 +17,6 @@ | |||
17 | #ifndef _wl_cfg80211_h_ | 17 | #ifndef _wl_cfg80211_h_ |
18 | #define _wl_cfg80211_h_ | 18 | #define _wl_cfg80211_h_ |
19 | 19 | ||
20 | struct brcmf_cfg80211_conf; | ||
21 | struct brcmf_cfg80211_iface; | ||
22 | struct brcmf_cfg80211_priv; | ||
23 | struct brcmf_cfg80211_security; | ||
24 | struct brcmf_cfg80211_ibss; | ||
25 | |||
26 | #define WL_DBG_NONE 0 | 20 | #define WL_DBG_NONE 0 |
27 | #define WL_DBG_CONN (1 << 5) | 21 | #define WL_DBG_CONN (1 << 5) |
28 | #define WL_DBG_SCAN (1 << 4) | 22 | #define WL_DBG_SCAN (1 << 4) |
@@ -123,13 +117,25 @@ do { \ | |||
123 | #define WL_SCAN_UNASSOC_TIME 40 | 117 | #define WL_SCAN_UNASSOC_TIME 40 |
124 | #define WL_SCAN_PASSIVE_TIME 120 | 118 | #define WL_SCAN_PASSIVE_TIME 120 |
125 | 119 | ||
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 | |||
127 | #define WL_AUTH_SHARED_KEY 1 /* d11 shared authentication */ | ||
128 | #define IE_MAX_LEN 512 | ||
129 | |||
126 | /* dongle status */ | 130 | /* dongle status */ |
127 | enum wl_status { | 131 | enum wl_status { |
128 | WL_STATUS_READY, | 132 | WL_STATUS_READY, |
129 | WL_STATUS_SCANNING, | 133 | WL_STATUS_SCANNING, |
130 | WL_STATUS_SCAN_ABORTING, | 134 | WL_STATUS_SCAN_ABORTING, |
131 | WL_STATUS_CONNECTING, | 135 | WL_STATUS_CONNECTING, |
132 | WL_STATUS_CONNECTED | 136 | WL_STATUS_CONNECTED, |
137 | WL_STATUS_AP_CREATING, | ||
138 | WL_STATUS_AP_CREATED | ||
133 | }; | 139 | }; |
134 | 140 | ||
135 | /* wi-fi mode */ | 141 | /* wi-fi mode */ |
@@ -169,23 +175,17 @@ struct brcmf_cfg80211_conf { | |||
169 | struct ieee80211_channel channel; | 175 | struct ieee80211_channel channel; |
170 | }; | 176 | }; |
171 | 177 | ||
178 | /* forward declaration */ | ||
179 | struct brcmf_cfg80211_info; | ||
180 | |||
172 | /* cfg80211 main event loop */ | 181 | /* cfg80211 main event loop */ |
173 | struct brcmf_cfg80211_event_loop { | 182 | struct brcmf_cfg80211_event_loop { |
174 | s32(*handler[BRCMF_E_LAST]) (struct brcmf_cfg80211_priv *cfg_priv, | 183 | s32(*handler[BRCMF_E_LAST]) (struct brcmf_cfg80211_info *cfg, |
175 | struct net_device *ndev, | 184 | struct net_device *ndev, |
176 | const struct brcmf_event_msg *e, | 185 | const struct brcmf_event_msg *e, |
177 | void *data); | 186 | void *data); |
178 | }; | 187 | }; |
179 | 188 | ||
180 | /* representing interface of cfg80211 plane */ | ||
181 | struct brcmf_cfg80211_iface { | ||
182 | struct brcmf_cfg80211_priv *cfg_priv; | ||
183 | }; | ||
184 | |||
185 | struct brcmf_cfg80211_dev { | ||
186 | void *driver_data; /* to store cfg80211 object information */ | ||
187 | }; | ||
188 | |||
189 | /* basic structure of scan request */ | 189 | /* basic structure of scan request */ |
190 | struct brcmf_cfg80211_scan_req { | 190 | struct brcmf_cfg80211_scan_req { |
191 | struct brcmf_ssid_le ssid_le; | 191 | struct brcmf_ssid_le ssid_le; |
@@ -238,7 +238,7 @@ struct brcmf_cfg80211_profile { | |||
238 | /* dongle iscan event loop */ | 238 | /* dongle iscan event loop */ |
239 | struct brcmf_cfg80211_iscan_eloop { | 239 | struct brcmf_cfg80211_iscan_eloop { |
240 | s32 (*handler[WL_SCAN_ERSULTS_LAST]) | 240 | s32 (*handler[WL_SCAN_ERSULTS_LAST]) |
241 | (struct brcmf_cfg80211_priv *cfg_priv); | 241 | (struct brcmf_cfg80211_info *cfg); |
242 | }; | 242 | }; |
243 | 243 | ||
244 | /* dongle iscan controller */ | 244 | /* dongle iscan controller */ |
@@ -275,92 +275,240 @@ struct brcmf_cfg80211_pmk_list { | |||
275 | struct pmkid foo[MAXPMKID - 1]; | 275 | struct pmkid foo[MAXPMKID - 1]; |
276 | }; | 276 | }; |
277 | 277 | ||
278 | /* dongle private data of cfg80211 interface */ | 278 | /* dongle escan state */ |
279 | struct brcmf_cfg80211_priv { | 279 | enum wl_escan_state { |
280 | struct wireless_dev *wdev; /* representing wl cfg80211 device */ | 280 | WL_ESCAN_STATE_IDLE, |
281 | struct brcmf_cfg80211_conf *conf; /* dongle configuration */ | 281 | WL_ESCAN_STATE_SCANNING |
282 | struct cfg80211_scan_request *scan_request; /* scan request | 282 | }; |
283 | object */ | 283 | |
284 | struct brcmf_cfg80211_event_loop el; /* main event loop */ | 284 | struct escan_info { |
285 | struct list_head evt_q_list; /* used for event queue */ | 285 | u32 escan_state; |
286 | spinlock_t evt_q_lock; /* for event queue synchronization */ | 286 | u8 escan_buf[WL_ESCAN_BUF_SIZE]; |
287 | struct mutex usr_sync; /* maily for dongle up/down synchronization */ | 287 | struct wiphy *wiphy; |
288 | struct brcmf_scan_results *bss_list; /* bss_list holding scanned | 288 | struct net_device *ndev; |
289 | ap information */ | 289 | }; |
290 | |||
291 | /* Structure to hold WPS, WPA IEs for a AP */ | ||
292 | struct ap_info { | ||
293 | u8 probe_res_ie[IE_MAX_LEN]; | ||
294 | u8 beacon_ie[IE_MAX_LEN]; | ||
295 | u32 probe_res_ie_len; | ||
296 | u32 beacon_ie_len; | ||
297 | u8 *wpa_ie; | ||
298 | u8 *rsn_ie; | ||
299 | bool security_mode; | ||
300 | }; | ||
301 | |||
302 | /** | ||
303 | * struct brcmf_pno_param_le - PNO scan configuration parameters | ||
304 | * | ||
305 | * @version: PNO parameters version. | ||
306 | * @scan_freq: scan frequency. | ||
307 | * @lost_network_timeout: #sec. to declare discovered network as lost. | ||
308 | * @flags: Bit field to control features of PFN such as sort criteria auto | ||
309 | * enable switch and background scan. | ||
310 | * @rssi_margin: Margin to avoid jitter for choosing a PFN based on RSSI sort | ||
311 | * criteria. | ||
312 | * @bestn: number of best networks in each scan. | ||
313 | * @mscan: number of scans recorded. | ||
314 | * @repeat: minimum number of scan intervals before scan frequency changes | ||
315 | * in adaptive scan. | ||
316 | * @exp: exponent of 2 for maximum scan interval. | ||
317 | * @slow_freq: slow scan period. | ||
318 | */ | ||
319 | struct brcmf_pno_param_le { | ||
320 | __le32 version; | ||
321 | __le32 scan_freq; | ||
322 | __le32 lost_network_timeout; | ||
323 | __le16 flags; | ||
324 | __le16 rssi_margin; | ||
325 | u8 bestn; | ||
326 | u8 mscan; | ||
327 | u8 repeat; | ||
328 | u8 exp; | ||
329 | __le32 slow_freq; | ||
330 | }; | ||
331 | |||
332 | /** | ||
333 | * struct brcmf_pno_net_param_le - scan parameters per preferred network. | ||
334 | * | ||
335 | * @ssid: ssid name and its length. | ||
336 | * @flags: bit2: hidden. | ||
337 | * @infra: BSS vs IBSS. | ||
338 | * @auth: Open vs Closed. | ||
339 | * @wpa_auth: WPA type. | ||
340 | * @wsec: wsec value. | ||
341 | */ | ||
342 | struct brcmf_pno_net_param_le { | ||
343 | struct brcmf_ssid_le ssid; | ||
344 | __le32 flags; | ||
345 | __le32 infra; | ||
346 | __le32 auth; | ||
347 | __le32 wpa_auth; | ||
348 | __le32 wsec; | ||
349 | }; | ||
350 | |||
351 | /** | ||
352 | * struct brcmf_pno_net_info_le - information per found network. | ||
353 | * | ||
354 | * @bssid: BSS network identifier. | ||
355 | * @channel: channel number only. | ||
356 | * @SSID_len: length of ssid. | ||
357 | * @SSID: ssid characters. | ||
358 | * @RSSI: receive signal strength (in dBm). | ||
359 | * @timestamp: age in seconds. | ||
360 | */ | ||
361 | struct brcmf_pno_net_info_le { | ||
362 | u8 bssid[ETH_ALEN]; | ||
363 | u8 channel; | ||
364 | u8 SSID_len; | ||
365 | u8 SSID[32]; | ||
366 | __le16 RSSI; | ||
367 | __le16 timestamp; | ||
368 | }; | ||
369 | |||
370 | /** | ||
371 | * struct brcmf_pno_scanresults_le - result returned in PNO NET FOUND event. | ||
372 | * | ||
373 | * @version: PNO version identifier. | ||
374 | * @status: indicates completion status of PNO scan. | ||
375 | * @count: amount of brcmf_pno_net_info_le entries appended. | ||
376 | */ | ||
377 | struct brcmf_pno_scanresults_le { | ||
378 | __le32 version; | ||
379 | __le32 status; | ||
380 | __le32 count; | ||
381 | }; | ||
382 | |||
383 | /** | ||
384 | * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface | ||
385 | * | ||
386 | * @wdev: representing wl cfg80211 device. | ||
387 | * @conf: dongle configuration. | ||
388 | * @scan_request: cfg80211 scan request object. | ||
389 | * @el: main event loop. | ||
390 | * @evt_q_list: used for event queue. | ||
391 | * @evt_q_lock: for event queue synchronization. | ||
392 | * @usr_sync: mainly for dongle up/down synchronization. | ||
393 | * @bss_list: bss_list holding scanned ap information. | ||
394 | * @scan_results: results of the last scan. | ||
395 | * @scan_req_int: internal scan request object. | ||
396 | * @bss_info: bss information for cfg80211 layer. | ||
397 | * @ie: information element object for internal purpose. | ||
398 | * @profile: holding dongle profile. | ||
399 | * @iscan: iscan controller information. | ||
400 | * @conn_info: association info. | ||
401 | * @pmk_list: wpa2 pmk list. | ||
402 | * @event_work: event handler work struct. | ||
403 | * @status: current dongle status. | ||
404 | * @pub: common driver information. | ||
405 | * @channel: current channel. | ||
406 | * @iscan_on: iscan on/off switch. | ||
407 | * @iscan_kickstart: indicate iscan already started. | ||
408 | * @active_scan: current scan mode. | ||
409 | * @sched_escan: e-scan for scheduled scan support running. | ||
410 | * @ibss_starter: indicates this sta is ibss starter. | ||
411 | * @link_up: link/connection up flag. | ||
412 | * @pwr_save: indicate whether dongle to support power save mode. | ||
413 | * @dongle_up: indicate whether dongle up or not. | ||
414 | * @roam_on: on/off switch for dongle self-roaming. | ||
415 | * @scan_tried: indicates if first scan attempted. | ||
416 | * @dcmd_buf: dcmd buffer. | ||
417 | * @extra_buf: mainly to grab assoc information. | ||
418 | * @debugfsdir: debugfs folder for this device. | ||
419 | * @escan_on: escan on/off switch. | ||
420 | * @escan_info: escan information. | ||
421 | * @escan_timeout: Timer for catch scan timeout. | ||
422 | * @escan_timeout_work: scan timeout worker. | ||
423 | * @escan_ioctl_buf: dongle command buffer for escan commands. | ||
424 | * @ap_info: host ap information. | ||
425 | * @ci: used to link this structure to netdev private data. | ||
426 | */ | ||
427 | struct brcmf_cfg80211_info { | ||
428 | struct wireless_dev *wdev; | ||
429 | struct brcmf_cfg80211_conf *conf; | ||
430 | struct cfg80211_scan_request *scan_request; | ||
431 | struct brcmf_cfg80211_event_loop el; | ||
432 | struct list_head evt_q_list; | ||
433 | spinlock_t evt_q_lock; | ||
434 | struct mutex usr_sync; | ||
435 | struct brcmf_scan_results *bss_list; | ||
290 | struct brcmf_scan_results *scan_results; | 436 | struct brcmf_scan_results *scan_results; |
291 | struct brcmf_cfg80211_scan_req *scan_req_int; /* scan request object | 437 | struct brcmf_cfg80211_scan_req *scan_req_int; |
292 | for internal purpose */ | 438 | struct wl_cfg80211_bss_info *bss_info; |
293 | struct wl_cfg80211_bss_info *bss_info; /* bss information for | 439 | struct brcmf_cfg80211_ie ie; |
294 | cfg80211 layer */ | 440 | struct brcmf_cfg80211_profile *profile; |
295 | struct brcmf_cfg80211_ie ie; /* information element object for | 441 | struct brcmf_cfg80211_iscan_ctrl *iscan; |
296 | internal purpose */ | 442 | struct brcmf_cfg80211_connect_info conn_info; |
297 | struct brcmf_cfg80211_profile *profile; /* holding dongle profile */ | 443 | struct brcmf_cfg80211_pmk_list *pmk_list; |
298 | struct brcmf_cfg80211_iscan_ctrl *iscan; /* iscan controller */ | 444 | struct work_struct event_work; |
299 | struct brcmf_cfg80211_connect_info conn_info; /* association info */ | 445 | unsigned long status; |
300 | struct brcmf_cfg80211_pmk_list *pmk_list; /* wpa2 pmk list */ | 446 | struct brcmf_pub *pub; |
301 | struct work_struct event_work; /* event handler work struct */ | 447 | u32 channel; |
302 | unsigned long status; /* current dongle status */ | 448 | bool iscan_on; |
303 | void *pub; | 449 | bool iscan_kickstart; |
304 | u32 channel; /* current channel */ | 450 | bool active_scan; |
305 | bool iscan_on; /* iscan on/off switch */ | 451 | bool sched_escan; |
306 | bool iscan_kickstart; /* indicate iscan already started */ | 452 | bool ibss_starter; |
307 | bool active_scan; /* current scan mode */ | 453 | bool link_up; |
308 | bool ibss_starter; /* indicates this sta is ibss starter */ | 454 | bool pwr_save; |
309 | bool link_up; /* link/connection up flag */ | 455 | bool dongle_up; |
310 | bool pwr_save; /* indicate whether dongle to support | 456 | bool roam_on; |
311 | power save mode */ | 457 | bool scan_tried; |
312 | bool dongle_up; /* indicate whether dongle up or not */ | 458 | u8 *dcmd_buf; |
313 | bool roam_on; /* on/off switch for dongle self-roaming */ | 459 | u8 *extra_buf; |
314 | bool scan_tried; /* indicates if first scan attempted */ | ||
315 | u8 *dcmd_buf; /* dcmd buffer */ | ||
316 | u8 *extra_buf; /* maily to grab assoc information */ | ||
317 | struct dentry *debugfsdir; | 460 | struct dentry *debugfsdir; |
318 | u8 ci[0] __aligned(NETDEV_ALIGN); | 461 | bool escan_on; |
462 | struct escan_info escan_info; | ||
463 | struct timer_list escan_timeout; | ||
464 | struct work_struct escan_timeout_work; | ||
465 | u8 *escan_ioctl_buf; | ||
466 | struct ap_info *ap_info; | ||
319 | }; | 467 | }; |
320 | 468 | ||
321 | static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_priv *w) | 469 | static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *w) |
322 | { | 470 | { |
323 | return w->wdev->wiphy; | 471 | return w->wdev->wiphy; |
324 | } | 472 | } |
325 | 473 | ||
326 | static inline struct brcmf_cfg80211_priv *wiphy_to_cfg(struct wiphy *w) | 474 | static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w) |
327 | { | 475 | { |
328 | return (struct brcmf_cfg80211_priv *)(wiphy_priv(w)); | 476 | return (struct brcmf_cfg80211_info *)(wiphy_priv(w)); |
329 | } | 477 | } |
330 | 478 | ||
331 | static inline struct brcmf_cfg80211_priv *wdev_to_cfg(struct wireless_dev *wd) | 479 | static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd) |
332 | { | 480 | { |
333 | return (struct brcmf_cfg80211_priv *)(wdev_priv(wd)); | 481 | return (struct brcmf_cfg80211_info *)(wdev_priv(wd)); |
334 | } | 482 | } |
335 | 483 | ||
336 | static inline struct net_device *cfg_to_ndev(struct brcmf_cfg80211_priv *cfg) | 484 | static inline struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg) |
337 | { | 485 | { |
338 | return cfg->wdev->netdev; | 486 | return cfg->wdev->netdev; |
339 | } | 487 | } |
340 | 488 | ||
341 | static inline struct brcmf_cfg80211_priv *ndev_to_cfg(struct net_device *ndev) | 489 | static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev) |
342 | { | 490 | { |
343 | return wdev_to_cfg(ndev->ieee80211_ptr); | 491 | return wdev_to_cfg(ndev->ieee80211_ptr); |
344 | } | 492 | } |
345 | 493 | ||
346 | #define iscan_to_cfg(i) ((struct brcmf_cfg80211_priv *)(i->data)) | 494 | #define iscan_to_cfg(i) ((struct brcmf_cfg80211_info *)(i->data)) |
347 | #define cfg_to_iscan(w) (w->iscan) | 495 | #define cfg_to_iscan(w) (w->iscan) |
348 | 496 | ||
349 | static inline struct | 497 | static inline struct |
350 | brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_priv *cfg) | 498 | brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg) |
351 | { | 499 | { |
352 | return &cfg->conn_info; | 500 | return &cfg->conn_info; |
353 | } | 501 | } |
354 | 502 | ||
355 | extern struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev, | 503 | struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct net_device *ndev, |
356 | struct device *busdev, | 504 | struct device *busdev, |
357 | void *data); | 505 | struct brcmf_pub *drvr); |
358 | extern void brcmf_cfg80211_detach(struct brcmf_cfg80211_dev *cfg); | 506 | void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); |
359 | 507 | ||
360 | /* event handler from dongle */ | 508 | /* event handler from dongle */ |
361 | extern void brcmf_cfg80211_event(struct net_device *ndev, | 509 | void brcmf_cfg80211_event(struct net_device *ndev, |
362 | const struct brcmf_event_msg *e, void *data); | 510 | const struct brcmf_event_msg *e, void *data); |
363 | extern s32 brcmf_cfg80211_up(struct brcmf_cfg80211_dev *cfg_dev); | 511 | s32 brcmf_cfg80211_up(struct brcmf_cfg80211_info *cfg); |
364 | extern s32 brcmf_cfg80211_down(struct brcmf_cfg80211_dev *cfg_dev); | 512 | s32 brcmf_cfg80211_down(struct brcmf_cfg80211_info *cfg); |
365 | 513 | ||
366 | #endif /* _wl_cfg80211_h_ */ | 514 | #endif /* _wl_cfg80211_h_ */ |