1 // SPDX-License-Identifier: ISC
2 /*
3  * Copyright (c) 2014 Broadcom Corporation
4  */
5 #ifndef _BRCMF_FEATURE_H
6 #define _BRCMF_FEATURE_H
7 
8 /*
9  * Features:
10  *
11  * MBSS: multiple BSSID support (eg. guest network in AP mode).
12  * MCHAN: multi-channel for concurrent P2P.
13  * PNO: preferred network offload.
14  * WOWL: Wake-On-WLAN.
15  * P2P: peer-to-peer
16  * RSDB: Real Simultaneous Dual Band
17  * TDLS: Tunneled Direct Link Setup
18  * SCAN_RANDOM_MAC: Random MAC during (net detect) scheduled scan.
19  * WOWL_ND: WOWL net detect (PNO)
20  * WOWL_GTK: (WOWL) GTK rekeying offload
21  * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL.
22  * MFP: 802.11w Management Frame Protection.
23  * GSCAN: enhanced scan offload feature.
24  * FWSUP: Firmware supplicant.
25  * MONITOR: firmware can pass monitor packets to host.
26  * MONITOR_FLAG: firmware flags monitor packets.
27  * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header
28  * MONITOR_FMT_HW_RX_HDR: firmware provides monitor packets with hw/ucode header
29  * DOT11H: firmware supports 802.11h
30  * SAE: simultaneous authentication of equals
31  */
32 #define BRCMF_FEAT_LIST \
33 	BRCMF_FEAT_DEF(MBSS) \
34 	BRCMF_FEAT_DEF(MCHAN) \
35 	BRCMF_FEAT_DEF(PNO) \
36 	BRCMF_FEAT_DEF(WOWL) \
37 	BRCMF_FEAT_DEF(P2P) \
38 	BRCMF_FEAT_DEF(RSDB) \
39 	BRCMF_FEAT_DEF(TDLS) \
40 	BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
41 	BRCMF_FEAT_DEF(WOWL_ND) \
42 	BRCMF_FEAT_DEF(WOWL_GTK) \
43 	BRCMF_FEAT_DEF(WOWL_ARP_ND) \
44 	BRCMF_FEAT_DEF(MFP) \
45 	BRCMF_FEAT_DEF(GSCAN) \
46 	BRCMF_FEAT_DEF(FWSUP) \
47 	BRCMF_FEAT_DEF(MONITOR) \
48 	BRCMF_FEAT_DEF(MONITOR_FLAG) \
49 	BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \
50 	BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) \
51 	BRCMF_FEAT_DEF(DOT11H) \
52 	BRCMF_FEAT_DEF(SAE)
53 
54 /*
55  * Quirks:
56  *
57  * AUTO_AUTH: workaround needed for automatic authentication type.
58  * NEED_MPC: driver needs to disable MPC during scanning operation.
59  */
60 #define BRCMF_QUIRK_LIST \
61 	BRCMF_QUIRK_DEF(AUTO_AUTH) \
62 	BRCMF_QUIRK_DEF(NEED_MPC)
63 
64 #define BRCMF_FEAT_DEF(_f) \
65 	BRCMF_FEAT_ ## _f,
66 /*
67  * expand feature list to enumeration.
68  */
69 enum brcmf_feat_id {
70 	BRCMF_FEAT_LIST
71 	BRCMF_FEAT_LAST
72 };
73 #undef BRCMF_FEAT_DEF
74 
75 #define BRCMF_QUIRK_DEF(_q) \
76 	BRCMF_FEAT_QUIRK_ ## _q,
77 /*
78  * expand quirk list to enumeration.
79  */
80 enum brcmf_feat_quirk {
81 	BRCMF_QUIRK_LIST
82 	BRCMF_FEAT_QUIRK_LAST
83 };
84 #undef BRCMF_QUIRK_DEF
85 
86 /**
87  * brcmf_feat_attach() - determine features and quirks.
88  *
89  * @drvr: driver instance.
90  */
91 void brcmf_feat_attach(struct brcmf_pub *drvr);
92 
93 /**
94  * brcmf_feat_debugfs_create() - create debugfs entries.
95  *
96  * @drvr: driver instance.
97  */
98 void brcmf_feat_debugfs_create(struct brcmf_pub *drvr);
99 
100 /**
101  * brcmf_feat_is_enabled() - query feature.
102  *
103  * @ifp: interface instance.
104  * @id: feature id to check.
105  *
106  * Return: true is feature is enabled; otherwise false.
107  */
108 bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id);
109 
110 /**
111  * brcmf_feat_is_quirk_enabled() - query chip quirk.
112  *
113  * @ifp: interface instance.
114  * @quirk: quirk id to check.
115  *
116  * Return: true is quirk is enabled; otherwise false.
117  */
118 bool brcmf_feat_is_quirk_enabled(struct brcmf_if *ifp,
119 				 enum brcmf_feat_quirk quirk);
120 
121 #endif /* _BRCMF_FEATURE_H */
122