]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
Merge tag 'soc-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[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 enum brcmf_fil_p2p_if_types {
57         BRCMF_FIL_P2P_IF_CLIENT,
58         BRCMF_FIL_P2P_IF_GO,
59         BRCMF_FIL_P2P_IF_DYNBCN_GO,
60         BRCMF_FIL_P2P_IF_DEV,
61 };
62
63 struct brcmf_fil_p2p_if_le {
64         u8 addr[ETH_ALEN];
65         __le16 type;
66         __le16 chspec;
67 };
68
69 struct brcmf_fil_chan_info_le {
70         __le32 hw_channel;
71         __le32 target_channel;
72         __le32 scan_channel;
73 };
74
75 struct brcmf_fil_action_frame_le {
76         u8      da[ETH_ALEN];
77         __le16  len;
78         __le32  packet_id;
79         u8      data[BRCMF_FIL_ACTION_FRAME_SIZE];
80 };
81
82 struct brcmf_fil_af_params_le {
83         __le32                                  channel;
84         __le32                                  dwell_time;
85         u8                                      bssid[ETH_ALEN];
86         u8                                      pad[2];
87         struct brcmf_fil_action_frame_le        action_frame;
88 };
89
90 struct brcmf_fil_bss_enable_le {
91         __le32 bsscfg_idx;
92         __le32 enable;
93 };
94
95 struct brcmf_fil_bwcap_le {
96         __le32 band;
97         __le32 bw_cap;
98 };
99
100 /**
101  * struct tdls_iovar - common structure for tdls iovars.
102  *
103  * @ea: ether address of peer station.
104  * @mode: mode value depending on specific tdls iovar.
105  * @chanspec: channel specification.
106  * @pad: unused (for future use).
107  */
108 struct brcmf_tdls_iovar_le {
109         u8 ea[ETH_ALEN];                /* Station address */
110         u8 mode;                        /* mode: depends on iovar */
111         __le16 chanspec;
112         __le32 pad;                     /* future */
113 };
114
115 enum brcmf_tdls_manual_ep_ops {
116         BRCMF_TDLS_MANUAL_EP_CREATE = 1,
117         BRCMF_TDLS_MANUAL_EP_DELETE = 3,
118         BRCMF_TDLS_MANUAL_EP_DISCOVERY = 6
119 };
120
121 /* Pattern matching filter. Specifies an offset within received packets to
122  * start matching, the pattern to match, the size of the pattern, and a bitmask
123  * that indicates which bits within the pattern should be matched.
124  */
125 struct brcmf_pkt_filter_pattern_le {
126         /*
127          * Offset within received packet to start pattern matching.
128          * Offset '0' is the first byte of the ethernet header.
129          */
130         __le32 offset;
131         /* Size of the pattern.  Bitmask must be the same size.*/
132         __le32 size_bytes;
133         /*
134          * Variable length mask and pattern data. mask starts at offset 0.
135          * Pattern immediately follows mask.
136          */
137         u8 mask_and_pattern[1];
138 };
139
140 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
141 struct brcmf_pkt_filter_le {
142         __le32 id;              /* Unique filter id, specified by app. */
143         __le32 type;            /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
144         __le32 negate_match;    /* Negate the result of filter matches */
145         union {                 /* Filter definitions */
146                 struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */
147         } u;
148 };
149
150 /* IOVAR "pkt_filter_enable" parameter. */
151 struct brcmf_pkt_filter_enable_le {
152         __le32 id;              /* Unique filter id */
153         __le32 enable;          /* Enable/disable bool */
154 };
155
156 /* BSS info structure
157  * Applications MUST CHECK ie_offset field and length field to access IEs and
158  * next bss_info structure in a vector (in struct brcmf_scan_results)
159  */
160 struct brcmf_bss_info_le {
161         __le32 version;         /* version field */
162         __le32 length;          /* byte length of data in this record,
163                                  * starting at version and including IEs
164                                  */
165         u8 BSSID[ETH_ALEN];
166         __le16 beacon_period;   /* units are Kusec */
167         __le16 capability;      /* Capability information */
168         u8 SSID_len;
169         u8 SSID[32];
170         struct {
171                 __le32 count;   /* # rates in this set */
172                 u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
173         } rateset;              /* supported rates */
174         __le16 chanspec;        /* chanspec for bss */
175         __le16 atim_window;     /* units are Kusec */
176         u8 dtim_period; /* DTIM period */
177         __le16 RSSI;            /* receive signal strength (in dBm) */
178         s8 phy_noise;           /* noise (in dBm) */
179
180         u8 n_cap;               /* BSS is 802.11N Capable */
181         /* 802.11N BSS Capabilities (based on HT_CAP_*): */
182         __le32 nbss_cap;
183         u8 ctl_ch;              /* 802.11N BSS control channel number */
184         __le32 reserved32[1];   /* Reserved for expansion of BSS properties */
185         u8 flags;               /* flags */
186         u8 reserved[3]; /* Reserved for expansion of BSS properties */
187         u8 basic_mcs[MCSSET_LEN];       /* 802.11N BSS required MCS set */
188
189         __le16 ie_offset;       /* offset at which IEs start, from beginning */
190         __le32 ie_length;       /* byte length of Information Elements */
191         __le16 SNR;             /* average SNR of during frame reception */
192         /* Add new fields here */
193         /* variable length Information Elements */
194 };
195
196 struct brcm_rateset_le {
197         /* # rates in this set */
198         __le32 count;
199         /* rates in 500kbps units w/hi bit set if basic */
200         u8 rates[BRCMF_MAXRATES_IN_SET];
201 };
202
203 struct brcmf_ssid {
204         u32 SSID_len;
205         unsigned char SSID[32];
206 };
207
208 struct brcmf_ssid_le {
209         __le32 SSID_len;
210         unsigned char SSID[32];
211 };
212
213 struct brcmf_scan_params_le {
214         struct brcmf_ssid_le ssid_le;   /* default: {0, ""} */
215         u8 bssid[ETH_ALEN];     /* default: bcast */
216         s8 bss_type;            /* default: any,
217                                  * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
218                                  */
219         u8 scan_type;   /* flags, 0 use default */
220         __le32 nprobes;   /* -1 use default, number of probes per channel */
221         __le32 active_time;     /* -1 use default, dwell time per channel for
222                                  * active scanning
223                                  */
224         __le32 passive_time;    /* -1 use default, dwell time per channel
225                                  * for passive scanning
226                                  */
227         __le32 home_time;       /* -1 use default, dwell time for the
228                                  * home channel between channel scans
229                                  */
230         __le32 channel_num;     /* count of channels and ssids that follow
231                                  *
232                                  * low half is count of channels in
233                                  * channel_list, 0 means default (use all
234                                  * available channels)
235                                  *
236                                  * high half is entries in struct brcmf_ssid
237                                  * array that follows channel_list, aligned for
238                                  * s32 (4 bytes) meaning an odd channel count
239                                  * implies a 2-byte pad between end of
240                                  * channel_list and first ssid
241                                  *
242                                  * if ssid count is zero, single ssid in the
243                                  * fixed parameter portion is assumed, otherwise
244                                  * ssid in the fixed portion is ignored
245                                  */
246         __le16 channel_list[1]; /* list of chanspecs */
247 };
248
249 struct brcmf_scan_results {
250         u32 buflen;
251         u32 version;
252         u32 count;
253         struct brcmf_bss_info_le bss_info_le[];
254 };
255
256 struct brcmf_escan_params_le {
257         __le32 version;
258         __le16 action;
259         __le16 sync_id;
260         struct brcmf_scan_params_le params_le;
261 };
262
263 struct brcmf_escan_result_le {
264         __le32 buflen;
265         __le32 version;
266         __le16 sync_id;
267         __le16 bss_count;
268         struct brcmf_bss_info_le bss_info_le;
269 };
270
271 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(struct brcmf_escan_result_le) - \
272         sizeof(struct brcmf_bss_info_le))
273
274 /* used for association with a specific BSSID and chanspec list */
275 struct brcmf_assoc_params_le {
276         /* 00:00:00:00:00:00: broadcast scan */
277         u8 bssid[ETH_ALEN];
278         /* 0: all available channels, otherwise count of chanspecs in
279          * chanspec_list */
280         __le32 chanspec_num;
281         /* list of chanspecs */
282         __le16 chanspec_list[1];
283 };
284
285 /* used for join with or without a specific bssid and channel list */
286 struct brcmf_join_params {
287         struct brcmf_ssid_le ssid_le;
288         struct brcmf_assoc_params_le params_le;
289 };
290
291 /* scan params for extended join */
292 struct brcmf_join_scan_params_le {
293         u8 scan_type;           /* 0 use default, active or passive scan */
294         __le32 nprobes;         /* -1 use default, nr of probes per channel */
295         __le32 active_time;     /* -1 use default, dwell time per channel for
296                                  * active scanning
297                                  */
298         __le32 passive_time;    /* -1 use default, dwell time per channel
299                                  * for passive scanning
300                                  */
301         __le32 home_time;       /* -1 use default, dwell time for the home
302                                  * channel between channel scans
303                                  */
304 };
305
306 /* extended join params */
307 struct brcmf_ext_join_params_le {
308         struct brcmf_ssid_le ssid_le;   /* {0, ""}: wildcard scan */
309         struct brcmf_join_scan_params_le scan_le;
310         struct brcmf_assoc_params_le assoc_le;
311 };
312
313 struct brcmf_wsec_key {
314         u32 index;              /* key index */
315         u32 len;                /* key length */
316         u8 data[WLAN_MAX_KEY_LEN];      /* key data */
317         u32 pad_1[18];
318         u32 algo;       /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
319         u32 flags;      /* misc flags */
320         u32 pad_2[3];
321         u32 iv_initialized;     /* has IV been initialized already? */
322         u32 pad_3;
323         /* Rx IV */
324         struct {
325                 u32 hi; /* upper 32 bits of IV */
326                 u16 lo; /* lower 16 bits of IV */
327         } rxiv;
328         u32 pad_4[2];
329         u8 ea[ETH_ALEN];        /* per station */
330 };
331
332 /*
333  * dongle requires same struct as above but with fields in little endian order
334  */
335 struct brcmf_wsec_key_le {
336         __le32 index;           /* key index */
337         __le32 len;             /* key length */
338         u8 data[WLAN_MAX_KEY_LEN];      /* key data */
339         __le32 pad_1[18];
340         __le32 algo;    /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
341         __le32 flags;   /* misc flags */
342         __le32 pad_2[3];
343         __le32 iv_initialized;  /* has IV been initialized already? */
344         __le32 pad_3;
345         /* Rx IV */
346         struct {
347                 __le32 hi;      /* upper 32 bits of IV */
348                 __le16 lo;      /* lower 16 bits of IV */
349         } rxiv;
350         __le32 pad_4[2];
351         u8 ea[ETH_ALEN];        /* per station */
352 };
353
354 /* Used to get specific STA parameters */
355 struct brcmf_scb_val_le {
356         __le32 val;
357         u8 ea[ETH_ALEN];
358 };
359
360 /* channel encoding */
361 struct brcmf_channel_info_le {
362         __le32 hw_channel;
363         __le32 target_channel;
364         __le32 scan_channel;
365 };
366
367 struct brcmf_sta_info_le {
368         __le16  ver;            /* version of this struct */
369         __le16  len;            /* length in bytes of this structure */
370         __le16  cap;            /* sta's advertised capabilities */
371         __le32  flags;          /* flags defined below */
372         __le32  idle;           /* time since data pkt rx'd from sta */
373         u8      ea[ETH_ALEN];           /* Station address */
374         __le32  count;                  /* # rates in this set */
375         u8      rates[BRCMF_MAXRATES_IN_SET];   /* rates in 500kbps units */
376                                                 /* w/hi bit set if basic */
377         __le32  in;             /* seconds elapsed since associated */
378         __le32  listen_interval_inms; /* Min Listen interval in ms for STA */
379         __le32  tx_pkts;        /* # of packets transmitted */
380         __le32  tx_failures;    /* # of packets failed */
381         __le32  rx_ucast_pkts;  /* # of unicast packets received */
382         __le32  rx_mcast_pkts;  /* # of multicast packets received */
383         __le32  tx_rate;        /* Rate of last successful tx frame */
384         __le32  rx_rate;        /* Rate of last successful rx frame */
385         __le32  rx_decrypt_succeeds;    /* # of packet decrypted successfully */
386         __le32  rx_decrypt_failures;    /* # of packet decrypted failed */
387 };
388
389 struct brcmf_chanspec_list {
390         __le32  count;          /* # of entries */
391         __le32  element[1];     /* variable length uint32 list */
392 };
393
394 /*
395  * WLC_E_PROBRESP_MSG
396  * WLC_E_P2P_PROBREQ_MSG
397  * WLC_E_ACTION_FRAME_RX
398  */
399 struct brcmf_rx_mgmt_data {
400         __be16  version;
401         __be16  chanspec;
402         __be32  rssi;
403         __be32  mactime;
404         __be32  rate;
405 };
406
407 #endif /* FWIL_TYPES_H_ */