xref: /linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/xtlv.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1 // SPDX-License-Identifier: ISC
2 /*
3  * Copyright (c) 2019 Broadcom
4  */
5 #ifndef __BRCMF_XTLV_H
6 #define __BRCMF_XTLV_H
7 
8 #include <linux/types.h>
9 #include <linux/bits.h>
10 
11 /* bcm type(id), length, value with w/16 bit id/len. The structure below
12  * is nominal, and is used to support variable length id and type. See
13  * xtlv options below.
14  */
15 struct brcmf_xtlv {
16 	u16 id;
17 	u16 len;
18 	u8 data[];
19 };
20 
21 enum brcmf_xtlv_option {
22 	BRCMF_XTLV_OPTION_ALIGN32 = BIT(0),
23 	BRCMF_XTLV_OPTION_IDU8 = BIT(1),
24 	BRCMF_XTLV_OPTION_LENU8 = BIT(2),
25 };
26 
27 int brcmf_xtlv_data_size(int dlen, u16 opts);
28 void brcmf_xtlv_pack_header(struct brcmf_xtlv *xtlv, u16 id, u16 len,
29 			    const u8 *data, u16 opts);
30 
31 #endif /* __BRCMF_XTLV_H */
32