xref: /wlan-dirver/qca-wifi-host-cmn/os_if/linux/wlan_osif_features.h (revision 2e17c21b55b6194b51cf3bca4b0f31ea64d81a24)
1 /*
2  * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: wlan_osif_features.h
21  *
22  * Define feature flags to cleanly describe when features
23  * are present in a given version of the kernel
24  */
25 
26 #ifndef _WLAN_OSIF_FEATURES_H_
27 #define _WLAN_OSIF_FEATURES_H_
28 
29 #include <linux/version.h>
30 
31 /*
32  * CFG80211_11BE_BASIC
33  * Used to indicate the Linux Kernel contains support for basic 802.11be
34  * definitions.
35  *
36  * These definitions were introduced in Linux Kernel 5.18 via:
37  * cbc1ca0a9d0a ieee80211: Add EHT (802.11be) definitions
38  * 2a2c86f15e17 ieee80211: add EHT 1K aggregation definitions
39  * 5cd5a8a3e2fb cfg80211: Add data structures to capture EHT capabilities
40  * 3743bec6120a cfg80211: Add support for EHT 320 MHz channel width
41  * cfb14110acf8 nl80211: add EHT MCS support
42  * c2b3d7699fb0 nl80211: add support for 320MHz channel limitation
43  * 31846b657857 cfg80211: add NO-EHT flag to regulatory
44  * ea05fd3581d3 cfg80211: Support configuration of station EHT capabilities
45  *
46  * These definitions were backported to Android Common Kernel 5.15 via:
47  * https://android-review.googlesource.com/c/kernel/common/+/1996261
48  * https://android-review.googlesource.com/c/kernel/common/+/1996262
49  * https://android-review.googlesource.com/c/kernel/common/+/1996263
50  * https://android-review.googlesource.com/c/kernel/common/+/1996264
51  * https://android-review.googlesource.com/c/kernel/common/+/1996265
52  * https://android-review.googlesource.com/c/kernel/common/+/1996266
53  * https://android-review.googlesource.com/c/kernel/common/+/1996267
54  * https://android-review.googlesource.com/c/kernel/common/+/1996268
55  */
56 
57 #if (defined(__ANDROID_COMMON_KERNEL__) && \
58 	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && \
59 	(LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))) || \
60 	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0))
61 #define CFG80211_11BE_BASIC 1
62 #endif
63 
64 /*
65  * CFG80211_SA_QUERY_OFFLOAD_SUPPORT
66  * Used to indicate the Linux Kernel contains support to offload SA Query
67  * procedures for AP SME device
68  *
69  * This feature was introduced in Linux Kernel 5.17 via:
70  * 47301a74bbfa ("nl80211: Add support to set AP settings flags with single attribute")
71  * 87c1aec15dee ("nl80211: Add support to offload SA Query procedures for AP SME device")
72  *
73  * This feature was backported to Android Common Kernel 5.15 via:
74  * https://android-review.googlesource.com/c/kernel/common/+/1958439
75  * https://android-review.googlesource.com/c/kernel/common/+/1958440
76  */
77 
78 #if (defined(__ANDROID_COMMON_KERNEL__) && \
79 	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && \
80 	(LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))) || \
81 	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
82 #define CFG80211_SA_QUERY_OFFLOAD_SUPPORT 1
83 #endif
84 
85 /*
86  * CFG80211_SINGLE_NETDEV_MULTI_LINK_SUPPORT
87  * Used to indicate the Linux Kernel contains support for single netdevice multi
88  * link support.
89  *
90  * This feature was merged into wireless-next via below commits:
91  * 7b0a0e3c3 wifi: cfg80211: do some rework towards MLO link APIs
92  * 0f7594489 wifi: cfg80211: mlme: get BSS entry outside cfg80211_mlme_assoc()
93  * 9ecff10e8 wifi: nl80211: refactor BSS lookup in nl80211_associate()
94  * 0f48b8b88 wifi: ieee80211: add definitions for multi-link element
95  * 325839da9 wifi: cfg80211: simplify cfg80211_mlme_auth() prototype
96  * d648c2302 wifi: nl80211: support MLO in auth/assoc
97  *
98  * This feature was backported to Android Common Kernel 5.15 via:
99  * https://android-review.googlesource.com/c/kernel/common/+/2123895
100  * https://android-review.googlesource.com/c/kernel/common/+/2115618
101  * https://android-review.googlesource.com/c/kernel/common/+/2115620
102  * https://android-review.googlesource.com/c/kernel/common/+/2121347
103  * https://android-review.googlesource.com/c/kernel/common/+/2121348
104  * https://android-review.googlesource.com/c/kernel/common/+/2121349
105  * https://android-review.googlesource.com/c/kernel/common/+/2121350
106  * https://android-review.googlesource.com/c/kernel/common/+/2121351
107  * https://android-review.googlesource.com/c/kernel/common/+/2123452
108  * https://android-review.googlesource.com/c/kernel/common/+/2123454
109  * https://android-review.googlesource.com/c/kernel/common/+/2115621
110  *
111  */
112 #if ((defined(__ANDROID_COMMON_KERNEL__) && \
113 	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && \
114 	(defined  IEEE80211_MLD_MAX_NUM_LINKS)) || \
115 	(LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)))
116 #define CFG80211_SINGLE_NETDEV_MULTI_LINK_SUPPORT 1
117 #endif
118 
119 /**
120  * CFG80211_SAE_AUTH_TA_ADDR_SUPPORT
121  * Used to indicate the Linux Kernel contains support for ML SAE auth with link
122  * address as the transmitter address
123  *
124  * TODO: These changes are currently in internal review once upstreamed and
125  * backported to 5.15 need to add the respective commit-ids
126  */
127 #if (defined(__ANDROID_COMMON_KERNEL__) && \
128 	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && \
129 	(defined  CFG80211_EXTERNAL_AUTH_TA_SUPPORT))
130 #define CFG80211_SAE_AUTH_TA_ADDR_SUPPORT 1
131 #endif
132 
133 /*
134  * CFG80211_MULTI_AKM_CONNECT_SUPPORT
135  * used to indicate the Linux kernel contains support for multi AKM connect
136  * support
137  *
138  * This feature was introduced in Linux Kernel 6.0 via:
139  * ecad3b0b99bf wifi: cfg80211: Increase akm_suites array size in
140  * cfg80211_crypto_settings.
141  */
142 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || \
143 	(defined CFG80211_MAX_NUM_AKM_SUITES))
144 #define CFG80211_MULTI_AKM_CONNECT_SUPPORT 1
145 #endif
146 
147 /*
148  * WLAN_MLD_AP_STA_CONNECT_SUPPORT
149  * Used to indicate Linux Kernel supports ML connection on SAP.
150  */
151 #if (defined(__ANDROID_COMMON_KERNEL__) && \
152 	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && \
153 	(defined CFG80211_MLD_AP_STA_CONNECT_SUPPORT))
154 #define WLAN_MLD_AP_STA_CONNECT_SUPPORT 1
155 #endif
156 
157 /*
158  * WLAN_MLD_AP_OWE_INFO_SUPPORT
159  * Used to indicate Linux Kernel supports ML OWE connection
160  * on SAP
161  */
162 #if (defined(__ANDROID_COMMON_KERNEL__) && \
163 	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && \
164 	(defined CFG80211_MLD_AP_OWE_INFO_SUPPORT))
165 #define WLAN_MLD_AP_OWE_INFO_SUPPORT 1
166 #endif
167 
168 /*
169  * CFG80211_TX_CONTROL_PORT_LINK_SUPPORT
170  * Used to indicate Linux kernel contains support for TX control port from
171  * specific link ID
172  *
173  * This feature was introduced in Linux Kernel 6.0 via:
174  * 9b6bf4d6120a wifi: nl80211: set BSS to NULL if IS_ERR()
175  * 45aaf17c0c34 wifi: nl80211: check MLO support in authenticate
176  * d2bc52498b6b wifi: nl80211: Support MLD parameters in nl80211_set_station()
177  * 67207bab9341 wifi: cfg80211/mac80211: Support control port TX from specific link
178  * 69c3f2d30c35 wifi: nl80211: allow link ID in set_wiphy with frequency
179  * fa2ca639c4e6 wifi: nl80211: advertise MLO support
180  * e3d331c9b620 wifi: cfg80211: set country_elem to NULL
181  * 34d76a14f8f7 wifi: nl80211: reject link specific elements on assoc link
182  * df35f3164ec1 wifi: nl80211: reject fragmented and non-inheritance elements
183  * ff5c4dc4cd78 wifi: nl80211: fix some attribute policy entries
184  * 7464f665158e wifi: cfg80211: add cfg80211_get_iftype_ext_capa()
185  * 8876c67e6296 wifi: nl80211: require MLD address on link STA add/modify
186  * 9dd1953846c7 wifi: nl80211/mac80211: clarify link ID in control port TX
187  * 00b3d8401019 wifi: cfg80211/nl80211: move rx management data into a struct
188  * 6074c9e57471 wifi: cfg80211: report link ID in NL80211_CMD_FRAME
189  * 95f498bb49f7 wifi: nl80211: add MLO link ID to the NL80211_CMD_FRAME TX API
190  * 1e0b3b0b6cb5 wifi: mac80211: Align with Draft P802.11be_D1.5
191  * 062e8e02dfd4 wifi: mac80211: Align with Draft P802.11be_D2.0
192  * d776763f4808 wifi: cfg80211: debugfs: fix return type in ht40allow_map_read()
193  * 64e966d1e84b wifi: cfg80211: fix MCS divisor value
194  * 4e9c3af39820 wifi: nl80211: add EML/MLD capabilities to per-iftype capabilities
195  * 80b0ed70a271 wifi: nl80211: add RX and TX timestamp attributes
196  * ea7d50c925ce wifi: cfg80211: add a function for reporting TX status with hardware timestamps
197  * 1ff715ffa0ec wifi: cfg80211: add hardware timestamps to frame RX info
198  *
199  * This feature was backported to Android Common Kernel 5.15.74 via:
200  * https://android-review.googlesource.com/c/kernel/common/+/2253173
201  * https://android-review.googlesource.com/c/kernel/common/+/2253174
202  * https://android-review.googlesource.com/c/kernel/common/+/2253175
203  * https://android-review.googlesource.com/c/kernel/common/+/2253176
204  * https://android-review.googlesource.com/c/kernel/common/+/2253177
205  * https://android-review.googlesource.com/c/kernel/common/+/2253178
206  * https://android-review.googlesource.com/c/kernel/common/+/2253179
207  * https://android-review.googlesource.com/c/kernel/common/+/2253180
208  * https://android-review.googlesource.com/c/kernel/common/+/2253181
209  * https://android-review.googlesource.com/c/kernel/common/+/2253182
210  * https://android-review.googlesource.com/c/kernel/common/+/2253183
211  * https://android-review.googlesource.com/c/kernel/common/+/2253184
212  * https://android-review.googlesource.com/c/kernel/common/+/2253185
213  * https://android-review.googlesource.com/c/kernel/common/+/2253186
214  * https://android-review.googlesource.com/c/kernel/common/+/2253187
215  * https://android-review.googlesource.com/c/kernel/common/+/2253188
216  * https://android-review.googlesource.com/c/kernel/common/+/2253189
217  * https://android-review.googlesource.com/c/kernel/common/+/2253190
218  * https://android-review.googlesource.com/c/kernel/common/+/2253191
219  * https://android-review.googlesource.com/c/kernel/common/+/2253192
220  * https://android-review.googlesource.com/c/kernel/common/+/2253193
221  * https://android-review.googlesource.com/c/kernel/common/+/2253194
222  * https://android-review.googlesource.com/c/kernel/common/+/2267469
223  * https://android-review.googlesource.com/c/kernel/common/+/2267204
224  * https://android-review.googlesource.com/c/kernel/common/+/2267210
225  */
226 
227 #if (defined(__ANDROID_COMMON_KERNEL__) && \
228 	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 74)) || \
229 	(defined IEEE80211_EHT_OPER_INFO_PRESENT))
230 #define CFG80211_TX_CONTROL_PORT_LINK_SUPPORT 1
231 #endif
232 
233 /*
234  * CFG80211_EXTERNAL_AUTH_MLO_SUPPORT
235  * Used to indicate Linux kernel contains support for ML external auth
236  *
237  * TODO: Corresponding Linux kernel changes are still under wirless-next
238  * will add the commit-ID when available.
239  */
240 /*
241  * TODO: will add this check when available.
242  * #if (defined(__ANDROID_COMMON_KERNEL__) && \
243  *	(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && \
244  *	(defined CFG80211_EXTERNAL_AUTH_MLO_SUPPORT))
245  */
246 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) || \
247 	(defined CFG80211_EXTERNAL_AUTH_MLO_SUPPORT))
248 #define WLAN_EXTERNAL_AUTH_MLO_SUPPORT
249 #endif
250 
251 /*
252  * CFG80211_TID_LINK_MAP_SUPPORT
253  * Used to indicate Linux kernel contains support to get the TID to link map
254  * status and response event.
255  *
256  * TODO: Corresponding Linux kernel support check changes are still under review
257  * will add the commit-ID when available
258  */
259 #if (defined CFG80211_TID_LINK_MAP_SUPPORT)
260 #define WLAN_TID_LINK_MAP_SUPPORT
261 #endif
262 
263 /*
264  * CFG80211_EXT_FEATURE_SECURE_NAN
265  * Used to indicate Linux kernel contains support to secure NAN feature
266  *
267  * This feature was introduced in Linux Kernel 6.4 via:
268  * 9b89495e479c wifi: nl80211: Allow authentication frames and set keys on NAN
269  *                             interface
270  */
271 #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)) || \
272 	(defined CFG80211_EXT_FEATURE_SECURE_NAN))
273 #define WLAN_EXT_FEATURE_SECURE_NAN
274 #endif
275 
276 /*
277  * CFG80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA
278  * Used to indicate Linux kernel contains support to auth and deauth random TA
279  *
280  * This feature was introduced in Linux Kernel 6.4 via:
281  * 6933486133ec wifi: nl80211: Add support for randomizing TA of auth and deauth
282  *                             frames
283  */
284 #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)) || \
285 	(defined CFG80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA))
286 #define WLAN_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA
287 #endif
288 
289 /*
290  * WLAN_MLD_AP_STA_CONNECT_SUPPORT
291  * Used to indicate Linux Upstream Kernel supports ML connection on SAP.
292  *
293  * This feature was introduced in Linux Kernel 6.3 via:
294  * a42e59e: wifi: cfg80211: Extend cfg80211_new_sta() for MLD AP
295  * 8bb588d: wifi: cfg80211: Extend cfg80211_update_owe_info_event() for MLD AP
296  *
297  * This feature was backported to Android Common Kernel 5.15.74 via:
298  * https://android-review.googlesource.com/c/kernel/common/+/2450265
299  * https://android-review.googlesource.com/c/kernel/common/+/2450266
300  *
301  * This feature was backported to Android Common Kernel 6.1 via:
302  * https://android-review.googlesource.com/c/kernel/common/+/2470890
303  * https://android-review.googlesource.com/c/kernel/common/+/2470891
304  */
305 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0) || \
306 	(defined CFG80211_MLD_AP_STA_CONNECT_UPSTREAM_SUPPORT))
307 #define WLAN_MLD_AP_STA_CONNECT_UPSTREAM_SUPPORT 1
308 #endif
309 
310 /*
311  * WLAN_LINK_STA_PARAMS_PRESENT
312  * WLAN_EHT_CAPABILITY_PRESENT
313  *
314  * To deterministically identify where EHT fields are present (whether in
315  * link_sta_params or station_parameters), enable either
316  * WLAN_LINK_STA_PARAMS_PRESENT or WLAN_EHT_CAPABILITY_PRESENT but not both.
317  *
318  * Incase EHT fields are present in link_sta_parameters only define
319  * WLAN_LINK_STA_PARAMS_PRESENT flag.
320  *
321  * If WLAN_LINK_STA_PARAMS_PRESENT is not defined, then EHT cap can be present
322  * in station_parameters structure, in such case WLAN_EHT_CAPABILITY_PRESENT
323  * flag will be defined.
324  *
325  * If both flags are not enabled then kernel is not EHT capable.
326  *
327  * WLAN_LINK_STA_PARAMS_PRESENT
328  * 577e5b8 wifi: cfg80211: add API to add/modify/remove a link station
329  * b95eb7f wifi: cfg80211/mac80211: separate link params from station params
330  *
331  * The changes are backported to ACK from below commits.
332  * https://android-review.googlesource.com/c/kernel/common/+/2227406
333  * https://android-review.googlesource.com/c/kernel/common/+/2227407
334  *
335  * WLAN_EHT_CAPABILITY_PRESENT
336  * ea05fd3 cfg80211: Support configuration of station EHT capabilities
337  *
338  * The changes are backported to ACK from below commit.
339  * https://android-review.googlesource.com/c/kernel/common/+/1996268
340  *
341  */
342 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || \
343 	(defined CFG80211_LINK_STA_PARAMS_PRESENT))
344 #define WLAN_LINK_STA_PARAMS_PRESENT 1
345 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) || \
346 	(defined NL80211_EHT_MIN_CAPABILITY_LEN))
347 #define WLAN_EHT_CAPABILITY_PRESENT 1
348 #endif
349 
350 #endif
351