1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef WLAN_QCT_WMA_H
21 #define WLAN_QCT_WMA_H
22 
23 #include "ani_global.h"
24 
25 #include "wma_api.h"
26 #include "wma_tgt_cfg.h"
27 #include "i_cds_packet.h"
28 
29 #define IS_FEATURE_SUPPORTED_BY_FW(feat_enum_value) \
30 				wma_get_fw_wlan_feat_caps(feat_enum_value)
31 #ifdef WLAN_FEATURE_11BE
32 #define IS_FEATURE_11BE_SUPPORTED_BY_FW IS_FEATURE_SUPPORTED_BY_FW(DOT11BE)
33 #else
34 #define IS_FEATURE_11BE_SUPPORTED_BY_FW 0
35 #endif
36 
37 #define DPU_FEEDBACK_UNPROTECTED_ERROR 0x0F
38 
39 #define WMA_GET_QDF_NBUF(pRxMeta) \
40 	(((t_packetmeta *)pRxMeta)->pkt_qdf_buf)
41 
42 #define WMA_GET_RX_MAC_HEADER_LEN(pRxMeta) \
43 	(((t_packetmeta *)pRxMeta)->mpdu_hdr_len)
44 
45 #define WMA_GET_RX_MAC_HEADER(pRxMeta) \
46 	(tpSirMacMgmtHdr)(((t_packetmeta *)pRxMeta)->mpdu_hdr_ptr)
47 
48 #define WMA_GET_RX_MPDUHEADER3A(pRxMeta) \
49 	(tpSirMacDataHdr3a)(((t_packetmeta *)pRxMeta)->mpdu_hdr_ptr)
50 
51 #define WMA_GET_RX_MPDU_HEADER_LEN(pRxMeta) \
52 	(((t_packetmeta *)pRxMeta)->mpdu_hdr_len)
53 
54 #define WMA_GET_RX_MPDU_LEN(pRxMeta) \
55 	(((t_packetmeta *)pRxMeta)->mpdu_len)
56 
57 #define WMA_GET_RX_PAYLOAD_LEN(pRxMeta)	\
58 	(((t_packetmeta *)pRxMeta)->mpdu_data_len)
59 
60 #define WMA_GET_RX_TSF_DELTA(pRxMeta) \
61 	(((t_packetmeta *)pRxMeta)->tsf_delta)
62 
63 #define WMA_GET_RX_MAC_RATE_IDX(pRxMeta) 0
64 
65 #define WMA_GET_RX_MPDU_DATA(pRxMeta) \
66 	(((t_packetmeta *)pRxMeta)->mpdu_data_ptr)
67 
68 #define WMA_GET_RX_UNKNOWN_UCAST(pRxMeta) 0
69 
70 #define WMA_GET_RX_FREQ(pRxMeta) \
71 	(((t_packetmeta *)pRxMeta)->frequency)
72 
73 #define WMA_GET_RX_FT_DONE(pRxMeta) 0
74 
75 #define WMA_GET_RX_DPU_FEEDBACK(pRxMeta) \
76 	(((t_packetmeta *)pRxMeta)->dpuFeedback)
77 
78 #define WMA_GET_RX_BEACON_SENT(pRxMeta) 0
79 
80 #define WMA_GET_RX_TSF_LATER(pRxMeta) 0
81 
82 #define WMA_GET_RX_TIMESTAMP(pRxMeta) \
83 	(((t_packetmeta *)pRxMeta)->timestamp)
84 
85 #define WMA_GET_OFFLOADSCANLEARN(pRxMeta) \
86 	(((t_packetmeta *)pRxMeta)->offloadScanLearn)
87 #define WMA_GET_ROAMCANDIDATEIND(pRxMeta) \
88 	(((t_packetmeta *)pRxMeta)->roamCandidateInd)
89 #define WMA_GET_SESSIONID(pRxMeta) \
90 	(((t_packetmeta *)pRxMeta)->session_id)
91 #define WMA_GET_SCAN_SRC(pRxMeta) \
92 	(((t_packetmeta *)pRxMeta)->scan_src)
93 
94 #ifdef FEATURE_WLAN_EXTSCAN
95 #define WMA_IS_EXTSCAN_SCAN_SRC(pRxMeta) \
96 	((((t_packetmeta *)pRxMeta)->scan_src) == WMI_MGMT_RX_HDR_EXTSCAN)
97 #define WMA_IS_EPNO_SCAN_SRC(pRxMeta) \
98 	((((t_packetmeta *)pRxMeta)->scan_src) & WMI_MGMT_RX_HDR_ENLO)
99 #endif /* FEATURE_WLAN_EXTSCAN */
100 
101 #define WMA_GET_RX_SNR(pRxMeta)	\
102 	(((t_packetmeta *)pRxMeta)->snr)
103 
104 #define WMA_GET_RX_RFBAND(pRxMeta) 0
105 
106 #define WMA_MAX_TXPOWER_INVALID        127
107 /* rssi value normalized to noise floor of -96 dBm */
108 #define WMA_GET_RX_RSSI_NORMALIZED(pRxMeta) \
109 		       (((t_packetmeta *)pRxMeta)->rssi)
110 
111 /* raw rssi based on actual noise floor in hardware */
112 #define WMA_GET_RX_RSSI_RAW(pRxMeta) \
113 		       (((t_packetmeta *)pRxMeta)->rssi_raw)
114 
115 /*
116  * the repeat_cnt is reserved by FW team, the current value
117  * is always 0xffffffff
118  */
119 #define WMI_WOW_PULSE_REPEAT_CNT 0xffffffff
120 
121 
122 /* WMA Messages */
123 enum wmamsgtype {
124 	WMA_MSG_TYPES_BEGIN = SIR_HAL_MSG_TYPES_BEGIN,
125 	WMA_ITC_MSG_TYPES_BEGIN = SIR_HAL_ITC_MSG_TYPES_BEGIN,
126 	WMA_RADAR_DETECTED_IND = SIR_HAL_RADAR_DETECTED_IND,
127 
128 	WMA_ADD_STA_REQ = SIR_HAL_ADD_STA_REQ,
129 	WMA_ADD_STA_RSP = SIR_HAL_ADD_STA_RSP,
130 	WMA_DELETE_STA_REQ = SIR_HAL_DELETE_STA_REQ,
131 	WMA_DELETE_STA_RSP =  SIR_HAL_DELETE_STA_RSP,
132 	WMA_ADD_BSS_REQ = SIR_HAL_ADD_BSS_REQ,
133 	WMA_DELETE_BSS_REQ = SIR_HAL_DELETE_BSS_REQ,
134 	WMA_DELETE_BSS_HO_FAIL_REQ = SIR_HAL_DELETE_BSS_HO_FAIL_REQ,
135 	WMA_DELETE_BSS_RSP = SIR_HAL_DELETE_BSS_RSP,
136 	WMA_DELETE_BSS_HO_FAIL_RSP = SIR_HAL_DELETE_BSS_HO_FAIL_RSP,
137 	WMA_SEND_BEACON_REQ = SIR_HAL_SEND_BEACON_REQ,
138 	WMA_SEND_BCN_RSP = SIR_HAL_SEND_BCN_RSP,
139 	WMA_SEND_PROBE_RSP_TMPL = SIR_HAL_SEND_PROBE_RSP_TMPL,
140 	WMA_SEND_PEER_UNMAP_CONF = SIR_HAL_SEND_PEER_UNMAP_CONF,
141 
142 	WMA_SET_BSSKEY_RSP = SIR_HAL_SET_BSSKEY_RSP,
143 	WMA_SET_STAKEY_RSP = SIR_HAL_SET_STAKEY_RSP,
144 	WMA_UPDATE_EDCA_PROFILE_IND = SIR_HAL_UPDATE_EDCA_PROFILE_IND,
145 
146 	WMA_UPDATE_BEACON_IND = SIR_HAL_UPDATE_BEACON_IND,
147 	WMA_CHNL_SWITCH_REQ = SIR_HAL_CHNL_SWITCH_REQ,
148 	WMA_ADD_TS_REQ = SIR_HAL_ADD_TS_REQ,
149 	WMA_DEL_TS_REQ = SIR_HAL_DEL_TS_REQ,
150 
151 	WMA_MISSED_BEACON_IND = SIR_HAL_MISSED_BEACON_IND,
152 
153 	WMA_SWITCH_CHANNEL_RSP = SIR_HAL_SWITCH_CHANNEL_RSP,
154 	WMA_P2P_NOA_ATTR_IND = SIR_HAL_P2P_NOA_ATTR_IND,
155 	WMA_PWR_SAVE_CFG = SIR_HAL_PWR_SAVE_CFG,
156 
157 	WMA_TIMER_ADJUST_ADAPTIVE_THRESHOLD_IND =
158 				SIR_HAL_TIMER_ADJUST_ADAPTIVE_THRESHOLD_IND,
159 	WMA_SET_LINK_STATE = SIR_HAL_SET_LINK_STATE,
160 	WMA_SET_STA_BCASTKEY_RSP = SIR_HAL_SET_STA_BCASTKEY_RSP,
161 	WMA_ADD_TS_RSP = SIR_HAL_ADD_TS_RSP,
162 	WMA_DPU_MIC_ERROR = SIR_HAL_DPU_MIC_ERROR,
163 	WMA_TIMER_CHIP_MONITOR_TIMEOUT = SIR_HAL_TIMER_CHIP_MONITOR_TIMEOUT,
164 	WMA_TIMER_TRAFFIC_ACTIVITY_REQ = SIR_HAL_TIMER_TRAFFIC_ACTIVITY_REQ,
165 	WMA_TIMER_ADC_RSSI_STATS = SIR_HAL_TIMER_ADC_RSSI_STATS,
166 	WMA_TIMER_TRAFFIC_STATS_IND = SIR_HAL_TRAFFIC_STATS_IND,
167 	WMA_EXCLUDE_UNENCRYPTED_IND = SIR_HAL_EXCLUDE_UNENCRYPTED_IND,
168 
169 #ifdef FEATURE_WLAN_ESE
170 	WMA_TSM_STATS_REQ = SIR_HAL_TSM_STATS_REQ,
171 	WMA_TSM_STATS_RSP = SIR_HAL_TSM_STATS_RSP,
172 #endif
173 
174 	WMA_ROAM_SCAN_CH_REQ = SIR_HAL_ROAM_SCAN_CH_REQ,
175 
176 	WMA_HT40_OBSS_SCAN_IND = SIR_HAL_HT40_OBSS_SCAN_IND,
177 
178 	WMA_SET_MIMOPS_REQ = SIR_HAL_SET_MIMOPS_REQ,
179 	WMA_SET_MIMOPS_RSP = SIR_HAL_SET_MIMOPS_RSP,
180 	WMA_SYS_READY_IND =  SIR_HAL_SYS_READY_IND,
181 	WMA_SET_TX_POWER_REQ = SIR_HAL_SET_TX_POWER_REQ,
182 	WMA_SET_TX_POWER_RSP = SIR_HAL_SET_TX_POWER_RSP,
183 	WMA_GET_TX_POWER_REQ = SIR_HAL_GET_TX_POWER_REQ,
184 
185 	WMA_ENABLE_UAPSD_REQ = SIR_HAL_ENABLE_UAPSD_REQ,
186 	WMA_DISABLE_UAPSD_REQ = SIR_HAL_DISABLE_UAPSD_REQ,
187 
188 	WMA_SET_KEY_DONE = SIR_HAL_SET_KEY_DONE,
189 
190 
191 	/* PE <-> HAL BTC messages */
192 	WMA_BTC_SET_CFG = SIR_HAL_BTC_SET_CFG,
193 	WMA_HANDLE_FW_MBOX_RSP = SIR_HAL_HANDLE_FW_MBOX_RSP,
194 
195 	WMA_SET_MAX_TX_POWER_REQ = SIR_HAL_SET_MAX_TX_POWER_REQ,
196 	WMA_SET_MAX_TX_POWER_RSP = SIR_HAL_SET_MAX_TX_POWER_RSP,
197 	WMA_SET_DTIM_PERIOD = SIR_HAL_SET_DTIM_PERIOD,
198 
199 	WMA_SET_MAX_TX_POWER_PER_BAND_REQ =
200 	SIR_HAL_SET_MAX_TX_POWER_PER_BAND_REQ,
201 
202 	/* PE <-> HAL Host Offload message */
203 	WMA_SET_HOST_OFFLOAD = SIR_HAL_SET_HOST_OFFLOAD,
204 
205 	/* PE <-> HAL Keep Alive message */
206 	WMA_SET_KEEP_ALIVE = SIR_HAL_SET_KEEP_ALIVE,
207 
208 #ifdef WLAN_NS_OFFLOAD
209 	WMA_SET_NS_OFFLOAD = SIR_HAL_SET_NS_OFFLOAD,
210 #endif /* WLAN_NS_OFFLOAD */
211 
212 #ifdef FEATURE_WLAN_TDLS
213 	WMA_SET_TDLS_LINK_ESTABLISH_REQ = SIR_HAL_TDLS_LINK_ESTABLISH_REQ,
214 	WMA_SET_TDLS_LINK_ESTABLISH_REQ_RSP =
215 				SIR_HAL_TDLS_LINK_ESTABLISH_REQ_RSP,
216 #endif
217 
218 	WMA_WLAN_SUSPEND_IND = SIR_HAL_WLAN_SUSPEND_IND,
219 	WMA_WLAN_RESUME_REQ = SIR_HAL_WLAN_RESUME_REQ,
220 	WMA_MSG_TYPES_END = SIR_HAL_MSG_TYPES_END,
221 
222 	WMA_AGGR_QOS_REQ = SIR_HAL_AGGR_QOS_REQ,
223 	WMA_AGGR_QOS_RSP = SIR_HAL_AGGR_QOS_RSP,
224 
225 	WMA_CSA_OFFLOAD_EVENT = SIR_CSA_OFFLOAD_EVENT,
226 
227 #ifdef FEATURE_WLAN_ESE
228 	WMA_SET_PLM_REQ = SIR_HAL_SET_PLM_REQ,
229 #endif
230 
231 	WMA_ROAM_PRE_AUTH_STATUS = SIR_HAL_ROAM_PRE_AUTH_STATUS_IND,
232 
233 	WMA_8023_MULTICAST_LIST_REQ = SIR_HAL_8023_MULTICAST_LIST_REQ,
234 
235 #ifdef WLAN_FEATURE_PACKET_FILTERING
236 	WMA_RECEIVE_FILTER_SET_FILTER_REQ =
237 				SIR_HAL_RECEIVE_FILTER_SET_FILTER_REQ,
238 	WMA_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ =
239 			SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ,
240 	WMA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP =
241 			SIR_HAL_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP,
242 	WMA_RECEIVE_FILTER_CLEAR_FILTER_REQ =
243 				SIR_HAL_RECEIVE_FILTER_CLEAR_FILTER_REQ,
244 #endif /* WLAN_FEATURE_PACKET_FILTERING */
245 
246 	WMA_DHCP_START_IND = SIR_HAL_DHCP_START_IND,
247 	WMA_DHCP_STOP_IND = SIR_HAL_DHCP_STOP_IND,
248 
249 #ifdef WLAN_FEATURE_GTK_OFFLOAD
250 	WMA_GTK_OFFLOAD_REQ = SIR_HAL_GTK_OFFLOAD_REQ,
251 	WMA_GTK_OFFLOAD_GETINFO_REQ = SIR_HAL_GTK_OFFLOAD_GETINFO_REQ,
252 	WMA_GTK_OFFLOAD_GETINFO_RSP = SIR_HAL_GTK_OFFLOAD_GETINFO_RSP,
253 #endif /* WLAN_FEATURE_GTK_OFFLOAD */
254 
255 	WMA_SET_TM_LEVEL_REQ = SIR_HAL_SET_TM_LEVEL_REQ,
256 
257 	WMA_UPDATE_OP_MODE = SIR_HAL_UPDATE_OP_MODE,
258 	WMA_UPDATE_RX_NSS = SIR_HAL_UPDATE_RX_NSS,
259 	WMA_UPDATE_MEMBERSHIP = SIR_HAL_UPDATE_MEMBERSHIP,
260 	WMA_UPDATE_USERPOS = SIR_HAL_UPDATE_USERPOS,
261 
262 #ifdef WLAN_FEATURE_NAN
263 	WMA_NAN_REQUEST = SIR_HAL_NAN_REQUEST,
264 #endif
265 
266 	WMA_UPDATE_CHAN_LIST_REQ = SIR_HAL_UPDATE_CHAN_LIST_REQ,
267 	WMA_RX_SCAN_EVENT = SIR_HAL_RX_SCAN_EVENT,
268 
269 	WMA_CLI_SET_CMD = SIR_HAL_CLI_SET_CMD,
270 
271 #ifndef REMOVE_PKT_LOG
272 	WMA_PKTLOG_ENABLE_REQ = SIR_HAL_PKTLOG_ENABLE_REQ,
273 #endif
274 
275 #ifdef FEATURE_WLAN_LPHB
276 	WMA_LPHB_CONF_REQ =  SIR_HAL_LPHB_CONF_IND,
277 #endif /* FEATURE_WLAN_LPHB */
278 
279 #ifdef FEATURE_WLAN_CH_AVOID
280 	WMA_CH_AVOID_UPDATE_REQ = SIR_HAL_CH_AVOID_UPDATE_REQ,
281 #endif /* FEATURE_WLAN_CH_AVOID */
282 
283 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN
284 	WMA_SET_AUTO_SHUTDOWN_TIMER_REQ = SIR_HAL_SET_AUTO_SHUTDOWN_TIMER_REQ,
285 #endif
286 
287 	WMA_ADD_PERIODIC_TX_PTRN_IND = SIR_HAL_ADD_PERIODIC_TX_PTRN_IND,
288 	WMA_DEL_PERIODIC_TX_PTRN_IND = SIR_HAL_DEL_PERIODIC_TX_PTRN_IND,
289 
290 	WMA_TX_POWER_LIMIT = SIR_HAL_SET_TX_POWER_LIMIT,
291 
292 	WMA_RATE_UPDATE_IND = SIR_HAL_RATE_UPDATE_IND,
293 
294 	WMA_SEND_ADDBA_REQ = SIR_HAL_SEND_ADDBA_REQ,
295 	WMA_INIT_THERMAL_INFO_CMD = SIR_HAL_INIT_THERMAL_INFO_CMD,
296 	WMA_SET_THERMAL_LEVEL = SIR_HAL_SET_THERMAL_LEVEL,
297 
298 	WMA_INIT_BAD_PEER_TX_CTL_INFO_CMD = SIR_HAL_BAD_PEER_TX_CTL_INI_CMD,
299 
300 #ifdef FEATURE_WLAN_TDLS
301 	WMA_UPDATE_TDLS_PEER_STATE = SIR_HAL_UPDATE_TDLS_PEER_STATE,
302 	WMA_TDLS_SHOULD_DISCOVER_CMD = SIR_HAL_TDLS_SHOULD_DISCOVER,
303 	WMA_TDLS_SHOULD_TEARDOWN_CMD = SIR_HAL_TDLS_SHOULD_TEARDOWN,
304 	WMA_TDLS_PEER_DISCONNECTED_CMD = SIR_HAL_TDLS_PEER_DISCONNECTED,
305 #endif
306 	WMA_SET_SAP_INTRABSS_DIS = SIR_HAL_SET_SAP_INTRABSS_DIS,
307 
308 /* Message to indicate beacon tx completion after beacon template update
309  * beacon offload case
310  */
311 	WMA_DFS_BEACON_TX_SUCCESS_IND = SIR_HAL_BEACON_TX_SUCCESS_IND,
312 	WMA_DISASSOC_TX_COMP = SIR_HAL_DISASSOC_TX_COMP,
313 	WMA_DEAUTH_TX_COMP = SIR_HAL_DEAUTH_TX_COMP,
314 
315 	WMA_GET_ISOLATION = SIR_HAL_GET_ISOLATION,
316 
317 	WMA_MODEM_POWER_STATE_IND = SIR_HAL_MODEM_POWER_STATE_IND,
318 
319 #ifdef WLAN_FEATURE_STATS_EXT
320 	WMA_STATS_EXT_REQUEST = SIR_HAL_STATS_EXT_REQUEST,
321 #endif
322 
323 	WMA_GET_TEMPERATURE_REQ = SIR_HAL_GET_TEMPERATURE_REQ,
324 	WMA_SET_WISA_PARAMS = SIR_HAL_SET_WISA_PARAMS,
325 
326 #ifdef FEATURE_WLAN_EXTSCAN
327 	WMA_EXTSCAN_GET_CAPABILITIES_REQ = SIR_HAL_EXTSCAN_GET_CAPABILITIES_REQ,
328 	WMA_EXTSCAN_START_REQ = SIR_HAL_EXTSCAN_START_REQ,
329 	WMA_EXTSCAN_STOP_REQ = SIR_HAL_EXTSCAN_STOP_REQ,
330 	WMA_EXTSCAN_SET_BSSID_HOTLIST_REQ =
331 				SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_REQ,
332 	WMA_EXTSCAN_RESET_BSSID_HOTLIST_REQ =
333 				SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_REQ,
334 	WMA_EXTSCAN_SET_SIGNF_CHANGE_REQ = SIR_HAL_EXTSCAN_SET_SIGNF_CHANGE_REQ,
335 	WMA_EXTSCAN_RESET_SIGNF_CHANGE_REQ =
336 				SIR_HAL_EXTSCAN_RESET_SIGNF_CHANGE_REQ,
337 	WMA_EXTSCAN_GET_CACHED_RESULTS_REQ =
338 				SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_REQ,
339 	WMA_SET_EPNO_LIST_REQ = SIR_HAL_SET_EPNO_LIST_REQ,
340 	WMA_SET_PASSPOINT_LIST_REQ = SIR_HAL_SET_PASSPOINT_LIST_REQ,
341 	WMA_RESET_PASSPOINT_LIST_REQ = SIR_HAL_RESET_PASSPOINT_LIST_REQ,
342 #endif  /* FEATURE_WLAN_EXTSCAN */
343 
344 #ifdef WLAN_FEATURE_LINK_LAYER_STATS
345 	WMA_LINK_LAYER_STATS_CLEAR_REQ = SIR_HAL_LL_STATS_CLEAR_REQ,
346 	WMA_LINK_LAYER_STATS_SET_REQ = SIR_HAL_LL_STATS_SET_REQ,
347 	WMA_LINK_LAYER_STATS_GET_REQ = SIR_HAL_LL_STATS_GET_REQ,
348 	WMA_LINK_LAYER_STATS_RESULTS_RSP = SIR_HAL_LL_STATS_RESULTS_RSP,
349 	WDA_LINK_LAYER_STATS_SET_THRESHOLD = SIR_HAL_LL_STATS_EXT_SET_THRESHOLD,
350 #endif  /* WLAN_FEATURE_LINK_LAYER_STATS */
351 
352 	WMA_LINK_STATUS_GET_REQ = SIR_HAL_LINK_STATUS_GET_REQ,
353 
354 #ifdef WLAN_FEATURE_EXTWOW_SUPPORT
355 	WMA_WLAN_EXT_WOW = SIR_HAL_CONFIG_EXT_WOW,
356 	WMA_WLAN_SET_APP_TYPE1_PARAMS = SIR_HAL_CONFIG_APP_TYPE1_PARAMS,
357 	WMA_WLAN_SET_APP_TYPE2_PARAMS = SIR_HAL_CONFIG_APP_TYPE2_PARAMS,
358 #endif
359 
360 	WMA_SET_SCAN_MAC_OUI_REQ = SIR_HAL_SET_SCAN_MAC_OUI_REQ,
361 	WMA_TSF_GPIO_PIN = SIR_HAL_TSF_GPIO_PIN_REQ,
362 
363 #ifdef DHCP_SERVER_OFFLOAD
364 	WMA_SET_DHCP_SERVER_OFFLOAD_CMD = SIR_HAL_SET_DHCP_SERVER_OFFLOAD,
365 #endif  /* DHCP_SERVER_OFFLOAD */
366 
367 #ifdef WLAN_FEATURE_GPIO_LED_FLASHING
368 	WMA_LED_FLASHING_REQ = SIR_HAL_LED_FLASHING_REQ,
369 #endif
370 
371 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
372 	WMA_UPDATE_Q2Q_IE_IND = SIR_HAL_UPDATE_Q2Q_IE_IND,
373 #endif  /* FEATURE_AP_MCC_CH_AVOIDANCE */
374 	WMA_SET_RSSI_MONITOR_REQ = SIR_HAL_SET_RSSI_MONITOR_REQ,
375 
376 	WMA_OCB_SET_CONFIG_CMD = SIR_HAL_OCB_SET_CONFIG_CMD,
377 	WMA_OCB_SET_UTC_TIME_CMD = SIR_HAL_OCB_SET_UTC_TIME_CMD,
378 	WMA_OCB_START_TIMING_ADVERT_CMD = SIR_HAL_OCB_START_TIMING_ADVERT_CMD,
379 	WMA_OCB_STOP_TIMING_ADVERT_CMD = SIR_HAL_OCB_STOP_TIMING_ADVERT_CMD,
380 	WMA_OCB_GET_TSF_TIMER_CMD = SIR_HAL_OCB_GET_TSF_TIMER_CMD,
381 	WMA_DCC_GET_STATS_CMD = SIR_HAL_DCC_GET_STATS_CMD,
382 	WMA_DCC_CLEAR_STATS_CMD = SIR_HAL_DCC_CLEAR_STATS_CMD,
383 	WMA_DCC_UPDATE_NDL_CMD = SIR_HAL_DCC_UPDATE_NDL_CMD,
384 	WMA_SET_IE_INFO = SIR_HAL_SET_IE_INFO,
385 
386 	WMA_GW_PARAM_UPDATE_REQ = SIR_HAL_GATEWAY_PARAM_UPDATE_REQ,
387 	WMA_ADD_BCN_FILTER_CMDID = SIR_HAL_ADD_BCN_FILTER_CMDID,
388 	WMA_REMOVE_BCN_FILTER_CMDID = SIR_HAL_REMOVE_BCN_FILTER_CMDID,
389 	WMA_SET_ADAPT_DWELLTIME_CONF_PARAMS =
390 					SIR_HAL_SET_ADAPT_DWELLTIME_PARAMS,
391 
392 	WDA_APF_GET_CAPABILITIES_REQ = SIR_HAL_APF_GET_CAPABILITIES_REQ,
393 	WMA_ROAM_SYNC_TIMEOUT = SIR_HAL_WMA_ROAM_SYNC_TIMEOUT,
394 
395 	WMA_SET_PDEV_IE_REQ = SIR_HAL_SET_PDEV_IE_REQ,
396 	WMA_SEND_FREQ_RANGE_CONTROL_IND = SIR_HAL_SEND_FREQ_RANGE_CONTROL_IND,
397 	WMA_POWER_DEBUG_STATS_REQ = SIR_HAL_POWER_DEBUG_STATS_REQ,
398 	WMA_BEACON_DEBUG_STATS_REQ = SIR_HAL_BEACON_DEBUG_STATS_REQ,
399 	WMA_GET_RCPI_REQ = SIR_HAL_GET_RCPI_REQ,
400 	WMA_SET_DBS_SCAN_SEL_CONF_PARAMS = SIR_HAL_SET_DBS_SCAN_SEL_PARAMS,
401 
402 	WMA_SET_WOW_PULSE_CMD = SIR_HAL_SET_WOW_PULSE_CMD,
403 
404 	WMA_SEND_AP_VDEV_UP = SIR_HAL_SEND_AP_VDEV_UP,
405 
406 	WMA_SET_ARP_STATS_REQ = SIR_HAL_SET_ARP_STATS_REQ,
407 	WMA_GET_ARP_STATS_REQ = SIR_HAL_GET_ARP_STATS_REQ,
408 	WMA_SET_LIMIT_OFF_CHAN = SIR_HAL_SET_LIMIT_OFF_CHAN,
409 	WMA_OBSS_DETECTION_REQ = SIR_HAL_OBSS_DETECTION_REQ,
410 	WMA_OBSS_DETECTION_INFO = SIR_HAL_OBSS_DETECTION_INFO,
411 	WMA_INVOKE_NEIGHBOR_REPORT = SIR_HAL_INVOKE_NEIGHBOR_REPORT,
412 	WMA_OBSS_COLOR_COLLISION_REQ = SIR_HAL_OBSS_COLOR_COLLISION_REQ,
413 	WMA_OBSS_COLOR_COLLISION_INFO = SIR_HAL_OBSS_COLOR_COLLISION_INFO,
414 	WMA_CFG_VENDOR_ACTION_TB_PPDU = SIR_HAL_CFG_VENDOR_ACTION_TB_PPDU,
415 	WMA_GET_ROAM_SCAN_STATS = SIR_HAL_GET_ROAM_SCAN_STATS,
416 
417 #ifdef WLAN_FEATURE_MOTION_DETECTION
418 	WMA_SET_MOTION_DET_CONFIG = SIR_HAL_SET_MOTION_DET_CONFIG,
419 	WMA_SET_MOTION_DET_ENABLE = SIR_HAL_SET_MOTION_DET_ENABLE,
420 	WMA_SET_MOTION_DET_BASE_LINE_CONFIG =
421 				SIR_HAL_SET_MOTION_DET_BASE_LINE_CONFIG,
422 	WMA_SET_MOTION_DET_BASE_LINE_ENABLE =
423 				SIR_HAL_SET_MOTION_DET_BASE_LINE_ENABLE,
424 #endif  /* WLAN_FEATURE_MOTION_DETECTION */
425 
426 #ifdef FW_THERMAL_THROTTLE_SUPPORT
427 	WMA_SET_THERMAL_THROTTLE_CFG = SIR_HAL_SET_THERMAL_THROTTLE_CFG,
428 	WMA_SET_THERMAL_MGMT = SIR_HAL_SET_THERMAL_MGMT,
429 #endif  /*FW_THERMAL_THROTTLE_SUPPORT */
430 
431 #ifdef WLAN_MWS_INFO_DEBUGFS
432 	WMA_GET_MWS_COEX_INFO_REQ = SIR_HAL_GET_MWS_COEX_INFO_REQ,
433 #endif
434 
435 	WMA_TWT_ADD_DIALOG_REQUEST = SIR_HAL_TWT_ADD_DIALOG_REQUEST,
436 	WMA_TWT_DEL_DIALOG_REQUEST = SIR_HAL_TWT_DEL_DIALOG_REQUEST,
437 	WMA_TWT_PAUSE_DIALOG_REQUEST = SIR_HAL_TWT_PAUSE_DIALOG_REQUEST,
438 	WMA_TWT_RESUME_DIALOG_REQUEST =  SIR_HAL_TWT_RESUME_DIALOG_REQUEST,
439 	WMA_PEER_CREATE_REQ = SIR_HAL_PEER_CREATE_REQ,
440 	WMA_TWT_NUDGE_DIALOG_REQUEST = SIR_HAL_TWT_NUDGE_DIALOG_REQUEST,
441 	WMA_PASN_PEER_DELETE_REQUEST = SIR_HAL_PASN_PEER_DELETE_REQUEST,
442 	WMA_UPDATE_EDCA_PIFS_PARAM_IND = SIR_HAL_UPDATE_EDCA_PIFS_PARAM_IND,
443 };
444 
445 /* Bit 6 will be used to control BD rate for Management frames */
446 #define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40
447 
448 #define wma_tx_frame(hHal, pFrmBuf, frmLen, frmType, txDir, tid, pCompFunc, \
449 		   pData, txFlag, sessionid, channel_freq, rid, peer_rssi) \
450 	(QDF_STATUS)( wma_tx_packet( \
451 		      cds_get_context(QDF_MODULE_ID_WMA), \
452 		      (pFrmBuf), \
453 		      (frmLen), \
454 		      (frmType), \
455 		      (txDir), \
456 		      (tid), \
457 		      (pCompFunc), \
458 		      (pData), \
459 		      (NULL), \
460 		      (txFlag), \
461 		      (sessionid), \
462 		      (false), \
463 		      (channel_freq), \
464 		      (rid), \
465 		      (peer_rssi), \
466 		      (0)))
467 
468 #define wma_tx_frameWithTxComplete(hHal, pFrmBuf, frmLen, frmType, txDir, tid, \
469 	 pCompFunc, pData, pCBackFnTxComp, txFlag, sessionid, \
470 	 tdlsflag, channel_freq, rid, peer_rssi, action) \
471 	(QDF_STATUS)( wma_tx_packet( \
472 		      cds_get_context(QDF_MODULE_ID_WMA), \
473 		      (pFrmBuf), \
474 		      (frmLen), \
475 		      (frmType), \
476 		      (txDir), \
477 		      (tid), \
478 		      (pCompFunc), \
479 		      (pData), \
480 		      (pCBackFnTxComp), \
481 		      (txFlag), \
482 		      (sessionid), \
483 		      (tdlsflag), \
484 		      (channel_freq), \
485 		      (rid), \
486 		      (peer_rssi), \
487 		      (action)))
488 
489 /**
490  * struct sUapsd_Params - Powersave Offload Changes
491  * @bkDeliveryEnabled: BK delivery enabled flag
492  * @beDeliveryEnabled: BE delivery enabled flag
493  * @viDeliveryEnabled: VI delivery enabled flag
494  * @voDeliveryEnabled: VO delivery enabled flag
495  * @bkTriggerEnabled: BK trigger enabled flag
496  * @beTriggerEnabled: BE trigger enabled flag
497  * @viTriggerEnabled: VI trigger enabled flag
498  * @voTriggerEnabled: VO trigger enabled flag
499  */
500 typedef struct sUapsd_Params {
501 	uint8_t bkDeliveryEnabled:1;
502 	uint8_t beDeliveryEnabled:1;
503 	uint8_t viDeliveryEnabled:1;
504 	uint8_t voDeliveryEnabled:1;
505 	uint8_t bkTriggerEnabled:1;
506 	uint8_t beTriggerEnabled:1;
507 	uint8_t viTriggerEnabled:1;
508 	uint8_t voTriggerEnabled:1;
509 	bool enable_ps;
510 } tUapsd_Params, *tpUapsd_Params;
511 
512 /**
513  * struct sEnablePsParams - Enable PowerSave Params
514  * @psSetting: power save setting
515  * @uapsdParams: UAPSD Parameters
516  * @sessionid: sme session id / vdev id
517  */
518 typedef struct sEnablePsParams {
519 	tSirAddonPsReq psSetting;
520 	tUapsd_Params uapsdParams;
521 	uint32_t sessionid;
522 } tEnablePsParams, *tpEnablePsParams;
523 
524 /**
525  * struct sDisablePsParams - Disable PowerSave Params
526  * @psSetting: power save setting
527  * @sessionid: sme session id / vdev id
528  */
529 typedef struct sDisablePsParams {
530 	tSirAddonPsReq psSetting;
531 	uint32_t sessionid;
532 } tDisablePsParams, *tpDisablePsParams;
533 
534 /**
535  * struct sEnableUapsdParams - Enable Uapsd Params
536  * @uapsdParams: UAPSD parameters
537  * @bssid: mac address
538  * @sessionid: sme session id/ vdev id
539  * @status: success/failure
540  */
541 typedef struct sEnableUapsdParams {
542 	tUapsd_Params uapsdParams;
543 	tSirMacAddr bssid;
544 	uint32_t sessionid;
545 	uint32_t status;
546 } tEnableUapsdParams, *tpEnableUapsdParams;
547 
548 /**
549  * struct sDisableUapsdParams - Disable Uapsd Params
550  * @bssid: mac address
551  * @sessionid: sme session id/ vdev id
552  * @status: success/failure
553  */
554 typedef struct sDisableUapsdParams {
555 	tSirMacAddr bssid;
556 	uint32_t sessionid;
557 	uint32_t status;
558 } tDisableUapsdParams, *tpDisableUapsdParams;
559 
560 /**
561  * wma_tx_dwnld_comp_callback - callback function for TX dwnld complete
562  * @context: global mac pointer
563  * @buf: buffer
564  * @bFreeData: to free/not free the buffer
565  *
566  * callback function for mgmt tx download completion.
567  *
568  * Return: QDF_STATUS_SUCCESS in case of success
569  */
570 typedef QDF_STATUS (*wma_tx_dwnld_comp_callback)(void *context, qdf_nbuf_t buf,
571 				 bool bFreeData);
572 
573 /**
574  * wma_tx_ota_comp_callback - callback function for TX complete
575  * @context: global mac pointer
576  * @buf: buffer
577  * @status: tx completion status
578  * @params: tx completion params
579  *
580  * callback function for mgmt tx ota completion.
581  *
582  * Return: QDF_STATUS_SUCCESS in case of success
583  */
584 typedef QDF_STATUS (*wma_tx_ota_comp_callback)(void *context, qdf_nbuf_t buf,
585 				      uint32_t status, void *params);
586 
587 /* generic callback for updating parameters from target to HDD */
588 typedef int (*wma_tgt_cfg_cb)(hdd_handle_t handle, struct wma_tgt_cfg *cfg);
589 
590 /**
591  * struct wma_cli_set_cmd_t - set command parameters
592  * @param_id: parameter id
593  * @param_value: parameter value
594  * @param_sec_value: parameter sec value
595  * @param_vdev_id: parameter vdev id
596  * @param_vp_dev: is it per vdev/pdev
597  */
598 typedef struct {
599 	uint32_t param_id;
600 	uint32_t param_value;
601 	uint32_t param_sec_value;
602 	uint32_t param_vdev_id;
603 	uint32_t param_vp_dev;
604 } wma_cli_set_cmd_t;
605 
606 enum rateid {
607 	RATEID_1MBPS = 0,
608 	RATEID_2MBPS,
609 	RATEID_5_5MBPS,
610 	RATEID_11MBPS,
611 	RATEID_6MBPS,
612 	RATEID_9MBPS,
613 	RATEID_12MBPS,
614 	RATEID_18MBPS,
615 	RATEID_24MBPS,
616 	RATEID_36MBPS,
617 	RATEID_48MBPS = 10,
618 	RATEID_54MBPS,
619 	RATEID_DEFAULT
620 };
621 
622 QDF_STATUS wma_post_ctrl_msg(struct mac_context *mac, struct scheduler_msg *pMsg);
623 
624 QDF_STATUS u_mac_post_ctrl_msg(void *pSirGlobal, tSirMbMsg *pMb);
625 
626 QDF_STATUS wma_set_idle_ps_config(void *wma_ptr, uint32_t idle_ps);
627 QDF_STATUS wma_get_snr(tAniGetSnrReq *psnr_req);
628 
629 /**
630  * wma_get_rx_retry_cnt() - API to get rx retry count from data path
631  * @mac: pointer to mac context
632  * @vdev_id: vdev id
633  * @mac_addr: mac address of the remote station
634  *
635  * Return: none
636  */
637 void wma_get_rx_retry_cnt(struct mac_context *mac, uint8_t vdev_id,
638 			  uint8_t *mac_addr);
639 
640 /**
641  * wma_set_wlm_latency_level() - set latency level to FW
642  * @wma_ptr: wma handle
643  * @latency_params: latency params
644  *
645  * Return: QDF_STATUS
646  */
647 QDF_STATUS wma_set_wlm_latency_level(void *wma_ptr,
648 			struct wlm_latency_level_param *latency_params);
649 
650 /**
651  * wma_ds_peek_rx_packet_info() - peek rx packet info
652  * @pkt: packet
653  * @pkt_meta: packet meta
654  *
655  * Function fills the rx packet meta info from the the cds packet
656  *
657  * Return: QDF status
658  */
659 QDF_STATUS wma_ds_peek_rx_packet_info(cds_pkt_t *pkt, void **pkt_meta);
660 
661 /**
662  * wma_tx_abort() - abort tx
663  * @vdev_id: vdev id
664  *
665  * In case of deauth host abort transmitting packet.
666  *
667  * Return: none
668  */
669 void wma_tx_abort(uint8_t vdev_id);
670 
671 /**
672  * wma_tx_packet() - Sends Tx Frame to TxRx
673  * @wma_context: wma context
674  * @tx_frame: frame buffer
675  * @frmLen: frame length
676  * @frmType: frame type
677  * @txDir: tx diection
678  * @tid: TID
679  * @tx_frm_download_comp_cb: tx download callback handler
680  * @pData: tx packet
681  * @tx_frm_ota_comp_cb: OTA completion handler
682  * @tx_flag: tx flag
683  * @vdev_id: vdev id
684  * @tdls_flag: tdls flag
685  * @channel_freq: channel frequency
686  * @rid: rate id
687  * @peer_rssi: peer RSSI value
688  * @action: action code
689  *
690  * This function sends the frame corresponding to the
691  * given vdev id.
692  * This is blocking call till the downloading of frame is complete.
693  *
694  * Return: QDF status
695  */
696 QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
697 			 eFrameType frmType, eFrameTxDir txDir, uint8_t tid,
698 			 wma_tx_dwnld_comp_callback tx_frm_download_comp_cb,
699 			 void *pData,
700 			 wma_tx_ota_comp_callback tx_frm_ota_comp_cb,
701 			 uint8_t tx_flag, uint8_t vdev_id, bool tdls_flag,
702 			 uint16_t channel_freq, enum rateid rid,
703 			 int8_t peer_rssi, uint16_t action);
704 
705 /**
706  * wma_open() - Allocate wma context and initialize it.
707  * @psoc: Psoc pointer
708  * @pTgtUpdCB: tgt config update callback fun
709  * @cds_cfg:  mac parameters
710  * @target_type: Target type
711  *
712  * Return: QDF_STATUS
713  */
714 QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
715 		    wma_tgt_cfg_cb pTgtUpdCB, struct cds_config_info *cds_cfg,
716 		    uint32_t target_type);
717 
718 /**
719  * wma_vdev_init() - initialize a wma vdev
720  * @vdev: the vdev to initialize
721  *
722  * Return: None
723  */
724 void wma_vdev_init(struct wma_txrx_node *vdev);
725 
726 /**
727  * wma_vdev_deinit() - de-initialize a wma vdev
728  * @vdev: the vdev to de-initialize
729  *
730  * Return: None
731  */
732 void wma_vdev_deinit(struct wma_txrx_node *vdev);
733 
734 QDF_STATUS wma_register_mgmt_frm_client(void);
735 
736 QDF_STATUS wma_de_register_mgmt_frm_client(void);
737 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
738 QDF_STATUS wma_register_roaming_callbacks(
739 		QDF_STATUS (*csr_roam_auth_event_handle_cb)(
740 			struct mac_context *mac,
741 			uint8_t vdev_id,
742 			struct qdf_mac_addr bssid,
743 			uint32_t akm),
744 		pe_roam_synch_fn_t pe_roam_synch_cb,
745 		QDF_STATUS (*pe_disconnect_cb) (struct mac_context *mac,
746 			uint8_t vdev_id,
747 			uint8_t *deauth_disassoc_frame,
748 			uint16_t deauth_disassoc_frame_len,
749 			uint16_t reason_code),
750 		set_ies_fn_t pe_roam_set_ie_cb);
751 #else
wma_register_roaming_callbacks(QDF_STATUS (* csr_roam_auth_event_handle_cb)(struct mac_context * mac,uint8_t vdev_id,struct qdf_mac_addr bssid,uint32_t akm),pe_roam_synch_fn_t pe_roam_synch_cb,QDF_STATUS (* pe_disconnect_cb)(struct mac_context * mac,uint8_t vdev_id,uint8_t * deauth_disassoc_frame,uint16_t deauth_disassoc_frame_len,uint16_t reason_code),set_ies_fn_t pe_roam_set_ie_cb)752 static inline QDF_STATUS wma_register_roaming_callbacks(
753 		QDF_STATUS (*csr_roam_auth_event_handle_cb)(
754 			struct mac_context *mac,
755 			uint8_t vdev_id,
756 			struct qdf_mac_addr bssid,
757 			uint32_t akm),
758 		pe_roam_synch_fn_t pe_roam_synch_cb,
759 		QDF_STATUS (*pe_disconnect_cb) (struct mac_context *mac,
760 			uint8_t vdev_id,
761 			uint8_t *deauth_disassoc_frame,
762 			uint16_t deauth_disassoc_frame_len,
763 			uint16_t reason_code),
764 		set_ies_fn_t pe_roam_set_ie_cb)
765 {
766 	return QDF_STATUS_E_NOSUPPORT;
767 }
768 #endif
769 
770 #endif
771