]>
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 | |
30 | #define BRCMF_C_SET_PROMISC 10 | |
31 | #define BRCMF_C_GET_RATE 12 | |
32 | #define BRCMF_C_GET_INFRA 19 | |
33 | #define BRCMF_C_SET_INFRA 20 | |
34 | #define BRCMF_C_GET_AUTH 21 | |
35 | #define BRCMF_C_SET_AUTH 22 | |
36 | #define BRCMF_C_GET_BSSID 23 | |
37 | #define BRCMF_C_GET_SSID 25 | |
38 | #define BRCMF_C_SET_SSID 26 | |
39 | #define BRCMF_C_GET_CHANNEL 29 | |
40 | #define BRCMF_C_GET_SRL 31 | |
41 | #define BRCMF_C_GET_LRL 33 | |
42 | #define BRCMF_C_GET_RADIO 37 | |
43 | #define BRCMF_C_SET_RADIO 38 | |
44 | #define BRCMF_C_GET_PHYTYPE 39 | |
45 | #define BRCMF_C_SET_KEY 45 | |
46 | #define BRCMF_C_SET_PASSIVE_SCAN 49 | |
47 | #define BRCMF_C_SCAN 50 | |
48 | #define BRCMF_C_SCAN_RESULTS 51 | |
49 | #define BRCMF_C_DISASSOC 52 | |
50 | #define BRCMF_C_REASSOC 53 | |
51 | #define BRCMF_C_SET_ROAM_TRIGGER 55 | |
52 | #define BRCMF_C_SET_ROAM_DELTA 57 | |
53 | #define BRCMF_C_GET_DTIMPRD 77 | |
54 | #define BRCMF_C_SET_COUNTRY 84 | |
55 | #define BRCMF_C_GET_PM 85 | |
56 | #define BRCMF_C_SET_PM 86 | |
57 | #define BRCMF_C_GET_AP 117 | |
58 | #define BRCMF_C_SET_AP 118 | |
59 | #define BRCMF_C_GET_RSSI 127 | |
60 | #define BRCMF_C_GET_WSEC 133 | |
61 | #define BRCMF_C_SET_WSEC 134 | |
62 | #define BRCMF_C_GET_PHY_NOISE 135 | |
63 | #define BRCMF_C_GET_BSS_INFO 136 | |
64 | #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185 | |
65 | #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187 | |
66 | #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201 | |
67 | #define BRCMF_C_GET_VALID_CHANNELS 217 | |
68 | #define BRCMF_C_GET_KEY_PRIMARY 235 | |
69 | #define BRCMF_C_SET_KEY_PRIMARY 236 | |
70 | #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258 | |
71 | #define BRCMF_C_GET_VAR 262 | |
72 | #define BRCMF_C_SET_VAR 263 | |
73 | ||
74 | /* phy types (returned by WLC_GET_PHYTPE) */ | |
75 | #define WLC_PHY_TYPE_A 0 | |
76 | #define WLC_PHY_TYPE_B 1 | |
77 | #define WLC_PHY_TYPE_G 2 | |
78 | #define WLC_PHY_TYPE_N 4 | |
79 | #define WLC_PHY_TYPE_LP 5 | |
80 | #define WLC_PHY_TYPE_SSN 6 | |
81 | #define WLC_PHY_TYPE_HT 7 | |
82 | #define WLC_PHY_TYPE_LCN 8 | |
83 | #define WLC_PHY_TYPE_NULL 0xf | |
84 | ||
85 | #define BRCMF_EVENTING_MASK_LEN 16 | |
86 | ||
87 | #define TOE_TX_CSUM_OL 0x00000001 | |
88 | #define TOE_RX_CSUM_OL 0x00000002 | |
89 | ||
d34bf64f | 90 | #define BRCMF_BSS_INFO_VERSION 108 /* curr ver of brcmf_bss_info_le struct */ |
5b435de0 AS |
91 | |
92 | /* size of brcmf_scan_params not including variable length array */ | |
93 | #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64 | |
94 | ||
95 | /* masks for channel and ssid count */ | |
96 | #define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff | |
97 | #define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16 | |
98 | ||
99 | #define BRCMF_SCAN_ACTION_START 1 | |
100 | #define BRCMF_SCAN_ACTION_CONTINUE 2 | |
101 | #define WL_SCAN_ACTION_ABORT 3 | |
102 | ||
103 | #define BRCMF_ISCAN_REQ_VERSION 1 | |
104 | ||
105 | /* brcmf_iscan_results status values */ | |
106 | #define BRCMF_SCAN_RESULTS_SUCCESS 0 | |
107 | #define BRCMF_SCAN_RESULTS_PARTIAL 1 | |
108 | #define BRCMF_SCAN_RESULTS_PENDING 2 | |
109 | #define BRCMF_SCAN_RESULTS_ABORTED 3 | |
110 | #define BRCMF_SCAN_RESULTS_NO_MEM 4 | |
111 | ||
112 | /* Indicates this key is using soft encrypt */ | |
113 | #define WL_SOFT_KEY (1 << 0) | |
114 | /* primary (ie tx) key */ | |
115 | #define BRCMF_PRIMARY_KEY (1 << 1) | |
116 | /* Reserved for backward compat */ | |
117 | #define WL_KF_RES_4 (1 << 4) | |
118 | /* Reserved for backward compat */ | |
119 | #define WL_KF_RES_5 (1 << 5) | |
120 | /* Indicates a group key for a IBSS PEER */ | |
121 | #define WL_IBSS_PEER_GROUP_KEY (1 << 6) | |
122 | ||
123 | /* For supporting multiple interfaces */ | |
124 | #define BRCMF_MAX_IFS 16 | |
5b435de0 AS |
125 | |
126 | #define DOT11_BSSTYPE_ANY 2 | |
127 | #define DOT11_MAX_DEFAULT_KEYS 4 | |
128 | ||
129 | #define BRCMF_EVENT_MSG_LINK 0x01 | |
130 | #define BRCMF_EVENT_MSG_FLUSHTXQ 0x02 | |
131 | #define BRCMF_EVENT_MSG_GROUP 0x04 | |
132 | ||
133 | struct brcmf_event_msg { | |
134 | __be16 version; | |
135 | __be16 flags; | |
136 | __be32 event_type; | |
137 | __be32 status; | |
138 | __be32 reason; | |
139 | __be32 auth_type; | |
140 | __be32 datalen; | |
141 | u8 addr[ETH_ALEN]; | |
142 | char ifname[IFNAMSIZ]; | |
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 | ||
159 | struct dngl_stats { | |
160 | unsigned long rx_packets; /* total packets received */ | |
161 | unsigned long tx_packets; /* total packets transmitted */ | |
162 | unsigned long rx_bytes; /* total bytes received */ | |
163 | unsigned long tx_bytes; /* total bytes transmitted */ | |
164 | unsigned long rx_errors; /* bad packets received */ | |
165 | unsigned long tx_errors; /* packet transmit problems */ | |
166 | unsigned long rx_dropped; /* packets dropped by dongle */ | |
167 | unsigned long tx_dropped; /* packets dropped by dongle */ | |
168 | unsigned long multicast; /* multicast packets received */ | |
169 | }; | |
170 | ||
171 | /* event codes sent by the dongle to this driver */ | |
172 | #define BRCMF_E_SET_SSID 0 | |
173 | #define BRCMF_E_JOIN 1 | |
174 | #define BRCMF_E_START 2 | |
175 | #define BRCMF_E_AUTH 3 | |
176 | #define BRCMF_E_AUTH_IND 4 | |
177 | #define BRCMF_E_DEAUTH 5 | |
178 | #define BRCMF_E_DEAUTH_IND 6 | |
179 | #define BRCMF_E_ASSOC 7 | |
180 | #define BRCMF_E_ASSOC_IND 8 | |
181 | #define BRCMF_E_REASSOC 9 | |
182 | #define BRCMF_E_REASSOC_IND 10 | |
183 | #define BRCMF_E_DISASSOC 11 | |
184 | #define BRCMF_E_DISASSOC_IND 12 | |
185 | #define BRCMF_E_QUIET_START 13 | |
186 | #define BRCMF_E_QUIET_END 14 | |
187 | #define BRCMF_E_BEACON_RX 15 | |
188 | #define BRCMF_E_LINK 16 | |
189 | #define BRCMF_E_MIC_ERROR 17 | |
190 | #define BRCMF_E_NDIS_LINK 18 | |
191 | #define BRCMF_E_ROAM 19 | |
192 | #define BRCMF_E_TXFAIL 20 | |
193 | #define BRCMF_E_PMKID_CACHE 21 | |
194 | #define BRCMF_E_RETROGRADE_TSF 22 | |
195 | #define BRCMF_E_PRUNE 23 | |
196 | #define BRCMF_E_AUTOAUTH 24 | |
197 | #define BRCMF_E_EAPOL_MSG 25 | |
198 | #define BRCMF_E_SCAN_COMPLETE 26 | |
199 | #define BRCMF_E_ADDTS_IND 27 | |
200 | #define BRCMF_E_DELTS_IND 28 | |
201 | #define BRCMF_E_BCNSENT_IND 29 | |
202 | #define BRCMF_E_BCNRX_MSG 30 | |
203 | #define BRCMF_E_BCNLOST_MSG 31 | |
204 | #define BRCMF_E_ROAM_PREP 32 | |
205 | #define BRCMF_E_PFN_NET_FOUND 33 | |
206 | #define BRCMF_E_PFN_NET_LOST 34 | |
207 | #define BRCMF_E_RESET_COMPLETE 35 | |
208 | #define BRCMF_E_JOIN_START 36 | |
209 | #define BRCMF_E_ROAM_START 37 | |
210 | #define BRCMF_E_ASSOC_START 38 | |
211 | #define BRCMF_E_IBSS_ASSOC 39 | |
212 | #define BRCMF_E_RADIO 40 | |
213 | #define BRCMF_E_PSM_WATCHDOG 41 | |
214 | #define BRCMF_E_PROBREQ_MSG 44 | |
215 | #define BRCMF_E_SCAN_CONFIRM_IND 45 | |
216 | #define BRCMF_E_PSK_SUP 46 | |
217 | #define BRCMF_E_COUNTRY_CODE_CHANGED 47 | |
218 | #define BRCMF_E_EXCEEDED_MEDIUM_TIME 48 | |
219 | #define BRCMF_E_ICV_ERROR 49 | |
220 | #define BRCMF_E_UNICAST_DECODE_ERROR 50 | |
221 | #define BRCMF_E_MULTICAST_DECODE_ERROR 51 | |
222 | #define BRCMF_E_TRACE 52 | |
223 | #define BRCMF_E_IF 54 | |
224 | #define BRCMF_E_RSSI 56 | |
225 | #define BRCMF_E_PFN_SCAN_COMPLETE 57 | |
226 | #define BRCMF_E_EXTLOG_MSG 58 | |
227 | #define BRCMF_E_ACTION_FRAME 59 | |
228 | #define BRCMF_E_ACTION_FRAME_COMPLETE 60 | |
229 | #define BRCMF_E_PRE_ASSOC_IND 61 | |
230 | #define BRCMF_E_PRE_REASSOC_IND 62 | |
231 | #define BRCMF_E_CHANNEL_ADOPTED 63 | |
232 | #define BRCMF_E_AP_STARTED 64 | |
233 | #define BRCMF_E_DFS_AP_STOP 65 | |
234 | #define BRCMF_E_DFS_AP_RESUME 66 | |
235 | #define BRCMF_E_RESERVED1 67 | |
236 | #define BRCMF_E_RESERVED2 68 | |
237 | #define BRCMF_E_ESCAN_RESULT 69 | |
238 | #define BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70 | |
239 | #define BRCMF_E_DCS_REQUEST 73 | |
240 | ||
241 | #define BRCMF_E_FIFO_CREDIT_MAP 74 | |
242 | ||
243 | #define BRCMF_E_LAST 75 | |
244 | ||
245 | #define BRCMF_E_STATUS_SUCCESS 0 | |
246 | #define BRCMF_E_STATUS_FAIL 1 | |
247 | #define BRCMF_E_STATUS_TIMEOUT 2 | |
248 | #define BRCMF_E_STATUS_NO_NETWORKS 3 | |
249 | #define BRCMF_E_STATUS_ABORT 4 | |
250 | #define BRCMF_E_STATUS_NO_ACK 5 | |
251 | #define BRCMF_E_STATUS_UNSOLICITED 6 | |
252 | #define BRCMF_E_STATUS_ATTEMPT 7 | |
253 | #define BRCMF_E_STATUS_PARTIAL 8 | |
254 | #define BRCMF_E_STATUS_NEWSCAN 9 | |
255 | #define BRCMF_E_STATUS_NEWASSOC 10 | |
256 | #define BRCMF_E_STATUS_11HQUIET 11 | |
257 | #define BRCMF_E_STATUS_SUPPRESS 12 | |
258 | #define BRCMF_E_STATUS_NOCHANS 13 | |
259 | #define BRCMF_E_STATUS_CS_ABORT 15 | |
260 | #define BRCMF_E_STATUS_ERROR 16 | |
261 | ||
262 | #define BRCMF_E_REASON_INITIAL_ASSOC 0 | |
263 | #define BRCMF_E_REASON_LOW_RSSI 1 | |
264 | #define BRCMF_E_REASON_DEAUTH 2 | |
265 | #define BRCMF_E_REASON_DISASSOC 3 | |
266 | #define BRCMF_E_REASON_BCNS_LOST 4 | |
267 | #define BRCMF_E_REASON_MINTXRATE 9 | |
268 | #define BRCMF_E_REASON_TXFAIL 10 | |
269 | ||
270 | #define BRCMF_E_REASON_FAST_ROAM_FAILED 5 | |
271 | #define BRCMF_E_REASON_DIRECTED_ROAM 6 | |
272 | #define BRCMF_E_REASON_TSPEC_REJECTED 7 | |
273 | #define BRCMF_E_REASON_BETTER_AP 8 | |
274 | ||
275 | #define BRCMF_E_PRUNE_ENCR_MISMATCH 1 | |
276 | #define BRCMF_E_PRUNE_BCAST_BSSID 2 | |
277 | #define BRCMF_E_PRUNE_MAC_DENY 3 | |
278 | #define BRCMF_E_PRUNE_MAC_NA 4 | |
279 | #define BRCMF_E_PRUNE_REG_PASSV 5 | |
280 | #define BRCMF_E_PRUNE_SPCT_MGMT 6 | |
281 | #define BRCMF_E_PRUNE_RADAR 7 | |
282 | #define BRCMF_E_RSN_MISMATCH 8 | |
283 | #define BRCMF_E_PRUNE_NO_COMMON_RATES 9 | |
284 | #define BRCMF_E_PRUNE_BASIC_RATES 10 | |
285 | #define BRCMF_E_PRUNE_CIPHER_NA 12 | |
286 | #define BRCMF_E_PRUNE_KNOWN_STA 13 | |
287 | #define BRCMF_E_PRUNE_WDS_PEER 15 | |
288 | #define BRCMF_E_PRUNE_QBSS_LOAD 16 | |
289 | #define BRCMF_E_PRUNE_HOME_AP 17 | |
290 | ||
291 | #define BRCMF_E_SUP_OTHER 0 | |
292 | #define BRCMF_E_SUP_DECRYPT_KEY_DATA 1 | |
293 | #define BRCMF_E_SUP_BAD_UCAST_WEP128 2 | |
294 | #define BRCMF_E_SUP_BAD_UCAST_WEP40 3 | |
295 | #define BRCMF_E_SUP_UNSUP_KEY_LEN 4 | |
296 | #define BRCMF_E_SUP_PW_KEY_CIPHER 5 | |
297 | #define BRCMF_E_SUP_MSG3_TOO_MANY_IE 6 | |
298 | #define BRCMF_E_SUP_MSG3_IE_MISMATCH 7 | |
299 | #define BRCMF_E_SUP_NO_INSTALL_FLAG 8 | |
300 | #define BRCMF_E_SUP_MSG3_NO_GTK 9 | |
301 | #define BRCMF_E_SUP_GRP_KEY_CIPHER 10 | |
302 | #define BRCMF_E_SUP_GRP_MSG1_NO_GTK 11 | |
303 | #define BRCMF_E_SUP_GTK_DECRYPT_FAIL 12 | |
304 | #define BRCMF_E_SUP_SEND_FAIL 13 | |
305 | #define BRCMF_E_SUP_DEAUTH 14 | |
306 | ||
307 | #define BRCMF_E_IF_ADD 1 | |
308 | #define BRCMF_E_IF_DEL 2 | |
309 | #define BRCMF_E_IF_CHANGE 3 | |
310 | ||
311 | #define BRCMF_E_IF_ROLE_STA 0 | |
312 | #define BRCMF_E_IF_ROLE_AP 1 | |
313 | #define BRCMF_E_IF_ROLE_WDS 2 | |
314 | ||
315 | #define BRCMF_E_LINK_BCN_LOSS 1 | |
316 | #define BRCMF_E_LINK_DISASSOC 2 | |
317 | #define BRCMF_E_LINK_ASSOC_REC 3 | |
318 | #define BRCMF_E_LINK_BSSCFG_DIS 4 | |
319 | ||
320 | /* The level of bus communication with the dongle */ | |
321 | enum brcmf_bus_state { | |
322 | BRCMF_BUS_DOWN, /* Not ready for frame transfers */ | |
323 | BRCMF_BUS_LOAD, /* Download access only (CPU reset) */ | |
324 | BRCMF_BUS_DATA /* Ready for frame transfers */ | |
325 | }; | |
326 | ||
327 | /* Pattern matching filter. Specifies an offset within received packets to | |
328 | * start matching, the pattern to match, the size of the pattern, and a bitmask | |
329 | * that indicates which bits within the pattern should be matched. | |
330 | */ | |
f7264adb | 331 | struct brcmf_pkt_filter_pattern_le { |
5b435de0 AS |
332 | /* |
333 | * Offset within received packet to start pattern matching. | |
334 | * Offset '0' is the first byte of the ethernet header. | |
335 | */ | |
f7264adb | 336 | __le32 offset; |
5b435de0 | 337 | /* Size of the pattern. Bitmask must be the same size.*/ |
f7264adb | 338 | __le32 size_bytes; |
5b435de0 AS |
339 | /* |
340 | * Variable length mask and pattern data. mask starts at offset 0. | |
341 | * Pattern immediately follows mask. | |
342 | */ | |
343 | u8 mask_and_pattern[1]; | |
344 | }; | |
345 | ||
346 | /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */ | |
f7264adb AS |
347 | struct brcmf_pkt_filter_le { |
348 | __le32 id; /* Unique filter id, specified by app. */ | |
349 | __le32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */ | |
350 | __le32 negate_match; /* Negate the result of filter matches */ | |
5b435de0 | 351 | union { /* Filter definitions */ |
f7264adb | 352 | struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */ |
5b435de0 AS |
353 | } u; |
354 | }; | |
355 | ||
356 | /* IOVAR "pkt_filter_enable" parameter. */ | |
f7264adb AS |
357 | struct brcmf_pkt_filter_enable_le { |
358 | __le32 id; /* Unique filter id */ | |
359 | __le32 enable; /* Enable/disable bool */ | |
5b435de0 AS |
360 | }; |
361 | ||
362 | /* BSS info structure | |
363 | * Applications MUST CHECK ie_offset field and length field to access IEs and | |
364 | * next bss_info structure in a vector (in struct brcmf_scan_results) | |
365 | */ | |
d34bf64f | 366 | struct brcmf_bss_info_le { |
5b435de0 AS |
367 | __le32 version; /* version field */ |
368 | __le32 length; /* byte length of data in this record, | |
369 | * starting at version and including IEs | |
370 | */ | |
371 | u8 BSSID[ETH_ALEN]; | |
372 | __le16 beacon_period; /* units are Kusec */ | |
373 | __le16 capability; /* Capability information */ | |
374 | u8 SSID_len; | |
375 | u8 SSID[32]; | |
376 | struct { | |
377 | __le32 count; /* # rates in this set */ | |
378 | u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ | |
379 | } rateset; /* supported rates */ | |
380 | __le16 chanspec; /* chanspec for bss */ | |
381 | __le16 atim_window; /* units are Kusec */ | |
382 | u8 dtim_period; /* DTIM period */ | |
383 | __le16 RSSI; /* receive signal strength (in dBm) */ | |
384 | s8 phy_noise; /* noise (in dBm) */ | |
385 | ||
386 | u8 n_cap; /* BSS is 802.11N Capable */ | |
387 | /* 802.11N BSS Capabilities (based on HT_CAP_*): */ | |
388 | __le32 nbss_cap; | |
389 | u8 ctl_ch; /* 802.11N BSS control channel number */ | |
390 | __le32 reserved32[1]; /* Reserved for expansion of BSS properties */ | |
391 | u8 flags; /* flags */ | |
392 | u8 reserved[3]; /* Reserved for expansion of BSS properties */ | |
393 | u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */ | |
394 | ||
395 | __le16 ie_offset; /* offset at which IEs start, from beginning */ | |
396 | __le32 ie_length; /* byte length of Information Elements */ | |
397 | __le16 SNR; /* average SNR of during frame reception */ | |
398 | /* Add new fields here */ | |
399 | /* variable length Information Elements */ | |
400 | }; | |
401 | ||
402 | struct brcm_rateset_le { | |
403 | /* # rates in this set */ | |
404 | __le32 count; | |
405 | /* rates in 500kbps units w/hi bit set if basic */ | |
406 | u8 rates[WL_NUMRATES]; | |
407 | }; | |
408 | ||
409 | struct brcmf_ssid { | |
410 | u32 SSID_len; | |
411 | unsigned char SSID[32]; | |
412 | }; | |
413 | ||
414 | struct brcmf_ssid_le { | |
415 | __le32 SSID_len; | |
416 | unsigned char SSID[32]; | |
417 | }; | |
418 | ||
419 | struct brcmf_scan_params_le { | |
420 | struct brcmf_ssid_le ssid_le; /* default: {0, ""} */ | |
421 | u8 bssid[ETH_ALEN]; /* default: bcast */ | |
422 | s8 bss_type; /* default: any, | |
423 | * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT | |
424 | */ | |
425 | u8 scan_type; /* flags, 0 use default */ | |
426 | __le32 nprobes; /* -1 use default, number of probes per channel */ | |
427 | __le32 active_time; /* -1 use default, dwell time per channel for | |
428 | * active scanning | |
429 | */ | |
430 | __le32 passive_time; /* -1 use default, dwell time per channel | |
431 | * for passive scanning | |
432 | */ | |
433 | __le32 home_time; /* -1 use default, dwell time for the | |
434 | * home channel between channel scans | |
435 | */ | |
436 | __le32 channel_num; /* count of channels and ssids that follow | |
437 | * | |
438 | * low half is count of channels in | |
439 | * channel_list, 0 means default (use all | |
440 | * available channels) | |
441 | * | |
442 | * high half is entries in struct brcmf_ssid | |
443 | * array that follows channel_list, aligned for | |
444 | * s32 (4 bytes) meaning an odd channel count | |
445 | * implies a 2-byte pad between end of | |
446 | * channel_list and first ssid | |
447 | * | |
448 | * if ssid count is zero, single ssid in the | |
449 | * fixed parameter portion is assumed, otherwise | |
450 | * ssid in the fixed portion is ignored | |
451 | */ | |
452 | __le16 channel_list[1]; /* list of chanspecs */ | |
453 | }; | |
454 | ||
455 | /* incremental scan struct */ | |
456 | struct brcmf_iscan_params_le { | |
457 | __le32 version; | |
458 | __le16 action; | |
459 | __le16 scan_duration; | |
460 | struct brcmf_scan_params_le params_le; | |
461 | }; | |
462 | ||
463 | struct brcmf_scan_results { | |
464 | u32 buflen; | |
465 | u32 version; | |
466 | u32 count; | |
0527781e | 467 | struct brcmf_bss_info_le bss_info_le[]; |
5b435de0 AS |
468 | }; |
469 | ||
470 | struct brcmf_scan_results_le { | |
471 | __le32 buflen; | |
472 | __le32 version; | |
473 | __le32 count; | |
5b435de0 AS |
474 | }; |
475 | ||
476 | /* used for association with a specific BSSID and chanspec list */ | |
477 | struct brcmf_assoc_params_le { | |
478 | /* 00:00:00:00:00:00: broadcast scan */ | |
479 | u8 bssid[ETH_ALEN]; | |
480 | /* 0: all available channels, otherwise count of chanspecs in | |
481 | * chanspec_list */ | |
482 | __le32 chanspec_num; | |
483 | /* list of chanspecs */ | |
484 | __le16 chanspec_list[1]; | |
485 | }; | |
486 | ||
487 | /* used for join with or without a specific bssid and channel list */ | |
488 | struct brcmf_join_params { | |
489 | struct brcmf_ssid_le ssid_le; | |
490 | struct brcmf_assoc_params_le params_le; | |
491 | }; | |
492 | ||
5b435de0 AS |
493 | /* incremental scan results struct */ |
494 | struct brcmf_iscan_results { | |
495 | union { | |
496 | u32 status; | |
497 | __le32 status_le; | |
498 | }; | |
499 | union { | |
500 | struct brcmf_scan_results results; | |
501 | struct brcmf_scan_results_le results_le; | |
502 | }; | |
503 | }; | |
504 | ||
505 | /* size of brcmf_iscan_results not including variable length array */ | |
506 | #define BRCMF_ISCAN_RESULTS_FIXED_SIZE \ | |
0527781e | 507 | (sizeof(struct brcmf_scan_results) + \ |
5b435de0 AS |
508 | offsetof(struct brcmf_iscan_results, results)) |
509 | ||
510 | struct brcmf_wsec_key { | |
511 | u32 index; /* key index */ | |
512 | u32 len; /* key length */ | |
513 | u8 data[WLAN_MAX_KEY_LEN]; /* key data */ | |
514 | u32 pad_1[18]; | |
515 | u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ | |
516 | u32 flags; /* misc flags */ | |
517 | u32 pad_2[3]; | |
518 | u32 iv_initialized; /* has IV been initialized already? */ | |
519 | u32 pad_3; | |
520 | /* Rx IV */ | |
521 | struct { | |
522 | u32 hi; /* upper 32 bits of IV */ | |
523 | u16 lo; /* lower 16 bits of IV */ | |
524 | } rxiv; | |
525 | u32 pad_4[2]; | |
526 | u8 ea[ETH_ALEN]; /* per station */ | |
527 | }; | |
528 | ||
529 | /* | |
530 | * dongle requires same struct as above but with fields in little endian order | |
531 | */ | |
532 | struct brcmf_wsec_key_le { | |
533 | __le32 index; /* key index */ | |
534 | __le32 len; /* key length */ | |
535 | u8 data[WLAN_MAX_KEY_LEN]; /* key data */ | |
536 | __le32 pad_1[18]; | |
537 | __le32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ | |
538 | __le32 flags; /* misc flags */ | |
539 | __le32 pad_2[3]; | |
540 | __le32 iv_initialized; /* has IV been initialized already? */ | |
541 | __le32 pad_3; | |
542 | /* Rx IV */ | |
543 | struct { | |
544 | __le32 hi; /* upper 32 bits of IV */ | |
545 | __le16 lo; /* lower 16 bits of IV */ | |
546 | } rxiv; | |
547 | __le32 pad_4[2]; | |
548 | u8 ea[ETH_ALEN]; /* per station */ | |
549 | }; | |
550 | ||
551 | /* Used to get specific STA parameters */ | |
552 | struct brcmf_scb_val_le { | |
553 | __le32 val; | |
554 | u8 ea[ETH_ALEN]; | |
555 | }; | |
556 | ||
557 | /* channel encoding */ | |
558 | struct brcmf_channel_info_le { | |
559 | __le32 hw_channel; | |
560 | __le32 target_channel; | |
561 | __le32 scan_channel; | |
562 | }; | |
563 | ||
564 | /* Bus independent dongle command */ | |
565 | struct brcmf_dcmd { | |
566 | uint cmd; /* common dongle cmd definition */ | |
567 | void *buf; /* pointer to user buffer */ | |
568 | uint len; /* length of user buffer */ | |
569 | u8 set; /* get or set request (optional) */ | |
570 | uint used; /* bytes read or written (optional) */ | |
571 | uint needed; /* bytes needed (optional) */ | |
572 | }; | |
573 | ||
574 | /* Forward decls for struct brcmf_pub (see below) */ | |
575 | struct brcmf_bus; /* device bus info */ | |
576 | struct brcmf_proto; /* device communication protocol info */ | |
577 | struct brcmf_info; /* device driver info */ | |
578 | struct brcmf_cfg80211_dev; /* cfg80211 device info */ | |
579 | ||
580 | /* Common structure for module and instance linkage */ | |
581 | struct brcmf_pub { | |
582 | /* Linkage ponters */ | |
583 | struct brcmf_bus *bus; | |
584 | struct brcmf_proto *prot; | |
585 | struct brcmf_info *info; | |
586 | struct brcmf_cfg80211_dev *config; | |
587 | ||
588 | /* Internal brcmf items */ | |
589 | bool up; /* Driver up/down (to OS) */ | |
590 | bool txoff; /* Transmit flow-controlled */ | |
591 | enum brcmf_bus_state busstate; | |
592 | uint hdrlen; /* Total BRCMF header length (proto + bus) */ | |
593 | uint maxctl; /* Max size rxctl request from proto to bus */ | |
594 | uint rxsz; /* Rx buffer size bus module should use */ | |
595 | u8 wme_dp; /* wme discard priority */ | |
596 | ||
597 | /* Dongle media info */ | |
598 | bool iswl; /* Dongle-resident driver is wl */ | |
599 | unsigned long drv_version; /* Version of dongle-resident driver */ | |
600 | u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */ | |
601 | struct dngl_stats dstats; /* Stats for dongle-based data */ | |
602 | ||
603 | /* Additional stats for the bus level */ | |
604 | ||
605 | /* Data packets sent to dongle */ | |
606 | unsigned long tx_packets; | |
607 | /* Multicast data packets sent to dongle */ | |
608 | unsigned long tx_multicast; | |
609 | /* Errors in sending data to dongle */ | |
610 | unsigned long tx_errors; | |
611 | /* Control packets sent to dongle */ | |
612 | unsigned long tx_ctlpkts; | |
613 | /* Errors sending control frames to dongle */ | |
614 | unsigned long tx_ctlerrs; | |
615 | /* Packets sent up the network interface */ | |
616 | unsigned long rx_packets; | |
617 | /* Multicast packets sent up the network interface */ | |
618 | unsigned long rx_multicast; | |
619 | /* Errors processing rx data packets */ | |
620 | unsigned long rx_errors; | |
621 | /* Control frames processed from dongle */ | |
622 | unsigned long rx_ctlpkts; | |
623 | ||
624 | /* Errors in processing rx control frames */ | |
625 | unsigned long rx_ctlerrs; | |
626 | /* Packets dropped locally (no memory) */ | |
627 | unsigned long rx_dropped; | |
628 | /* Packets flushed due to unscheduled sendup thread */ | |
629 | unsigned long rx_flushed; | |
630 | /* Number of times dpc scheduled by watchdog timer */ | |
631 | unsigned long wd_dpc_sched; | |
632 | ||
633 | /* Number of packets where header read-ahead was used. */ | |
634 | unsigned long rx_readahead_cnt; | |
635 | /* Number of tx packets we had to realloc for headroom */ | |
636 | unsigned long tx_realloc; | |
637 | /* Number of flow control pkts recvd */ | |
638 | unsigned long fc_packets; | |
639 | ||
640 | /* Last error return */ | |
641 | int bcmerror; | |
642 | uint tickcnt; | |
643 | ||
644 | /* Last error from dongle */ | |
645 | int dongle_error; | |
646 | ||
647 | /* Suspend disable flag flag */ | |
648 | int suspend_disable_flag; /* "1" to disable all extra powersaving | |
649 | during suspend */ | |
650 | int in_suspend; /* flag set to 1 when early suspend called */ | |
651 | int dtim_skip; /* dtim skip , default 0 means wake each dtim */ | |
652 | ||
653 | /* Pkt filter defination */ | |
654 | char *pktfilter[100]; | |
655 | int pktfilter_count; | |
656 | ||
657 | u8 country_code[BRCM_CNTRY_BUF_SZ]; | |
658 | char eventmask[BRCMF_EVENTING_MASK_LEN]; | |
659 | ||
660 | }; | |
661 | ||
662 | struct brcmf_if_event { | |
663 | u8 ifidx; | |
664 | u8 action; | |
665 | u8 flags; | |
666 | u8 bssidx; | |
667 | }; | |
668 | ||
669 | struct bcmevent_name { | |
670 | uint event; | |
671 | const char *name; | |
672 | }; | |
673 | ||
674 | extern const struct bcmevent_name bcmevent_names[]; | |
675 | ||
53a2277d AB |
676 | extern uint brcmf_c_mkiovar(char *name, char *data, uint datalen, |
677 | char *buf, uint len); | |
678 | ||
5b435de0 AS |
679 | /* Indication from bus module regarding presence/insertion of dongle. |
680 | * Return struct brcmf_pub pointer, used as handle to OS module in later calls. | |
681 | * Returned structure should have bus and prot pointers filled in. | |
682 | * bus_hdrlen specifies required headroom for bus module header. | |
683 | */ | |
684 | extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, | |
685 | uint bus_hdrlen); | |
686 | extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx); | |
687 | extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); | |
688 | ||
689 | extern s32 brcmf_exec_dcmd(struct net_device *dev, u32 cmd, void *arg, u32 len); | |
690 | ||
691 | /* Indication from bus module regarding removal/absence of dongle */ | |
692 | extern void brcmf_detach(struct brcmf_pub *drvr); | |
693 | ||
694 | /* Indication from bus module to change flow-control state */ | |
695 | extern void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool on); | |
696 | ||
697 | extern bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q, | |
698 | struct sk_buff *pkt, int prec); | |
699 | ||
700 | /* Receive frame for delivery to OS. Callee disposes of rxp. */ | |
701 | extern void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, | |
0b45bf74 AS |
702 | struct sk_buff_head *rxlist); |
703 | static inline void brcmf_rx_packet(struct brcmf_pub *drvr, int ifidx, | |
704 | struct sk_buff *pkt) | |
705 | { | |
706 | struct sk_buff_head q; | |
707 | ||
708 | skb_queue_head_init(&q); | |
709 | skb_queue_tail(&q, pkt); | |
710 | brcmf_rx_frame(drvr, ifidx, &q); | |
711 | } | |
5b435de0 AS |
712 | |
713 | /* Return pointer to interface name */ | |
714 | extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx); | |
715 | ||
716 | /* Notify tx completion */ | |
717 | extern void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp, | |
718 | bool success); | |
719 | ||
720 | /* Query dongle */ | |
721 | extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, | |
722 | uint cmd, void *buf, uint len); | |
723 | ||
724 | /* OS independent layer functions */ | |
725 | extern int brcmf_os_proto_block(struct brcmf_pub *drvr); | |
726 | extern int brcmf_os_proto_unblock(struct brcmf_pub *drvr); | |
727 | #ifdef BCMDBG | |
af534958 | 728 | extern int brcmf_write_to_file(struct brcmf_pub *drvr, const u8 *buf, int size); |
5b435de0 AS |
729 | #endif /* BCMDBG */ |
730 | ||
731 | extern int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name); | |
732 | extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx, | |
733 | void *pktdata, struct brcmf_event_msg *, | |
734 | void **data_ptr); | |
735 | ||
736 | extern void brcmf_c_init(void); | |
737 | ||
738 | extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, | |
15d45b6f | 739 | char *name, u8 *mac_addr); |
5b435de0 AS |
740 | extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx); |
741 | ||
742 | /* Send packet to dongle via data channel */ | |
743 | extern int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx,\ | |
744 | struct sk_buff *pkt); | |
745 | ||
746 | extern int brcmf_bus_start(struct brcmf_pub *drvr); | |
747 | ||
748 | extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg); | |
749 | extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, | |
750 | int enable, int master_mode); | |
751 | ||
752 | #define BRCMF_DCMD_SMLEN 256 /* "small" cmd buffer required */ | |
753 | #define BRCMF_DCMD_MEDLEN 1536 /* "med" cmd buffer required */ | |
754 | #define BRCMF_DCMD_MAXLEN 8192 /* max length cmd buffer required */ | |
755 | ||
756 | /* message levels */ | |
757 | #define BRCMF_ERROR_VAL 0x0001 | |
758 | #define BRCMF_TRACE_VAL 0x0002 | |
759 | #define BRCMF_INFO_VAL 0x0004 | |
760 | #define BRCMF_DATA_VAL 0x0008 | |
761 | #define BRCMF_CTL_VAL 0x0010 | |
762 | #define BRCMF_TIMER_VAL 0x0020 | |
763 | #define BRCMF_HDRS_VAL 0x0040 | |
764 | #define BRCMF_BYTES_VAL 0x0080 | |
765 | #define BRCMF_INTR_VAL 0x0100 | |
766 | #define BRCMF_GLOM_VAL 0x0400 | |
767 | #define BRCMF_EVENT_VAL 0x0800 | |
768 | #define BRCMF_BTA_VAL 0x1000 | |
769 | #define BRCMF_ISCAN_VAL 0x2000 | |
770 | ||
771 | /* Enter idle immediately (no timeout) */ | |
772 | #define BRCMF_IDLE_IMMEDIATE (-1) | |
773 | #define BRCMF_IDLE_ACTIVE 0 /* Do not request any SD clock change | |
774 | when idle */ | |
775 | #define BRCMF_IDLE_INTERVAL 1 | |
776 | ||
777 | #endif /* _BRCMF_H_ */ |