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_FMT_RADIOTAP: firmware provides monitor packets with radiotap header
27  * MONITOR_FMT_HW_RX_HDR: firmware provides monitor packets with hw/ucode header
28  */
29 #define BRCMF_FEAT_LIST \
30 	BRCMF_FEAT_DEF(MBSS) \
31 	BRCMF_FEAT_DEF(MCHAN) \
32 	BRCMF_FEAT_DEF(PNO) \
33 	BRCMF_FEAT_DEF(WOWL) \
34 	BRCMF_FEAT_DEF(P2P) \
35 	BRCMF_FEAT_DEF(RSDB) \
36 	BRCMF_FEAT_DEF(TDLS) \
37 	BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
38 	BRCMF_FEAT_DEF(WOWL_ND) \
39 	BRCMF_FEAT_DEF(WOWL_GTK) \
40 	BRCMF_FEAT_DEF(WOWL_ARP_ND) \
41 	BRCMF_FEAT_DEF(MFP) \
42 	BRCMF_FEAT_DEF(GSCAN) \
43 	BRCMF_FEAT_DEF(FWSUP) \
44 	BRCMF_FEAT_DEF(MONITOR) \
45 	BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \
46 	BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR)
47 
48 /*
49  * Quirks:
50  *
51  * AUTO_AUTH: workaround needed for automatic authentication type.
52  * NEED_MPC: driver needs to disable MPC during scanning operation.
53  */
54 #define BRCMF_QUIRK_LIST \
55 	BRCMF_QUIRK_DEF(AUTO_AUTH) \
56 	BRCMF_QUIRK_DEF(NEED_MPC)
57 
58 #define BRCMF_FEAT_DEF(_f) \
59 	BRCMF_FEAT_ ## _f,
60 /*
61  * expand feature list to enumeration.
62  */
63 enum brcmf_feat_id {
64 	BRCMF_FEAT_LIST
65 	BRCMF_FEAT_LAST
66 };
67 #undef BRCMF_FEAT_DEF
68 
69 #define BRCMF_QUIRK_DEF(_q) \
70 	BRCMF_FEAT_QUIRK_ ## _q,
71 /*
72  * expand quirk list to enumeration.
73  */
74 enum brcmf_feat_quirk {
75 	BRCMF_QUIRK_LIST
76 	BRCMF_FEAT_QUIRK_LAST
77 };
78 #undef BRCMF_QUIRK_DEF
79 
80 /**
81  * brcmf_feat_attach() - determine features and quirks.
82  *
83  * @drvr: driver instance.
84  */
85 void brcmf_feat_attach(struct brcmf_pub *drvr);
86 
87 /**
88  * brcmf_feat_debugfs_create() - create debugfs entries.
89  *
90  * @drvr: driver instance.
91  */
92 void brcmf_feat_debugfs_create(struct brcmf_pub *drvr);
93 
94 /**
95  * brcmf_feat_is_enabled() - query feature.
96  *
97  * @ifp: interface instance.
98  * @id: feature id to check.
99  *
100  * Return: true is feature is enabled; otherwise false.
101  */
102 bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id);
103 
104 /**
105  * brcmf_feat_is_quirk_enabled() - query chip quirk.
106  *
107  * @ifp: interface instance.
108  * @quirk: quirk id to check.
109  *
110  * Return: true is quirk is enabled; otherwise false.
111  */
112 bool brcmf_feat_is_quirk_enabled(struct brcmf_if *ifp,
113 				 enum brcmf_feat_quirk quirk);
114 
115 #endif /* _BRCMF_FEATURE_H */
116