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 | ||
21 | #ifndef _dhd_h_ | |
22 | #define _dhd_h_ | |
23 | ||
366bbb3f AS |
24 | #define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */ |
25 | #define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */ | |
26 | #define BRCMF_C_IOCTL_MAXLEN 8192 | |
27 | ||
28 | #define BRCMF_C_UP 2 | |
29 | #define BRCMF_C_SET_PROMISC 10 | |
30 | #define BRCMF_C_GET_RATE 12 | |
31 | #define BRCMF_C_GET_INFRA 19 | |
32 | #define BRCMF_C_SET_INFRA 20 | |
33 | #define BRCMF_C_GET_AUTH 21 | |
34 | #define BRCMF_C_SET_AUTH 22 | |
35 | #define BRCMF_C_GET_BSSID 23 | |
36 | #define BRCMF_C_GET_SSID 25 | |
37 | #define BRCMF_C_SET_SSID 26 | |
38 | #define BRCMF_C_GET_CHANNEL 29 | |
39 | #define BRCMF_C_GET_SRL 31 | |
40 | #define BRCMF_C_GET_LRL 33 | |
41 | #define BRCMF_C_GET_RADIO 37 | |
42 | #define BRCMF_C_SET_RADIO 38 | |
43 | #define BRCMF_C_GET_PHYTYPE 39 | |
44 | #define BRCMF_C_SET_KEY 45 | |
45 | #define BRCMF_C_SET_PASSIVE_SCAN 49 | |
46 | #define BRCMF_C_SCAN 50 | |
47 | #define BRCMF_C_SCAN_RESULTS 51 | |
48 | #define BRCMF_C_DISASSOC 52 | |
49 | #define BRCMF_C_REASSOC 53 | |
50 | #define BRCMF_C_SET_ROAM_TRIGGER 55 | |
51 | #define BRCMF_C_SET_ROAM_DELTA 57 | |
52 | #define BRCMF_C_GET_DTIMPRD 77 | |
53 | #define BRCMF_C_SET_COUNTRY 84 | |
54 | #define BRCMF_C_GET_PM 85 | |
55 | #define BRCMF_C_SET_PM 86 | |
56 | #define BRCMF_C_GET_AP 117 | |
57 | #define BRCMF_C_SET_AP 118 | |
58 | #define BRCMF_C_GET_RSSI 127 | |
59 | #define BRCMF_C_GET_WSEC 133 | |
60 | #define BRCMF_C_SET_WSEC 134 | |
61 | #define BRCMF_C_GET_PHY_NOISE 135 | |
62 | #define BRCMF_C_GET_BSS_INFO 136 | |
63 | #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185 | |
64 | #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187 | |
65 | #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201 | |
66 | #define BRCMF_C_GET_VALID_CHANNELS 217 | |
67 | #define BRCMF_C_GET_KEY_PRIMARY 235 | |
68 | #define BRCMF_C_SET_KEY_PRIMARY 236 | |
69 | #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258 | |
70 | #define BRCMF_C_GET_VAR 262 | |
71 | #define BRCMF_C_SET_VAR 263 | |
434c14ef RV |
72 | |
73 | /* phy types (returned by WLC_GET_PHYTPE) */ | |
74 | #define WLC_PHY_TYPE_A 0 | |
75 | #define WLC_PHY_TYPE_B 1 | |
76 | #define WLC_PHY_TYPE_G 2 | |
77 | #define WLC_PHY_TYPE_N 4 | |
78 | #define WLC_PHY_TYPE_LP 5 | |
79 | #define WLC_PHY_TYPE_SSN 6 | |
80 | #define WLC_PHY_TYPE_HT 7 | |
81 | #define WLC_PHY_TYPE_LCN 8 | |
82 | #define WLC_PHY_TYPE_NULL 0xf | |
83 | ||
84 | #define WL_PKT_FILTER_FIXED_LEN offsetof(wl_pkt_filter_t, u) | |
85 | #define WL_PKT_FILTER_PATTERN_FIXED_LEN offsetof(wl_pkt_filter_pattern_t, mask_and_pattern) | |
86 | ||
87 | #define WL_EVENTING_MASK_LEN 16 | |
88 | ||
89 | #define TOE_TX_CSUM_OL 0x00000001 | |
90 | #define TOE_RX_CSUM_OL 0x00000002 | |
91 | ||
92 | /* maximum channels returned by the get valid channels iovar */ | |
93 | #define WL_NUMCHANNELS 64 | |
94 | ||
95 | #define WL_BSS_INFO_VERSION 108 /* current ver of wl_bss_info struct */ | |
96 | ||
97 | /* size of wl_scan_params not including variable length array */ | |
98 | #define WL_SCAN_PARAMS_FIXED_SIZE 64 | |
99 | ||
100 | /* masks for channel and ssid count */ | |
101 | #define WL_SCAN_PARAMS_COUNT_MASK 0x0000ffff | |
102 | #define WL_SCAN_PARAMS_NSSID_SHIFT 16 | |
103 | ||
104 | #define WL_SCAN_ACTION_START 1 | |
105 | #define WL_SCAN_ACTION_CONTINUE 2 | |
106 | #define WL_SCAN_ACTION_ABORT 3 | |
107 | ||
108 | #define ISCAN_REQ_VERSION 1 | |
109 | ||
110 | /* wl_iscan_results status values */ | |
111 | #define WL_SCAN_RESULTS_SUCCESS 0 | |
112 | #define WL_SCAN_RESULTS_PARTIAL 1 | |
113 | #define WL_SCAN_RESULTS_PENDING 2 | |
114 | #define WL_SCAN_RESULTS_ABORTED 3 | |
115 | #define WL_SCAN_RESULTS_NO_MEM 4 | |
116 | ||
434c14ef RV |
117 | #define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */ |
118 | #define WL_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */ | |
119 | #define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */ | |
120 | #define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */ | |
121 | #define WL_IBSS_PEER_GROUP_KEY (1 << 6) /* Indicates a group key for a IBSS PEER */ | |
122 | ||
434c14ef RV |
123 | /* optionally set by a module_param_string() */ |
124 | #define MOD_PARAM_PATHLEN 2048 | |
125 | ||
126 | /* For supporting multiple interfaces */ | |
127 | #define DHD_MAX_IFS 16 | |
128 | #define DHD_DEL_IF -0xe | |
129 | #define DHD_BAD_IF -0xf | |
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 | |
05dc0f43 | 138 | typedef 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]; |
05dc0f43 | 148 | } __packed brcmf_event_msg_t; |
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 | |
05dc0f43 | 158 | typedef struct brcmf_event { |
a019382e | 159 | struct ethhdr eth; |
05dc0f43 AS |
160 | struct brcm_ethhdr hdr; |
161 | struct brcmf_event_msg msg; | |
162 | } __packed brcmf_event_t; | |
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 | |
434c14ef RV |
312 | enum cust_gpio_modes { |
313 | WLAN_RESET_ON, | |
314 | WLAN_RESET_OFF, | |
315 | WLAN_POWER_ON, | |
316 | WLAN_POWER_OFF | |
317 | }; | |
318 | ||
cf2b4488 HP |
319 | /* The level of bus communication with the dongle */ |
320 | enum dhd_bus_state { | |
321 | DHD_BUS_DOWN, /* Not ready for frame transfers */ | |
322 | DHD_BUS_LOAD, /* Download access only (CPU reset) */ | |
323 | DHD_BUS_DATA /* Ready for frame transfers */ | |
324 | }; | |
325 | ||
434c14ef RV |
326 | /* Pattern matching filter. Specifies an offset within received packets to |
327 | * start matching, the pattern to match, the size of the pattern, and a bitmask | |
328 | * that indicates which bits within the pattern should be matched. | |
329 | */ | |
330 | typedef struct wl_pkt_filter_pattern { | |
331 | u32 offset; /* Offset within received packet to start pattern matching. | |
332 | * Offset '0' is the first byte of the ethernet header. | |
333 | */ | |
334 | u32 size_bytes; /* Size of the pattern. Bitmask must be the same size. */ | |
335 | u8 mask_and_pattern[1]; /* Variable length mask and pattern data. mask starts | |
336 | * at offset 0. Pattern immediately follows mask. | |
337 | */ | |
338 | } wl_pkt_filter_pattern_t; | |
339 | ||
340 | /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */ | |
341 | typedef struct wl_pkt_filter { | |
342 | u32 id; /* Unique filter id, specified by app. */ | |
343 | u32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */ | |
344 | u32 negate_match; /* Negate the result of filter matches */ | |
345 | union { /* Filter definitions */ | |
346 | wl_pkt_filter_pattern_t pattern; /* Pattern matching filter */ | |
347 | } u; | |
348 | } wl_pkt_filter_t; | |
349 | ||
350 | /* IOVAR "pkt_filter_enable" parameter. */ | |
351 | typedef struct wl_pkt_filter_enable { | |
352 | u32 id; /* Unique filter id */ | |
353 | u32 enable; /* Enable/disable bool */ | |
354 | } wl_pkt_filter_enable_t; | |
355 | ||
356 | /* BSS info structure | |
357 | * Applications MUST CHECK ie_offset field and length field to access IEs and | |
358 | * next bss_info structure in a vector (in wl_scan_results_t) | |
359 | */ | |
360 | typedef struct wl_bss_info { | |
361 | u32 version; /* version field */ | |
362 | u32 length; /* byte length of data in this record, | |
363 | * starting at version and including IEs | |
364 | */ | |
365 | u8 BSSID[ETH_ALEN]; | |
366 | u16 beacon_period; /* units are Kusec */ | |
367 | u16 capability; /* Capability information */ | |
368 | u8 SSID_len; | |
369 | u8 SSID[32]; | |
370 | struct { | |
371 | uint count; /* # rates in this set */ | |
372 | u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ | |
373 | } rateset; /* supported rates */ | |
374 | chanspec_t chanspec; /* chanspec for bss */ | |
375 | u16 atim_window; /* units are Kusec */ | |
376 | u8 dtim_period; /* DTIM period */ | |
377 | s16 RSSI; /* receive signal strength (in dBm) */ | |
378 | s8 phy_noise; /* noise (in dBm) */ | |
379 | ||
380 | u8 n_cap; /* BSS is 802.11N Capable */ | |
381 | u32 nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */ | |
382 | u8 ctl_ch; /* 802.11N BSS control channel number */ | |
383 | u32 reserved32[1]; /* Reserved for expansion of BSS properties */ | |
384 | u8 flags; /* flags */ | |
385 | u8 reserved[3]; /* Reserved for expansion of BSS properties */ | |
386 | u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */ | |
387 | ||
388 | u16 ie_offset; /* offset at which IEs start, from beginning */ | |
389 | u32 ie_length; /* byte length of Information Elements */ | |
390 | s16 SNR; /* average SNR of during frame reception */ | |
391 | /* Add new fields here */ | |
392 | /* variable length Information Elements */ | |
393 | } wl_bss_info_t; | |
394 | ||
395 | typedef struct wlc_ssid { | |
396 | u32 SSID_len; | |
397 | unsigned char SSID[32]; | |
398 | } wlc_ssid_t; | |
399 | ||
400 | typedef struct wl_scan_params { | |
401 | wlc_ssid_t ssid; /* default: {0, ""} */ | |
402 | u8 bssid[ETH_ALEN]; /* default: bcast */ | |
403 | s8 bss_type; /* default: any, | |
404 | * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT | |
405 | */ | |
406 | u8 scan_type; /* flags, 0 use default */ | |
407 | s32 nprobes; /* -1 use default, number of probes per channel */ | |
408 | s32 active_time; /* -1 use default, dwell time per channel for | |
409 | * active scanning | |
410 | */ | |
411 | s32 passive_time; /* -1 use default, dwell time per channel | |
412 | * for passive scanning | |
413 | */ | |
414 | s32 home_time; /* -1 use default, dwell time for the home channel | |
415 | * between channel scans | |
416 | */ | |
417 | s32 channel_num; /* count of channels and ssids that follow | |
418 | * | |
419 | * low half is count of channels in channel_list, 0 | |
420 | * means default (use all available channels) | |
421 | * | |
422 | * high half is entries in wlc_ssid_t array that | |
423 | * follows channel_list, aligned for s32 (4 bytes) | |
424 | * meaning an odd channel count implies a 2-byte pad | |
425 | * between end of channel_list and first ssid | |
426 | * | |
427 | * if ssid count is zero, single ssid in the fixed | |
428 | * parameter portion is assumed, otherwise ssid in | |
429 | * the fixed portion is ignored | |
430 | */ | |
431 | u16 channel_list[1]; /* list of chanspecs */ | |
432 | } wl_scan_params_t; | |
433 | ||
434 | /* incremental scan struct */ | |
435 | typedef struct wl_iscan_params { | |
436 | u32 version; | |
437 | u16 action; | |
438 | u16 scan_duration; | |
439 | wl_scan_params_t params; | |
440 | } wl_iscan_params_t; | |
441 | ||
442 | /* 3 fields + size of wl_scan_params, not including variable length array */ | |
443 | #define WL_ISCAN_PARAMS_FIXED_SIZE (offsetof(wl_iscan_params_t, params) + sizeof(wlc_ssid_t)) | |
444 | ||
445 | typedef struct wl_scan_results { | |
446 | u32 buflen; | |
447 | u32 version; | |
448 | u32 count; | |
449 | wl_bss_info_t bss_info[1]; | |
450 | } wl_scan_results_t; | |
451 | ||
452 | typedef struct wl_rateset_args { | |
453 | u32 count; /* # rates in this set */ | |
454 | u8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */ | |
455 | u8 mcs[MCSSET_LEN]; /* supported mcs index bit map */ | |
456 | } wl_rateset_args_t; | |
457 | ||
458 | /* u32 list */ | |
459 | typedef struct wl_u32_list { | |
460 | /* in - # of elements, out - # of entries */ | |
461 | u32 count; | |
462 | /* variable length u32 list */ | |
463 | u32 element[1]; | |
464 | } wl_u32_list_t; | |
465 | ||
466 | /* used for association with a specific BSSID and chanspec list */ | |
467 | typedef struct wl_assoc_params { | |
468 | u8 bssid[ETH_ALEN]; /* 00:00:00:00:00:00: broadcast scan */ | |
469 | s32 chanspec_num; /* 0: all available channels, | |
470 | * otherwise count of chanspecs in chanspec_list | |
471 | */ | |
472 | chanspec_t chanspec_list[1]; /* list of chanspecs */ | |
473 | } wl_assoc_params_t; | |
8a76f1ee | 474 | #define WL_ASSOC_PARAMS_FIXED_SIZE (sizeof(wl_assoc_params_t) - sizeof(chanspec_t)) |
434c14ef RV |
475 | |
476 | /* used for reassociation/roam to a specific BSSID and channel */ | |
477 | typedef wl_assoc_params_t wl_reassoc_params_t; | |
434c14ef RV |
478 | |
479 | /* used for join with or without a specific bssid and channel list */ | |
480 | typedef struct wl_join_params { | |
481 | wlc_ssid_t ssid; | |
482 | wl_assoc_params_t params; /* optional field, but it must include the fixed portion | |
483 | * of the wl_assoc_params_t struct when it does present. | |
484 | */ | |
485 | } wl_join_params_t; | |
434c14ef RV |
486 | |
487 | /* size of wl_scan_results not including variable length array */ | |
488 | #define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t)) | |
489 | ||
490 | /* incremental scan results struct */ | |
491 | typedef struct wl_iscan_results { | |
492 | u32 status; | |
493 | wl_scan_results_t results; | |
494 | } wl_iscan_results_t; | |
495 | ||
496 | /* size of wl_iscan_results not including variable length array */ | |
497 | #define WL_ISCAN_RESULTS_FIXED_SIZE \ | |
498 | (WL_SCAN_RESULTS_FIXED_SIZE + offsetof(wl_iscan_results_t, results)) | |
499 | ||
500 | typedef struct { | |
501 | u32 duration; /* millisecs spent sampling this channel */ | |
502 | u32 congest_ibss; /* millisecs in our bss (presumably this traffic will */ | |
503 | /* move if cur bss moves channels) */ | |
504 | u32 congest_obss; /* traffic not in our bss */ | |
505 | u32 interference; /* millisecs detecting a non 802.11 interferer. */ | |
506 | u32 timestamp; /* second timestamp */ | |
507 | } cca_congest_t; | |
508 | ||
509 | typedef struct { | |
510 | chanspec_t chanspec; /* Which channel? */ | |
511 | u8 num_secs; /* How many secs worth of data */ | |
512 | cca_congest_t secs[1]; /* Data */ | |
513 | } cca_congest_channel_req_t; | |
514 | ||
515 | typedef struct wl_country { | |
516 | char country_abbrev[WLC_CNTRY_BUF_SZ]; /* nul-terminated country code used in | |
517 | * the Country IE | |
518 | */ | |
519 | s32 rev; /* revision specifier for ccode | |
520 | * on set, -1 indicates unspecified. | |
521 | * on get, rev >= 0 | |
522 | */ | |
523 | char ccode[WLC_CNTRY_BUF_SZ]; /* nul-terminated built-in country code. | |
524 | * variable length, but fixed size in | |
525 | * struct allows simple allocation for | |
526 | * expected country strings <= 3 chars. | |
527 | */ | |
528 | } wl_country_t; | |
529 | ||
530 | typedef struct wl_channels_in_country { | |
531 | u32 buflen; | |
532 | u32 band; | |
533 | char country_abbrev[WLC_CNTRY_BUF_SZ]; | |
534 | u32 count; | |
535 | u32 channel[1]; | |
536 | } wl_channels_in_country_t; | |
537 | ||
538 | typedef struct wl_country_list { | |
539 | u32 buflen; | |
540 | u32 band_set; | |
541 | u32 band; | |
542 | u32 count; | |
543 | char country_abbrev[1]; | |
544 | } wl_country_list_t; | |
545 | ||
546 | typedef struct wl_rm_req_elt { | |
547 | s8 type; | |
548 | s8 flags; | |
549 | chanspec_t chanspec; | |
550 | u32 token; /* token for this measurement */ | |
551 | u32 tsf_h; /* TSF high 32-bits of Measurement start time */ | |
552 | u32 tsf_l; /* TSF low 32-bits */ | |
553 | u32 dur; /* TUs */ | |
554 | } wl_rm_req_elt_t; | |
555 | ||
556 | typedef struct wl_rm_req { | |
557 | u32 token; /* overall measurement set token */ | |
558 | u32 count; /* number of measurement requests */ | |
559 | void *cb; /* completion callback function: may be NULL */ | |
560 | void *cb_arg; /* arg to completion callback function */ | |
561 | wl_rm_req_elt_t req[1]; /* variable length block of requests */ | |
562 | } wl_rm_req_t; | |
434c14ef RV |
563 | |
564 | typedef struct wl_rm_rep_elt { | |
565 | s8 type; | |
566 | s8 flags; | |
567 | chanspec_t chanspec; | |
568 | u32 token; /* token for this measurement */ | |
569 | u32 tsf_h; /* TSF high 32-bits of Measurement start time */ | |
570 | u32 tsf_l; /* TSF low 32-bits */ | |
571 | u32 dur; /* TUs */ | |
572 | u32 len; /* byte length of data block */ | |
573 | u8 data[1]; /* variable length data block */ | |
574 | } wl_rm_rep_elt_t; | |
434c14ef RV |
575 | |
576 | #define WL_RPI_REP_BIN_NUM 8 | |
577 | typedef struct wl_rm_rpi_rep { | |
578 | u8 rpi[WL_RPI_REP_BIN_NUM]; | |
579 | s8 rpi_max[WL_RPI_REP_BIN_NUM]; | |
580 | } wl_rm_rpi_rep_t; | |
581 | ||
582 | typedef struct wl_rm_rep { | |
583 | u32 token; /* overall measurement set token */ | |
584 | u32 len; /* length of measurement report block */ | |
585 | wl_rm_rep_elt_t rep[1]; /* variable length block of reports */ | |
586 | } wl_rm_rep_t; | |
434c14ef RV |
587 | |
588 | typedef struct wl_wsec_key { | |
589 | u32 index; /* key index */ | |
590 | u32 len; /* key length */ | |
591 | u8 data[WLAN_MAX_KEY_LEN]; /* key data */ | |
592 | u32 pad_1[18]; | |
593 | u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ | |
594 | u32 flags; /* misc flags */ | |
595 | u32 pad_2[2]; | |
596 | int pad_3; | |
597 | int iv_initialized; /* has IV been initialized already? */ | |
598 | int pad_4; | |
599 | /* Rx IV */ | |
600 | struct { | |
601 | u32 hi; /* upper 32 bits of IV */ | |
602 | u16 lo; /* lower 16 bits of IV */ | |
603 | } rxiv; | |
604 | u32 pad_5[2]; | |
605 | u8 ea[ETH_ALEN]; /* per station */ | |
606 | } wl_wsec_key_t; | |
607 | ||
608 | /* Used to get specific STA parameters */ | |
609 | typedef struct { | |
610 | u32 val; | |
611 | u8 ea[ETH_ALEN]; | |
612 | } scb_val_t; | |
613 | ||
614 | /* channel encoding */ | |
615 | typedef struct channel_info { | |
616 | int hw_channel; | |
617 | int target_channel; | |
618 | int scan_channel; | |
619 | } channel_info_t; | |
620 | ||
621 | /* Linux network driver ioctl encoding */ | |
622 | typedef struct wl_ioctl { | |
623 | uint cmd; /* common ioctl definition */ | |
624 | void *buf; /* pointer to user buffer */ | |
625 | uint len; /* length of user buffer */ | |
626 | u8 set; /* get or set request (optional) */ | |
627 | uint used; /* bytes read or written (optional) */ | |
628 | uint needed; /* bytes needed (optional) */ | |
629 | } wl_ioctl_t; | |
630 | ||
e35efc81 AS |
631 | /* Forward decls for struct dhd_pub (see below) */ |
632 | struct dhd_bus; /* device bus info */ | |
633 | struct brcmf_proto; /* device communication protocol info */ | |
634 | struct dhd_info; /* device driver info */ | |
635 | ||
cf2b4488 HP |
636 | /* Common structure for module and instance linkage */ |
637 | typedef struct dhd_pub { | |
638 | /* Linkage ponters */ | |
e35efc81 AS |
639 | struct dhd_bus *bus; |
640 | struct brcmf_proto *prot; | |
641 | struct dhd_info *info; | |
cf2b4488 HP |
642 | |
643 | /* Internal dhd items */ | |
644 | bool up; /* Driver up/down (to OS) */ | |
645 | bool txoff; /* Transmit flow-controlled */ | |
0f0881b0 | 646 | bool dongle_reset; /* true = DEVRESET put dongle into reset */ |
cf2b4488 HP |
647 | enum dhd_bus_state busstate; |
648 | uint hdrlen; /* Total DHD header length (proto + bus) */ | |
649 | uint maxctl; /* Max size rxctl request from proto to bus */ | |
650 | uint rxsz; /* Rx buffer size bus module should use */ | |
3fd79f7c | 651 | u8 wme_dp; /* wme discard priority */ |
cf2b4488 HP |
652 | |
653 | /* Dongle media info */ | |
654 | bool iswl; /* Dongle-resident driver is wl */ | |
3deea904 | 655 | unsigned long drv_version; /* Version of dongle-resident driver */ |
a44d4236 AS |
656 | u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */ |
657 | dngl_stats_t dstats; /* Stats for dongle-based data */ | |
cf2b4488 HP |
658 | |
659 | /* Additional stats for the bus level */ | |
3deea904 GKH |
660 | unsigned long tx_packets; /* Data packets sent to dongle */ |
661 | unsigned long tx_multicast; /* Multicast data packets sent to dongle */ | |
662 | unsigned long tx_errors; /* Errors in sending data to dongle */ | |
663 | unsigned long tx_ctlpkts; /* Control packets sent to dongle */ | |
664 | unsigned long tx_ctlerrs; /* Errors sending control frames to dongle */ | |
665 | unsigned long rx_packets; /* Packets sent up the network interface */ | |
666 | unsigned long rx_multicast; /* Multicast packets sent up the network | |
cf2b4488 | 667 | interface */ |
3deea904 GKH |
668 | unsigned long rx_errors; /* Errors processing rx data packets */ |
669 | unsigned long rx_ctlpkts; /* Control frames processed from dongle */ | |
670 | unsigned long rx_ctlerrs; /* Errors in processing rx control frames */ | |
671 | unsigned long rx_dropped; /* Packets dropped locally (no memory) */ | |
672 | unsigned long rx_flushed; /* Packets flushed due to | |
cf2b4488 | 673 | unscheduled sendup thread */ |
3deea904 | 674 | unsigned long wd_dpc_sched; /* Number of times dhd dpc scheduled by |
cf2b4488 HP |
675 | watchdog timer */ |
676 | ||
3deea904 | 677 | unsigned long rx_readahead_cnt; /* Number of packets where header read-ahead |
cf2b4488 | 678 | was used. */ |
3deea904 | 679 | unsigned long tx_realloc; /* Number of tx packets we had to realloc for |
cf2b4488 | 680 | headroom */ |
3deea904 | 681 | unsigned long fc_packets; /* Number of flow control pkts recvd */ |
cf2b4488 HP |
682 | |
683 | /* Last error return */ | |
684 | int bcmerror; | |
685 | uint tickcnt; | |
686 | ||
687 | /* Last error from dongle */ | |
688 | int dongle_error; | |
689 | ||
690 | /* Suspend disable flag flag */ | |
691 | int suspend_disable_flag; /* "1" to disable all extra powersaving | |
692 | during suspend */ | |
693 | int in_suspend; /* flag set to 1 when early suspend called */ | |
694 | #ifdef PNO_SUPPORT | |
695 | int pno_enable; /* pno status : "1" is pno enable */ | |
696 | #endif /* PNO_SUPPORT */ | |
697 | int dtim_skip; /* dtim skip , default 0 means wake each dtim */ | |
698 | ||
699 | /* Pkt filter defination */ | |
700 | char *pktfilter[100]; | |
701 | int pktfilter_count; | |
702 | ||
3fd79f7c | 703 | u8 country_code[WLC_CNTRY_BUF_SZ]; |
cf2b4488 HP |
704 | char eventmask[WL_EVENTING_MASK_LEN]; |
705 | ||
cf2b4488 HP |
706 | } dhd_pub_t; |
707 | ||
434c14ef RV |
708 | typedef struct dhd_if_event { |
709 | u8 ifidx; | |
710 | u8 action; | |
711 | u8 flags; | |
712 | u8 bssidx; | |
713 | } dhd_if_event_t; | |
714 | ||
715 | typedef struct { | |
716 | u32 limit; /* Expiration time (usec) */ | |
717 | u32 increment; /* Current expiration increment (usec) */ | |
718 | u32 elapsed; /* Current elapsed time (usec) */ | |
719 | u32 tick; /* O/S tick time (usec) */ | |
720 | } dhd_timeout_t; | |
721 | ||
a019382e RV |
722 | typedef struct { |
723 | uint event; | |
724 | const char *name; | |
725 | } bcmevent_name_t; | |
726 | ||
cf2b4488 | 727 | #if defined(CONFIG_PM_SLEEP) |
e6e8f894 | 728 | extern atomic_t dhd_mmc_suspend; |
cf2b4488 | 729 | #define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); |
e6e8f894 SS |
730 | #define _DHD_PM_RESUME_WAIT(a, b) do { \ |
731 | int retry = 0; \ | |
732 | while (atomic_read(&dhd_mmc_suspend) && retry++ != b) { \ | |
733 | wait_event_timeout(a, false, HZ/100); \ | |
734 | } \ | |
735 | } while (0) | |
cf2b4488 HP |
736 | #define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 30) |
737 | #define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0) | |
738 | #define DHD_PM_RESUME_RETURN_ERROR(a) \ | |
e6e8f894 SS |
739 | do { if (atomic_read(&dhd_mmc_suspend)) return a; } while (0) |
740 | #define DHD_PM_RESUME_RETURN do { \ | |
741 | if (atomic_read(&dhd_mmc_suspend)) \ | |
742 | return; \ | |
743 | } while (0) | |
cf2b4488 HP |
744 | |
745 | #define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); | |
746 | #define SPINWAIT_SLEEP(a, exp, us) do { \ | |
747 | uint countdown = (us) + 9999; \ | |
748 | while ((exp) && (countdown >= 10000)) { \ | |
0965ae88 | 749 | wait_event_timeout(a, false, HZ/100); \ |
cf2b4488 HP |
750 | countdown -= 10000; \ |
751 | } \ | |
752 | } while (0) | |
753 | ||
754 | #else | |
755 | ||
756 | #define DHD_PM_RESUME_WAIT_INIT(a) | |
757 | #define DHD_PM_RESUME_WAIT(a) | |
758 | #define DHD_PM_RESUME_WAIT_FOREVER(a) | |
759 | #define DHD_PM_RESUME_RETURN_ERROR(a) | |
760 | #define DHD_PM_RESUME_RETURN | |
761 | ||
762 | #define DHD_SPINWAIT_SLEEP_INIT(a) | |
763 | #define SPINWAIT_SLEEP(a, exp, us) do { \ | |
764 | uint countdown = (us) + 9; \ | |
765 | while ((exp) && (countdown >= 10)) { \ | |
7383141b | 766 | udelay(10); \ |
cf2b4488 HP |
767 | countdown -= 10; \ |
768 | } \ | |
769 | } while (0) | |
770 | ||
771 | #endif /* defined(CONFIG_PM_SLEEP) */ | |
434c14ef RV |
772 | |
773 | /* | |
774 | * Insmod parameters for debug/test | |
775 | */ | |
776 | ||
777 | /* Watchdog timer interval */ | |
5e92aa8c | 778 | extern uint brcmf_watchdog_ms; |
434c14ef RV |
779 | |
780 | #if defined(DHD_DEBUG) | |
781 | /* Console output poll interval */ | |
5e92aa8c | 782 | extern uint brcmf_console_ms; |
434c14ef RV |
783 | #endif /* defined(DHD_DEBUG) */ |
784 | ||
785 | /* Use interrupts */ | |
5e92aa8c | 786 | extern uint brcmf_intr; |
434c14ef RV |
787 | |
788 | /* Use polling */ | |
5e92aa8c | 789 | extern uint brcmf_poll; |
434c14ef RV |
790 | |
791 | /* ARP offload agent mode */ | |
5e92aa8c | 792 | extern uint brcmf_arp_mode; |
434c14ef RV |
793 | |
794 | /* ARP offload enable */ | |
5e92aa8c | 795 | extern uint brcmf_arp_enable; |
434c14ef RV |
796 | |
797 | /* Pkt filte enable control */ | |
5e92aa8c | 798 | extern uint brcmf_pkt_filter_enable; |
434c14ef RV |
799 | |
800 | /* Pkt filter init setup */ | |
5e92aa8c | 801 | extern uint brcmf_pkt_filter_init; |
434c14ef RV |
802 | |
803 | /* Pkt filter mode control */ | |
5e92aa8c | 804 | extern uint brcmf_master_mode; |
434c14ef RV |
805 | |
806 | /* Roaming mode control */ | |
5e92aa8c | 807 | extern uint brcmf_roam; |
434c14ef RV |
808 | |
809 | /* Roaming mode control */ | |
5e92aa8c | 810 | extern uint brcmf_radio_up; |
434c14ef RV |
811 | |
812 | /* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */ | |
5e92aa8c AS |
813 | extern int brcmf_idletime; |
814 | #define BRCMF_IDLETIME_TICKS 1 | |
434c14ef RV |
815 | |
816 | /* SDIO Drive Strength */ | |
5e92aa8c | 817 | extern uint brcmf_sdiod_drive_strength; |
434c14ef RV |
818 | |
819 | /* Override to force tx queueing all the time */ | |
5e92aa8c | 820 | extern uint brcmf_force_tx_queueing; |
434c14ef RV |
821 | |
822 | #ifdef SDTEST | |
823 | /* Echo packet generator (SDIO), pkts/s */ | |
5e92aa8c | 824 | extern uint brcmf_pktgen; |
434c14ef RV |
825 | |
826 | /* Echo packet len (0 => sawtooth, max 1800) */ | |
5e92aa8c AS |
827 | extern uint brcmf_pktgen_len; |
828 | #define BRCMF_MAX_PKTGEN_LEN 1800 | |
434c14ef RV |
829 | #endif |
830 | ||
aba5e0ad AS |
831 | extern char brcmf_fw_path[MOD_PARAM_PATHLEN]; |
832 | extern char brcmf_nv_path[MOD_PARAM_PATHLEN]; | |
434c14ef RV |
833 | |
834 | extern u32 g_assert_type; | |
a019382e RV |
835 | extern const bcmevent_name_t bcmevent_names[]; |
836 | extern const int bcmevent_names_size; | |
837 | ||
cf2b4488 HP |
838 | |
839 | static inline void MUTEX_LOCK_INIT(dhd_pub_t *dhdp) | |
840 | { | |
841 | } | |
842 | ||
843 | static inline void MUTEX_LOCK(dhd_pub_t *dhdp) | |
844 | { | |
845 | } | |
846 | ||
847 | static inline void MUTEX_UNLOCK(dhd_pub_t *dhdp) | |
848 | { | |
849 | } | |
850 | ||
851 | static inline void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t *dhdp) | |
852 | { | |
853 | } | |
854 | ||
855 | static inline void MUTEX_LOCK_SOFTAP_SET(dhd_pub_t *dhdp) | |
856 | { | |
857 | } | |
858 | ||
859 | static inline void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t *dhdp) | |
860 | { | |
861 | } | |
862 | ||
863 | static inline void MUTEX_LOCK_WL_SCAN_SET_INIT(void) | |
864 | { | |
865 | } | |
866 | ||
867 | static inline void MUTEX_LOCK_WL_SCAN_SET(void) | |
868 | { | |
869 | } | |
870 | ||
871 | static inline void MUTEX_UNLOCK_WL_SCAN_SET(void) | |
872 | { | |
873 | } | |
874 | ||
cf2b4488 HP |
875 | /* |
876 | * Exported from dhd OS modules (dhd_linux/dhd_ndis) | |
877 | */ | |
878 | ||
cf2b4488 HP |
879 | /* Indication from bus module regarding presence/insertion of dongle. |
880 | * Return dhd_pub_t pointer, used as handle to OS module in later calls. | |
881 | * Returned structure should have bus and prot pointers filled in. | |
882 | * bus_hdrlen specifies required headroom for bus module header. | |
883 | */ | |
a84bac46 | 884 | extern dhd_pub_t *brcmf_attach(struct dhd_bus *bus, |
e69284f2 | 885 | uint bus_hdrlen); |
a84bac46 | 886 | extern int brcmf_net_attach(dhd_pub_t *dhdp, int idx); |
fc2860a9 | 887 | extern int brcmf_netdev_wait_pend8021x(struct net_device *dev); |
cf2b4488 HP |
888 | |
889 | /* Indication from bus module regarding removal/absence of dongle */ | |
a84bac46 | 890 | extern void brcmf_detach(dhd_pub_t *dhdp); |
cf2b4488 HP |
891 | |
892 | /* Indication from bus module to change flow-control state */ | |
a84bac46 | 893 | extern void brcmf_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on); |
cf2b4488 | 894 | |
aba5e0ad | 895 | extern bool brcmf_c_prec_enq(dhd_pub_t *dhdp, struct pktq *q, |
c26b1378 | 896 | struct sk_buff *pkt, int prec); |
cf2b4488 HP |
897 | |
898 | /* Receive frame for delivery to OS. Callee disposes of rxp. */ | |
a84bac46 | 899 | extern void brcmf_rx_frame(dhd_pub_t *dhdp, int ifidx, |
c26b1378 | 900 | struct sk_buff *rxp, int numpkt); |
cf2b4488 HP |
901 | |
902 | /* Return pointer to interface name */ | |
a84bac46 | 903 | extern char *brcmf_ifname(dhd_pub_t *dhdp, int idx); |
cf2b4488 HP |
904 | |
905 | /* Request scheduling of the bus dpc */ | |
a84bac46 | 906 | extern void brcmf_sched_dpc(dhd_pub_t *dhdp); |
cf2b4488 HP |
907 | |
908 | /* Notify tx completion */ | |
a84bac46 AS |
909 | extern void brcmf_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, |
910 | bool success); | |
cf2b4488 HP |
911 | |
912 | /* Query ioctl */ | |
0aa94b84 AS |
913 | extern int brcmf_proto_cdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, |
914 | void *buf, uint len); | |
cf2b4488 HP |
915 | |
916 | /* OS independent layer functions */ | |
a84bac46 AS |
917 | extern int brcmf_os_proto_block(dhd_pub_t *pub); |
918 | extern int brcmf_os_proto_unblock(dhd_pub_t *pub); | |
919 | extern int brcmf_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, | |
cf2b4488 | 920 | bool *pending); |
a84bac46 AS |
921 | extern int brcmf_os_ioctl_resp_wake(dhd_pub_t *pub); |
922 | extern unsigned int brcmf_os_get_ioctl_resp_timeout(void); | |
923 | extern void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec); | |
924 | extern void *brcmf_os_open_image(char *filename); | |
925 | extern int brcmf_os_get_image_block(char *buf, int len, void *image); | |
926 | extern void brcmf_os_close_image(void *image); | |
927 | extern void brcmf_os_wd_timer(void *bus, uint wdtick); | |
928 | extern void brcmf_os_sdlock(dhd_pub_t *pub); | |
929 | extern void brcmf_os_sdunlock(dhd_pub_t *pub); | |
930 | extern void brcmf_os_sdlock_sndup_rxq(dhd_pub_t *pub); | |
931 | extern void brcmf_customer_gpio_wlan_ctrl(int onoff); | |
932 | extern int brcmf_custom_get_mac_address(unsigned char *buf); | |
933 | extern void brcmf_os_sdunlock_sndup_rxq(dhd_pub_t *pub); | |
934 | extern void brcmf_os_sdlock_eventq(dhd_pub_t *pub); | |
935 | extern void brcmf_os_sdunlock_eventq(dhd_pub_t *pub); | |
cf2b4488 | 936 | #ifdef DHD_DEBUG |
a84bac46 | 937 | extern int brcmf_write_to_file(dhd_pub_t *dhd, u8 *buf, int size); |
cf2b4488 HP |
938 | #endif /* DHD_DEBUG */ |
939 | #if defined(OOB_INTR_ONLY) | |
a84bac46 | 940 | extern int brcmf_customer_oob_irq_map(unsigned long *irq_flags_ptr); |
cf2b4488 | 941 | #endif /* defined(OOB_INTR_ONLY) */ |
cf2b4488 | 942 | |
a84bac46 AS |
943 | extern void brcmf_timeout_start(dhd_timeout_t *tmo, uint usec); |
944 | extern int brcmf_timeout_expired(dhd_timeout_t *tmo); | |
cf2b4488 | 945 | |
a84bac46 | 946 | extern int brcmf_ifname2idx(struct dhd_info *dhd, char *name); |
aba5e0ad | 947 | extern int brcmf_c_host_event(struct dhd_info *dhd, int *idx, void *pktdata, |
05dc0f43 | 948 | brcmf_event_msg_t *, void **data_ptr); |
cf2b4488 | 949 | |
aba5e0ad | 950 | extern void brcmf_c_init(void); |
cf2b4488 | 951 | |
a84bac46 | 952 | extern int brcmf_add_if(struct dhd_info *dhd, int ifidx, void *handle, |
66cbd3ab | 953 | char *name, u8 *mac_addr, u32 flags, u8 bssidx); |
a84bac46 | 954 | extern void brcmf_del_if(struct dhd_info *dhd, int ifidx); |
cf2b4488 | 955 | |
a84bac46 AS |
956 | extern void brcmf_vif_add(struct dhd_info *dhd, int ifidx, char *name); |
957 | extern void brcmf_vif_del(struct dhd_info *dhd, int ifidx); | |
cf2b4488 | 958 | |
a84bac46 AS |
959 | extern void brcmf_event(struct dhd_info *dhd, char *evpkt, int evlen, |
960 | int ifidx); | |
961 | extern void brcmf_vif_sendup(struct dhd_info *dhd, int ifidx, | |
962 | unsigned char *cp, int len); | |
cf2b4488 HP |
963 | |
964 | /* Send packet to dongle via data channel */ | |
a84bac46 | 965 | extern int brcmf_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pkt); |
cf2b4488 | 966 | |
a84bac46 | 967 | extern int brcmf_bus_devreset(dhd_pub_t *dhdp, u8 flag); |
a84bac46 | 968 | extern int brcmf_bus_start(dhd_pub_t *dhdp); |
cf2b4488 | 969 | |
a84bac46 AS |
970 | extern void brcmf_wait_for_event(dhd_pub_t *dhd, bool * lockvar); |
971 | extern void brcmf_wait_event_wakeup(dhd_pub_t *dhd); | |
cf2b4488 | 972 | |
e51b3e52 | 973 | #ifdef PKT_FILTER_SUPPORT |
aba5e0ad AS |
974 | extern void brcmf_c_pktfilter_offload_set(dhd_pub_t *dhd, char *arg); |
975 | extern void brcmf_c_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, | |
976 | int enable, int master_mode); | |
e51b3e52 AS |
977 | #endif |
978 | ||
13f401cb RV |
979 | #ifdef BCMDBG |
980 | #define ASSERT(exp) \ | |
981 | do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0) | |
982 | extern void osl_assert(char *exp, char *file, int line); | |
983 | #else | |
984 | #define ASSERT(exp) do {} while (0) | |
985 | #endif /* defined(BCMDBG) */ | |
986 | ||
434c14ef RV |
987 | /* Linux network driver ioctl encoding */ |
988 | typedef struct dhd_ioctl { | |
989 | uint cmd; /* common ioctl definition */ | |
990 | void *buf; /* pointer to user buffer */ | |
991 | uint len; /* length of user buffer */ | |
992 | bool set; /* get or set request (optional) */ | |
993 | uint used; /* bytes read or written (optional) */ | |
994 | uint needed; /* bytes needed (optional) */ | |
995 | uint driver; /* to identify target driver */ | |
996 | } dhd_ioctl_t; | |
997 | ||
998 | /* per-driver magic numbers */ | |
999 | #define DHD_IOCTL_MAGIC 0x00444944 | |
1000 | ||
1001 | /* bump this number if you change the ioctl interface */ | |
1002 | #define DHD_IOCTL_VERSION 1 | |
1003 | ||
1004 | #define DHD_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */ | |
1005 | #define DHD_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */ | |
1006 | ||
1007 | /* common ioctl definitions */ | |
1008 | #define DHD_GET_MAGIC 0 | |
1009 | #define DHD_GET_VERSION 1 | |
1010 | #define DHD_GET_VAR 2 | |
1011 | #define DHD_SET_VAR 3 | |
1012 | ||
1013 | /* message levels */ | |
1014 | #define DHD_ERROR_VAL 0x0001 | |
1015 | #define DHD_TRACE_VAL 0x0002 | |
1016 | #define DHD_INFO_VAL 0x0004 | |
1017 | #define DHD_DATA_VAL 0x0008 | |
1018 | #define DHD_CTL_VAL 0x0010 | |
1019 | #define DHD_TIMER_VAL 0x0020 | |
1020 | #define DHD_HDRS_VAL 0x0040 | |
1021 | #define DHD_BYTES_VAL 0x0080 | |
1022 | #define DHD_INTR_VAL 0x0100 | |
1023 | #define DHD_LOG_VAL 0x0200 | |
1024 | #define DHD_GLOM_VAL 0x0400 | |
1025 | #define DHD_EVENT_VAL 0x0800 | |
1026 | #define DHD_BTA_VAL 0x1000 | |
1027 | #define DHD_ISCAN_VAL 0x2000 | |
1028 | ||
1029 | #ifdef SDTEST | |
1030 | /* For pktgen iovar */ | |
5e92aa8c | 1031 | typedef struct brcmf_pktgen { |
434c14ef RV |
1032 | uint version; /* To allow structure change tracking */ |
1033 | uint freq; /* Max ticks between tx/rx attempts */ | |
1034 | uint count; /* Test packets to send/rcv each attempt */ | |
1035 | uint print; /* Print counts every <print> attempts */ | |
1036 | uint total; /* Total packets (or bursts) */ | |
1037 | uint minlen; /* Minimum length of packets to send */ | |
1038 | uint maxlen; /* Maximum length of packets to send */ | |
1039 | uint numsent; /* Count of test packets sent */ | |
1040 | uint numrcvd; /* Count of test packets received */ | |
1041 | uint numfail; /* Count of test send failures */ | |
1042 | uint mode; /* Test mode (type of test packets) */ | |
1043 | uint stop; /* Stop after this many tx failures */ | |
5e92aa8c | 1044 | } brcmf_pktgen_t; |
434c14ef RV |
1045 | |
1046 | /* Version in case structure changes */ | |
1047 | #define DHD_PKTGEN_VERSION 2 | |
1048 | ||
1049 | /* Type of test packets to use */ | |
1050 | #define DHD_PKTGEN_ECHO 1 /* Send echo requests */ | |
1051 | #define DHD_PKTGEN_SEND 2 /* Send discard packets */ | |
1052 | #define DHD_PKTGEN_RXBURST 3 /* Request dongle send N packets */ | |
1053 | #define DHD_PKTGEN_RECV 4 /* Continuous rx from continuous | |
1054 | tx dongle */ | |
1055 | #endif /* SDTEST */ | |
1056 | ||
1057 | /* Enter idle immediately (no timeout) */ | |
1058 | #define DHD_IDLE_IMMEDIATE (-1) | |
1059 | ||
1060 | /* Values for idleclock iovar: other values are the sd_divisor to use | |
1061 | when idle */ | |
1062 | #define DHD_IDLE_ACTIVE 0 /* Do not request any SD clock change | |
1063 | when idle */ | |
1064 | #define DHD_IDLE_STOP (-1) /* Request SD clock be stopped | |
1065 | (and use SD1 mode) */ | |
1066 | ||
cf2b4488 | 1067 | #endif /* _dhd_h_ */ |