]>
Commit | Line | Data |
---|---|---|
5b435de0 AS |
1 | /* |
2 | * Copyright (c) 2010 Broadcom Corporation | |
3 | * | |
4 | * Permission to use, copy, modify, and/or distribute this software for any | |
5 | * purpose with or without fee is hereby granted, provided that the above | |
6 | * copyright notice and this permission notice appear in all copies. | |
7 | * | |
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
15 | */ | |
16 | ||
17 | /**************** | |
18 | * Common types * | |
19 | */ | |
20 | ||
21 | #ifndef _BRCMF_H_ | |
22 | #define _BRCMF_H_ | |
23 | ||
24 | #define BRCMF_VERSION_STR "4.218.248.5" | |
25 | ||
26 | /******************************************************************************* | |
27 | * IO codes that are interpreted by dongle firmware | |
28 | ******************************************************************************/ | |
29 | #define BRCMF_C_UP 2 | |
1a873342 | 30 | #define BRCMF_C_DOWN 3 |
5b435de0 AS |
31 | #define BRCMF_C_SET_PROMISC 10 |
32 | #define BRCMF_C_GET_RATE 12 | |
33 | #define BRCMF_C_GET_INFRA 19 | |
34 | #define BRCMF_C_SET_INFRA 20 | |
35 | #define BRCMF_C_GET_AUTH 21 | |
36 | #define BRCMF_C_SET_AUTH 22 | |
37 | #define BRCMF_C_GET_BSSID 23 | |
38 | #define BRCMF_C_GET_SSID 25 | |
39 | #define BRCMF_C_SET_SSID 26 | |
40 | #define BRCMF_C_GET_CHANNEL 29 | |
41 | #define BRCMF_C_GET_SRL 31 | |
42 | #define BRCMF_C_GET_LRL 33 | |
43 | #define BRCMF_C_GET_RADIO 37 | |
44 | #define BRCMF_C_SET_RADIO 38 | |
45 | #define BRCMF_C_GET_PHYTYPE 39 | |
46 | #define BRCMF_C_SET_KEY 45 | |
47 | #define BRCMF_C_SET_PASSIVE_SCAN 49 | |
48 | #define BRCMF_C_SCAN 50 | |
49 | #define BRCMF_C_SCAN_RESULTS 51 | |
50 | #define BRCMF_C_DISASSOC 52 | |
51 | #define BRCMF_C_REASSOC 53 | |
52 | #define BRCMF_C_SET_ROAM_TRIGGER 55 | |
53 | #define BRCMF_C_SET_ROAM_DELTA 57 | |
1a873342 HM |
54 | #define BRCMF_C_GET_BCNPRD 75 |
55 | #define BRCMF_C_SET_BCNPRD 76 | |
5b435de0 | 56 | #define BRCMF_C_GET_DTIMPRD 77 |
1a873342 | 57 | #define BRCMF_C_SET_DTIMPRD 78 |
5b435de0 AS |
58 | #define BRCMF_C_SET_COUNTRY 84 |
59 | #define BRCMF_C_GET_PM 85 | |
60 | #define BRCMF_C_SET_PM 86 | |
61 | #define BRCMF_C_GET_AP 117 | |
62 | #define BRCMF_C_SET_AP 118 | |
63 | #define BRCMF_C_GET_RSSI 127 | |
64 | #define BRCMF_C_GET_WSEC 133 | |
65 | #define BRCMF_C_SET_WSEC 134 | |
66 | #define BRCMF_C_GET_PHY_NOISE 135 | |
67 | #define BRCMF_C_GET_BSS_INFO 136 | |
68 | #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185 | |
69 | #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187 | |
70 | #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201 | |
71 | #define BRCMF_C_GET_VALID_CHANNELS 217 | |
72 | #define BRCMF_C_GET_KEY_PRIMARY 235 | |
73 | #define BRCMF_C_SET_KEY_PRIMARY 236 | |
74 | #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258 | |
75 | #define BRCMF_C_GET_VAR 262 | |
76 | #define BRCMF_C_SET_VAR 263 | |
77 | ||
78 | /* phy types (returned by WLC_GET_PHYTPE) */ | |
79 | #define WLC_PHY_TYPE_A 0 | |
80 | #define WLC_PHY_TYPE_B 1 | |
81 | #define WLC_PHY_TYPE_G 2 | |
82 | #define WLC_PHY_TYPE_N 4 | |
83 | #define WLC_PHY_TYPE_LP 5 | |
84 | #define WLC_PHY_TYPE_SSN 6 | |
85 | #define WLC_PHY_TYPE_HT 7 | |
86 | #define WLC_PHY_TYPE_LCN 8 | |
87 | #define WLC_PHY_TYPE_NULL 0xf | |
88 | ||
89 | #define BRCMF_EVENTING_MASK_LEN 16 | |
90 | ||
91 | #define TOE_TX_CSUM_OL 0x00000001 | |
92 | #define TOE_RX_CSUM_OL 0x00000002 | |
93 | ||
e40aed06 | 94 | #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */ |
5b435de0 AS |
95 | |
96 | /* size of brcmf_scan_params not including variable length array */ | |
97 | #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64 | |
98 | ||
99 | /* masks for channel and ssid count */ | |
100 | #define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff | |
101 | #define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16 | |
102 | ||
5b435de0 AS |
103 | /* Indicates this key is using soft encrypt */ |
104 | #define WL_SOFT_KEY (1 << 0) | |
105 | /* primary (ie tx) key */ | |
106 | #define BRCMF_PRIMARY_KEY (1 << 1) | |
107 | /* Reserved for backward compat */ | |
108 | #define WL_KF_RES_4 (1 << 4) | |
109 | /* Reserved for backward compat */ | |
110 | #define WL_KF_RES_5 (1 << 5) | |
111 | /* Indicates a group key for a IBSS PEER */ | |
112 | #define WL_IBSS_PEER_GROUP_KEY (1 << 6) | |
113 | ||
114 | /* For supporting multiple interfaces */ | |
115 | #define BRCMF_MAX_IFS 16 | |
5b435de0 AS |
116 | |
117 | #define DOT11_BSSTYPE_ANY 2 | |
118 | #define DOT11_MAX_DEFAULT_KEYS 4 | |
119 | ||
120 | #define BRCMF_EVENT_MSG_LINK 0x01 | |
121 | #define BRCMF_EVENT_MSG_FLUSHTXQ 0x02 | |
122 | #define BRCMF_EVENT_MSG_GROUP 0x04 | |
123 | ||
e756af5b HM |
124 | #define BRCMF_ESCAN_REQ_VERSION 1 |
125 | ||
126 | #define WLC_BSS_RSSI_ON_CHANNEL 0x0002 | |
127 | ||
1a873342 HM |
128 | #define BRCMF_MAXRATES_IN_SET 16 /* max # of rates in rateset */ |
129 | #define BRCMF_STA_ASSOC 0x10 /* Associated */ | |
130 | ||
5b435de0 AS |
131 | struct brcmf_event_msg { |
132 | __be16 version; | |
133 | __be16 flags; | |
134 | __be32 event_type; | |
135 | __be32 status; | |
136 | __be32 reason; | |
137 | __be32 auth_type; | |
138 | __be32 datalen; | |
139 | u8 addr[ETH_ALEN]; | |
140 | char ifname[IFNAMSIZ]; | |
c4fdb056 HM |
141 | u8 ifidx; |
142 | u8 bsscfgidx; | |
5b435de0 AS |
143 | } __packed; |
144 | ||
145 | struct brcm_ethhdr { | |
146 | u16 subtype; | |
147 | u16 length; | |
148 | u8 version; | |
149 | u8 oui[3]; | |
150 | u16 usr_subtype; | |
151 | } __packed; | |
152 | ||
153 | struct brcmf_event { | |
154 | struct ethhdr eth; | |
155 | struct brcm_ethhdr hdr; | |
156 | struct brcmf_event_msg msg; | |
157 | } __packed; | |
158 | ||
5b435de0 AS |
159 | /* event codes sent by the dongle to this driver */ |
160 | #define BRCMF_E_SET_SSID 0 | |
161 | #define BRCMF_E_JOIN 1 | |
162 | #define BRCMF_E_START 2 | |
163 | #define BRCMF_E_AUTH 3 | |
164 | #define BRCMF_E_AUTH_IND 4 | |
165 | #define BRCMF_E_DEAUTH 5 | |
166 | #define BRCMF_E_DEAUTH_IND 6 | |
167 | #define BRCMF_E_ASSOC 7 | |
168 | #define BRCMF_E_ASSOC_IND 8 | |
169 | #define BRCMF_E_REASSOC 9 | |
170 | #define BRCMF_E_REASSOC_IND 10 | |
171 | #define BRCMF_E_DISASSOC 11 | |
172 | #define BRCMF_E_DISASSOC_IND 12 | |
173 | #define BRCMF_E_QUIET_START 13 | |
174 | #define BRCMF_E_QUIET_END 14 | |
175 | #define BRCMF_E_BEACON_RX 15 | |
176 | #define BRCMF_E_LINK 16 | |
177 | #define BRCMF_E_MIC_ERROR 17 | |
178 | #define BRCMF_E_NDIS_LINK 18 | |
179 | #define BRCMF_E_ROAM 19 | |
180 | #define BRCMF_E_TXFAIL 20 | |
181 | #define BRCMF_E_PMKID_CACHE 21 | |
182 | #define BRCMF_E_RETROGRADE_TSF 22 | |
183 | #define BRCMF_E_PRUNE 23 | |
184 | #define BRCMF_E_AUTOAUTH 24 | |
185 | #define BRCMF_E_EAPOL_MSG 25 | |
186 | #define BRCMF_E_SCAN_COMPLETE 26 | |
187 | #define BRCMF_E_ADDTS_IND 27 | |
188 | #define BRCMF_E_DELTS_IND 28 | |
189 | #define BRCMF_E_BCNSENT_IND 29 | |
190 | #define BRCMF_E_BCNRX_MSG 30 | |
191 | #define BRCMF_E_BCNLOST_MSG 31 | |
192 | #define BRCMF_E_ROAM_PREP 32 | |
193 | #define BRCMF_E_PFN_NET_FOUND 33 | |
194 | #define BRCMF_E_PFN_NET_LOST 34 | |
195 | #define BRCMF_E_RESET_COMPLETE 35 | |
196 | #define BRCMF_E_JOIN_START 36 | |
197 | #define BRCMF_E_ROAM_START 37 | |
198 | #define BRCMF_E_ASSOC_START 38 | |
199 | #define BRCMF_E_IBSS_ASSOC 39 | |
200 | #define BRCMF_E_RADIO 40 | |
201 | #define BRCMF_E_PSM_WATCHDOG 41 | |
202 | #define BRCMF_E_PROBREQ_MSG 44 | |
203 | #define BRCMF_E_SCAN_CONFIRM_IND 45 | |
204 | #define BRCMF_E_PSK_SUP 46 | |
205 | #define BRCMF_E_COUNTRY_CODE_CHANGED 47 | |
206 | #define BRCMF_E_EXCEEDED_MEDIUM_TIME 48 | |
207 | #define BRCMF_E_ICV_ERROR 49 | |
208 | #define BRCMF_E_UNICAST_DECODE_ERROR 50 | |
209 | #define BRCMF_E_MULTICAST_DECODE_ERROR 51 | |
210 | #define BRCMF_E_TRACE 52 | |
211 | #define BRCMF_E_IF 54 | |
212 | #define BRCMF_E_RSSI 56 | |
213 | #define BRCMF_E_PFN_SCAN_COMPLETE 57 | |
214 | #define BRCMF_E_EXTLOG_MSG 58 | |
215 | #define BRCMF_E_ACTION_FRAME 59 | |
216 | #define BRCMF_E_ACTION_FRAME_COMPLETE 60 | |
217 | #define BRCMF_E_PRE_ASSOC_IND 61 | |
218 | #define BRCMF_E_PRE_REASSOC_IND 62 | |
219 | #define BRCMF_E_CHANNEL_ADOPTED 63 | |
220 | #define BRCMF_E_AP_STARTED 64 | |
221 | #define BRCMF_E_DFS_AP_STOP 65 | |
222 | #define BRCMF_E_DFS_AP_RESUME 66 | |
223 | #define BRCMF_E_RESERVED1 67 | |
224 | #define BRCMF_E_RESERVED2 68 | |
225 | #define BRCMF_E_ESCAN_RESULT 69 | |
226 | #define BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70 | |
227 | #define BRCMF_E_DCS_REQUEST 73 | |
228 | ||
229 | #define BRCMF_E_FIFO_CREDIT_MAP 74 | |
230 | ||
231 | #define BRCMF_E_LAST 75 | |
232 | ||
233 | #define BRCMF_E_STATUS_SUCCESS 0 | |
234 | #define BRCMF_E_STATUS_FAIL 1 | |
235 | #define BRCMF_E_STATUS_TIMEOUT 2 | |
236 | #define BRCMF_E_STATUS_NO_NETWORKS 3 | |
237 | #define BRCMF_E_STATUS_ABORT 4 | |
238 | #define BRCMF_E_STATUS_NO_ACK 5 | |
239 | #define BRCMF_E_STATUS_UNSOLICITED 6 | |
240 | #define BRCMF_E_STATUS_ATTEMPT 7 | |
241 | #define BRCMF_E_STATUS_PARTIAL 8 | |
242 | #define BRCMF_E_STATUS_NEWSCAN 9 | |
243 | #define BRCMF_E_STATUS_NEWASSOC 10 | |
244 | #define BRCMF_E_STATUS_11HQUIET 11 | |
245 | #define BRCMF_E_STATUS_SUPPRESS 12 | |
246 | #define BRCMF_E_STATUS_NOCHANS 13 | |
247 | #define BRCMF_E_STATUS_CS_ABORT 15 | |
248 | #define BRCMF_E_STATUS_ERROR 16 | |
249 | ||
250 | #define BRCMF_E_REASON_INITIAL_ASSOC 0 | |
251 | #define BRCMF_E_REASON_LOW_RSSI 1 | |
252 | #define BRCMF_E_REASON_DEAUTH 2 | |
253 | #define BRCMF_E_REASON_DISASSOC 3 | |
254 | #define BRCMF_E_REASON_BCNS_LOST 4 | |
255 | #define BRCMF_E_REASON_MINTXRATE 9 | |
256 | #define BRCMF_E_REASON_TXFAIL 10 | |
257 | ||
258 | #define BRCMF_E_REASON_FAST_ROAM_FAILED 5 | |
259 | #define BRCMF_E_REASON_DIRECTED_ROAM 6 | |
260 | #define BRCMF_E_REASON_TSPEC_REJECTED 7 | |
261 | #define BRCMF_E_REASON_BETTER_AP 8 | |
262 | ||
263 | #define BRCMF_E_PRUNE_ENCR_MISMATCH 1 | |
264 | #define BRCMF_E_PRUNE_BCAST_BSSID 2 | |
265 | #define BRCMF_E_PRUNE_MAC_DENY 3 | |
266 | #define BRCMF_E_PRUNE_MAC_NA 4 | |
267 | #define BRCMF_E_PRUNE_REG_PASSV 5 | |
268 | #define BRCMF_E_PRUNE_SPCT_MGMT 6 | |
269 | #define BRCMF_E_PRUNE_RADAR 7 | |
270 | #define BRCMF_E_RSN_MISMATCH 8 | |
271 | #define BRCMF_E_PRUNE_NO_COMMON_RATES 9 | |
272 | #define BRCMF_E_PRUNE_BASIC_RATES 10 | |
273 | #define BRCMF_E_PRUNE_CIPHER_NA 12 | |
274 | #define BRCMF_E_PRUNE_KNOWN_STA 13 | |
275 | #define BRCMF_E_PRUNE_WDS_PEER 15 | |
276 | #define BRCMF_E_PRUNE_QBSS_LOAD 16 | |
277 | #define BRCMF_E_PRUNE_HOME_AP 17 | |
278 | ||
279 | #define BRCMF_E_SUP_OTHER 0 | |
280 | #define BRCMF_E_SUP_DECRYPT_KEY_DATA 1 | |
281 | #define BRCMF_E_SUP_BAD_UCAST_WEP128 2 | |
282 | #define BRCMF_E_SUP_BAD_UCAST_WEP40 3 | |
283 | #define BRCMF_E_SUP_UNSUP_KEY_LEN 4 | |
284 | #define BRCMF_E_SUP_PW_KEY_CIPHER 5 | |
285 | #define BRCMF_E_SUP_MSG3_TOO_MANY_IE 6 | |
286 | #define BRCMF_E_SUP_MSG3_IE_MISMATCH 7 | |
287 | #define BRCMF_E_SUP_NO_INSTALL_FLAG 8 | |
288 | #define BRCMF_E_SUP_MSG3_NO_GTK 9 | |
289 | #define BRCMF_E_SUP_GRP_KEY_CIPHER 10 | |
290 | #define BRCMF_E_SUP_GRP_MSG1_NO_GTK 11 | |
291 | #define BRCMF_E_SUP_GTK_DECRYPT_FAIL 12 | |
292 | #define BRCMF_E_SUP_SEND_FAIL 13 | |
293 | #define BRCMF_E_SUP_DEAUTH 14 | |
294 | ||
295 | #define BRCMF_E_IF_ADD 1 | |
296 | #define BRCMF_E_IF_DEL 2 | |
297 | #define BRCMF_E_IF_CHANGE 3 | |
298 | ||
299 | #define BRCMF_E_IF_ROLE_STA 0 | |
300 | #define BRCMF_E_IF_ROLE_AP 1 | |
301 | #define BRCMF_E_IF_ROLE_WDS 2 | |
302 | ||
303 | #define BRCMF_E_LINK_BCN_LOSS 1 | |
304 | #define BRCMF_E_LINK_DISASSOC 2 | |
305 | #define BRCMF_E_LINK_ASSOC_REC 3 | |
306 | #define BRCMF_E_LINK_BSSCFG_DIS 4 | |
307 | ||
81f5dcb8 HM |
308 | /* Small, medium and maximum buffer size for dcmd |
309 | */ | |
310 | #define BRCMF_DCMD_SMLEN 256 | |
311 | #define BRCMF_DCMD_MEDLEN 1536 | |
312 | #define BRCMF_DCMD_MAXLEN 8192 | |
313 | ||
5b435de0 AS |
314 | /* Pattern matching filter. Specifies an offset within received packets to |
315 | * start matching, the pattern to match, the size of the pattern, and a bitmask | |
316 | * that indicates which bits within the pattern should be matched. | |
317 | */ | |
f7264adb | 318 | struct brcmf_pkt_filter_pattern_le { |
5b435de0 AS |
319 | /* |
320 | * Offset within received packet to start pattern matching. | |
321 | * Offset '0' is the first byte of the ethernet header. | |
322 | */ | |
f7264adb | 323 | __le32 offset; |
5b435de0 | 324 | /* Size of the pattern. Bitmask must be the same size.*/ |
f7264adb | 325 | __le32 size_bytes; |
5b435de0 AS |
326 | /* |
327 | * Variable length mask and pattern data. mask starts at offset 0. | |
328 | * Pattern immediately follows mask. | |
329 | */ | |
330 | u8 mask_and_pattern[1]; | |
331 | }; | |
332 | ||
333 | /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */ | |
f7264adb AS |
334 | struct brcmf_pkt_filter_le { |
335 | __le32 id; /* Unique filter id, specified by app. */ | |
336 | __le32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */ | |
337 | __le32 negate_match; /* Negate the result of filter matches */ | |
5b435de0 | 338 | union { /* Filter definitions */ |
f7264adb | 339 | struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */ |
5b435de0 AS |
340 | } u; |
341 | }; | |
342 | ||
343 | /* IOVAR "pkt_filter_enable" parameter. */ | |
f7264adb AS |
344 | struct brcmf_pkt_filter_enable_le { |
345 | __le32 id; /* Unique filter id */ | |
346 | __le32 enable; /* Enable/disable bool */ | |
5b435de0 AS |
347 | }; |
348 | ||
349 | /* BSS info structure | |
350 | * Applications MUST CHECK ie_offset field and length field to access IEs and | |
351 | * next bss_info structure in a vector (in struct brcmf_scan_results) | |
352 | */ | |
d34bf64f | 353 | struct brcmf_bss_info_le { |
5b435de0 AS |
354 | __le32 version; /* version field */ |
355 | __le32 length; /* byte length of data in this record, | |
356 | * starting at version and including IEs | |
357 | */ | |
358 | u8 BSSID[ETH_ALEN]; | |
359 | __le16 beacon_period; /* units are Kusec */ | |
360 | __le16 capability; /* Capability information */ | |
361 | u8 SSID_len; | |
362 | u8 SSID[32]; | |
363 | struct { | |
364 | __le32 count; /* # rates in this set */ | |
365 | u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ | |
366 | } rateset; /* supported rates */ | |
367 | __le16 chanspec; /* chanspec for bss */ | |
368 | __le16 atim_window; /* units are Kusec */ | |
369 | u8 dtim_period; /* DTIM period */ | |
370 | __le16 RSSI; /* receive signal strength (in dBm) */ | |
371 | s8 phy_noise; /* noise (in dBm) */ | |
372 | ||
373 | u8 n_cap; /* BSS is 802.11N Capable */ | |
374 | /* 802.11N BSS Capabilities (based on HT_CAP_*): */ | |
375 | __le32 nbss_cap; | |
376 | u8 ctl_ch; /* 802.11N BSS control channel number */ | |
377 | __le32 reserved32[1]; /* Reserved for expansion of BSS properties */ | |
378 | u8 flags; /* flags */ | |
379 | u8 reserved[3]; /* Reserved for expansion of BSS properties */ | |
380 | u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */ | |
381 | ||
382 | __le16 ie_offset; /* offset at which IEs start, from beginning */ | |
383 | __le32 ie_length; /* byte length of Information Elements */ | |
384 | __le16 SNR; /* average SNR of during frame reception */ | |
385 | /* Add new fields here */ | |
386 | /* variable length Information Elements */ | |
387 | }; | |
388 | ||
389 | struct brcm_rateset_le { | |
390 | /* # rates in this set */ | |
391 | __le32 count; | |
392 | /* rates in 500kbps units w/hi bit set if basic */ | |
393 | u8 rates[WL_NUMRATES]; | |
394 | }; | |
395 | ||
396 | struct brcmf_ssid { | |
397 | u32 SSID_len; | |
398 | unsigned char SSID[32]; | |
399 | }; | |
400 | ||
401 | struct brcmf_ssid_le { | |
402 | __le32 SSID_len; | |
403 | unsigned char SSID[32]; | |
404 | }; | |
405 | ||
406 | struct brcmf_scan_params_le { | |
407 | struct brcmf_ssid_le ssid_le; /* default: {0, ""} */ | |
408 | u8 bssid[ETH_ALEN]; /* default: bcast */ | |
409 | s8 bss_type; /* default: any, | |
410 | * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT | |
411 | */ | |
412 | u8 scan_type; /* flags, 0 use default */ | |
413 | __le32 nprobes; /* -1 use default, number of probes per channel */ | |
414 | __le32 active_time; /* -1 use default, dwell time per channel for | |
415 | * active scanning | |
416 | */ | |
417 | __le32 passive_time; /* -1 use default, dwell time per channel | |
418 | * for passive scanning | |
419 | */ | |
420 | __le32 home_time; /* -1 use default, dwell time for the | |
421 | * home channel between channel scans | |
422 | */ | |
423 | __le32 channel_num; /* count of channels and ssids that follow | |
424 | * | |
425 | * low half is count of channels in | |
426 | * channel_list, 0 means default (use all | |
427 | * available channels) | |
428 | * | |
429 | * high half is entries in struct brcmf_ssid | |
430 | * array that follows channel_list, aligned for | |
431 | * s32 (4 bytes) meaning an odd channel count | |
432 | * implies a 2-byte pad between end of | |
433 | * channel_list and first ssid | |
434 | * | |
435 | * if ssid count is zero, single ssid in the | |
436 | * fixed parameter portion is assumed, otherwise | |
437 | * ssid in the fixed portion is ignored | |
438 | */ | |
439 | __le16 channel_list[1]; /* list of chanspecs */ | |
440 | }; | |
441 | ||
5b435de0 AS |
442 | struct brcmf_scan_results { |
443 | u32 buflen; | |
444 | u32 version; | |
445 | u32 count; | |
0527781e | 446 | struct brcmf_bss_info_le bss_info_le[]; |
5b435de0 AS |
447 | }; |
448 | ||
e756af5b HM |
449 | struct brcmf_escan_params_le { |
450 | __le32 version; | |
451 | __le16 action; | |
452 | __le16 sync_id; | |
453 | struct brcmf_scan_params_le params_le; | |
454 | }; | |
455 | ||
456 | struct brcmf_escan_result_le { | |
457 | __le32 buflen; | |
458 | __le32 version; | |
459 | __le16 sync_id; | |
460 | __le16 bss_count; | |
461 | struct brcmf_bss_info_le bss_info_le; | |
462 | }; | |
463 | ||
464 | #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(struct brcmf_escan_result_le) - \ | |
465 | sizeof(struct brcmf_bss_info_le)) | |
466 | ||
5b435de0 AS |
467 | /* used for association with a specific BSSID and chanspec list */ |
468 | struct brcmf_assoc_params_le { | |
469 | /* 00:00:00:00:00:00: broadcast scan */ | |
470 | u8 bssid[ETH_ALEN]; | |
471 | /* 0: all available channels, otherwise count of chanspecs in | |
472 | * chanspec_list */ | |
473 | __le32 chanspec_num; | |
474 | /* list of chanspecs */ | |
475 | __le16 chanspec_list[1]; | |
476 | }; | |
477 | ||
478 | /* used for join with or without a specific bssid and channel list */ | |
479 | struct brcmf_join_params { | |
480 | struct brcmf_ssid_le ssid_le; | |
481 | struct brcmf_assoc_params_le params_le; | |
482 | }; | |
483 | ||
5b435de0 AS |
484 | struct brcmf_wsec_key { |
485 | u32 index; /* key index */ | |
486 | u32 len; /* key length */ | |
487 | u8 data[WLAN_MAX_KEY_LEN]; /* key data */ | |
488 | u32 pad_1[18]; | |
489 | u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ | |
490 | u32 flags; /* misc flags */ | |
491 | u32 pad_2[3]; | |
492 | u32 iv_initialized; /* has IV been initialized already? */ | |
493 | u32 pad_3; | |
494 | /* Rx IV */ | |
495 | struct { | |
496 | u32 hi; /* upper 32 bits of IV */ | |
497 | u16 lo; /* lower 16 bits of IV */ | |
498 | } rxiv; | |
499 | u32 pad_4[2]; | |
500 | u8 ea[ETH_ALEN]; /* per station */ | |
501 | }; | |
502 | ||
503 | /* | |
504 | * dongle requires same struct as above but with fields in little endian order | |
505 | */ | |
506 | struct brcmf_wsec_key_le { | |
507 | __le32 index; /* key index */ | |
508 | __le32 len; /* key length */ | |
509 | u8 data[WLAN_MAX_KEY_LEN]; /* key data */ | |
510 | __le32 pad_1[18]; | |
511 | __le32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ | |
512 | __le32 flags; /* misc flags */ | |
513 | __le32 pad_2[3]; | |
514 | __le32 iv_initialized; /* has IV been initialized already? */ | |
515 | __le32 pad_3; | |
516 | /* Rx IV */ | |
517 | struct { | |
518 | __le32 hi; /* upper 32 bits of IV */ | |
519 | __le16 lo; /* lower 16 bits of IV */ | |
520 | } rxiv; | |
521 | __le32 pad_4[2]; | |
522 | u8 ea[ETH_ALEN]; /* per station */ | |
523 | }; | |
524 | ||
525 | /* Used to get specific STA parameters */ | |
526 | struct brcmf_scb_val_le { | |
527 | __le32 val; | |
528 | u8 ea[ETH_ALEN]; | |
529 | }; | |
530 | ||
531 | /* channel encoding */ | |
532 | struct brcmf_channel_info_le { | |
533 | __le32 hw_channel; | |
534 | __le32 target_channel; | |
535 | __le32 scan_channel; | |
536 | }; | |
537 | ||
1a873342 HM |
538 | struct brcmf_sta_info_le { |
539 | __le16 ver; /* version of this struct */ | |
540 | __le16 len; /* length in bytes of this structure */ | |
541 | __le16 cap; /* sta's advertised capabilities */ | |
542 | __le32 flags; /* flags defined below */ | |
543 | __le32 idle; /* time since data pkt rx'd from sta */ | |
544 | u8 ea[ETH_ALEN]; /* Station address */ | |
545 | __le32 count; /* # rates in this set */ | |
546 | u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */ | |
547 | /* w/hi bit set if basic */ | |
548 | __le32 in; /* seconds elapsed since associated */ | |
549 | __le32 listen_interval_inms; /* Min Listen interval in ms for STA */ | |
550 | __le32 tx_pkts; /* # of packets transmitted */ | |
551 | __le32 tx_failures; /* # of packets failed */ | |
552 | __le32 rx_ucast_pkts; /* # of unicast packets received */ | |
553 | __le32 rx_mcast_pkts; /* # of multicast packets received */ | |
554 | __le32 tx_rate; /* Rate of last successful tx frame */ | |
555 | __le32 rx_rate; /* Rate of last successful rx frame */ | |
556 | __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */ | |
557 | __le32 rx_decrypt_failures; /* # of packet decrypted failed */ | |
558 | }; | |
559 | ||
5b435de0 AS |
560 | /* Bus independent dongle command */ |
561 | struct brcmf_dcmd { | |
562 | uint cmd; /* common dongle cmd definition */ | |
563 | void *buf; /* pointer to user buffer */ | |
564 | uint len; /* length of user buffer */ | |
565 | u8 set; /* get or set request (optional) */ | |
566 | uint used; /* bytes read or written (optional) */ | |
567 | uint needed; /* bytes needed (optional) */ | |
568 | }; | |
569 | ||
570 | /* Forward decls for struct brcmf_pub (see below) */ | |
5b435de0 | 571 | struct brcmf_proto; /* device communication protocol info */ |
5b435de0 AS |
572 | struct brcmf_cfg80211_dev; /* cfg80211 device info */ |
573 | ||
574 | /* Common structure for module and instance linkage */ | |
575 | struct brcmf_pub { | |
576 | /* Linkage ponters */ | |
8d169aa0 | 577 | struct brcmf_bus *bus_if; |
5b435de0 | 578 | struct brcmf_proto *prot; |
27a68fe3 | 579 | struct brcmf_cfg80211_info *config; |
532cdd3b | 580 | struct device *dev; /* fullmac dongle device pointer */ |
5b435de0 AS |
581 | |
582 | /* Internal brcmf items */ | |
5b435de0 | 583 | uint hdrlen; /* Total BRCMF header length (proto + bus) */ |
5b435de0 AS |
584 | uint rxsz; /* Rx buffer size bus module should use */ |
585 | u8 wme_dp; /* wme discard priority */ | |
586 | ||
587 | /* Dongle media info */ | |
5b435de0 AS |
588 | unsigned long drv_version; /* Version of dongle-resident driver */ |
589 | u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */ | |
5b435de0 AS |
590 | |
591 | /* Additional stats for the bus level */ | |
592 | ||
5b435de0 AS |
593 | /* Multicast data packets sent to dongle */ |
594 | unsigned long tx_multicast; | |
5b435de0 AS |
595 | /* Packets flushed due to unscheduled sendup thread */ |
596 | unsigned long rx_flushed; | |
597 | /* Number of times dpc scheduled by watchdog timer */ | |
598 | unsigned long wd_dpc_sched; | |
599 | ||
5b435de0 AS |
600 | /* Number of flow control pkts recvd */ |
601 | unsigned long fc_packets; | |
602 | ||
603 | /* Last error return */ | |
604 | int bcmerror; | |
5b435de0 AS |
605 | |
606 | /* Last error from dongle */ | |
607 | int dongle_error; | |
608 | ||
609 | /* Suspend disable flag flag */ | |
610 | int suspend_disable_flag; /* "1" to disable all extra powersaving | |
611 | during suspend */ | |
612 | int in_suspend; /* flag set to 1 when early suspend called */ | |
613 | int dtim_skip; /* dtim skip , default 0 means wake each dtim */ | |
614 | ||
d08b6a37 FL |
615 | struct brcmf_if *iflist[BRCMF_MAX_IFS]; |
616 | ||
617 | struct mutex proto_block; | |
81f5dcb8 | 618 | unsigned char proto_buf[BRCMF_DCMD_MAXLEN]; |
d08b6a37 FL |
619 | |
620 | struct work_struct setmacaddr_work; | |
621 | struct work_struct multicast_work; | |
622 | u8 macvalue[ETH_ALEN]; | |
623 | atomic_t pend_8021x_cnt; | |
21fff75d | 624 | wait_queue_head_t pend_8021x_wait; |
d319a7cf AS |
625 | #ifdef DEBUG |
626 | struct dentry *dbgfs_dir; | |
627 | #endif | |
5b435de0 AS |
628 | }; |
629 | ||
1d4fd8d7 AS |
630 | struct bcmevent_name { |
631 | uint event; | |
632 | const char *name; | |
81f5dcb8 HM |
633 | }; |
634 | ||
5b435de0 AS |
635 | struct brcmf_if_event { |
636 | u8 ifidx; | |
637 | u8 action; | |
638 | u8 flags; | |
639 | u8 bssidx; | |
640 | }; | |
641 | ||
3eacf866 AS |
642 | /* forward declaration */ |
643 | struct brcmf_cfg80211_vif; | |
644 | ||
1d4fd8d7 AS |
645 | /** |
646 | * struct brcmf_if - interface control information. | |
647 | * | |
648 | * @drvr: points to device related information. | |
3eacf866 | 649 | * @vif: points to cfg80211 specific interface information. |
1d4fd8d7 AS |
650 | * @ndev: associated network device. |
651 | * @stats: interface specific network statistics. | |
652 | * @idx: interface index in device firmware. | |
653 | * @bssidx: index of bss associated with this interface. | |
654 | * @mac_addr: assigned mac address. | |
655 | */ | |
656 | struct brcmf_if { | |
657 | struct brcmf_pub *drvr; | |
3eacf866 | 658 | struct brcmf_cfg80211_vif *vif; |
1d4fd8d7 AS |
659 | struct net_device *ndev; |
660 | struct net_device_stats stats; | |
661 | int idx; | |
662 | s32 bssidx; | |
663 | u8 mac_addr[ETH_ALEN]; | |
5b435de0 AS |
664 | }; |
665 | ||
1d4fd8d7 AS |
666 | static inline s32 brcmf_ndev_bssidx(struct net_device *ndev) |
667 | { | |
668 | struct brcmf_if *ifp = netdev_priv(ndev); | |
669 | return ifp->bssidx; | |
670 | } | |
671 | ||
5b435de0 AS |
672 | extern const struct bcmevent_name bcmevent_names[]; |
673 | ||
5b435de0 AS |
674 | extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); |
675 | ||
5b435de0 AS |
676 | /* Return pointer to interface name */ |
677 | extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx); | |
678 | ||
5b435de0 AS |
679 | /* Query dongle */ |
680 | extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, | |
681 | uint cmd, void *buf, uint len); | |
81f5dcb8 HM |
682 | extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, |
683 | void *buf, uint len); | |
5b435de0 | 684 | |
d08b6a37 FL |
685 | extern int brcmf_ifname2idx(struct brcmf_pub *drvr, char *name); |
686 | extern int brcmf_c_host_event(struct brcmf_pub *drvr, int *idx, | |
5b435de0 AS |
687 | void *pktdata, struct brcmf_event_msg *, |
688 | void **data_ptr); | |
689 | ||
1ed9baf0 AS |
690 | extern int brcmf_net_attach(struct brcmf_if *ifp); |
691 | extern struct brcmf_if *brcmf_add_if(struct device *dev, int ifidx, s32 bssidx, | |
692 | char *name, u8 *mac_addr); | |
d08b6a37 | 693 | extern void brcmf_del_if(struct brcmf_pub *drvr, int ifidx); |
5b435de0 | 694 | |
5b435de0 | 695 | #endif /* _BRCMF_H_ */ |