2 * Copyright (c) 2010 Broadcom Corporation
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.
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.
24 #define BRCMF_VERSION_STR "4.218.248.5"
26 #define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */
27 #define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */
28 #define BRCMF_C_IOCTL_MAXLEN 8192
31 #define BRCMF_C_SET_PROMISC 10
32 #define BRCMF_C_GET_RATE 12
33 #define BRCMF_C_GET_INFRA 19
34 #define BRCMF_C_SET_INFRA 20
35 #define BRCMF_C_GET_AUTH 21
36 #define BRCMF_C_SET_AUTH 22
37 #define BRCMF_C_GET_BSSID 23
38 #define BRCMF_C_GET_SSID 25
39 #define BRCMF_C_SET_SSID 26
40 #define BRCMF_C_GET_CHANNEL 29
41 #define BRCMF_C_GET_SRL 31
42 #define BRCMF_C_GET_LRL 33
43 #define BRCMF_C_GET_RADIO 37
44 #define BRCMF_C_SET_RADIO 38
45 #define BRCMF_C_GET_PHYTYPE 39
46 #define BRCMF_C_SET_KEY 45
47 #define BRCMF_C_SET_PASSIVE_SCAN 49
48 #define BRCMF_C_SCAN 50
49 #define BRCMF_C_SCAN_RESULTS 51
50 #define BRCMF_C_DISASSOC 52
51 #define BRCMF_C_REASSOC 53
52 #define BRCMF_C_SET_ROAM_TRIGGER 55
53 #define BRCMF_C_SET_ROAM_DELTA 57
54 #define BRCMF_C_GET_DTIMPRD 77
55 #define BRCMF_C_SET_COUNTRY 84
56 #define BRCMF_C_GET_PM 85
57 #define BRCMF_C_SET_PM 86
58 #define BRCMF_C_GET_AP 117
59 #define BRCMF_C_SET_AP 118
60 #define BRCMF_C_GET_RSSI 127
61 #define BRCMF_C_GET_WSEC 133
62 #define BRCMF_C_SET_WSEC 134
63 #define BRCMF_C_GET_PHY_NOISE 135
64 #define BRCMF_C_GET_BSS_INFO 136
65 #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185
66 #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187
67 #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201
68 #define BRCMF_C_GET_VALID_CHANNELS 217
69 #define BRCMF_C_GET_KEY_PRIMARY 235
70 #define BRCMF_C_SET_KEY_PRIMARY 236
71 #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258
72 #define BRCMF_C_GET_VAR 262
73 #define BRCMF_C_SET_VAR 263
75 /* phy types (returned by WLC_GET_PHYTPE) */
76 #define WLC_PHY_TYPE_A 0
77 #define WLC_PHY_TYPE_B 1
78 #define WLC_PHY_TYPE_G 2
79 #define WLC_PHY_TYPE_N 4
80 #define WLC_PHY_TYPE_LP 5
81 #define WLC_PHY_TYPE_SSN 6
82 #define WLC_PHY_TYPE_HT 7
83 #define WLC_PHY_TYPE_LCN 8
84 #define WLC_PHY_TYPE_NULL 0xf
86 #define BRCMF_PKT_FILTER_FIXED_LEN offsetof(struct brcmf_pkt_filter, u)
87 #define BRCMF_PKT_FILTER_PATTERN_FIXED_LEN \
88 offsetof(struct brcmf_pkt_filter_pattern, mask_and_pattern)
90 #define BRCMF_EVENTING_MASK_LEN 16
92 #define TOE_TX_CSUM_OL 0x00000001
93 #define TOE_RX_CSUM_OL 0x00000002
95 /* maximum channels returned by the get valid channels iovar */
96 #define WL_NUMCHANNELS 64
98 #define BRCMF_BSS_INFO_VERSION 108 /* current ver of brcmf_bss_info struct */
100 /* size of brcmf_scan_params not including variable length array */
101 #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
103 /* masks for channel and ssid count */
104 #define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff
105 #define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16
107 #define BRCMF_SCAN_ACTION_START 1
108 #define BRCMF_SCAN_ACTION_CONTINUE 2
109 #define WL_SCAN_ACTION_ABORT 3
111 #define BRCMF_ISCAN_REQ_VERSION 1
113 /* brcmf_iscan_results status values */
114 #define BRCMF_SCAN_RESULTS_SUCCESS 0
115 #define BRCMF_SCAN_RESULTS_PARTIAL 1
116 #define BRCMF_SCAN_RESULTS_PENDING 2
117 #define BRCMF_SCAN_RESULTS_ABORTED 3
118 #define BRCMF_SCAN_RESULTS_NO_MEM 4
120 #define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */
121 #define BRCMF_PRIMARY_KEY (1 << 1) /* primary (ie tx) key */
122 #define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */
123 #define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */
124 #define WL_IBSS_PEER_GROUP_KEY (1 << 6) /* Indicates a group key for a IBSS PEER */
126 /* For supporting multiple interfaces */
127 #define BRCMF_MAX_IFS 16
128 #define BRCMF_DEL_IF -0xe
129 #define BRCMF_BAD_IF -0xf
131 #define DOT11_BSSTYPE_ANY 2
132 #define DOT11_MAX_DEFAULT_KEYS 4
134 #define BRCMF_EVENT_MSG_LINK 0x01
135 #define BRCMF_EVENT_MSG_FLUSHTXQ 0x02
136 #define BRCMF_EVENT_MSG_GROUP 0x04
138 struct brcmf_event_msg
{
147 char ifname
[IFNAMSIZ
];
160 struct brcm_ethhdr hdr
;
161 struct brcmf_event_msg msg
;
165 unsigned long rx_packets
; /* total packets received */
166 unsigned long tx_packets
; /* total packets transmitted */
167 unsigned long rx_bytes
; /* total bytes received */
168 unsigned long tx_bytes
; /* total bytes transmitted */
169 unsigned long rx_errors
; /* bad packets received */
170 unsigned long tx_errors
; /* packet transmit problems */
171 unsigned long rx_dropped
; /* packets dropped by dongle */
172 unsigned long tx_dropped
; /* packets dropped by dongle */
173 unsigned long multicast
; /* multicast packets received */
176 #define BRCMF_E_SET_SSID 0
177 #define BRCMF_E_JOIN 1
178 #define BRCMF_E_START 2
179 #define BRCMF_E_AUTH 3
180 #define BRCMF_E_AUTH_IND 4
181 #define BRCMF_E_DEAUTH 5
182 #define BRCMF_E_DEAUTH_IND 6
183 #define BRCMF_E_ASSOC 7
184 #define BRCMF_E_ASSOC_IND 8
185 #define BRCMF_E_REASSOC 9
186 #define BRCMF_E_REASSOC_IND 10
187 #define BRCMF_E_DISASSOC 11
188 #define BRCMF_E_DISASSOC_IND 12
189 #define BRCMF_E_QUIET_START 13
190 #define BRCMF_E_QUIET_END 14
191 #define BRCMF_E_BEACON_RX 15
192 #define BRCMF_E_LINK 16
193 #define BRCMF_E_MIC_ERROR 17
194 #define BRCMF_E_NDIS_LINK 18
195 #define BRCMF_E_ROAM 19
196 #define BRCMF_E_TXFAIL 20
197 #define BRCMF_E_PMKID_CACHE 21
198 #define BRCMF_E_RETROGRADE_TSF 22
199 #define BRCMF_E_PRUNE 23
200 #define BRCMF_E_AUTOAUTH 24
201 #define BRCMF_E_EAPOL_MSG 25
202 #define BRCMF_E_SCAN_COMPLETE 26
203 #define BRCMF_E_ADDTS_IND 27
204 #define BRCMF_E_DELTS_IND 28
205 #define BRCMF_E_BCNSENT_IND 29
206 #define BRCMF_E_BCNRX_MSG 30
207 #define BRCMF_E_BCNLOST_MSG 31
208 #define BRCMF_E_ROAM_PREP 32
209 #define BRCMF_E_PFN_NET_FOUND 33
210 #define BRCMF_E_PFN_NET_LOST 34
211 #define BRCMF_E_RESET_COMPLETE 35
212 #define BRCMF_E_JOIN_START 36
213 #define BRCMF_E_ROAM_START 37
214 #define BRCMF_E_ASSOC_START 38
215 #define BRCMF_E_IBSS_ASSOC 39
216 #define BRCMF_E_RADIO 40
217 #define BRCMF_E_PSM_WATCHDOG 41
218 #define BRCMF_E_PROBREQ_MSG 44
219 #define BRCMF_E_SCAN_CONFIRM_IND 45
220 #define BRCMF_E_PSK_SUP 46
221 #define BRCMF_E_COUNTRY_CODE_CHANGED 47
222 #define BRCMF_E_EXCEEDED_MEDIUM_TIME 48
223 #define BRCMF_E_ICV_ERROR 49
224 #define BRCMF_E_UNICAST_DECODE_ERROR 50
225 #define BRCMF_E_MULTICAST_DECODE_ERROR 51
226 #define BRCMF_E_TRACE 52
227 #define BRCMF_E_IF 54
228 #define BRCMF_E_RSSI 56
229 #define BRCMF_E_PFN_SCAN_COMPLETE 57
230 #define BRCMF_E_EXTLOG_MSG 58
231 #define BRCMF_E_ACTION_FRAME 59
232 #define BRCMF_E_ACTION_FRAME_COMPLETE 60
233 #define BRCMF_E_PRE_ASSOC_IND 61
234 #define BRCMF_E_PRE_REASSOC_IND 62
235 #define BRCMF_E_CHANNEL_ADOPTED 63
236 #define BRCMF_E_AP_STARTED 64
237 #define BRCMF_E_DFS_AP_STOP 65
238 #define BRCMF_E_DFS_AP_RESUME 66
239 #define BRCMF_E_RESERVED1 67
240 #define BRCMF_E_RESERVED2 68
241 #define BRCMF_E_ESCAN_RESULT 69
242 #define BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70
243 #define BRCMF_E_DCS_REQUEST 73
245 #define BRCMF_E_FIFO_CREDIT_MAP 74
247 #define BRCMF_E_LAST 75
249 #define BRCMF_E_STATUS_SUCCESS 0
250 #define BRCMF_E_STATUS_FAIL 1
251 #define BRCMF_E_STATUS_TIMEOUT 2
252 #define BRCMF_E_STATUS_NO_NETWORKS 3
253 #define BRCMF_E_STATUS_ABORT 4
254 #define BRCMF_E_STATUS_NO_ACK 5
255 #define BRCMF_E_STATUS_UNSOLICITED 6
256 #define BRCMF_E_STATUS_ATTEMPT 7
257 #define BRCMF_E_STATUS_PARTIAL 8
258 #define BRCMF_E_STATUS_NEWSCAN 9
259 #define BRCMF_E_STATUS_NEWASSOC 10
260 #define BRCMF_E_STATUS_11HQUIET 11
261 #define BRCMF_E_STATUS_SUPPRESS 12
262 #define BRCMF_E_STATUS_NOCHANS 13
263 #define BRCMF_E_STATUS_CS_ABORT 15
264 #define BRCMF_E_STATUS_ERROR 16
266 #define BRCMF_E_REASON_INITIAL_ASSOC 0
267 #define BRCMF_E_REASON_LOW_RSSI 1
268 #define BRCMF_E_REASON_DEAUTH 2
269 #define BRCMF_E_REASON_DISASSOC 3
270 #define BRCMF_E_REASON_BCNS_LOST 4
271 #define BRCMF_E_REASON_MINTXRATE 9
272 #define BRCMF_E_REASON_TXFAIL 10
274 #define BRCMF_E_REASON_FAST_ROAM_FAILED 5
275 #define BRCMF_E_REASON_DIRECTED_ROAM 6
276 #define BRCMF_E_REASON_TSPEC_REJECTED 7
277 #define BRCMF_E_REASON_BETTER_AP 8
279 #define BRCMF_E_PRUNE_ENCR_MISMATCH 1
280 #define BRCMF_E_PRUNE_BCAST_BSSID 2
281 #define BRCMF_E_PRUNE_MAC_DENY 3
282 #define BRCMF_E_PRUNE_MAC_NA 4
283 #define BRCMF_E_PRUNE_REG_PASSV 5
284 #define BRCMF_E_PRUNE_SPCT_MGMT 6
285 #define BRCMF_E_PRUNE_RADAR 7
286 #define BRCMF_E_RSN_MISMATCH 8
287 #define BRCMF_E_PRUNE_NO_COMMON_RATES 9
288 #define BRCMF_E_PRUNE_BASIC_RATES 10
289 #define BRCMF_E_PRUNE_CIPHER_NA 12
290 #define BRCMF_E_PRUNE_KNOWN_STA 13
291 #define BRCMF_E_PRUNE_WDS_PEER 15
292 #define BRCMF_E_PRUNE_QBSS_LOAD 16
293 #define BRCMF_E_PRUNE_HOME_AP 17
295 #define BRCMF_E_SUP_OTHER 0
296 #define BRCMF_E_SUP_DECRYPT_KEY_DATA 1
297 #define BRCMF_E_SUP_BAD_UCAST_WEP128 2
298 #define BRCMF_E_SUP_BAD_UCAST_WEP40 3
299 #define BRCMF_E_SUP_UNSUP_KEY_LEN 4
300 #define BRCMF_E_SUP_PW_KEY_CIPHER 5
301 #define BRCMF_E_SUP_MSG3_TOO_MANY_IE 6
302 #define BRCMF_E_SUP_MSG3_IE_MISMATCH 7
303 #define BRCMF_E_SUP_NO_INSTALL_FLAG 8
304 #define BRCMF_E_SUP_MSG3_NO_GTK 9
305 #define BRCMF_E_SUP_GRP_KEY_CIPHER 10
306 #define BRCMF_E_SUP_GRP_MSG1_NO_GTK 11
307 #define BRCMF_E_SUP_GTK_DECRYPT_FAIL 12
308 #define BRCMF_E_SUP_SEND_FAIL 13
309 #define BRCMF_E_SUP_DEAUTH 14
311 #define BRCMF_E_IF_ADD 1
312 #define BRCMF_E_IF_DEL 2
313 #define BRCMF_E_IF_CHANGE 3
315 #define BRCMF_E_IF_ROLE_STA 0
316 #define BRCMF_E_IF_ROLE_AP 1
317 #define BRCMF_E_IF_ROLE_WDS 2
319 #define BRCMF_E_LINK_BCN_LOSS 1
320 #define BRCMF_E_LINK_DISASSOC 2
321 #define BRCMF_E_LINK_ASSOC_REC 3
322 #define BRCMF_E_LINK_BSSCFG_DIS 4
324 /* The level of bus communication with the dongle */
325 enum brcmf_bus_state
{
326 BRCMF_BUS_DOWN
, /* Not ready for frame transfers */
327 BRCMF_BUS_LOAD
, /* Download access only (CPU reset) */
328 BRCMF_BUS_DATA
/* Ready for frame transfers */
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.
335 struct brcmf_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.
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.
345 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
346 struct brcmf_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 struct brcmf_pkt_filter_pattern pattern
; /* Filter pattern */
355 /* IOVAR "pkt_filter_enable" parameter. */
356 struct brcmf_pkt_filter_enable
{
357 u32 id
; /* Unique filter id */
358 u32 enable
; /* Enable/disable bool */
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 struct brcmf_scan_results)
365 struct brcmf_bss_info
{
366 u32 version
; /* version field */
367 u32 length
; /* byte length of data in this record,
368 * starting at version and including IEs
371 u16 beacon_period
; /* units are Kusec */
372 u16 capability
; /* Capability information */
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) */
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 */
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 */
402 unsigned char SSID
[32];
405 struct brcmf_scan_params
{
406 struct brcmf_ssid ssid
; /* default: {0, ""} */
407 u8 bssid
[ETH_ALEN
]; /* default: bcast */
408 s8 bss_type
; /* default: any,
409 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
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
416 s32 passive_time
; /* -1 use default, dwell time per channel
417 * for passive scanning
419 s32 home_time
; /* -1 use default, dwell time for the home channel
420 * between channel scans
422 s32 channel_num
; /* count of channels and ssids that follow
424 * low half is count of channels in
425 * channel_list, 0 means default (use all
426 * available channels)
428 * high half is entries in struct brcmf_ssid
429 * array that follows channel_list, aligned for
430 * s32 (4 bytes) meaning an odd channel count
431 * implies a 2-byte pad between end of
432 * channel_list and first ssid
434 * if ssid count is zero, single ssid in the
435 * fixed parameter portion is assumed, otherwise
436 * ssid in the fixed portion is ignored
438 u16 channel_list
[1]; /* list of chanspecs */
441 /* incremental scan struct */
442 struct brcmf_iscan_params
{
446 struct brcmf_scan_params params
;
449 /* 3 fields + size of brcmf_scan_params, not including variable length array */
450 #define BRCMF_ISCAN_PARAMS_FIXED_SIZE \
451 (offsetof(struct brcmf_iscan_params, params) + \
452 sizeof(struct brcmf_ssid))
454 struct brcmf_scan_results
{
458 struct brcmf_bss_info bss_info
[1];
461 /* used for association with a specific BSSID and chanspec list */
462 struct brcmf_assoc_params
{
463 u8 bssid
[ETH_ALEN
]; /* 00:00:00:00:00:00: broadcast scan */
464 s32 chanspec_num
; /* 0: all available channels,
465 * otherwise count of chanspecs in chanspec_list
467 chanspec_t chanspec_list
[1]; /* list of chanspecs */
469 #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
470 (sizeof(struct brcmf_assoc_params) - sizeof(chanspec_t))
472 /* used for join with or without a specific bssid and channel list */
473 struct brcmf_join_params
{
474 struct brcmf_ssid ssid
;
475 struct brcmf_assoc_params params
;
478 /* size of brcmf_scan_results not including variable length array */
479 #define BRCMF_SCAN_RESULTS_FIXED_SIZE \
480 (sizeof(struct brcmf_scan_results) - sizeof(struct brcmf_bss_info))
482 /* incremental scan results struct */
483 struct brcmf_iscan_results
{
485 struct brcmf_scan_results results
;
488 /* size of brcmf_iscan_results not including variable length array */
489 #define BRCMF_ISCAN_RESULTS_FIXED_SIZE \
490 (BRCMF_SCAN_RESULTS_FIXED_SIZE + \
491 offsetof(struct brcmf_iscan_results, results))
493 struct brcmf_wsec_key
{
494 u32 index
; /* key index */
495 u32 len
; /* key length */
496 u8 data
[WLAN_MAX_KEY_LEN
]; /* key data */
498 u32 algo
; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
499 u32 flags
; /* misc flags */
502 int iv_initialized
; /* has IV been initialized already? */
506 u32 hi
; /* upper 32 bits of IV */
507 u16 lo
; /* lower 16 bits of IV */
510 u8 ea
[ETH_ALEN
]; /* per station */
513 /* Used to get specific STA parameters */
514 struct brcmf_scb_val
{
519 /* channel encoding */
520 struct brcmf_channel_info
{
526 /* Linux network driver ioctl encoding */
528 uint cmd
; /* common ioctl definition */
529 void *buf
; /* pointer to user buffer */
530 uint len
; /* length of user buffer */
531 u8 set
; /* get or set request (optional) */
532 uint used
; /* bytes read or written (optional) */
533 uint needed
; /* bytes needed (optional) */
536 /* Forward decls for struct brcmf_pub (see below) */
537 struct brcmf_bus
; /* device bus info */
538 struct brcmf_proto
; /* device communication protocol info */
539 struct brcmf_info
; /* device driver info */
541 /* Common structure for module and instance linkage */
543 /* Linkage ponters */
544 struct brcmf_bus
*bus
;
545 struct brcmf_proto
*prot
;
546 struct brcmf_info
*info
;
548 /* Internal brcmf items */
549 bool up
; /* Driver up/down (to OS) */
550 bool txoff
; /* Transmit flow-controlled */
551 bool dongle_reset
; /* true = DEVRESET put dongle into reset */
552 enum brcmf_bus_state busstate
;
553 uint hdrlen
; /* Total BRCMF header length (proto + bus) */
554 uint maxctl
; /* Max size rxctl request from proto to bus */
555 uint rxsz
; /* Rx buffer size bus module should use */
556 u8 wme_dp
; /* wme discard priority */
558 /* Dongle media info */
559 bool iswl
; /* Dongle-resident driver is wl */
560 unsigned long drv_version
; /* Version of dongle-resident driver */
561 u8 mac
[ETH_ALEN
]; /* MAC address obtained from dongle */
562 struct dngl_stats dstats
; /* Stats for dongle-based data */
564 /* Additional stats for the bus level */
565 unsigned long tx_packets
; /* Data packets sent to dongle */
566 unsigned long tx_multicast
; /* Multicast data packets sent to dongle */
567 unsigned long tx_errors
; /* Errors in sending data to dongle */
568 unsigned long tx_ctlpkts
; /* Control packets sent to dongle */
569 unsigned long tx_ctlerrs
; /* Errors sending control frames to dongle */
570 unsigned long rx_packets
; /* Packets sent up the network interface */
571 unsigned long rx_multicast
; /* Multicast packets sent up the network
573 unsigned long rx_errors
; /* Errors processing rx data packets */
574 unsigned long rx_ctlpkts
; /* Control frames processed from dongle */
575 unsigned long rx_ctlerrs
; /* Errors in processing rx control frames */
576 unsigned long rx_dropped
; /* Packets dropped locally (no memory) */
577 unsigned long rx_flushed
; /* Packets flushed due to
578 unscheduled sendup thread */
579 unsigned long wd_dpc_sched
; /* Number of times dpc scheduled by
582 unsigned long rx_readahead_cnt
; /* Number of packets where header read-ahead
584 unsigned long tx_realloc
; /* Number of tx packets we had to realloc for
586 unsigned long fc_packets
; /* Number of flow control pkts recvd */
588 /* Last error return */
592 /* Last error from dongle */
595 /* Suspend disable flag flag */
596 int suspend_disable_flag
; /* "1" to disable all extra powersaving
598 int in_suspend
; /* flag set to 1 when early suspend called */
599 int dtim_skip
; /* dtim skip , default 0 means wake each dtim */
601 /* Pkt filter defination */
602 char *pktfilter
[100];
605 u8 country_code
[BRCM_CNTRY_BUF_SZ
];
606 char eventmask
[BRCMF_EVENTING_MASK_LEN
];
610 struct brcmf_if_event
{
617 struct brcmf_timeout
{
618 u32 limit
; /* Expiration time (usec) */
619 u32 increment
; /* Current expiration increment (usec) */
620 u32 elapsed
; /* Current elapsed time (usec) */
621 u32 tick
; /* O/S tick time (usec) */
624 struct bcmevent_name
{
629 #if defined(CONFIG_PM_SLEEP)
630 extern atomic_t brcmf_mmc_suspend
;
631 #define BRCMF_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
632 #define _BRCMF_PM_RESUME_WAIT(a, b) do { \
634 while (atomic_read(&brcmf_mmc_suspend) && retry++ != b) { \
635 wait_event_timeout(a, false, HZ/100); \
638 #define BRCMF_PM_RESUME_WAIT(a) _BRCMF_PM_RESUME_WAIT(a, 30)
639 #define BRCMF_PM_RESUME_RETURN_ERROR(a) \
640 do { if (atomic_read(&brcmf_mmc_suspend)) return a; } while (0)
642 #define BRCMF_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
643 #define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \
644 uint countdown = (us) + 9999; \
645 while ((exp) && (countdown >= 10000)) { \
646 wait_event_timeout(a, false, HZ/100); \
647 countdown -= 10000; \
653 #define BRCMF_PM_RESUME_WAIT_INIT(a)
654 #define BRCMF_PM_RESUME_WAIT(a)
655 #define BRCMF_PM_RESUME_RETURN_ERROR(a)
657 #define BRCMF_SPINWAIT_SLEEP_INIT(a)
658 #define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \
659 uint countdown = (us) + 9; \
660 while ((exp) && (countdown >= 10)) { \
666 #endif /* defined(CONFIG_PM_SLEEP) */
669 * Insmod parameters for debug/test
673 extern uint brcmf_intr
;
676 extern uint brcmf_poll
;
678 /* ARP offload agent mode */
679 extern uint brcmf_arp_mode
;
681 /* ARP offload enable */
682 extern uint brcmf_arp_enable
;
684 /* Pkt filte enable control */
685 extern uint brcmf_pkt_filter_enable
;
687 /* Pkt filter init setup */
688 extern uint brcmf_pkt_filter_init
;
690 /* Pkt filter mode control */
691 extern uint brcmf_master_mode
;
693 /* Roaming mode control */
694 extern uint brcmf_roam
;
696 /* Roaming mode control */
697 extern uint brcmf_radio_up
;
699 /* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */
700 extern int brcmf_idletime
;
701 #define BRCMF_IDLETIME_TICKS 1
703 /* SDIO Drive Strength */
704 extern uint brcmf_sdiod_drive_strength
;
706 /* Override to force tx queueing all the time */
707 extern uint brcmf_force_tx_queueing
;
710 /* Echo packet generator (SDIO), pkts/s */
711 extern uint brcmf_pktgen
;
713 /* Echo packet len (0 => sawtooth, max 1800) */
714 extern uint brcmf_pktgen_len
;
715 #define BRCMF_MAX_PKTGEN_LEN 1800
718 extern const struct bcmevent_name bcmevent_names
[];
719 extern const int bcmevent_names_size
;
722 static inline void MUTEX_LOCK_INIT(struct brcmf_pub
*drvr
)
726 static inline void MUTEX_LOCK(struct brcmf_pub
*drvr
)
730 static inline void MUTEX_UNLOCK(struct brcmf_pub
*drvr
)
734 static inline void MUTEX_LOCK_SOFTAP_SET_INIT(struct brcmf_pub
*drvr
)
738 static inline void MUTEX_LOCK_SOFTAP_SET(struct brcmf_pub
*drvr
)
742 static inline void MUTEX_UNLOCK_SOFTAP_SET(struct brcmf_pub
*drvr
)
746 static inline void MUTEX_LOCK_WL_SCAN_SET_INIT(void)
750 static inline void MUTEX_LOCK_WL_SCAN_SET(void)
754 static inline void MUTEX_UNLOCK_WL_SCAN_SET(void)
758 /* Indication from bus module regarding presence/insertion of dongle.
759 * Return struct brcmf_pub pointer, used as handle to OS module in later calls.
760 * Returned structure should have bus and prot pointers filled in.
761 * bus_hdrlen specifies required headroom for bus module header.
763 extern struct brcmf_pub
*brcmf_attach(struct brcmf_bus
*bus
,
765 extern int brcmf_net_attach(struct brcmf_pub
*drvr
, int idx
);
766 extern int brcmf_netdev_wait_pend8021x(struct net_device
*dev
);
768 /* Indication from bus module regarding removal/absence of dongle */
769 extern void brcmf_detach(struct brcmf_pub
*drvr
);
771 /* Indication from bus module to change flow-control state */
772 extern void brcmf_txflowcontrol(struct brcmf_pub
*drvr
, int ifidx
, bool on
);
774 extern bool brcmf_c_prec_enq(struct brcmf_pub
*drvr
, struct pktq
*q
,
775 struct sk_buff
*pkt
, int prec
);
777 /* Receive frame for delivery to OS. Callee disposes of rxp. */
778 extern void brcmf_rx_frame(struct brcmf_pub
*drvr
, int ifidx
,
779 struct sk_buff
*rxp
, int numpkt
);
781 /* Return pointer to interface name */
782 extern char *brcmf_ifname(struct brcmf_pub
*drvr
, int idx
);
784 /* Notify tx completion */
785 extern void brcmf_txcomplete(struct brcmf_pub
*drvr
, struct sk_buff
*txp
,
789 extern int brcmf_proto_cdc_query_ioctl(struct brcmf_pub
*drvr
, int ifidx
,
790 uint cmd
, void *buf
, uint len
);
792 /* OS independent layer functions */
793 extern int brcmf_os_proto_block(struct brcmf_pub
*drvr
);
794 extern int brcmf_os_proto_unblock(struct brcmf_pub
*drvr
);
795 extern int brcmf_os_ioctl_resp_wait(struct brcmf_pub
*drvr
, uint
*condition
,
797 extern int brcmf_os_ioctl_resp_wake(struct brcmf_pub
*drvr
);
798 extern unsigned int brcmf_os_get_ioctl_resp_timeout(void);
799 extern void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec
);
801 extern int brcmf_write_to_file(struct brcmf_pub
*drvr
, u8
*buf
, int size
);
804 extern void brcmf_timeout_start(struct brcmf_timeout
*tmo
, uint usec
);
805 extern int brcmf_timeout_expired(struct brcmf_timeout
*tmo
);
807 extern int brcmf_ifname2idx(struct brcmf_info
*drvr_priv
, char *name
);
808 extern int brcmf_c_host_event(struct brcmf_info
*drvr_priv
, int *idx
,
809 void *pktdata
, struct brcmf_event_msg
*,
812 extern void brcmf_c_init(void);
814 extern int brcmf_add_if(struct brcmf_info
*drvr_priv
, int ifidx
, void *handle
,
815 char *name
, u8
*mac_addr
, u32 flags
, u8 bssidx
);
816 extern void brcmf_del_if(struct brcmf_info
*drvr_priv
, int ifidx
);
818 /* Send packet to dongle via data channel */
819 extern int brcmf_sendpkt(struct brcmf_pub
*drvr
, int ifidx
,\
820 struct sk_buff
*pkt
);
822 extern int brcmf_bus_devreset(struct brcmf_pub
*drvr
, u8 flag
);
823 extern int brcmf_bus_start(struct brcmf_pub
*drvr
);
825 extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub
*drvr
, char *arg
);
826 extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub
*drvr
, char *arg
,
827 int enable
, int master_mode
);
829 /* Linux network driver ioctl encoding */
830 struct brcmf_c_ioctl
{
831 uint cmd
; /* common ioctl definition */
832 void *buf
; /* pointer to user buffer */
833 uint len
; /* length of user buffer */
834 bool set
; /* get or set request (optional) */
835 uint used
; /* bytes read or written (optional) */
836 uint needed
; /* bytes needed (optional) */
837 uint driver
; /* to identify target driver */
840 /* per-driver magic numbers */
841 #define BRCMF_IOCTL_MAGIC 0x00444944
843 /* bump this number if you change the ioctl interface */
844 #define BRCMF_IOCTL_VERSION 1
845 #define BRCMF_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */
847 /* common ioctl definitions */
848 #define BRCMF_GET_MAGIC 0
849 #define BRCMF_GET_VERSION 1
850 #define BRCMF_GET_VAR 2
851 #define BRCMF_SET_VAR 3
854 #define BRCMF_ERROR_VAL 0x0001
855 #define BRCMF_TRACE_VAL 0x0002
856 #define BRCMF_INFO_VAL 0x0004
857 #define BRCMF_DATA_VAL 0x0008
858 #define BRCMF_CTL_VAL 0x0010
859 #define BRCMF_TIMER_VAL 0x0020
860 #define BRCMF_HDRS_VAL 0x0040
861 #define BRCMF_BYTES_VAL 0x0080
862 #define BRCMF_INTR_VAL 0x0100
863 #define BRCMF_GLOM_VAL 0x0400
864 #define BRCMF_EVENT_VAL 0x0800
865 #define BRCMF_BTA_VAL 0x1000
866 #define BRCMF_ISCAN_VAL 0x2000
869 /* For pktgen iovar */
870 struct brcmf_pktgen
{
871 uint version
; /* To allow structure change tracking */
872 uint freq
; /* Max ticks between tx/rx attempts */
873 uint count
; /* Test packets to send/rcv each attempt */
874 uint print
; /* Print counts every <print> attempts */
875 uint total
; /* Total packets (or bursts) */
876 uint minlen
; /* Minimum length of packets to send */
877 uint maxlen
; /* Maximum length of packets to send */
878 uint numsent
; /* Count of test packets sent */
879 uint numrcvd
; /* Count of test packets received */
880 uint numfail
; /* Count of test send failures */
881 uint mode
; /* Test mode (type of test packets) */
882 uint stop
; /* Stop after this many tx failures */
885 /* Version in case structure changes */
886 #define BRCMF_PKTGEN_VERSION 2
888 /* Type of test packets to use */
889 #define BRCMF_PKTGEN_ECHO 1 /* Send echo requests */
890 #define BRCMF_PKTGEN_SEND 2 /* Send discard packets */
891 #define BRCMF_PKTGEN_RXBURST 3 /* Request dongle send N packets */
892 #define BRCMF_PKTGEN_RECV 4 /* Continuous rx from continuous
896 /* Enter idle immediately (no timeout) */
897 #define BRCMF_IDLE_IMMEDIATE (-1)
899 /* Values for idleclock iovar: other values are the sd_divisor to use
901 #define BRCMF_IDLE_ACTIVE 0 /* Do not request any SD clock change
904 #endif /* _BRCMF_H_ */