Resync with broadcom drivers 5.100.138.20 and utilities.
[tomato.git] / release / src-rt / include / wllmacctl.h
blob0a4c559760b8c83208e77bfd7e3f5e9380cc2eab
1 /*
2 * LMAC API definitions for
3 * Broadcom 802.11abg Networking Device Driver
5 * Definitions subject to change without notice.
7 * Copyright (C) 2010, Broadcom Corporation. All Rights Reserved.
8 *
9 * Permission to use, copy, modify, and/or distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
16 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
18 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
19 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * $Id: wllmacctl.h,v 13.31 2009-10-05 20:49:01 Exp $:
24 #ifndef _wllmacctl_h_
25 #define _wllmacctl_h_
27 #include <typedefs.h>
28 #include <proto/ethernet.h>
29 #include <proto/bcmeth.h>
30 #include <proto/bcmevent.h>
31 #include <proto/802.11.h>
33 /* cpp contortions to concatenate w/arg prescan */
34 #ifndef PAD
35 #define _PADLINE(line) pad ## line
36 #define _XSTR(line) _PADLINE(line)
37 #define PAD _XSTR(__LINE__)
38 #endif /* PAD */
40 /* Init/Configure response */
42 typedef struct {
43 uint8 vec[32]; /* bitvec of channels */
44 } lmacchanvec_t;
46 #define LMAC_MAXMCS 80
48 typedef struct {
49 uint8 mcs[(LMAC_MAXMCS / 8)];
50 } lmac_mcs_t;
52 typedef struct {
53 uint32 htcaps;
54 uint16 max_phy_rxrate; /* Mbps */
55 uint8 sup_chan_width; /* 20MHz/40MHz */
56 uint8 rx_stbc_cap;
57 uint8 max_amsdulen;
58 uint8 max_rx_ampdulen;
59 uint8 ampdu_spacing; /* time between mpdus in an ampdu */
60 lmac_mcs_t rxmcs_set;
61 lmac_mcs_t txmcs_set;
62 uint8 pco_trans_time;
63 uint8 sup_mcs_feedback;
64 uint8 reserved[3];
65 } lmac_ht_cap_t;
67 /* LMAC HT CAP field specific definitions */
69 /* htcaps bits 13-31 reserved */
70 #define LMAC_HTCAP_RX_LDPC 0x00000001
71 #define LMAC_HTCAP_40MHz 0x00000002
72 #define LMAC_HTCAP_GF_FRAMES 0x00000004
73 #define LMAC_HTCAP_SGI_20MHz 0x00000008
74 #define LMAC_HTCAP_SGI_40MHz 0x00000010
75 #define LMAC_HTCAP_STBC_TX 0x00000020
76 #define LMAC_HTCAP_DELAYED_BA 0x00000040
77 #define LMAC_HTCAP_DSSSCCK_40MHz 0x00000080
78 #define LMAC_HTCAP_PSMP 0x00000100
79 #define LMAC_HTCAP_LSIG_TXOP 0x00000200
80 #define LMAC_HTCAP_PCO 0x00000400
81 #define LMAC_HTCAP_HTC_FIELD 0x00000800
82 #define LMAC_HTCAP_RD_RESP 0x00001000
84 /* sup_chan_width */
85 #define LMAC_SUP_20MHz_ONLY 0
86 #define LMAC_SUP_20MHz40MHz 1
88 /* rx_stbc_cap */
89 #define LMAC_RXSTBC_UNSUPPORTED 0
90 #define LMAC_RXSTBC_1_SSTREAM 1
91 #define LMAC_RXSTBC_1_2_SSTREAM 2
92 #define LMAC_RXSTBC_1_2_3_SSTREAM 3
94 /* max_amsdulen */
95 #define LMAC_MAXAMSDU_SIZE_3839 0
96 #define LMAC_MAXAMSDU_SIZE_7935 1
98 /* max_rx_ampdulen */
99 #define LMAC_RXMAXAMPDU_SIZE_8191 0
100 #define LMAC_RXMAXAMPDU_SIZE_16383 1
101 #define LMAC_RXMAXAMPDU_SIZE_32767 2
102 #define LMAC_RXMAXAMPDU_SIZE_65535 3
104 /* ampdu_spacing */
105 #define LMAC_SPACING_NORESTRICT 0
106 #define LMAC_SPACING_250ns 1
107 #define LMAC_SPACING_512ns 2
108 #define LMAC_SPACING_1000ns 3
109 #define LMAC_SPACING_2000ns 4
110 #define LMAC_SPACING_4000ns 5
111 #define LMAC_SPACING_8000ns 6
112 #define LMAC_SPACING_16000ns 7
114 /* pco_trans_time */
115 #define LMAC_PCO_TRANSITION_NONE 0
116 #define LMAC_PCO_TRANSITION_400us 1
117 #define LMAC_PCO_TRANSITION_1500us 2
118 #define LMAC_PCO_TRANSITION_5000us 3
120 /* sup_mcs_feedback */
121 #define LMAC_MCSFEEDBACK_NONE 0
122 #define LMAC_MCSFEEDBACK_RSVD 1
123 #define LMAC_MCSFEEDBACK_UNSOLICITED 2
124 #define LMAC_MCSFEEDBACK_ALL 3
127 #define LMAC_CAP_MAGIC 0xdeadbeef
128 #define LMAC_VERSION_BUF_SIZE 64
130 typedef struct wl_lmac_cap {
131 uint32 magic;
132 wl_rateset_t hw_legacy_rateset; /* nonHT hw rates */
133 uint8 scan_ssid;
134 uint8 bands; /* bands (WLC_BAND_xx) */
135 uint8 nmulticast;
136 uint8 nratefallbackclasses;
137 uint16 ssid_buffer_len;
138 uint16 rxpacketflags;
139 struct {
140 int32 max_dBm;
141 int32 min_dBm;
142 uint32 step_dB;
143 } txpower[3];
144 uint32 capabilities;
145 uint8 max_txbuffers[AC_COUNT];
146 uint16 max_rxbuffers;
147 uint8 max_ethtype_filters;
148 uint8 max_udpport_filters;
150 /* HT Capabilities */
151 lmac_ht_cap_t lmac_htcap;
153 /* BROADCOM specific parts */
154 uint32 radioid[2];
155 lmacchanvec_t sup_chan[2];
156 char lmac_version[LMAC_VERSION_BUF_SIZE];
157 uint8 rxhdr_size;
158 uint8 rxhdr_hwrxoff;
159 uint8 PAD[2];
160 uint32 PAD[7];
161 wlc_rev_info_t lmac_rev_info;
162 uint32 PAD[8];
163 } wl_lmac_cap_t;
165 /* LMAC capabilities */
166 #define LMAC_CAP_MAXRXLIFETIME_AC 0x00000001
167 #define LMAC_CAP_IBSS_PS 0x00000002
168 #define LMAC_CAP_TRUNCATE_TXPOLICY 0x00000004
169 #define LMAC_CAP_PREAMBLE_OVERRIDE 0x00000008
170 #define LMAC_CAP_TXPWR_SENDPKT 0x00000010
171 #define LMAC_CAP_EXPIRY_TXPACKET 0x00000020
172 #define LMAC_CAP_PROBEFOR_JOIN 0x00000040
173 #define LMAC_CAP_MAXLIFETIME_Q 0x00000080
174 #define LMAC_CAP_TXNOACK_Q 0x00000100
175 #define LMAC_CAP_BLOCKACK_Q 0x00000200
176 #define LMAC_CAP_DOT11SLOTTIME 0x00000400
177 #define LMAC_CAP_WMM_SA 0x00000800
178 #define LMAC_CAP_SAPSD 0x00001000
179 #define LMAC_CAP_RM 0x00002000
180 #define LMAC_CAP_LEGACY_PSPOLL_Q 0x00004000
181 #define LMAC_CAP_WEP128 0x00008000
182 #define LMAC_CAP_MOREDATA_ACK 0x00010000
183 #define LMAC_CAP_SCAN_MINMAX_TIME 0x00020000
184 #define LMAC_CAP_TXAUTORATE 0x00040000
185 #define LMAC_CAP_NOIVICV_IN_PKT 0x00080000
186 #define LMAC_CAP_HT 0x00100000
187 #define LMAC_CAP_WAPI 0x00200000
188 #define LMAC_CAP_DSPARAM_IN_PRB 0x00400000
189 #define LMAC_CAP_STA 0x80000000 /* (BRCM) STA functions included */
191 /* LMAC Join params */
192 #define WLC_LMAC_JOIN_MODE_IBSS 0
193 #define WLC_LMAC_JOIN_MODE_BSS 1
195 /* Note: order of fields is chosen carefully for proper alignment */
196 typedef struct wl_lmac_join_params {
197 uint32 mode;
198 uint32 beacon_interval; /* TUs */
199 uint16 atim_window;
200 struct ether_addr bssid;
201 uint8 band;
202 uint8 channel;
203 uint8 preamble;
204 uint8 SSID_len;
205 uint8 SSID[32];
206 uint8 probe_for_join;
207 uint8 rsvd[3];
208 wl_rateset_t basic_rateset;
209 } wl_lmac_join_params_t;
211 typedef struct wl_lmac_bss_params {
212 uint16 aid;
213 uint8 dtim_interval;
214 } wl_lmac_bss_params_t;
216 typedef enum queue_id {
217 Q_BE = 0,
218 Q_BK,
219 Q_VI,
220 Q_VO,
221 Q_HCCA
222 } queue_id_t;
224 typedef enum ps_scheme {
225 PS_REGULAR = 0,
226 PS_UAPSD,
227 PS_LEGACY_PSPOLL,
228 PS_SAPSD
229 } ps_scheme_t;
231 typedef enum ack_policy {
232 ACKP_NORMAL = 0,
233 ACKP_NOACK,
234 ACKP_BLOCKACK
235 } ack_policy_t;
237 typedef struct wl_lmac_conf_q {
238 queue_id_t qid;
239 ack_policy_t ack;
240 ps_scheme_t ps;
241 uint8 pad;
243 uint32 maxtxlifetime; /* usec */
244 struct {
245 uint32 start_time;
246 uint32 interval;
247 } sapsd_conf;
248 uint16 mediumtime;
249 } wl_lmac_conf_q_t;
251 typedef struct wl_lmac_conf_ac {
252 uint16 cwmin[AC_COUNT];
253 uint16 cwmax[AC_COUNT];
254 uint8 aifs[AC_COUNT];
255 uint16 txop[AC_COUNT];
256 uint32 max_rxlifetime[AC_COUNT];
257 } wl_lmac_conf_ac_t;
259 #define TEMPLATE_BUFFER_LEN (256 + 32)
260 #define TEMPLATE_BEACON_FRAME 0
261 #define TEMPLATE_PRBREQ_FRAME 1
262 #define TEMPLATE_NULLDATA_FRAME 2
263 #define TEMPLATE_PRBRESP_FRAME 3
264 #define TEMPLATE_QOSNULLDATA_FRAME 4
265 #define TEMPLATE_PSPOLL_FRAME 5
266 #define TEMPLATE_COUNT 6 /* Must be last */
268 struct wl_lmac_frmtemplate {
269 uint32 frm_type;
270 uint32 rate;
271 uint32 length; /* Actual size of frm_data[] content only */
274 #define LMAC_FRMTEMPLATE_FIXED_SIZE (sizeof(struct wl_lmac_frmtemplate))
276 #define BCNIE_FILTER_BIT0_MASK 0x01
277 #define BCNIE_FILTER_BIT1_MASK 0x02
279 typedef struct wl_lmac_bcnfilter {
280 uint32 bcn_filter_enable;
281 uint32 hostwake_bcn_count;
282 } wl_lmac_bcnfilter_t;
284 #define WLLMAC_BCNFILTER_MAX_IES 8
285 typedef struct wl_lmac_bcnie {
286 uint8 id;
287 uint8 mask;
288 int16 offset;
289 uint8 OUI[3];
290 uint8 type;
291 uint16 ver;
292 } wl_lmac_bcnie_t;
294 typedef struct wl_lmac_bcniefilter {
295 uint32 nies;
296 wl_lmac_bcnie_t ies[WLLMAC_BCNFILTER_MAX_IES];
297 } wl_lmac_bcniefilter_t;
299 typedef struct wl_lmac_txrate_class {
300 uint8 retry_54Mbps;
301 uint8 retry_48Mbps;
302 uint8 retry_36Mbps;
303 uint8 retry_33Mbps;
304 uint8 retry_24Mbps;
305 uint8 retry_22Mbps;
306 uint8 retry_18Mbps;
307 uint8 retry_12Mbps;
308 uint8 retry_11Mbps;
309 uint8 retry_9Mbps;
310 uint8 retry_6Mbps;
311 uint8 retry_5p5Mbps;
312 uint8 retry_2Mbps;
313 uint8 retry_1Mbps;
314 uint8 SRL;
315 uint8 LRL;
316 uint32 iflags;
317 } wl_lmac_txrate_class_t;
319 typedef struct wl_lmac_txrate_policy {
320 uint32 nclasses;
321 wl_lmac_txrate_class_t txrate_classes[1];
322 } wl_lmac_txrate_policy_t;
324 typedef struct wl_lmac_setchannel {
325 uint8 channel;
326 uint8 txp_user_target[45];
327 uint8 txp_limit[45];
328 uint8 override;
329 uint8 txpwr_percent;
330 } wl_lmac_set_channel_t;
332 typedef struct wl_lmac_addkey {
333 uint8 index;
334 uint8 reserved[3];
335 wl_wsec_key_t key;
336 } wl_lmac_addkey_t;
338 typedef struct wl_lmac_delkey {
339 uint8 keyindex;
340 } wl_lmac_delkey_t;
342 typedef struct wl_bcmlmac_txdone {
343 /* Length is D11_TXH_LEN(104),TXSTATUS_LEN(16),D11_PHY_HDR_LEN(6) */
344 uint8 data[128];
345 } wl_bcmlmac_txdone_t;
347 #define LMAC_MODE_NORMAL 0
348 #define LMAC_MODE_EXTENDED 1 /* Expands format of txheader/rxheader/rxstatus/etc */
350 /* LMAC RX filter mode bits */
351 #define LMAC_PROMISC 0x00000001
352 #define LMAC_BSSIDFILTER 0x00000002
353 #define LMAC_MONITOR 0x80000000
355 /* Error codes that can be returned by LMAC */
356 #define LMAC_SUCCESS 0
357 #define LMAC_FAILURE 1
358 #define LMAC_RX_DECRYPT_FAILED 2
359 #define LMAC_RX_MICFAILURE 3
360 #define LMAC_SUCCESSXFER 4
361 #define LMAC_PENDING 5
362 #define LMAC_TXQ_FULL 6
363 #define LMAC_EXCEED_RETRY 7
364 #define LMAC_LIFETIME_EXPIRED 8
365 #define LMAC_NOLINK 9
366 #define LMAC_MAC_ERROR 10
368 /* LMAC events */
369 #define LMAC_EVENT_INITDONE 0
370 #define LMAC_EVENT_FATAL 1
371 #define LMAC_EVENT_BSSLOST 2
372 #define LMAC_EVENT_BSSREGAINED 3
373 #define LMAC_EVENT_RADARDETECT 4
374 #define LMAC_EVENT_LOWRSSI 5
375 #define LMAC_EVENT_SCANCOMPLETE 6
376 #define LMAC_EVENT_RMCOMPLETE 7
377 #define LMAC_EVENT_JOINCOMPLETE 8
378 #define LMAC_EVENT_PSCOMPLETE 9
379 #define LMAC_EVENT_TRACE 10
380 #define LMAC_EVENT_LAST 11 /* Must be last */
382 typedef struct wllmac_join_data {
383 int32 max_powerlevel;
384 int32 min_powerlevel;
385 } wllmac_join_data_t;
387 typedef struct wllmac_pscomplete_data {
388 uint32 pmstate;
389 } wllmac_pscomplete_data_t;
391 typedef struct wllmac_scancomplete_data {
392 uint32 pmstate;
393 } wllmac_scancomplete_data_t;
395 typedef struct wl_lmac_rmreq_params {
396 int32 tx_power;
397 uint32 channel;
398 uint8 band;
399 uint8 activation_delay;
400 uint8 measurement_offset;
401 uint8 nmeasures;
402 } wl_lmac_rmreq_params_t;
404 typedef struct wlc_lmac_rm_req {
405 uint32 type;
406 uint32 dur;
407 uint32 resrved;
408 } wl_lmac_rm_req_t;
410 struct wlc_lmac_rm_bcn_measure {
411 uint32 scan_mode;
414 #define LMAC_WAKEUP_BEACON 0
415 #define LMAC_WAKEUP_DTIMBEACON 1
416 #define LMAC_WAKEUP_NBEACONS 2
417 #define LMAC_WAKEUP_NDTIMBEACONS 3
419 #define LMAC_SLEEPMODE_WAKEUP 0
420 #define LMAC_SLEEPMODE_PDOWN 1
421 #define LMAC_SLEEPMODE_LPDOWN 2
424 #define WLLMAC_PF_DISABLE 0
425 #define WLLMAC_PF_MATCH_FORWARD 1
426 #define WLLMAC_PF_MATCH_DISCARD 2
428 #define WLLMAC_PFTYPE_ETHTYPE 1
429 #define WLLMAC_PFTYPE_ARPHOSTIP 2 /* not used for now */
430 #define WLLMAC_PFTYPE_BCAST_UDPPORT 3
432 typedef struct wllmac_pktfilter {
433 uint8 pf_type;
434 uint8 pf_flags;
435 uint8 pf_nelements;
436 uint8 reserved;
437 /* actual pkt filter data starts here */
438 } wllmac_pktfilter_t;
440 #define WLLMAC_PKTFILTER_MINSIZE sizeof(wllmac_pktfilter_t)
442 typedef struct wllmac_htcap {
443 uint8 ht_supported;
444 uint8 rx_stbc_cap;
445 struct ether_addr ibss_peer_mac;
446 ht_cap_ie_t ie;
447 } wllmac_htcap_t;
449 #define LMAC_HT_RXBCN_PRIMARY 0x00
450 #define LMAC_HT_RXBCN_ANY 0x01
451 #define LMAC_HT_RXBCN_SECONDARY 0x02
453 typedef struct wllmac_ht_secbcn {
454 uint8 sec_bcn;
455 uint8 reserved[3];
456 } wllmac_ht_secbcn_t;
458 typedef struct wllmac_ht_blockack {
459 uint8 tx_tid_bitmap;
460 uint8 rx_tid_bitmap;
461 uint8 reserved[2];
462 } wllmac_ht_blockack_t;
464 #define WLLMAC_RATE_MCS 0x8000
465 #define WLLMAC_RATE_MASK 0x7fff
467 #define WLLMAC_RX_FLAG_RAMATCH 0x00000001
468 #define WLLMAC_RX_FLAG_MCASTMATCH 0x00000002
469 #define WLLMAC_RX_FLAG_BCASTMATCH 0x00000004
470 #define WLLMAC_RX_FLAG_BCNTIM_SET 0x00000008
471 #define WLLMAC_RX_FLAG_BCNVBMP_LOT 0x00000010
472 #define WLLMAC_RX_FLAG_SSID_MATCH 0x00000020
473 #define WLLMAC_RX_FLAG_BSSID_MATCH 0x00000040
474 #define WLLMAC_RX_FLAG_ENC_MASK 0x00038000
475 #define WLLMAC_RX_FLAG_MORE_RX 0x00040000
476 #define WLLMAC_RX_FLAG_MORE_MEASURE 0x00080000
477 #define WLLMAC_RX_FLAG_HTPACKET 0x00100000
478 #define WLLMAC_RX_FLAG_AMPDU 0x00200000
479 #define WLLMAC_RX_FLAG_STBC 0x00400000
481 #define WLLMAC_RX_FLAG_ENC_SHIFT 15
482 #define WLLMAC_RX_FLAG_ENC_NONE (0 << WLLMAC_RX_FLAG_ENC_SHIFT)
483 #define WLLMAC_RX_FLAG_ENC_WAPI (1 << WLLMAC_RX_FLAG_ENC_SHIFT)
484 #define WLLMAC_RX_FLAG_ENC_WEP (2 << WLLMAC_RX_FLAG_ENC_SHIFT)
485 #define WLLMAC_RX_FLAG_ENC_TKIP (4 << WLLMAC_RX_FLAG_ENC_SHIFT)
486 #define WLLMAC_RX_FLAG_ENC_AES (6 << WLLMAC_RX_FLAG_ENC_SHIFT)
489 typedef struct wllmac_autorate_class {
490 wl_rateset_t legacy_rateset;
491 lmac_mcs_t mcs_rates;
492 uint8 index;
493 uint8 SRL;
494 uint8 LRL;
495 uint8 pad[3];
496 } wllmac_autorate_t;
498 #endif /* _wllmacctl_h_ */