14713f576671cec8204234a3d1bfc580392c5a63
[cascardo/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 MAX_CCA_CHANNELS 38     /* Max number of 20 Mhz wide channels */
123 #define MAX_CCA_SECS     60     /* CCA keeps this many seconds history */
124
125 #define IBSS_MED        15      /* Mediom in-bss congestion percentage */
126 #define IBSS_HI         25      /* Hi in-bss congestion percentage */
127 #define OBSS_MED        12
128 #define OBSS_HI         25
129 #define INTERFER_MED    5
130 #define INTERFER_HI     10
131
132 #define  CCA_FLAG_2G_ONLY               0x01    /* Return a channel from 2.4 Ghz band */
133 #define  CCA_FLAG_5G_ONLY               0x02    /* Return a channel from 2.4 Ghz band */
134 #define  CCA_FLAG_IGNORE_DURATION       0x04    /* Ignore dwell time for each channel */
135 #define  CCA_FLAGS_PREFER_1_6_11        0x10
136 #define  CCA_FLAG_IGNORE_INTERFER       0x20    /* do not exlude channel based on interfer level */
137
138 #define CCA_ERRNO_BAND          1       /* After filtering for band pref, no choices left */
139 #define CCA_ERRNO_DURATION      2       /* After filtering for duration, no choices left */
140 #define CCA_ERRNO_PREF_CHAN     3       /* After filtering for chan pref, no choices left */
141 #define CCA_ERRNO_INTERFER      4       /* After filtering for interference, no choices left */
142 #define CCA_ERRNO_TOO_FEW       5       /* Only 1 channel was input */
143
144 #define WL_NUM_RPI_BINS         8
145 #define WL_RM_TYPE_BASIC        1
146 #define WL_RM_TYPE_CCA          2
147 #define WL_RM_TYPE_RPI          3
148
149 #define WL_RM_FLAG_PARALLEL     (1<<0)
150
151 #define WL_RM_FLAG_LATE         (1<<1)
152 #define WL_RM_FLAG_INCAPABLE    (1<<2)
153 #define WL_RM_FLAG_REFUSED      (1<<3)
154
155 #define WL_SOFT_KEY     (1 << 0)        /* Indicates this key is using soft encrypt */
156 #define WL_PRIMARY_KEY  (1 << 1)        /* Indicates this key is the primary (ie tx) key */
157 #define WL_KF_RES_4     (1 << 4)        /* Reserved for backward compat */
158 #define WL_KF_RES_5     (1 << 5)        /* Reserved for backward compat */
159 #define WL_IBSS_PEER_GROUP_KEY  (1 << 6)        /* Indicates a group key for a IBSS PEER */
160
161 #define DHD_IF_VIF      0x01    /* Virtual IF (Hidden from user) */
162
163 /* optionally set by a module_param_string() */
164 #define MOD_PARAM_PATHLEN       2048
165
166 /* For supporting multiple interfaces */
167 #define DHD_MAX_IFS     16
168 #define DHD_DEL_IF      -0xe
169 #define DHD_BAD_IF      -0xf
170
171 #define DOT11_BSSTYPE_ANY                       2
172 #define DOT11_MAX_DEFAULT_KEYS  4
173
174 #define BCM_EVENT_MSG_VERSION           1
175 #define BCM_MSG_IFNAME_MAX              16
176
177 #define WLC_EVENT_MSG_LINK              0x01
178 #define WLC_EVENT_MSG_FLUSHTXQ          0x02
179 #define WLC_EVENT_MSG_GROUP             0x04
180
181 typedef struct {
182         u16 version;
183         u16 flags;
184         u32 event_type;
185         u32 status;
186         u32 reason;
187         u32 auth_type;
188         u32 datalen;
189         u8 addr[ETH_ALEN];
190         char ifname[BCM_MSG_IFNAME_MAX];
191 } __attribute__((packed)) wl_event_msg_t;
192
193 typedef  struct bcmeth_hdr {
194         u16 subtype;
195         u16 length;
196         u8 version;
197         u8 oui[3];
198         u16 usr_subtype;
199 } __attribute__((packed)) bcmeth_hdr_t;
200
201 #ifdef BRCM_FULLMAC
202 typedef struct bcm_event {
203         struct ethhdr eth;
204         bcmeth_hdr_t            bcm_hdr;
205         wl_event_msg_t          event;
206 } __attribute__((packed)) bcm_event_t;
207 #endif
208 #define BCM_MSG_LEN     (sizeof(bcm_event_t) - sizeof(bcmeth_hdr_t) - \
209         sizeof(struct ether_header))
210
211 #define WLC_E_SET_SSID          0
212 #define WLC_E_JOIN              1
213 #define WLC_E_START             2
214 #define WLC_E_AUTH              3
215 #define WLC_E_AUTH_IND          4
216 #define WLC_E_DEAUTH            5
217 #define WLC_E_DEAUTH_IND        6
218 #define WLC_E_ASSOC             7
219 #define WLC_E_ASSOC_IND         8
220 #define WLC_E_REASSOC           9
221 #define WLC_E_REASSOC_IND       10
222 #define WLC_E_DISASSOC          11
223 #define WLC_E_DISASSOC_IND      12
224 #define WLC_E_QUIET_START       13
225 #define WLC_E_QUIET_END         14
226 #define WLC_E_BEACON_RX         15
227 #define WLC_E_LINK              16
228 #define WLC_E_MIC_ERROR         17
229 #define WLC_E_NDIS_LINK         18
230 #define WLC_E_ROAM              19
231 #define WLC_E_TXFAIL            20
232 #define WLC_E_PMKID_CACHE       21
233 #define WLC_E_RETROGRADE_TSF    22
234 #define WLC_E_PRUNE             23
235 #define WLC_E_AUTOAUTH          24
236 #define WLC_E_EAPOL_MSG         25
237 #define WLC_E_SCAN_COMPLETE     26
238 #define WLC_E_ADDTS_IND         27
239 #define WLC_E_DELTS_IND         28
240 #define WLC_E_BCNSENT_IND       29
241 #define WLC_E_BCNRX_MSG         30
242 #define WLC_E_BCNLOST_MSG       31
243 #define WLC_E_ROAM_PREP         32
244 #define WLC_E_PFN_NET_FOUND     33
245 #define WLC_E_PFN_NET_LOST      34
246 #define WLC_E_RESET_COMPLETE    35
247 #define WLC_E_JOIN_START        36
248 #define WLC_E_ROAM_START        37
249 #define WLC_E_ASSOC_START       38
250 #define WLC_E_IBSS_ASSOC        39
251 #define WLC_E_RADIO             40
252 #define WLC_E_PSM_WATCHDOG      41
253 #define WLC_E_PROBREQ_MSG       44
254 #define WLC_E_SCAN_CONFIRM_IND  45
255 #define WLC_E_PSK_SUP           46
256 #define WLC_E_COUNTRY_CODE_CHANGED 47
257 #define WLC_E_EXCEEDED_MEDIUM_TIME 48
258 #define WLC_E_ICV_ERROR         49
259 #define WLC_E_UNICAST_DECODE_ERROR 50
260 #define WLC_E_MULTICAST_DECODE_ERROR 51
261 #define WLC_E_TRACE             52
262 #define WLC_E_IF                54
263 #define WLC_E_RSSI              56
264 #define WLC_E_PFN_SCAN_COMPLETE 57
265 #define WLC_E_EXTLOG_MSG        58
266 #define WLC_E_ACTION_FRAME      59
267 #define WLC_E_ACTION_FRAME_COMPLETE 60
268 #define WLC_E_PRE_ASSOC_IND     61
269 #define WLC_E_PRE_REASSOC_IND   62
270 #define WLC_E_CHANNEL_ADOPTED   63
271 #define WLC_E_AP_STARTED        64
272 #define WLC_E_DFS_AP_STOP       65
273 #define WLC_E_DFS_AP_RESUME     66
274 #define WLC_E_RESERVED1         67
275 #define WLC_E_RESERVED2         68
276 #define WLC_E_ESCAN_RESULT      69
277 #define WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE    70
278 #define WLC_E_DCS_REQUEST 73
279
280 #define WLC_E_FIFO_CREDIT_MAP   74
281
282 #define WLC_E_LAST              75
283
284 #define WLC_E_STATUS_SUCCESS            0
285 #define WLC_E_STATUS_FAIL               1
286 #define WLC_E_STATUS_TIMEOUT            2
287 #define WLC_E_STATUS_NO_NETWORKS        3
288 #define WLC_E_STATUS_ABORT              4
289 #define WLC_E_STATUS_NO_ACK             5
290 #define WLC_E_STATUS_UNSOLICITED        6
291 #define WLC_E_STATUS_ATTEMPT            7
292 #define WLC_E_STATUS_PARTIAL            8
293 #define WLC_E_STATUS_NEWSCAN            9
294 #define WLC_E_STATUS_NEWASSOC           10
295 #define WLC_E_STATUS_11HQUIET           11
296 #define WLC_E_STATUS_SUPPRESS           12
297 #define WLC_E_STATUS_NOCHANS            13
298 #define WLC_E_STATUS_CS_ABORT           15
299 #define WLC_E_STATUS_ERROR              16
300
301 #define WLC_E_REASON_INITIAL_ASSOC      0
302 #define WLC_E_REASON_LOW_RSSI           1
303 #define WLC_E_REASON_DEAUTH             2
304 #define WLC_E_REASON_DISASSOC           3
305 #define WLC_E_REASON_BCNS_LOST          4
306 #define WLC_E_REASON_MINTXRATE          9
307 #define WLC_E_REASON_TXFAIL             10
308
309 #define WLC_E_REASON_FAST_ROAM_FAILED   5
310 #define WLC_E_REASON_DIRECTED_ROAM      6
311 #define WLC_E_REASON_TSPEC_REJECTED     7
312 #define WLC_E_REASON_BETTER_AP          8
313
314 #define WLC_E_PRUNE_ENCR_MISMATCH       1
315 #define WLC_E_PRUNE_BCAST_BSSID         2
316 #define WLC_E_PRUNE_MAC_DENY            3
317 #define WLC_E_PRUNE_MAC_NA              4
318 #define WLC_E_PRUNE_REG_PASSV           5
319 #define WLC_E_PRUNE_SPCT_MGMT           6
320 #define WLC_E_PRUNE_RADAR               7
321 #define WLC_E_RSN_MISMATCH              8
322 #define WLC_E_PRUNE_NO_COMMON_RATES     9
323 #define WLC_E_PRUNE_BASIC_RATES         10
324 #define WLC_E_PRUNE_CIPHER_NA           12
325 #define WLC_E_PRUNE_KNOWN_STA           13
326 #define WLC_E_PRUNE_WDS_PEER            15
327 #define WLC_E_PRUNE_QBSS_LOAD           16
328 #define WLC_E_PRUNE_HOME_AP             17
329
330 #define WLC_E_SUP_OTHER                 0
331 #define WLC_E_SUP_DECRYPT_KEY_DATA      1
332 #define WLC_E_SUP_BAD_UCAST_WEP128      2
333 #define WLC_E_SUP_BAD_UCAST_WEP40       3
334 #define WLC_E_SUP_UNSUP_KEY_LEN         4
335 #define WLC_E_SUP_PW_KEY_CIPHER         5
336 #define WLC_E_SUP_MSG3_TOO_MANY_IE      6
337 #define WLC_E_SUP_MSG3_IE_MISMATCH      7
338 #define WLC_E_SUP_NO_INSTALL_FLAG       8
339 #define WLC_E_SUP_MSG3_NO_GTK           9
340 #define WLC_E_SUP_GRP_KEY_CIPHER        10
341 #define WLC_E_SUP_GRP_MSG1_NO_GTK       11
342 #define WLC_E_SUP_GTK_DECRYPT_FAIL      12
343 #define WLC_E_SUP_SEND_FAIL             13
344 #define WLC_E_SUP_DEAUTH                14
345
346 #define WLC_E_IF_ADD            1
347 #define WLC_E_IF_DEL            2
348 #define WLC_E_IF_CHANGE         3
349
350 #define WLC_E_IF_ROLE_STA               0
351 #define WLC_E_IF_ROLE_AP                1
352 #define WLC_E_IF_ROLE_WDS               2
353
354 #define WLC_E_LINK_BCN_LOSS     1
355 #define WLC_E_LINK_DISASSOC     2
356 #define WLC_E_LINK_ASSOC_REC    3
357 #define WLC_E_LINK_BSSCFG_DIS   4
358
359 enum cust_gpio_modes {
360         WLAN_RESET_ON,
361         WLAN_RESET_OFF,
362         WLAN_POWER_ON,
363         WLAN_POWER_OFF
364 };
365
366 /* The level of bus communication with the dongle */
367 enum dhd_bus_state {
368         DHD_BUS_DOWN,           /* Not ready for frame transfers */
369         DHD_BUS_LOAD,           /* Download access only (CPU reset) */
370         DHD_BUS_DATA            /* Ready for frame transfers */
371 };
372
373 /* Pattern matching filter. Specifies an offset within received packets to
374  * start matching, the pattern to match, the size of the pattern, and a bitmask
375  * that indicates which bits within the pattern should be matched.
376  */
377 typedef struct wl_pkt_filter_pattern {
378         u32 offset;             /* Offset within received packet to start pattern matching.
379                                  * Offset '0' is the first byte of the ethernet header.
380                                  */
381         u32 size_bytes; /* Size of the pattern.  Bitmask must be the same size. */
382         u8 mask_and_pattern[1]; /* Variable length mask and pattern data.  mask starts
383                                          * at offset 0.  Pattern immediately follows mask.
384                                          */
385 } wl_pkt_filter_pattern_t;
386
387 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
388 typedef struct wl_pkt_filter {
389         u32 id;         /* Unique filter id, specified by app. */
390         u32 type;               /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
391         u32 negate_match;       /* Negate the result of filter matches */
392         union {                 /* Filter definitions */
393                 wl_pkt_filter_pattern_t pattern;        /* Pattern matching filter */
394         } u;
395 } wl_pkt_filter_t;
396
397 /* IOVAR "pkt_filter_enable" parameter. */
398 typedef struct wl_pkt_filter_enable {
399         u32 id;         /* Unique filter id */
400         u32 enable;             /* Enable/disable bool */
401 } wl_pkt_filter_enable_t;
402
403 /* BSS info structure
404  * Applications MUST CHECK ie_offset field and length field to access IEs and
405  * next bss_info structure in a vector (in wl_scan_results_t)
406  */
407 typedef struct wl_bss_info {
408         u32 version;            /* version field */
409         u32 length;             /* byte length of data in this record,
410                                  * starting at version and including IEs
411                                  */
412         u8 BSSID[ETH_ALEN];
413         u16 beacon_period;      /* units are Kusec */
414         u16 capability; /* Capability information */
415         u8 SSID_len;
416         u8 SSID[32];
417         struct {
418                 uint count;     /* # rates in this set */
419                 u8 rates[16];   /* rates in 500kbps units w/hi bit set if basic */
420         } rateset;              /* supported rates */
421         chanspec_t chanspec;    /* chanspec for bss */
422         u16 atim_window;        /* units are Kusec */
423         u8 dtim_period; /* DTIM period */
424         s16 RSSI;               /* receive signal strength (in dBm) */
425         s8 phy_noise;           /* noise (in dBm) */
426
427         u8 n_cap;               /* BSS is 802.11N Capable */
428         u32 nbss_cap;   /* 802.11N BSS Capabilities (based on HT_CAP_*) */
429         u8 ctl_ch;              /* 802.11N BSS control channel number */
430         u32 reserved32[1];      /* Reserved for expansion of BSS properties */
431         u8 flags;               /* flags */
432         u8 reserved[3]; /* Reserved for expansion of BSS properties */
433         u8 basic_mcs[MCSSET_LEN];       /* 802.11N BSS required MCS set */
434
435         u16 ie_offset;  /* offset at which IEs start, from beginning */
436         u32 ie_length;  /* byte length of Information Elements */
437         s16 SNR;                /* average SNR of during frame reception */
438         /* Add new fields here */
439         /* variable length Information Elements */
440 } wl_bss_info_t;
441
442 typedef struct wlc_ssid {
443         u32 SSID_len;
444         unsigned char SSID[32];
445 } wlc_ssid_t;
446
447 typedef struct wl_scan_params {
448         wlc_ssid_t ssid;        /* default: {0, ""} */
449         u8 bssid[ETH_ALEN];     /* default: bcast */
450         s8 bss_type;            /* default: any,
451                                  * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
452                                  */
453         u8 scan_type;   /* flags, 0 use default */
454         s32 nprobes;            /* -1 use default, number of probes per channel */
455         s32 active_time;        /* -1 use default, dwell time per channel for
456                                  * active scanning
457                                  */
458         s32 passive_time;       /* -1 use default, dwell time per channel
459                                  * for passive scanning
460                                  */
461         s32 home_time;  /* -1 use default, dwell time for the home channel
462                                  * between channel scans
463                                  */
464         s32 channel_num;        /* count of channels and ssids that follow
465                                  *
466                                  * low half is count of channels in channel_list, 0
467                                  * means default (use all available channels)
468                                  *
469                                  * high half is entries in wlc_ssid_t array that
470                                  * follows channel_list, aligned for s32 (4 bytes)
471                                  * meaning an odd channel count implies a 2-byte pad
472                                  * between end of channel_list and first ssid
473                                  *
474                                  * if ssid count is zero, single ssid in the fixed
475                                  * parameter portion is assumed, otherwise ssid in
476                                  * the fixed portion is ignored
477                                  */
478         u16 channel_list[1];    /* list of chanspecs */
479 } wl_scan_params_t;
480
481 /* incremental scan struct */
482 typedef struct wl_iscan_params {
483         u32 version;
484         u16 action;
485         u16 scan_duration;
486         wl_scan_params_t params;
487 } wl_iscan_params_t;
488
489 /* 3 fields + size of wl_scan_params, not including variable length array */
490 #define WL_ISCAN_PARAMS_FIXED_SIZE (offsetof(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
491
492 typedef struct wl_scan_results {
493         u32 buflen;
494         u32 version;
495         u32 count;
496         wl_bss_info_t bss_info[1];
497 } wl_scan_results_t;
498
499 typedef struct wl_rateset_args {
500         u32 count;              /* # rates in this set */
501         u8 rates[WL_NUMRATES];  /* rates in 500kbps units w/hi bit set if basic */
502         u8 mcs[MCSSET_LEN];     /* supported mcs index bit map */
503 } wl_rateset_args_t;
504
505 /* u32 list */
506 typedef struct wl_u32_list {
507         /* in - # of elements, out - # of entries */
508         u32 count;
509         /* variable length u32 list */
510         u32 element[1];
511 } wl_u32_list_t;
512
513 /* used for association with a specific BSSID and chanspec list */
514 typedef struct wl_assoc_params {
515         u8 bssid[ETH_ALEN];     /* 00:00:00:00:00:00: broadcast scan */
516         s32 chanspec_num;       /* 0: all available channels,
517                                  * otherwise count of chanspecs in chanspec_list
518                                  */
519         chanspec_t chanspec_list[1];    /* list of chanspecs */
520 } wl_assoc_params_t;
521 #define WL_ASSOC_PARAMS_FIXED_SIZE      (sizeof(wl_assoc_params_t) - sizeof(chanspec_t))
522
523 /* used for reassociation/roam to a specific BSSID and channel */
524 typedef wl_assoc_params_t wl_reassoc_params_t;
525 #define WL_REASSOC_PARAMS_FIXED_SIZE    WL_ASSOC_PARAMS_FIXED_SIZE
526
527 /* used for join with or without a specific bssid and channel list */
528 typedef struct wl_join_params {
529         wlc_ssid_t ssid;
530         wl_assoc_params_t params;       /* optional field, but it must include the fixed portion
531                                          * of the wl_assoc_params_t struct when it does present.
532                                          */
533 } wl_join_params_t;
534 #define WL_JOIN_PARAMS_FIXED_SIZE       (sizeof(wl_join_params_t) - sizeof(chanspec_t))
535
536 /* size of wl_scan_results not including variable length array */
537 #define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
538
539 /* incremental scan results struct */
540 typedef struct wl_iscan_results {
541         u32 status;
542         wl_scan_results_t results;
543 } wl_iscan_results_t;
544
545 /* size of wl_iscan_results not including variable length array */
546 #define WL_ISCAN_RESULTS_FIXED_SIZE \
547         (WL_SCAN_RESULTS_FIXED_SIZE + offsetof(wl_iscan_results_t, results))
548
549 typedef struct {
550         u32 duration;   /* millisecs spent sampling this channel */
551         u32 congest_ibss;       /* millisecs in our bss (presumably this traffic will */
552         /*  move if cur bss moves channels) */
553         u32 congest_obss;       /* traffic not in our bss */
554         u32 interference;       /* millisecs detecting a non 802.11 interferer. */
555         u32 timestamp;  /* second timestamp */
556 } cca_congest_t;
557
558 typedef struct {
559         chanspec_t chanspec;    /* Which channel? */
560         u8 num_secs;            /* How many secs worth of data */
561         cca_congest_t secs[1];  /* Data */
562 } cca_congest_channel_req_t;
563
564 typedef struct wl_country {
565         char country_abbrev[WLC_CNTRY_BUF_SZ];  /* nul-terminated country code used in
566                                                  * the Country IE
567                                                  */
568         s32 rev;                /* revision specifier for ccode
569                                  * on set, -1 indicates unspecified.
570                                  * on get, rev >= 0
571                                  */
572         char ccode[WLC_CNTRY_BUF_SZ];   /* nul-terminated built-in country code.
573                                          * variable length, but fixed size in
574                                          * struct allows simple allocation for
575                                          * expected country strings <= 3 chars.
576                                          */
577 } wl_country_t;
578
579 typedef struct wl_channels_in_country {
580         u32 buflen;
581         u32 band;
582         char country_abbrev[WLC_CNTRY_BUF_SZ];
583         u32 count;
584         u32 channel[1];
585 } wl_channels_in_country_t;
586
587 typedef struct wl_country_list {
588         u32 buflen;
589         u32 band_set;
590         u32 band;
591         u32 count;
592         char country_abbrev[1];
593 } wl_country_list_t;
594
595 typedef struct wl_rm_req_elt {
596         s8 type;
597         s8 flags;
598         chanspec_t chanspec;
599         u32 token;              /* token for this measurement */
600         u32 tsf_h;              /* TSF high 32-bits of Measurement start time */
601         u32 tsf_l;              /* TSF low 32-bits */
602         u32 dur;                /* TUs */
603 } wl_rm_req_elt_t;
604
605 typedef struct wl_rm_req {
606         u32 token;              /* overall measurement set token */
607         u32 count;              /* number of measurement requests */
608         void *cb;               /* completion callback function: may be NULL */
609         void *cb_arg;           /* arg to completion callback function */
610         wl_rm_req_elt_t req[1]; /* variable length block of requests */
611 } wl_rm_req_t;
612 #define WL_RM_REQ_FIXED_LEN     offsetof(wl_rm_req_t, req)
613
614 typedef struct wl_rm_rep_elt {
615         s8 type;
616         s8 flags;
617         chanspec_t chanspec;
618         u32 token;              /* token for this measurement */
619         u32 tsf_h;              /* TSF high 32-bits of Measurement start time */
620         u32 tsf_l;              /* TSF low 32-bits */
621         u32 dur;                /* TUs */
622         u32 len;                /* byte length of data block */
623         u8 data[1];             /* variable length data block */
624 } wl_rm_rep_elt_t;
625 #define WL_RM_REP_ELT_FIXED_LEN 24      /* length excluding data block */
626
627 #define WL_RPI_REP_BIN_NUM 8
628 typedef struct wl_rm_rpi_rep {
629         u8 rpi[WL_RPI_REP_BIN_NUM];
630         s8 rpi_max[WL_RPI_REP_BIN_NUM];
631 } wl_rm_rpi_rep_t;
632
633 typedef struct wl_rm_rep {
634         u32 token;              /* overall measurement set token */
635         u32 len;                /* length of measurement report block */
636         wl_rm_rep_elt_t rep[1]; /* variable length block of reports */
637 } wl_rm_rep_t;
638 #define WL_RM_REP_FIXED_LEN     8
639
640 typedef struct wl_wsec_key {
641         u32 index;              /* key index */
642         u32 len;                /* key length */
643         u8 data[WLAN_MAX_KEY_LEN];      /* key data */
644         u32 pad_1[18];
645         u32 algo;               /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
646         u32 flags;              /* misc flags */
647         u32 pad_2[2];
648         int pad_3;
649         int iv_initialized;     /* has IV been initialized already? */
650         int pad_4;
651         /* Rx IV */
652         struct {
653                 u32 hi; /* upper 32 bits of IV */
654                 u16 lo; /* lower 16 bits of IV */
655         } rxiv;
656         u32 pad_5[2];
657         u8 ea[ETH_ALEN];        /* per station */
658 } wl_wsec_key_t;
659
660 /* Used to get specific STA parameters */
661 typedef struct {
662         u32 val;
663         u8 ea[ETH_ALEN];
664 } scb_val_t;
665
666 /* channel encoding */
667 typedef struct channel_info {
668         int hw_channel;
669         int target_channel;
670         int scan_channel;
671 } channel_info_t;
672
673 /* Linux network driver ioctl encoding */
674 typedef struct wl_ioctl {
675         uint cmd;               /* common ioctl definition */
676         void *buf;              /* pointer to user buffer */
677         uint len;               /* length of user buffer */
678         u8 set;         /* get or set request (optional) */
679         uint used;              /* bytes read or written (optional) */
680         uint needed;            /* bytes needed (optional) */
681 } wl_ioctl_t;
682
683 /* Common structure for module and instance linkage */
684 typedef struct dhd_pub {
685         /* Linkage ponters */
686         struct dhd_bus *bus;    /* Bus module handle */
687         struct dhd_prot *prot;  /* Protocol module handle */
688         struct dhd_info *info;  /* Info module handle */
689
690         /* Internal dhd items */
691         bool up;                /* Driver up/down (to OS) */
692         bool txoff;             /* Transmit flow-controlled */
693         bool dongle_reset;      /* true = DEVRESET put dongle into reset */
694         enum dhd_bus_state busstate;
695         uint hdrlen;            /* Total DHD header length (proto + bus) */
696         uint maxctl;            /* Max size rxctl request from proto to bus */
697         uint rxsz;              /* Rx buffer size bus module should use */
698         u8 wme_dp;              /* wme discard priority */
699
700         /* Dongle media info */
701         bool iswl;              /* Dongle-resident driver is wl */
702         unsigned long drv_version;      /* Version of dongle-resident driver */
703         u8 mac[ETH_ALEN];                       /* MAC address obtained from dongle */
704         dngl_stats_t dstats;            /* Stats for dongle-based data */
705
706         /* Additional stats for the bus level */
707         unsigned long tx_packets;       /* Data packets sent to dongle */
708         unsigned long tx_multicast;     /* Multicast data packets sent to dongle */
709         unsigned long tx_errors;        /* Errors in sending data to dongle */
710         unsigned long tx_ctlpkts;       /* Control packets sent to dongle */
711         unsigned long tx_ctlerrs;       /* Errors sending control frames to dongle */
712         unsigned long rx_packets;       /* Packets sent up the network interface */
713         unsigned long rx_multicast;     /* Multicast packets sent up the network
714                                          interface */
715         unsigned long rx_errors;        /* Errors processing rx data packets */
716         unsigned long rx_ctlpkts;       /* Control frames processed from dongle */
717         unsigned long rx_ctlerrs;       /* Errors in processing rx control frames */
718         unsigned long rx_dropped;       /* Packets dropped locally (no memory) */
719         unsigned long rx_flushed;       /* Packets flushed due to
720                                 unscheduled sendup thread */
721         unsigned long wd_dpc_sched;     /* Number of times dhd dpc scheduled by
722                                          watchdog timer */
723
724         unsigned long rx_readahead_cnt; /* Number of packets where header read-ahead
725                                          was used. */
726         unsigned long tx_realloc;       /* Number of tx packets we had to realloc for
727                                          headroom */
728         unsigned long fc_packets;       /* Number of flow control pkts recvd */
729
730         /* Last error return */
731         int bcmerror;
732         uint tickcnt;
733
734         /* Last error from dongle */
735         int dongle_error;
736
737         /* Suspend disable flag  flag */
738         int suspend_disable_flag;       /* "1" to disable all extra powersaving
739                                          during suspend */
740         int in_suspend;         /* flag set to 1 when early suspend called */
741 #ifdef PNO_SUPPORT
742         int pno_enable;         /* pno status : "1" is pno enable */
743 #endif                          /* PNO_SUPPORT */
744         int dtim_skip;          /* dtim skip , default 0 means wake each dtim */
745
746         /* Pkt filter defination */
747         char *pktfilter[100];
748         int pktfilter_count;
749
750         u8 country_code[WLC_CNTRY_BUF_SZ];
751         char eventmask[WL_EVENTING_MASK_LEN];
752
753 } dhd_pub_t;
754
755 typedef struct dhd_if_event {
756         u8 ifidx;
757         u8 action;
758         u8 flags;
759         u8 bssidx;
760 } dhd_if_event_t;
761
762 typedef struct {
763         u32 limit;              /* Expiration time (usec) */
764         u32 increment;  /* Current expiration increment (usec) */
765         u32 elapsed;            /* Current elapsed time (usec) */
766         u32 tick;               /* O/S tick time (usec) */
767 } dhd_timeout_t;
768
769 typedef struct {
770         uint event;
771         const char *name;
772 } bcmevent_name_t;
773
774 #if defined(CONFIG_PM_SLEEP)
775 extern atomic_t dhd_mmc_suspend;
776 #define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
777 #define _DHD_PM_RESUME_WAIT(a, b) do { \
778                 int retry = 0; \
779                 while (atomic_read(&dhd_mmc_suspend) && retry++ != b) { \
780                         wait_event_timeout(a, false, HZ/100); \
781                 } \
782         }       while (0)
783 #define DHD_PM_RESUME_WAIT(a)   _DHD_PM_RESUME_WAIT(a, 30)
784 #define DHD_PM_RESUME_WAIT_FOREVER(a)   _DHD_PM_RESUME_WAIT(a, ~0)
785 #define DHD_PM_RESUME_RETURN_ERROR(a)   \
786         do { if (atomic_read(&dhd_mmc_suspend)) return a; } while (0)
787 #define DHD_PM_RESUME_RETURN    do { \
788         if (atomic_read(&dhd_mmc_suspend)) \
789                 return; \
790         } while (0)
791
792 #define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
793 #define SPINWAIT_SLEEP(a, exp, us) do { \
794                 uint countdown = (us) + 9999; \
795                 while ((exp) && (countdown >= 10000)) { \
796                         wait_event_timeout(a, false, HZ/100); \
797                         countdown -= 10000; \
798                 } \
799         } while (0)
800
801 #else
802
803 #define DHD_PM_RESUME_WAIT_INIT(a)
804 #define DHD_PM_RESUME_WAIT(a)
805 #define DHD_PM_RESUME_WAIT_FOREVER(a)
806 #define DHD_PM_RESUME_RETURN_ERROR(a)
807 #define DHD_PM_RESUME_RETURN
808
809 #define DHD_SPINWAIT_SLEEP_INIT(a)
810 #define SPINWAIT_SLEEP(a, exp, us)  do { \
811                 uint countdown = (us) + 9; \
812                 while ((exp) && (countdown >= 10)) { \
813                         udelay(10);  \
814                         countdown -= 10;  \
815                 } \
816         } while (0)
817
818 #endif  /* defined(CONFIG_PM_SLEEP) */
819
820 /*
821  * Insmod parameters for debug/test
822  */
823
824 /* Watchdog timer interval */
825 extern uint dhd_watchdog_ms;
826
827 #if defined(DHD_DEBUG)
828 /* Console output poll interval */
829 extern uint dhd_console_ms;
830 #endif                          /* defined(DHD_DEBUG) */
831
832 /* Use interrupts */
833 extern uint dhd_intr;
834
835 /* Use polling */
836 extern uint dhd_poll;
837
838 /* ARP offload agent mode */
839 extern uint dhd_arp_mode;
840
841 /* ARP offload enable */
842 extern uint dhd_arp_enable;
843
844 /* Pkt filte enable control */
845 extern uint dhd_pkt_filter_enable;
846
847 /*  Pkt filter init setup */
848 extern uint dhd_pkt_filter_init;
849
850 /* Pkt filter mode control */
851 extern uint dhd_master_mode;
852
853 /* Roaming mode control */
854 extern uint dhd_roam;
855
856 /* Roaming mode control */
857 extern uint dhd_radio_up;
858
859 /* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */
860 extern int dhd_idletime;
861 #define DHD_IDLETIME_TICKS 1
862
863 /* SDIO Drive Strength */
864 extern uint dhd_sdiod_drive_strength;
865
866 /* Override to force tx queueing all the time */
867 extern uint dhd_force_tx_queueing;
868
869 #ifdef SDTEST
870 /* Echo packet generator (SDIO), pkts/s */
871 extern uint dhd_pktgen;
872
873 /* Echo packet len (0 => sawtooth, max 1800) */
874 extern uint dhd_pktgen_len;
875 #define MAX_PKTGEN_LEN 1800
876 #endif
877
878 extern char brcmf_fw_path[MOD_PARAM_PATHLEN];
879 extern char brcmf_nv_path[MOD_PARAM_PATHLEN];
880
881 extern u32 g_assert_type;
882 extern const bcmevent_name_t bcmevent_names[];
883 extern const int bcmevent_names_size;
884
885
886 static inline void MUTEX_LOCK_INIT(dhd_pub_t *dhdp)
887 {
888 }
889
890 static inline void MUTEX_LOCK(dhd_pub_t *dhdp)
891 {
892 }
893
894 static inline void MUTEX_UNLOCK(dhd_pub_t *dhdp)
895 {
896 }
897
898 static inline void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t *dhdp)
899 {
900 }
901
902 static inline void MUTEX_LOCK_SOFTAP_SET(dhd_pub_t *dhdp)
903 {
904 }
905
906 static inline void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t *dhdp)
907 {
908 }
909
910 static inline void MUTEX_LOCK_WL_SCAN_SET_INIT(void)
911 {
912 }
913
914 static inline void MUTEX_LOCK_WL_SCAN_SET(void)
915 {
916 }
917
918 static inline void MUTEX_UNLOCK_WL_SCAN_SET(void)
919 {
920 }
921
922 /*
923  * Exported from dhd OS modules (dhd_linux/dhd_ndis)
924  */
925
926 /* Indication from bus module regarding presence/insertion of dongle.
927  * Return dhd_pub_t pointer, used as handle to OS module in later calls.
928  * Returned structure should have bus and prot pointers filled in.
929  * bus_hdrlen specifies required headroom for bus module header.
930  */
931 extern dhd_pub_t *dhd_attach(struct dhd_bus *bus,
932                                 uint bus_hdrlen);
933 extern int dhd_net_attach(dhd_pub_t *dhdp, int idx);
934
935 /* Indication from bus module regarding removal/absence of dongle */
936 extern void dhd_detach(dhd_pub_t *dhdp);
937
938 /* Indication from bus module to change flow-control state */
939 extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on);
940
941 extern bool brcmf_c_prec_enq(dhd_pub_t *dhdp, struct pktq *q,
942                          struct sk_buff *pkt, int prec);
943
944 /* Receive frame for delivery to OS.  Callee disposes of rxp. */
945 extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx,
946                          struct sk_buff *rxp, int numpkt);
947
948 /* Return pointer to interface name */
949 extern char *dhd_ifname(dhd_pub_t *dhdp, int idx);
950
951 /* Request scheduling of the bus dpc */
952 extern void dhd_sched_dpc(dhd_pub_t *dhdp);
953
954 /* Notify tx completion */
955 extern void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success);
956
957 /* Query ioctl */
958 extern int dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
959                               uint len);
960
961 /* OS independent layer functions */
962 extern int dhd_os_proto_block(dhd_pub_t *pub);
963 extern int dhd_os_proto_unblock(dhd_pub_t *pub);
964 extern int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition,
965                                   bool *pending);
966 extern int dhd_os_ioctl_resp_wake(dhd_pub_t *pub);
967 extern unsigned int dhd_os_get_ioctl_resp_timeout(void);
968 extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec);
969 extern void *dhd_os_open_image(char *filename);
970 extern int dhd_os_get_image_block(char *buf, int len, void *image);
971 extern void dhd_os_close_image(void *image);
972 extern void dhd_os_wd_timer(void *bus, uint wdtick);
973 extern void dhd_os_sdlock(dhd_pub_t *pub);
974 extern void dhd_os_sdunlock(dhd_pub_t *pub);
975 extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t *pub);
976 extern void dhd_customer_gpio_wlan_ctrl(int onoff);
977 extern int dhd_custom_get_mac_address(unsigned char *buf);
978 extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t *pub);
979 extern void dhd_os_sdlock_eventq(dhd_pub_t *pub);
980 extern void dhd_os_sdunlock_eventq(dhd_pub_t *pub);
981 #ifdef DHD_DEBUG
982 extern int write_to_file(dhd_pub_t *dhd, u8 *buf, int size);
983 #endif                          /* DHD_DEBUG */
984 #if defined(OOB_INTR_ONLY)
985 extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr);
986 #endif                          /* defined(OOB_INTR_ONLY) */
987
988 int setScheduler(struct task_struct *p, int policy, struct sched_param *param);
989
990 extern void dhd_timeout_start(dhd_timeout_t *tmo, uint usec);
991 extern int dhd_timeout_expired(dhd_timeout_t *tmo);
992
993 extern int dhd_ifname2idx(struct dhd_info *dhd, char *name);
994 extern u8 *dhd_bssidx2bssid(dhd_pub_t *dhd, int idx);
995 extern int brcmf_c_host_event(struct dhd_info *dhd, int *idx, void *pktdata,
996                          wl_event_msg_t *, void **data_ptr);
997
998 extern void brcmf_c_init(void);
999
1000 extern int dhd_add_if(struct dhd_info *dhd, int ifidx, void *handle,
1001                       char *name, u8 *mac_addr, u32 flags, u8 bssidx);
1002 extern void dhd_del_if(struct dhd_info *dhd, int ifidx);
1003
1004 extern void dhd_vif_add(struct dhd_info *dhd, int ifidx, char *name);
1005 extern void dhd_vif_del(struct dhd_info *dhd, int ifidx);
1006
1007 extern void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx);
1008 extern void dhd_vif_sendup(struct dhd_info *dhd, int ifidx, unsigned char * cp,
1009                            int len);
1010
1011 /* Send packet to dongle via data channel */
1012 extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pkt);
1013
1014 /* Send event to host */
1015 extern void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event,
1016                              void *data);
1017 extern int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag);
1018 extern uint dhd_bus_status(dhd_pub_t *dhdp);
1019 extern int dhd_bus_start(dhd_pub_t *dhdp);
1020
1021 extern void dhd_wait_for_event(dhd_pub_t *dhd, bool * lockvar);
1022 extern void dhd_wait_event_wakeup(dhd_pub_t *dhd);
1023
1024 #ifdef PKT_FILTER_SUPPORT
1025 extern void brcmf_c_pktfilter_offload_set(dhd_pub_t *dhd, char *arg);
1026 extern void brcmf_c_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg,
1027                                              int enable, int master_mode);
1028 #endif
1029
1030 #ifdef BCMDBG
1031 #define ASSERT(exp) \
1032           do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
1033 extern void osl_assert(char *exp, char *file, int line);
1034 #else
1035 #define ASSERT(exp)     do {} while (0)
1036 #endif  /* defined(BCMDBG) */
1037
1038 /* Linux network driver ioctl encoding */
1039 typedef struct dhd_ioctl {
1040         uint cmd;               /* common ioctl definition */
1041         void *buf;              /* pointer to user buffer */
1042         uint len;               /* length of user buffer */
1043         bool set;               /* get or set request (optional) */
1044         uint used;              /* bytes read or written (optional) */
1045         uint needed;            /* bytes needed (optional) */
1046         uint driver;            /* to identify target driver */
1047 } dhd_ioctl_t;
1048
1049 /* per-driver magic numbers */
1050 #define DHD_IOCTL_MAGIC         0x00444944
1051
1052 /* bump this number if you change the ioctl interface */
1053 #define DHD_IOCTL_VERSION       1
1054
1055 #define DHD_IOCTL_MAXLEN        8192    /* max length ioctl buffer required */
1056 #define DHD_IOCTL_SMLEN 256     /* "small" length ioctl buffer required */
1057
1058 /* common ioctl definitions */
1059 #define DHD_GET_MAGIC                           0
1060 #define DHD_GET_VERSION                         1
1061 #define DHD_GET_VAR                             2
1062 #define DHD_SET_VAR                             3
1063
1064 /* message levels */
1065 #define DHD_ERROR_VAL   0x0001
1066 #define DHD_TRACE_VAL   0x0002
1067 #define DHD_INFO_VAL    0x0004
1068 #define DHD_DATA_VAL    0x0008
1069 #define DHD_CTL_VAL     0x0010
1070 #define DHD_TIMER_VAL   0x0020
1071 #define DHD_HDRS_VAL    0x0040
1072 #define DHD_BYTES_VAL   0x0080
1073 #define DHD_INTR_VAL    0x0100
1074 #define DHD_LOG_VAL     0x0200
1075 #define DHD_GLOM_VAL    0x0400
1076 #define DHD_EVENT_VAL   0x0800
1077 #define DHD_BTA_VAL     0x1000
1078 #define DHD_ISCAN_VAL 0x2000
1079
1080 #ifdef SDTEST
1081 /* For pktgen iovar */
1082 typedef struct dhd_pktgen {
1083         uint version;           /* To allow structure change tracking */
1084         uint freq;              /* Max ticks between tx/rx attempts */
1085         uint count;             /* Test packets to send/rcv each attempt */
1086         uint print;             /* Print counts every <print> attempts */
1087         uint total;             /* Total packets (or bursts) */
1088         uint minlen;            /* Minimum length of packets to send */
1089         uint maxlen;            /* Maximum length of packets to send */
1090         uint numsent;           /* Count of test packets sent */
1091         uint numrcvd;           /* Count of test packets received */
1092         uint numfail;           /* Count of test send failures */
1093         uint mode;              /* Test mode (type of test packets) */
1094         uint stop;              /* Stop after this many tx failures */
1095 } dhd_pktgen_t;
1096
1097 /* Version in case structure changes */
1098 #define DHD_PKTGEN_VERSION 2
1099
1100 /* Type of test packets to use */
1101 #define DHD_PKTGEN_ECHO         1       /* Send echo requests */
1102 #define DHD_PKTGEN_SEND         2       /* Send discard packets */
1103 #define DHD_PKTGEN_RXBURST      3       /* Request dongle send N packets */
1104 #define DHD_PKTGEN_RECV         4       /* Continuous rx from continuous
1105                                          tx dongle */
1106 #endif                          /* SDTEST */
1107
1108 /* Enter idle immediately (no timeout) */
1109 #define DHD_IDLE_IMMEDIATE      (-1)
1110
1111 /* Values for idleclock iovar: other values are the sd_divisor to use
1112          when idle */
1113 #define DHD_IDLE_ACTIVE 0       /* Do not request any SD clock change
1114                                  when idle */
1115 #define DHD_IDLE_STOP   (-1)    /* Request SD clock be stopped
1116                                  (and use SD1 mode) */
1117
1118 #endif                          /* _dhd_h_ */