staging: brcm80211: remove unnecessary abstraction for scheduler
[deliverable/linux.git] / drivers / staging / brcm80211 / brcmfmac / dhd.h
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
24 /* Forward decls */
25 struct dhd_bus;
26 struct dhd_prot;
27 struct dhd_info;
28
29 #define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */
30 #define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */
31 #define BRCMF_C_IOCTL_MAXLEN 8192
32
33 #define BRCMF_C_UP 2
34 #define BRCMF_C_SET_PROMISC 10
35 #define BRCMF_C_GET_RATE 12
36 #define BRCMF_C_GET_INFRA 19
37 #define BRCMF_C_SET_INFRA 20
38 #define BRCMF_C_GET_AUTH 21
39 #define BRCMF_C_SET_AUTH 22
40 #define BRCMF_C_GET_BSSID 23
41 #define BRCMF_C_GET_SSID 25
42 #define BRCMF_C_SET_SSID 26
43 #define BRCMF_C_GET_CHANNEL 29
44 #define BRCMF_C_GET_SRL 31
45 #define BRCMF_C_GET_LRL 33
46 #define BRCMF_C_GET_RADIO 37
47 #define BRCMF_C_SET_RADIO 38
48 #define BRCMF_C_GET_PHYTYPE 39
49 #define BRCMF_C_SET_KEY 45
50 #define BRCMF_C_SET_PASSIVE_SCAN 49
51 #define BRCMF_C_SCAN 50
52 #define BRCMF_C_SCAN_RESULTS 51
53 #define BRCMF_C_DISASSOC 52
54 #define BRCMF_C_REASSOC 53
55 #define BRCMF_C_SET_ROAM_TRIGGER 55
56 #define BRCMF_C_SET_ROAM_DELTA 57
57 #define BRCMF_C_GET_DTIMPRD 77
58 #define BRCMF_C_SET_COUNTRY 84
59 #define BRCMF_C_GET_PM 85
60 #define BRCMF_C_SET_PM 86
61 #define BRCMF_C_GET_AP 117
62 #define BRCMF_C_SET_AP 118
63 #define BRCMF_C_GET_RSSI 127
64 #define BRCMF_C_GET_WSEC 133
65 #define BRCMF_C_SET_WSEC 134
66 #define BRCMF_C_GET_PHY_NOISE 135
67 #define BRCMF_C_GET_BSS_INFO 136
68 #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185
69 #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187
70 #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201
71 #define BRCMF_C_GET_VALID_CHANNELS 217
72 #define BRCMF_C_GET_KEY_PRIMARY 235
73 #define BRCMF_C_SET_KEY_PRIMARY 236
74 #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258
75 #define BRCMF_C_GET_VAR 262
76 #define BRCMF_C_SET_VAR 263
77
78 /* phy types (returned by WLC_GET_PHYTPE) */
79 #define WLC_PHY_TYPE_A 0
80 #define WLC_PHY_TYPE_B 1
81 #define WLC_PHY_TYPE_G 2
82 #define WLC_PHY_TYPE_N 4
83 #define WLC_PHY_TYPE_LP 5
84 #define WLC_PHY_TYPE_SSN 6
85 #define WLC_PHY_TYPE_HT 7
86 #define WLC_PHY_TYPE_LCN 8
87 #define WLC_PHY_TYPE_NULL 0xf
88
89 #define WL_PKT_FILTER_FIXED_LEN offsetof(wl_pkt_filter_t, u)
90 #define WL_PKT_FILTER_PATTERN_FIXED_LEN offsetof(wl_pkt_filter_pattern_t, mask_and_pattern)
91
92 #define WL_EVENTING_MASK_LEN 16
93
94 #define TOE_TX_CSUM_OL 0x00000001
95 #define TOE_RX_CSUM_OL 0x00000002
96
97 /* maximum channels returned by the get valid channels iovar */
98 #define WL_NUMCHANNELS 64
99
100 #define WL_BSS_INFO_VERSION 108 /* current ver of wl_bss_info struct */
101
102 /* size of wl_scan_params not including variable length array */
103 #define WL_SCAN_PARAMS_FIXED_SIZE 64
104
105 /* masks for channel and ssid count */
106 #define WL_SCAN_PARAMS_COUNT_MASK 0x0000ffff
107 #define WL_SCAN_PARAMS_NSSID_SHIFT 16
108
109 #define WL_SCAN_ACTION_START 1
110 #define WL_SCAN_ACTION_CONTINUE 2
111 #define WL_SCAN_ACTION_ABORT 3
112
113 #define ISCAN_REQ_VERSION 1
114
115 /* wl_iscan_results status values */
116 #define WL_SCAN_RESULTS_SUCCESS 0
117 #define WL_SCAN_RESULTS_PARTIAL 1
118 #define WL_SCAN_RESULTS_PENDING 2
119 #define WL_SCAN_RESULTS_ABORTED 3
120 #define WL_SCAN_RESULTS_NO_MEM 4
121
122 #define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */
123 #define WL_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */
124 #define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */
125 #define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */
126 #define WL_IBSS_PEER_GROUP_KEY (1 << 6) /* Indicates a group key for a IBSS PEER */
127
128 /* optionally set by a module_param_string() */
129 #define MOD_PARAM_PATHLEN 2048
130
131 /* For supporting multiple interfaces */
132 #define DHD_MAX_IFS 16
133 #define DHD_DEL_IF -0xe
134 #define DHD_BAD_IF -0xf
135
136 #define DOT11_BSSTYPE_ANY 2
137 #define DOT11_MAX_DEFAULT_KEYS 4
138
139 #define BRCMF_EVENT_MSG_LINK 0x01
140 #define BRCMF_EVENT_MSG_FLUSHTXQ 0x02
141 #define BRCMF_EVENT_MSG_GROUP 0x04
142
143 typedef struct brcmf_event_msg {
144 u16 version;
145 u16 flags;
146 u32 event_type;
147 u32 status;
148 u32 reason;
149 u32 auth_type;
150 u32 datalen;
151 u8 addr[ETH_ALEN];
152 char ifname[IFNAMSIZ];
153 } __packed brcmf_event_msg_t;
154
155 struct brcm_ethhdr {
156 u16 subtype;
157 u16 length;
158 u8 version;
159 u8 oui[3];
160 u16 usr_subtype;
161 } __packed;
162
163 typedef struct brcmf_event {
164 struct ethhdr eth;
165 struct brcm_ethhdr hdr;
166 struct brcmf_event_msg msg;
167 } __packed brcmf_event_t;
168
169 #define BRCMF_E_SET_SSID 0
170 #define BRCMF_E_JOIN 1
171 #define BRCMF_E_START 2
172 #define BRCMF_E_AUTH 3
173 #define BRCMF_E_AUTH_IND 4
174 #define BRCMF_E_DEAUTH 5
175 #define BRCMF_E_DEAUTH_IND 6
176 #define BRCMF_E_ASSOC 7
177 #define BRCMF_E_ASSOC_IND 8
178 #define BRCMF_E_REASSOC 9
179 #define BRCMF_E_REASSOC_IND 10
180 #define BRCMF_E_DISASSOC 11
181 #define BRCMF_E_DISASSOC_IND 12
182 #define BRCMF_E_QUIET_START 13
183 #define BRCMF_E_QUIET_END 14
184 #define BRCMF_E_BEACON_RX 15
185 #define BRCMF_E_LINK 16
186 #define BRCMF_E_MIC_ERROR 17
187 #define BRCMF_E_NDIS_LINK 18
188 #define BRCMF_E_ROAM 19
189 #define BRCMF_E_TXFAIL 20
190 #define BRCMF_E_PMKID_CACHE 21
191 #define BRCMF_E_RETROGRADE_TSF 22
192 #define BRCMF_E_PRUNE 23
193 #define BRCMF_E_AUTOAUTH 24
194 #define BRCMF_E_EAPOL_MSG 25
195 #define BRCMF_E_SCAN_COMPLETE 26
196 #define BRCMF_E_ADDTS_IND 27
197 #define BRCMF_E_DELTS_IND 28
198 #define BRCMF_E_BCNSENT_IND 29
199 #define BRCMF_E_BCNRX_MSG 30
200 #define BRCMF_E_BCNLOST_MSG 31
201 #define BRCMF_E_ROAM_PREP 32
202 #define BRCMF_E_PFN_NET_FOUND 33
203 #define BRCMF_E_PFN_NET_LOST 34
204 #define BRCMF_E_RESET_COMPLETE 35
205 #define BRCMF_E_JOIN_START 36
206 #define BRCMF_E_ROAM_START 37
207 #define BRCMF_E_ASSOC_START 38
208 #define BRCMF_E_IBSS_ASSOC 39
209 #define BRCMF_E_RADIO 40
210 #define BRCMF_E_PSM_WATCHDOG 41
211 #define BRCMF_E_PROBREQ_MSG 44
212 #define BRCMF_E_SCAN_CONFIRM_IND 45
213 #define BRCMF_E_PSK_SUP 46
214 #define BRCMF_E_COUNTRY_CODE_CHANGED 47
215 #define BRCMF_E_EXCEEDED_MEDIUM_TIME 48
216 #define BRCMF_E_ICV_ERROR 49
217 #define BRCMF_E_UNICAST_DECODE_ERROR 50
218 #define BRCMF_E_MULTICAST_DECODE_ERROR 51
219 #define BRCMF_E_TRACE 52
220 #define BRCMF_E_IF 54
221 #define BRCMF_E_RSSI 56
222 #define BRCMF_E_PFN_SCAN_COMPLETE 57
223 #define BRCMF_E_EXTLOG_MSG 58
224 #define BRCMF_E_ACTION_FRAME 59
225 #define BRCMF_E_ACTION_FRAME_COMPLETE 60
226 #define BRCMF_E_PRE_ASSOC_IND 61
227 #define BRCMF_E_PRE_REASSOC_IND 62
228 #define BRCMF_E_CHANNEL_ADOPTED 63
229 #define BRCMF_E_AP_STARTED 64
230 #define BRCMF_E_DFS_AP_STOP 65
231 #define BRCMF_E_DFS_AP_RESUME 66
232 #define BRCMF_E_RESERVED1 67
233 #define BRCMF_E_RESERVED2 68
234 #define BRCMF_E_ESCAN_RESULT 69
235 #define BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70
236 #define BRCMF_E_DCS_REQUEST 73
237
238 #define BRCMF_E_FIFO_CREDIT_MAP 74
239
240 #define BRCMF_E_LAST 75
241
242 #define BRCMF_E_STATUS_SUCCESS 0
243 #define BRCMF_E_STATUS_FAIL 1
244 #define BRCMF_E_STATUS_TIMEOUT 2
245 #define BRCMF_E_STATUS_NO_NETWORKS 3
246 #define BRCMF_E_STATUS_ABORT 4
247 #define BRCMF_E_STATUS_NO_ACK 5
248 #define BRCMF_E_STATUS_UNSOLICITED 6
249 #define BRCMF_E_STATUS_ATTEMPT 7
250 #define BRCMF_E_STATUS_PARTIAL 8
251 #define BRCMF_E_STATUS_NEWSCAN 9
252 #define BRCMF_E_STATUS_NEWASSOC 10
253 #define BRCMF_E_STATUS_11HQUIET 11
254 #define BRCMF_E_STATUS_SUPPRESS 12
255 #define BRCMF_E_STATUS_NOCHANS 13
256 #define BRCMF_E_STATUS_CS_ABORT 15
257 #define BRCMF_E_STATUS_ERROR 16
258
259 #define BRCMF_E_REASON_INITIAL_ASSOC 0
260 #define BRCMF_E_REASON_LOW_RSSI 1
261 #define BRCMF_E_REASON_DEAUTH 2
262 #define BRCMF_E_REASON_DISASSOC 3
263 #define BRCMF_E_REASON_BCNS_LOST 4
264 #define BRCMF_E_REASON_MINTXRATE 9
265 #define BRCMF_E_REASON_TXFAIL 10
266
267 #define BRCMF_E_REASON_FAST_ROAM_FAILED 5
268 #define BRCMF_E_REASON_DIRECTED_ROAM 6
269 #define BRCMF_E_REASON_TSPEC_REJECTED 7
270 #define BRCMF_E_REASON_BETTER_AP 8
271
272 #define BRCMF_E_PRUNE_ENCR_MISMATCH 1
273 #define BRCMF_E_PRUNE_BCAST_BSSID 2
274 #define BRCMF_E_PRUNE_MAC_DENY 3
275 #define BRCMF_E_PRUNE_MAC_NA 4
276 #define BRCMF_E_PRUNE_REG_PASSV 5
277 #define BRCMF_E_PRUNE_SPCT_MGMT 6
278 #define BRCMF_E_PRUNE_RADAR 7
279 #define BRCMF_E_RSN_MISMATCH 8
280 #define BRCMF_E_PRUNE_NO_COMMON_RATES 9
281 #define BRCMF_E_PRUNE_BASIC_RATES 10
282 #define BRCMF_E_PRUNE_CIPHER_NA 12
283 #define BRCMF_E_PRUNE_KNOWN_STA 13
284 #define BRCMF_E_PRUNE_WDS_PEER 15
285 #define BRCMF_E_PRUNE_QBSS_LOAD 16
286 #define BRCMF_E_PRUNE_HOME_AP 17
287
288 #define BRCMF_E_SUP_OTHER 0
289 #define BRCMF_E_SUP_DECRYPT_KEY_DATA 1
290 #define BRCMF_E_SUP_BAD_UCAST_WEP128 2
291 #define BRCMF_E_SUP_BAD_UCAST_WEP40 3
292 #define BRCMF_E_SUP_UNSUP_KEY_LEN 4
293 #define BRCMF_E_SUP_PW_KEY_CIPHER 5
294 #define BRCMF_E_SUP_MSG3_TOO_MANY_IE 6
295 #define BRCMF_E_SUP_MSG3_IE_MISMATCH 7
296 #define BRCMF_E_SUP_NO_INSTALL_FLAG 8
297 #define BRCMF_E_SUP_MSG3_NO_GTK 9
298 #define BRCMF_E_SUP_GRP_KEY_CIPHER 10
299 #define BRCMF_E_SUP_GRP_MSG1_NO_GTK 11
300 #define BRCMF_E_SUP_GTK_DECRYPT_FAIL 12
301 #define BRCMF_E_SUP_SEND_FAIL 13
302 #define BRCMF_E_SUP_DEAUTH 14
303
304 #define BRCMF_E_IF_ADD 1
305 #define BRCMF_E_IF_DEL 2
306 #define BRCMF_E_IF_CHANGE 3
307
308 #define BRCMF_E_IF_ROLE_STA 0
309 #define BRCMF_E_IF_ROLE_AP 1
310 #define BRCMF_E_IF_ROLE_WDS 2
311
312 #define BRCMF_E_LINK_BCN_LOSS 1
313 #define BRCMF_E_LINK_DISASSOC 2
314 #define BRCMF_E_LINK_ASSOC_REC 3
315 #define BRCMF_E_LINK_BSSCFG_DIS 4
316
317 enum cust_gpio_modes {
318 WLAN_RESET_ON,
319 WLAN_RESET_OFF,
320 WLAN_POWER_ON,
321 WLAN_POWER_OFF
322 };
323
324 /* The level of bus communication with the dongle */
325 enum dhd_bus_state {
326 DHD_BUS_DOWN, /* Not ready for frame transfers */
327 DHD_BUS_LOAD, /* Download access only (CPU reset) */
328 DHD_BUS_DATA /* Ready for frame transfers */
329 };
330
331 /* Pattern matching filter. Specifies an offset within received packets to
332 * start matching, the pattern to match, the size of the pattern, and a bitmask
333 * that indicates which bits within the pattern should be matched.
334 */
335 typedef struct wl_pkt_filter_pattern {
336 u32 offset; /* Offset within received packet to start pattern matching.
337 * Offset '0' is the first byte of the ethernet header.
338 */
339 u32 size_bytes; /* Size of the pattern. Bitmask must be the same size. */
340 u8 mask_and_pattern[1]; /* Variable length mask and pattern data. mask starts
341 * at offset 0. Pattern immediately follows mask.
342 */
343 } wl_pkt_filter_pattern_t;
344
345 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
346 typedef struct wl_pkt_filter {
347 u32 id; /* Unique filter id, specified by app. */
348 u32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
349 u32 negate_match; /* Negate the result of filter matches */
350 union { /* Filter definitions */
351 wl_pkt_filter_pattern_t pattern; /* Pattern matching filter */
352 } u;
353 } wl_pkt_filter_t;
354
355 /* IOVAR "pkt_filter_enable" parameter. */
356 typedef struct wl_pkt_filter_enable {
357 u32 id; /* Unique filter id */
358 u32 enable; /* Enable/disable bool */
359 } wl_pkt_filter_enable_t;
360
361 /* BSS info structure
362 * Applications MUST CHECK ie_offset field and length field to access IEs and
363 * next bss_info structure in a vector (in wl_scan_results_t)
364 */
365 typedef struct wl_bss_info {
366 u32 version; /* version field */
367 u32 length; /* byte length of data in this record,
368 * starting at version and including IEs
369 */
370 u8 BSSID[ETH_ALEN];
371 u16 beacon_period; /* units are Kusec */
372 u16 capability; /* Capability information */
373 u8 SSID_len;
374 u8 SSID[32];
375 struct {
376 uint count; /* # rates in this set */
377 u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
378 } rateset; /* supported rates */
379 chanspec_t chanspec; /* chanspec for bss */
380 u16 atim_window; /* units are Kusec */
381 u8 dtim_period; /* DTIM period */
382 s16 RSSI; /* receive signal strength (in dBm) */
383 s8 phy_noise; /* noise (in dBm) */
384
385 u8 n_cap; /* BSS is 802.11N Capable */
386 u32 nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */
387 u8 ctl_ch; /* 802.11N BSS control channel number */
388 u32 reserved32[1]; /* Reserved for expansion of BSS properties */
389 u8 flags; /* flags */
390 u8 reserved[3]; /* Reserved for expansion of BSS properties */
391 u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
392
393 u16 ie_offset; /* offset at which IEs start, from beginning */
394 u32 ie_length; /* byte length of Information Elements */
395 s16 SNR; /* average SNR of during frame reception */
396 /* Add new fields here */
397 /* variable length Information Elements */
398 } wl_bss_info_t;
399
400 typedef struct wlc_ssid {
401 u32 SSID_len;
402 unsigned char SSID[32];
403 } wlc_ssid_t;
404
405 typedef struct wl_scan_params {
406 wlc_ssid_t ssid; /* default: {0, ""} */
407 u8 bssid[ETH_ALEN]; /* default: bcast */
408 s8 bss_type; /* default: any,
409 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
410 */
411 u8 scan_type; /* flags, 0 use default */
412 s32 nprobes; /* -1 use default, number of probes per channel */
413 s32 active_time; /* -1 use default, dwell time per channel for
414 * active scanning
415 */
416 s32 passive_time; /* -1 use default, dwell time per channel
417 * for passive scanning
418 */
419 s32 home_time; /* -1 use default, dwell time for the home channel
420 * between channel scans
421 */
422 s32 channel_num; /* count of channels and ssids that follow
423 *
424 * low half is count of channels in channel_list, 0
425 * means default (use all available channels)
426 *
427 * high half is entries in wlc_ssid_t array that
428 * follows channel_list, aligned for s32 (4 bytes)
429 * meaning an odd channel count implies a 2-byte pad
430 * between end of channel_list and first ssid
431 *
432 * if ssid count is zero, single ssid in the fixed
433 * parameter portion is assumed, otherwise ssid in
434 * the fixed portion is ignored
435 */
436 u16 channel_list[1]; /* list of chanspecs */
437 } wl_scan_params_t;
438
439 /* incremental scan struct */
440 typedef struct wl_iscan_params {
441 u32 version;
442 u16 action;
443 u16 scan_duration;
444 wl_scan_params_t params;
445 } wl_iscan_params_t;
446
447 /* 3 fields + size of wl_scan_params, not including variable length array */
448 #define WL_ISCAN_PARAMS_FIXED_SIZE (offsetof(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
449
450 typedef struct wl_scan_results {
451 u32 buflen;
452 u32 version;
453 u32 count;
454 wl_bss_info_t bss_info[1];
455 } wl_scan_results_t;
456
457 typedef struct wl_rateset_args {
458 u32 count; /* # rates in this set */
459 u8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
460 u8 mcs[MCSSET_LEN]; /* supported mcs index bit map */
461 } wl_rateset_args_t;
462
463 /* u32 list */
464 typedef struct wl_u32_list {
465 /* in - # of elements, out - # of entries */
466 u32 count;
467 /* variable length u32 list */
468 u32 element[1];
469 } wl_u32_list_t;
470
471 /* used for association with a specific BSSID and chanspec list */
472 typedef struct wl_assoc_params {
473 u8 bssid[ETH_ALEN]; /* 00:00:00:00:00:00: broadcast scan */
474 s32 chanspec_num; /* 0: all available channels,
475 * otherwise count of chanspecs in chanspec_list
476 */
477 chanspec_t chanspec_list[1]; /* list of chanspecs */
478 } wl_assoc_params_t;
479 #define WL_ASSOC_PARAMS_FIXED_SIZE (sizeof(wl_assoc_params_t) - sizeof(chanspec_t))
480
481 /* used for reassociation/roam to a specific BSSID and channel */
482 typedef wl_assoc_params_t wl_reassoc_params_t;
483
484 /* used for join with or without a specific bssid and channel list */
485 typedef struct wl_join_params {
486 wlc_ssid_t ssid;
487 wl_assoc_params_t params; /* optional field, but it must include the fixed portion
488 * of the wl_assoc_params_t struct when it does present.
489 */
490 } wl_join_params_t;
491
492 /* size of wl_scan_results not including variable length array */
493 #define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
494
495 /* incremental scan results struct */
496 typedef struct wl_iscan_results {
497 u32 status;
498 wl_scan_results_t results;
499 } wl_iscan_results_t;
500
501 /* size of wl_iscan_results not including variable length array */
502 #define WL_ISCAN_RESULTS_FIXED_SIZE \
503 (WL_SCAN_RESULTS_FIXED_SIZE + offsetof(wl_iscan_results_t, results))
504
505 typedef struct {
506 u32 duration; /* millisecs spent sampling this channel */
507 u32 congest_ibss; /* millisecs in our bss (presumably this traffic will */
508 /* move if cur bss moves channels) */
509 u32 congest_obss; /* traffic not in our bss */
510 u32 interference; /* millisecs detecting a non 802.11 interferer. */
511 u32 timestamp; /* second timestamp */
512 } cca_congest_t;
513
514 typedef struct {
515 chanspec_t chanspec; /* Which channel? */
516 u8 num_secs; /* How many secs worth of data */
517 cca_congest_t secs[1]; /* Data */
518 } cca_congest_channel_req_t;
519
520 typedef struct wl_country {
521 char country_abbrev[WLC_CNTRY_BUF_SZ]; /* nul-terminated country code used in
522 * the Country IE
523 */
524 s32 rev; /* revision specifier for ccode
525 * on set, -1 indicates unspecified.
526 * on get, rev >= 0
527 */
528 char ccode[WLC_CNTRY_BUF_SZ]; /* nul-terminated built-in country code.
529 * variable length, but fixed size in
530 * struct allows simple allocation for
531 * expected country strings <= 3 chars.
532 */
533 } wl_country_t;
534
535 typedef struct wl_channels_in_country {
536 u32 buflen;
537 u32 band;
538 char country_abbrev[WLC_CNTRY_BUF_SZ];
539 u32 count;
540 u32 channel[1];
541 } wl_channels_in_country_t;
542
543 typedef struct wl_country_list {
544 u32 buflen;
545 u32 band_set;
546 u32 band;
547 u32 count;
548 char country_abbrev[1];
549 } wl_country_list_t;
550
551 typedef struct wl_rm_req_elt {
552 s8 type;
553 s8 flags;
554 chanspec_t chanspec;
555 u32 token; /* token for this measurement */
556 u32 tsf_h; /* TSF high 32-bits of Measurement start time */
557 u32 tsf_l; /* TSF low 32-bits */
558 u32 dur; /* TUs */
559 } wl_rm_req_elt_t;
560
561 typedef struct wl_rm_req {
562 u32 token; /* overall measurement set token */
563 u32 count; /* number of measurement requests */
564 void *cb; /* completion callback function: may be NULL */
565 void *cb_arg; /* arg to completion callback function */
566 wl_rm_req_elt_t req[1]; /* variable length block of requests */
567 } wl_rm_req_t;
568
569 typedef struct wl_rm_rep_elt {
570 s8 type;
571 s8 flags;
572 chanspec_t chanspec;
573 u32 token; /* token for this measurement */
574 u32 tsf_h; /* TSF high 32-bits of Measurement start time */
575 u32 tsf_l; /* TSF low 32-bits */
576 u32 dur; /* TUs */
577 u32 len; /* byte length of data block */
578 u8 data[1]; /* variable length data block */
579 } wl_rm_rep_elt_t;
580
581 #define WL_RPI_REP_BIN_NUM 8
582 typedef struct wl_rm_rpi_rep {
583 u8 rpi[WL_RPI_REP_BIN_NUM];
584 s8 rpi_max[WL_RPI_REP_BIN_NUM];
585 } wl_rm_rpi_rep_t;
586
587 typedef struct wl_rm_rep {
588 u32 token; /* overall measurement set token */
589 u32 len; /* length of measurement report block */
590 wl_rm_rep_elt_t rep[1]; /* variable length block of reports */
591 } wl_rm_rep_t;
592
593 typedef struct wl_wsec_key {
594 u32 index; /* key index */
595 u32 len; /* key length */
596 u8 data[WLAN_MAX_KEY_LEN]; /* key data */
597 u32 pad_1[18];
598 u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
599 u32 flags; /* misc flags */
600 u32 pad_2[2];
601 int pad_3;
602 int iv_initialized; /* has IV been initialized already? */
603 int pad_4;
604 /* Rx IV */
605 struct {
606 u32 hi; /* upper 32 bits of IV */
607 u16 lo; /* lower 16 bits of IV */
608 } rxiv;
609 u32 pad_5[2];
610 u8 ea[ETH_ALEN]; /* per station */
611 } wl_wsec_key_t;
612
613 /* Used to get specific STA parameters */
614 typedef struct {
615 u32 val;
616 u8 ea[ETH_ALEN];
617 } scb_val_t;
618
619 /* channel encoding */
620 typedef struct channel_info {
621 int hw_channel;
622 int target_channel;
623 int scan_channel;
624 } channel_info_t;
625
626 /* Linux network driver ioctl encoding */
627 typedef struct wl_ioctl {
628 uint cmd; /* common ioctl definition */
629 void *buf; /* pointer to user buffer */
630 uint len; /* length of user buffer */
631 u8 set; /* get or set request (optional) */
632 uint used; /* bytes read or written (optional) */
633 uint needed; /* bytes needed (optional) */
634 } wl_ioctl_t;
635
636 /* Common structure for module and instance linkage */
637 typedef struct dhd_pub {
638 /* Linkage ponters */
639 struct dhd_bus *bus; /* Bus module handle */
640 struct dhd_prot *prot; /* Protocol module handle */
641 struct dhd_info *info; /* Info module handle */
642
643 /* Internal dhd items */
644 bool up; /* Driver up/down (to OS) */
645 bool txoff; /* Transmit flow-controlled */
646 bool dongle_reset; /* true = DEVRESET put dongle into reset */
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 */
651 u8 wme_dp; /* wme discard priority */
652
653 /* Dongle media info */
654 bool iswl; /* Dongle-resident driver is wl */
655 unsigned long drv_version; /* Version of dongle-resident driver */
656 u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */
657 dngl_stats_t dstats; /* Stats for dongle-based data */
658
659 /* Additional stats for the bus level */
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
667 interface */
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
673 unscheduled sendup thread */
674 unsigned long wd_dpc_sched; /* Number of times dhd dpc scheduled by
675 watchdog timer */
676
677 unsigned long rx_readahead_cnt; /* Number of packets where header read-ahead
678 was used. */
679 unsigned long tx_realloc; /* Number of tx packets we had to realloc for
680 headroom */
681 unsigned long fc_packets; /* Number of flow control pkts recvd */
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
703 u8 country_code[WLC_CNTRY_BUF_SZ];
704 char eventmask[WL_EVENTING_MASK_LEN];
705
706 } dhd_pub_t;
707
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
722 typedef struct {
723 uint event;
724 const char *name;
725 } bcmevent_name_t;
726
727 #if defined(CONFIG_PM_SLEEP)
728 extern atomic_t dhd_mmc_suspend;
729 #define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
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)
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) \
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)
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)) { \
749 wait_event_timeout(a, false, HZ/100); \
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)) { \
766 udelay(10); \
767 countdown -= 10; \
768 } \
769 } while (0)
770
771 #endif /* defined(CONFIG_PM_SLEEP) */
772
773 /*
774 * Insmod parameters for debug/test
775 */
776
777 /* Watchdog timer interval */
778 extern uint brcmf_watchdog_ms;
779
780 #if defined(DHD_DEBUG)
781 /* Console output poll interval */
782 extern uint brcmf_console_ms;
783 #endif /* defined(DHD_DEBUG) */
784
785 /* Use interrupts */
786 extern uint brcmf_intr;
787
788 /* Use polling */
789 extern uint brcmf_poll;
790
791 /* ARP offload agent mode */
792 extern uint brcmf_arp_mode;
793
794 /* ARP offload enable */
795 extern uint brcmf_arp_enable;
796
797 /* Pkt filte enable control */
798 extern uint brcmf_pkt_filter_enable;
799
800 /* Pkt filter init setup */
801 extern uint brcmf_pkt_filter_init;
802
803 /* Pkt filter mode control */
804 extern uint brcmf_master_mode;
805
806 /* Roaming mode control */
807 extern uint brcmf_roam;
808
809 /* Roaming mode control */
810 extern uint brcmf_radio_up;
811
812 /* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */
813 extern int brcmf_idletime;
814 #define BRCMF_IDLETIME_TICKS 1
815
816 /* SDIO Drive Strength */
817 extern uint brcmf_sdiod_drive_strength;
818
819 /* Override to force tx queueing all the time */
820 extern uint brcmf_force_tx_queueing;
821
822 #ifdef SDTEST
823 /* Echo packet generator (SDIO), pkts/s */
824 extern uint brcmf_pktgen;
825
826 /* Echo packet len (0 => sawtooth, max 1800) */
827 extern uint brcmf_pktgen_len;
828 #define BRCMF_MAX_PKTGEN_LEN 1800
829 #endif
830
831 extern char brcmf_fw_path[MOD_PARAM_PATHLEN];
832 extern char brcmf_nv_path[MOD_PARAM_PATHLEN];
833
834 extern u32 g_assert_type;
835 extern const bcmevent_name_t bcmevent_names[];
836 extern const int bcmevent_names_size;
837
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
875 /*
876 * Exported from dhd OS modules (dhd_linux/dhd_ndis)
877 */
878
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 */
884 extern dhd_pub_t *dhd_attach(struct dhd_bus *bus,
885 uint bus_hdrlen);
886 extern int dhd_net_attach(dhd_pub_t *dhdp, int idx);
887
888 /* Indication from bus module regarding removal/absence of dongle */
889 extern void dhd_detach(dhd_pub_t *dhdp);
890
891 /* Indication from bus module to change flow-control state */
892 extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on);
893
894 extern bool brcmf_c_prec_enq(dhd_pub_t *dhdp, struct pktq *q,
895 struct sk_buff *pkt, int prec);
896
897 /* Receive frame for delivery to OS. Callee disposes of rxp. */
898 extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx,
899 struct sk_buff *rxp, int numpkt);
900
901 /* Return pointer to interface name */
902 extern char *dhd_ifname(dhd_pub_t *dhdp, int idx);
903
904 /* Request scheduling of the bus dpc */
905 extern void dhd_sched_dpc(dhd_pub_t *dhdp);
906
907 /* Notify tx completion */
908 extern void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success);
909
910 /* Query ioctl */
911 extern int dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
912 uint len);
913
914 /* OS independent layer functions */
915 extern int dhd_os_proto_block(dhd_pub_t *pub);
916 extern int dhd_os_proto_unblock(dhd_pub_t *pub);
917 extern int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition,
918 bool *pending);
919 extern int dhd_os_ioctl_resp_wake(dhd_pub_t *pub);
920 extern unsigned int dhd_os_get_ioctl_resp_timeout(void);
921 extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec);
922 extern void *dhd_os_open_image(char *filename);
923 extern int dhd_os_get_image_block(char *buf, int len, void *image);
924 extern void dhd_os_close_image(void *image);
925 extern void dhd_os_wd_timer(void *bus, uint wdtick);
926 extern void dhd_os_sdlock(dhd_pub_t *pub);
927 extern void dhd_os_sdunlock(dhd_pub_t *pub);
928 extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t *pub);
929 extern void dhd_customer_gpio_wlan_ctrl(int onoff);
930 extern int dhd_custom_get_mac_address(unsigned char *buf);
931 extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t *pub);
932 extern void dhd_os_sdlock_eventq(dhd_pub_t *pub);
933 extern void dhd_os_sdunlock_eventq(dhd_pub_t *pub);
934 #ifdef DHD_DEBUG
935 extern int write_to_file(dhd_pub_t *dhd, u8 *buf, int size);
936 #endif /* DHD_DEBUG */
937 #if defined(OOB_INTR_ONLY)
938 extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr);
939 #endif /* defined(OOB_INTR_ONLY) */
940
941 extern void dhd_timeout_start(dhd_timeout_t *tmo, uint usec);
942 extern int dhd_timeout_expired(dhd_timeout_t *tmo);
943
944 extern int dhd_ifname2idx(struct dhd_info *dhd, char *name);
945 extern u8 *dhd_bssidx2bssid(dhd_pub_t *dhd, int idx);
946 extern int brcmf_c_host_event(struct dhd_info *dhd, int *idx, void *pktdata,
947 brcmf_event_msg_t *, void **data_ptr);
948
949 extern void brcmf_c_init(void);
950
951 extern int dhd_add_if(struct dhd_info *dhd, int ifidx, void *handle,
952 char *name, u8 *mac_addr, u32 flags, u8 bssidx);
953 extern void dhd_del_if(struct dhd_info *dhd, int ifidx);
954
955 extern void dhd_vif_add(struct dhd_info *dhd, int ifidx, char *name);
956 extern void dhd_vif_del(struct dhd_info *dhd, int ifidx);
957
958 extern void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx);
959 extern void dhd_vif_sendup(struct dhd_info *dhd, int ifidx, unsigned char * cp,
960 int len);
961
962 /* Send packet to dongle via data channel */
963 extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pkt);
964
965 /* Send event to host */
966 extern void dhd_sendup_event(dhd_pub_t *dhdp, brcmf_event_msg_t *event,
967 void *data);
968 extern int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag);
969 extern uint dhd_bus_status(dhd_pub_t *dhdp);
970 extern int dhd_bus_start(dhd_pub_t *dhdp);
971
972 extern void dhd_wait_for_event(dhd_pub_t *dhd, bool * lockvar);
973 extern void dhd_wait_event_wakeup(dhd_pub_t *dhd);
974
975 #ifdef PKT_FILTER_SUPPORT
976 extern void brcmf_c_pktfilter_offload_set(dhd_pub_t *dhd, char *arg);
977 extern void brcmf_c_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg,
978 int enable, int master_mode);
979 #endif
980
981 #ifdef BCMDBG
982 #define ASSERT(exp) \
983 do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
984 extern void osl_assert(char *exp, char *file, int line);
985 #else
986 #define ASSERT(exp) do {} while (0)
987 #endif /* defined(BCMDBG) */
988
989 /* Linux network driver ioctl encoding */
990 typedef struct dhd_ioctl {
991 uint cmd; /* common ioctl definition */
992 void *buf; /* pointer to user buffer */
993 uint len; /* length of user buffer */
994 bool set; /* get or set request (optional) */
995 uint used; /* bytes read or written (optional) */
996 uint needed; /* bytes needed (optional) */
997 uint driver; /* to identify target driver */
998 } dhd_ioctl_t;
999
1000 /* per-driver magic numbers */
1001 #define DHD_IOCTL_MAGIC 0x00444944
1002
1003 /* bump this number if you change the ioctl interface */
1004 #define DHD_IOCTL_VERSION 1
1005
1006 #define DHD_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */
1007 #define DHD_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */
1008
1009 /* common ioctl definitions */
1010 #define DHD_GET_MAGIC 0
1011 #define DHD_GET_VERSION 1
1012 #define DHD_GET_VAR 2
1013 #define DHD_SET_VAR 3
1014
1015 /* message levels */
1016 #define DHD_ERROR_VAL 0x0001
1017 #define DHD_TRACE_VAL 0x0002
1018 #define DHD_INFO_VAL 0x0004
1019 #define DHD_DATA_VAL 0x0008
1020 #define DHD_CTL_VAL 0x0010
1021 #define DHD_TIMER_VAL 0x0020
1022 #define DHD_HDRS_VAL 0x0040
1023 #define DHD_BYTES_VAL 0x0080
1024 #define DHD_INTR_VAL 0x0100
1025 #define DHD_LOG_VAL 0x0200
1026 #define DHD_GLOM_VAL 0x0400
1027 #define DHD_EVENT_VAL 0x0800
1028 #define DHD_BTA_VAL 0x1000
1029 #define DHD_ISCAN_VAL 0x2000
1030
1031 #ifdef SDTEST
1032 /* For pktgen iovar */
1033 typedef struct brcmf_pktgen {
1034 uint version; /* To allow structure change tracking */
1035 uint freq; /* Max ticks between tx/rx attempts */
1036 uint count; /* Test packets to send/rcv each attempt */
1037 uint print; /* Print counts every <print> attempts */
1038 uint total; /* Total packets (or bursts) */
1039 uint minlen; /* Minimum length of packets to send */
1040 uint maxlen; /* Maximum length of packets to send */
1041 uint numsent; /* Count of test packets sent */
1042 uint numrcvd; /* Count of test packets received */
1043 uint numfail; /* Count of test send failures */
1044 uint mode; /* Test mode (type of test packets) */
1045 uint stop; /* Stop after this many tx failures */
1046 } brcmf_pktgen_t;
1047
1048 /* Version in case structure changes */
1049 #define DHD_PKTGEN_VERSION 2
1050
1051 /* Type of test packets to use */
1052 #define DHD_PKTGEN_ECHO 1 /* Send echo requests */
1053 #define DHD_PKTGEN_SEND 2 /* Send discard packets */
1054 #define DHD_PKTGEN_RXBURST 3 /* Request dongle send N packets */
1055 #define DHD_PKTGEN_RECV 4 /* Continuous rx from continuous
1056 tx dongle */
1057 #endif /* SDTEST */
1058
1059 /* Enter idle immediately (no timeout) */
1060 #define DHD_IDLE_IMMEDIATE (-1)
1061
1062 /* Values for idleclock iovar: other values are the sd_divisor to use
1063 when idle */
1064 #define DHD_IDLE_ACTIVE 0 /* Do not request any SD clock change
1065 when idle */
1066 #define DHD_IDLE_STOP (-1) /* Request SD clock be stopped
1067 (and use SD1 mode) */
1068
1069 #endif /* _dhd_h_ */
This page took 0.054074 seconds and 6 git commands to generate.