1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#ifndef _wl_cfg80211_h_
18#define _wl_cfg80211_h_
19
20
21#include <brcmu_d11.h>
22
23#define WL_NUM_SCAN_MAX 10
24#define WL_NUM_PMKIDS_MAX MAXPMKID
25#define WL_TLV_INFO_MAX 1024
26#define WL_BSS_INFO_MAX 2048
27#define WL_ASSOC_INFO_MAX 512
28#define WL_EXTRA_BUF_MAX 2048
29#define WL_ROAM_TRIGGER_LEVEL -75
30#define WL_ROAM_DELTA 20
31#define WL_BEACON_TIMEOUT 3
32
33#define WL_SCAN_CHANNEL_TIME 40
34#define WL_SCAN_UNASSOC_TIME 40
35#define WL_SCAN_PASSIVE_TIME 120
36
37#define WL_ESCAN_BUF_SIZE (1024 * 64)
38#define WL_ESCAN_TIMER_INTERVAL_MS 8000
39
40#define WL_ESCAN_ACTION_START 1
41#define WL_ESCAN_ACTION_CONTINUE 2
42#define WL_ESCAN_ACTION_ABORT 3
43
44#define WL_AUTH_SHARED_KEY 1
45#define IE_MAX_LEN 512
46
47
48#define TLV_LEN_OFF 1
49#define TLV_HDR_LEN 2
50#define TLV_BODY_OFF 2
51#define TLV_OUI_LEN 3
52
53
54#define BRCMF_VNDR_IE_BEACON_FLAG 0x1
55#define BRCMF_VNDR_IE_PRBRSP_FLAG 0x2
56#define BRCMF_VNDR_IE_ASSOCRSP_FLAG 0x4
57#define BRCMF_VNDR_IE_AUTHRSP_FLAG 0x8
58#define BRCMF_VNDR_IE_PRBREQ_FLAG 0x10
59#define BRCMF_VNDR_IE_ASSOCREQ_FLAG 0x20
60
61#define BRCMF_VNDR_IE_IWAPID_FLAG 0x40
62
63#define BRCMF_VNDR_IE_CUSTOM_FLAG 0x100
64
65
66#define BRCMF_VNDR_IE_GONREQ_FLAG 0x001000
67#define BRCMF_VNDR_IE_GONRSP_FLAG 0x002000
68#define BRCMF_VNDR_IE_GONCFM_FLAG 0x004000
69#define BRCMF_VNDR_IE_INVREQ_FLAG 0x008000
70#define BRCMF_VNDR_IE_INVRSP_FLAG 0x010000
71#define BRCMF_VNDR_IE_DISREQ_FLAG 0x020000
72#define BRCMF_VNDR_IE_DISRSP_FLAG 0x040000
73#define BRCMF_VNDR_IE_PRDREQ_FLAG 0x080000
74#define BRCMF_VNDR_IE_PRDRSP_FLAG 0x100000
75
76#define BRCMF_VNDR_IE_P2PAF_SHIFT 12
77
78
79
80
81
82
83
84
85
86enum brcmf_scan_status {
87 BRCMF_SCAN_STATUS_BUSY,
88 BRCMF_SCAN_STATUS_ABORT,
89 BRCMF_SCAN_STATUS_SUPPRESS,
90};
91
92
93struct brcmf_cfg80211_conf {
94 u32 frag_threshold;
95 u32 rts_threshold;
96 u32 retry_short;
97 u32 retry_long;
98 s32 tx_power;
99 struct ieee80211_channel channel;
100};
101
102
103struct brcmf_cfg80211_scan_req {
104 struct brcmf_ssid_le ssid_le;
105};
106
107
108struct brcmf_cfg80211_ie {
109 u16 offset;
110 u8 buf[WL_TLV_INFO_MAX];
111};
112
113
114struct brcmf_cfg80211_security {
115 u32 wpa_versions;
116 u32 auth_type;
117 u32 cipher_pairwise;
118 u32 cipher_group;
119 u32 wpa_auth;
120};
121
122
123
124
125
126
127
128
129struct brcmf_cfg80211_profile {
130 struct brcmf_ssid ssid;
131 u8 bssid[ETH_ALEN];
132 struct brcmf_cfg80211_security sec;
133};
134
135
136
137
138
139
140
141
142
143
144
145enum brcmf_vif_status {
146 BRCMF_VIF_STATUS_READY,
147 BRCMF_VIF_STATUS_CONNECTING,
148 BRCMF_VIF_STATUS_CONNECTED,
149 BRCMF_VIF_STATUS_DISCONNECTING,
150 BRCMF_VIF_STATUS_AP_CREATING,
151 BRCMF_VIF_STATUS_AP_CREATED
152};
153
154
155
156
157
158
159
160
161
162
163
164struct vif_saved_ie {
165 u8 probe_req_ie[IE_MAX_LEN];
166 u8 probe_res_ie[IE_MAX_LEN];
167 u8 beacon_ie[IE_MAX_LEN];
168 u8 assoc_req_ie[IE_MAX_LEN];
169 u32 probe_req_ie_len;
170 u32 probe_res_ie_len;
171 u32 beacon_ie_len;
172 u32 assoc_req_ie_len;
173};
174
175
176
177
178
179
180
181
182
183
184
185
186
187struct brcmf_cfg80211_vif {
188 struct brcmf_if *ifp;
189 struct wireless_dev wdev;
190 struct brcmf_cfg80211_profile profile;
191 s32 roam_off;
192 unsigned long sme_state;
193 bool pm_block;
194 struct vif_saved_ie saved_ie;
195 struct list_head list;
196 u16 mgmt_rx_reg;
197};
198
199
200struct brcmf_cfg80211_connect_info {
201 u8 *req_ie;
202 s32 req_ie_len;
203 u8 *resp_ie;
204 s32 resp_ie_len;
205};
206
207
208struct brcmf_cfg80211_assoc_ielen_le {
209 __le32 req_len;
210 __le32 resp_len;
211};
212
213
214struct brcmf_cfg80211_pmk_list {
215 struct pmkid_list pmkids;
216 struct pmkid foo[MAXPMKID - 1];
217};
218
219
220enum wl_escan_state {
221 WL_ESCAN_STATE_IDLE,
222 WL_ESCAN_STATE_SCANNING
223};
224
225struct escan_info {
226 u32 escan_state;
227 u8 escan_buf[WL_ESCAN_BUF_SIZE];
228 struct wiphy *wiphy;
229 struct brcmf_if *ifp;
230 s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
231 struct cfg80211_scan_request *request, u16 action);
232};
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251struct brcmf_pno_param_le {
252 __le32 version;
253 __le32 scan_freq;
254 __le32 lost_network_timeout;
255 __le16 flags;
256 __le16 rssi_margin;
257 u8 bestn;
258 u8 mscan;
259 u8 repeat;
260 u8 exp;
261 __le32 slow_freq;
262};
263
264
265
266
267
268
269
270
271
272
273
274struct brcmf_pno_net_param_le {
275 struct brcmf_ssid_le ssid;
276 __le32 flags;
277 __le32 infra;
278 __le32 auth;
279 __le32 wpa_auth;
280 __le32 wsec;
281};
282
283
284
285
286
287
288
289
290
291
292
293struct brcmf_pno_net_info_le {
294 u8 bssid[ETH_ALEN];
295 u8 channel;
296 u8 SSID_len;
297 u8 SSID[32];
298 __le16 RSSI;
299 __le16 timestamp;
300};
301
302
303
304
305
306
307
308
309struct brcmf_pno_scanresults_le {
310 __le32 version;
311 __le32 status;
312 __le32 count;
313};
314
315
316
317
318
319
320
321
322
323
324struct brcmf_cfg80211_vif_event {
325 wait_queue_head_t vif_wq;
326 struct mutex vif_event_lock;
327 u8 action;
328 struct brcmf_cfg80211_vif *vif;
329};
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367struct brcmf_cfg80211_info {
368 struct wiphy *wiphy;
369 struct brcmf_cfg80211_conf *conf;
370 struct brcmf_p2p_info p2p;
371 struct brcmf_btcoex_info *btcoex;
372 struct cfg80211_scan_request *scan_request;
373 struct mutex usr_sync;
374 struct brcmf_scan_results *bss_list;
375 struct brcmf_cfg80211_scan_req scan_req_int;
376 struct wl_cfg80211_bss_info *bss_info;
377 struct brcmf_cfg80211_ie ie;
378 struct brcmf_cfg80211_connect_info conn_info;
379 struct brcmf_cfg80211_pmk_list *pmk_list;
380 unsigned long scan_status;
381 struct brcmf_pub *pub;
382 u32 channel;
383 bool active_scan;
384 bool sched_escan;
385 bool ibss_starter;
386 bool pwr_save;
387 bool dongle_up;
388 bool scan_tried;
389 u8 *dcmd_buf;
390 u8 *extra_buf;
391 struct dentry *debugfsdir;
392 struct escan_info escan_info;
393 struct timer_list escan_timeout;
394 struct work_struct escan_timeout_work;
395 u8 *escan_ioctl_buf;
396 struct list_head vif_list;
397 struct brcmf_cfg80211_vif_event vif_event;
398 struct completion vif_disabled;
399 struct brcmu_d11inf d11inf;
400};
401
402
403
404
405
406
407
408
409struct brcmf_tlv {
410 u8 id;
411 u8 len;
412 u8 data[1];
413};
414
415static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg)
416{
417 return cfg->wiphy;
418}
419
420static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w)
421{
422 return (struct brcmf_cfg80211_info *)(wiphy_priv(w));
423}
424
425static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd)
426{
427 return (struct brcmf_cfg80211_info *)(wdev_priv(wd));
428}
429
430static inline
431struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg)
432{
433 struct brcmf_cfg80211_vif *vif;
434 vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list);
435 return vif->wdev.netdev;
436}
437
438static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev)
439{
440 return wdev_to_cfg(ndev->ieee80211_ptr);
441}
442
443static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd)
444{
445 struct brcmf_if *ifp = netdev_priv(nd);
446 return &ifp->vif->profile;
447}
448
449static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev)
450{
451 struct brcmf_if *ifp = netdev_priv(ndev);
452 return ifp->vif;
453}
454
455static inline struct
456brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg)
457{
458 return &cfg->conn_info;
459}
460
461struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
462 struct device *busdev);
463void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
464s32 brcmf_cfg80211_up(struct net_device *ndev);
465s32 brcmf_cfg80211_down(struct net_device *ndev);
466enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
467
468struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
469 enum nl80211_iftype type,
470 bool pm_block);
471void brcmf_free_vif(struct brcmf_cfg80211_vif *vif);
472
473s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
474 const u8 *vndr_ie_buf, u32 vndr_ie_len);
475s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif);
476const struct brcmf_tlv *
477brcmf_parse_tlvs(const void *buf, int buflen, uint key);
478u16 channel_to_chanspec(struct brcmu_d11inf *d11inf,
479 struct ieee80211_channel *ch);
480bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg, unsigned long state);
481void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
482 struct brcmf_cfg80211_vif *vif);
483bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
484int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg,
485 u8 action, ulong timeout);
486s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
487 struct brcmf_if *ifp, bool aborted,
488 bool fw_abort);
489void brcmf_set_mpc(struct brcmf_if *ndev, int mpc);
490void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg);
491void brcmf_cfg80211_free_netdev(struct net_device *ndev);
492
493#endif
494