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