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
138struct brcmf_cfg80211_profile {
139 u8 bssid[ETH_ALEN];
140 struct brcmf_cfg80211_security sec;
141 struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
142 enum brcmf_profile_fwsup use_fwsup;
143 bool is_ft;
144};
145
146
147
148
149
150
151
152
153
154
155
156
157enum brcmf_vif_status {
158 BRCMF_VIF_STATUS_READY,
159 BRCMF_VIF_STATUS_CONNECTING,
160 BRCMF_VIF_STATUS_CONNECTED,
161 BRCMF_VIF_STATUS_DISCONNECTING,
162 BRCMF_VIF_STATUS_AP_CREATED,
163 BRCMF_VIF_STATUS_EAP_SUCCESS,
164 BRCMF_VIF_STATUS_ASSOC_SUCCESS,
165};
166
167
168
169
170
171
172
173
174
175
176
177
178
179struct vif_saved_ie {
180 u8 probe_req_ie[IE_MAX_LEN];
181 u8 probe_res_ie[IE_MAX_LEN];
182 u8 beacon_ie[IE_MAX_LEN];
183 u8 assoc_req_ie[IE_MAX_LEN];
184 u8 assoc_res_ie[IE_MAX_LEN];
185 u32 probe_req_ie_len;
186 u32 probe_res_ie_len;
187 u32 beacon_ie_len;
188 u32 assoc_req_ie_len;
189 u32 assoc_res_ie_len;
190};
191
192
193
194
195
196
197
198
199
200
201
202
203struct brcmf_cfg80211_vif {
204 struct brcmf_if *ifp;
205 struct wireless_dev wdev;
206 struct brcmf_cfg80211_profile profile;
207 unsigned long sme_state;
208 struct vif_saved_ie saved_ie;
209 struct list_head list;
210 u16 mgmt_rx_reg;
211 bool mbss;
212 int is_11d;
213};
214
215
216struct brcmf_cfg80211_connect_info {
217 u8 *req_ie;
218 s32 req_ie_len;
219 u8 *resp_ie;
220 s32 resp_ie_len;
221};
222
223
224struct brcmf_cfg80211_assoc_ielen_le {
225 __le32 req_len;
226 __le32 resp_len;
227};
228
229struct brcmf_cfg80211_edcf_acparam {
230 u8 ACI;
231 u8 ECW;
232 u16 TXOP;
233};
234
235
236enum wl_escan_state {
237 WL_ESCAN_STATE_IDLE,
238 WL_ESCAN_STATE_SCANNING
239};
240
241struct escan_info {
242 u32 escan_state;
243 u8 *escan_buf;
244 struct wiphy *wiphy;
245 struct brcmf_if *ifp;
246 s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
247 struct cfg80211_scan_request *request);
248};
249
250
251
252
253
254
255
256
257
258
259struct brcmf_cfg80211_vif_event {
260 wait_queue_head_t vif_wq;
261 spinlock_t vif_event_lock;
262 u8 action;
263 struct brcmf_cfg80211_vif *vif;
264};
265
266
267
268
269
270
271
272
273
274
275
276
277struct brcmf_cfg80211_wowl {
278 bool active;
279 u32 pre_pmmode;
280 struct cfg80211_wowlan_nd_match *nd;
281 struct cfg80211_wowlan_nd_info *nd_info;
282 wait_queue_head_t nd_data_wait;
283 bool nd_data_completed;
284 bool nd_enabled;
285};
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322struct brcmf_cfg80211_info {
323 struct wiphy *wiphy;
324 struct brcmf_cfg80211_conf *conf;
325 struct brcmf_p2p_info p2p;
326 struct brcmf_btcoex_info *btcoex;
327 struct cfg80211_scan_request *scan_request;
328 struct mutex usr_sync;
329 struct wl_cfg80211_bss_info *bss_info;
330 struct brcmf_cfg80211_connect_info conn_info;
331 struct brcmf_pmk_list_le pmk_list;
332 unsigned long scan_status;
333 struct brcmf_pub *pub;
334 u32 channel;
335 u32 int_escan_map;
336 bool ibss_starter;
337 bool pwr_save;
338 bool dongle_up;
339 bool scan_tried;
340 u8 *dcmd_buf;
341 u8 *extra_buf;
342 struct dentry *debugfsdir;
343 struct escan_info escan_info;
344 struct timer_list escan_timeout;
345 struct work_struct escan_timeout_work;
346 struct list_head vif_list;
347 struct brcmf_cfg80211_vif_event vif_event;
348 struct completion vif_disabled;
349 struct brcmu_d11inf d11inf;
350 struct brcmf_assoclist_le assoclist;
351 struct brcmf_cfg80211_wowl wowl;
352 struct brcmf_pno_info *pno;
353 u8 ac_priority[MAX_8021D_PRIO];
354};
355
356
357
358
359
360
361
362
363struct brcmf_tlv {
364 u8 id;
365 u8 len;
366 u8 data[1];
367};
368
369static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg)
370{
371 return cfg->wiphy;
372}
373
374static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w)
375{
376 struct brcmf_pub *drvr = wiphy_priv(w);
377 return drvr->config;
378}
379
380static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd)
381{
382 return wiphy_to_cfg(wd->wiphy);
383}
384
385static inline struct brcmf_cfg80211_vif *wdev_to_vif(struct wireless_dev *wdev)
386{
387 return container_of(wdev, struct brcmf_cfg80211_vif, wdev);
388}
389
390static inline
391struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg)
392{
393 return brcmf_get_ifp(cfg->pub, 0)->ndev;
394}
395
396static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev)
397{
398 return wdev_to_cfg(ndev->ieee80211_ptr);
399}
400
401static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd)
402{
403 struct brcmf_if *ifp = netdev_priv(nd);
404 return &ifp->vif->profile;
405}
406
407static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev)
408{
409 struct brcmf_if *ifp = netdev_priv(ndev);
410 return ifp->vif;
411}
412
413static inline struct
414brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg)
415{
416 return &cfg->conn_info;
417}
418
419struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
420 struct cfg80211_ops *ops,
421 bool p2pdev_forced);
422void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
423s32 brcmf_cfg80211_up(struct net_device *ndev);
424s32 brcmf_cfg80211_down(struct net_device *ndev);
425struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings);
426enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
427
428struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
429 enum nl80211_iftype type);
430void brcmf_free_vif(struct brcmf_cfg80211_vif *vif);
431
432s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
433 const u8 *vndr_ie_buf, u32 vndr_ie_len);
434s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif);
435u16 channel_to_chanspec(struct brcmu_d11inf *d11inf,
436 struct ieee80211_channel *ch);
437bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg,
438 unsigned long state);
439void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
440 struct brcmf_cfg80211_vif *vif);
441bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
442int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
443 u8 action, ulong timeout);
444s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
445 struct brcmf_if *ifp, bool aborted,
446 bool fw_abort);
447void brcmf_set_mpc(struct brcmf_if *ndev, int mpc);
448void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg);
449void brcmf_cfg80211_free_netdev(struct net_device *ndev);
450
451#endif
452