Commit | Line | Data |
---|---|---|
cf2b4488 HP |
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 | ||
1f660b9c RV |
21 | #ifndef _BRCMF_H_ |
22 | #define _BRCMF_H_ | |
cf2b4488 | 23 | |
c8796cbe AS |
24 | #define BRCMF_VERSION_STR "4.218.248.5" |
25 | ||
366bbb3f AS |
26 | #define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */ |
27 | #define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */ | |
28 | #define BRCMF_C_IOCTL_MAXLEN 8192 | |
29 | ||
30 | #define BRCMF_C_UP 2 | |
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 | |
54 | #define BRCMF_C_GET_DTIMPRD 77 | |
55 | #define BRCMF_C_SET_COUNTRY 84 | |
56 | #define BRCMF_C_GET_PM 85 | |
57 | #define BRCMF_C_SET_PM 86 | |
58 | #define BRCMF_C_GET_AP 117 | |
59 | #define BRCMF_C_SET_AP 118 | |
60 | #define BRCMF_C_GET_RSSI 127 | |
61 | #define BRCMF_C_GET_WSEC 133 | |
62 | #define BRCMF_C_SET_WSEC 134 | |
63 | #define BRCMF_C_GET_PHY_NOISE 135 | |
64 | #define BRCMF_C_GET_BSS_INFO 136 | |
65 | #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185 | |
66 | #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187 | |
67 | #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201 | |
68 | #define BRCMF_C_GET_VALID_CHANNELS 217 | |
69 | #define BRCMF_C_GET_KEY_PRIMARY 235 | |
70 | #define BRCMF_C_SET_KEY_PRIMARY 236 | |
71 | #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258 | |
72 | #define BRCMF_C_GET_VAR 262 | |
73 | #define BRCMF_C_SET_VAR 263 | |
434c14ef RV |
74 | |
75 | /* phy types (returned by WLC_GET_PHYTPE) */ | |
76 | #define WLC_PHY_TYPE_A 0 | |
77 | #define WLC_PHY_TYPE_B 1 | |
78 | #define WLC_PHY_TYPE_G 2 | |
79 | #define WLC_PHY_TYPE_N 4 | |
80 | #define WLC_PHY_TYPE_LP 5 | |
81 | #define WLC_PHY_TYPE_SSN 6 | |
82 | #define WLC_PHY_TYPE_HT 7 | |
83 | #define WLC_PHY_TYPE_LCN 8 | |
84 | #define WLC_PHY_TYPE_NULL 0xf | |
85 | ||
40695d1a AS |
86 | #define BRCMF_PKT_FILTER_FIXED_LEN offsetof(struct brcmf_pkt_filter, u) |
87 | #define BRCMF_PKT_FILTER_PATTERN_FIXED_LEN \ | |
ec66c6fa | 88 | offsetof(struct brcmf_pkt_filter_pattern, mask_and_pattern) |
434c14ef | 89 | |
40695d1a | 90 | #define BRCMF_EVENTING_MASK_LEN 16 |
434c14ef RV |
91 | |
92 | #define TOE_TX_CSUM_OL 0x00000001 | |
93 | #define TOE_RX_CSUM_OL 0x00000002 | |
94 | ||
95 | /* maximum channels returned by the get valid channels iovar */ | |
96 | #define WL_NUMCHANNELS 64 | |
97 | ||
40695d1a | 98 | #define BRCMF_BSS_INFO_VERSION 108 /* current ver of brcmf_bss_info struct */ |
434c14ef | 99 | |
ec66c6fa | 100 | /* size of brcmf_scan_params not including variable length array */ |
40695d1a | 101 | #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64 |
434c14ef RV |
102 | |
103 | /* masks for channel and ssid count */ | |
40695d1a AS |
104 | #define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff |
105 | #define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16 | |
434c14ef | 106 | |
40695d1a AS |
107 | #define BRCMF_SCAN_ACTION_START 1 |
108 | #define BRCMF_SCAN_ACTION_CONTINUE 2 | |
434c14ef RV |
109 | #define WL_SCAN_ACTION_ABORT 3 |
110 | ||
40695d1a | 111 | #define BRCMF_ISCAN_REQ_VERSION 1 |
434c14ef | 112 | |
ec66c6fa | 113 | /* brcmf_iscan_results status values */ |
40695d1a AS |
114 | #define BRCMF_SCAN_RESULTS_SUCCESS 0 |
115 | #define BRCMF_SCAN_RESULTS_PARTIAL 1 | |
116 | #define BRCMF_SCAN_RESULTS_PENDING 2 | |
117 | #define BRCMF_SCAN_RESULTS_ABORTED 3 | |
118 | #define BRCMF_SCAN_RESULTS_NO_MEM 4 | |
434c14ef | 119 | |
434c14ef | 120 | #define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */ |
40695d1a | 121 | #define BRCMF_PRIMARY_KEY (1 << 1) /* primary (ie tx) key */ |
434c14ef RV |
122 | #define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */ |
123 | #define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */ | |
124 | #define WL_IBSS_PEER_GROUP_KEY (1 << 6) /* Indicates a group key for a IBSS PEER */ | |
125 | ||
434c14ef | 126 | /* For supporting multiple interfaces */ |
40695d1a AS |
127 | #define BRCMF_MAX_IFS 16 |
128 | #define BRCMF_DEL_IF -0xe | |
129 | #define BRCMF_BAD_IF -0xf | |
434c14ef | 130 | |
9152bf26 RV |
131 | #define DOT11_BSSTYPE_ANY 2 |
132 | #define DOT11_MAX_DEFAULT_KEYS 4 | |
133 | ||
05dc0f43 AS |
134 | #define BRCMF_EVENT_MSG_LINK 0x01 |
135 | #define BRCMF_EVENT_MSG_FLUSHTXQ 0x02 | |
136 | #define BRCMF_EVENT_MSG_GROUP 0x04 | |
a019382e | 137 | |
63bec49e | 138 | struct brcmf_event_msg { |
a019382e RV |
139 | u16 version; |
140 | u16 flags; | |
141 | u32 event_type; | |
142 | u32 status; | |
143 | u32 reason; | |
144 | u32 auth_type; | |
145 | u32 datalen; | |
146 | u8 addr[ETH_ALEN]; | |
96a6062b | 147 | char ifname[IFNAMSIZ]; |
63bec49e | 148 | } __packed; |
a019382e | 149 | |
05dc0f43 | 150 | struct brcm_ethhdr { |
a019382e RV |
151 | u16 subtype; |
152 | u16 length; | |
153 | u8 version; | |
154 | u8 oui[3]; | |
155 | u16 usr_subtype; | |
05dc0f43 | 156 | } __packed; |
a019382e | 157 | |
63bec49e | 158 | struct brcmf_event { |
a019382e | 159 | struct ethhdr eth; |
05dc0f43 AS |
160 | struct brcm_ethhdr hdr; |
161 | struct brcmf_event_msg msg; | |
63bec49e | 162 | } __packed; |
05dc0f43 AS |
163 | |
164 | #define BRCMF_E_SET_SSID 0 | |
165 | #define BRCMF_E_JOIN 1 | |
166 | #define BRCMF_E_START 2 | |
167 | #define BRCMF_E_AUTH 3 | |
168 | #define BRCMF_E_AUTH_IND 4 | |
169 | #define BRCMF_E_DEAUTH 5 | |
170 | #define BRCMF_E_DEAUTH_IND 6 | |
171 | #define BRCMF_E_ASSOC 7 | |
172 | #define BRCMF_E_ASSOC_IND 8 | |
173 | #define BRCMF_E_REASSOC 9 | |
174 | #define BRCMF_E_REASSOC_IND 10 | |
175 | #define BRCMF_E_DISASSOC 11 | |
176 | #define BRCMF_E_DISASSOC_IND 12 | |
177 | #define BRCMF_E_QUIET_START 13 | |
178 | #define BRCMF_E_QUIET_END 14 | |
179 | #define BRCMF_E_BEACON_RX 15 | |
180 | #define BRCMF_E_LINK 16 | |
181 | #define BRCMF_E_MIC_ERROR 17 | |
182 | #define BRCMF_E_NDIS_LINK 18 | |
183 | #define BRCMF_E_ROAM 19 | |
184 | #define BRCMF_E_TXFAIL 20 | |
185 | #define BRCMF_E_PMKID_CACHE 21 | |
186 | #define BRCMF_E_RETROGRADE_TSF 22 | |
187 | #define BRCMF_E_PRUNE 23 | |
188 | #define BRCMF_E_AUTOAUTH 24 | |
189 | #define BRCMF_E_EAPOL_MSG 25 | |
190 | #define BRCMF_E_SCAN_COMPLETE 26 | |
191 | #define BRCMF_E_ADDTS_IND 27 | |
192 | #define BRCMF_E_DELTS_IND 28 | |
193 | #define BRCMF_E_BCNSENT_IND 29 | |
194 | #define BRCMF_E_BCNRX_MSG 30 | |
195 | #define BRCMF_E_BCNLOST_MSG 31 | |
196 | #define BRCMF_E_ROAM_PREP 32 | |
197 | #define BRCMF_E_PFN_NET_FOUND 33 | |
198 | #define BRCMF_E_PFN_NET_LOST 34 | |
199 | #define BRCMF_E_RESET_COMPLETE 35 | |
200 | #define BRCMF_E_JOIN_START 36 | |
201 | #define BRCMF_E_ROAM_START 37 | |
202 | #define BRCMF_E_ASSOC_START 38 | |
203 | #define BRCMF_E_IBSS_ASSOC 39 | |
204 | #define BRCMF_E_RADIO 40 | |
205 | #define BRCMF_E_PSM_WATCHDOG 41 | |
206 | #define BRCMF_E_PROBREQ_MSG 44 | |
207 | #define BRCMF_E_SCAN_CONFIRM_IND 45 | |
208 | #define BRCMF_E_PSK_SUP 46 | |
209 | #define BRCMF_E_COUNTRY_CODE_CHANGED 47 | |
210 | #define BRCMF_E_EXCEEDED_MEDIUM_TIME 48 | |
211 | #define BRCMF_E_ICV_ERROR 49 | |
212 | #define BRCMF_E_UNICAST_DECODE_ERROR 50 | |
213 | #define BRCMF_E_MULTICAST_DECODE_ERROR 51 | |
214 | #define BRCMF_E_TRACE 52 | |
215 | #define BRCMF_E_IF 54 | |
216 | #define BRCMF_E_RSSI 56 | |
217 | #define BRCMF_E_PFN_SCAN_COMPLETE 57 | |
218 | #define BRCMF_E_EXTLOG_MSG 58 | |
219 | #define BRCMF_E_ACTION_FRAME 59 | |
220 | #define BRCMF_E_ACTION_FRAME_COMPLETE 60 | |
221 | #define BRCMF_E_PRE_ASSOC_IND 61 | |
222 | #define BRCMF_E_PRE_REASSOC_IND 62 | |
223 | #define BRCMF_E_CHANNEL_ADOPTED 63 | |
224 | #define BRCMF_E_AP_STARTED 64 | |
225 | #define BRCMF_E_DFS_AP_STOP 65 | |
226 | #define BRCMF_E_DFS_AP_RESUME 66 | |
227 | #define BRCMF_E_RESERVED1 67 | |
228 | #define BRCMF_E_RESERVED2 68 | |
229 | #define BRCMF_E_ESCAN_RESULT 69 | |
230 | #define BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70 | |
231 | #define BRCMF_E_DCS_REQUEST 73 | |
232 | ||
233 | #define BRCMF_E_FIFO_CREDIT_MAP 74 | |
234 | ||
235 | #define BRCMF_E_LAST 75 | |
236 | ||
237 | #define BRCMF_E_STATUS_SUCCESS 0 | |
238 | #define BRCMF_E_STATUS_FAIL 1 | |
239 | #define BRCMF_E_STATUS_TIMEOUT 2 | |
240 | #define BRCMF_E_STATUS_NO_NETWORKS 3 | |
241 | #define BRCMF_E_STATUS_ABORT 4 | |
242 | #define BRCMF_E_STATUS_NO_ACK 5 | |
243 | #define BRCMF_E_STATUS_UNSOLICITED 6 | |
244 | #define BRCMF_E_STATUS_ATTEMPT 7 | |
245 | #define BRCMF_E_STATUS_PARTIAL 8 | |
246 | #define BRCMF_E_STATUS_NEWSCAN 9 | |
247 | #define BRCMF_E_STATUS_NEWASSOC 10 | |
248 | #define BRCMF_E_STATUS_11HQUIET 11 | |
249 | #define BRCMF_E_STATUS_SUPPRESS 12 | |
250 | #define BRCMF_E_STATUS_NOCHANS 13 | |
251 | #define BRCMF_E_STATUS_CS_ABORT 15 | |
252 | #define BRCMF_E_STATUS_ERROR 16 | |
253 | ||
254 | #define BRCMF_E_REASON_INITIAL_ASSOC 0 | |
255 | #define BRCMF_E_REASON_LOW_RSSI 1 | |
256 | #define BRCMF_E_REASON_DEAUTH 2 | |
257 | #define BRCMF_E_REASON_DISASSOC 3 | |
258 | #define BRCMF_E_REASON_BCNS_LOST 4 | |
259 | #define BRCMF_E_REASON_MINTXRATE 9 | |
260 | #define BRCMF_E_REASON_TXFAIL 10 | |
261 | ||
262 | #define BRCMF_E_REASON_FAST_ROAM_FAILED 5 | |
263 | #define BRCMF_E_REASON_DIRECTED_ROAM 6 | |
264 | #define BRCMF_E_REASON_TSPEC_REJECTED 7 | |
265 | #define BRCMF_E_REASON_BETTER_AP 8 | |
266 | ||
267 | #define BRCMF_E_PRUNE_ENCR_MISMATCH 1 | |
268 | #define BRCMF_E_PRUNE_BCAST_BSSID 2 | |
269 | #define BRCMF_E_PRUNE_MAC_DENY 3 | |
270 | #define BRCMF_E_PRUNE_MAC_NA 4 | |
271 | #define BRCMF_E_PRUNE_REG_PASSV 5 | |
272 | #define BRCMF_E_PRUNE_SPCT_MGMT 6 | |
273 | #define BRCMF_E_PRUNE_RADAR 7 | |
274 | #define BRCMF_E_RSN_MISMATCH 8 | |
275 | #define BRCMF_E_PRUNE_NO_COMMON_RATES 9 | |
276 | #define BRCMF_E_PRUNE_BASIC_RATES 10 | |
277 | #define BRCMF_E_PRUNE_CIPHER_NA 12 | |
278 | #define BRCMF_E_PRUNE_KNOWN_STA 13 | |
279 | #define BRCMF_E_PRUNE_WDS_PEER 15 | |
280 | #define BRCMF_E_PRUNE_QBSS_LOAD 16 | |
281 | #define BRCMF_E_PRUNE_HOME_AP 17 | |
282 | ||
283 | #define BRCMF_E_SUP_OTHER 0 | |
284 | #define BRCMF_E_SUP_DECRYPT_KEY_DATA 1 | |
285 | #define BRCMF_E_SUP_BAD_UCAST_WEP128 2 | |
286 | #define BRCMF_E_SUP_BAD_UCAST_WEP40 3 | |
287 | #define BRCMF_E_SUP_UNSUP_KEY_LEN 4 | |
288 | #define BRCMF_E_SUP_PW_KEY_CIPHER 5 | |
289 | #define BRCMF_E_SUP_MSG3_TOO_MANY_IE 6 | |
290 | #define BRCMF_E_SUP_MSG3_IE_MISMATCH 7 | |
291 | #define BRCMF_E_SUP_NO_INSTALL_FLAG 8 | |
292 | #define BRCMF_E_SUP_MSG3_NO_GTK 9 | |
293 | #define BRCMF_E_SUP_GRP_KEY_CIPHER 10 | |
294 | #define BRCMF_E_SUP_GRP_MSG1_NO_GTK 11 | |
295 | #define BRCMF_E_SUP_GTK_DECRYPT_FAIL 12 | |
296 | #define BRCMF_E_SUP_SEND_FAIL 13 | |
297 | #define BRCMF_E_SUP_DEAUTH 14 | |
298 | ||
299 | #define BRCMF_E_IF_ADD 1 | |
300 | #define BRCMF_E_IF_DEL 2 | |
301 | #define BRCMF_E_IF_CHANGE 3 | |
302 | ||
303 | #define BRCMF_E_IF_ROLE_STA 0 | |
304 | #define BRCMF_E_IF_ROLE_AP 1 | |
305 | #define BRCMF_E_IF_ROLE_WDS 2 | |
306 | ||
307 | #define BRCMF_E_LINK_BCN_LOSS 1 | |
308 | #define BRCMF_E_LINK_DISASSOC 2 | |
309 | #define BRCMF_E_LINK_ASSOC_REC 3 | |
310 | #define BRCMF_E_LINK_BSSCFG_DIS 4 | |
a019382e | 311 | |
cf2b4488 | 312 | /* The level of bus communication with the dongle */ |
1f660b9c RV |
313 | enum brcmf_bus_state { |
314 | BRCMF_BUS_DOWN, /* Not ready for frame transfers */ | |
315 | BRCMF_BUS_LOAD, /* Download access only (CPU reset) */ | |
316 | BRCMF_BUS_DATA /* Ready for frame transfers */ | |
cf2b4488 HP |
317 | }; |
318 | ||
434c14ef RV |
319 | /* Pattern matching filter. Specifies an offset within received packets to |
320 | * start matching, the pattern to match, the size of the pattern, and a bitmask | |
321 | * that indicates which bits within the pattern should be matched. | |
322 | */ | |
ec66c6fa | 323 | struct brcmf_pkt_filter_pattern { |
434c14ef RV |
324 | u32 offset; /* Offset within received packet to start pattern matching. |
325 | * Offset '0' is the first byte of the ethernet header. | |
326 | */ | |
327 | u32 size_bytes; /* Size of the pattern. Bitmask must be the same size. */ | |
328 | u8 mask_and_pattern[1]; /* Variable length mask and pattern data. mask starts | |
329 | * at offset 0. Pattern immediately follows mask. | |
330 | */ | |
ec66c6fa | 331 | }; |
434c14ef RV |
332 | |
333 | /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */ | |
ec66c6fa | 334 | struct brcmf_pkt_filter { |
434c14ef RV |
335 | u32 id; /* Unique filter id, specified by app. */ |
336 | u32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */ | |
337 | u32 negate_match; /* Negate the result of filter matches */ | |
338 | union { /* Filter definitions */ | |
ec66c6fa | 339 | struct brcmf_pkt_filter_pattern pattern; /* Filter pattern */ |
434c14ef | 340 | } u; |
ec66c6fa | 341 | }; |
434c14ef RV |
342 | |
343 | /* IOVAR "pkt_filter_enable" parameter. */ | |
ec66c6fa | 344 | struct brcmf_pkt_filter_enable { |
434c14ef RV |
345 | u32 id; /* Unique filter id */ |
346 | u32 enable; /* Enable/disable bool */ | |
ec66c6fa | 347 | }; |
434c14ef RV |
348 | |
349 | /* BSS info structure | |
350 | * Applications MUST CHECK ie_offset field and length field to access IEs and | |
ec66c6fa | 351 | * next bss_info structure in a vector (in struct brcmf_scan_results) |
434c14ef | 352 | */ |
ec66c6fa | 353 | struct brcmf_bss_info { |
434c14ef RV |
354 | u32 version; /* version field */ |
355 | u32 length; /* byte length of data in this record, | |
356 | * starting at version and including IEs | |
357 | */ | |
358 | u8 BSSID[ETH_ALEN]; | |
359 | u16 beacon_period; /* units are Kusec */ | |
360 | u16 capability; /* Capability information */ | |
361 | u8 SSID_len; | |
362 | u8 SSID[32]; | |
363 | struct { | |
364 | uint count; /* # rates in this set */ | |
365 | u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ | |
366 | } rateset; /* supported rates */ | |
367 | chanspec_t chanspec; /* chanspec for bss */ | |
368 | u16 atim_window; /* units are Kusec */ | |
369 | u8 dtim_period; /* DTIM period */ | |
370 | s16 RSSI; /* receive signal strength (in dBm) */ | |
371 | s8 phy_noise; /* noise (in dBm) */ | |
372 | ||
373 | u8 n_cap; /* BSS is 802.11N Capable */ | |
374 | u32 nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */ | |
375 | u8 ctl_ch; /* 802.11N BSS control channel number */ | |
376 | u32 reserved32[1]; /* Reserved for expansion of BSS properties */ | |
377 | u8 flags; /* flags */ | |
378 | u8 reserved[3]; /* Reserved for expansion of BSS properties */ | |
379 | u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */ | |
380 | ||
381 | u16 ie_offset; /* offset at which IEs start, from beginning */ | |
382 | u32 ie_length; /* byte length of Information Elements */ | |
383 | s16 SNR; /* average SNR of during frame reception */ | |
384 | /* Add new fields here */ | |
385 | /* variable length Information Elements */ | |
ec66c6fa | 386 | }; |
434c14ef | 387 | |
ec66c6fa | 388 | struct brcmf_ssid { |
434c14ef RV |
389 | u32 SSID_len; |
390 | unsigned char SSID[32]; | |
ec66c6fa | 391 | }; |
434c14ef | 392 | |
ec66c6fa AS |
393 | struct brcmf_scan_params { |
394 | struct brcmf_ssid ssid; /* default: {0, ""} */ | |
434c14ef RV |
395 | u8 bssid[ETH_ALEN]; /* default: bcast */ |
396 | s8 bss_type; /* default: any, | |
397 | * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT | |
398 | */ | |
399 | u8 scan_type; /* flags, 0 use default */ | |
400 | s32 nprobes; /* -1 use default, number of probes per channel */ | |
401 | s32 active_time; /* -1 use default, dwell time per channel for | |
402 | * active scanning | |
403 | */ | |
404 | s32 passive_time; /* -1 use default, dwell time per channel | |
405 | * for passive scanning | |
406 | */ | |
407 | s32 home_time; /* -1 use default, dwell time for the home channel | |
408 | * between channel scans | |
409 | */ | |
410 | s32 channel_num; /* count of channels and ssids that follow | |
411 | * | |
ec66c6fa AS |
412 | * low half is count of channels in |
413 | * channel_list, 0 means default (use all | |
414 | * available channels) | |
434c14ef | 415 | * |
ec66c6fa AS |
416 | * high half is entries in struct brcmf_ssid |
417 | * array that follows channel_list, aligned for | |
418 | * s32 (4 bytes) meaning an odd channel count | |
419 | * implies a 2-byte pad between end of | |
420 | * channel_list and first ssid | |
434c14ef | 421 | * |
ec66c6fa AS |
422 | * if ssid count is zero, single ssid in the |
423 | * fixed parameter portion is assumed, otherwise | |
424 | * ssid in the fixed portion is ignored | |
434c14ef RV |
425 | */ |
426 | u16 channel_list[1]; /* list of chanspecs */ | |
ec66c6fa | 427 | }; |
434c14ef RV |
428 | |
429 | /* incremental scan struct */ | |
ec66c6fa | 430 | struct brcmf_iscan_params { |
434c14ef RV |
431 | u32 version; |
432 | u16 action; | |
433 | u16 scan_duration; | |
ec66c6fa AS |
434 | struct brcmf_scan_params params; |
435 | }; | |
434c14ef | 436 | |
ec66c6fa AS |
437 | /* 3 fields + size of brcmf_scan_params, not including variable length array */ |
438 | #define BRCMF_ISCAN_PARAMS_FIXED_SIZE \ | |
439 | (offsetof(struct brcmf_iscan_params, params) + \ | |
440 | sizeof(struct brcmf_ssid)) | |
434c14ef | 441 | |
ec66c6fa | 442 | struct brcmf_scan_results { |
434c14ef RV |
443 | u32 buflen; |
444 | u32 version; | |
445 | u32 count; | |
ec66c6fa AS |
446 | struct brcmf_bss_info bss_info[1]; |
447 | }; | |
434c14ef | 448 | |
434c14ef | 449 | /* used for association with a specific BSSID and chanspec list */ |
ec66c6fa | 450 | struct brcmf_assoc_params { |
434c14ef RV |
451 | u8 bssid[ETH_ALEN]; /* 00:00:00:00:00:00: broadcast scan */ |
452 | s32 chanspec_num; /* 0: all available channels, | |
453 | * otherwise count of chanspecs in chanspec_list | |
454 | */ | |
455 | chanspec_t chanspec_list[1]; /* list of chanspecs */ | |
ec66c6fa | 456 | }; |
40695d1a | 457 | #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \ |
ec66c6fa | 458 | (sizeof(struct brcmf_assoc_params) - sizeof(chanspec_t)) |
434c14ef | 459 | |
434c14ef | 460 | /* used for join with or without a specific bssid and channel list */ |
ec66c6fa AS |
461 | struct brcmf_join_params { |
462 | struct brcmf_ssid ssid; | |
463 | struct brcmf_assoc_params params; | |
464 | }; | |
434c14ef | 465 | |
ec66c6fa AS |
466 | /* size of brcmf_scan_results not including variable length array */ |
467 | #define BRCMF_SCAN_RESULTS_FIXED_SIZE \ | |
468 | (sizeof(struct brcmf_scan_results) - sizeof(struct brcmf_bss_info)) | |
434c14ef RV |
469 | |
470 | /* incremental scan results struct */ | |
ec66c6fa | 471 | struct brcmf_iscan_results { |
434c14ef | 472 | u32 status; |
ec66c6fa AS |
473 | struct brcmf_scan_results results; |
474 | }; | |
434c14ef | 475 | |
ec66c6fa AS |
476 | /* size of brcmf_iscan_results not including variable length array */ |
477 | #define BRCMF_ISCAN_RESULTS_FIXED_SIZE \ | |
478 | (BRCMF_SCAN_RESULTS_FIXED_SIZE + \ | |
479 | offsetof(struct brcmf_iscan_results, results)) | |
434c14ef | 480 | |
ec66c6fa | 481 | struct brcmf_wsec_key { |
434c14ef RV |
482 | u32 index; /* key index */ |
483 | u32 len; /* key length */ | |
484 | u8 data[WLAN_MAX_KEY_LEN]; /* key data */ | |
485 | u32 pad_1[18]; | |
486 | u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ | |
487 | u32 flags; /* misc flags */ | |
488 | u32 pad_2[2]; | |
489 | int pad_3; | |
490 | int iv_initialized; /* has IV been initialized already? */ | |
491 | int pad_4; | |
492 | /* Rx IV */ | |
493 | struct { | |
494 | u32 hi; /* upper 32 bits of IV */ | |
495 | u16 lo; /* lower 16 bits of IV */ | |
496 | } rxiv; | |
497 | u32 pad_5[2]; | |
498 | u8 ea[ETH_ALEN]; /* per station */ | |
ec66c6fa | 499 | }; |
434c14ef RV |
500 | |
501 | /* Used to get specific STA parameters */ | |
ec66c6fa | 502 | struct brcmf_scb_val { |
434c14ef RV |
503 | u32 val; |
504 | u8 ea[ETH_ALEN]; | |
ec66c6fa | 505 | }; |
434c14ef RV |
506 | |
507 | /* channel encoding */ | |
ec66c6fa | 508 | struct brcmf_channel_info { |
434c14ef RV |
509 | int hw_channel; |
510 | int target_channel; | |
511 | int scan_channel; | |
ec66c6fa | 512 | }; |
434c14ef RV |
513 | |
514 | /* Linux network driver ioctl encoding */ | |
ec66c6fa | 515 | struct brcmf_ioctl { |
434c14ef RV |
516 | uint cmd; /* common ioctl definition */ |
517 | void *buf; /* pointer to user buffer */ | |
518 | uint len; /* length of user buffer */ | |
519 | u8 set; /* get or set request (optional) */ | |
520 | uint used; /* bytes read or written (optional) */ | |
521 | uint needed; /* bytes needed (optional) */ | |
ec66c6fa | 522 | }; |
434c14ef | 523 | |
fb1d0aa2 | 524 | /* Forward decls for struct brcmf_pub (see below) */ |
46c3db78 | 525 | struct brcmf_bus; /* device bus info */ |
e35efc81 | 526 | struct brcmf_proto; /* device communication protocol info */ |
abfe1804 | 527 | struct brcmf_info; /* device driver info */ |
e35efc81 | 528 | |
cf2b4488 | 529 | /* Common structure for module and instance linkage */ |
fb1d0aa2 | 530 | struct brcmf_pub { |
cf2b4488 | 531 | /* Linkage ponters */ |
46c3db78 | 532 | struct brcmf_bus *bus; |
e35efc81 | 533 | struct brcmf_proto *prot; |
abfe1804 | 534 | struct brcmf_info *info; |
cf2b4488 | 535 | |
1f660b9c | 536 | /* Internal brcmf items */ |
cf2b4488 HP |
537 | bool up; /* Driver up/down (to OS) */ |
538 | bool txoff; /* Transmit flow-controlled */ | |
0f0881b0 | 539 | bool dongle_reset; /* true = DEVRESET put dongle into reset */ |
1f660b9c RV |
540 | enum brcmf_bus_state busstate; |
541 | uint hdrlen; /* Total BRCMF header length (proto + bus) */ | |
cf2b4488 HP |
542 | uint maxctl; /* Max size rxctl request from proto to bus */ |
543 | uint rxsz; /* Rx buffer size bus module should use */ | |
3fd79f7c | 544 | u8 wme_dp; /* wme discard priority */ |
cf2b4488 HP |
545 | |
546 | /* Dongle media info */ | |
547 | bool iswl; /* Dongle-resident driver is wl */ | |
3deea904 | 548 | unsigned long drv_version; /* Version of dongle-resident driver */ |
a44d4236 | 549 | u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */ |
63bec49e | 550 | struct dngl_stats dstats; /* Stats for dongle-based data */ |
cf2b4488 HP |
551 | |
552 | /* Additional stats for the bus level */ | |
3deea904 GKH |
553 | unsigned long tx_packets; /* Data packets sent to dongle */ |
554 | unsigned long tx_multicast; /* Multicast data packets sent to dongle */ | |
555 | unsigned long tx_errors; /* Errors in sending data to dongle */ | |
556 | unsigned long tx_ctlpkts; /* Control packets sent to dongle */ | |
557 | unsigned long tx_ctlerrs; /* Errors sending control frames to dongle */ | |
558 | unsigned long rx_packets; /* Packets sent up the network interface */ | |
559 | unsigned long rx_multicast; /* Multicast packets sent up the network | |
cf2b4488 | 560 | interface */ |
3deea904 GKH |
561 | unsigned long rx_errors; /* Errors processing rx data packets */ |
562 | unsigned long rx_ctlpkts; /* Control frames processed from dongle */ | |
563 | unsigned long rx_ctlerrs; /* Errors in processing rx control frames */ | |
564 | unsigned long rx_dropped; /* Packets dropped locally (no memory) */ | |
565 | unsigned long rx_flushed; /* Packets flushed due to | |
cf2b4488 | 566 | unscheduled sendup thread */ |
1f660b9c | 567 | unsigned long wd_dpc_sched; /* Number of times dpc scheduled by |
cf2b4488 HP |
568 | watchdog timer */ |
569 | ||
3deea904 | 570 | unsigned long rx_readahead_cnt; /* Number of packets where header read-ahead |
cf2b4488 | 571 | was used. */ |
3deea904 | 572 | unsigned long tx_realloc; /* Number of tx packets we had to realloc for |
cf2b4488 | 573 | headroom */ |
3deea904 | 574 | unsigned long fc_packets; /* Number of flow control pkts recvd */ |
cf2b4488 HP |
575 | |
576 | /* Last error return */ | |
577 | int bcmerror; | |
578 | uint tickcnt; | |
579 | ||
580 | /* Last error from dongle */ | |
581 | int dongle_error; | |
582 | ||
583 | /* Suspend disable flag flag */ | |
584 | int suspend_disable_flag; /* "1" to disable all extra powersaving | |
585 | during suspend */ | |
586 | int in_suspend; /* flag set to 1 when early suspend called */ | |
cf2b4488 HP |
587 | int dtim_skip; /* dtim skip , default 0 means wake each dtim */ |
588 | ||
589 | /* Pkt filter defination */ | |
590 | char *pktfilter[100]; | |
591 | int pktfilter_count; | |
592 | ||
3fd79f7c | 593 | u8 country_code[WLC_CNTRY_BUF_SZ]; |
40695d1a | 594 | char eventmask[BRCMF_EVENTING_MASK_LEN]; |
cf2b4488 | 595 | |
fb1d0aa2 | 596 | }; |
cf2b4488 | 597 | |
bb26354a | 598 | struct brcmf_if_event { |
434c14ef RV |
599 | u8 ifidx; |
600 | u8 action; | |
601 | u8 flags; | |
602 | u8 bssidx; | |
bb26354a | 603 | }; |
434c14ef | 604 | |
bb26354a | 605 | struct brcmf_timeout { |
434c14ef RV |
606 | u32 limit; /* Expiration time (usec) */ |
607 | u32 increment; /* Current expiration increment (usec) */ | |
608 | u32 elapsed; /* Current elapsed time (usec) */ | |
609 | u32 tick; /* O/S tick time (usec) */ | |
bb26354a | 610 | }; |
434c14ef | 611 | |
63bec49e | 612 | struct bcmevent_name { |
a019382e RV |
613 | uint event; |
614 | const char *name; | |
63bec49e | 615 | }; |
a019382e | 616 | |
cf2b4488 | 617 | #if defined(CONFIG_PM_SLEEP) |
8d825a8e | 618 | extern atomic_t brcmf_mmc_suspend; |
40695d1a AS |
619 | #define BRCMF_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); |
620 | #define _BRCMF_PM_RESUME_WAIT(a, b) do { \ | |
e6e8f894 | 621 | int retry = 0; \ |
8d825a8e | 622 | while (atomic_read(&brcmf_mmc_suspend) && retry++ != b) { \ |
e6e8f894 SS |
623 | wait_event_timeout(a, false, HZ/100); \ |
624 | } \ | |
625 | } while (0) | |
40695d1a | 626 | #define BRCMF_PM_RESUME_WAIT(a) _BRCMF_PM_RESUME_WAIT(a, 30) |
40695d1a | 627 | #define BRCMF_PM_RESUME_RETURN_ERROR(a) \ |
8d825a8e | 628 | do { if (atomic_read(&brcmf_mmc_suspend)) return a; } while (0) |
cf2b4488 | 629 | |
40695d1a AS |
630 | #define BRCMF_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); |
631 | #define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \ | |
cf2b4488 HP |
632 | uint countdown = (us) + 9999; \ |
633 | while ((exp) && (countdown >= 10000)) { \ | |
0965ae88 | 634 | wait_event_timeout(a, false, HZ/100); \ |
cf2b4488 HP |
635 | countdown -= 10000; \ |
636 | } \ | |
637 | } while (0) | |
638 | ||
639 | #else | |
640 | ||
40695d1a AS |
641 | #define BRCMF_PM_RESUME_WAIT_INIT(a) |
642 | #define BRCMF_PM_RESUME_WAIT(a) | |
40695d1a | 643 | #define BRCMF_PM_RESUME_RETURN_ERROR(a) |
cf2b4488 | 644 | |
40695d1a AS |
645 | #define BRCMF_SPINWAIT_SLEEP_INIT(a) |
646 | #define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \ | |
cf2b4488 HP |
647 | uint countdown = (us) + 9; \ |
648 | while ((exp) && (countdown >= 10)) { \ | |
7383141b | 649 | udelay(10); \ |
cf2b4488 HP |
650 | countdown -= 10; \ |
651 | } \ | |
652 | } while (0) | |
653 | ||
654 | #endif /* defined(CONFIG_PM_SLEEP) */ | |
434c14ef RV |
655 | |
656 | /* | |
657 | * Insmod parameters for debug/test | |
658 | */ | |
659 | ||
434c14ef | 660 | /* Use interrupts */ |
5e92aa8c | 661 | extern uint brcmf_intr; |
434c14ef RV |
662 | |
663 | /* Use polling */ | |
5e92aa8c | 664 | extern uint brcmf_poll; |
434c14ef RV |
665 | |
666 | /* ARP offload agent mode */ | |
5e92aa8c | 667 | extern uint brcmf_arp_mode; |
434c14ef RV |
668 | |
669 | /* ARP offload enable */ | |
5e92aa8c | 670 | extern uint brcmf_arp_enable; |
434c14ef RV |
671 | |
672 | /* Pkt filte enable control */ | |
5e92aa8c | 673 | extern uint brcmf_pkt_filter_enable; |
434c14ef RV |
674 | |
675 | /* Pkt filter init setup */ | |
5e92aa8c | 676 | extern uint brcmf_pkt_filter_init; |
434c14ef RV |
677 | |
678 | /* Pkt filter mode control */ | |
5e92aa8c | 679 | extern uint brcmf_master_mode; |
434c14ef RV |
680 | |
681 | /* Roaming mode control */ | |
5e92aa8c | 682 | extern uint brcmf_roam; |
434c14ef RV |
683 | |
684 | /* Roaming mode control */ | |
5e92aa8c | 685 | extern uint brcmf_radio_up; |
434c14ef RV |
686 | |
687 | /* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */ | |
5e92aa8c AS |
688 | extern int brcmf_idletime; |
689 | #define BRCMF_IDLETIME_TICKS 1 | |
434c14ef RV |
690 | |
691 | /* SDIO Drive Strength */ | |
5e92aa8c | 692 | extern uint brcmf_sdiod_drive_strength; |
434c14ef RV |
693 | |
694 | /* Override to force tx queueing all the time */ | |
5e92aa8c | 695 | extern uint brcmf_force_tx_queueing; |
434c14ef RV |
696 | |
697 | #ifdef SDTEST | |
698 | /* Echo packet generator (SDIO), pkts/s */ | |
5e92aa8c | 699 | extern uint brcmf_pktgen; |
434c14ef RV |
700 | |
701 | /* Echo packet len (0 => sawtooth, max 1800) */ | |
5e92aa8c AS |
702 | extern uint brcmf_pktgen_len; |
703 | #define BRCMF_MAX_PKTGEN_LEN 1800 | |
434c14ef RV |
704 | #endif |
705 | ||
434c14ef | 706 | extern u32 g_assert_type; |
63bec49e | 707 | extern const struct bcmevent_name bcmevent_names[]; |
a019382e RV |
708 | extern const int bcmevent_names_size; |
709 | ||
cf2b4488 | 710 | |
6758a717 | 711 | static inline void MUTEX_LOCK_INIT(struct brcmf_pub *drvr) |
cf2b4488 HP |
712 | { |
713 | } | |
714 | ||
6758a717 | 715 | static inline void MUTEX_LOCK(struct brcmf_pub *drvr) |
cf2b4488 HP |
716 | { |
717 | } | |
718 | ||
6758a717 | 719 | static inline void MUTEX_UNLOCK(struct brcmf_pub *drvr) |
cf2b4488 HP |
720 | { |
721 | } | |
722 | ||
6758a717 | 723 | static inline void MUTEX_LOCK_SOFTAP_SET_INIT(struct brcmf_pub *drvr) |
cf2b4488 HP |
724 | { |
725 | } | |
726 | ||
6758a717 | 727 | static inline void MUTEX_LOCK_SOFTAP_SET(struct brcmf_pub *drvr) |
cf2b4488 HP |
728 | { |
729 | } | |
730 | ||
6758a717 | 731 | static inline void MUTEX_UNLOCK_SOFTAP_SET(struct brcmf_pub *drvr) |
cf2b4488 HP |
732 | { |
733 | } | |
734 | ||
735 | static inline void MUTEX_LOCK_WL_SCAN_SET_INIT(void) | |
736 | { | |
737 | } | |
738 | ||
739 | static inline void MUTEX_LOCK_WL_SCAN_SET(void) | |
740 | { | |
741 | } | |
742 | ||
743 | static inline void MUTEX_UNLOCK_WL_SCAN_SET(void) | |
744 | { | |
745 | } | |
746 | ||
cf2b4488 | 747 | /* Indication from bus module regarding presence/insertion of dongle. |
fb1d0aa2 | 748 | * Return struct brcmf_pub pointer, used as handle to OS module in later calls. |
cf2b4488 HP |
749 | * Returned structure should have bus and prot pointers filled in. |
750 | * bus_hdrlen specifies required headroom for bus module header. | |
751 | */ | |
46c3db78 | 752 | extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, |
6758a717 AS |
753 | uint bus_hdrlen); |
754 | extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx); | |
fc2860a9 | 755 | extern int brcmf_netdev_wait_pend8021x(struct net_device *dev); |
cf2b4488 HP |
756 | |
757 | /* Indication from bus module regarding removal/absence of dongle */ | |
6758a717 | 758 | extern void brcmf_detach(struct brcmf_pub *drvr); |
cf2b4488 HP |
759 | |
760 | /* Indication from bus module to change flow-control state */ | |
6758a717 | 761 | extern void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool on); |
cf2b4488 | 762 | |
6758a717 | 763 | extern bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q, |
c26b1378 | 764 | struct sk_buff *pkt, int prec); |
cf2b4488 HP |
765 | |
766 | /* Receive frame for delivery to OS. Callee disposes of rxp. */ | |
6758a717 | 767 | extern void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, |
c26b1378 | 768 | struct sk_buff *rxp, int numpkt); |
cf2b4488 HP |
769 | |
770 | /* Return pointer to interface name */ | |
6758a717 | 771 | extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx); |
cf2b4488 | 772 | |
cf2b4488 | 773 | /* Notify tx completion */ |
6758a717 | 774 | extern void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp, |
a84bac46 | 775 | bool success); |
cf2b4488 HP |
776 | |
777 | /* Query ioctl */ | |
6758a717 | 778 | extern int brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, |
fb1d0aa2 | 779 | uint cmd, void *buf, uint len); |
cf2b4488 HP |
780 | |
781 | /* OS independent layer functions */ | |
6758a717 AS |
782 | extern int brcmf_os_proto_block(struct brcmf_pub *drvr); |
783 | extern int brcmf_os_proto_unblock(struct brcmf_pub *drvr); | |
784 | extern int brcmf_os_ioctl_resp_wait(struct brcmf_pub *drvr, uint *condition, | |
cf2b4488 | 785 | bool *pending); |
6758a717 | 786 | extern int brcmf_os_ioctl_resp_wake(struct brcmf_pub *drvr); |
a84bac46 AS |
787 | extern unsigned int brcmf_os_get_ioctl_resp_timeout(void); |
788 | extern void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec); | |
762c2a36 | 789 | #ifdef BCMDBG |
6758a717 | 790 | extern int brcmf_write_to_file(struct brcmf_pub *drvr, u8 *buf, int size); |
762c2a36 | 791 | #endif /* BCMDBG */ |
cf2b4488 | 792 | |
bb26354a AS |
793 | extern void brcmf_timeout_start(struct brcmf_timeout *tmo, uint usec); |
794 | extern int brcmf_timeout_expired(struct brcmf_timeout *tmo); | |
cf2b4488 | 795 | |
6758a717 AS |
796 | extern int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name); |
797 | extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx, | |
63bec49e | 798 | void *pktdata, struct brcmf_event_msg *, |
6758a717 | 799 | void **data_ptr); |
cf2b4488 | 800 | |
aba5e0ad | 801 | extern void brcmf_c_init(void); |
cf2b4488 | 802 | |
6758a717 | 803 | extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle, |
66cbd3ab | 804 | char *name, u8 *mac_addr, u32 flags, u8 bssidx); |
6758a717 | 805 | extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx); |
cf2b4488 | 806 | |
cf2b4488 | 807 | /* Send packet to dongle via data channel */ |
6758a717 | 808 | extern int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx,\ |
fb1d0aa2 | 809 | struct sk_buff *pkt); |
cf2b4488 | 810 | |
6758a717 AS |
811 | extern int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag); |
812 | extern int brcmf_bus_start(struct brcmf_pub *drvr); | |
cf2b4488 | 813 | |
6758a717 AS |
814 | extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg); |
815 | extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, | |
aba5e0ad | 816 | int enable, int master_mode); |
e51b3e52 | 817 | |
13f401cb RV |
818 | #ifdef BCMDBG |
819 | #define ASSERT(exp) \ | |
820 | do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0) | |
821 | extern void osl_assert(char *exp, char *file, int line); | |
822 | #else | |
823 | #define ASSERT(exp) do {} while (0) | |
824 | #endif /* defined(BCMDBG) */ | |
825 | ||
434c14ef | 826 | /* Linux network driver ioctl encoding */ |
bb26354a | 827 | struct brcmf_c_ioctl { |
434c14ef RV |
828 | uint cmd; /* common ioctl definition */ |
829 | void *buf; /* pointer to user buffer */ | |
830 | uint len; /* length of user buffer */ | |
831 | bool set; /* get or set request (optional) */ | |
832 | uint used; /* bytes read or written (optional) */ | |
833 | uint needed; /* bytes needed (optional) */ | |
834 | uint driver; /* to identify target driver */ | |
bb26354a | 835 | }; |
434c14ef RV |
836 | |
837 | /* per-driver magic numbers */ | |
40695d1a | 838 | #define BRCMF_IOCTL_MAGIC 0x00444944 |
434c14ef RV |
839 | |
840 | /* bump this number if you change the ioctl interface */ | |
40695d1a | 841 | #define BRCMF_IOCTL_VERSION 1 |
40695d1a | 842 | #define BRCMF_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */ |
434c14ef RV |
843 | |
844 | /* common ioctl definitions */ | |
40695d1a AS |
845 | #define BRCMF_GET_MAGIC 0 |
846 | #define BRCMF_GET_VERSION 1 | |
847 | #define BRCMF_GET_VAR 2 | |
848 | #define BRCMF_SET_VAR 3 | |
434c14ef RV |
849 | |
850 | /* message levels */ | |
40695d1a AS |
851 | #define BRCMF_ERROR_VAL 0x0001 |
852 | #define BRCMF_TRACE_VAL 0x0002 | |
853 | #define BRCMF_INFO_VAL 0x0004 | |
854 | #define BRCMF_DATA_VAL 0x0008 | |
855 | #define BRCMF_CTL_VAL 0x0010 | |
856 | #define BRCMF_TIMER_VAL 0x0020 | |
857 | #define BRCMF_HDRS_VAL 0x0040 | |
858 | #define BRCMF_BYTES_VAL 0x0080 | |
859 | #define BRCMF_INTR_VAL 0x0100 | |
40695d1a AS |
860 | #define BRCMF_GLOM_VAL 0x0400 |
861 | #define BRCMF_EVENT_VAL 0x0800 | |
862 | #define BRCMF_BTA_VAL 0x1000 | |
863 | #define BRCMF_ISCAN_VAL 0x2000 | |
434c14ef RV |
864 | |
865 | #ifdef SDTEST | |
866 | /* For pktgen iovar */ | |
63bec49e | 867 | struct brcmf_pktgen { |
434c14ef RV |
868 | uint version; /* To allow structure change tracking */ |
869 | uint freq; /* Max ticks between tx/rx attempts */ | |
870 | uint count; /* Test packets to send/rcv each attempt */ | |
871 | uint print; /* Print counts every <print> attempts */ | |
872 | uint total; /* Total packets (or bursts) */ | |
873 | uint minlen; /* Minimum length of packets to send */ | |
874 | uint maxlen; /* Maximum length of packets to send */ | |
875 | uint numsent; /* Count of test packets sent */ | |
876 | uint numrcvd; /* Count of test packets received */ | |
877 | uint numfail; /* Count of test send failures */ | |
878 | uint mode; /* Test mode (type of test packets) */ | |
879 | uint stop; /* Stop after this many tx failures */ | |
63bec49e | 880 | }; |
434c14ef RV |
881 | |
882 | /* Version in case structure changes */ | |
40695d1a | 883 | #define BRCMF_PKTGEN_VERSION 2 |
434c14ef RV |
884 | |
885 | /* Type of test packets to use */ | |
40695d1a AS |
886 | #define BRCMF_PKTGEN_ECHO 1 /* Send echo requests */ |
887 | #define BRCMF_PKTGEN_SEND 2 /* Send discard packets */ | |
888 | #define BRCMF_PKTGEN_RXBURST 3 /* Request dongle send N packets */ | |
889 | #define BRCMF_PKTGEN_RECV 4 /* Continuous rx from continuous | |
434c14ef RV |
890 | tx dongle */ |
891 | #endif /* SDTEST */ | |
892 | ||
893 | /* Enter idle immediately (no timeout) */ | |
40695d1a | 894 | #define BRCMF_IDLE_IMMEDIATE (-1) |
434c14ef RV |
895 | |
896 | /* Values for idleclock iovar: other values are the sd_divisor to use | |
897 | when idle */ | |
40695d1a | 898 | #define BRCMF_IDLE_ACTIVE 0 /* Do not request any SD clock change |
434c14ef | 899 | when idle */ |
434c14ef | 900 | |
1f660b9c | 901 | #endif /* _BRCMF_H_ */ |