summaryrefslogtreecommitdiff
path: root/include/802.11brcm.h
blob: 3471d066939b925b7c09a6fa1a4ac19c20d21eb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
/*
 * Broadcom proprietary types and constants relating to 802.11
 *
 * Copyright (C) 2024, Broadcom.
 *
 *      Unless you and Broadcom execute a separate written software license
 * agreement governing use of this software, this software is licensed to you
 * under the terms of the GNU General Public License version 2 (the "GPL"),
 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
 * following added to such license:
 *
 *      As a special exception, the copyright holders of this software give you
 * permission to link this software with independent modules, and to copy and
 * distribute the resulting executable under terms of your choice, provided that
 * you also meet, for each linked independent module, the terms and conditions of
 * the license of that module.  An independent module is a module which is not
 * derived from this software.  The special exception does not apply to any
 * modifications of the software.
 *
 *
 * <<Broadcom-WL-IPTag/Dual:>>
 */

#ifndef _802_11brcm_h_
#define _802_11brcm_h_

#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif

#ifndef _NET_ETHERNET_H_
#include <ethernet.h>
#endif

#include <802.11n.h>

/* This marks the start of a packed structure section. */
#include <packed_section_start.h>

/**
 * RWL wifi protocol: The Vendor Specific Action frame is defined for vendor-specific signaling
 *  category+OUI+vendor specific content ( this can be variable)
 */
BWL_PRE_PACKED_STRUCT struct dot11_action_wifi_vendor_specific {
	uint8	category;
	uint8	OUI[3];
	uint8	type;
	uint8	subtype;
	uint8	data[1040];
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_action_wifi_vendor_specific dot11_action_wifi_vendor_specific_t;

#define BCM_ACTION_OUI_BYTE0	0x00
#define BCM_ACTION_OUI_BYTE1	0x90
#define BCM_ACTION_OUI_BYTE2	0x4c

BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch {
	uint8	id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
	uint8	len;		/* IE length */
	uint8	oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
	uint8	type;           /* type indicates what follows */
	uint8	extch;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_brcm_extch dot11_brcm_extch_ie_t;

#define BRCM_EXTCH_IE_LEN	5

/* OUI for BRCM proprietary IE */
#define BRCM_PROP_OUI		"\x00\x90\x4C"	/* Broadcom proprietary OUI */

/* Broadcom Proprietary OUI type list. Please update below page when adding a new type.
 * Twiki https://hwnbu-twiki.lvn.broadcom.net/bin/view/Mwgroup/WlDriverIOVars?topic=WlBrcmPropIE
 */
/* The following BRCM_PROP_OUI types are currently in use (defined in
 * relevant subsections). Each of them will be in a separate proprietary(221) IE
 * #define SES_VNDR_IE_TYPE		1   (defined in src/ses/shared/ses.h)
 * #define BRCM_SYSCAP_IE_TYPE		3
 * #define WET_TUNNEL_IE_TYPE		3
 * #define ULB_BRCM_PROP_IE_TYPE	91
 * #define SDB_BRCM_PROP_IE_TYPE	92
 * #define BCM_RESERVED_ACCESS		93	(Reserved, definition pending)
 */
#define RWL_WIFI_DEFAULT		0
#define DPT_IE_TYPE			2
#define VHT_FEATURES_IE_TYPE		4
#define RWL_WIFI_FIND_MY_PEER		9	/* Used while finding server */
#define RWL_WIFI_FOUND_PEER		10	/* Server response to the client  */
#define PROXD_IE_TYPE			11	/* Wifi proximity action frame type */
#define BRCM_FTM_IE_TYPE		14
#define HT_CAP_IE_TYPE			51	/* used in prop IE 221 only */
#define HT_ADD_IE_TYPE			52	/* faked out as current spec is illegal */
#define BRCM_EXTCH_IE_TYPE		53	/* 802.11n ID not yet assigned */
#define MEMBER_OF_BRCM_PROP_IE_TYPE	54      /* used in prop IE 221 only */
#define RELMCAST_BRCM_PROP_IE_TYPE	55	/* used in prop IE 221 only */
/* BCM proprietary IE type for AIBSS */
#define BCM_AIBSS_IE_TYPE		56
/*
 * This BRCM_PROP_OUI types is intended for use in events to embed additional
 * data, and would not be expected to appear on the air -- but having an IE
 * format allows IE frame data with extra data in events in that allows for
 * more flexible parsing.
 */
#define BRCM_EVT_WL_BSS_INFO		64
#define RWL_ACTION_WIFI_FRAG_TYPE	85	/* Fragment indicator for receiver */
#define BTC_INFO_BRCM_PROP_IE_TYPE	90

/* Action frame type */
#define PROXD_AF_TYPE			11	/* Wifi proximity action frame type */
#define BRCM_RELMACST_AF_TYPE	        12	/* RMC action frame type */
/* Action frame type for FTM Initiator Report */
#define BRCM_FTM_VS_AF_TYPE		14

enum {
	BRCM_FTM_VS_INITIATOR_RPT_SUBTYPE = 1,	/* FTM Initiator Report */
	BRCM_FTM_VS_COLLECT_SUBTYPE = 2,	/* FTM Collect debug protocol */
};

/**
 * Following is the generic structure for brcm_prop_ie (uses BRCM_PROP_OUI).
 * DPT uses this format with type set to DPT_IE_TYPE
 */
#ifdef NEW_BRCM_PROP_IE
BWL_PRE_PACKED_STRUCT struct brcm_prop_ie_s {
	uint8 id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
	uint8 len;		/* IE length */
	uint8 oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
	uint8 type;		/* type of this IE */
} BWL_POST_PACKED_STRUCT;
typedef struct brcm_prop_ie_s brcm_prop_ie_t;
#else
typedef struct dpt_brcm_prop_ie_s brcm_prop_ie_t;
#endif /* NEW_BRCM_PROP_IE */
#define BRCM_PROP_IE_LEN	6	/* len of fixed part of brcm_prop ie */


/**
 * Following is the generic structure for brcm_prop_ie (uses BRCM_PROP_OUI).
 * DPT uses this format with type set to DPT_IE_TYPE
 */
BWL_PRE_PACKED_STRUCT struct dpt_brcm_prop_ie_s {
	uint8 id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
	uint8 len;		/* IE length */
	uint8 oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
	uint8 type;		/* type of this IE */
	uint16 cap;
} BWL_POST_PACKED_STRUCT;
typedef struct brcm_prop_ie_s dpt_brcm_prop_ie_t;

/* BRCM OUI: Used in the proprietary(221) IE in all broadcom devices */
#define BRCM_OUI		"\x00\x10\x18"	/* Broadcom OUI */

/** BRCM info element */
BWL_PRE_PACKED_STRUCT struct brcm_ie {
	uint8	id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
	uint8	len;		/* IE length */
	uint8	oui[3];		/* Proprietary OUI, BRCM_OUI */
	uint8	ver;		/* type/ver of this IE */
	uint8	assoc;		/* # of assoc STAs */
	uint8	flags;		/* misc flags */
	uint8	flags1;		/* misc flags */
	uint16	amsdu_mtu_pref;	/* preferred A-MSDU MTU */
	uint8	flags2;		/* DTPC Cap flags */
} BWL_POST_PACKED_STRUCT;
typedef	struct brcm_ie brcm_ie_t;
#define BRCM_IE_LEN		12u	/* BRCM IE length */
#define BRCM_IE_VER		2u	/* BRCM IE version */
#define BRCM_IE_LEGACY_AES_VER	1u	/* BRCM IE legacy AES version */

/* brcm_ie flags */
#define	BRF_ABCAP		0x01	/* afterburner is obsolete,  defined for backward compat */
#define	BRF_ABRQRD		0x02	/* afterburner is obsolete,  defined for backward compat */
#define	BRF_LZWDS		0x04	/* lazy wds enabled */
#define	BRF_BLOCKACK		0x08	/* BlockACK capable */
#define BRF_ABCOUNTER_MASK	0xf0	/* afterburner is obsolete,  defined for backward compat */
#define BRF_PROP_11N_MCS	0x10	/* re-use afterburner bit */
#define BRF_MEDIA_CLIENT	0x20	/* re-use afterburner bit to indicate media client device */

/**
 * Support for Broadcom proprietary HT MCS rates. Re-uses afterburner bits since
 * afterburner is not used anymore. Checks for BRF_ABCAP to stay compliant with 'old'
 * images in the field.
 */
#define GET_BRF_PROP_11N_MCS(brcm_ie) \
	(!((brcm_ie)->flags & BRF_ABCAP) && ((brcm_ie)->flags & BRF_PROP_11N_MCS))

/* brcm_ie flags1 */
#define	BRF1_AMSDU		0x01	/* A-MSDU capable */
#define	BRF1_WNM		0x02	/* WNM capable */
#define BRF1_WMEPS		0x04	/* AP is capable of handling WME + PS w/o APSD */
#define BRF1_PSOFIX		0x08	/* AP has fixed PS mode out-of-order packets */
#define	BRF1_RX_LARGE_AGG	0x10	/* device can rx large aggregates */
#define BRF1_RFAWARE_DCS	0x20    /* RFAWARE dynamic channel selection (DCS) */
#define BRF1_SOFTAP		0x40    /* Configure as Broadcom SOFTAP */
#define BRF1_DWDS		0x80    /* DWDS capable */

/* brcm_ie flags2 */
#define BRF2_DTPC_TX		0x01u	/* DTPC: DTPC TX Cap */
#define BRF2_DTPC_RX		0x02u	/* DTPC: DTPC RX Cap */
#define BRF2_DTPC_TX_RX		0x03u	/* DTPC: Enable Both DTPC TX and RX Cap */
#define BRF2_DTPC_NONBF		0x04u	/* DTPC: Enable DTPC for NON-TXBF */
#define BRF2_TWT_RESP_CAP	0x08u	/* TWT responder Cap for Brcm Softap
					 * only brcm sta parse this
					 */
#define BRF2_TWT_REQ_CAP	0x10u	/* TWT requester Cap for BRCM STA
					 * only brcm softap parse this
					 */

/** BRCM PROP DEVICE PRIMARY MAC ADDRESS IE */
BWL_PRE_PACKED_STRUCT struct member_of_brcm_prop_ie {
	uchar id;
	uchar len;
	uchar oui[3];
	uint8	type;           /* type indicates what follows */
	struct ether_addr ea;   /* Device Primary MAC Adrress */
} BWL_POST_PACKED_STRUCT;
typedef struct member_of_brcm_prop_ie member_of_brcm_prop_ie_t;

#define MEMBER_OF_BRCM_PROP_IE_LEN	10	/* IE max length */
#define MEMBER_OF_BRCM_PROP_IE_HDRLEN	(sizeof(member_of_brcm_prop_ie_t))

/** BRCM Reliable Multicast IE */
BWL_PRE_PACKED_STRUCT struct relmcast_brcm_prop_ie {
	uint8 id;
	uint8 len;
	uint8 oui[3];
	uint8 type;		/* type indicates what follows */
	struct ether_addr ea;	/* The ack sender's MAC Adrress */
	struct ether_addr mcast_ea;  /* The multicast MAC address */
	uint8 updtmo; /* time interval(second) for client to send null packet to report its rssi */
} BWL_POST_PACKED_STRUCT;
typedef struct relmcast_brcm_prop_ie relmcast_brcm_prop_ie_t;

/* IE length */
/* BRCM_PROP_IE_LEN = sizeof(relmcast_brcm_prop_ie_t)-((sizeof (id) + sizeof (len)))? */
#define RELMCAST_BRCM_PROP_IE_LEN	(sizeof(relmcast_brcm_prop_ie_t)-(2*sizeof(uint8)))

/* BRCM BTC IE */
BWL_PRE_PACKED_STRUCT struct btc_brcm_prop_ie {
	uint8 id;
	uint8 len;
	uint8 oui[3];
	uint8 type;		/* type inidicates what follows */
	uint32 info;
} BWL_POST_PACKED_STRUCT;
typedef struct btc_brcm_prop_ie btc_brcm_prop_ie_t;

#define BRCM_BTC_INFO_TYPE_LEN	(sizeof(btc_brcm_prop_ie_t) - (2 * sizeof(uint8)))

/* CAP IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
/* the capability IE is primarily used to convey this nodes abilities */
BWL_PRE_PACKED_STRUCT struct ht_prop_cap_ie {
	uint8	id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
	uint8	len;		/* IE length */
	uint8	oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
	uint8	type;		/* type indicates what follows */
	ht_cap_ie_t cap_ie;
} BWL_POST_PACKED_STRUCT;
typedef struct ht_prop_cap_ie ht_prop_cap_ie_t;

#define HT_PROP_IE_OVERHEAD	4	/* overhead bytes for prop oui ie */

/* ADD IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
/* the additional IE is primarily used to convey the current BSS configuration */
BWL_PRE_PACKED_STRUCT struct ht_prop_add_ie {
	uint8	id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
	uint8	len;		/* IE length */
	uint8	oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
	uint8	type;		/* indicates what follows */
	ht_add_ie_t add_ie;
} BWL_POST_PACKED_STRUCT;
typedef struct ht_prop_add_ie ht_prop_add_ie_t;

/**
 * BRCM vht features IE header
 * The header if the fixed part of the IE
 * On the 5GHz band this is the entire IE,
 * on 2.4GHz the VHT IEs as defined in the 802.11ac
 * specification follows
 *
 *
 * VHT features rates  bitmap.
 * Bit0:		5G MCS 0-9 BW 160MHz
 * Bit1:		5G MCS 0-9 support BW 80MHz
 * Bit2:		5G MCS 0-9 support BW 20MHz
 * Bit3:		2.4G MCS 0-9 support BW 20MHz
 * Bits:4-7	Reserved for future use
 *
 */
BWL_PRE_PACKED_STRUCT struct vht_features_ie_hdr {
	uint8 oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
	uint8 type;		/* type of this IE = 4 */
	uint8 rate_mask;	/* VHT rate mask */
} BWL_POST_PACKED_STRUCT;
typedef struct vht_features_ie_hdr vht_features_ie_hdr_t;

/* tag_ID/length/value_buffer tuple */
typedef BWL_PRE_PACKED_STRUCT struct {
	uint8	id;
	uint8	len;
	uint8	data[];
} BWL_POST_PACKED_STRUCT ftm_vs_tlv_t;

BWL_PRE_PACKED_STRUCT struct dot11_ftm_vs_ie {
	uint8 id;		/* DOT11_MNG_VS_ID */
	uint8 len;		/* length following */
	uint8 oui[3];		/* BRCM_PROP_OUI (or Customer) */
	uint8 sub_type;		/* BRCM_FTM_IE_TYPE (or Customer) */
	uint8 version;
	uint8 tlvs[]; /* ftm_vs_tlv_t tlv */
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_ftm_vs_ie dot11_ftm_vs_ie_t;

/* same as payload of dot11_ftm_vs_ie.
* This definition helps in having struct access
* of pay load while building FTM VS IE from other modules(NAN)
*/
BWL_PRE_PACKED_STRUCT struct dot11_ftm_vs_ie_pyld {
	uint8 sub_type;		/* BRCM_FTM_IE_TYPE (or Customer) */
	uint8 version;
	uint8 tlvs[]; /* ftm_vs_tlv_t tlv */
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_ftm_vs_ie_pyld dot11_ftm_vs_ie_pyld_t;

/* ftm vs api version */
#define BCM_FTM_VS_PARAMS_VERSION 0x01

/* ftm vendor specific information tlv types */
enum {
	FTM_VS_TLV_NONE = 0,
	FTM_VS_TLV_REQ_PARAMS = 1,		/* additional request params (in FTM_REQ) */
	FTM_VS_TLV_MEAS_INFO = 2,		/* measurement information (in FTM_MEAS) */
	FTM_VS_TLV_SEC_PARAMS = 3,		/* security parameters (in either) */
	FTM_VS_TLV_SEQ_PARAMS = 4,		/* toast parameters (FTM_REQ, BRCM proprietary) */
	FTM_VS_TLV_MF_BUF = 5,			/* multi frame buffer - may span ftm vs ie's */
	FTM_VS_TLV_TIMING_PARAMS = 6,            /* timing adjustments */
	FTM_VS_TLV_MF_STATS_BUF = 7		/* multi frame statistics buffer */
	/* add additional types above */
};

/* BCM proprietary flag type for WL_DISCO_VSIE */
#define SSE_OUI			"\x00\x00\xF0"
#define VENDOR_ENTERPRISE_STA_OUI_TYPE	0x22
#define MAX_VSIE_DISASSOC       (1)
#define DISCO_VSIE_LEN          0x09u

/* This marks the end of a packed structure section. */
#include <packed_section_end.h>

#endif /* _802_11brcm_h_ */