GNU Linux-libre 4.19.264-gnu1
[releases.git] / drivers / net / wireless / broadcom / brcm80211 / brcmfmac / feature.h
1 /*
2  * Copyright (c) 2014 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 #ifndef _BRCMF_FEATURE_H
17 #define _BRCMF_FEATURE_H
18
19 /*
20  * Features:
21  *
22  * MBSS: multiple BSSID support (eg. guest network in AP mode).
23  * MCHAN: multi-channel for concurrent P2P.
24  * PNO: preferred network offload.
25  * WOWL: Wake-On-WLAN.
26  * P2P: peer-to-peer
27  * RSDB: Real Simultaneous Dual Band
28  * TDLS: Tunneled Direct Link Setup
29  * SCAN_RANDOM_MAC: Random MAC during (net detect) scheduled scan.
30  * WOWL_ND: WOWL net detect (PNO)
31  * WOWL_GTK: (WOWL) GTK rekeying offload
32  * WOWL_ARP_ND: ARP and Neighbor Discovery offload support during WOWL.
33  * MFP: 802.11w Management Frame Protection.
34  * GSCAN: enhanced scan offload feature.
35  * FWSUP: Firmware supplicant.
36  * MONITOR: firmware can pass monitor packets to host.
37  * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header
38  */
39 #define BRCMF_FEAT_LIST \
40         BRCMF_FEAT_DEF(MBSS) \
41         BRCMF_FEAT_DEF(MCHAN) \
42         BRCMF_FEAT_DEF(PNO) \
43         BRCMF_FEAT_DEF(WOWL) \
44         BRCMF_FEAT_DEF(P2P) \
45         BRCMF_FEAT_DEF(RSDB) \
46         BRCMF_FEAT_DEF(TDLS) \
47         BRCMF_FEAT_DEF(SCAN_RANDOM_MAC) \
48         BRCMF_FEAT_DEF(WOWL_ND) \
49         BRCMF_FEAT_DEF(WOWL_GTK) \
50         BRCMF_FEAT_DEF(WOWL_ARP_ND) \
51         BRCMF_FEAT_DEF(MFP) \
52         BRCMF_FEAT_DEF(GSCAN) \
53         BRCMF_FEAT_DEF(FWSUP) \
54         BRCMF_FEAT_DEF(MONITOR) \
55         BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP)
56
57 /*
58  * Quirks:
59  *
60  * AUTO_AUTH: workaround needed for automatic authentication type.
61  * NEED_MPC: driver needs to disable MPC during scanning operation.
62  */
63 #define BRCMF_QUIRK_LIST \
64         BRCMF_QUIRK_DEF(AUTO_AUTH) \
65         BRCMF_QUIRK_DEF(NEED_MPC)
66
67 #define BRCMF_FEAT_DEF(_f) \
68         BRCMF_FEAT_ ## _f,
69 /*
70  * expand feature list to enumeration.
71  */
72 enum brcmf_feat_id {
73         BRCMF_FEAT_LIST
74         BRCMF_FEAT_LAST
75 };
76 #undef BRCMF_FEAT_DEF
77
78 #define BRCMF_QUIRK_DEF(_q) \
79         BRCMF_FEAT_QUIRK_ ## _q,
80 /*
81  * expand quirk list to enumeration.
82  */
83 enum brcmf_feat_quirk {
84         BRCMF_QUIRK_LIST
85         BRCMF_FEAT_QUIRK_LAST
86 };
87 #undef BRCMF_QUIRK_DEF
88
89 /**
90  * brcmf_feat_attach() - determine features and quirks.
91  *
92  * @drvr: driver instance.
93  */
94 void brcmf_feat_attach(struct brcmf_pub *drvr);
95
96 /**
97  * brcmf_feat_debugfs_create() - create debugfs entries.
98  *
99  * @drvr: driver instance.
100  */
101 void brcmf_feat_debugfs_create(struct brcmf_pub *drvr);
102
103 /**
104  * brcmf_feat_is_enabled() - query feature.
105  *
106  * @ifp: interface instance.
107  * @id: feature id to check.
108  *
109  * Return: true is feature is enabled; otherwise false.
110  */
111 bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id);
112
113 /**
114  * brcmf_feat_is_quirk_enabled() - query chip quirk.
115  *
116  * @ifp: interface instance.
117  * @quirk: quirk id to check.
118  *
119  * Return: true is quirk is enabled; otherwise false.
120  */
121 bool brcmf_feat_is_quirk_enabled(struct brcmf_if *ifp,
122                                  enum brcmf_feat_quirk quirk);
123
124 #endif /* _BRCMF_FEATURE_H */