1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: wlan_hdd_cfg80211.h
22  *
23  * WLAN host device driver cfg80211 functions declaration
24  */
25 
26 #if !defined(HDD_CFG80211_H__)
27 #define HDD_CFG80211_H__
28 
29 #include <wlan_cfg80211_scan.h>
30 #include <wlan_cfg80211.h>
31 #include <wlan_cfg80211_tdls.h>
32 #include <qca_vendor.h>
33 #include <wlan_cfg80211_spectral.h>
34 
35 struct hdd_context;
36 struct wlan_hdd_link_info;
37 
38 #ifdef WLAN_FEATURE_11BE_MLO
39 #define EHT_OPMODE_SUPPORTED 2
40 #else
41 #define EHT_OPMODE_SUPPORTED 1
42 #endif
43 
44 /* QCA_NL80211_VENDOR_SUBCMD_ROAM policy */
45 extern const struct nla_policy wlan_hdd_set_roam_param_policy[
46 			QCA_WLAN_VENDOR_ATTR_ROAMING_PARAM_MAX + 1];
47 
48 /* QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO policy */
49 extern const struct nla_policy qca_wlan_vendor_get_wifi_info_policy[
50 			QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1];
51 
52 /* QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION policy */
53 extern const struct nla_policy wlan_hdd_wifi_config_policy[
54 			QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1];
55 
56 /* QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START policy */
57 extern const struct nla_policy qca_wlan_vendor_wifi_logger_start_policy[
58 			QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1];
59 
60 /* QCA_NL80211_VENDOR_SUBCMD_ND_OFFLOAD policy */
61 extern const struct nla_policy ns_offload_set_policy[
62 			QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_MAX + 1];
63 
64 /* QCA_NL80211_VENDOR_SUBCMD_GET_PREFERRED_FREQ_LIST policy */
65 extern const struct nla_policy get_preferred_freq_list_policy[
66 			QCA_WLAN_VENDOR_ATTR_GET_PREFERRED_FREQ_LIST_MAX + 1];
67 
68 /* QCA_NL80211_VENDOR_SUBCMD_SET_PROBABLE_OPER_CHANNEL policy */
69 extern const struct nla_policy set_probable_oper_channel_policy[
70 			QCA_WLAN_VENDOR_ATTR_PROBABLE_OPER_CHANNEL_MAX + 1];
71 
72 /* QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG policy */
73 extern const struct nla_policy wlan_hdd_set_no_dfs_flag_config_policy[
74 			QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1];
75 
76 /* QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA policy */
77 extern const struct nla_policy qca_wlan_vendor_wifi_logger_get_ring_data_policy[
78 			QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1];
79 
80 /* QCA_NL80211_VENDOR_SUBCMD_OFFLOADED_PACKETS policy */
81 extern const struct nla_policy offloaded_packet_policy[
82 			QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_MAX + 1];
83 
84 /* QCA_NL80211_VENDOR_SUBCMD_SETBAND policy */
85 extern const struct nla_policy setband_policy[QCA_WLAN_VENDOR_ATTR_MAX + 1];
86 
87 /* QCA_NL80211_VENDOR_SUBCMD_ACS_POLICY policy */
88 extern const struct nla_policy wlan_hdd_set_acs_dfs_config_policy[
89 			QCA_WLAN_VENDOR_ATTR_ACS_DFS_MAX + 1];
90 
91 /* QCA_NL80211_VENDOR_SUBCMD_STA_CONNECT_ROAM_POLICY policy */
92 extern const struct nla_policy wlan_hdd_set_sta_roam_config_policy[
93 			QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_MAX + 1];
94 
95 /* QCA_NL80211_VENDOR_SUBCMD_WISA  policy */
96 extern const struct nla_policy wlan_hdd_wisa_cmd_policy[
97 			QCA_WLAN_VENDOR_ATTR_WISA_MAX + 1];
98 
99 /* value for initial part of frames and number of bytes to be compared */
100 #define GAS_INITIAL_REQ "\x04\x0a"
101 #define GAS_INITIAL_REQ_SIZE 2
102 
103 #define GAS_INITIAL_RSP "\x04\x0b"
104 #define GAS_INITIAL_RSP_SIZE 2
105 
106 #define GAS_COMEBACK_REQ "\x04\x0c"
107 #define GAS_COMEBACK_REQ_SIZE 2
108 
109 #define GAS_COMEBACK_RSP "\x04\x0d"
110 #define GAS_COMEBACK_RSP_SIZE 2
111 
112 #define P2P_PUBLIC_ACTION_FRAME "\x04\x09\x50\x6f\x9a\x09"
113 #define P2P_PUBLIC_ACTION_FRAME_SIZE 6
114 
115 #define P2P_ACTION_FRAME "\x7f\x50\x6f\x9a\x09"
116 #define P2P_ACTION_FRAME_SIZE 5
117 
118 #define SA_QUERY_FRAME_REQ "\x08\x00"
119 #define SA_QUERY_FRAME_REQ_SIZE 2
120 
121 #define SA_QUERY_FRAME_RSP "\x08\x01"
122 #define SA_QUERY_FRAME_RSP_SIZE 2
123 
124 #define WNM_BSS_ACTION_FRAME "\x0a\x07"
125 #define WNM_BSS_ACTION_FRAME_SIZE 2
126 
127 #define WNM_NOTIFICATION_FRAME "\x0a\x1a"
128 #define WNM_NOTIFICATION_FRAME_SIZE 2
129 
130 #define WPA_OUI_TYPE   "\x00\x50\xf2\x01"
131 #define DENYLIST_OUI_TYPE   "\x00\x50\x00\x00"
132 #define ALLOWLIST_OUI_TYPE   "\x00\x50\x00\x01"
133 #define WPA_OUI_TYPE_SIZE  4
134 #define WMM_OUI_TYPE   "\x00\x50\xf2\x02\x01"
135 #define WMM_OUI_TYPE_SIZE  5
136 
137 #define VENDOR1_AP_OUI_TYPE "\x00\xE0\x4C"
138 #define VENDOR1_AP_OUI_TYPE_SIZE 3
139 
140 #define BASIC_RATE_MASK   0x80
141 #define RATE_MASK         0x7f
142 
143 #ifndef NL80211_AUTHTYPE_FILS_SK
144 #define NL80211_AUTHTYPE_FILS_SK 5
145 #endif
146 #ifndef NL80211_AUTHTYPE_FILS_SK_PFS
147 #define NL80211_AUTHTYPE_FILS_SK_PFS 6
148 #endif
149 #ifndef NL80211_AUTHTYPE_FILS_PK
150 #define NL80211_AUTHTYPE_FILS_PK 7
151 #endif
152 #ifndef WLAN_AKM_SUITE_FILS_SHA256
153 #define WLAN_AKM_SUITE_FILS_SHA256 0x000FAC0E
154 #endif
155 #ifndef WLAN_AKM_SUITE_FILS_SHA384
156 #define WLAN_AKM_SUITE_FILS_SHA384 0x000FAC0F
157 #endif
158 #ifndef WLAN_AKM_SUITE_FT_FILS_SHA256
159 #define WLAN_AKM_SUITE_FT_FILS_SHA256 0x000FAC10
160 #endif
161 #ifndef WLAN_AKM_SUITE_FT_FILS_SHA384
162 #define WLAN_AKM_SUITE_FT_FILS_SHA384 0x000FAC11
163 #endif
164 #ifndef WLAN_AKM_SUITE_DPP_RSN
165 #define WLAN_AKM_SUITE_DPP_RSN 0x506f9a02
166 #endif
167 
168 #ifndef WLAN_AKM_SUITE_OWE
169 #define WLAN_AKM_SUITE_OWE 0x000FAC12
170 #endif
171 
172 #ifndef WLAN_AKM_SUITE_EAP_SHA256
173 #define WLAN_AKM_SUITE_EAP_SHA256 0x000FAC0B
174 #endif
175 
176 #ifndef WLAN_AKM_SUITE_EAP_SHA384
177 #define WLAN_AKM_SUITE_EAP_SHA384 0x000FAC0C
178 #endif
179 
180 #ifndef WLAN_AKM_SUITE_SAE
181 #define WLAN_AKM_SUITE_SAE 0x000FAC08
182 #endif
183 
184 #ifndef WLAN_AKM_SUITE_FT_SAE
185 #define WLAN_AKM_SUITE_FT_SAE 0x000FAC09
186 #endif
187 
188 #ifndef WLAN_AKM_SUITE_FT_EAP_SHA_384
189 #define WLAN_AKM_SUITE_FT_EAP_SHA_384 0x000FAC0D
190 #endif
191 
192 #ifndef WLAN_AKM_SUITE_SAE_EXT_KEY
193 #define WLAN_AKM_SUITE_SAE_EXT_KEY 0x000FAC18
194 #endif
195 
196 #ifndef WLAN_AKM_SUITE_FT_SAE_EXT_KEY
197 #define WLAN_AKM_SUITE_FT_SAE_EXT_KEY 0x000FAC19
198 #endif
199 
200 #ifdef FEATURE_WLAN_TDLS
201 #define WLAN_IS_TDLS_SETUP_ACTION(action) \
202 	((TDLS_SETUP_REQUEST <= action) && \
203 	(TDLS_SETUP_CONFIRM >= action))
204 #if !defined(TDLS_MGMT_VERSION2)
205 #define TDLS_MGMT_VERSION2 0
206 #endif
207 
208 #endif
209 
210 #define HDD_SET_BIT(__param, __val)    ((__param) |= (1 << (__val)))
211 
212 #define MAX_SCAN_SSID 10
213 
214 #define IS_CHANNEL_VALID(channel) ((channel >= 0 && channel < 15) \
215 			|| (channel >= 36 && channel <= 184))
216 
217 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) \
218 	|| defined(BACKPORTED_CHANNEL_SWITCH_PRESENT)
219 #define CHANNEL_SWITCH_SUPPORTED
220 #endif
221 
222 #if defined(CFG80211_DEL_STA_V2) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) || defined(WITH_BACKPORTS)
223 #define USE_CFG80211_DEL_STA_V2
224 #endif
225 
226 /**
227  * typedef eDFS_CAC_STATUS - CAC status
228  *
229  * @DFS_CAC_NEVER_DONE: CAC never done
230  * @DFS_CAC_IN_PROGRESS: CAC is in progress
231  * @DFS_CAC_ALREADY_DONE: CAC already done
232  */
233 typedef enum {
234 	DFS_CAC_NEVER_DONE,
235 	DFS_CAC_IN_PROGRESS,
236 	DFS_CAC_ALREADY_DONE,
237 } eDFS_CAC_STATUS;
238 
239 #define MAX_REQUEST_ID			0xFFFFFFFF
240 
241 /* Feature defines */
242 #define WIFI_FEATURE_INFRA              0x0001  /* Basic infrastructure mode */
243 #define WIFI_FEATURE_INFRA_5G           0x0002  /* Support for 5 GHz Band */
244 #define WIFI_FEATURE_HOTSPOT            0x0004  /* Support for GAS/ANQP */
245 #define WIFI_FEATURE_P2P                0x0008  /* Wifi-Direct */
246 #define WIFI_FEATURE_SOFT_AP            0x0010  /* Soft AP */
247 #define WIFI_FEATURE_EXTSCAN            0x0020  /* Extended Scan APIs */
248 #define WIFI_FEATURE_NAN                0x0040  /* Neighbor Awareness
249 						 * Networking
250 						 */
251 #define WIFI_FEATURE_D2D_RTT		0x0080  /* Device-to-device RTT */
252 #define WIFI_FEATURE_D2AP_RTT           0x0100  /* Device-to-AP RTT */
253 #define WIFI_FEATURE_BATCH_SCAN         0x0200  /* Batched Scan (legacy) */
254 #define WIFI_FEATURE_PNO                0x0400  /* Preferred network offload */
255 #define WIFI_FEATURE_ADDITIONAL_STA     0x0800  /* Support for two STAs */
256 #define WIFI_FEATURE_TDLS               0x1000  /* Tunnel directed link
257 						 * setup
258 						 */
259 #define WIFI_FEATURE_TDLS_OFFCHANNEL	0x2000  /* Support for TDLS off
260 						 * channel
261 						 */
262 #define WIFI_FEATURE_EPR                0x4000  /* Enhanced power reporting */
263 #define WIFI_FEATURE_AP_STA             0x8000  /* Support for AP STA
264 						 * Concurrency
265 						 */
266 #define WIFI_FEATURE_LINK_LAYER_STATS   0x10000  /* Link layer stats */
267 #define WIFI_FEATURE_LOGGER             0x20000  /* WiFi Logger */
268 #define WIFI_FEATURE_HAL_EPNO           0x40000  /* WiFi PNO enhanced */
269 #define WIFI_FEATURE_RSSI_MONITOR       0x80000  /* RSSI Monitor */
270 #define WIFI_FEATURE_MKEEP_ALIVE        0x100000  /* WiFi mkeep_alive */
271 #define WIFI_FEATURE_CONFIG_NDO         0x200000  /* ND offload configure */
272 #define WIFI_FEATURE_TX_TRANSMIT_POWER  0x400000  /* Tx transmit power levels */
273 #define WIFI_FEATURE_CONTROL_ROAMING    0x800000  /* Enable/Disable roaming */
274 #define WIFI_FEATURE_IE_ALLOWLIST       0x1000000 /* Support Probe IE allow
275 						   * listing
276 						   */
277 #define WIFI_FEATURE_SCAN_RAND          0x2000000 /* Support MAC & Probe Sequence Number randomization */
278 #define WIFI_FEATURE_SET_LATENCY_MODE   0x40000000 /* Set latency mode */
279 /* Support changing MAC address without iface reset(down and up) */
280 #define WIFI_FEATURE_DYNAMIC_SET_MAC    0x10000000
281 
282 /* Support Tx Power Limit setting */
283 #define WIFI_FEATURE_SET_TX_POWER_LIMIT 0x4000000
284 
285 /* Add more features here */
286 #define WIFI_TDLS_SUPPORT			BIT(0)
287 #define WIFI_TDLS_EXTERNAL_CONTROL_SUPPORT	BIT(1)
288 #define WIFI_TDLS_OFFCHANNEL_SUPPORT		BIT(2)
289 #define WIFI_TDLS_WIDER_BW_SUPPORT		BIT(3)
290 
291 #define CFG_NON_AGG_RETRY_MAX                  (64)
292 #define CFG_AGG_RETRY_MAX                      (64)
293 #define CFG_CTRL_RETRY_MAX                     (31)
294 #define CFG_PROPAGATION_DELAY_MAX              (63)
295 #define CFG_PROPAGATION_DELAY_BASE             (64)
296 #define CFG_AGG_RETRY_MIN                      (5)
297 #define CFG_NON_AGG_RETRY_MIN                  (5)
298 
299 #define CFG_NO_SUPPORT_UL_MUMIMO		(0)
300 #define CFG_FULL_BW_SUPPORT_UL_MUMIMO		(1)
301 #define CFG_PARTIAL_BW_SUPPORT_UL_MUMIMO	(2)
302 #define CFG_FULL_PARTIAL_BW_SUPPORT_UL_MUMIMO	(3)
303 
304 #define PCL_CHANNEL_SUPPORT_GO			BIT(0)
305 #define PCL_CHANNEL_SUPPORT_CLI			BIT(1)
306 #define PCL_CHANNEL_EXCLUDE_IN_GO_NEG		BIT(3)
307 
308 #define CONNECTIVITY_CHECK_SET_ARP \
309 	QCA_WLAN_VENDOR_CONNECTIVITY_CHECK_SET_ARP
310 #define CONNECTIVITY_CHECK_SET_DNS \
311 	QCA_WLAN_VENDOR_CONNECTIVITY_CHECK_SET_DNS
312 #define CONNECTIVITY_CHECK_SET_TCP_HANDSHAKE \
313 	QCA_WLAN_VENDOR_CONNECTIVITY_CHECK_SET_TCP_HANDSHAKE
314 #define CONNECTIVITY_CHECK_SET_ICMPV4 \
315 	QCA_WLAN_VENDOR_CONNECTIVITY_CHECK_SET_ICMPV4
316 #define CONNECTIVITY_CHECK_SET_ICMPV6 \
317 	QCA_WLAN_VENDOR_CONNECTIVITY_CHECK_SET_ICMPV6
318 #define CONNECTIVITY_CHECK_SET_TCP_SYN \
319 	QCA_WLAN_VENDOR_CONNECTIVITY_CHECK_SET_TCP_SYN
320 #define CONNECTIVITY_CHECK_SET_TCP_SYN_ACK \
321 	QCA_WLAN_VENDOR_CONNECTIVITY_CHECK_SET_TCP_SYN_ACK
322 #define CONNECTIVITY_CHECK_SET_TCP_ACK \
323 	QCA_WLAN_VENDOR_CONNECTIVITY_CHECK_SET_TCP_ACK
324 
325 extern const struct nla_policy
326 wlan_hdd_wifi_test_config_policy[
327 	QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_MAX + 1];
328 
329 #define RSNXE_DEFAULT 0
330 #define RSNXE_OVERRIDE_1 1
331 #define RSNXE_OVERRIDE_2 2
332 #define CSA_DEFAULT 0
333 #define CSA_IGNORE 1
334 #define SA_QUERY_TIMEOUT_DEFAULT 0
335 #define SA_QUERY_TIMEOUT_IGNORE 1
336 #define FILS_DISCV_FRAMES_DISABLE 0
337 #define FILS_DISCV_FRAMES_ENABLE 1
338 #define H2E_RSNXE_DEFAULT 0
339 #define H2E_RSNXE_IGNORE 1
340 
341 #define FEATURE_VENDOR_SUBCMD_WIFI_TEST_CONFIGURATION                    \
342 {                                                                        \
343 	.info.vendor_id = QCA_NL80211_VENDOR_ID,                         \
344 	.info.subcmd =                                                   \
345 		QCA_NL80211_VENDOR_SUBCMD_WIFI_TEST_CONFIGURATION,       \
346 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |                            \
347 		WIPHY_VENDOR_CMD_NEED_NETDEV |                           \
348 		WIPHY_VENDOR_CMD_NEED_RUNNING,                           \
349 	.doit = wlan_hdd_cfg80211_set_wifi_test_config,                  \
350 	vendor_command_policy(wlan_hdd_wifi_test_config_policy,          \
351 			      QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_MAX) \
352 },
353 
354 extern const struct nla_policy
355 	qca_wlan_vendor_set_nud_stats_policy
356 	[QCA_ATTR_NUD_STATS_SET_MAX + 1];
357 
358 #define FEATURE_VENDOR_SUBCMD_NUD_STATS_SET				    \
359 {									    \
360 		.info.vendor_id = QCA_NL80211_VENDOR_ID,		    \
361 		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_SET,     \
362 		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |			    \
363 			WIPHY_VENDOR_CMD_NEED_NETDEV |			    \
364 			WIPHY_VENDOR_CMD_NEED_RUNNING,			    \
365 		.doit = wlan_hdd_cfg80211_set_nud_stats,		    \
366 		vendor_command_policy(qca_wlan_vendor_set_nud_stats_policy, \
367 				      QCA_ATTR_NUD_STATS_SET_MAX)	    \
368 },
369 
370 extern const struct nla_policy
371 	qca_wlan_vendor_set_trace_level_policy
372 	[QCA_WLAN_VENDOR_ATTR_SET_TRACE_LEVEL_MAX + 1];
373 
374 #define FEATURE_VENDOR_SUBCMD_SET_TRACE_LEVEL				\
375 {									\
376 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			\
377 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_TRACE_LEVEL,	\
378 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				\
379 		 WIPHY_VENDOR_CMD_NEED_NETDEV |				\
380 		 WIPHY_VENDOR_CMD_NEED_RUNNING,				\
381 	.doit = wlan_hdd_cfg80211_set_trace_level,			\
382 	vendor_command_policy(qca_wlan_vendor_set_trace_level_policy,	\
383 			      QCA_WLAN_VENDOR_ATTR_SET_TRACE_LEVEL_MAX)	\
384 },
385 
386 /**
387  * hdd_cfg80211_wiphy_alloc() - Allocate wiphy
388  *
389  * Allocate wiphy and hdd context.
390  *
391  * Return: hdd context on success and NULL on failure.
392  */
393 struct hdd_context *hdd_cfg80211_wiphy_alloc(void);
394 
395 int wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
396 			   struct cfg80211_scan_request *request);
397 
398 int wlan_hdd_cfg80211_init(struct device *dev,
399 			   struct wiphy *wiphy, struct hdd_config *config);
400 
401 void wlan_hdd_cfg80211_deinit(struct wiphy *wiphy);
402 
403 void wlan_hdd_update_wiphy(struct hdd_context *hdd_ctx);
404 
405 void wlan_hdd_update_11n_mode(struct hdd_context *hdd_ctx);
406 
407 /**
408  * wlan_hdd_update_wiphy_supported_band() - Updates wiphy band info when
409  * receive FW ready event
410  * @hdd_ctx: HDD context
411  *
412  * Updates wiphy band info
413  *
414  * Return: QDF Status
415  */
416 QDF_STATUS wlan_hdd_update_wiphy_supported_band(struct hdd_context *hdd_ctx);
417 
418 int wlan_hdd_cfg80211_register(struct wiphy *wiphy);
419 
420 /**
421  * wlan_hdd_cfg80211_register_frames() - register frame types and callbacks
422  * with the PE.
423  * @adapter: pointer to adapter
424  *
425  * This function is used by HDD to register frame types which are interested
426  * by supplicant, callbacks for rx frame indication and ack.
427  *
428  * Return: 0 on success and non zero value on failure
429  */
430 int wlan_hdd_cfg80211_register_frames(struct hdd_adapter *adapter);
431 
432 void wlan_hdd_cfg80211_deregister_frames(struct hdd_adapter *adapter);
433 
434 void hdd_reg_notifier(struct wiphy *wiphy,
435 				 struct regulatory_request *request);
436 
437 /*
438  * FUNCTION: wlan_hdd_validate_operation_channel
439  * called by wlan_hdd_cfg80211_start_bss() and
440  * wlan_hdd_set_channel()
441  * @hdd_ctx: Global HDD context
442  *
443  * This function validates whether given channel is part of valid
444  * channel list.
445  */
446 QDF_STATUS wlan_hdd_validate_operation_channel(struct hdd_context *hdd_ctx,
447 					       uint32_t ch_freq);
448 
449 /**
450  * hdd_select_cbmode() - select channel bonding mode
451  * @adapter: Pointer to adapter
452  * @oper_freq: Operating frequency (MHz)
453  * @sec_ch_2g_freq: secondary channel freq
454  * @ch_params: channel info struct to populate
455  *
456  * Return: none
457  */
458 void hdd_select_cbmode(struct hdd_adapter *adapter, qdf_freq_t oper_freq,
459 		       qdf_freq_t sec_ch_2g_freq, struct ch_params *ch_params);
460 
461 /**
462  * wlan_hdd_is_ap_supports_immediate_power_save() - to find certain vendor APs
463  *				which do not support immediate power-save.
464  * @ies: beacon IE of the AP which STA is connecting/connected to
465  * @length: beacon IE length only
466  *
467  * This API takes the IE of connected/connecting AP and determines that
468  * whether it has specific vendor OUI. If it finds then it will return false to
469  * notify that AP doesn't support immediate power-save.
470  *
471  * Return: true or false based on findings
472  */
473 bool wlan_hdd_is_ap_supports_immediate_power_save(uint8_t *ies, int length);
474 
475 /**
476  * wlan_hdd_del_station() - delete station wrapper
477  * @adapter: pointer to the hdd adapter
478  * @mac: pointer to mac addr
479  *
480  * Return: Errno
481  */
482 int wlan_hdd_del_station(struct hdd_adapter *adapter, const uint8_t *mac);
483 
484 #if defined(USE_CFG80211_DEL_STA_V2)
485 int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
486 				  struct net_device *dev,
487 				  struct station_del_parameters *param);
488 #else
489 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
490 int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
491 				  struct net_device *dev,
492 				  const uint8_t *mac);
493 #else
494 int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
495 				  struct net_device *dev,
496 				  uint8_t *mac);
497 #endif
498 #endif /* USE_CFG80211_DEL_STA_V2 */
499 
500 int wlan_hdd_send_avoid_freq_event(struct hdd_context *hdd_ctx,
501 				   struct ch_avoid_ind_type *avoid_freq_list);
502 
503 /**
504  * wlan_hdd_send_hang_reason_event() - Send hang reason to the userspace
505  * @hdd_ctx: Pointer to hdd context
506  * @reason: cds recovery reason
507  * @data: Hang Data
508  * @data_len: Hang Data len
509  *
510  * Return: 0 on success or failure reason
511  */
512 int wlan_hdd_send_hang_reason_event(struct hdd_context *hdd_ctx,
513 				    uint32_t reason, uint8_t *data,
514 				    size_t data_len);
515 
516 int wlan_hdd_send_avoid_freq_for_dnbs(struct hdd_context *hdd_ctx,
517 				      qdf_freq_t op_freq);
518 
519 /**
520  * wlan_hdd_rso_cmd_status_cb() - HDD callback to read RSO command status
521  * @hdd_handle: opaque handle for the hdd context
522  * @rso_status: rso command status
523  *
524  * This callback function is invoked by firmware to update
525  * the RSO(ROAM SCAN OFFLOAD) command status.
526  *
527  * Return: None
528  */
529 void wlan_hdd_rso_cmd_status_cb(hdd_handle_t hdd_handle,
530 				struct rso_cmd_status *rso_status);
531 
532 /**
533  * wlan_hdd_cfg80211_acs_ch_select_evt: Callback function for ACS evt
534  * @link_info: Link info pointer in HDD adapter
535  * @store_acs_freq: Store current ACS frequecy flag
536  *
537  * This is a callback function on ACS procedure is completed.
538  * This function send the ACS selected channel information to hostapd
539  *
540  * Return: None
541  */
542 void wlan_hdd_cfg80211_acs_ch_select_evt(struct wlan_hdd_link_info *link_info,
543 					 bool store_acs_freq);
544 
545 #ifdef WLAN_CFR_ENABLE
546 /*
547  * hdd_cfr_data_send_nl_event() - send cfr data through nl event
548  * @vdev_id: vdev id
549  * @pid: process pid to which send data event unicast way
550  * @data: pointer to the cfr data
551  * @data_len: length of data
552  *
553  * Return: void
554  */
555 void hdd_cfr_data_send_nl_event(uint8_t vdev_id, uint32_t pid,
556 				const void *data, uint32_t data_len);
557 
558 #define FEATURE_CFR_DATA_VENDOR_EVENTS                                  \
559 [QCA_NL80211_VENDOR_SUBCMD_PEER_CFR_CAPTURE_CFG_INDEX] = {              \
560         .vendor_id = QCA_NL80211_VENDOR_ID,                             \
561         .subcmd = QCA_NL80211_VENDOR_SUBCMD_PEER_CFR_CAPTURE_CFG,       \
562 },
563 #else
564 #define FEATURE_CFR_DATA_VENDOR_EVENTS
565 #endif
566 
567 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
568 /**
569  * hdd_send_roam_scan_ch_list_event() - roam scan ch list event to user space
570  * @hdd_ctx: HDD context
571  * @vdev_id: vdev id
572  * @buf_len: length of frequency list
573  * @buf: pointer to buffer of frequency list
574  *
575  * Return: None
576  */
577 void hdd_send_roam_scan_ch_list_event(struct hdd_context *hdd_ctx,
578 				      uint8_t vdev_id, uint16_t buf_len,
579 				      uint8_t *buf);
580 #else
581 static inline
hdd_send_roam_scan_ch_list_event(struct hdd_context * hdd_ctx,uint8_t vdev_id,uint16_t buf_len,uint8_t * buf)582 void hdd_send_roam_scan_ch_list_event(struct hdd_context *hdd_ctx,
583 				      uint8_t vdev_id, uint16_t buf_len,
584 				      uint8_t *buf)
585 {
586 }
587 #endif
588 
589 /**
590  * wlan_hdd_cfg80211_update_apies() - update ap mode ies
591  * @link_info: Link info pointer in hostapd adapter
592  *
593  * Return: 0 for success non-zero for failure
594  */
595 int wlan_hdd_cfg80211_update_apies(struct wlan_hdd_link_info *link_info);
596 
597 int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter);
598 
599 int wlan_hdd_enable_dfs_chan_scan(struct hdd_context *hdd_ctx,
600 				  bool enable_dfs_channels);
601 
602 /**
603  * wlan_hdd_cfg80211_update_band() - Update band of operation
604  * @hdd_ctx: The global HDD context
605  * @wiphy: The wiphy being configured
606  * @new_band: The new bad of operation
607  *
608  * This function is called from the supplicant through a
609  * private ioctl to change the band value
610  *
611  * Return: 0 on success, else a negative errno if the operation could
612  *         not be completed
613  */
614 int wlan_hdd_cfg80211_update_band(struct hdd_context *hdd_ctx,
615 				  struct wiphy *wiphy,
616 				  enum band_info new_band);
617 
618 /**
619  * wlan_hdd_change_hw_mode_for_given_chnl() - change HW mode for given channel
620  * @adapter: pointer to adapter
621  * @chan_freq: given channel frequency
622  * @reason: reason for HW mode change is needed
623  *
624  * This API decides and sets hardware mode to DBS based on given channel.
625  * For example, some of the platforms require DBS hardware mode to operate
626  * in 2.4G channel
627  *
628  * Return: 0 for success and non-zero for failure
629  */
630 int wlan_hdd_change_hw_mode_for_given_chnl(struct hdd_adapter *adapter,
631 					   uint32_t chan_freq,
632 					   enum policy_mgr_conn_update_reason reason);
633 
634 /**
635  * enum hdd_rate_info_bw: an HDD internal rate bandwidth representation
636  * @HDD_RATE_BW_5: 5MHz
637  * @HDD_RATE_BW_10: 10MHz
638  * @HDD_RATE_BW_20: 20MHz
639  * @HDD_RATE_BW_40: 40MHz
640  * @HDD_RATE_BW_80: 80MHz
641  * @HDD_RATE_BW_160: 160 MHz
642  * @HDD_RATE_BW_320: 320 MHz
643  */
644 enum hdd_rate_info_bw {
645 	HDD_RATE_BW_5,
646 	HDD_RATE_BW_10,
647 	HDD_RATE_BW_20,
648 	HDD_RATE_BW_40,
649 	HDD_RATE_BW_80,
650 	HDD_RATE_BW_160,
651 	HDD_RATE_BW_320,
652 };
653 
654 /**
655  * enum hdd_chain_mode : Representation of Number of chains available.
656  * @HDD_CHAIN_MODE_1X1: Chain mask Not Configurable as only one chain available
657  * @HDD_CHAIN_MODE_2X2: Chain mask configurable as both chains available
658  */
659 enum hdd_chain_mode {
660 	HDD_CHAIN_MODE_1X1 = 1,
661 	HDD_CHAIN_MODE_2X2 = 3,
662 };
663 
664 /**
665  * enum hdd_ba_mode: Representation of Number to configure BA mode
666  * @HDD_BA_MODE_AUTO: Auto mode
667  * @HDD_BA_MODE_MANUAL: Manual mode
668  * @HDD_BA_MODE_64: For buffer size 64
669  * @HDD_BA_MODE_256: For buffer size 256
670  * @HDD_BA_MODE_128: placeholder, not valid
671  * @HDD_BA_MODE_512: For buffer size 512
672  * @HDD_BA_MODE_1024: For buffer size 1024
673  */
674 enum hdd_ba_mode {
675 	HDD_BA_MODE_AUTO,
676 	HDD_BA_MODE_MANUAL,
677 	HDD_BA_MODE_64,
678 	HDD_BA_MODE_256,
679 	HDD_BA_MODE_128,
680 	HDD_BA_MODE_512,
681 	HDD_BA_MODE_1024,
682 };
683 
684 /**
685  * hdd_set_rate_bw(): Set the bandwidth for the given rate_info
686  * @info: The rate info for which the bandwidth should be set
687  * @hdd_bw: HDD representation of a rate info bandwidth
688  */
689 void hdd_set_rate_bw(struct rate_info *info, enum hdd_rate_info_bw hdd_bw);
690 
691 /*
692  * hdd_get_sap_operating_band_by_link_info: Get operating channel of link info
693  * for sap.
694  * @link_info: Pointer to link_info in adapter
695  *
696  * Return : Corresponding band for SAP operating channel
697  */
698 
699 uint8_t
700 hdd_get_sap_operating_band_by_link_info(struct wlan_hdd_link_info *link_info);
701 
702 /*
703  * hdd_get_sap_operating_band:  Get current operating channel
704  * for sap.
705  * @hdd_ctx: hdd context
706  *
707  * Return : Corresponding band for SAP operating channel
708  */
709 uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx);
710 
711 /**
712  * wlan_hdd_merge_avoid_freqs(): Merge two tHddAvoidFreqList
713  * @destFreqList: Destination list in which merged frequency
714  * list will be available.
715  * @srcFreqList: Source frequency list.
716  *
717  * Merges two avoid_frequency lists
718  */
719 int wlan_hdd_merge_avoid_freqs(struct ch_avoid_ind_type *destFreqList,
720 		struct ch_avoid_ind_type *srcFreqList);
721 
722 
723 /**
724  * hdd_bt_activity_cb() - callback function to receive bt activity
725  * @hdd_handle: Opaque handle to the HDD context
726  * @bt_activity: specifies the kind of bt activity
727  *
728  * Return: none
729  */
730 void hdd_bt_activity_cb(hdd_handle_t hdd_handle, uint32_t bt_activity);
731 
732 #ifdef WLAN_FEATURE_GTK_OFFLOAD
733 /**
734  * wlan_hdd_save_gtk_offload_params() - Save gtk offload parameters in STA
735  *                                      context for offload operations.
736  * @adapter: Adapter context
737  * @kck_ptr: KCK buffer pointer
738  * @kck_len: KCK length
739  * @kek_ptr: KEK buffer pointer
740  * @kek_len: KEK length
741  * @replay_ctr: Pointer to 64 bit long replay counter
742  * @big_endian: true if replay_ctr is in big endian format
743  *
744  * Return: None
745  */
746 void wlan_hdd_save_gtk_offload_params(struct hdd_adapter *adapter,
747 				      uint8_t *kck_ptr, uint8_t  kck_len,
748 				      uint8_t *kek_ptr, uint32_t kek_len,
749 				      uint8_t *replay_ctr, bool big_endian);
750 #else
wlan_hdd_save_gtk_offload_params(struct hdd_adapter * adapter,uint8_t * kck_ptr,uint8_t kck_len,uint8_t * kek_ptr,uint32_t kek_len,uint8_t * replay_ctr,bool big_endian)751 void wlan_hdd_save_gtk_offload_params(struct hdd_adapter *adapter,
752 				      uint8_t *kck_ptr, uint8_t kck_len,
753 				      uint8_t *kek_ptr, uint32_t kek_len,
754 				      uint8_t *replay_ctr, bool big_endian)
755 {}
756 #endif
757 
758 
759 /**
760  * wlan_hdd_flush_pmksa_cache() - flush pmksa cache for adapter
761  * @link_info: link_info pointer in adapter
762  *
763  * Return: qdf status
764  */
765 QDF_STATUS wlan_hdd_flush_pmksa_cache(struct wlan_hdd_link_info *link_info);
766 
767 /*
768  * wlan_hdd_send_mode_change_event() - API to send hw mode change event to
769  * userspace
770  *
771  * Return : 0 on success and errno on failure
772  */
773 int wlan_hdd_send_mode_change_event(void);
774 
775 /**
776  * wlan_hdd_restore_channels() - Restore the channels which were cached
777  * and disabled in wlan_hdd_disable_channels api.
778  * @hdd_ctx: Pointer to the HDD context
779  *
780  * Return: 0 on success, Error code on failure
781  */
782 int wlan_hdd_restore_channels(struct hdd_context *hdd_ctx);
783 
784 /*
785  * wlan_hdd_send_sta_authorized_event: Function to send station authorized
786  * event to user space in case of SAP
787  * @adapter: Pointer to the adapter
788  * @hdd_ctx: HDD Context
789  * @mac_addr: MAC address of the STA for which the Authorized event needs to
790  * be sent
791  * This api is used to send station authorized event to user space
792  */
793 QDF_STATUS wlan_hdd_send_sta_authorized_event(
794 					struct hdd_adapter *adapter,
795 					struct hdd_context *hdd_ctx,
796 					const struct qdf_mac_addr *mac_addr);
797 
798 /**
799  * hdd_set_dynamic_antenna_mode() - set dynamic antenna mode
800  * @link_info: Link info pointer in HDD adapter
801  * @num_rx_chains: number of chains to be used for receiving data
802  * @num_tx_chains: number of chains to be used for transmitting data
803  *
804  * This function will set dynamic antenna mode
805  *
806  * Return: 0 for success
807  */
808 int hdd_set_dynamic_antenna_mode(struct wlan_hdd_link_info *link_info,
809 				 uint8_t num_rx_chains, uint8_t num_tx_chains);
810 
811 #ifdef MULTI_CLIENT_LL_SUPPORT
812 /**
813  * hdd_get_multi_client_ll_support() - get multi client ll support flag
814  * @adapter: hdd adapter
815  *
816  * Return: none
817  */
818 bool hdd_get_multi_client_ll_support(struct hdd_adapter *adapter);
819 
820 /**
821  * wlan_hdd_set_wlm_client_latency_level() - Set latency level to FW
822  * @adapter: pointer to network adapter
823  * @port_id: port id for which host sends latency level to FW
824  * @latency_level: level to be set in fw
825  *
826  * Return: QDF_STATUS
827  */
828 QDF_STATUS wlan_hdd_set_wlm_client_latency_level(struct hdd_adapter *adapter,
829 						 uint32_t port_id,
830 						 uint16_t latency_level);
831 
832 /**
833  * wlan_hdd_set_wlm_latency_level() - Set latency level to FW
834  * @adapter: pointer to network adapter
835  * @latency_level: level to be set in fw
836  * @client_id_bitmap: client id bitmap
837  * @force_reset: flag to reset latency level in fw
838  *
839  * Return: QDF_STATUS
840  */
841 QDF_STATUS wlan_hdd_set_wlm_latency_level(struct hdd_adapter *adapter,
842 					  uint16_t latency_level,
843 					  uint32_t client_id_bitmap,
844 					  bool force_reset);
845 
846 /**
847  * wlan_hdd_get_set_client_info_id() - to update client info table
848  * @adapter: pointer to network adapter
849  * @port_id: port id for which host receives set latency level vendor command
850  * @client_id: client id for a given port id
851  *
852  * Return: QDF_STATUS
853  */
854 QDF_STATUS wlan_hdd_get_set_client_info_id(struct hdd_adapter *adapter,
855 					   uint32_t port_id,
856 					   uint32_t *client_id);
857 
858 /**
859  * wlan_hdd_get_client_id_bitmap() - to calculate client id bitmap
860  * @adapter: pointer to network adapter
861  *
862  * Return: client id bitmap
863  */
864 uint8_t wlan_hdd_get_client_id_bitmap(struct hdd_adapter *adapter);
865 
866 /**
867  * hdd_latency_level_event_handler_cb() - Function to be invoked for low latency
868  * event
869  * @event_data: event data
870  * @vdev_id: vdev id
871  *
872  * Return: none
873  */
874 void
875 hdd_latency_level_event_handler_cb(const struct latency_level_data *event_data,
876 				   uint8_t vdev_id);
877 #else
878 static inline
wlan_hdd_set_wlm_client_latency_level(struct hdd_adapter * adapter,uint32_t port_id,uint16_t latency_level)879 QDF_STATUS wlan_hdd_set_wlm_client_latency_level(struct hdd_adapter *adapter,
880 						 uint32_t port_id,
881 						 uint16_t latency_level)
882 {
883 	return QDF_STATUS_E_FAILURE;
884 }
885 
886 static inline
wlan_hdd_set_wlm_latency_level(struct hdd_adapter * adapter,uint16_t latency_level,uint32_t client_id_bitmap,bool force_reset)887 QDF_STATUS wlan_hdd_set_wlm_latency_level(struct hdd_adapter *adapter,
888 					  uint16_t latency_level,
889 					  uint32_t client_id_bitmap,
890 					  bool force_reset)
891 {
892 	return QDF_STATUS_E_FAILURE;
893 }
894 
wlan_hdd_get_client_id_bitmap(struct hdd_adapter * adapter)895 static inline uint8_t wlan_hdd_get_client_id_bitmap(struct hdd_adapter *adapter)
896 {
897 	return 0;
898 }
899 
900 static inline
wlan_hdd_get_set_client_info_id(struct hdd_adapter * adapter,uint32_t port_id,uint32_t * client_id)901 QDF_STATUS wlan_hdd_get_set_client_info_id(struct hdd_adapter *adapter,
902 					   uint32_t port_id,
903 					   uint32_t *client_id)
904 {
905 	return QDF_STATUS_E_FAILURE;
906 }
907 
hdd_get_multi_client_ll_support(struct hdd_adapter * adapter)908 static inline bool hdd_get_multi_client_ll_support(struct hdd_adapter *adapter)
909 {
910 	return false;
911 }
912 
913 static inline void
hdd_latency_level_event_handler_cb(const void * event_data,uint8_t vdev_id)914 hdd_latency_level_event_handler_cb(const void *event_data,
915 				   uint8_t vdev_id)
916 {
917 }
918 #endif
919 
920 /**
921  * hdd_convert_cfgdot11mode_to_80211mode() - Function to convert cfg dot11 mode
922  *  to 80211 mode
923  * @mode: cfg dot11 mode
924  *
925  * Return: 80211 mode
926  */
927 enum qca_wlan_802_11_mode
928 hdd_convert_cfgdot11mode_to_80211mode(enum csr_cfgdot11mode mode);
929 
930 /**
931  * hdd_convert_phymode_to_80211mode() - Function to convert eCsrPhyMode
932  *					to 80211 mode
933  * @mode: eCsrPhyMode
934  *
935  * Return: 80211 mode
936  */
937 enum qca_wlan_802_11_mode
938 hdd_convert_phymode_to_80211mode(eCsrPhyMode mode);
939 
940 /**
941  * hdd_send_update_owe_info_event - Send update OWE info event
942  * @adapter: Pointer to adapter
943  * @sta_addr: MAC address of peer STA
944  * @owe_ie: OWE IE
945  * @owe_ie_len: Length of OWE IE
946  *
947  * Send update OWE info event to hostapd
948  *
949  * Return: none
950  */
951 #if defined(CFG80211_EXTERNAL_DH_UPDATE_SUPPORT) || \
952 (LINUX_VERSION_CODE > KERNEL_VERSION(5, 2, 0))
953 void hdd_send_update_owe_info_event(struct hdd_adapter *adapter,
954 				    uint8_t sta_addr[],
955 				    uint8_t *owe_ie,
956 				    uint32_t owe_ie_len);
957 #else
hdd_send_update_owe_info_event(struct hdd_adapter * adapter,uint8_t sta_addr[],uint8_t * owe_ie,uint32_t owe_ie_len)958 static inline void hdd_send_update_owe_info_event(struct hdd_adapter *adapter,
959 						  uint8_t sta_addr[],
960 						  uint8_t *owe_ie,
961 						  uint32_t owe_ie_len)
962 {
963 }
964 #endif
965 
966 /**
967  * hdd_set_phy_mode() - set phy mode
968  * @adapter: Handle to hdd_adapter
969  * @vendor_phy_mode: phy mode to set
970  *
971  * Return: 0 on success, negative errno on failure
972  */
973 int hdd_set_phy_mode(struct hdd_adapter *adapter,
974 		     enum qca_wlan_vendor_phy_mode vendor_phy_mode);
975 
976 /**
977  * hdd_set_mac_chan_width() - set channel width
978  * @link_info: Link info in HDD adapter
979  * @chwidth: given channel width
980  * @link_id: mlo link id
981  * @is_restore: is restore
982  *
983  * Return: 0 on success, negative errno on failure
984  */
985 int hdd_set_mac_chan_width(struct wlan_hdd_link_info *link_info,
986 			   enum eSirMacHTChannelWidth chwidth,
987 			   uint8_t link_id, bool is_restore);
988 
989 /**
990  * hdd_is_legacy_connection() - Is adapter connection is legacy
991  * @link_info: Pointer to link_info in hdd_adapter
992  *
993  * Return: true if connection mode is legacy, false otherwise.
994  */
995 bool hdd_is_legacy_connection(struct wlan_hdd_link_info *link_info);
996 
997 struct hdd_hostapd_state;
998 
999 /**
1000  * hdd_softap_deauth_all_sta() - Deauth all sta in the sta list
1001  * @adapter: pointer to adapter structure
1002  * @hapd_state: pointer to hostapd state structure
1003  * @param: pointer to del sta params
1004  *
1005  * Return: QDF_STATUS on success, corresponding QDF failure status on failure
1006  */
1007 QDF_STATUS hdd_softap_deauth_all_sta(struct hdd_adapter *adapter,
1008 				     struct hdd_hostapd_state *hapd_state,
1009 				     struct csr_del_sta_params *param);
1010 
1011 /**
1012  * wlan_hdd_cfg80211_rx_control_port() - notification about a received control
1013  * port frame
1014  *
1015  * @dev: net device pointer
1016  * @ta_addr: transmitter address
1017  * @skb: skbuf with the control port frame
1018  * @unencrypted: Whether the frame is unencrypted
1019  *
1020  * Wrapper function for call to kernel function cfg80211_rx_control_port()
1021  *
1022  * Return: none
1023  */
1024 bool wlan_hdd_cfg80211_rx_control_port(struct net_device *dev,
1025 				       u8 *ta_addr,
1026 				       struct sk_buff *skb,
1027 				       bool unencrypted);
1028 
1029 #ifdef WLAN_FEATURE_DBAM_CONFIG
1030 /**
1031  * hdd_send_dbam_config() - send DBAM config
1032  * @adapter: hdd adapter
1033  * @dbam_mode: dbam mode configuration
1034  *
1035  * Return: 0 on success, negative errno on failure
1036  */
1037 int hdd_send_dbam_config(struct hdd_adapter *adapter,
1038 			 enum coex_dbam_config_mode dbam_mode);
1039 #endif
1040 
1041 #ifdef WLAN_FEATURE_11BE_MLO
1042 /**
1043  * wlan_hdd_send_key_vdev() - api to send vdev keys
1044  * @vdev: vdev pointer
1045  * @key_index: key index value
1046  * @pairwise: pairwise keys
1047  * @cipher_type: cipher type value
1048  *
1049  * Api to send vdev keys for mlo link
1050  *
1051  * Return: none
1052  */
1053 QDF_STATUS wlan_hdd_send_key_vdev(struct wlan_objmgr_vdev *vdev,
1054 				  u8 key_index, bool pairwise,
1055 				  enum wlan_crypto_cipher_type cipher_type);
1056 
1057 /**
1058  * wlan_hdd_mlo_copy_partner_addr_from_mlie  - Copy the Partner link mac
1059  * address from the ML IE
1060  * @vdev: vdev pointer
1061  * @partner_mac: pointer to the mac address to be filled
1062  *
1063  * Return: QDF_STATUS
1064  */
1065 QDF_STATUS
1066 wlan_hdd_mlo_copy_partner_addr_from_mlie(struct wlan_objmgr_vdev *vdev,
1067 					 struct qdf_mac_addr *partner_mac);
1068 #else
1069 static inline
wlan_hdd_send_key_vdev(struct wlan_objmgr_vdev * vdev,u8 key_index,bool pairwise,enum wlan_crypto_cipher_type cipher_type)1070 QDF_STATUS wlan_hdd_send_key_vdev(struct wlan_objmgr_vdev *vdev,
1071 				  u8 key_index, bool pairwise,
1072 				  enum wlan_crypto_cipher_type cipher_type)
1073 {
1074 	return QDF_STATUS_E_NOSUPPORT;
1075 }
1076 
1077 static inline QDF_STATUS
wlan_hdd_mlo_copy_partner_addr_from_mlie(struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr * partner_mac)1078 wlan_hdd_mlo_copy_partner_addr_from_mlie(struct wlan_objmgr_vdev *vdev,
1079 					 struct qdf_mac_addr *partner_mac)
1080 {
1081 	return QDF_STATUS_E_NOSUPPORT;
1082 }
1083 #endif /* WLAN_FEATURE_11BE_MLO */
1084 
1085 /**
1086  * wlan_key_get_link_vdev() - get vdev per link id
1087  * @adapter: hdd adapter object
1088  * @id: reference dbg id
1089  * @link_id: link id
1090  *
1091  * Return: pointer of wlan_objmgr_vdev or NULL if fail
1092  */
1093 struct wlan_objmgr_vdev *wlan_key_get_link_vdev(struct hdd_adapter *adapter,
1094 						wlan_objmgr_ref_dbgid id,
1095 						int link_id);
1096 /**
1097  * wlan_key_put_link_vdev() - put link vdev reference
1098  * @link_vdev: the pointer to link vdev
1099  * @id: reference dbg id
1100  *
1101  * Return: void
1102  */
1103 void wlan_key_put_link_vdev(struct wlan_objmgr_vdev *link_vdev,
1104 			    wlan_objmgr_ref_dbgid id);
1105 
1106 #if defined(WLAN_FEATURE_11BE_MLO)
1107 /**
1108  * hdd_tid_to_link_map() - to get t2lm info
1109  * @vdev: Pointer to vdev
1110  * @t2lm: T2LM info
1111  * @dev: Pointer to net_device structure
1112  *
1113  * Return: QDF_STATUS
1114  */
1115 QDF_STATUS hdd_tid_to_link_map(struct wlan_objmgr_vdev *vdev,
1116 			       struct wlan_t2lm_info *t2lm,
1117 			       struct net_device *dev);
1118 
1119 /**
1120  * hdd_mlo_dev_t2lm_notify_link_update() - Send update T2LM info event
1121  * @vdev: Pointer to vdev
1122  * @t2lm: T2LM info
1123  *
1124  * Send update T2LM info event to userspace
1125  *
1126  * Return: QDF_STATUS
1127  */
1128 QDF_STATUS hdd_mlo_dev_t2lm_notify_link_update(struct wlan_objmgr_vdev *vdev,
1129 					       struct wlan_t2lm_info *t2lm);
1130 #else
1131 static inline
hdd_mlo_dev_t2lm_notify_link_update(struct wlan_objmgr_vdev * vdev,struct wlan_t2lm_info * t2lm)1132 QDF_STATUS hdd_mlo_dev_t2lm_notify_link_update(struct wlan_objmgr_vdev *vdev,
1133 					       struct wlan_t2lm_info *t2lm)
1134 {
1135 	return QDF_STATUS_SUCCESS;
1136 }
1137 #endif
1138 
1139 /** hdd_set_vdev_phy_mode() - Set vdev phy mode
1140  * @adapter: adapter pointer
1141  * @vendor_phy_mode: vendor phy mode
1142  *
1143  * Return: 0 for success
1144  */
1145 int hdd_set_vdev_phy_mode(struct hdd_adapter *adapter,
1146 			  enum qca_wlan_vendor_phy_mode vendor_phy_mode);
1147 
1148 #if defined(WLAN_FEATURE_11BE_MLO) && \
1149 	defined(CFG80211_SINGLE_NETDEV_MULTI_LINK_SUPPORT)
1150 /**
1151  * wlan_hdd_ml_sap_get_peer  - Get ML SAP peer
1152  * @vdev: vdev pointer
1153  * @peer_mld: Peer MLD address
1154  *
1155  * Return: Peer object
1156  */
1157 struct wlan_objmgr_peer *
1158 wlan_hdd_ml_sap_get_peer(struct wlan_objmgr_vdev *vdev,
1159 			 const uint8_t *peer_mld);
1160 #else
1161 static inline struct wlan_objmgr_peer *
wlan_hdd_ml_sap_get_peer(struct wlan_objmgr_vdev * vdev,const uint8_t * peer_mld)1162 wlan_hdd_ml_sap_get_peer(struct wlan_objmgr_vdev *vdev,
1163 			 const uint8_t *peer_mld)
1164 {
1165 	return NULL;
1166 }
1167 #endif /* WLAN_FEATURE_11BE_MLO && CFG80211_SINGLE_NETDEV_MULTI_LINK_SUPPORT */
1168 
1169 /**
1170  * hdd_vdev_send_sta_keep_alive_interval - Send sta keep alive interval to fw
1171  * @link_info: Link info pointer.
1172  * @hdd_ctx: HDD context pointer
1173  * @keep_alive_interval: STA keep alive interval
1174  *
1175  * Return: 0 on success, negative on failure
1176  */
1177 int hdd_vdev_send_sta_keep_alive_interval(struct wlan_hdd_link_info *link_info,
1178 					  struct hdd_context *hdd_ctx,
1179 					  uint16_t keep_alive_interval);
1180 
1181 /**
1182  * wlan_hdd_save_sta_keep_alive_interval() - Save STA keep alive interval
1183  * @adapter: HDD adapter pointer
1184  * @sta_alive_interval: STA keep alive interval
1185  *
1186  * Return: None.
1187  */
1188 void wlan_hdd_save_sta_keep_alive_interval(struct hdd_adapter *adapter,
1189 					   uint16_t sta_alive_interval);
1190 #endif
1191