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