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