xref: /wlan-dirver/qcacld-3.0/core/wma/inc/wma.h (revision e686af65b6176b5b659333daaad8e170b9ef09bc)
1 /*
2  * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 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 #ifndef WMA_H
21 #define WMA_H
22 
23 #include "a_types.h"
24 #include "qdf_types.h"
25 #include "osapi_linux.h"
26 #include "htc_packet.h"
27 #include "i_qdf_event.h"
28 #include "wmi_services.h"
29 #include "wmi_unified.h"
30 #include "wmi_version.h"
31 #include "qdf_types.h"
32 #include "qdf_status.h"
33 #include "cds_sched.h"
34 #include "cds_config.h"
35 #include "sir_mac_prot_def.h"
36 #include "wma_types.h"
37 #include <linux/workqueue.h>
38 #include "utils_api.h"
39 #include "lim_types.h"
40 #include "wmi_unified_api.h"
41 #include "cdp_txrx_cmn.h"
42 #include "dbglog.h"
43 #include "cds_ieee80211_common.h"
44 #include "wlan_objmgr_psoc_obj.h"
45 #include <cdp_txrx_handle.h>
46 #include <wlan_policy_mgr_api.h>
47 #include "wma_api.h"
48 #include "wmi_unified_param.h"
49 #include "wmi.h"
50 #include "wlan_cm_roam_public_struct.h"
51 #include "target_if.h"
52 
53 /* Platform specific configuration for max. no. of fragments */
54 #define QCA_OL_11AC_TX_MAX_FRAGS            2
55 
56 /* Private */
57 
58 #define WMA_READY_EVENTID_TIMEOUT          6000
59 #define WMA_SERVICE_READY_EXT_TIMEOUT      6000
60 #define NAN_CLUSTER_ID_BYTES               4
61 
62 #define WMA_CRASH_INJECT_TIMEOUT           5000
63 
64 /* MAC ID to PDEV ID mapping is as given below
65  * MAC_ID           PDEV_ID
66  * 0                    1
67  * 1                    2
68  * SOC Level            WMI_PDEV_ID_SOC
69  */
70 #define WMA_MAC_TO_PDEV_MAP(x) ((x) + (1))
71 #define WMA_PDEV_TO_MAC_MAP(x) ((x) - (1))
72 
73 #define MAX_PRINT_FAILURE_CNT 50
74 
75 #define WMA_INVALID_VDEV_ID                             0xFF
76 
77 #define wma_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_WMA, params)
78 #define wma_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_WMA, params)
79 #define wma_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_WMA, params)
80 #define wma_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_WMA, params)
81 #define wma_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_WMA, params)
82 #define wma_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_WMA, params)
83 #define wma_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_WMA, params)
84 
85 #define wma_nofl_alert(params...) \
86 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_WMA, params)
87 #define wma_nofl_err(params...) \
88 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_WMA, params)
89 #define wma_nofl_warn(params...) \
90 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_WMA, params)
91 #define wma_nofl_info(params...) \
92 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_WMA, params)
93 #define wma_nofl_debug(params...) \
94 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_WMA, params)
95 
96 #define wma_conditional_log(is_console_log_enabled, params...) \
97 	do { \
98 		if (is_console_log_enabled) \
99 			wma_info(params); \
100 		else \
101 			wma_debug(params); \
102 	} while(0); \
103 
104 #define WMA_WILDCARD_PDEV_ID 0x0
105 
106 #define WMA_HW_DEF_SCAN_MAX_DURATION      30000 /* 30 secs */
107 
108 #define WMA_EAPOL_SUBTYPE_GET_MIN_LEN     21
109 #define WMA_EAPOL_INFO_GET_MIN_LEN        23
110 #define WMA_IS_DHCP_GET_MIN_LEN           38
111 #define WMA_DHCP_SUBTYPE_GET_MIN_LEN      0x11D
112 #define WMA_DHCP_INFO_GET_MIN_LEN         50
113 #define WMA_ARP_SUBTYPE_GET_MIN_LEN       22
114 #define WMA_IPV4_PROTO_GET_MIN_LEN        24
115 #define WMA_IPV4_PKT_INFO_GET_MIN_LEN     42
116 #define WMA_ICMP_SUBTYPE_GET_MIN_LEN      35
117 #define WMA_IPV6_PROTO_GET_MIN_LEN        21
118 #define WMA_IPV6_PKT_INFO_GET_MIN_LEN     62
119 #define WMA_ICMPV6_SUBTYPE_GET_MIN_LEN    55
120 
121 /* Beacon tx rate */
122 #define WMA_BEACON_TX_RATE_1_M            10
123 #define WMA_BEACON_TX_RATE_2_M            20
124 #define WMA_BEACON_TX_RATE_5_5_M          55
125 #define WMA_BEACON_TX_RATE_11_M           110
126 #define WMA_BEACON_TX_RATE_6_M            60
127 #define WMA_BEACON_TX_RATE_9_M            90
128 #define WMA_BEACON_TX_RATE_12_M           120
129 #define WMA_BEACON_TX_RATE_18_M           180
130 #define WMA_BEACON_TX_RATE_24_M           240
131 #define WMA_BEACON_TX_RATE_36_M           360
132 #define WMA_BEACON_TX_RATE_48_M           480
133 #define WMA_BEACON_TX_RATE_54_M           540
134 
135 /* Roaming default values
136  * All time and period values are in milliseconds.
137  * All rssi values are in dB except for WMA_NOISE_FLOOR_DBM_DEFAULT.
138  */
139 
140 #define WMA_ROAM_SCAN_CHANNEL_SWITCH_TIME    (4)
141 #define WMA_NOISE_FLOOR_DBM_DEFAULT          (-96)
142 #define WMA_RSSI_MIN_VALUE                   (-128)
143 #define WMA_RSSI_MAX_VALUE                   (127)
144 #define WMA_ROAM_RSSI_DIFF_DEFAULT           (5)
145 #define WMA_ROAM_DWELL_TIME_ACTIVE_DEFAULT   (100)
146 #define WMA_ROAM_DWELL_TIME_PASSIVE_DEFAULT  (110)
147 #define WMA_ROAM_MIN_REST_TIME_DEFAULT       (50)
148 #define WMA_ROAM_MAX_REST_TIME_DEFAULT       (500)
149 
150 #define WMA_INVALID_KEY_IDX     0xff
151 
152 #define WMA_MAX_RF_CHAINS(x)    ((1 << x) - 1)
153 #define WMA_MIN_RF_CHAINS               (1)
154 #define WMA_MAX_NSS               (2)
155 
156 #define WMA_NOA_IE_SIZE(num_desc) (2 + (13 * (num_desc)))
157 #define WMA_MAX_NOA_DESCRIPTORS 4
158 
159 #define WMA_TIM_SUPPORTED_PVB_LENGTH ((HAL_NUM_STA / 8) + 1)
160 
161 #define WMA_BSS_STATUS_STARTED 0x1
162 #define WMA_BSS_STATUS_STOPPED 0x2
163 
164 #define WMA_PEER_ASSOC_CNF_START 0x01
165 #define WMA_PEER_ASSOC_TIMEOUT SIR_PEER_ASSOC_TIMEOUT
166 
167 #define WMA_DELETE_STA_RSP_START 0x02
168 #define WMA_DELETE_STA_TIMEOUT SIR_DELETE_STA_TIMEOUT
169 
170 #define WMA_DEL_P2P_SELF_STA_RSP_START 0x03
171 #define WMA_SET_LINK_PEER_RSP 0x04
172 #define WMA_DELETE_PEER_RSP 0x05
173 
174 #define WMA_PDEV_SET_HW_MODE_RESP 0x06
175 #define WMA_PDEV_MAC_CFG_RESP 0x07
176 
177 #define WMA_PEER_CREATE_RESPONSE 0x08
178 #define WMA_PEER_CREATE_RESPONSE_TIMEOUT SIR_PEER_CREATE_RESPONSE_TIMEOUT
179 
180 /* send connect respone after bss peer is deleted */
181 #define WMA_DELETE_STA_CONNECT_RSP 0x09
182 
183 /* Peer create response for 11az PASN peer */
184 #define WMA_PASN_PEER_CREATE_RESPONSE 0x0a
185 
186 #define WMA_PASN_PEER_DELETE_RESPONSE 0x0b
187 #define WMA_PEER_DELETE_RESPONSE_TIMEOUT SIR_DELETE_STA_TIMEOUT
188 
189 /* FW response timeout values in milli seconds */
190 #define WMA_VDEV_PLCY_MGR_TIMEOUT        SIR_VDEV_PLCY_MGR_TIMEOUT
191 #define WMA_VDEV_HW_MODE_REQUEST_TIMEOUT WMA_VDEV_PLCY_MGR_TIMEOUT
192 #define WMA_VDEV_DUAL_MAC_CFG_TIMEOUT    WMA_VDEV_PLCY_MGR_TIMEOUT
193 #define WMA_VDEV_PLCY_MGR_WAKE_LOCK_TIMEOUT \
194 	(WMA_VDEV_PLCY_MGR_TIMEOUT + 500)
195 
196 
197 #define WMA_VDEV_SET_KEY_WAKELOCK_TIMEOUT	WAKELOCK_DURATION_RECOMMENDED
198 
199 #define WMA_TX_Q_RECHECK_TIMER_WAIT      2      /* 2 ms */
200 
201 #define WMA_SMPS_PARAM_VALUE_S 29
202 
203 /*
204  * Setting the Tx Comp Timeout to 1 secs.
205  * TODO: Need to Revist the Timing
206  */
207 #define WMA_TX_FRAME_COMPLETE_TIMEOUT  1000
208 #define WMA_TX_FRAME_BUFFER_NO_FREE    0
209 #define WMA_TX_FRAME_BUFFER_FREE       1
210 
211 /*
212  * TODO: Add WMI_CMD_ID_MAX as part of WMI_CMD_ID
213  * instead of assigning it to the last valid wmi
214  * cmd+1 to avoid updating this when a command is
215  * added/deleted.
216  */
217 #define WMI_CMDID_MAX (WMI_TXBF_CMDID + 1)
218 
219 #define WMA_NLO_FREQ_THRESH          1000       /* in MHz */
220 #define WMA_MSEC_TO_USEC(msec)	     (msec * 1000) /* msec to usec */
221 
222 #define WMA_AUTH_REQ_RECV_WAKE_LOCK_TIMEOUT     WAKELOCK_DURATION_RECOMMENDED
223 #define WMA_ASSOC_REQ_RECV_WAKE_LOCK_DURATION   WAKELOCK_DURATION_RECOMMENDED
224 #define WMA_DEAUTH_RECV_WAKE_LOCK_DURATION      WAKELOCK_DURATION_RECOMMENDED
225 #define WMA_DISASSOC_RECV_WAKE_LOCK_DURATION    WAKELOCK_DURATION_RECOMMENDED
226 #define WMA_ROAM_HO_WAKE_LOCK_DURATION          (500)          /* in msec */
227 #define WMA_ROAM_PREAUTH_WAKE_LOCK_DURATION     (2 * 1000)
228 
229 #define WMA_REASON_PROBE_REQ_WPS_IE_RECV_DURATION     (3 * 1000)
230 
231 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN
232 #define WMA_AUTO_SHUTDOWN_WAKE_LOCK_DURATION    WAKELOCK_DURATION_RECOMMENDED
233 #endif
234 #define WMA_BMISS_EVENT_WAKE_LOCK_DURATION      WAKELOCK_DURATION_RECOMMENDED
235 #define WMA_FW_RSP_EVENT_WAKE_LOCK_DURATION     WAKELOCK_DURATION_MAX
236 
237 #define WMA_TXMIC_LEN 8
238 #define WMA_RXMIC_LEN 8
239 #define WMA_IV_KEY_LEN 16
240 
241 /*
242  * Length = (2 octets for Index and CTWin/Opp PS) and
243  * (13 octets for each NOA Descriptors)
244  */
245 
246 #define WMA_P2P_NOA_IE_OPP_PS_SET (0x80)
247 #define WMA_P2P_NOA_IE_CTWIN_MASK (0x7F)
248 
249 #define WMA_P2P_IE_ID 0xdd
250 #define WMA_P2P_WFA_OUI { 0x50, 0x6f, 0x9a }
251 #define WMA_P2P_WFA_VER 0x09    /* ver 1.0 */
252 
253 /* P2P Sub element definitions (according to table 5 of Wifi's P2P spec) */
254 #define WMA_P2P_SUB_ELEMENT_STATUS                    0
255 #define WMA_P2P_SUB_ELEMENT_MINOR_REASON              1
256 #define WMA_P2P_SUB_ELEMENT_CAPABILITY                2
257 #define WMA_P2P_SUB_ELEMENT_DEVICE_ID                 3
258 #define WMA_P2P_SUB_ELEMENT_GO_INTENT                 4
259 #define WMA_P2P_SUB_ELEMENT_CONFIGURATION_TIMEOUT     5
260 #define WMA_P2P_SUB_ELEMENT_LISTEN_CHANNEL            6
261 #define WMA_P2P_SUB_ELEMENT_GROUP_BSSID               7
262 #define WMA_P2P_SUB_ELEMENT_EXTENDED_LISTEN_TIMING    8
263 #define WMA_P2P_SUB_ELEMENT_INTENDED_INTERFACE_ADDR   9
264 #define WMA_P2P_SUB_ELEMENT_MANAGEABILITY             10
265 #define WMA_P2P_SUB_ELEMENT_CHANNEL_LIST              11
266 #define WMA_P2P_SUB_ELEMENT_NOA                       12
267 #define WMA_P2P_SUB_ELEMENT_DEVICE_INFO               13
268 #define WMA_P2P_SUB_ELEMENT_GROUP_INFO                14
269 #define WMA_P2P_SUB_ELEMENT_GROUP_ID                  15
270 #define WMA_P2P_SUB_ELEMENT_INTERFACE                 16
271 #define WMA_P2P_SUB_ELEMENT_OP_CHANNEL                17
272 #define WMA_P2P_SUB_ELEMENT_INVITATION_FLAGS          18
273 #define WMA_P2P_SUB_ELEMENT_VENDOR                    221
274 
275 /* Macros for handling unaligned memory accesses */
276 #define P2PIE_PUT_LE16(a, val)		\
277 	do {			\
278 		(a)[1] = ((uint16_t) (val)) >> 8;	\
279 		(a)[0] = ((uint16_t) (val)) & 0xff;	\
280 	} while (0)
281 
282 #define P2PIE_PUT_LE32(a, val)			\
283 	do {				\
284 		(a)[3] = (uint8_t) ((((uint32_t) (val)) >> 24) & 0xff);	\
285 		(a)[2] = (uint8_t) ((((uint32_t) (val)) >> 16) & 0xff);	\
286 		(a)[1] = (uint8_t) ((((uint32_t) (val)) >> 8) & 0xff);	\
287 		(a)[0] = (uint8_t) (((uint32_t) (val)) & 0xff);	    \
288 	} while (0)
289 
290 
291 #define WMA_DEFAULT_MAX_PSPOLL_BEFORE_WAKE 1
292 
293 #define WMA_VHT_PPS_PAID_MATCH 1
294 #define WMA_VHT_PPS_GID_MATCH 2
295 #define WMA_VHT_PPS_DELIM_CRC_FAIL 3
296 
297 #define WMA_DEFAULT_HW_MODE_INDEX 0xFFFF
298 #define TWO_THIRD (2/3)
299 
300 #ifdef WLAN_FEATURE_SON
301 #define WMA_SON_MAX_PEER_EXT_STATS 16
302 #else
303 #define WMA_SON_MAX_PEER_EXT_STATS 0
304 #endif
305 
306 /**
307  * WMA hardware mode list bit-mask definitions.
308  * Bits 4:0, 31:29 are unused.
309  *
310  * The below definitions are added corresponding to WMI DBS HW mode
311  * list to make it independent of firmware changes for WMI definitions.
312  * Currently these definitions have dependency with BIT positions of
313  * the existing WMI macros. Thus, if the BIT positions are changed for
314  * WMI macros, then these macros' BIT definitions are also need to be
315  * changed.
316  */
317 #define WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS  (28)
318 #define WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS  (24)
319 #define WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS  (20)
320 #define WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS  (16)
321 #define WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS   (12)
322 #define WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS   (8)
323 #define WMA_HW_MODE_DBS_MODE_BITPOS         (7)
324 #define WMA_HW_MODE_AGILE_DFS_MODE_BITPOS   (6)
325 #define WMA_HW_MODE_SBS_MODE_BITPOS         (5)
326 
327 #define WMA_HW_MODE_MAC0_TX_STREAMS_MASK    \
328 			(0xf << WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS)
329 #define WMA_HW_MODE_MAC0_RX_STREAMS_MASK    \
330 			(0xf << WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS)
331 #define WMA_HW_MODE_MAC1_TX_STREAMS_MASK    \
332 			(0xf << WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS)
333 #define WMA_HW_MODE_MAC1_RX_STREAMS_MASK    \
334 			(0xf << WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS)
335 #define WMA_HW_MODE_MAC0_BANDWIDTH_MASK     \
336 			(0xf << WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS)
337 #define WMA_HW_MODE_MAC1_BANDWIDTH_MASK     \
338 			(0xf << WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS)
339 #define WMA_HW_MODE_DBS_MODE_MASK           \
340 			(0x1 << WMA_HW_MODE_DBS_MODE_BITPOS)
341 #define WMA_HW_MODE_AGILE_DFS_MODE_MASK     \
342 			(0x1 << WMA_HW_MODE_AGILE_DFS_MODE_BITPOS)
343 #define WMA_HW_MODE_SBS_MODE_MASK           \
344 			(0x1 << WMA_HW_MODE_SBS_MODE_BITPOS)
345 
346 #define WMA_HW_MODE_MAC0_TX_STREAMS_SET(hw_mode, value) \
347 	WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS, 4, value)
348 #define WMA_HW_MODE_MAC0_RX_STREAMS_SET(hw_mode, value) \
349 	WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS, 4, value)
350 #define WMA_HW_MODE_MAC1_TX_STREAMS_SET(hw_mode, value) \
351 	WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS, 4, value)
352 #define WMA_HW_MODE_MAC1_RX_STREAMS_SET(hw_mode, value) \
353 	WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS, 4, value)
354 #define WMA_HW_MODE_MAC0_BANDWIDTH_SET(hw_mode, value)  \
355 	WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS, 4, value)
356 #define WMA_HW_MODE_MAC1_BANDWIDTH_SET(hw_mode, value)  \
357 	WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS, 4, value)
358 #define WMA_HW_MODE_DBS_MODE_SET(hw_mode, value)        \
359 	WMI_SET_BITS(hw_mode, WMA_HW_MODE_DBS_MODE_BITPOS, 1, value)
360 #define WMA_HW_MODE_AGILE_DFS_SET(hw_mode, value)       \
361 	WMI_SET_BITS(hw_mode, WMA_HW_MODE_AGILE_DFS_MODE_BITPOS, 1, value)
362 #define WMA_HW_MODE_SBS_MODE_SET(hw_mode, value)        \
363 	WMI_SET_BITS(hw_mode, WMA_HW_MODE_SBS_MODE_BITPOS, 1, value)
364 
365 #define WMA_HW_MODE_MAC0_TX_STREAMS_GET(hw_mode)                \
366 	((hw_mode & WMA_HW_MODE_MAC0_TX_STREAMS_MASK) >>        \
367 		WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS)
368 #define WMA_HW_MODE_MAC0_RX_STREAMS_GET(hw_mode)                \
369 	((hw_mode & WMA_HW_MODE_MAC0_RX_STREAMS_MASK) >>        \
370 		WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS)
371 #define WMA_HW_MODE_MAC1_TX_STREAMS_GET(hw_mode)                \
372 	((hw_mode & WMA_HW_MODE_MAC1_TX_STREAMS_MASK) >>        \
373 		WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS)
374 #define WMA_HW_MODE_MAC1_RX_STREAMS_GET(hw_mode)                \
375 	((hw_mode & WMA_HW_MODE_MAC1_RX_STREAMS_MASK) >>        \
376 		WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS)
377 #define WMA_HW_MODE_MAC0_BANDWIDTH_GET(hw_mode)                 \
378 	((hw_mode & WMA_HW_MODE_MAC0_BANDWIDTH_MASK) >>         \
379 		WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS)
380 #define WMA_HW_MODE_MAC1_BANDWIDTH_GET(hw_mode)                 \
381 	((hw_mode & WMA_HW_MODE_MAC1_BANDWIDTH_MASK) >>         \
382 		WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS)
383 #define WMA_HW_MODE_DBS_MODE_GET(hw_mode)                       \
384 	((hw_mode & WMA_HW_MODE_DBS_MODE_MASK) >>               \
385 		WMA_HW_MODE_DBS_MODE_BITPOS)
386 #define WMA_HW_MODE_AGILE_DFS_GET(hw_mode)                      \
387 	((hw_mode & WMA_HW_MODE_AGILE_DFS_MODE_MASK) >>         \
388 		WMA_HW_MODE_AGILE_DFS_MODE_BITPOS)
389 #define WMA_HW_MODE_SBS_MODE_GET(hw_mode)                       \
390 	((hw_mode & WMA_HW_MODE_SBS_MODE_MASK) >>               \
391 		WMA_HW_MODE_SBS_MODE_BITPOS)
392 
393 /*
394  * Extract 2G or 5G tx/rx chainmask
395  * format of txrx_chainmask (from wmi_service_ready_event_fixed_param):
396  *    [7:0]   - 2G band tx chain mask
397  *    [15:8]  - 2G band rx chain mask
398  *    [23:16] - 5G band tx chain mask
399  *    [31:24] - 5G band rx chain mask
400  */
401 #define EXTRACT_TX_CHAIN_MASK_2G(chainmask) ((chainmask) & 0xFF)
402 #define EXTRACT_RX_CHAIN_MASK_2G(chainmask) (((chainmask) >> 8) & 0xFF)
403 #define EXTRACT_TX_CHAIN_MASK_5G(chainmask) (((chainmask) >> 16) & 0xFF)
404 #define EXTRACT_RX_CHAIN_MASK_5G(chainmask) (((chainmask) >> 24) & 0xFF)
405 
406 /*
407  * PROBE_REQ_TX_DELAY
408  * param to specify probe request Tx delay for scans triggered on this VDEV
409  */
410 #define PROBE_REQ_TX_DELAY 10
411 
412 /* PROBE_REQ_TX_TIME_GAP
413  * param to specify the time gap between each set of probe request transmission.
414  * The number of probe requests in each set depends on the ssid_list and,
415  * bssid_list in the scan request. This parameter will get applied only,
416  * for the scans triggered on this VDEV.
417  */
418 #define PROBE_REQ_TX_TIME_GAP 20
419 
420 /**
421  * enum wma_rx_exec_ctx - wma rx execution context
422  * @WMA_RX_WORK_CTX: work queue context execution
423  * @WMA_RX_TASKLET_CTX: tasklet context execution
424  * @WMA_RX_SERIALIZER_CTX: MC thread context execution
425  *
426  */
427 enum wma_rx_exec_ctx {
428 	WMA_RX_WORK_CTX = WMI_RX_WORK_CTX,
429 	WMA_RX_TASKLET_CTX = WMI_RX_TASKLET_CTX,
430 	WMA_RX_SERIALIZER_CTX = WMI_RX_SERIALIZER_CTX,
431 };
432 
433 /**
434  * struct beacon_info - structure to store beacon template
435  * @buf: skb ptr
436  * @len: length
437  * @dma_mapped: is it dma mapped or not
438  * @tim_ie_offset: TIM IE offset
439  * @dtim_count: DTIM count
440  * @seq_no: sequence no
441  * @noa_sub_ie: NOA sub IE
442  * @noa_sub_ie_len: NOA sub IE length
443  * @noa_ie: NOA IE
444  * @p2p_ie_offset: p2p IE offset
445  * @csa_count_offset: Offset of Switch count field in CSA IE
446  * @ecsa_count_offset: Offset of Switch count field in ECSA IE
447  * @lock: lock
448  */
449 struct beacon_info {
450 	qdf_nbuf_t buf;
451 	uint32_t len;
452 	uint8_t dma_mapped;
453 	uint32_t tim_ie_offset;
454 	uint8_t dtim_count;
455 	uint16_t seq_no;
456 	uint8_t noa_sub_ie[2 + WMA_NOA_IE_SIZE(WMA_MAX_NOA_DESCRIPTORS)];
457 	uint16_t noa_sub_ie_len;
458 	uint8_t *noa_ie;
459 	uint16_t p2p_ie_offset;
460 	uint16_t csa_count_offset;
461 	uint16_t ecsa_count_offset;
462 	qdf_spinlock_t lock;
463 };
464 
465 /**
466  * struct beacon_tim_ie - structure to store TIM IE of beacon
467  * @tim_ie: tim ie
468  * @tim_len: tim ie length
469  * @dtim_count: dtim count
470  * @dtim_period: dtim period
471  * @tim_bitctl: tim bit control
472  * @tim_bitmap: tim bitmap
473  */
474 struct beacon_tim_ie {
475 	uint8_t tim_ie;
476 	uint8_t tim_len;
477 	uint8_t dtim_count;
478 	uint8_t dtim_period;
479 	uint8_t tim_bitctl;
480 	uint8_t tim_bitmap[1];
481 } __ATTRIB_PACK;
482 
483 /**
484  * struct pps - packet power save parameter
485  * @paid_match_enable: paid match enable
486  * @gid_match_enable: gid match enable
487  * @tim_clear: time clear
488  * @dtim_clear: dtim clear
489  * @eof_delim: eof delim
490  * @mac_match: mac match
491  * @delim_fail: delim fail
492  * @nsts_zero: nsts zero
493  * @rssi_chk: RSSI check
494  * @ebt_5g: ebt 5GHz
495  */
496 struct pps {
497 	bool paid_match_enable;
498 	bool gid_match_enable;
499 	bool tim_clear;
500 	bool dtim_clear;
501 	bool eof_delim;
502 	bool mac_match;
503 	bool delim_fail;
504 	bool nsts_zero;
505 	bool rssi_chk;
506 	bool ebt_5g;
507 };
508 
509 /**
510  * struct qpower_params - qpower related parameters
511  * @max_ps_poll_cnt: max ps poll count
512  * @max_tx_before_wake: max tx before wake
513  * @spec_ps_poll_wake_interval: ps poll wake interval
514  * @max_spec_nodata_ps_poll: no data ps poll
515  */
516 struct qpower_params {
517 	uint32_t max_ps_poll_cnt;
518 	uint32_t max_tx_before_wake;
519 	uint32_t spec_ps_poll_wake_interval;
520 	uint32_t max_spec_nodata_ps_poll;
521 };
522 
523 
524 /**
525  * struct gtx_config_t - GTX config
526  * @gtxRTMask: for HT and VHT rate masks
527  * @gtxUsrcfg: host request for GTX mask
528  * @gtxPERThreshold: PER Threshold (default: 10%)
529  * @gtxPERMargin: PER margin (default: 2%)
530  * @gtxTPCstep: TCP step (default: 1)
531  * @gtxTPCMin: TCP min (default: 5)
532  * @gtxBWMask: BW mask (20/40/80/160 Mhz)
533  */
534 typedef struct {
535 	uint32_t gtxRTMask[2];
536 	uint32_t gtxUsrcfg;
537 	uint32_t gtxPERThreshold;
538 	uint32_t gtxPERMargin;
539 	uint32_t gtxTPCstep;
540 	uint32_t gtxTPCMin;
541 	uint32_t gtxBWMask;
542 } gtx_config_t;
543 
544 /**
545  * struct pdev_cli_config_t - store pdev parameters
546  * @ani_enable: ANI is enabled/disable on target
547  * @ani_poll_len: store ANI polling period
548  * @ani_listen_len: store ANI listening period
549  * @ani_ofdm_level: store ANI OFDM immunity level
550  * @ani_cck_level: store ANI CCK immunity level
551  * @cwmenable: Dynamic bw is enable/disable in fw
552  * @txchainmask: tx chain mask
553  * @rxchainmask: rx chain mask
554  * @txpow2g: tx power limit for 2GHz
555  * @txpow5g: tx power limit for 5GHz
556  *
557  * This structure stores pdev parameters.
558  * Some of these parameters are set in fw and some
559  * parameters are only maintained in host.
560  */
561 typedef struct {
562 	uint32_t ani_enable;
563 	uint32_t ani_poll_len;
564 	uint32_t ani_listen_len;
565 	uint32_t ani_ofdm_level;
566 	uint32_t ani_cck_level;
567 	uint32_t cwmenable;
568 	uint32_t cts_cbw;
569 	uint32_t txchainmask;
570 	uint32_t rxchainmask;
571 	uint32_t txpow2g;
572 	uint32_t txpow5g;
573 } pdev_cli_config_t;
574 
575 /**
576  * struct vdev_cli_config_t - store vdev parameters
577  * @nss: nss width
578  * @ldpc: is ldpc is enable/disable
579  * @tx_stbc: TX STBC is enable/disable
580  * @rx_stbc: RX STBC is enable/disable
581  * @shortgi: short gi is enable/disable
582  * @rtscts_en: RTS/CTS is enable/disable
583  * @chwidth: channel width
584  * @tx_rate: tx rate
585  * @ampdu: ampdu size
586  * @amsdu: amsdu size
587  * @erx_adjust: enable/disable early rx enable
588  * @erx_bmiss_num: target bmiss number per sample
589  * @erx_bmiss_cycle: sample cycle
590  * @erx_slop_step: slop_step value
591  * @erx_init_slop: init slop
592  * @erx_adj_pause: pause adjust enable/disable
593  * @erx_dri_sample: enable/disable drift sample
594  * @pps_params: packet power save parameters
595  * @qpower_params: qpower parameters
596  * @gtx_info: GTX offload info
597  * @dcm: DCM enable/disable
598  * @range_ext: HE range extension enable/disable
599  * @tx_ampdu: tx ampdu size
600  * @rx_ampdu: rx ampdu size
601  * @tx_amsdu: tx amsdu size
602  * @rx_amsdu: rx amsdu size
603  *
604  * This structure stores vdev parameters.
605  * Some of these parameters are set in fw and some
606  * parameters are only maintained in host.
607  */
608 typedef struct {
609 	uint32_t nss;
610 	uint32_t ldpc;
611 	uint32_t tx_stbc;
612 	uint32_t rx_stbc;
613 	uint32_t shortgi;
614 	uint32_t rtscts_en;
615 	uint32_t chwidth;
616 	uint32_t tx_rate;
617 	uint32_t ampdu;
618 	uint32_t amsdu;
619 	uint32_t erx_adjust;
620 	uint32_t erx_bmiss_num;
621 	uint32_t erx_bmiss_cycle;
622 	uint32_t erx_slop_step;
623 	uint32_t erx_init_slop;
624 	uint32_t erx_adj_pause;
625 	uint32_t erx_dri_sample;
626 	struct pps pps_params;
627 	struct qpower_params qpower_params;
628 	gtx_config_t gtx_info;
629 #ifdef WLAN_FEATURE_11AX
630 	uint8_t dcm;
631 	uint8_t range_ext;
632 #endif
633 	uint32_t tx_ampdu;
634 	uint32_t rx_ampdu;
635 	uint32_t tx_amsdu;
636 	uint32_t rx_amsdu;
637 } vdev_cli_config_t;
638 
639 /**
640  * struct wma_version_info - Store wmi version info
641  * @major: wmi major version
642  * @minor: wmi minor version
643  * @revision: wmi revision number
644  */
645 struct wma_version_info {
646 	u_int32_t major;
647 	u_int32_t minor;
648 	u_int32_t revision;
649 };
650 
651 /* Max number of invalid peer entries */
652 #define INVALID_PEER_MAX_NUM 5
653 
654 /**
655  * struct wma_invalid_peer_params - stores invalid peer entries
656  * @rx_macaddr: store mac addr of invalid peer
657  */
658 struct wma_invalid_peer_params {
659 	uint8_t rx_macaddr[QDF_MAC_ADDR_SIZE];
660 };
661 
662 /**
663  * struct wma_txrx_node - txrx node
664  * @vdev: pointer to vdev object
665  * @beacon: beacon info
666  * @config: per vdev config parameters
667  * @scan_info: scan info
668  * @type: type
669  * @sub_type: sub type
670  * @nlo_match_evt_received: is nlo match event received or not
671  * @pno_in_progress: is pno in progress or not
672  * @plm_in_progress: is plm in progress or not
673  * @beaconInterval: beacon interval
674  * @llbCoexist: 11b coexist
675  * @shortSlotTimeSupported: is short slot time supported or not
676  * @dtimPeriod: DTIM period
677  * @chan_width: channel bandwidth
678  * @vdev_up: is vdev up or not
679  * @tsfadjust: TSF adjust
680  * @addBssStaContext: add bss context
681  * @aid: association id
682  * @rmfEnabled: Robust Management Frame (RMF) enabled/disabled
683  * @uapsd_cached_val: uapsd cached value
684  * @stats_rsp: stats response
685  * @del_staself_req: delete sta self request
686  * @bss_status: bss status
687  * @nss: nss value
688  * @is_channel_switch: is channel switch
689  * @pause_bitmap: pause bitmap
690  * @nwType: network type (802.11a/b/g/n/ac)
691  * @ps_enabled: is powersave enable/disable
692  * @peer_count: peer count
693  * @plink_status_req: link status request
694  * @psnr_req: snr request
695  * @tx_streams: number of tx streams can be used by the vdev
696  * @mac_id: the mac on which vdev is on
697  * @arp_offload_req: cached arp offload request
698  * @ns_offload_req: cached ns offload request
699  * @rcpi_req: rcpi request
700  * @in_bmps: Whether bmps for this interface has been enabled
701  * @ch_freq: channel frequency
702  * @roam_scan_stats_req: cached roam scan stats request
703  * @wma_invalid_peer_params: structure storing invalid peer params
704  * @invalid_peer_idx: invalid peer index
705  * It stores parameters per vdev in wma.
706  */
707 struct wma_txrx_node {
708 	struct wlan_objmgr_vdev *vdev;
709 	struct beacon_info *beacon;
710 	vdev_cli_config_t config;
711 	uint32_t type;
712 	uint32_t sub_type;
713 #ifdef FEATURE_WLAN_ESE
714 	bool plm_in_progress;
715 #endif
716 	tSirMacBeaconInterval beaconInterval;
717 	uint8_t llbCoexist;
718 	uint8_t shortSlotTimeSupported;
719 	uint8_t dtimPeriod;
720 	enum phy_ch_width chan_width;
721 	bool vdev_active;
722 	uint64_t tsfadjust;
723 	tAddStaParams *addBssStaContext;
724 	uint16_t aid;
725 	uint8_t rmfEnabled;
726 	uint32_t uapsd_cached_val;
727 	void *del_staself_req;
728 	bool is_del_sta_deferred;
729 	qdf_atomic_t bss_status;
730 	enum tx_rate_info rate_flags;
731 	uint8_t nss;
732 	uint16_t pause_bitmap;
733 	uint32_t nwType;
734 	uint32_t peer_count;
735 	void *plink_status_req;
736 	void *psnr_req;
737 #ifdef FEATURE_WLAN_EXTSCAN
738 	bool extscan_in_progress;
739 #endif
740 	uint32_t tx_streams;
741 	uint32_t mac_id;
742 	int32_t roam_synch_delay;
743 	struct sme_rcpi_req *rcpi_req;
744 	bool in_bmps;
745 	struct beacon_filter_param beacon_filter;
746 	bool beacon_filter_enabled;
747 	struct roam_synch_frame_ind roam_synch_frame_ind;
748 	bool is_waiting_for_key;
749 	uint32_t ch_freq;
750 	uint16_t ch_flagext;
751 	struct sir_roam_scan_stats *roam_scan_stats_req;
752 	struct wma_invalid_peer_params invalid_peers[INVALID_PEER_MAX_NUM];
753 	uint8_t invalid_peer_idx;
754 	uint16_t bss_max_idle_period;
755 };
756 
757 /**
758  * struct mac_ss_bw_info - hw_mode_list PHY/MAC params for each MAC
759  * @mac_tx_stream: Max TX stream
760  * @mac_rx_stream: Max RX stream
761  * @mac_bw: Max bandwidth
762  */
763 struct mac_ss_bw_info {
764 	uint32_t mac_tx_stream;
765 	uint32_t mac_rx_stream;
766 	uint32_t mac_bw;
767 };
768 
769 /**
770  * struct wma_ini_config - Structure to hold wma ini configuration
771  * @max_no_of_peers: Max Number of supported
772  * @exclude_selftx_from_cca_busy: Exclude self tx time from cca busy time flag.
773  *
774  * Placeholder for WMA ini parameters.
775  */
776 struct wma_ini_config {
777 	uint8_t max_no_of_peers;
778 	bool exclude_selftx_from_cca_busy;
779 };
780 
781 /**
782  * struct wma_valid_channels - Channel details part of WMI_SCAN_CHAN_LIST_CMDID
783  * @num_channels: Number of channels
784  * @ch_freq_list: Channel Frequency list
785  */
786 struct wma_valid_channels {
787 	uint8_t num_channels;
788 	uint32_t ch_freq_list[NUM_CHANNELS];
789 };
790 
791 #ifdef FEATURE_WLM_STATS
792 /**
793  * struct wma_wlm_stats_data - Data required to be used to send WLM req
794  * @wlm_stats_max_size: Buffer size provided by userspace
795  * @wlm_stats_cookie: Cookie to retrieve WLM req data
796  * @wlm_stats_callback: Callback to be used to send WLM response
797  */
798 struct wma_wlm_stats_data {
799 	uint32_t wlm_stats_max_size;
800 	void *wlm_stats_cookie;
801 	wma_wlm_stats_cb wlm_stats_callback;
802 };
803 #endif
804 
805 /**
806  * struct t_wma_handle - wma context
807  * @wmi_handle: wmi handle
808  * @cds_context: cds handle
809  * @mac_context: mac context
810  * @psoc: psoc context
811  * @pdev: physical device global object
812  * @target_suspend: target suspend event
813  * @recovery_event: wma FW recovery event
814  * @max_station: max stations
815  * @max_bssid: max bssid
816  * @myaddr: current mac address
817  * @hwaddr: mac address from EEPROM
818  * @lpss_support: LPSS feature is supported in target or not
819  * @wmi_ready: wmi status flag
820  * @wlan_init_status: wlan init status
821  * @qdf_dev: qdf device
822  * @wmi_service_bitmap: wmi services bitmap received from Target
823  * @wmi_service_ext_bitmap: extended wmi services bitmap received from Target
824  * @tx_frm_download_comp_cb: Tx Frame Compl Cb registered by umac
825  * @tx_frm_download_comp_event: Event to wait for tx download completion
826  * @tx_queue_empty_event: Dummy event to wait for draining MSDUs left
827  *   in hardware tx queue and before requesting VDEV_STOP. Nobody will
828  *   set this and wait will timeout, and code will poll the pending tx
829  *   descriptors number to be zero.
830  * @umac_ota_ack_cb: Ack Complete Callback registered by umac
831  * @umac_data_ota_ack_cb: ack complete callback
832  * @last_umac_data_ota_timestamp: timestamp when OTA of last umac data
833  *   was done
834  * @last_umac_data_nbuf: cache nbuf ptr for the last umac data buf
835  * @tgt_cfg_update_cb: configuration update callback
836  * @reg_cap: regulatory capabilities
837  * @scan_id: scan id
838  * @interfaces: txrx nodes(per vdev)
839  * @pdevconfig: pdev related configurations
840  * @wma_hold_req_queue: Queue use to serialize requests to firmware
841  * @wma_hold_req_q_lock: Mutex for @wma_hold_req_queue
842  * @vht_supp_mcs: VHT supported MCS
843  * @is_fw_assert: is fw asserted
844  * @ack_work_ctx: Context for deferred processing of TX ACK
845  * @pGetRssiReq: get RSSI request
846  * @get_one_peer_info: When a "get peer info" request is active, is
847  *   the request for a single peer?
848  * @peer_macaddr: When @get_one_peer_info is true, the peer's mac address
849  * @thermal_mgmt_info: Thermal mitigation related info
850  * @enable_mc_list: To Check if Multicast list filtering is enabled in FW
851  * @hddTxFailCb: tx fail indication callback
852  * @extscan_wake_lock: extscan wake lock
853  * @wow_wake_lock: wow wake lock
854  * @wow_auth_req_wl: wow wake lock for auth req
855  * @wow_assoc_req_wl: wow wake lock for assoc req
856  * @wow_deauth_rec_wl: wow wake lock for deauth req
857  * @wow_disassoc_rec_wl: wow wake lock for disassoc req
858  * @wow_ap_assoc_lost_wl: wow wake lock for assoc lost req
859  * @wow_auto_shutdown_wl: wow wake lock for shutdown req
860  * @roam_ho_wl: wake lock for roam handoff req
861  * @wow_nack: wow negative ack flag
862  * @is_wow_bus_suspended: is wow bus suspended flag
863  * @IsRArateLimitEnabled: RA rate limiti s enabled or not
864  * @RArateLimitInterval: RA rate limit interval
865  * @is_lpass_enabled: Flag to indicate if LPASS feature is enabled or not
866  * @staMaxLIModDtim: station max listen interval
867  * @sta_max_li_mod_dtim_ms: station max listen interval in ms
868  * @staModDtim: station mode DTIM
869  * @staDynamicDtim: station dynamic DTIM
870  * @hw_bd_id: hardware board id
871  * @hw_bd_info: hardware board info
872  * @miracast_value: miracast value
873  * @log_completion_timer: log completion timer
874  * @old_hw_mode_index: Previous configured HW mode index
875  * @new_hw_mode_index: Current configured HW mode index
876  * @ocb_config_req: OCB request context
877  * @self_gen_frm_pwr: Self-generated frame power
878  * @tx_chain_mask_cck: Is the CCK tx chain mask enabled
879  * @service_ready_ext_timer: Timer for service ready extended.  Note
880  *   this is a a timer instead of wait event because on receiving the
881  *   service ready event, we will be waiting on the MC thread for the
882  *   service extended ready event which is also processed in MC
883  *   thread.  This leads to MC thread being stuck. Alternative was to
884  *   process these events in tasklet/workqueue context. But, this
885  *   leads to race conditions when the events are processed in two
886  *   different context. So, processing ready event and extended ready
887  *   event in the serialized MC thread context with a timer.
888  * @csr_roam_synch_cb: CSR callback for firmware Roam Sync events
889  * @pe_roam_synch_cb: pe callback for firmware Roam Sync events
890  * @csr_roam_auth_event_handle_cb: CSR callback for target authentication
891  * offload event.
892  * @pe_roam_set_ie_cb: PE callback to set IEs to firmware.
893  * @wmi_cmd_rsp_wake_lock: wmi command response wake lock
894  * @wmi_cmd_rsp_runtime_lock: wmi command response bus lock
895  * @active_uc_apf_mode: Setting that determines how APF is applied in
896  *   active mode for uc packets
897  * @active_mc_bc_apf_mode: Setting that determines how APF is applied in
898  *   active mode for MC/BC packets
899  * @ini_config: Initial configuration from upper layer
900  * @saved_chan: saved channel list sent as part of
901  *   WMI_SCAN_CHAN_LIST_CMDID
902  * @nan_datapath_enabled: Is NAN datapath support enabled in firmware?
903  * @fw_timeout_crash: Should firmware be reset upon response timeout?
904  * @sub_20_support: Does target support sub-20MHz bandwidth (aka
905  *   half-rate and quarter-rate)?
906  * @is_dfs_offloaded: Is dfs and cac timer offloaded?
907  * @wma_mgmt_tx_packetdump_cb: Callback function for TX packet dump
908  * @wma_mgmt_rx_packetdump_cb: Callback function for RX packet dump
909  * @rcpi_enabled: Is RCPI enabled?
910  * @link_stats_results: Structure for handing link stats from firmware
911  * @tx_fail_cnt: Number of TX failures
912  * @wlm_data: Data required for WLM req and resp handling
913  * @he_cap: 802.11ax capabilities
914  * @bandcapability: band capability configured through ini
915  * @tx_bfee_8ss_enabled: Is Tx Beamformee support for 8x8 enabled?
916  * @in_imps: Is device in Idle Mode Power Save?
917  * @dynamic_nss_chains_update: per vdev nss, chains update
918  * @ito_repeat_count: Indicates ito repeated count
919  * @wma_fw_time_sync_timer: timer used for firmware time sync
920  * * @fw_therm_throt_support: FW Supports thermal throttling?
921  * @eht_cap: 802.11be capabilities
922  * @set_hw_mode_resp_status: Set HW mode response status
923  * @pagefault_wakeups_ts: Stores timestamps at which host wakes up by fw
924  * because of pagefaults
925  * @num_page_fault_wakeups: Stores the number of times host wakes up by fw
926  * because of pagefaults
927  *
928  * This structure is the global wma context.  It contains global wma
929  * module parameters and handles of other modules.
930 
931  */
932 typedef struct {
933 	void *wmi_handle;
934 	void *cds_context;
935 	struct mac_context *mac_context;
936 	struct wlan_objmgr_psoc *psoc;
937 	struct wlan_objmgr_pdev *pdev;
938 	qdf_event_t target_suspend;
939 	qdf_event_t runtime_suspend;
940 	qdf_event_t recovery_event;
941 	uint16_t max_station;
942 	uint16_t max_bssid;
943 	uint8_t myaddr[QDF_MAC_ADDR_SIZE];
944 	uint8_t hwaddr[QDF_MAC_ADDR_SIZE];
945 #ifdef WLAN_FEATURE_LPSS
946 	uint8_t lpss_support;
947 #endif
948 	uint8_t ap_arpns_support;
949 	bool wmi_ready;
950 	uint32_t wlan_init_status;
951 	qdf_device_t qdf_dev;
952 	uint32_t wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
953 	uint32_t wmi_service_ext_bitmap[WMI_SERVICE_SEGMENT_BM_SIZE32];
954 	wma_tx_dwnld_comp_callback tx_frm_download_comp_cb;
955 	qdf_event_t tx_frm_download_comp_event;
956 	qdf_event_t tx_queue_empty_event;
957 	wma_tx_ota_comp_callback umac_data_ota_ack_cb;
958 	unsigned long last_umac_data_ota_timestamp;
959 	qdf_nbuf_t last_umac_data_nbuf;
960 	wma_tgt_cfg_cb tgt_cfg_update_cb;
961 	HAL_REG_CAPABILITIES reg_cap;
962 	uint32_t scan_id;
963 	struct wma_txrx_node *interfaces;
964 	pdev_cli_config_t pdevconfig;
965 	qdf_list_t wma_hold_req_queue;
966 	qdf_spinlock_t wma_hold_req_q_lock;
967 	uint32_t vht_supp_mcs;
968 	uint8_t is_fw_assert;
969 	struct wma_tx_ack_work_ctx *ack_work_ctx;
970 	void *pGetRssiReq;
971 	bool get_one_peer_info;
972 	struct qdf_mac_addr peer_macaddr;
973 	t_thermal_mgmt thermal_mgmt_info;
974 	bool enable_mc_list;
975 #ifdef FEATURE_WLAN_EXTSCAN
976 	qdf_wake_lock_t extscan_wake_lock;
977 #endif
978 	qdf_wake_lock_t wow_wake_lock;
979 	qdf_wake_lock_t wow_auth_req_wl;
980 	qdf_wake_lock_t wow_assoc_req_wl;
981 	qdf_wake_lock_t wow_deauth_rec_wl;
982 	qdf_wake_lock_t wow_disassoc_rec_wl;
983 	qdf_wake_lock_t wow_ap_assoc_lost_wl;
984 	qdf_wake_lock_t wow_auto_shutdown_wl;
985 	qdf_wake_lock_t roam_ho_wl;
986 	qdf_wake_lock_t roam_preauth_wl;
987 	qdf_wake_lock_t probe_req_wps_wl;
988 	int wow_nack;
989 	qdf_atomic_t is_wow_bus_suspended;
990 #ifdef WLAN_FEATURE_LPSS
991 	bool is_lpass_enabled;
992 #endif
993 	uint8_t staMaxLIModDtim;
994 	uint16_t sta_max_li_mod_dtim_ms;
995 	uint8_t staModDtim;
996 	uint8_t staDynamicDtim;
997 	uint32_t hw_bd_id;
998 	uint32_t hw_bd_info[HW_BD_INFO_SIZE];
999 	uint32_t miracast_value;
1000 	qdf_mc_timer_t log_completion_timer;
1001 	uint32_t old_hw_mode_index;
1002 	uint32_t new_hw_mode_index;
1003 	uint16_t self_gen_frm_pwr;
1004 	bool tx_chain_mask_cck;
1005 	qdf_mc_timer_t service_ready_ext_timer;
1006 
1007 	QDF_STATUS (*csr_roam_auth_event_handle_cb)(struct mac_context *mac,
1008 						    uint8_t vdev_id,
1009 						    struct qdf_mac_addr bssid,
1010 						    uint32_t akm);
1011 	QDF_STATUS (*pe_roam_synch_cb)(struct mac_context *mac,
1012 		uint8_t vdev_id,
1013 		struct roam_offload_synch_ind *roam_synch_data,
1014 		uint16_t ie_len,
1015 		enum sir_roam_op_code reason);
1016 	QDF_STATUS (*pe_disconnect_cb) (struct mac_context *mac,
1017 					uint8_t vdev_id,
1018 					uint8_t *deauth_disassoc_frame,
1019 					uint16_t deauth_disassoc_frame_len,
1020 					uint16_t reason_code);
1021 	QDF_STATUS (*pe_roam_set_ie_cb)(struct mac_context *mac_ctx,
1022 					uint8_t vdev_id, uint16_t dot11_mode,
1023 					enum QDF_OPMODE device_mode);
1024 	qdf_wake_lock_t wmi_cmd_rsp_wake_lock;
1025 	qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock;
1026 	qdf_runtime_lock_t sap_prevent_runtime_pm_lock;
1027 	qdf_runtime_lock_t ndp_prevent_runtime_pm_lock;
1028 	enum active_apf_mode active_uc_apf_mode;
1029 	enum active_apf_mode active_mc_bc_apf_mode;
1030 	struct wma_ini_config ini_config;
1031 	struct wma_valid_channels saved_chan;
1032 	bool nan_datapath_enabled;
1033 	bool fw_timeout_crash;
1034 	bool sub_20_support;
1035 	bool is_dfs_offloaded;
1036 	ol_txrx_pktdump_cb wma_mgmt_tx_packetdump_cb;
1037 	ol_txrx_pktdump_cb wma_mgmt_rx_packetdump_cb;
1038 	bool rcpi_enabled;
1039 	tSirLLStatsResults *link_stats_results;
1040 	qdf_mutex_t radio_stats_lock;
1041 	uint64_t tx_fail_cnt;
1042 #ifdef FEATURE_WLM_STATS
1043 	struct wma_wlm_stats_data wlm_data;
1044 #endif
1045 #ifdef WLAN_FEATURE_11AX
1046 	struct he_capability he_cap;
1047 #endif
1048 	uint8_t bandcapability;
1049 	bool tx_bfee_8ss_enabled;
1050 	bool in_imps;
1051 	bool dynamic_nss_chains_support;
1052 	uint8_t  ito_repeat_count;
1053 	bool fw_therm_throt_support;
1054 	bool enable_tx_compl_tsf64;
1055 #ifdef WLAN_FEATURE_11BE
1056 	struct eht_capability eht_cap;
1057 #endif
1058 	qdf_atomic_t sap_num_clients_connected;
1059 	qdf_atomic_t go_num_clients_connected;
1060 	qdf_wake_lock_t sap_d3_wow_wake_lock;
1061 	qdf_wake_lock_t go_d3_wow_wake_lock;
1062 	enum set_hw_mode_status set_hw_mode_resp_status;
1063 	qdf_time_t *pagefault_wakeups_ts;
1064 	uint8_t num_page_fault_wakeups;
1065 } t_wma_handle, *tp_wma_handle;
1066 
1067 /**
1068  * wma_validate_handle() - Validate WMA handle
1069  * @wma_handle: wma handle
1070  *
1071  * This function will log on error and hence caller should not log on error
1072  *
1073  * Return: errno if WMA handle is NULL; 0 otherwise
1074  */
1075 #define wma_validate_handle(wma_handle) \
1076         __wma_validate_handle(wma_handle, __func__)
1077 int __wma_validate_handle(tp_wma_handle wma_handle, const char *func);
1078 
1079 /**
1080  * wma_vdev_nss_chain_params_send() - send vdev nss chain params to fw.
1081  * @vdev_id: vdev_id
1082  * @user_cfg: pointer to the params structure
1083  *
1084  * This function sends nss chain params to the fw
1085  *
1086  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on error
1087  */
1088 QDF_STATUS
1089 wma_vdev_nss_chain_params_send(uint8_t vdev_id,
1090 			       struct wlan_mlme_nss_chains *user_cfg);
1091 
1092 /**
1093  * wma_send_regdomain_info_to_fw() - send regdomain info to fw
1094  * @reg_dmn: reg domain
1095  * @regdmn2G: 2G reg domain
1096  * @regdmn5G: 5G reg domain
1097  * @ctl2G: 2G test limit
1098  * @ctl5G: 5G test limit
1099  *
1100  * Return: none
1101  */
1102 void wma_send_regdomain_info_to_fw(uint32_t reg_dmn, uint16_t regdmn2G,
1103 				   uint16_t regdmn5G, uint8_t ctl2G,
1104 				   uint8_t ctl5G);
1105 /**
1106  * enum frame_index - Frame index
1107  * @GENERIC_NODOWNLD_NOACK_COMP_INDEX: Frame index for no download comp no ack
1108  * @GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX: Frame index for download comp no ack
1109  * @GENERIC_DOWNLD_COMP_ACK_COMP_INDEX: Frame index for download comp and ack
1110  * @GENERIC_NODOWLOAD_ACK_COMP_INDEX: Frame index for no download comp and ack
1111  * @FRAME_INDEX_MAX: maximum frame index
1112  */
1113 enum frame_index {
1114 	GENERIC_NODOWNLD_NOACK_COMP_INDEX,
1115 	GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX,
1116 	GENERIC_DOWNLD_COMP_ACK_COMP_INDEX,
1117 	GENERIC_NODOWLOAD_ACK_COMP_INDEX,
1118 	FRAME_INDEX_MAX
1119 };
1120 
1121 /**
1122  * struct wma_tx_ack_work_ctx - tx ack work context
1123  * @wma_handle: wma handle
1124  * @sub_type: sub type
1125  * @status: status
1126  * @ack_cmp_work: work structure
1127  */
1128 struct wma_tx_ack_work_ctx {
1129 	tp_wma_handle wma_handle;
1130 	uint16_t sub_type;
1131 	int32_t status;
1132 	qdf_work_t ack_cmp_work;
1133 };
1134 
1135 /**
1136  * struct wma_target_req - target request parameters
1137  * @event_timeout: event timeout
1138  * @node: list
1139  * @user_data: user data
1140  * @addr: Mac address
1141  * @msg_type: message type
1142  * @vdev_id: vdev id
1143  * @type: type
1144  */
1145 struct wma_target_req {
1146 	qdf_mc_timer_t event_timeout;
1147 	qdf_list_node_t node;
1148 	void *user_data;
1149 	struct qdf_mac_addr addr;
1150 	uint32_t msg_type;
1151 	uint8_t vdev_id;
1152 	uint8_t type;
1153 };
1154 
1155 /**
1156  * struct t_thermal_cmd_params - thermal command parameters
1157  * @minTemp: minimum temperature
1158  * @maxTemp: maximum temperature
1159  * @thermalEnable: thermal enable
1160  * @thermal_action: thermal action
1161  */
1162 typedef struct {
1163 	uint16_t minTemp;
1164 	uint16_t maxTemp;
1165 	uint8_t thermalEnable;
1166 	enum thermal_mgmt_action_code thermal_action;
1167 } t_thermal_cmd_params, *tp_thermal_cmd_params;
1168 
1169 /**
1170  * enum wma_cfg_cmd_id - wma cmd ids
1171  * @WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID: txrx firmware stats enable command
1172  * @WMA_VDEV_TXRX_FWSTATS_RESET_CMDID: txrx firmware stats reset command
1173  * @WMA_VDEV_MCC_SET_TIME_LATENCY: set MCC latency time
1174  * @WMA_VDEV_MCC_SET_TIME_QUOTA: set MCC time quota
1175  * @WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID: get IPA microcontroller fw stats
1176  * @WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID: get IPA uC wifi-sharing stats
1177  * @WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID: set IPA uC quota limit
1178  *
1179  * wma command ids for configuration request which
1180  * does not involve sending a wmi command.
1181  */
1182 enum wma_cfg_cmd_id {
1183 	WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID = WMI_CMDID_MAX,
1184 	WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
1185 	WMA_VDEV_MCC_SET_TIME_LATENCY,
1186 	WMA_VDEV_MCC_SET_TIME_QUOTA,
1187 	WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID,
1188 	WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID,
1189 	WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID,
1190 	WMA_CMD_ID_MAX
1191 };
1192 
1193 /**
1194  * struct wma_trigger_uapsd_params - trigger uapsd parameters
1195  * @wmm_ac: wmm access category
1196  * @user_priority: user priority
1197  * @service_interval: service interval
1198  * @suspend_interval: suspend interval
1199  * @delay_interval: delay interval
1200  */
1201 typedef struct wma_trigger_uapsd_params {
1202 	uint32_t wmm_ac;
1203 	uint32_t user_priority;
1204 	uint32_t service_interval;
1205 	uint32_t suspend_interval;
1206 	uint32_t delay_interval;
1207 } t_wma_trigger_uapsd_params, *tp_wma_trigger_uapsd_params;
1208 
1209 /**
1210  * enum uapsd_peer_param_max_sp - U-APSD maximum service period of peer station
1211  * @UAPSD_MAX_SP_LEN_UNLIMITED: unlimited max service period
1212  * @UAPSD_MAX_SP_LEN_2: max service period = 2
1213  * @UAPSD_MAX_SP_LEN_4: max service period = 4
1214  * @UAPSD_MAX_SP_LEN_6: max service period = 6
1215  */
1216 enum uapsd_peer_param_max_sp {
1217 	UAPSD_MAX_SP_LEN_UNLIMITED = 0,
1218 	UAPSD_MAX_SP_LEN_2 = 2,
1219 	UAPSD_MAX_SP_LEN_4 = 4,
1220 	UAPSD_MAX_SP_LEN_6 = 6
1221 };
1222 
1223 /**
1224  * enum uapsd_peer_param_enabled_ac - U-APSD Enabled AC's of peer station
1225  * @UAPSD_VO_ENABLED: enable uapsd for voice
1226  * @UAPSD_VI_ENABLED: enable uapsd for video
1227  * @UAPSD_BK_ENABLED: enable uapsd for background
1228  * @UAPSD_BE_ENABLED: enable uapsd for best effort
1229  */
1230 enum uapsd_peer_param_enabled_ac {
1231 	UAPSD_VO_ENABLED = 0x01,
1232 	UAPSD_VI_ENABLED = 0x02,
1233 	UAPSD_BK_ENABLED = 0x04,
1234 	UAPSD_BE_ENABLED = 0x08
1235 };
1236 
1237 /**
1238  * enum profile_id_t - Firmware profiling index
1239  * @PROF_CPU_IDLE: cpu idle profile
1240  * @PROF_PPDU_PROC: ppdu processing profile
1241  * @PROF_PPDU_POST: ppdu post profile
1242  * @PROF_HTT_TX_INPUT: htt tx input profile
1243  * @PROF_MSDU_ENQ: msdu enqueue profile
1244  * @PROF_PPDU_POST_HAL: ppdu post profile
1245  * @PROF_COMPUTE_TX_TIME: tx time profile
1246  * @PROF_MAX_ID: max profile index
1247  */
1248 enum profile_id_t {
1249 	PROF_CPU_IDLE,
1250 	PROF_PPDU_PROC,
1251 	PROF_PPDU_POST,
1252 	PROF_HTT_TX_INPUT,
1253 	PROF_MSDU_ENQ,
1254 	PROF_PPDU_POST_HAL,
1255 	PROF_COMPUTE_TX_TIME,
1256 	PROF_MAX_ID,
1257 };
1258 
1259 /**
1260  * struct p2p_ie - P2P IE structural definition.
1261  * @p2p_id: p2p id
1262  * @p2p_len: p2p length
1263  * @p2p_oui: p2p OUI
1264  * @p2p_oui_type: p2p OUI type
1265  */
1266 struct p2p_ie {
1267 	uint8_t p2p_id;
1268 	uint8_t p2p_len;
1269 	uint8_t p2p_oui[3];
1270 	uint8_t p2p_oui_type;
1271 } __packed;
1272 
1273 /**
1274  * struct p2p_noa_descriptor - noa descriptor
1275  * @type_count: 255: continuous schedule, 0: reserved
1276  * @duration: Absent period duration in micro seconds
1277  * @interval: Absent period interval in micro seconds
1278  * @start_time: 32 bit tsf time when in starts
1279  */
1280 struct p2p_noa_descriptor {
1281 	uint8_t type_count;
1282 	uint32_t duration;
1283 	uint32_t interval;
1284 	uint32_t start_time;
1285 } __packed;
1286 
1287 /**
1288  * struct p2p_sub_element_noa - p2p noa element
1289  * @p2p_sub_id: p2p sub id
1290  * @p2p_sub_len: p2p sub length
1291  * @index: identifies instance of NOA su element
1292  * @oppPS: oppPS state of the AP
1293  * @ctwindow: ctwindow in TUs
1294  * @num_descriptors: number of NOA descriptors
1295  * @noa_descriptors: noa descriptors
1296  */
1297 struct p2p_sub_element_noa {
1298 	uint8_t p2p_sub_id;
1299 	uint8_t p2p_sub_len;
1300 	uint8_t index;          /* identifies instance of NOA su element */
1301 	uint8_t oppPS:1,        /* oppPS state of the AP */
1302 		ctwindow:7;     /* ctwindow in TUs */
1303 	uint8_t num_descriptors;        /* number of NOA descriptors */
1304 	struct p2p_noa_descriptor noa_descriptors[WMA_MAX_NOA_DESCRIPTORS];
1305 };
1306 
1307 /**
1308  * struct wma_decap_info_t - decapsulation info
1309  * @hdr: header
1310  * @hdr_len: header length
1311  */
1312 struct wma_decap_info_t {
1313 	uint8_t hdr[sizeof(struct ieee80211_qosframe_addr4)];
1314 	int32_t hdr_len;
1315 };
1316 
1317 /**
1318  * enum packet_power_save - packet power save params
1319  * @WMI_VDEV_PPS_PAID_MATCH: paid match param
1320  * @WMI_VDEV_PPS_GID_MATCH: gid match param
1321  * @WMI_VDEV_PPS_EARLY_TIM_CLEAR: early tim clear param
1322  * @WMI_VDEV_PPS_EARLY_DTIM_CLEAR: early dtim clear param
1323  * @WMI_VDEV_PPS_EOF_PAD_DELIM: eof pad delim param
1324  * @WMI_VDEV_PPS_MACADDR_MISMATCH: macaddr mismatch param
1325  * @WMI_VDEV_PPS_DELIM_CRC_FAIL: delim CRC fail param
1326  * @WMI_VDEV_PPS_GID_NSTS_ZERO: gid nsts zero param
1327  * @WMI_VDEV_PPS_RSSI_CHECK: RSSI check param
1328  * @WMI_VDEV_PPS_5G_EBT: 5G ebt param
1329  */
1330 typedef enum {
1331 	WMI_VDEV_PPS_PAID_MATCH = 0,
1332 	WMI_VDEV_PPS_GID_MATCH = 1,
1333 	WMI_VDEV_PPS_EARLY_TIM_CLEAR = 2,
1334 	WMI_VDEV_PPS_EARLY_DTIM_CLEAR = 3,
1335 	WMI_VDEV_PPS_EOF_PAD_DELIM = 4,
1336 	WMI_VDEV_PPS_MACADDR_MISMATCH = 5,
1337 	WMI_VDEV_PPS_DELIM_CRC_FAIL = 6,
1338 	WMI_VDEV_PPS_GID_NSTS_ZERO = 7,
1339 	WMI_VDEV_PPS_RSSI_CHECK = 8,
1340 	WMI_VDEV_VHT_SET_GID_MGMT = 9,
1341 	WMI_VDEV_PPS_5G_EBT = 10
1342 } packet_power_save;
1343 
1344 /**
1345  * enum green_tx_param - green tx parameters
1346  * @wmi_vdev_param_gtx_ht_mcs: ht mcs param
1347  * @wmi_vdev_param_gtx_vht_mcs: vht mcs param
1348  * @wmi_vdev_param_gtx_usr_cfg: user cfg param
1349  * @wmi_vdev_param_gtx_thre: thre param
1350  * @wmi_vdev_param_gtx_margin: green tx margin param
1351  * @wmi_vdev_param_gtx_step: green tx step param
1352  * @wmi_vdev_param_gtx_mintpc: mintpc param
1353  * @wmi_vdev_param_gtx_bw_mask: bandwidth mask
1354  */
1355 typedef enum {
1356 	wmi_vdev_param_gtx_ht_mcs,
1357 	wmi_vdev_param_gtx_vht_mcs,
1358 	wmi_vdev_param_gtx_usr_cfg,
1359 	wmi_vdev_param_gtx_thre,
1360 	wmi_vdev_param_gtx_margin,
1361 	wmi_vdev_param_gtx_step,
1362 	wmi_vdev_param_gtx_mintpc,
1363 	wmi_vdev_param_gtx_bw_mask,
1364 } green_tx_param;
1365 
1366 /**
1367  * enum uapsd_ac - U-APSD Access Categories
1368  * @UAPSD_BE: best effort
1369  * @UAPSD_BK: back ground
1370  * @UAPSD_VI: video
1371  * @UAPSD_VO: voice
1372  */
1373 enum uapsd_ac {
1374 	UAPSD_BE,
1375 	UAPSD_BK,
1376 	UAPSD_VI,
1377 	UAPSD_VO
1378 };
1379 
1380 /**
1381  * wma_disable_uapsd_per_ac() - disable uapsd per ac
1382  * @wmi_handle: wma handle
1383  * @vdev_id: vdev id
1384  * @ac: access category
1385  *
1386  * Return: QDF_STATUS_SUCCESS for success or error code.
1387  */
1388 QDF_STATUS wma_disable_uapsd_per_ac(tp_wma_handle wma_handle,
1389 				    uint32_t vdev_id, enum uapsd_ac ac);
1390 
1391 /**
1392  * enum uapsd_up - U-APSD User Priorities
1393  * @UAPSD_UP_BE: best effort
1394  * @UAPSD_UP_BK: back ground
1395  * @UAPSD_UP_RESV: reserve
1396  * @UAPSD_UP_EE: Excellent Effort
1397  * @UAPSD_UP_CL: Critical Applications
1398  * @UAPSD_UP_VI: video
1399  * @UAPSD_UP_VO: voice
1400  * @UAPSD_UP_NC: Network Control
1401  */
1402 enum uapsd_up {
1403 	UAPSD_UP_BE,
1404 	UAPSD_UP_BK,
1405 	UAPSD_UP_RESV,
1406 	UAPSD_UP_EE,
1407 	UAPSD_UP_CL,
1408 	UAPSD_UP_VI,
1409 	UAPSD_UP_VO,
1410 	UAPSD_UP_NC,
1411 	UAPSD_UP_MAX
1412 };
1413 
1414 /**
1415  * wma_trigger_uapsd_params() - set trigger uapsd parameter
1416  * @wmi_handle: wma handle
1417  * @vdev_id: vdev id
1418  * @trigger_uapsd_params: trigger uapsd parameters
1419  *
1420  * This function sets the trigger uapsd
1421  * params such as service interval, delay
1422  * interval and suspend interval which
1423  * will be used by the firmware to send
1424  * trigger frames periodically when there
1425  * is no traffic on the transmit side.
1426  *
1427  * Return: QDF_STATUS_SUCCESS for success or error code.
1428  */
1429 QDF_STATUS wma_trigger_uapsd_params(tp_wma_handle wma_handle, uint32_t vdev_id,
1430 				    tp_wma_trigger_uapsd_params
1431 				    trigger_uapsd_params);
1432 
1433 void wma_send_flush_logs_to_fw(tp_wma_handle wma_handle);
1434 void wma_log_completion_timeout(void *data);
1435 
1436 #ifdef FEATURE_RSSI_MONITOR
1437 /**
1438  * wma_set_rssi_monitoring() - set rssi monitoring
1439  * @handle: WMA handle
1440  * @req: rssi monitoring request structure
1441  *
1442  * This function takes the incoming @req and sends it down to the
1443  * firmware
1444  *
1445  * Return: QDF_STATUS
1446  */
1447 QDF_STATUS wma_set_rssi_monitoring(tp_wma_handle wma,
1448 				   struct rssi_monitor_param *req);
1449 #else /* FEATURE_RSSI_MONITOR */
1450 static inline
1451 QDF_STATUS wma_set_rssi_monitoring(tp_wma_handle wma,
1452 				   struct rssi_monitor_param *req)
1453 {
1454 	return QDF_STATUS_SUCCESS;
1455 }
1456 #endif /* FEATURE_RSSI_MONITOR */
1457 
1458 /**
1459  * wma_map_pcl_weights  - Map WMA pcl weights to wmi pcl weights
1460  * @pcl_weight: Input PCL weight to be converted to wmi format
1461  *
1462  * Return: wmi_pcl_chan_weight
1463  */
1464 wmi_pcl_chan_weight wma_map_pcl_weights(uint32_t pcl_weight);
1465 
1466 QDF_STATUS wma_send_set_pcl_cmd(tp_wma_handle wma_handle,
1467 				struct set_pcl_req *msg);
1468 
1469 QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle,
1470 		struct policy_mgr_hw_mode *msg);
1471 
1472 QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle,
1473 		struct policy_mgr_dual_mac_config *msg);
1474 QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle,
1475 		struct sir_antenna_mode_param *msg);
1476 
1477 struct wma_target_req *wma_fill_hold_req(tp_wma_handle wma,
1478 				    uint8_t vdev_id, uint32_t msg_type,
1479 				    uint8_t type, void *params,
1480 				    uint32_t timeout);
1481 
1482 int wma_mgmt_tx_completion_handler(void *handle, uint8_t *cmpl_event_params,
1483 				   uint32_t len);
1484 int wma_mgmt_tx_bundle_completion_handler(void *handle,
1485 	uint8_t *cmpl_event_params, uint32_t len);
1486 uint32_t wma_get_vht_ch_width(void);
1487 
1488 #ifdef WLAN_FEATURE_11BE
1489 /**
1490  * wma_get_orig_eht_ch_width() - Get original EHT channel width supported
1491  *
1492  * API to get original EHT channel width
1493  *
1494  * Return: void
1495  */
1496 uint32_t wma_get_orig_eht_ch_width(void);
1497 
1498 /**
1499  * wma_get_orig_eht_ch_width() - Get current EHT channel width supported
1500  *
1501  * API to get current EHT channel width
1502  *
1503  * Return: void
1504  */
1505 uint32_t wma_get_eht_ch_width(void);
1506 #else
1507 static inline uint32_t wma_get_orig_eht_ch_width(void)
1508 {
1509 	return 0;
1510 }
1511 
1512 static inline uint32_t wma_get_eht_ch_width(void)
1513 {
1514 	return 0;
1515 }
1516 #endif
1517 
1518 QDF_STATUS
1519 wma_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param,
1520 		A_UINT32 val, A_UINT32 *module_id_bitmap,
1521 		A_UINT32 bitmap_len);
1522 
1523 #ifdef FEATURE_LFR_SUBNET_DETECTION
1524 /**
1525  * wma_set_gateway_params() - set gateway parameters
1526  * @wma: WMA handle
1527  * @req: gateway update request parameter structure
1528  *
1529  * This function takes the incoming @req and sends it down to the
1530  * firmware
1531  *
1532  * Return: QDF_STATUS
1533  */
1534 QDF_STATUS wma_set_gateway_params(tp_wma_handle wma,
1535 				  struct gateway_update_req_param *req);
1536 #else
1537 static inline
1538 QDF_STATUS wma_set_gateway_params(tp_wma_handle wma,
1539 				  struct gateway_update_req_param *req)
1540 {
1541 	return QDF_STATUS_SUCCESS;
1542 }
1543 #endif /* FEATURE_LFR_SUBNET_DETECTION */
1544 
1545 QDF_STATUS wma_ht40_stop_obss_scan(tp_wma_handle wma_handle,
1546 				int32_t vdev_id);
1547 
1548 QDF_STATUS wma_process_fw_test_cmd(WMA_HANDLE handle,
1549 				   struct set_fwtest_params *wma_fwtest);
1550 
1551 QDF_STATUS wma_send_ht40_obss_scanind(tp_wma_handle wma,
1552 	struct obss_ht40_scanind *req);
1553 
1554 uint32_t wma_get_num_of_setbits_from_bitmask(uint32_t mask);
1555 
1556 #ifdef FEATURE_WLAN_APF
1557 /**
1558  *  wma_get_apf_caps_event_handler() - Event handler for get apf capability
1559  *  @handle: WMA global handle
1560  *  @cmd_param_info: command event data
1561  *  @len: Length of @cmd_param_info
1562  *
1563  *  Return: 0 on Success or Errno on failure
1564  */
1565 int wma_get_apf_caps_event_handler(void *handle,
1566 				   u_int8_t *cmd_param_info,
1567 				   u_int32_t len);
1568 
1569 /**
1570  * wma_get_apf_capabilities - Send get apf capability to firmware
1571  * @wma_handle: wma handle
1572  *
1573  * Return: QDF_STATUS enumeration.
1574  */
1575 QDF_STATUS wma_get_apf_capabilities(tp_wma_handle wma);
1576 
1577 /**
1578  *  wma_set_apf_instructions - Set apf instructions to firmware
1579  *  @wma: wma handle
1580  *  @apf_set_offload: APF offload information to set to firmware
1581  *
1582  *  Return: QDF_STATUS enumeration
1583  */
1584 QDF_STATUS
1585 wma_set_apf_instructions(tp_wma_handle wma,
1586 			 struct sir_apf_set_offload *apf_set_offload);
1587 
1588 /**
1589  * wma_send_apf_enable_cmd - Send apf enable/disable cmd
1590  * @wma_handle: wma handle
1591  * @vdev_id: vdev id
1592  * @apf_enable: true: Enable APF Int., false: Disable APF Int.
1593  *
1594  * Return: QDF_STATUS enumeration.
1595  */
1596 QDF_STATUS wma_send_apf_enable_cmd(WMA_HANDLE handle, uint8_t vdev_id,
1597 				   bool apf_enable);
1598 
1599 /**
1600  * wma_send_apf_write_work_memory_cmd - Command to write into the apf work
1601  * memory
1602  * @wma_handle: wma handle
1603  * @write_params: APF parameters for the write operation
1604  *
1605  * Return: QDF_STATUS enumeration.
1606  */
1607 QDF_STATUS
1608 wma_send_apf_write_work_memory_cmd(WMA_HANDLE handle,
1609 				   struct wmi_apf_write_memory_params
1610 								*write_params);
1611 
1612 /**
1613  * wma_send_apf_read_work_memory_cmd - Command to get part of apf work memory
1614  * @wma_handle: wma handle
1615  * @callback: HDD callback to receive apf get mem event
1616  * @context: Context for the HDD callback
1617  * @read_params: APF parameters for the get operation
1618  *
1619  * Return: QDF_STATUS enumeration.
1620  */
1621 QDF_STATUS
1622 wma_send_apf_read_work_memory_cmd(WMA_HANDLE handle,
1623 				  struct wmi_apf_read_memory_params
1624 								*read_params);
1625 
1626 /**
1627  * wma_apf_read_work_memory_event_handler - Event handler for get apf mem
1628  * operation
1629  * @handle: wma handle
1630  * @evt_buf: Buffer pointer to the event
1631  * @len: Length of the event buffer
1632  *
1633  * Return: status.
1634  */
1635 int wma_apf_read_work_memory_event_handler(void *handle, uint8_t *evt_buf,
1636 					   uint32_t len);
1637 #else /* FEATURE_WLAN_APF */
1638 static inline QDF_STATUS wma_get_apf_capabilities(tp_wma_handle wma)
1639 {
1640 	return QDF_STATUS_SUCCESS;
1641 }
1642 
1643 static inline QDF_STATUS
1644 wma_set_apf_instructions(tp_wma_handle wma,
1645 			 struct sir_apf_set_offload *apf_set_offload)
1646 {
1647 	return QDF_STATUS_SUCCESS;
1648 }
1649 #endif /* FEATURE_WLAN_APF */
1650 
1651 void wma_process_set_pdev_ie_req(tp_wma_handle wma,
1652 		struct set_ie_param *ie_params);
1653 void wma_process_set_pdev_ht_ie_req(tp_wma_handle wma,
1654 		struct set_ie_param *ie_params);
1655 void wma_process_set_pdev_vht_ie_req(tp_wma_handle wma,
1656 		struct set_ie_param *ie_params);
1657 
1658 QDF_STATUS wma_remove_peer(tp_wma_handle wma, uint8_t *mac_addr,
1659 			   uint8_t vdev_id, bool no_fw_peer_delete);
1660 
1661 /**
1662  * wma_create_peer() - Call wma_add_peer() to send peer create command to fw
1663  * and setup cdp peer
1664  * @wma: wma handle
1665  * @peer_addr: peer mac address
1666  * @peer_type: peer type
1667  * @vdev_id: vdev id
1668  * @peer_mld_addr: peer mld address
1669  * @is_assoc_peer: is assoc peer or not
1670  *
1671  * Return: QDF_STATUS
1672  */
1673 QDF_STATUS wma_create_peer(tp_wma_handle wma,
1674 			   uint8_t peer_addr[QDF_MAC_ADDR_SIZE],
1675 			   u_int32_t peer_type, u_int8_t vdev_id,
1676 			   uint8_t peer_mld_addr[QDF_MAC_ADDR_SIZE],
1677 			   bool is_assoc_peer);
1678 
1679 /**
1680  * wma_create_objmgr_peer() - create objmgr peer information in host driver
1681  * @wma: wma handle
1682  * @vdev_id: vdev id
1683  * @peer_addr: peer mac address
1684  * @wma_peer_type: peer type of enum wmi_peer_type
1685  * @peer_mld: peer mld address
1686  *
1687  * Return: Pointer to objmgr_peer
1688  */
1689 struct wlan_objmgr_peer *wma_create_objmgr_peer(tp_wma_handle wma,
1690 						uint8_t vdev_id,
1691 						uint8_t *peer_addr,
1692 						uint32_t wma_peer_type,
1693 						uint8_t *peer_mld);
1694 
1695 /**
1696  * wma_remove_objmgr_peer() - Remove Object manager peer
1697  * @wma:  WMA handle
1698  * @obj_vdev: Vdev object pointer
1699  * @peer_addr: Peer mac address
1700  *
1701  * Return: None
1702  */
1703 void wma_remove_objmgr_peer(tp_wma_handle wma,
1704 			    struct wlan_objmgr_vdev *obj_vdev,
1705 			    uint8_t *peer_addr);
1706 
1707 QDF_STATUS wma_peer_unmap_conf_cb(uint8_t vdev_id,
1708 				  uint32_t peer_id_cnt,
1709 				  uint16_t *peer_id_list);
1710 
1711 bool wma_objmgr_peer_exist(tp_wma_handle wma,
1712 			   uint8_t *peer_addr, uint8_t *peer_vdev_id);
1713 
1714 /**
1715  * wma_get_cca_stats() - send request to fw to get CCA
1716  * @wmi_hdl: wma handle
1717  * @vdev_id: vdev id
1718  *
1719  * Return: QDF status
1720  */
1721 QDF_STATUS wma_get_cca_stats(tp_wma_handle wma_handle,
1722 				uint8_t vdev_id);
1723 
1724 struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle);
1725 
1726 /**
1727  * wma_chan_phy__mode() - get host phymode for channel
1728  * @freq: channel freq
1729  * @chan_width: maximum channel width possible
1730  * @dot11_mode: maximum phy_mode possible
1731  *
1732  * Return: return host phymode
1733  */
1734 enum wlan_phymode wma_chan_phy_mode(uint32_t freq, enum phy_ch_width chan_width,
1735 				    uint8_t dot11_mode);
1736 
1737 /**
1738  * wma_fw_to_host_phymode() - convert fw to host phymode
1739  * @phymode: phymode to convert
1740  *
1741  * Return: one of the values defined in enum wlan_phymode;
1742  *         or WLAN_PHYMODE_AUTO if the conversion fails
1743  */
1744 enum wlan_phymode wma_fw_to_host_phymode(WMI_HOST_WLAN_PHY_MODE phymode);
1745 
1746 
1747 #ifdef FEATURE_OEM_DATA_SUPPORT
1748 /**
1749  * wma_start_oem_req_cmd() - send oem request command to fw
1750  * @wma_handle: wma handle
1751  * @oem_data_req: the pointer of oem req buf
1752  *
1753  * Return: QDF status
1754  */
1755 QDF_STATUS wma_start_oem_req_cmd(tp_wma_handle wma_handle,
1756 				 struct oem_data_req *oem_data_req);
1757 #endif
1758 
1759 #ifdef FEATURE_OEM_DATA
1760 /**
1761  * wma_start_oem_data_cmd() - send oem data command to fw
1762  * @wma_handle: wma handle
1763  * @oem_data: the pointer of oem data buf
1764  *
1765  * Return: QDF status
1766  */
1767 QDF_STATUS wma_start_oem_data_cmd(tp_wma_handle wma_handle,
1768 				  struct oem_data *oem_data);
1769 #endif
1770 
1771 QDF_STATUS wma_enable_disable_caevent_ind(tp_wma_handle wma_handle,
1772 				uint8_t val);
1773 void wma_register_packetdump_callback(
1774 		ol_txrx_pktdump_cb wma_mgmt_tx_packetdump_cb,
1775 		ol_txrx_pktdump_cb wma_mgmt_rx_packetdump_cb);
1776 void wma_deregister_packetdump_callback(void);
1777 void wma_update_sta_inactivity_timeout(tp_wma_handle wma,
1778 		struct sme_sta_inactivity_timeout  *sta_inactivity_timer);
1779 
1780 /**
1781  * wma_form_rx_packet() - form rx cds packet
1782  * @buf: buffer
1783  * @mgmt_rx_params: mgmt rx params
1784  * @rx_pkt: cds packet
1785  *
1786  * This functions forms a cds packet from the rx mgmt frame received.
1787  *
1788  * Return: 0 for success or error code
1789  */
1790 int wma_form_rx_packet(qdf_nbuf_t buf,
1791 			struct mgmt_rx_event_params *mgmt_rx_params,
1792 			cds_pkt_t *rx_pkt);
1793 
1794 /**
1795  * wma_mgmt_unified_cmd_send() - send the mgmt tx packet
1796  * @vdev: objmgr vdev
1797  * @buf: buffer
1798  * @desc_id: desc id
1799  * @mgmt_tx_params: mgmt rx params
1800  *
1801  * This functions sends mgmt tx packet to WMI layer.
1802  *
1803  * Return: 0 for success or error code
1804  */
1805 QDF_STATUS wma_mgmt_unified_cmd_send(struct wlan_objmgr_vdev *vdev,
1806 				qdf_nbuf_t buf, uint32_t desc_id,
1807 				void *mgmt_tx_params);
1808 
1809 #ifndef CONFIG_HL_SUPPORT
1810 /**
1811  * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts
1812  * @pdev: objmgr pdev
1813  * @buf: buffer
1814  *
1815  * This function does the dma unmap of the pending mgmt packet cleanup
1816  *
1817  * Return: None
1818  */
1819 void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev,
1820 			    qdf_nbuf_t buf);
1821 /**
1822  * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts
1823  * @pdev: objmgr pdev
1824  * @buf: buffer
1825  *
1826  * This is a cb function drains all mgmt packets of a vdev.
1827  * This is called in event of target going down without sending completions.
1828  *
1829  * Return: QDF_STATUS
1830  */
1831 QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer,
1832 				       qdf_nbuf_t buf);
1833 #else
1834 static inline void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev,
1835 					  qdf_nbuf_t buf)
1836 {}
1837 static inline QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer,
1838 						     qdf_nbuf_t buf)
1839 {
1840 	return QDF_STATUS_SUCCESS;
1841 }
1842 #endif
1843 
1844 /**
1845  * wma_chan_info_event_handler() - chan info event handler
1846  * @handle: wma handle
1847  * @event_buf: event handler data
1848  * @len: length of @event_buf
1849  *
1850  * this function will handle the WMI_CHAN_INFO_EVENTID
1851  *
1852  * Return: int
1853  */
1854 int wma_chan_info_event_handler(void *handle, uint8_t *event_buf,
1855 						uint32_t len);
1856 
1857 /**
1858  * wma_update_vdev_pause_bitmap() - update vdev pause bitmap
1859  * @vdev_id: the Id of the vdev to configure
1860  * @value: value pause bitmap value
1861  *
1862  * Return: None
1863  */
1864 static inline
1865 void wma_vdev_update_pause_bitmap(uint8_t vdev_id, uint16_t value)
1866 {
1867 	tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
1868 	struct wma_txrx_node *iface;
1869 
1870 	if (!wma)
1871 		return;
1872 
1873 	if (vdev_id >= wma->max_bssid) {
1874 		wma_err("Invalid vdev_id: %d", vdev_id);
1875 		return;
1876 	}
1877 
1878 	iface = &wma->interfaces[vdev_id];
1879 
1880 	if (!iface) {
1881 		wma_err("Interface is NULL");
1882 		return;
1883 	}
1884 
1885 	iface->pause_bitmap = value;
1886 }
1887 
1888 /**
1889  * wma_vdev_get_pause_bitmap() - Get vdev pause bitmap
1890  * @vdev_id: the Id of the vdev to configure
1891  *
1892  * Return: Vdev pause bitmap value else 0 on error
1893  */
1894 static inline
1895 uint16_t wma_vdev_get_pause_bitmap(uint8_t vdev_id)
1896 {
1897 	tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
1898 	struct wma_txrx_node *iface;
1899 
1900 	if (!wma)
1901 		return 0;
1902 
1903 	iface = &wma->interfaces[vdev_id];
1904 
1905 	if (!iface) {
1906 		wma_err("Interface is NULL");
1907 		return 0;
1908 	}
1909 
1910 	return iface->pause_bitmap;
1911 }
1912 
1913 /**
1914  * wma_vdev_is_device_in_low_pwr_mode - is device in power save mode
1915  * @vdev_id: the Id of the vdev to configure
1916  *
1917  * Return: true if device is in low power mode else false
1918  */
1919 static inline bool wma_vdev_is_device_in_low_pwr_mode(uint8_t vdev_id)
1920 {
1921 	tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
1922 	struct wma_txrx_node *iface;
1923 
1924 	if (!wma)
1925 		return 0;
1926 
1927 	iface = &wma->interfaces[vdev_id];
1928 
1929 	if (!iface) {
1930 		wma_err("Interface is NULL");
1931 		return 0;
1932 	}
1933 
1934 	return iface->in_bmps || wma->in_imps;
1935 }
1936 
1937 /**
1938  * wma_vdev_get_dtim_period - Get dtim period value from mlme
1939  * @vdev_id: vdev index number
1940  * @value: pointer to the value to fill out
1941  *
1942  * Note caller must verify return status before using value
1943  *
1944  * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else
1945  * QDF_STATUS_E_FAILURE
1946  */
1947 static inline
1948 QDF_STATUS wma_vdev_get_dtim_period(uint8_t vdev_id, uint8_t *value)
1949 {
1950 	tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
1951 	struct wma_txrx_node *iface;
1952 	/* set value to zero */
1953 	*value = 0;
1954 
1955 	if (!wma)
1956 		return QDF_STATUS_E_FAILURE;
1957 
1958 	iface = &wma->interfaces[vdev_id];
1959 
1960 	if (!iface)
1961 		return QDF_STATUS_E_FAILURE;
1962 
1963 	*value = iface->dtimPeriod;
1964 	return QDF_STATUS_SUCCESS;
1965 }
1966 
1967 /**
1968  * wma_vdev_get_beacon_interval - Get beacon interval from mlme
1969  * @vdev_id: vdev index number
1970  * @value: pointer to the value to fill out
1971  *
1972  * Note caller must verify return status before using value
1973  *
1974  * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else
1975  * QDF_STATUS_E_FAILURE
1976  */
1977 static inline
1978 QDF_STATUS wma_vdev_get_beacon_interval(uint8_t  vdev_id, uint16_t *value)
1979 {
1980 	tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
1981 	struct wma_txrx_node *iface;
1982 	/* set value to zero */
1983 	*value = 0;
1984 
1985 	if (!wma)
1986 		return QDF_STATUS_E_FAILURE;
1987 
1988 	iface = &wma->interfaces[vdev_id];
1989 
1990 	if (!iface)
1991 		return QDF_STATUS_E_FAILURE;
1992 
1993 	*value = iface->beaconInterval;
1994 	return QDF_STATUS_SUCCESS;
1995 }
1996 
1997 /**
1998  * wma_get_vdev_rate_flag - Get beacon rate flag from mlme
1999  * @vdev_id: vdev index number
2000  * @rate_flag: pointer to the value to fill out
2001  *
2002  * Note caller must verify return status before using value
2003  *
2004  * Return: QDF_STATUS_SUCCESS when fetched a valid value from mlme else
2005  * QDF_STATUS_E_FAILURE
2006  */
2007 static inline QDF_STATUS
2008 wma_get_vdev_rate_flag(struct wlan_objmgr_vdev *vdev, uint32_t *rate_flag)
2009 {
2010 	struct vdev_mlme_obj *mlme_obj;
2011 
2012 	if (!vdev) {
2013 		wma_err("vdev is NULL");
2014 		return QDF_STATUS_E_FAILURE;
2015 	}
2016 
2017 	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
2018 	if (!mlme_obj) {
2019 		wma_err("ailed to get mlme_obj");
2020 		return QDF_STATUS_E_FAILURE;
2021 	}
2022 
2023 	*rate_flag = mlme_obj->mgmt.rate_info.rate_flags;
2024 	return QDF_STATUS_SUCCESS;
2025 }
2026 
2027 /**
2028  * wma_vdev_set_pause_bit() - Set a bit in vdev pause bitmap
2029  * @vdev_id: the Id of the vdev to configure
2030  * @bit_pos: set bit position in pause bitmap
2031  *
2032  * Return: None
2033  */
2034 static inline
2035 void wma_vdev_set_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos)
2036 {
2037 	tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
2038 	struct wma_txrx_node *iface;
2039 
2040 	if (!wma)
2041 		return;
2042 
2043 	iface = &wma->interfaces[vdev_id];
2044 
2045 	if (!iface) {
2046 		wma_err("Interface is NULL");
2047 		return;
2048 	}
2049 
2050 	iface->pause_bitmap |= (1 << bit_pos);
2051 }
2052 
2053 /**
2054  * wma_vdev_clear_pause_bit() - Clear a bit from vdev pause bitmap
2055  * @vdev_id: the Id of the vdev to configure
2056  * @bit_pos: set bit position in pause bitmap
2057  *
2058  * Return: None
2059  */
2060 static inline
2061 void wma_vdev_clear_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos)
2062 {
2063 	tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
2064 	struct wma_txrx_node *iface;
2065 
2066 	if (!wma)
2067 		return;
2068 
2069 	iface = &wma->interfaces[vdev_id];
2070 
2071 	if (!iface) {
2072 		wma_err("Interface is NULL");
2073 		return;
2074 	}
2075 
2076 	iface->pause_bitmap &= ~(1 << bit_pos);
2077 }
2078 
2079 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
2080 /**
2081  * wma_send_roam_preauth_status() - Send the preauth status to wmi
2082  * @handle: WMA handle
2083  * @roam_req: Pointer to wmi_roam_auth_status_params from sae
2084  *
2085  * Return: None
2086  */
2087 void
2088 wma_send_roam_preauth_status(tp_wma_handle wma_handle,
2089 			     struct wmi_roam_auth_status_params *params);
2090 /**
2091  * wma_handle_roam_sync_timeout() - Update roaming status at wma layer
2092  * @wma_handle: wma handle
2093  * @info: Info for roaming start timer
2094  *
2095  * This function gets called in case of roaming offload timer get expired
2096  *
2097  * Return: None
2098  */
2099 void wma_handle_roam_sync_timeout(tp_wma_handle wma_handle,
2100 				  struct roam_sync_timeout_timer_info *info);
2101 #else
2102 static inline void
2103 wma_send_roam_preauth_status(tp_wma_handle wma_handle,
2104 			     struct wmi_roam_auth_status_params *params)
2105 {}
2106 
2107 static inline void
2108 wma_handle_roam_sync_timeout(tp_wma_handle wma_handle,
2109 			     struct roam_sync_timeout_timer_info *info)
2110 {}
2111 #endif
2112 
2113 #ifdef WMI_INTERFACE_EVENT_LOGGING
2114 static inline void wma_print_wmi_cmd_log(uint32_t count,
2115 					 qdf_abstract_print *print,
2116 					 void *print_priv)
2117 {
2118 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
2119 
2120 	if (wma) {
2121 		print(print_priv, "Command Log (count %u)", count);
2122 		wmi_print_cmd_log(wma->wmi_handle, count, print, print_priv);
2123 	}
2124 }
2125 
2126 static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count,
2127 						qdf_abstract_print *print,
2128 						void *print_priv)
2129 {
2130 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
2131 
2132 	if (wma) {
2133 		print(print_priv, "Command Tx Complete Log (count %u)", count);
2134 		wmi_print_cmd_tx_cmp_log(wma->wmi_handle, count, print,
2135 					 print_priv);
2136 	}
2137 }
2138 
2139 static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
2140 					      qdf_abstract_print *print,
2141 					      void *print_priv)
2142 {
2143 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
2144 
2145 	if (wma) {
2146 		print(print_priv, "Management Command Log (count %u)", count);
2147 		wmi_print_mgmt_cmd_log(wma->wmi_handle, count, print,
2148 				       print_priv);
2149 	}
2150 }
2151 
2152 static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count,
2153 						     qdf_abstract_print *print,
2154 						     void *print_priv)
2155 {
2156 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
2157 
2158 	if (wma) {
2159 		print(print_priv,
2160 		"Management Command Tx Complete Log (count %u)", count);
2161 		wmi_print_mgmt_cmd_tx_cmp_log(wma->wmi_handle, count, print,
2162 					      print_priv);
2163 	}
2164 }
2165 
2166 static inline void wma_print_wmi_event_log(uint32_t count,
2167 					   qdf_abstract_print *print,
2168 					   void *print_priv)
2169 {
2170 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
2171 
2172 	if (wma) {
2173 		print(print_priv, "Event Log (count %u)", count);
2174 		wmi_print_event_log(wma->wmi_handle, count, print, print_priv);
2175 	}
2176 }
2177 
2178 static inline void wma_print_wmi_rx_event_log(uint32_t count,
2179 					      qdf_abstract_print *print,
2180 					      void *print_priv)
2181 {
2182 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
2183 
2184 	if (wma) {
2185 		print(print_priv, "Rx Event Log (count %u)", count);
2186 		wmi_print_rx_event_log(wma->wmi_handle, count, print,
2187 				       print_priv);
2188 	}
2189 }
2190 
2191 static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
2192 						qdf_abstract_print *print,
2193 						void *print_priv)
2194 {
2195 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
2196 
2197 	if (wma) {
2198 		print(print_priv, "Management Event Log (count %u)", count);
2199 		wmi_print_mgmt_event_log(wma->wmi_handle, count, print,
2200 					 print_priv);
2201 	}
2202 }
2203 #else
2204 
2205 static inline void wma_print_wmi_cmd_log(uint32_t count,
2206 					 qdf_abstract_print *print,
2207 					 void *print_priv)
2208 {
2209 }
2210 
2211 static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count,
2212 						qdf_abstract_print *print,
2213 						void *print_priv)
2214 {
2215 }
2216 
2217 static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
2218 					      qdf_abstract_print *print,
2219 					      void *print_priv)
2220 {
2221 }
2222 
2223 static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count,
2224 						     qdf_abstract_print *print,
2225 						     void *print_priv)
2226 {
2227 }
2228 
2229 static inline void wma_print_wmi_event_log(uint32_t count,
2230 					   qdf_abstract_print *print,
2231 					   void *print_priv)
2232 {
2233 }
2234 
2235 static inline void wma_print_wmi_rx_event_log(uint32_t count,
2236 					      qdf_abstract_print *print,
2237 					      void *print_priv)
2238 {
2239 }
2240 
2241 static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
2242 						qdf_abstract_print *print,
2243 						void *print_priv)
2244 {
2245 }
2246 #endif /* WMI_INTERFACE_EVENT_LOGGING */
2247 
2248 /**
2249  * wma_set_rx_reorder_timeout_val() - set rx recorder timeout value
2250  * @wma_handle: pointer to wma handle
2251  * @reorder_timeout: rx reorder timeout value
2252  *
2253  * Return: QDF_STATUS
2254  */
2255 QDF_STATUS wma_set_rx_reorder_timeout_val(tp_wma_handle wma_handle,
2256 	struct sir_set_rx_reorder_timeout_val *reorder_timeout);
2257 
2258 /**
2259  * wma_set_rx_blocksize() - set rx blocksize
2260  * @wma_handle: pointer to wma handle
2261  * @peer_rx_blocksize: rx blocksize for peer mac
2262  *
2263  * Return: QDF_STATUS_SUCCESS for success or error code.
2264  */
2265 QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle,
2266 	struct sir_peer_set_rx_blocksize *peer_rx_blocksize);
2267 /**
2268  * wma_configure_smps_params() - Configures the smps parameters to set
2269  * @vdev_id: Virtual device for the command
2270  * @param_id: SMPS parameter ID
2271  * @param_val: Value to be set for the parameter
2272  * Return: QDF_STATUS_SUCCESS or non-zero on failure
2273  */
2274 QDF_STATUS wma_configure_smps_params(uint32_t vdev_id, uint32_t param_id,
2275 							uint32_t param_val);
2276 
2277 /*
2278  * wma_chip_power_save_failure_detected_handler() - chip pwr save fail detected
2279  * event handler
2280  * @handle: wma handle
2281  * @cmd_param_info: event handler data
2282  * @len: length of @cmd_param_info
2283  *
2284  * Return: QDF_STATUS_SUCCESS on success; error code otherwise
2285  */
2286 int wma_chip_power_save_failure_detected_handler(void *handle,
2287 						 uint8_t *cmd_param_info,
2288 						 uint32_t len);
2289 
2290 /**
2291  * wma_get_chain_rssi() - send wmi cmd to get chain rssi
2292  * @wma_handle: wma handler
2293  * @req_params: requset params
2294  *
2295  * Return: Return QDF_STATUS
2296  */
2297 QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle,
2298 		struct get_chain_rssi_req_params *req_params);
2299 
2300 /**
2301  * wma_config_bmiss_bcnt_params() - set bmiss config parameters
2302  * @vdev_id: virtual device for the command
2303  * @first_cnt: bmiss first value
2304  * @final_cnt: bmiss final value
2305  *
2306  * Return: QDF_STATUS_SUCCESS or non-zero on failure
2307  */
2308 QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt,
2309 		uint32_t final_cnt);
2310 
2311 #ifdef WLAN_POWER_MANAGEMENT_OFFLOAD
2312 /**
2313  * wma_check_and_set_wake_timer(): checks all interfaces and if any interface
2314  * has install_key pending, sets timer pattern in fw to wake up host after
2315  * specified time has elapsed.
2316  * @time: time after which host wants to be awaken.
2317  *
2318  * Return: None
2319  */
2320 void wma_check_and_set_wake_timer(uint32_t time);
2321 #endif
2322 
2323 /**
2324  * wma_delete_invalid_peer_entries() - Delete invalid peer entries stored
2325  * @vdev_id: virtual interface id
2326  * @peer_mac_addr: Peer MAC address
2327  *
2328  * Removes the invalid peer mac entry from wma node
2329  */
2330 void wma_delete_invalid_peer_entries(uint8_t vdev_id, uint8_t *peer_mac_addr);
2331 
2332 /**
2333  * wma_rx_invalid_peer_ind() - the callback for DP to notify WMA layer
2334  * invalid peer data is received, this function will send message to
2335  * lim module.
2336  * @vdev_id: virtual device ID
2337  * @wh: Pointer to 802.11 frame header
2338  *
2339  * Return: 0 for success or non-zero on failure
2340  */
2341 uint8_t wma_rx_invalid_peer_ind(uint8_t vdev_id, void *wh);
2342 
2343 /**
2344  * wma_dp_send_delba_ind() - the callback for DP to notify WMA layer
2345  * to del ba of rx
2346  * @vdev_id: vdev id
2347  * @peer_macaddr: peer mac address
2348  * @tid: tid of rx
2349  * @reason_code: reason code
2350  * @cdp_rcode: CDP reason code for sending DELBA
2351  *
2352  * Return: 0 for success or non-zero on failure
2353  */
2354 int wma_dp_send_delba_ind(uint8_t vdev_id,
2355 			  uint8_t *peer_macaddr,
2356 			  uint8_t tid,
2357 			  uint8_t reason_code,
2358 			  enum cdp_delba_rcode cdp_rcode);
2359 
2360 /**
2361  * is_roam_inprogress() - Is vdev in progress
2362  * @vdev_id: vdev of interest
2363  *
2364  * Return: true if roaming started,  false during roam sync and otherwise
2365  */
2366 bool wma_is_roam_in_progress(uint32_t vdev_id);
2367 
2368 /**
2369  * wma_get_psoc_from_scn_handle() - API to get psoc from scn handle
2370  * @scn_handle: opaque wma handle
2371  *
2372  * API to get psoc from scn handle
2373  *
2374  * Return: psoc context or null in case of failure
2375  */
2376 struct wlan_objmgr_psoc *wma_get_psoc_from_scn_handle(void *scn_handle);
2377 
2378 /**
2379  * wma_set_peer_ucast_cipher() - Update unicast cipher of the peer
2380  * @mac_addr: peer mac address
2381  * @cipher: peer cipher bits
2382  * @cipher_cap: cipher cap
2383  *
2384  * Return: None
2385  */
2386 void wma_set_peer_ucast_cipher(uint8_t *mac_addr, int32_t cipher,
2387 			       int32_t cipher_cap);
2388 
2389 /**
2390  * wma_update_set_key() - Update WMA layer for set key
2391  * @session_id: vdev session identifier
2392  * @pairwise: denotes if it is pairwise or group key
2393  * @key_index: Key Index
2394  * @cipher_type: cipher type being used for the encryption/decryption
2395  *
2396  * Return: None
2397  */
2398 void wma_update_set_key(uint8_t session_id, bool pairwise,
2399 			uint8_t key_index,
2400 			enum wlan_crypto_cipher_type cipher_type);
2401 
2402 #ifdef WLAN_FEATURE_MOTION_DETECTION
2403 /**
2404  * wma_motion_det_host_event_handler - motion detection event handler
2405  * @handle: WMA global handle
2406  * @event: motion detection event
2407  * @len: Length of cmd
2408  *
2409  * Call motion detection event callback handler
2410  *
2411  * Return: 0 on success, else error on failure
2412  */
2413 
2414 int wma_motion_det_host_event_handler(void *handle, u_int8_t *event,
2415 				      u_int32_t len);
2416 
2417 /**
2418  * wma_motion_det_base_line_host_event_handler - md baselining event handler
2419  * @handle: WMA global handle
2420  * @event: motion detection baselining event
2421  * @len: Length of cmd
2422  *
2423  * Return: 0 on success, else error on failure
2424  */
2425 int wma_motion_det_base_line_host_event_handler(void *handle, u_int8_t *event,
2426 						u_int32_t len);
2427 #endif /* WLAN_FEATURE_MOTION_DETECTION */
2428 
2429 /**
2430  * wma_add_bss_peer_sta() - create bss peer when sta connect
2431  * @vdev_id: vdev id
2432  * @bssid: AP bssid
2433  * @roam_sync: if roam sync is in progress
2434  * @is_resp_required: Peer create response is expected from firmware.
2435  * This flag will be set to true for initial connection and false for
2436  * LFR2 case.
2437  * @mld_mac: peer mld mac address
2438  * @is_assoc_peer: is assoc peer or not
2439  *
2440  * Return: 0 on success, else error on failure
2441  */
2442 QDF_STATUS wma_add_bss_peer_sta(uint8_t vdev_id, uint8_t *bssid,
2443 				bool is_resp_required, uint8_t *mld_mac,
2444 				bool is_assoc_peer);
2445 
2446 /**
2447  * wma_send_vdev_stop() - WMA api to send vdev stop to fw
2448  * @vdev_id: vdev id
2449  *
2450  * Return: 0 on success, else error on failure
2451  */
2452 QDF_STATUS wma_send_vdev_stop(uint8_t vdev_id);
2453 
2454 /**
2455  * wma_pre_assoc_req() - wma pre assoc req when sta connect
2456  * @add_bss: add bss param
2457  *
2458  * Return: QDF_STATUS
2459  */
2460 QDF_STATUS wma_pre_assoc_req(struct bss_params *add_bss);
2461 
2462 /**
2463  * wma_add_bss_lfr3() - add bss during LFR3 offload roaming
2464  * @wma: wma handler
2465  * @add_bss: add bss param
2466  *
2467  * Return: None
2468  */
2469 void wma_add_bss_lfr3(tp_wma_handle wma, struct bss_params *add_bss);
2470 
2471 #ifdef WLAN_FEATURE_HOST_ROAM
2472 /**
2473  * wma_add_bss_lfr2_vdev_start() - add bss and start vdev during host roaming
2474  * @vdev: vdev in object manager
2475  * @add_bss: add bss param
2476  *
2477  * Return: None
2478  */
2479 QDF_STATUS wma_add_bss_lfr2_vdev_start(struct wlan_objmgr_vdev *vdev,
2480 				       struct bss_params *add_bss);
2481 #endif
2482 
2483 /**
2484  * wma_send_peer_assoc_req() - wma send peer assoc req when sta connect
2485  * @add_bss: add bss param
2486  *
2487  * Return: None
2488  */
2489 QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss);
2490 
2491 /**
2492  * wma_get_rx_chainmask() - API to get rx chainmask from mac phy capability
2493  * @pdev_id: pdev id
2494  * @chainmask_2g: pointer to return 2g chainmask
2495  * @chainmask_5g: pointer to return 5g chainmask
2496  *
2497  * API to get rx chainmask from mac phy capability directly.
2498  *
2499  * Return: QDF_STATUS_SUCCESS or non-zero on failure
2500  */
2501 QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g,
2502 				uint32_t *chainmask_5g);
2503 
2504 /**
2505  * wma_handle_channel_switch_resp() - handle channel switch resp
2506  * @wma: wma handle
2507  * @rsp: response for channel switch
2508  *
2509  * Return: QDF_STATUS
2510  */
2511 QDF_STATUS wma_handle_channel_switch_resp(tp_wma_handle wma,
2512 					  struct vdev_start_response *rsp);
2513 
2514 /**
2515  * wma_pre_chan_switch_setup() - handler before channel switch vdev start
2516  * @vdev_id: vdev id
2517  *
2518  * Return: QDF_STATUS
2519  */
2520 QDF_STATUS wma_pre_chan_switch_setup(uint8_t vdev_id);
2521 
2522 /**
2523  * wma_post_chan_switch_setup() - handler after channel switch vdev start
2524  * @vdev_id: vdev id
2525  *
2526  * Return: QDF_STATUS
2527  */
2528 QDF_STATUS wma_post_chan_switch_setup(uint8_t vdev_id);
2529 
2530 /**
2531  * wma_vdev_pre_start() - prepare vdev start
2532  * @vdev_id: vdev id
2533  *
2534  * Return: QDF_STATUS
2535  */
2536 QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart);
2537 
2538 #ifdef WLAN_FEATURE_11BE_MLO
2539 /**
2540  * wma_delete_peer_mlo() - Remove the MLO peer and detach link peer
2541  * @psoc: PSOC objmgr pointer
2542  * @macaddr: MAC address of objmgr peer
2543  *
2544  * The API will remove the ML peer with objmgr peer fetched from
2545  * psoc peer list using the @macaddr.
2546  *
2547  * Return: void
2548  */
2549 void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr);
2550 #else
2551 static inline
2552 void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr)
2553 {
2554 }
2555 #endif
2556 
2557 /**
2558  * wma_remove_bss_peer_on_failure() - remove the bss peers in case of
2559  * failure
2560  * @wma: wma handle.
2561  * @vdev_id: vdev id
2562  *
2563  * This API deletes the BSS peer created during ADD BSS in case of ADD BSS
2564  * request sent to the FW fails.
2565  *
2566  * Return: None;
2567  */
2568 void wma_remove_bss_peer_on_failure(tp_wma_handle wma, uint8_t vdev_id);
2569 
2570 /**
2571  * wma_remove_bss_peer_before_join() - remove the bss peers in case of
2572  * failure before join (vdev start) for sta mode
2573  * @wma: wma handle.
2574  * @vdev_id: vdev id
2575  * @cm_join_req: join cm context
2576  *
2577  * This API deletes the BSS peer if any failure before "join" (vdev start).
2578  * And indicate connection failure to CM after bss peer delete event comes
2579  * from FW.
2580  *
2581  * Return: QDF_STATUS_SUCCESS if success, QDF_STATUS_E_PENDING if peer delete
2582  *  event will be indicated later from target.
2583  */
2584 QDF_STATUS wma_remove_bss_peer_before_join(
2585 		tp_wma_handle wma, uint8_t vdev_id,
2586 		void *cm_join_req);
2587 
2588 /**
2589  * wma_send_add_bss_resp() - send add bss failure
2590  * @wma: wma handle.
2591  * @vdev_id: vdev id
2592  * @status: status
2593  *
2594  * Return: None
2595  */
2596 void wma_send_add_bss_resp(tp_wma_handle wma, uint8_t vdev_id,
2597 			   QDF_STATUS status);
2598 
2599 /**
2600  * wma_post_vdev_start_setup() - wma post vdev start handler
2601  * @wma: wma handle.
2602  * @vdev_id: vdev id
2603  *
2604  * Return: Success or Failure status
2605  */
2606 QDF_STATUS wma_post_vdev_start_setup(uint8_t vdev_id);
2607 
2608 /**
2609  * wma_pre_vdev_start_setup() - wma pre vdev start handler
2610  * @wma: wma handle.
2611  * @vdev_id: vdev id
2612  * @addbss_param: bss param
2613  *
2614  * Return: Success or Failure status
2615  */
2616 QDF_STATUS wma_pre_vdev_start_setup(uint8_t vdev_id,
2617 				    struct bss_params *add_bss);
2618 
2619 #ifdef FEATURE_ANI_LEVEL_REQUEST
2620 /**
2621  * wma_send_ani_level_request() - Send get ani level cmd to WMI
2622  * @wma_handle: wma handle.
2623  * @freqs: pointer to channels for which ANI level has to be retrieved
2624  * @num_freqs: number of channels in the above parameter
2625  *
2626  * Return: QDF_STATUS
2627  */
2628 QDF_STATUS wma_send_ani_level_request(tp_wma_handle wma_handle,
2629 				      uint32_t *freqs, uint8_t num_freqs);
2630 #endif /* FEATURE_ANI_LEVEL_REQUEST */
2631 
2632 /**
2633  * wma_vdev_detach() - send vdev delete command to fw
2634  * @wma_handle: wma handle
2635  * @pdel_vdev_req_param: del vdev params
2636  *
2637  * Return: QDF status
2638  */
2639 QDF_STATUS wma_vdev_detach(struct del_vdev_params *pdel_vdev_req_param);
2640 
2641 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
2642 /**
2643  * wma_p2p_self_peer_remove() - Send P2P self peer delete command to FW
2644  * @vdev: Object manager vdev
2645  *
2646  * Return: success if peer delete command sent to firmware, else failure.
2647  */
2648 
2649 QDF_STATUS wma_p2p_self_peer_remove(struct wlan_objmgr_vdev *vdev);
2650 #endif
2651 #endif
2652 
2653