]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
Merge branches 'for-3.18/upstream-fixes' and 'for-3.19/upstream' into for-linus
[karo-tx-linux.git] / drivers / net / wireless / brcm80211 / brcmfmac / fwil_types.h
1 /*
2  * Copyright (c) 2012 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 #ifndef FWIL_TYPES_H_
19 #define FWIL_TYPES_H_
20
21 #include <linux/if_ether.h>
22
23
24 #define BRCMF_FIL_ACTION_FRAME_SIZE     1800
25
26 /* ARP Offload feature flags for arp_ol iovar */
27 #define BRCMF_ARP_OL_AGENT              0x00000001
28 #define BRCMF_ARP_OL_SNOOP              0x00000002
29 #define BRCMF_ARP_OL_HOST_AUTO_REPLY    0x00000004
30 #define BRCMF_ARP_OL_PEER_AUTO_REPLY    0x00000008
31
32 #define BRCMF_BSS_INFO_VERSION  109 /* curr ver of brcmf_bss_info_le struct */
33 #define BRCMF_BSS_RSSI_ON_CHANNEL       0x0002
34
35 #define BRCMF_STA_ASSOC                 0x10            /* Associated */
36
37 /* size of brcmf_scan_params not including variable length array */
38 #define BRCMF_SCAN_PARAMS_FIXED_SIZE    64
39
40 /* masks for channel and ssid count */
41 #define BRCMF_SCAN_PARAMS_COUNT_MASK    0x0000ffff
42 #define BRCMF_SCAN_PARAMS_NSSID_SHIFT   16
43
44 /* primary (ie tx) key */
45 #define BRCMF_PRIMARY_KEY               (1 << 1)
46 #define DOT11_BSSTYPE_ANY               2
47 #define BRCMF_ESCAN_REQ_VERSION         1
48
49 #define BRCMF_MAXRATES_IN_SET           16      /* max # of rates in rateset */
50
51 /* OBSS Coex Auto/On/Off */
52 #define BRCMF_OBSS_COEX_AUTO            (-1)
53 #define BRCMF_OBSS_COEX_OFF             0
54 #define BRCMF_OBSS_COEX_ON              1
55
56 /* WOWL bits */
57 /* Wakeup on Magic packet: */
58 #define WL_WOWL_MAGIC                   (1 << 0)
59 /* Wakeup on Netpattern */
60 #define WL_WOWL_NET                     (1 << 1)
61 /* Wakeup on loss-of-link due to Disassoc/Deauth: */
62 #define WL_WOWL_DIS                     (1 << 2)
63 /* Wakeup on retrograde TSF: */
64 #define WL_WOWL_RETR                    (1 << 3)
65 /* Wakeup on loss of beacon: */
66 #define WL_WOWL_BCN                     (1 << 4)
67 /* Wakeup after test: */
68 #define WL_WOWL_TST                     (1 << 5)
69 /* Wakeup after PTK refresh: */
70 #define WL_WOWL_M1                      (1 << 6)
71 /* Wakeup after receipt of EAP-Identity Req: */
72 #define WL_WOWL_EAPID                   (1 << 7)
73 /* Wakeind via PME(0) or GPIO(1): */
74 #define WL_WOWL_PME_GPIO                (1 << 8)
75 /* need tkip phase 1 key to be updated by the driver: */
76 #define WL_WOWL_NEEDTKIP1               (1 << 9)
77 /* enable wakeup if GTK fails: */
78 #define WL_WOWL_GTK_FAILURE             (1 << 10)
79 /* support extended magic packets: */
80 #define WL_WOWL_EXTMAGPAT               (1 << 11)
81 /* support ARP/NS/keepalive offloading: */
82 #define WL_WOWL_ARPOFFLOAD              (1 << 12)
83 /* read protocol version for EAPOL frames: */
84 #define WL_WOWL_WPA2                    (1 << 13)
85 /* If the bit is set, use key rotaton: */
86 #define WL_WOWL_KEYROT                  (1 << 14)
87 /* If the bit is set, frm received was bcast frame: */
88 #define WL_WOWL_BCAST                   (1 << 15)
89 /* If the bit is set, scan offload is enabled: */
90 #define WL_WOWL_SCANOL                  (1 << 16)
91 /* Wakeup on tcpkeep alive timeout: */
92 #define WL_WOWL_TCPKEEP_TIME            (1 << 17)
93 /* Wakeup on mDNS Conflict Resolution: */
94 #define WL_WOWL_MDNS_CONFLICT           (1 << 18)
95 /* Wakeup on mDNS Service Connect: */
96 #define WL_WOWL_MDNS_SERVICE            (1 << 19)
97 /* tcp keepalive got data: */
98 #define WL_WOWL_TCPKEEP_DATA            (1 << 20)
99 /* Firmware died in wowl mode: */
100 #define WL_WOWL_FW_HALT                 (1 << 21)
101 /* Enable detection of radio button changes: */
102 #define WL_WOWL_ENAB_HWRADIO            (1 << 22)
103 /* Offloads detected MIC failure(s): */
104 #define WL_WOWL_MIC_FAIL                (1 << 23)
105 /* Wakeup in Unassociated state (Net/Magic Pattern): */
106 #define WL_WOWL_UNASSOC                 (1 << 24)
107 /* Wakeup if received matched secured pattern: */
108 #define WL_WOWL_SECURE                  (1 << 25)
109 /* Link Down indication in WoWL mode: */
110 #define WL_WOWL_LINKDOWN                (1 << 31)
111
112 /* join preference types for join_pref iovar */
113 enum brcmf_join_pref_types {
114         BRCMF_JOIN_PREF_RSSI = 1,
115         BRCMF_JOIN_PREF_WPA,
116         BRCMF_JOIN_PREF_BAND,
117         BRCMF_JOIN_PREF_RSSI_DELTA,
118 };
119
120 enum brcmf_fil_p2p_if_types {
121         BRCMF_FIL_P2P_IF_CLIENT,
122         BRCMF_FIL_P2P_IF_GO,
123         BRCMF_FIL_P2P_IF_DYNBCN_GO,
124         BRCMF_FIL_P2P_IF_DEV,
125 };
126
127 struct brcmf_fil_p2p_if_le {
128         u8 addr[ETH_ALEN];
129         __le16 type;
130         __le16 chspec;
131 };
132
133 struct brcmf_fil_chan_info_le {
134         __le32 hw_channel;
135         __le32 target_channel;
136         __le32 scan_channel;
137 };
138
139 struct brcmf_fil_action_frame_le {
140         u8      da[ETH_ALEN];
141         __le16  len;
142         __le32  packet_id;
143         u8      data[BRCMF_FIL_ACTION_FRAME_SIZE];
144 };
145
146 struct brcmf_fil_af_params_le {
147         __le32                                  channel;
148         __le32                                  dwell_time;
149         u8                                      bssid[ETH_ALEN];
150         u8                                      pad[2];
151         struct brcmf_fil_action_frame_le        action_frame;
152 };
153
154 struct brcmf_fil_bss_enable_le {
155         __le32 bsscfg_idx;
156         __le32 enable;
157 };
158
159 struct brcmf_fil_bwcap_le {
160         __le32 band;
161         __le32 bw_cap;
162 };
163
164 /**
165  * struct tdls_iovar - common structure for tdls iovars.
166  *
167  * @ea: ether address of peer station.
168  * @mode: mode value depending on specific tdls iovar.
169  * @chanspec: channel specification.
170  * @pad: unused (for future use).
171  */
172 struct brcmf_tdls_iovar_le {
173         u8 ea[ETH_ALEN];                /* Station address */
174         u8 mode;                        /* mode: depends on iovar */
175         __le16 chanspec;
176         __le32 pad;                     /* future */
177 };
178
179 enum brcmf_tdls_manual_ep_ops {
180         BRCMF_TDLS_MANUAL_EP_CREATE = 1,
181         BRCMF_TDLS_MANUAL_EP_DELETE = 3,
182         BRCMF_TDLS_MANUAL_EP_DISCOVERY = 6
183 };
184
185 /* Pattern matching filter. Specifies an offset within received packets to
186  * start matching, the pattern to match, the size of the pattern, and a bitmask
187  * that indicates which bits within the pattern should be matched.
188  */
189 struct brcmf_pkt_filter_pattern_le {
190         /*
191          * Offset within received packet to start pattern matching.
192          * Offset '0' is the first byte of the ethernet header.
193          */
194         __le32 offset;
195         /* Size of the pattern.  Bitmask must be the same size.*/
196         __le32 size_bytes;
197         /*
198          * Variable length mask and pattern data. mask starts at offset 0.
199          * Pattern immediately follows mask.
200          */
201         u8 mask_and_pattern[1];
202 };
203
204 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
205 struct brcmf_pkt_filter_le {
206         __le32 id;              /* Unique filter id, specified by app. */
207         __le32 type;            /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
208         __le32 negate_match;    /* Negate the result of filter matches */
209         union {                 /* Filter definitions */
210                 struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */
211         } u;
212 };
213
214 /* IOVAR "pkt_filter_enable" parameter. */
215 struct brcmf_pkt_filter_enable_le {
216         __le32 id;              /* Unique filter id */
217         __le32 enable;          /* Enable/disable bool */
218 };
219
220 /* BSS info structure
221  * Applications MUST CHECK ie_offset field and length field to access IEs and
222  * next bss_info structure in a vector (in struct brcmf_scan_results)
223  */
224 struct brcmf_bss_info_le {
225         __le32 version;         /* version field */
226         __le32 length;          /* byte length of data in this record,
227                                  * starting at version and including IEs
228                                  */
229         u8 BSSID[ETH_ALEN];
230         __le16 beacon_period;   /* units are Kusec */
231         __le16 capability;      /* Capability information */
232         u8 SSID_len;
233         u8 SSID[32];
234         struct {
235                 __le32 count;   /* # rates in this set */
236                 u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
237         } rateset;              /* supported rates */
238         __le16 chanspec;        /* chanspec for bss */
239         __le16 atim_window;     /* units are Kusec */
240         u8 dtim_period; /* DTIM period */
241         __le16 RSSI;            /* receive signal strength (in dBm) */
242         s8 phy_noise;           /* noise (in dBm) */
243
244         u8 n_cap;               /* BSS is 802.11N Capable */
245         /* 802.11N BSS Capabilities (based on HT_CAP_*): */
246         __le32 nbss_cap;
247         u8 ctl_ch;              /* 802.11N BSS control channel number */
248         __le32 reserved32[1];   /* Reserved for expansion of BSS properties */
249         u8 flags;               /* flags */
250         u8 reserved[3]; /* Reserved for expansion of BSS properties */
251         u8 basic_mcs[MCSSET_LEN];       /* 802.11N BSS required MCS set */
252
253         __le16 ie_offset;       /* offset at which IEs start, from beginning */
254         __le32 ie_length;       /* byte length of Information Elements */
255         __le16 SNR;             /* average SNR of during frame reception */
256         /* Add new fields here */
257         /* variable length Information Elements */
258 };
259
260 struct brcm_rateset_le {
261         /* # rates in this set */
262         __le32 count;
263         /* rates in 500kbps units w/hi bit set if basic */
264         u8 rates[BRCMF_MAXRATES_IN_SET];
265 };
266
267 struct brcmf_ssid {
268         u32 SSID_len;
269         unsigned char SSID[32];
270 };
271
272 struct brcmf_ssid_le {
273         __le32 SSID_len;
274         unsigned char SSID[32];
275 };
276
277 struct brcmf_scan_params_le {
278         struct brcmf_ssid_le ssid_le;   /* default: {0, ""} */
279         u8 bssid[ETH_ALEN];     /* default: bcast */
280         s8 bss_type;            /* default: any,
281                                  * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
282                                  */
283         u8 scan_type;   /* flags, 0 use default */
284         __le32 nprobes;   /* -1 use default, number of probes per channel */
285         __le32 active_time;     /* -1 use default, dwell time per channel for
286                                  * active scanning
287                                  */
288         __le32 passive_time;    /* -1 use default, dwell time per channel
289                                  * for passive scanning
290                                  */
291         __le32 home_time;       /* -1 use default, dwell time for the
292                                  * home channel between channel scans
293                                  */
294         __le32 channel_num;     /* count of channels and ssids that follow
295                                  *
296                                  * low half is count of channels in
297                                  * channel_list, 0 means default (use all
298                                  * available channels)
299                                  *
300                                  * high half is entries in struct brcmf_ssid
301                                  * array that follows channel_list, aligned for
302                                  * s32 (4 bytes) meaning an odd channel count
303                                  * implies a 2-byte pad between end of
304                                  * channel_list and first ssid
305                                  *
306                                  * if ssid count is zero, single ssid in the
307                                  * fixed parameter portion is assumed, otherwise
308                                  * ssid in the fixed portion is ignored
309                                  */
310         __le16 channel_list[1]; /* list of chanspecs */
311 };
312
313 struct brcmf_scan_results {
314         u32 buflen;
315         u32 version;
316         u32 count;
317         struct brcmf_bss_info_le bss_info_le[];
318 };
319
320 struct brcmf_escan_params_le {
321         __le32 version;
322         __le16 action;
323         __le16 sync_id;
324         struct brcmf_scan_params_le params_le;
325 };
326
327 struct brcmf_escan_result_le {
328         __le32 buflen;
329         __le32 version;
330         __le16 sync_id;
331         __le16 bss_count;
332         struct brcmf_bss_info_le bss_info_le;
333 };
334
335 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(struct brcmf_escan_result_le) - \
336         sizeof(struct brcmf_bss_info_le))
337
338 /* used for association with a specific BSSID and chanspec list */
339 struct brcmf_assoc_params_le {
340         /* 00:00:00:00:00:00: broadcast scan */
341         u8 bssid[ETH_ALEN];
342         /* 0: all available channels, otherwise count of chanspecs in
343          * chanspec_list */
344         __le32 chanspec_num;
345         /* list of chanspecs */
346         __le16 chanspec_list[1];
347 };
348
349 /**
350  * struct join_pref params - parameters for preferred join selection.
351  *
352  * @type: preference type (see enum brcmf_join_pref_types).
353  * @len: length of bytes following (currently always 2).
354  * @rssi_gain: signal gain for selection (only when @type is RSSI_DELTA).
355  * @band: band to which selection preference applies.
356  *      This is used if @type is BAND or RSSI_DELTA.
357  */
358 struct brcmf_join_pref_params {
359         u8 type;
360         u8 len;
361         u8 rssi_gain;
362         u8 band;
363 };
364
365 /* used for join with or without a specific bssid and channel list */
366 struct brcmf_join_params {
367         struct brcmf_ssid_le ssid_le;
368         struct brcmf_assoc_params_le params_le;
369 };
370
371 /* scan params for extended join */
372 struct brcmf_join_scan_params_le {
373         u8 scan_type;           /* 0 use default, active or passive scan */
374         __le32 nprobes;         /* -1 use default, nr of probes per channel */
375         __le32 active_time;     /* -1 use default, dwell time per channel for
376                                  * active scanning
377                                  */
378         __le32 passive_time;    /* -1 use default, dwell time per channel
379                                  * for passive scanning
380                                  */
381         __le32 home_time;       /* -1 use default, dwell time for the home
382                                  * channel between channel scans
383                                  */
384 };
385
386 /* extended join params */
387 struct brcmf_ext_join_params_le {
388         struct brcmf_ssid_le ssid_le;   /* {0, ""}: wildcard scan */
389         struct brcmf_join_scan_params_le scan_le;
390         struct brcmf_assoc_params_le assoc_le;
391 };
392
393 struct brcmf_wsec_key {
394         u32 index;              /* key index */
395         u32 len;                /* key length */
396         u8 data[WLAN_MAX_KEY_LEN];      /* key data */
397         u32 pad_1[18];
398         u32 algo;       /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
399         u32 flags;      /* misc flags */
400         u32 pad_2[3];
401         u32 iv_initialized;     /* has IV been initialized already? */
402         u32 pad_3;
403         /* Rx IV */
404         struct {
405                 u32 hi; /* upper 32 bits of IV */
406                 u16 lo; /* lower 16 bits of IV */
407         } rxiv;
408         u32 pad_4[2];
409         u8 ea[ETH_ALEN];        /* per station */
410 };
411
412 /*
413  * dongle requires same struct as above but with fields in little endian order
414  */
415 struct brcmf_wsec_key_le {
416         __le32 index;           /* key index */
417         __le32 len;             /* key length */
418         u8 data[WLAN_MAX_KEY_LEN];      /* key data */
419         __le32 pad_1[18];
420         __le32 algo;    /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
421         __le32 flags;   /* misc flags */
422         __le32 pad_2[3];
423         __le32 iv_initialized;  /* has IV been initialized already? */
424         __le32 pad_3;
425         /* Rx IV */
426         struct {
427                 __le32 hi;      /* upper 32 bits of IV */
428                 __le16 lo;      /* lower 16 bits of IV */
429         } rxiv;
430         __le32 pad_4[2];
431         u8 ea[ETH_ALEN];        /* per station */
432 };
433
434 /* Used to get specific STA parameters */
435 struct brcmf_scb_val_le {
436         __le32 val;
437         u8 ea[ETH_ALEN];
438 };
439
440 /* channel encoding */
441 struct brcmf_channel_info_le {
442         __le32 hw_channel;
443         __le32 target_channel;
444         __le32 scan_channel;
445 };
446
447 struct brcmf_sta_info_le {
448         __le16  ver;            /* version of this struct */
449         __le16  len;            /* length in bytes of this structure */
450         __le16  cap;            /* sta's advertised capabilities */
451         __le32  flags;          /* flags defined below */
452         __le32  idle;           /* time since data pkt rx'd from sta */
453         u8      ea[ETH_ALEN];           /* Station address */
454         __le32  count;                  /* # rates in this set */
455         u8      rates[BRCMF_MAXRATES_IN_SET];   /* rates in 500kbps units */
456                                                 /* w/hi bit set if basic */
457         __le32  in;             /* seconds elapsed since associated */
458         __le32  listen_interval_inms; /* Min Listen interval in ms for STA */
459         __le32  tx_pkts;        /* # of packets transmitted */
460         __le32  tx_failures;    /* # of packets failed */
461         __le32  rx_ucast_pkts;  /* # of unicast packets received */
462         __le32  rx_mcast_pkts;  /* # of multicast packets received */
463         __le32  tx_rate;        /* Rate of last successful tx frame */
464         __le32  rx_rate;        /* Rate of last successful rx frame */
465         __le32  rx_decrypt_succeeds;    /* # of packet decrypted successfully */
466         __le32  rx_decrypt_failures;    /* # of packet decrypted failed */
467 };
468
469 struct brcmf_chanspec_list {
470         __le32  count;          /* # of entries */
471         __le32  element[1];     /* variable length uint32 list */
472 };
473
474 /*
475  * WLC_E_PROBRESP_MSG
476  * WLC_E_P2P_PROBREQ_MSG
477  * WLC_E_ACTION_FRAME_RX
478  */
479 struct brcmf_rx_mgmt_data {
480         __be16  version;
481         __be16  chanspec;
482         __be32  rssi;
483         __be32  mactime;
484         __be32  rate;
485 };
486
487 #endif /* FWIL_TYPES_H_ */