xref: /wlan-dirver/qca-wifi-host-cmn/hal/wifi3.0/be/hal_be_generic_api.h (revision 2888b71da71bce103343119fa1b31f4a0cee07c8)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 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 _HAL_BE_GENERIC_API_H_
21 #define _HAL_BE_GENERIC_API_H_
22 
23 #include <hal_be_hw_headers.h>
24 #include "hal_be_tx.h"
25 #include "hal_be_reo.h"
26 #include <hal_api_mon.h>
27 #include <hal_generic_api.h>
28 #include <hal_be_api_mon.h>
29 
30 /**
31  * Debug macro to print the TLV header tag
32  */
33 #define SHOW_DEFINED(x) do {} while (0)
34 
35 #if defined(WLAN_FEATURE_TSF_UPLINK_DELAY) || defined(WLAN_CONFIG_TX_DELAY)
36 static inline void
37 hal_tx_comp_get_buffer_timestamp_be(void *desc,
38 				    struct hal_tx_completion_status *ts)
39 {
40 	ts->buffer_timestamp = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
41 					       BUFFER_TIMESTAMP);
42 }
43 #else /* !WLAN_FEATURE_TSF_UPLINK_DELAY || WLAN_CONFIG_TX_DELAY */
44 static inline void
45 hal_tx_comp_get_buffer_timestamp_be(void *desc,
46 				    struct hal_tx_completion_status *ts)
47 {
48 }
49 #endif /* WLAN_FEATURE_TSF_UPLINK_DELAY || CONFIG_SAWF */
50 
51 /**
52  * hal_tx_comp_get_status() - TQM Release reason
53  * @hal_desc: completion ring Tx status
54  *
55  * This function will parse the WBM completion descriptor and populate in
56  * HAL structure
57  *
58  * Return: none
59  */
60 static inline void
61 hal_tx_comp_get_status_generic_be(void *desc, void *ts1,
62 				  struct hal_soc *hal)
63 {
64 	uint8_t rate_stats_valid = 0;
65 	uint32_t rate_stats = 0;
66 	struct hal_tx_completion_status *ts =
67 		(struct hal_tx_completion_status *)ts1;
68 
69 	ts->ppdu_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
70 				      TQM_STATUS_NUMBER);
71 	ts->ack_frame_rssi = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
72 					     ACK_FRAME_RSSI);
73 	ts->first_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
74 					 FIRST_MSDU);
75 	ts->last_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
76 					LAST_MSDU);
77 #if 0
78 	// TODO -  This has to be calculated form first and last msdu
79 	ts->msdu_part_of_amsdu = HAL_TX_DESC_GET(desc,
80 						 WBM2SW_COMPLETION_RING_TX,
81 						 MSDU_PART_OF_AMSDU);
82 #endif
83 
84 	ts->peer_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
85 				      SW_PEER_ID);
86 	ts->tid = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX, TID);
87 	ts->transmit_cnt = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
88 					   TRANSMIT_COUNT);
89 
90 	rate_stats = HAL_TX_DESC_GET(desc, HAL_TX_COMP, TX_RATE_STATS);
91 
92 	rate_stats_valid = HAL_TX_MS(TX_RATE_STATS_INFO,
93 			TX_RATE_STATS_INFO_VALID, rate_stats);
94 
95 	ts->valid = rate_stats_valid;
96 
97 	if (rate_stats_valid) {
98 		ts->bw = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_BW,
99 				rate_stats);
100 		ts->pkt_type = HAL_TX_MS(TX_RATE_STATS_INFO,
101 				TRANSMIT_PKT_TYPE, rate_stats);
102 		ts->stbc = HAL_TX_MS(TX_RATE_STATS_INFO,
103 				TRANSMIT_STBC, rate_stats);
104 		ts->ldpc = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_LDPC,
105 				rate_stats);
106 		ts->sgi = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_SGI,
107 				rate_stats);
108 		ts->mcs = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_MCS,
109 				rate_stats);
110 		ts->ofdma = HAL_TX_MS(TX_RATE_STATS_INFO, OFDMA_TRANSMISSION,
111 				rate_stats);
112 		ts->tones_in_ru = HAL_TX_MS(TX_RATE_STATS_INFO, TONES_IN_RU,
113 				rate_stats);
114 	}
115 
116 	ts->release_src = hal_tx_comp_get_buffer_source_generic_be(desc);
117 	ts->status = hal_tx_comp_get_release_reason(
118 					desc,
119 					hal_soc_to_hal_soc_handle(hal));
120 
121 	ts->tsf = HAL_TX_DESC_GET(desc, UNIFIED_WBM_RELEASE_RING_6,
122 			TX_RATE_STATS_INFO_TX_RATE_STATS);
123 	hal_tx_comp_get_buffer_timestamp_be(desc, ts);
124 }
125 
126 /**
127  * hal_tx_set_pcp_tid_map_generic_be() - Configure default PCP to TID map table
128  * @soc: HAL SoC context
129  * @map: PCP-TID mapping table
130  *
131  * PCP are mapped to 8 TID values using TID values programmed
132  * in one set of mapping registers PCP_TID_MAP_<0 to 6>
133  * The mapping register has TID mapping for 8 PCP values
134  *
135  * Return: none
136  */
137 static void hal_tx_set_pcp_tid_map_generic_be(struct hal_soc *soc, uint8_t *map)
138 {
139 	uint32_t addr, value;
140 
141 	addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
142 				MAC_TCL_REG_REG_BASE);
143 
144 	value = (map[0] |
145 		(map[1] << HWIO_TCL_R0_PCP_TID_MAP_PCP_1_SHFT) |
146 		(map[2] << HWIO_TCL_R0_PCP_TID_MAP_PCP_2_SHFT) |
147 		(map[3] << HWIO_TCL_R0_PCP_TID_MAP_PCP_3_SHFT) |
148 		(map[4] << HWIO_TCL_R0_PCP_TID_MAP_PCP_4_SHFT) |
149 		(map[5] << HWIO_TCL_R0_PCP_TID_MAP_PCP_5_SHFT) |
150 		(map[6] << HWIO_TCL_R0_PCP_TID_MAP_PCP_6_SHFT) |
151 		(map[7] << HWIO_TCL_R0_PCP_TID_MAP_PCP_7_SHFT));
152 
153 	HAL_REG_WRITE(soc, addr, (value & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
154 }
155 
156 /**
157  * hal_tx_update_pcp_tid_generic_be() - Update the pcp tid map table with
158  *					value received from user-space
159  * @soc: HAL SoC context
160  * @pcp: pcp value
161  * @tid : tid value
162  *
163  * Return: void
164  */
165 static void
166 hal_tx_update_pcp_tid_generic_be(struct hal_soc *soc,
167 				 uint8_t pcp, uint8_t tid)
168 {
169 	uint32_t addr, value, regval;
170 
171 	addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
172 				MAC_TCL_REG_REG_BASE);
173 
174 	value = (uint32_t)tid << (HAL_TX_BITS_PER_TID * pcp);
175 
176 	/* Read back previous PCP TID config and update
177 	 * with new config.
178 	 */
179 	regval = HAL_REG_READ(soc, addr);
180 	regval &= ~(HAL_TX_TID_BITS_MASK << (HAL_TX_BITS_PER_TID * pcp));
181 	regval |= value;
182 
183 	HAL_REG_WRITE(soc, addr,
184 		      (regval & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
185 }
186 
187 /**
188  * hal_tx_update_tidmap_prty_generic_be() - Update the tid map priority
189  * @soc: HAL SoC context
190  * @val: priority value
191  *
192  * Return: void
193  */
194 static
195 void hal_tx_update_tidmap_prty_generic_be(struct hal_soc *soc, uint8_t value)
196 {
197 	uint32_t addr;
198 
199 	addr = HWIO_TCL_R0_TID_MAP_PRTY_ADDR(
200 				MAC_TCL_REG_REG_BASE);
201 
202 	HAL_REG_WRITE(soc, addr,
203 		      (value & HWIO_TCL_R0_TID_MAP_PRTY_RMSK));
204 }
205 
206 /**
207  * hal_rx_get_tlv_size_generic_be() - Get rx packet tlv size
208  * @rx_pkt_tlv_size: TLV size for regular RX packets
209  * @rx_mon_pkt_tlv_size: TLV size for monitor mode packets
210  *
211  * Return: size of rx pkt tlv before the actual data
212  */
213 static void hal_rx_get_tlv_size_generic_be(uint16_t *rx_pkt_tlv_size,
214 					   uint16_t *rx_mon_pkt_tlv_size)
215 {
216 	*rx_pkt_tlv_size = RX_PKT_TLVS_LEN;
217 	/* For now mon pkt tlv is same as rx pkt tlv */
218 	*rx_mon_pkt_tlv_size = MON_RX_PKT_TLVS_LEN;
219 }
220 
221 /**
222  * hal_rx_flow_get_tuple_info_be() - Setup a flow search entry in HW FST
223  * @fst: Pointer to the Rx Flow Search Table
224  * @hal_hash: HAL 5 tuple hash
225  * @tuple_info: 5-tuple info of the flow returned to the caller
226  *
227  * Return: Success/Failure
228  */
229 static void *
230 hal_rx_flow_get_tuple_info_be(uint8_t *rx_fst, uint32_t hal_hash,
231 			      uint8_t *flow_tuple_info)
232 {
233 	struct hal_rx_fst *fst = (struct hal_rx_fst *)rx_fst;
234 	void *hal_fse = NULL;
235 	struct hal_flow_tuple_info *tuple_info
236 		= (struct hal_flow_tuple_info *)flow_tuple_info;
237 
238 	hal_fse = (uint8_t *)fst->base_vaddr +
239 		(hal_hash * HAL_RX_FST_ENTRY_SIZE);
240 
241 	if (!hal_fse || !tuple_info)
242 		return NULL;
243 
244 	if (!HAL_GET_FLD(hal_fse, RX_FLOW_SEARCH_ENTRY, VALID))
245 		return NULL;
246 
247 	tuple_info->src_ip_127_96 =
248 				qdf_ntohl(HAL_GET_FLD(hal_fse,
249 						      RX_FLOW_SEARCH_ENTRY,
250 						      SRC_IP_127_96));
251 	tuple_info->src_ip_95_64 =
252 				qdf_ntohl(HAL_GET_FLD(hal_fse,
253 						      RX_FLOW_SEARCH_ENTRY,
254 						      SRC_IP_95_64));
255 	tuple_info->src_ip_63_32 =
256 				qdf_ntohl(HAL_GET_FLD(hal_fse,
257 						      RX_FLOW_SEARCH_ENTRY,
258 						      SRC_IP_63_32));
259 	tuple_info->src_ip_31_0 =
260 				qdf_ntohl(HAL_GET_FLD(hal_fse,
261 						      RX_FLOW_SEARCH_ENTRY,
262 						      SRC_IP_31_0));
263 	tuple_info->dest_ip_127_96 =
264 				qdf_ntohl(HAL_GET_FLD(hal_fse,
265 						      RX_FLOW_SEARCH_ENTRY,
266 						      DEST_IP_127_96));
267 	tuple_info->dest_ip_95_64 =
268 				qdf_ntohl(HAL_GET_FLD(hal_fse,
269 						      RX_FLOW_SEARCH_ENTRY,
270 						      DEST_IP_95_64));
271 	tuple_info->dest_ip_63_32 =
272 				qdf_ntohl(HAL_GET_FLD(hal_fse,
273 						      RX_FLOW_SEARCH_ENTRY,
274 						      DEST_IP_63_32));
275 	tuple_info->dest_ip_31_0 =
276 				qdf_ntohl(HAL_GET_FLD(hal_fse,
277 						      RX_FLOW_SEARCH_ENTRY,
278 						      DEST_IP_31_0));
279 	tuple_info->dest_port = HAL_GET_FLD(hal_fse,
280 					    RX_FLOW_SEARCH_ENTRY,
281 					    DEST_PORT);
282 	tuple_info->src_port = HAL_GET_FLD(hal_fse,
283 					   RX_FLOW_SEARCH_ENTRY,
284 					   SRC_PORT);
285 	tuple_info->l4_protocol = HAL_GET_FLD(hal_fse,
286 					      RX_FLOW_SEARCH_ENTRY,
287 					      L4_PROTOCOL);
288 
289 	return hal_fse;
290 }
291 
292 /**
293  * hal_rx_flow_delete_entry_be() - Setup a flow search entry in HW FST
294  * @fst: Pointer to the Rx Flow Search Table
295  * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
296  *
297  * Return: Success/Failure
298  */
299 static QDF_STATUS
300 hal_rx_flow_delete_entry_be(uint8_t *rx_fst, void *hal_rx_fse)
301 {
302 	uint8_t *fse = (uint8_t *)hal_rx_fse;
303 
304 	if (!HAL_GET_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID))
305 		return QDF_STATUS_E_NOENT;
306 
307 	HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID);
308 
309 	return QDF_STATUS_SUCCESS;
310 }
311 
312 /**
313  * hal_rx_fst_get_fse_size_be() - Retrieve the size of each entry in Rx FST
314  *
315  * Return: size of each entry/flow in Rx FST
316  */
317 static inline uint32_t
318 hal_rx_fst_get_fse_size_be(void)
319 {
320 	return HAL_RX_FST_ENTRY_SIZE;
321 }
322 
323 /*
324  * TX MONITOR
325  */
326 
327 #ifdef QCA_MONITOR_2_0_SUPPORT
328 /**
329  * hal_txmon_is_mon_buf_addr_tlv_generic_be() - api to find mon buffer tlv
330  * @tx_tlv: pointer to TLV header
331  *
332  * Return: bool based on tlv tag matches monitor buffer address tlv
333  */
334 static inline bool
335 hal_txmon_is_mon_buf_addr_tlv_generic_be(void *tx_tlv_hdr)
336 {
337 	uint32_t tlv_tag;
338 
339 	tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv_hdr);
340 
341 	if (WIFIMON_BUFFER_ADDR_E == tlv_tag)
342 		return true;
343 
344 	return false;
345 }
346 
347 /**
348  * hal_txmon_populate_packet_info_generic_be() - api to populate packet info
349  * @tx_tlv: pointer to TLV header
350  * @packet_info: place holder for packet info
351  *
352  * Return: Address to void
353  */
354 static inline void
355 hal_txmon_populate_packet_info_generic_be(void *tx_tlv, void *packet_info)
356 {
357 	struct hal_mon_packet_info *pkt_info;
358 	struct mon_buffer_addr *addr = (struct mon_buffer_addr *)tx_tlv;
359 
360 	pkt_info = (struct hal_mon_packet_info *)packet_info;
361 	pkt_info->sw_cookie = (((uint64_t)addr->buffer_virt_addr_63_32 << 32) |
362 			       (addr->buffer_virt_addr_31_0));
363 	pkt_info->dma_length = addr->dma_length + 1;
364 	pkt_info->msdu_continuation = addr->msdu_continuation;
365 	pkt_info->truncated = addr->truncated;
366 }
367 
368 #if defined(TX_MONITOR_WORD_MASK)
369 /**
370  * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
371  *
372  * @tx_tlv: pointer to tx_fes_setup tlv header
373  *
374  * Return: number of users
375  */
376 static inline uint8_t
377 hal_txmon_get_num_users(void *tx_tlv)
378 {
379 	hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
380 
381 	return tx_fes_setup->number_of_users;
382 }
383 
384 /**
385  * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
386  *
387  * @tx_tlv: pointer to tx_fes_setup tlv header
388  * @ppdu_info: pointer to hal_tx_ppdu_info
389  *
390  * Return: void
391  */
392 static inline void
393 hal_txmon_parse_tx_fes_setup(void *tx_tlv,
394 			     struct hal_tx_ppdu_info *tx_ppdu_info)
395 {
396 	hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
397 
398 	tx_ppdu_info->num_users = tx_fes_setup->number_of_users;
399 	if (tx_ppdu_info->num_users == 0)
400 		tx_ppdu_info->num_users = 1;
401 	tx_ppdu_info->ppdu_id = tx_fes_setup->schedule_id;
402 }
403 
404 /**
405  * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
406  *
407  * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
408  * @data_status_info: pointer to data hal_tx_status_info
409  * @prot_status_info: pointer to protection hal_tx_status_info
410  *
411  * Return: void
412  */
413 static inline void
414 hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
415 				    struct hal_tx_status_info *data_status_info,
416 				    struct hal_tx_status_info *prot_status_info)
417 {
418 }
419 
420 /**
421  * hal_txmon_parse_peer_entry() - parse peer entry tlv
422  *
423  * @tx_tlv: pointer to peer_entry tlv header
424  * @user_id: user_id
425  * @tx_ppdu_info: pointer to hal_tx_ppdu_info
426  * @tx_status_info: pointer to hal_tx_status_info
427  *
428  * Return: void
429  */
430 static inline void
431 hal_txmon_parse_peer_entry(void *tx_tlv,
432 			   uint8_t user_id,
433 			   struct hal_tx_ppdu_info *tx_ppdu_info,
434 			   struct hal_tx_status_info *tx_status_info)
435 {
436 }
437 
438 /**
439  * hal_txmon_parse_queue_exten() - parse queue exten tlv
440  *
441  * @tx_tlv: pointer to queue exten tlv header
442  * @tx_ppdu_info: pointer to hal_tx_ppdu_info
443  *
444  * Return: void
445  */
446 static inline void
447 hal_txmon_parse_queue_exten(void *tx_tlv,
448 			    struct hal_tx_ppdu_info *tx_ppdu_info)
449 {
450 }
451 
452 /**
453  * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
454  *
455  * @tx_tlv: pointer to mpdu start tlv header
456  * @user_id: user id
457  * @tx_ppdu_info: pointer to hal_tx_ppdu_info
458  *
459  * Return: void
460  */
461 static inline void
462 hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
463 			   struct hal_tx_ppdu_info *tx_ppdu_info)
464 {
465 }
466 
467 #else
468 /**
469  * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
470  *
471  * @tx_tlv: pointer to tx_fes_setup tlv header
472  *
473  * Return: number of users
474  */
475 static inline uint8_t
476 hal_txmon_get_num_users(void *tx_tlv)
477 {
478 	uint8_t num_users = HAL_TX_DESC_GET_64(tx_tlv,
479 					       TX_FES_SETUP, NUMBER_OF_USERS);
480 
481 	return num_users;
482 }
483 
484 /**
485  * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
486  *
487  * @tx_tlv: pointer to tx_fes_setup tlv header
488  * @ppdu_info: pointer to hal_tx_ppdu_info
489  *
490  * Return: void
491  */
492 static inline void
493 hal_txmon_parse_tx_fes_setup(void *tx_tlv,
494 			     struct hal_tx_ppdu_info *tx_ppdu_info)
495 {
496 	uint32_t num_users = 0;
497 	uint32_t ppdu_id = 0;
498 
499 	num_users = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, NUMBER_OF_USERS);
500 	ppdu_id = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, SCHEDULE_ID);
501 
502 	if (num_users == 0)
503 		num_users = 1;
504 
505 	tx_ppdu_info->num_users = num_users;
506 	tx_ppdu_info->ppdu_id = ppdu_id;
507 }
508 
509 /**
510  * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
511  *
512  * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
513  * @data_status_info: pointer to data hal_tx_status_info
514  * @prot_status_info: pointer to protection hal_tx_status_info
515  *
516  * Return: void
517  */
518 static inline void
519 hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
520 				    struct hal_tx_status_info *data_status_info,
521 				    struct hal_tx_status_info *prot_status_info)
522 {
523 	prot_status_info->protection_addr =
524 			HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
525 					   USE_ADDRESS_FIELDS_FOR_PROTECTION);
526 	/* protection frame address 1 */
527 	*(uint32_t *)&prot_status_info->addr1[0] =
528 				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
529 						   PROTECTION_FRAME_AD1_31_0);
530 	*(uint32_t *)&prot_status_info->addr1[4] =
531 				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
532 						   PROTECTION_FRAME_AD1_47_32);
533 	/* protection frame address 2 */
534 	*(uint32_t *)&prot_status_info->addr2[0] =
535 				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
536 						   PROTECTION_FRAME_AD2_15_0);
537 	*(uint32_t *)&prot_status_info->addr2[2] =
538 				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
539 						   PROTECTION_FRAME_AD2_47_16);
540 	/* protection frame address 3 */
541 	*(uint32_t *)&prot_status_info->addr3[0] =
542 				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
543 						   PROTECTION_FRAME_AD3_31_0);
544 	*(uint32_t *)&prot_status_info->addr3[4] =
545 				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
546 						   PROTECTION_FRAME_AD3_47_32);
547 	/* protection frame address 4 */
548 	*(uint32_t *)&prot_status_info->addr4[0] =
549 				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
550 						   PROTECTION_FRAME_AD4_15_0);
551 	*(uint32_t *)&prot_status_info->addr4[2] =
552 				HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
553 						   PROTECTION_FRAME_AD4_47_16);
554 }
555 
556 /**
557  * hal_txmon_parse_peer_entry() - parse peer entry tlv
558  *
559  * @tx_tlv: pointer to peer_entry tlv header
560  * @user_id: user_id
561  * @tx_ppdu_info: pointer to hal_tx_ppdu_info
562  * @tx_status_info: pointer to hal_tx_status_info
563  *
564  * Return: void
565  */
566 static inline void
567 hal_txmon_parse_peer_entry(void *tx_tlv,
568 			   uint8_t user_id,
569 			   struct hal_tx_ppdu_info *tx_ppdu_info,
570 			   struct hal_tx_status_info *tx_status_info)
571 {
572 	*(uint32_t *)&tx_status_info->addr1[0] =
573 		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_31_0);
574 	*(uint32_t *)&tx_status_info->addr1[4] =
575 		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_47_32);
576 	*(uint32_t *)&tx_status_info->addr2[0] =
577 		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_15_0);
578 	*(uint32_t *)&tx_status_info->addr2[2] =
579 		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_47_16);
580 	TXMON_HAL_USER(tx_ppdu_info, user_id, sw_peer_id) =
581 		HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, SW_PEER_ID);
582 }
583 
584 /**
585  * hal_txmon_parse_queue_exten() - parse queue exten tlv
586  *
587  * @tx_tlv: pointer to queue exten tlv header
588  * @tx_ppdu_info: pointer to hal_tx_ppdu_info
589  *
590  * Return: void
591  */
592 static inline void
593 hal_txmon_parse_queue_exten(void *tx_tlv,
594 			    struct hal_tx_ppdu_info *tx_ppdu_info)
595 {
596 	TXMON_HAL_STATUS(tx_ppdu_info, frame_control) =
597 				HAL_TX_DESC_GET_64(tx_tlv, TX_QUEUE_EXTENSION,
598 						   FRAME_CTL);
599 	TXMON_HAL_STATUS(tx_ppdu_info, frame_control_info_valid) = true;
600 }
601 
602 /**
603  * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
604  *
605  * @tx_tlv: pointer to mpdu start tlv header
606  * @user_id: user id
607  * @tx_ppdu_info: pointer to hal_tx_ppdu_info
608  *
609  * Return: void
610  */
611 static inline void
612 hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
613 			   struct hal_tx_ppdu_info *tx_ppdu_info)
614 {
615 	TXMON_HAL_USER(tx_ppdu_info, user_id,
616 		       start_seq) = HAL_TX_DESC_GET_64(tx_tlv, TX_MPDU_START,
617 						       MPDU_SEQUENCE_NUMBER);
618 	TXMON_HAL(tx_ppdu_info, cur_usr_idx) = user_id;
619 }
620 #endif
621 
622 /**
623  * hal_txmon_status_get_num_users_generic_be() - api to get num users
624  * from start of fes window
625  *
626  * @tx_tlv_hdr: pointer to TLV header
627  * @num_users: reference to number of user
628  *
629  * Return: status
630  */
631 static inline uint32_t
632 hal_txmon_status_get_num_users_generic_be(void *tx_tlv_hdr, uint8_t *num_users)
633 {
634 	uint32_t tlv_tag, user_id, tlv_len;
635 	uint32_t tlv_status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
636 	void *tx_tlv;
637 
638 	tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(tx_tlv_hdr);
639 	user_id = HAL_RX_GET_USER_TLV32_USERID(tx_tlv_hdr);
640 	tlv_len = HAL_RX_GET_USER_TLV32_LEN(tx_tlv_hdr);
641 
642 	tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
643 	/* window starts with either initiator or response */
644 	switch (tlv_tag) {
645 	case WIFITX_FES_SETUP_E:
646 	{
647 		*num_users = hal_txmon_get_num_users(tx_tlv);
648 		if (*num_users == 0)
649 			*num_users = 1;
650 
651 		tlv_status = HAL_MON_TX_FES_SETUP;
652 		break;
653 	}
654 	case WIFIRX_RESPONSE_REQUIRED_INFO_E:
655 	{
656 		*num_users = HAL_TX_DESC_GET_64(tx_tlv,
657 						RX_RESPONSE_REQUIRED_INFO,
658 						RESPONSE_STA_COUNT);
659 		if (*num_users == 0)
660 			*num_users = 1;
661 		tlv_status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
662 		break;
663 	}
664 	};
665 
666 	return tlv_status;
667 }
668 
669 /**
670  * hal_tx_get_ppdu_info() - api to get tx ppdu info
671  * @pdev_handle: DP_PDEV handle
672  * @prot_ppdu_info: populate dp_ppdu_info protection
673  * @tx_data_ppdu_info: populate dp_ppdu_info data
674  * @tlv_tag: Tag
675  *
676  * Return: dp_tx_ppdu_info pointer
677  */
678 static inline void *
679 hal_tx_get_ppdu_info(void *data_info, void *prot_info, uint32_t tlv_tag)
680 {
681 	struct hal_tx_ppdu_info *prot_ppdu_info = prot_info;
682 
683 	switch (tlv_tag) {
684 	case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
685 	case WIFITX_FLUSH_E:/* DOWNSTREAM */
686 	case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
687 	case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
688 	case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
689 	case WIFITX_MPDU_START_E:/* DOWNSTREAM */
690 	case WIFITX_MSDU_START_E:/* DOWNSTREAM */
691 	case WIFITX_DATA_E:/* DOWNSTREAM */
692 	case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
693 	case WIFITX_MPDU_END_E:/* DOWNSTREAM */
694 	case WIFITX_MSDU_END_E:/* DOWNSTREAM */
695 	case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
696 	case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
697 	case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
698 	case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
699 	case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
700 	case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
701 	case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
702 	case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
703 	case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
704 	case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
705 	case WIFISCHEDULER_END_E:/* DOWNSTREAM */
706 	case WIFITX_FES_STATUS_START_PPDU_E:/* UPSTREAM */
707 	{
708 		return data_info;
709 	}
710 	}
711 
712 	/*
713 	 * check current prot_tlv_status is start protection
714 	 * check current tlv_tag is either start protection or end protection
715 	 */
716 	if (TXMON_HAL(prot_ppdu_info,
717 		      prot_tlv_status) == WIFITX_FES_STATUS_START_PROT_E) {
718 		return prot_info;
719 	} else if (tlv_tag == WIFITX_FES_STATUS_PROT_E ||
720 		   tlv_tag == WIFITX_FES_STATUS_START_PROT_E) {
721 		TXMON_HAL(prot_ppdu_info, prot_tlv_status) = tlv_tag;
722 		return prot_info;
723 	} else {
724 		TXMON_HAL(prot_ppdu_info, prot_tlv_status) = tlv_tag;
725 		return data_info;
726 	}
727 
728 	return data_info;
729 }
730 
731 /**
732  * hal_txmon_status_parse_tlv_generic_be() - api to parse status tlv.
733  * @data_ppdu_info: hal_txmon data ppdu info
734  * @prot_ppdu_info: hal_txmon prot ppdu info
735  * @data_status_info: pointer to data status info
736  * @prot_status_info: pointer to prot status info
737  * @tx_tlv_hdr: fragment of tx_tlv_hdr
738  * @status_frag: qdf_frag_t buffer
739  *
740  * Return: status
741  */
742 static inline uint32_t
743 hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
744 				      void *prot_ppdu_info,
745 				      void *data_status_info,
746 				      void *prot_status_info,
747 				      void *tx_tlv_hdr,
748 				      qdf_frag_t status_frag)
749 {
750 	struct hal_tx_ppdu_info *ppdu_info;
751 	struct hal_tx_status_info *tx_status_info;
752 	struct hal_mon_packet_info *packet_info = NULL;
753 	uint32_t tlv_tag, user_id, tlv_len;
754 	uint32_t status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
755 	void *tx_tlv;
756 
757 	tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv_hdr);
758 	/* user_id start with 1, decrement by 1 to start from 0 */
759 	user_id = HAL_RX_GET_USER_TLV64_USERID(tx_tlv_hdr) - 1;
760 	tlv_len = HAL_RX_GET_USER_TLV64_LEN(tx_tlv_hdr);
761 
762 	tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
763 
764 	/* parse tlv and populate tx_ppdu_info */
765 	ppdu_info = hal_tx_get_ppdu_info(data_ppdu_info,
766 					 prot_ppdu_info, tlv_tag);
767 	tx_status_info = (ppdu_info->is_data ? data_status_info :
768 			  prot_status_info);
769 
770 	user_id = user_id > ppdu_info->num_users ? 0 : ppdu_info->num_users;
771 
772 	switch (tlv_tag) {
773 	/* start of initiator FES window */
774 	case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
775 	{
776 		/* initiator PPDU window start */
777 		hal_txmon_parse_tx_fes_setup(tx_tlv, ppdu_info);
778 
779 		status = HAL_MON_TX_FES_SETUP;
780 		SHOW_DEFINED(WIFITX_FES_SETUP_E);
781 		break;
782 	}
783 	/* end of initiator FES window */
784 	case WIFITX_FES_STATUS_END_E:/* UPSTREAM */
785 	{
786 		/* initiator PPDU window end */
787 		uint32_t ppdu_timestamp_start = 0;
788 		uint32_t ppdu_timestamp_end = 0;
789 		uint8_t response_type = 0;
790 		uint8_t r2r_end_status_follow = 0;
791 
792 		status = HAL_MON_TX_FES_STATUS_END;
793 
794 		ppdu_timestamp_start =
795 			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
796 					   START_OF_FRAME_TIMESTAMP_15_0) |
797 			(HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
798 					    START_OF_FRAME_TIMESTAMP_31_16) <<
799 			 HAL_TX_LSB(TX_FES_STATUS_END,
800 				    START_OF_FRAME_TIMESTAMP_31_16));
801 		ppdu_timestamp_end =
802 			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
803 					   END_OF_FRAME_TIMESTAMP_15_0) |
804 			(HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
805 					    END_OF_FRAME_TIMESTAMP_31_16) <<
806 			 HAL_TX_LSB(TX_FES_STATUS_END,
807 				    END_OF_FRAME_TIMESTAMP_31_16));
808 
809 		response_type = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
810 						   RESPONSE_TYPE);
811 		/*
812 		 * r2r end status follow to inform whether to look for
813 		 * rx_response_required_info
814 		 */
815 		r2r_end_status_follow =
816 			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
817 					   R2R_END_STATUS_TO_FOLLOW);
818 
819 		TXMON_STATUS_INFO(tx_status_info,
820 				  response_type) = response_type;
821 		TXMON_STATUS_INFO(tx_status_info,
822 				  r2r_to_follow) = r2r_end_status_follow;
823 
824 		/*  update phy timestamp to ppdu timestamp */
825 		TXMON_HAL_STATUS(ppdu_info,
826 				 ppdu_timestamp) = ppdu_timestamp_start;
827 
828 		SHOW_DEFINED(WIFITX_FES_STATUS_END_E);
829 		break;
830 	}
831 	/* response window open */
832 	case WIFIRX_RESPONSE_REQUIRED_INFO_E:/* UPSTREAM */
833 	{
834 		/* response PPDU window start */
835 		uint32_t ppdu_id = 0;
836 		uint8_t reception_type = 0;
837 		uint8_t response_sta_count = 0;
838 
839 		status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
840 
841 		ppdu_id = HAL_TX_DESC_GET_64(tx_tlv,
842 					     RX_RESPONSE_REQUIRED_INFO,
843 					     PHY_PPDU_ID);
844 		reception_type =
845 			HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
846 					   SU_OR_UPLINK_MU_RECEPTION);
847 		response_sta_count =
848 			HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
849 					   RESPONSE_STA_COUNT);
850 
851 		/* get mac address */
852 		*(uint32_t *)&tx_status_info->addr1[0] =
853 				HAL_TX_DESC_GET_64(tx_tlv,
854 						   RX_RESPONSE_REQUIRED_INFO,
855 						   ADDR1_31_0);
856 		*(uint32_t *)&tx_status_info->addr1[4] =
857 				HAL_TX_DESC_GET_64(tx_tlv,
858 						   RX_RESPONSE_REQUIRED_INFO,
859 						   ADDR1_47_32);
860 		*(uint32_t *)&tx_status_info->addr2[0] =
861 				HAL_TX_DESC_GET_64(tx_tlv,
862 						   RX_RESPONSE_REQUIRED_INFO,
863 						   ADDR2_15_0);
864 		*(uint32_t *)&tx_status_info->addr2[2] =
865 				HAL_TX_DESC_GET_64(tx_tlv,
866 						   RX_RESPONSE_REQUIRED_INFO,
867 						   ADDR2_47_16);
868 
869 		TXMON_HAL(ppdu_info, ppdu_id) = ppdu_id;
870 		TXMON_HAL_STATUS(ppdu_info, ppdu_id) = ppdu_id;
871 
872 		if (response_sta_count == 0)
873 			response_sta_count = 1;
874 		TXMON_HAL(ppdu_info, num_users) = response_sta_count;
875 
876 		if (reception_type)
877 			TXMON_STATUS_INFO(tx_status_info,
878 					  transmission_type) =
879 							TXMON_SU_TRANSMISSION;
880 		else
881 			TXMON_STATUS_INFO(tx_status_info,
882 					  transmission_type) =
883 							TXMON_MU_TRANSMISSION;
884 
885 		SHOW_DEFINED(WIFIRX_RESPONSE_REQUIRED_INFO_E);
886 		break;
887 	}
888 	/* Response window close */
889 	case WIFIRESPONSE_END_STATUS_E:/* UPSTREAM */
890 	{
891 		/* response PPDU window end */
892 		uint8_t generated_response = 0;
893 		uint32_t bandwidth = 0;
894 		uint32_t ppdu_timestamp_start = 0;
895 		uint32_t ppdu_timestamp_end = 0;
896 
897 		status = HAL_MON_RESPONSE_END_STATUS_INFO;
898 		generated_response = HAL_TX_DESC_GET_64(tx_tlv,
899 							RESPONSE_END_STATUS,
900 							GENERATED_RESPONSE);
901 		bandwidth = HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
902 					       COEX_BASED_TX_BW);
903 		/* 32 bits TSF */
904 		ppdu_timestamp_start =
905 			(HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
906 					    START_OF_FRAME_TIMESTAMP_15_0) |
907 			 (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
908 					     START_OF_FRAME_TIMESTAMP_31_16) <<
909 			  16));
910 		ppdu_timestamp_end =
911 			(HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
912 					    END_OF_FRAME_TIMESTAMP_15_0) |
913 			 (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
914 					     END_OF_FRAME_TIMESTAMP_31_16) <<
915 			  16));
916 
917 		TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
918 		/* update phy timestamp to ppdu timestamp */
919 		TXMON_HAL_STATUS(ppdu_info,
920 				 ppdu_timestamp) = ppdu_timestamp_start;
921 
922 		TXMON_STATUS_INFO(tx_status_info,
923 				  generated_response) = generated_response;
924 		SHOW_DEFINED(WIFIRESPONSE_END_STATUS_E);
925 		break;
926 	}
927 	case WIFITX_FLUSH_E:/* DOWNSTREAM */
928 	{
929 		SHOW_DEFINED(WIFITX_FLUSH_E);
930 		break;
931 	}
932 
933 	/* Downstream tlv */
934 	case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
935 	{
936 		hal_txmon_parse_pcu_ppdu_setup_init(tx_tlv, data_status_info,
937 						    prot_status_info);
938 
939 		status = HAL_MON_TX_PCU_PPDU_SETUP_INIT;
940 		SHOW_DEFINED(WIFIPCU_PPDU_SETUP_INIT_E);
941 		break;
942 	}
943 	case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
944 	{
945 		hal_txmon_parse_peer_entry(tx_tlv, user_id,
946 					   ppdu_info, tx_status_info);
947 		SHOW_DEFINED(WIFITX_PEER_ENTRY_E);
948 		break;
949 	}
950 	case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
951 	{
952 		status = HAL_MON_TX_QUEUE_EXTENSION;
953 		hal_txmon_parse_queue_exten(tx_tlv, ppdu_info);
954 
955 		SHOW_DEFINED(WIFITX_QUEUE_EXTENSION_E);
956 		break;
957 	}
958 	/* payload and data frame handling */
959 	case WIFITX_MPDU_START_E:/* DOWNSTREAM */
960 	{
961 		hal_txmon_parse_mpdu_start(tx_tlv, user_id, ppdu_info);
962 
963 		status = HAL_MON_TX_MPDU_START;
964 		SHOW_DEFINED(WIFITX_MPDU_START_E);
965 		break;
966 	}
967 	case WIFITX_MSDU_START_E:/* DOWNSTREAM */
968 	{
969 		/* compacted */
970 		/* we expect frame to be 802.11 frame type */
971 		status = HAL_MON_TX_MSDU_START;
972 		SHOW_DEFINED(WIFITX_MSDU_START_E);
973 		break;
974 	}
975 	case WIFITX_DATA_E:/* DOWNSTREAM */
976 	{
977 		status = HAL_MON_TX_DATA;
978 		/*
979 		 * TODO: do we need a conversion api to convert
980 		 * user_id from hw to get host user_index
981 		 */
982 		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
983 		TXMON_STATUS_INFO(tx_status_info,
984 				  buffer) = (void *)status_frag;
985 		TXMON_STATUS_INFO(tx_status_info,
986 				  offset) = ((void *)tx_tlv -
987 					     (void *)status_frag);
988 		TXMON_STATUS_INFO(tx_status_info,
989 				  length) = tlv_len;
990 
991 		/*
992 		 * reference of the status buffer will be held in
993 		 * dp_tx_update_ppdu_info_status()
994 		 */
995 		status = HAL_MON_TX_DATA;
996 		SHOW_DEFINED(WIFITX_DATA_E);
997 		break;
998 	}
999 	case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
1000 	{
1001 		packet_info = &ppdu_info->packet_info;
1002 		status = HAL_MON_TX_BUFFER_ADDR;
1003 		/*
1004 		 * TODO: do we need a conversion api to convert
1005 		 * user_id from hw to get host user_index
1006 		 */
1007 		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
1008 
1009 		hal_txmon_populate_packet_info_generic_be(tx_tlv, packet_info);
1010 
1011 		SHOW_DEFINED(WIFIMON_BUFFER_ADDR_E);
1012 		break;
1013 	}
1014 	case WIFITX_MPDU_END_E:/* DOWNSTREAM */
1015 	{
1016 		/* no tlv content */
1017 		SHOW_DEFINED(WIFITX_MPDU_END_E);
1018 		break;
1019 	}
1020 	case WIFITX_MSDU_END_E:/* DOWNSTREAM */
1021 	{
1022 		/* no tlv content */
1023 		SHOW_DEFINED(WIFITX_MSDU_END_E);
1024 		break;
1025 	}
1026 	case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
1027 	{
1028 		/* no tlv content */
1029 		SHOW_DEFINED(WIFITX_LAST_MPDU_FETCHED_E);
1030 		break;
1031 	}
1032 	case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
1033 	{
1034 		/* no tlv content */
1035 		SHOW_DEFINED(WIFITX_LAST_MPDU_END_E);
1036 		break;
1037 	}
1038 	case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
1039 	{
1040 		/*
1041 		 * transmitting power
1042 		 * minimum transmitting power
1043 		 * desired nss
1044 		 * tx chain mask
1045 		 * desired bw
1046 		 * duration of transmit and response
1047 		 *
1048 		 * since most of the field we are deriving from other tlv
1049 		 * we don't need to enable this in our tlv.
1050 		 */
1051 		SHOW_DEFINED(WIFICOEX_TX_REQ_E);
1052 		break;
1053 	}
1054 	case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
1055 	{
1056 		/* user tlv */
1057 		/*
1058 		 * All Tx monitor will have 802.11 hdr
1059 		 * we don't need to enable this TLV
1060 		 */
1061 		SHOW_DEFINED(WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E);
1062 		break;
1063 	}
1064 	case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
1065 	{
1066 		/*
1067 		 * no tlv content
1068 		 *
1069 		 * TLV that indicates to TXPCU that preamble phase for the NDP
1070 		 * frame transmission is now over
1071 		 */
1072 		SHOW_DEFINED(WIFINDP_PREAMBLE_DONE_E);
1073 		break;
1074 	}
1075 	case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
1076 	{
1077 		/*
1078 		 * no tlv content
1079 		 *
1080 		 * TLV indicates to the SCH that all timing critical TLV
1081 		 * has been passed on to the transmit path
1082 		 */
1083 		SHOW_DEFINED(WIFISCH_CRITICAL_TLV_REFERENCE_E);
1084 		break;
1085 	}
1086 	case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
1087 	{
1088 		/*
1089 		 * Loopback specific setup info - not needed for Tx monitor
1090 		 */
1091 		SHOW_DEFINED(WIFITX_LOOPBACK_SETUP_E);
1092 		break;
1093 	}
1094 	case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
1095 	{
1096 		/*
1097 		 * no tlv content
1098 		 *
1099 		 * TLV indicates that other modules besides the scheduler can
1100 		 * now also start generating TLV's
1101 		 * prevent colliding or generating TLV's out of order
1102 		 */
1103 		SHOW_DEFINED(WIFITX_FES_SETUP_COMPLETE_E);
1104 		break;
1105 	}
1106 	case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
1107 	{
1108 		/*
1109 		 * no tlv content
1110 		 *
1111 		 * TLV indicates to SCH that a burst of MPDU info will
1112 		 * start to come in over the TLV
1113 		 */
1114 		SHOW_DEFINED(WIFITQM_MPDU_GLOBAL_START_E);
1115 		break;
1116 	}
1117 	case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
1118 	{
1119 		SHOW_DEFINED(WIFITX_WUR_DATA_E);
1120 		break;
1121 	}
1122 	case WIFISCHEDULER_END_E:/* DOWNSTREAM */
1123 	{
1124 		/*
1125 		 * no tlv content
1126 		 *
1127 		 * TLV indicates END of all TLV's within the scheduler TLV
1128 		 */
1129 		SHOW_DEFINED(WIFISCHEDULER_END_E);
1130 		break;
1131 	}
1132 
1133 	/* Upstream tlv */
1134 	case WIFIPDG_TX_REQ_E:
1135 	{
1136 		SHOW_DEFINED(WIFIPDG_TX_REQ_E);
1137 		break;
1138 	}
1139 	case WIFITX_FES_STATUS_START_E:
1140 	{
1141 		/*
1142 		 * TLV indicating that first transmission on the medium
1143 		 */
1144 		uint8_t medium_prot_type = 0;
1145 
1146 		status = HAL_MON_TX_FES_STATUS_START;
1147 
1148 		medium_prot_type = HAL_TX_DESC_GET_64(tx_tlv,
1149 						      TX_FES_STATUS_START,
1150 						      MEDIUM_PROT_TYPE);
1151 
1152 		ppdu_info = (struct hal_tx_ppdu_info *)prot_ppdu_info;
1153 		/* update what type of medium protection frame */
1154 		TXMON_STATUS_INFO(tx_status_info,
1155 				  medium_prot_type) = medium_prot_type;
1156 		SHOW_DEFINED(WIFITX_FES_STATUS_START_E);
1157 		break;
1158 	}
1159 	case WIFITX_FES_STATUS_PROT_E:
1160 	{
1161 		uint32_t start_timestamp = 0;
1162 		uint32_t end_timestamp = 0;
1163 
1164 		/*
1165 		 * generated by TXPCU to indicate the result of having
1166 		 * received of the expected protection frame
1167 		 */
1168 
1169 		status = HAL_MON_TX_FES_STATUS_PROT;
1170 		start_timestamp =
1171 			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
1172 					   START_OF_FRAME_TIMESTAMP_15_0);
1173 		start_timestamp |=
1174 			(HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
1175 					    START_OF_FRAME_TIMESTAMP_31_16) <<
1176 			 15);
1177 		end_timestamp = HAL_TX_DESC_GET_64(tx_tlv,
1178 						   TX_FES_STATUS_PROT,
1179 						   END_OF_FRAME_TIMESTAMP_15_0);
1180 		end_timestamp |=
1181 			HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
1182 					   END_OF_FRAME_TIMESTAMP_31_16) << 15;
1183 
1184 		/* ppdu timestamp as phy timestamp */
1185 		TXMON_HAL_STATUS(ppdu_info,
1186 				 ppdu_timestamp) = start_timestamp;
1187 
1188 		SHOW_DEFINED(WIFITX_FES_STATUS_PROT_E);
1189 		break;
1190 	}
1191 	case WIFITX_FES_STATUS_START_PROT_E:
1192 	{
1193 		uint64_t tsft_64;
1194 		uint32_t response_type;
1195 		status = HAL_MON_TX_FES_STATUS_START_PROT;
1196 		TXMON_HAL(ppdu_info, prot_tlv_status) = tlv_tag;
1197 		/* timestamp */
1198 		tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
1199 					     TX_FES_STATUS_START_PROT,
1200 					     PROT_TIMESTAMP_LOWER_32);
1201 		tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
1202 					       TX_FES_STATUS_START_PROT,
1203 					       PROT_TIMESTAMP_UPPER_32) << 32);
1204 
1205 		response_type = HAL_TX_DESC_GET_64(tx_tlv,
1206 						   TX_FES_STATUS_START_PROT,
1207 						   RESPONSE_TYPE);
1208 
1209 		TXMON_STATUS_INFO(tx_status_info,
1210 				  response_type) = response_type;
1211 		TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
1212 
1213 		SHOW_DEFINED(WIFITX_FES_STATUS_START_PROT_E);
1214 		break;
1215 	}
1216 	case WIFIPROT_TX_END_E:
1217 	{
1218 		/*
1219 		 * no tlv content
1220 		 *
1221 		 * generated by TXPCU the moment that protection frame
1222 		 * transmission has finished on the medium
1223 		 */
1224 		SHOW_DEFINED(WIFIPROT_TX_END_E);
1225 		break;
1226 	}
1227 	case WIFITX_FES_STATUS_START_PPDU_E:
1228 	{
1229 		uint64_t tsft_64;
1230 		uint8_t ndp_frame;
1231 
1232 		status = HAL_MON_TX_FES_STATUS_START_PPDU;
1233 		tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
1234 					     TX_FES_STATUS_START_PPDU,
1235 					     PPDU_TIMESTAMP_LOWER_32);
1236 		tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
1237 					       TX_FES_STATUS_START_PPDU,
1238 					       PPDU_TIMESTAMP_UPPER_32) << 32);
1239 
1240 		ndp_frame = HAL_TX_DESC_GET_64(tx_tlv,
1241 					       TX_FES_STATUS_START_PPDU,
1242 					       NDP_FRAME);
1243 
1244 		TXMON_STATUS_INFO(tx_status_info, ndp_frame) = ndp_frame;
1245 		TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
1246 
1247 		SHOW_DEFINED(WIFITX_FES_STATUS_START_PPDU_E);
1248 		break;
1249 	}
1250 	case WIFITX_FES_STATUS_USER_PPDU_E:
1251 	{
1252 		/* user tlv */
1253 		uint16_t duration;
1254 		uint8_t transmitted_tid;
1255 
1256 		duration = HAL_TX_DESC_GET_64(tx_tlv,
1257 					      TX_FES_STATUS_USER_PPDU,
1258 					      DURATION);
1259 		transmitted_tid = HAL_TX_DESC_GET_64(tx_tlv,
1260 						     TX_FES_STATUS_USER_PPDU,
1261 						     TRANSMITTED_TID);
1262 
1263 		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
1264 		TXMON_HAL_USER(ppdu_info, user_id, tid) = transmitted_tid;
1265 		TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
1266 
1267 		status = HAL_MON_TX_FES_STATUS_USER_PPDU;
1268 		SHOW_DEFINED(WIFITX_FES_STATUS_USER_PPDU_E);
1269 		break;
1270 	}
1271 	case WIFIPPDU_TX_END_E:
1272 	{
1273 		/*
1274 		 * no tlv content
1275 		 *
1276 		 * generated by TXPCU the moment that PPDU transmission has
1277 		 * finished on the medium
1278 		 */
1279 		SHOW_DEFINED(WIFIPPDU_TX_END_E);
1280 		break;
1281 	}
1282 
1283 	case WIFITX_FES_STATUS_USER_RESPONSE_E:
1284 	{
1285 		/*
1286 		 * TLV contains the FES transmit result of the each
1287 		 * of the MAC users. TLV are forwarded to HWSCH
1288 		 */
1289 		SHOW_DEFINED(WIFITX_FES_STATUS_USER_RESPONSE_E);
1290 		break;
1291 	}
1292 	case WIFITX_FES_STATUS_ACK_OR_BA_E:
1293 	{
1294 		/* user tlv */
1295 		/*
1296 		 * TLV generated by RXPCU and provide information related to
1297 		 * the received BA or ACK frame
1298 		 */
1299 		SHOW_DEFINED(WIFITX_FES_STATUS_ACK_OR_BA_E);
1300 		break;
1301 	}
1302 	case WIFITX_FES_STATUS_1K_BA_E:
1303 	{
1304 		/* user tlv */
1305 		/*
1306 		 * TLV generated by RXPCU and providing information related
1307 		 * to the received BA frame in case of 512/1024 bitmaps
1308 		 */
1309 		SHOW_DEFINED(WIFITX_FES_STATUS_1K_BA_E);
1310 		break;
1311 	}
1312 	case WIFIRECEIVED_RESPONSE_USER_7_0_E:
1313 	{
1314 		SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_7_0_E);
1315 		break;
1316 	}
1317 	case WIFIRECEIVED_RESPONSE_USER_15_8_E:
1318 	{
1319 		SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_15_8_E);
1320 		break;
1321 	}
1322 	case WIFIRECEIVED_RESPONSE_USER_23_16_E:
1323 	{
1324 		SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_23_16_E);
1325 		break;
1326 	}
1327 	case WIFIRECEIVED_RESPONSE_USER_31_24_E:
1328 	{
1329 		SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_31_24_E);
1330 		break;
1331 	}
1332 	case WIFIRECEIVED_RESPONSE_USER_36_32_E:
1333 	{
1334 		/*
1335 		 * RXPCU generates this TLV when it receives a response frame
1336 		 * that TXPCU pre-announced it was waiting for and in
1337 		 * RXPCU_SETUP TLV, TLV generated before the
1338 		 * RECEIVED_RESPONSE_INFO TLV.
1339 		 *
1340 		 * received info user fields are there which is not needed
1341 		 * for TX monitor
1342 		 */
1343 		SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_36_32_E);
1344 		break;
1345 	}
1346 
1347 	case WIFITXPCU_BUFFER_STATUS_E:
1348 	{
1349 		SHOW_DEFINED(WIFITXPCU_BUFFER_STATUS_E);
1350 		break;
1351 	}
1352 	case WIFITXPCU_USER_BUFFER_STATUS_E:
1353 	{
1354 		/*
1355 		 * WIFITXPCU_USER_BUFFER_STATUS_E - user tlv
1356 		 * for TX monitor we aren't interested in this tlv
1357 		 */
1358 		SHOW_DEFINED(WIFITXPCU_USER_BUFFER_STATUS_E);
1359 		break;
1360 	}
1361 	case WIFITXDMA_STOP_REQUEST_E:
1362 	{
1363 		/*
1364 		 * no tlv content
1365 		 *
1366 		 * TLV is destined to TXDMA and informs TXDMA to stop
1367 		 * pushing data into the transmit path.
1368 		 */
1369 		SHOW_DEFINED(WIFITXDMA_STOP_REQUEST_E);
1370 		break;
1371 	}
1372 	case WIFITX_CBF_INFO_E:
1373 	{
1374 		/*
1375 		 * After NDPA + NDP is received, RXPCU sends the TX_CBF_INFO to
1376 		 * TXPCU to respond the CBF frame
1377 		 *
1378 		 * compressed beamforming pkt doesn't has mac header
1379 		 * Tx monitor not interested in this pkt.
1380 		 */
1381 		SHOW_DEFINED(WIFITX_CBF_INFO_E);
1382 		break;
1383 	}
1384 	case WIFITX_MPDU_COUNT_TRANSFER_END_E:
1385 	{
1386 		/*
1387 		 * no tlv content
1388 		 *
1389 		 * TLV indicates that TXPCU has finished generating the
1390 		 * TQM_UPDATE_TX_MPDU_COUNT TLV for all users
1391 		 */
1392 		SHOW_DEFINED(WIFITX_MPDU_COUNT_TRANSFER_END_E);
1393 		break;
1394 	}
1395 	case WIFIPDG_RESPONSE_E:
1396 	{
1397 		/*
1398 		 * most of the feilds are already covered in
1399 		 * other TLV
1400 		 * This is generated by TX_PCU to PDG to calculate
1401 		 * all the PHY header info.
1402 		 *
1403 		 * some useful fields like min transmit power,
1404 		 * rate used for transmitting packet is present.
1405 		 */
1406 		SHOW_DEFINED(WIFIPDG_RESPONSE_E);
1407 		break;
1408 	}
1409 	case WIFIPDG_TRIG_RESPONSE_E:
1410 	{
1411 		/* no tlv content */
1412 		SHOW_DEFINED(WIFIPDG_TRIG_RESPONSE_E);
1413 		break;
1414 	}
1415 	case WIFIRECEIVED_TRIGGER_INFO_E:
1416 	{
1417 		/*
1418 		 * TLV generated by RXPCU to inform the scheduler that
1419 		 * a trigger frame has been received
1420 		 */
1421 		SHOW_DEFINED(WIFIRECEIVED_TRIGGER_INFO_E);
1422 		break;
1423 	}
1424 	case WIFIOFDMA_TRIGGER_DETAILS_E:
1425 	{
1426 		SHOW_DEFINED(WIFIOFDMA_TRIGGER_DETAILS_E);
1427 		break;
1428 	}
1429 	case WIFIRX_FRAME_BITMAP_ACK_E:
1430 	{
1431 		/* user tlv */
1432 		status = HAL_MON_RX_FRAME_BITMAP_ACK;
1433 		SHOW_DEFINED(WIFIRX_FRAME_BITMAP_ACK_E);
1434 		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
1435 		TXMON_STATUS_INFO(tx_status_info, no_bitmap_avail) =
1436 					HAL_TX_DESC_GET_64(tx_tlv,
1437 							   RX_FRAME_BITMAP_ACK,
1438 							   NO_BITMAP_AVAILABLE);
1439 
1440 		TXMON_STATUS_INFO(tx_status_info, explicit_ack) =
1441 					HAL_TX_DESC_GET_64(tx_tlv,
1442 							   RX_FRAME_BITMAP_ACK,
1443 							   EXPLICIT_ACK);
1444 		/*
1445 		 * get mac address, since address is received frame
1446 		 * change the order and store it
1447 		 */
1448 		*(uint32_t *)&tx_status_info->addr2[0] =
1449 					HAL_TX_DESC_GET_64(tx_tlv,
1450 							   RX_FRAME_BITMAP_ACK,
1451 							   ADDR1_31_0);
1452 		*(uint32_t *)&tx_status_info->addr2[4] =
1453 					HAL_TX_DESC_GET_64(tx_tlv,
1454 							   RX_FRAME_BITMAP_ACK,
1455 							   ADDR1_47_32);
1456 		*(uint32_t *)&tx_status_info->addr1[0] =
1457 					HAL_TX_DESC_GET_64(tx_tlv,
1458 							   RX_FRAME_BITMAP_ACK,
1459 							   ADDR2_15_0);
1460 		*(uint32_t *)&tx_status_info->addr1[2] =
1461 					HAL_TX_DESC_GET_64(tx_tlv,
1462 							   RX_FRAME_BITMAP_ACK,
1463 							   ADDR2_47_16);
1464 
1465 		TXMON_STATUS_INFO(tx_status_info, explicit_ack_type) =
1466 				HAL_TX_DESC_GET_64(tx_tlv, RX_FRAME_BITMAP_ACK,
1467 						   EXPLICT_ACK_TYPE);
1468 
1469 		TXMON_HAL_USER(ppdu_info, user_id, tid) =
1470 					HAL_TX_DESC_GET_64(tx_tlv,
1471 							   RX_FRAME_BITMAP_ACK,
1472 							   BA_TID);
1473 		TXMON_HAL_USER(ppdu_info, user_id, aid) =
1474 					HAL_TX_DESC_GET_64(tx_tlv,
1475 							   RX_FRAME_BITMAP_ACK,
1476 							   STA_FULL_AID);
1477 		TXMON_HAL_USER(ppdu_info, user_id, start_seq) =
1478 					HAL_TX_DESC_GET_64(tx_tlv,
1479 							   RX_FRAME_BITMAP_ACK,
1480 							   BA_TS_SEQ);
1481 		TXMON_HAL_USER(ppdu_info, user_id, ba_control) =
1482 					HAL_TX_DESC_GET_64(tx_tlv,
1483 							   RX_FRAME_BITMAP_ACK,
1484 							   BA_TS_CTRL);
1485 		TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap_sz) =
1486 					HAL_TX_DESC_GET_64(tx_tlv,
1487 							   RX_FRAME_BITMAP_ACK,
1488 							   BA_BITMAP_SIZE);
1489 
1490 		/* ba bitmap */
1491 		qdf_mem_copy(TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap),
1492 			     &HAL_SET_FLD_OFFSET_64(tx_tlv,
1493 						    RX_FRAME_BITMAP_ACK,
1494 						    BA_TS_BITMAP_31_0, 0), 32);
1495 
1496 		break;
1497 	}
1498 	case WIFIRX_FRAME_1K_BITMAP_ACK_E:
1499 	{
1500 		/* user tlv */
1501 		status = HAL_MON_RX_FRAME_BITMAP_BLOCK_ACK_1K;
1502 		SHOW_DEFINED(WIFIRX_FRAME_1K_BITMAP_ACK_E);
1503 		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
1504 		TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap_sz) =
1505 			(4 + HAL_TX_DESC_GET_64(tx_tlv, RX_FRAME_1K_BITMAP_ACK,
1506 						BA_BITMAP_SIZE));
1507 		TXMON_HAL_USER(ppdu_info, user_id, tid) =
1508 				HAL_TX_DESC_GET_64(tx_tlv,
1509 						   RX_FRAME_1K_BITMAP_ACK,
1510 						   BA_TID);
1511 		TXMON_HAL_USER(ppdu_info, user_id, aid) =
1512 				HAL_TX_DESC_GET_64(tx_tlv,
1513 						   RX_FRAME_1K_BITMAP_ACK,
1514 						   STA_FULL_AID);
1515 		/* get mac address */
1516 		*(uint32_t *)&tx_status_info->addr1[0] =
1517 				HAL_TX_DESC_GET_64(tx_tlv,
1518 						   RX_FRAME_1K_BITMAP_ACK,
1519 						   ADDR1_31_0);
1520 		*(uint32_t *)&tx_status_info->addr1[4] =
1521 				HAL_TX_DESC_GET_64(tx_tlv,
1522 						   RX_FRAME_1K_BITMAP_ACK,
1523 						   ADDR1_47_32);
1524 		*(uint32_t *)&tx_status_info->addr2[0] =
1525 				HAL_TX_DESC_GET_64(tx_tlv,
1526 						   RX_FRAME_1K_BITMAP_ACK,
1527 						   ADDR2_15_0);
1528 		*(uint32_t *)&tx_status_info->addr2[2] =
1529 				HAL_TX_DESC_GET_64(tx_tlv,
1530 						   RX_FRAME_1K_BITMAP_ACK,
1531 						   ADDR2_47_16);
1532 
1533 		TXMON_HAL_USER(ppdu_info, user_id, start_seq) =
1534 				HAL_TX_DESC_GET_64(tx_tlv,
1535 						   RX_FRAME_1K_BITMAP_ACK,
1536 						   BA_TS_SEQ);
1537 		TXMON_HAL_USER(ppdu_info, user_id, ba_control) =
1538 				HAL_TX_DESC_GET_64(tx_tlv,
1539 						   RX_FRAME_1K_BITMAP_ACK,
1540 						   BA_TS_CTRL);
1541 		/* memcpy  ba bitmap */
1542 		qdf_mem_copy(TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap),
1543 			     &HAL_SET_FLD_OFFSET_64(tx_tlv,
1544 						    RX_FRAME_1K_BITMAP_ACK,
1545 						    BA_TS_BITMAP_31_0, 0),
1546 			     4 << TXMON_HAL_USER(ppdu_info,
1547 						 user_id, ba_bitmap_sz));
1548 
1549 		break;
1550 	}
1551 	case WIFIRESPONSE_START_STATUS_E:
1552 	{
1553 		/*
1554 		 * TLV indicates which HW response the TXPCU
1555 		 * started generating
1556 		 *
1557 		 * HW generated frames like
1558 		 * ACK frame - handled
1559 		 * CTS frame - handled
1560 		 * BA frame - handled
1561 		 * MBA frame - handled
1562 		 * CBF frame - no frame header
1563 		 * Trigger response - TODO
1564 		 * NDP LMR - no frame header
1565 		 */
1566 		SHOW_DEFINED(WIFIRESPONSE_START_STATUS_E);
1567 		break;
1568 	}
1569 	case WIFIRX_START_PARAM_E:
1570 	{
1571 		/*
1572 		 * RXPCU send this TLV after PHY RX detected a frame
1573 		 * in the medium
1574 		 *
1575 		 * TX monitor not interested in this TLV
1576 		 */
1577 		SHOW_DEFINED(WIFIRX_START_PARAM_E);
1578 		break;
1579 	}
1580 	case WIFIRXPCU_EARLY_RX_INDICATION_E:
1581 	{
1582 		/*
1583 		 * early indication of pkt type and mcs rate
1584 		 * already captured in other tlv
1585 		 */
1586 		SHOW_DEFINED(WIFIRXPCU_EARLY_RX_INDICATION_E);
1587 		break;
1588 	}
1589 	case WIFIRX_PM_INFO_E:
1590 	{
1591 		SHOW_DEFINED(WIFIRX_PM_INFO_E);
1592 		break;
1593 	}
1594 
1595 	/* Active window */
1596 	case WIFITX_FLUSH_REQ_E:
1597 	{
1598 		SHOW_DEFINED(WIFITX_FLUSH_REQ_E);
1599 		break;
1600 	}
1601 	case WIFICOEX_TX_STATUS_E:
1602 	{
1603 		/* duration are retrieved from coex tx status */
1604 		uint16_t duration;
1605 		uint8_t status_reason;
1606 
1607 		status = HAL_MON_COEX_TX_STATUS;
1608 		duration = HAL_TX_DESC_GET_64(tx_tlv,
1609 					      COEX_TX_STATUS,
1610 					      CURRENT_TX_DURATION);
1611 		status_reason = HAL_TX_DESC_GET_64(tx_tlv,
1612 						   COEX_TX_STATUS,
1613 						   TX_STATUS_REASON);
1614 
1615 		/* update duration */
1616 		if (status_reason == COEX_FES_TX_START ||
1617 		    status_reason == COEX_RESPONSE_TX_START)
1618 			TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
1619 
1620 		SHOW_DEFINED(WIFICOEX_TX_STATUS_E);
1621 		break;
1622 	}
1623 	case WIFIR2R_STATUS_END_E:
1624 	{
1625 		SHOW_DEFINED(WIFIR2R_STATUS_END_E);
1626 		break;
1627 	}
1628 	case WIFIRX_PREAMBLE_E:
1629 	{
1630 		SHOW_DEFINED(WIFIRX_PREAMBLE_E);
1631 		break;
1632 	}
1633 	case WIFIMACTX_SERVICE_E:
1634 	{
1635 		SHOW_DEFINED(WIFIMACTX_SERVICE_E);
1636 		break;
1637 	}
1638 
1639 	case WIFIMACTX_U_SIG_EHT_SU_MU_E:
1640 	{
1641 		SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_SU_MU_E);
1642 		break;
1643 	}
1644 	case WIFIMACTX_U_SIG_EHT_TB_E:
1645 	{
1646 		/* TODO: no radiotap info available */
1647 		SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_TB_E);
1648 		break;
1649 	}
1650 	case WIFIMACTX_EHT_SIG_USR_OFDMA_E:
1651 	{
1652 		SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_OFDMA_E);
1653 		break;
1654 	}
1655 	case WIFIMACTX_EHT_SIG_USR_MU_MIMO_E:
1656 	{
1657 		SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_MU_MIMO_E);
1658 		break;
1659 	}
1660 	case WIFIMACTX_EHT_SIG_USR_SU_E:
1661 	{
1662 		SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_SU_E);
1663 		/* TODO: no radiotap info available */
1664 		break;
1665 	}
1666 
1667 	case WIFIMACTX_HE_SIG_A_SU_E:
1668 	{
1669 		uint8_t mcs_of_sig_b = 0;
1670 		uint8_t dcm_of_sig_b = 0;
1671 		uint8_t sig_a_bw = 0;
1672 		uint16_t he_mu_flag_1 = 0;
1673 		uint16_t he_mu_flag_2 = 0;
1674 
1675 		status = HAL_MON_MACTX_HE_SIG_A_SU;
1676 
1677 		mcs_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
1678 						  MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
1679 						  TRANSMIT_MCS);
1680 		dcm_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
1681 						  MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
1682 						  DCM);
1683 		sig_a_bw = HAL_TX_DESC_GET_64(tx_tlv,
1684 					      MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
1685 					      TRANSMIT_BW);
1686 
1687 		he_mu_flag_1 |= QDF_MON_STATUS_SIG_B_MCS_KNOWN |
1688 				QDF_MON_STATUS_SIG_B_DCM_KNOWN |
1689 				QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN |
1690 				QDF_MON_STATUS_CHANNEL_1_RU_KNOWN |
1691 				QDF_MON_STATUS_CHANNEL_2_RU_KNOWN |
1692 				QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN;
1693 
1694 		/* MCS */
1695 		he_mu_flag_1 |= mcs_of_sig_b <<
1696 				QDF_MON_STATUS_SIG_B_MCS_SHIFT;
1697 		/* DCM */
1698 		he_mu_flag_1 |= dcm_of_sig_b <<
1699 				QDF_MON_STATUS_SIG_B_DCM_SHIFT;
1700 		/* bandwidth */
1701 		he_mu_flag_2 |= QDF_MON_STATUS_SIG_A_BANDWIDTH_KNOWN;
1702 		he_mu_flag_2 |= sig_a_bw <<
1703 				QDF_MON_STATUS_SIG_A_BANDWIDTH_SHIFT;
1704 
1705 		TXMON_HAL_STATUS(ppdu_info, he_flags1) = he_mu_flag_1;
1706 		TXMON_HAL_STATUS(ppdu_info, he_flags2) = he_mu_flag_2;
1707 
1708 		SHOW_DEFINED(WIFIMACTX_HE_SIG_A_SU_E);
1709 		break;
1710 	}
1711 	case WIFIMACTX_HE_SIG_A_MU_DL_E:
1712 	{
1713 		uint8_t mcs_of_sig_b = 0;
1714 		uint8_t dcm_of_sig_b = 0;
1715 		uint8_t sig_a_bw = 0;
1716 		uint8_t num_sig_b_symb = 0;
1717 		uint8_t comp_mode_sig_b = 0;
1718 		uint8_t punc_bw = 0;
1719 		uint16_t he_mu_flag_1 = 0;
1720 		uint16_t he_mu_flag_2 = 0;
1721 
1722 		status = HAL_MON_MACTX_HE_SIG_A_MU_DL;
1723 		mcs_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
1724 						  MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
1725 						  MCS_OF_SIG_B);
1726 		dcm_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
1727 						  MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
1728 						  DCM_OF_SIG_B);
1729 		sig_a_bw = HAL_TX_DESC_GET_64(tx_tlv,
1730 					      MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
1731 					      TRANSMIT_BW);
1732 		num_sig_b_symb = HAL_TX_DESC_GET_64(tx_tlv,
1733 						    MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
1734 						    NUM_SIG_B_SYMBOLS);
1735 		comp_mode_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
1736 						     MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
1737 						     COMP_MODE_SIG_B);
1738 
1739 		he_mu_flag_1 |= QDF_MON_STATUS_SIG_B_MCS_KNOWN |
1740 				QDF_MON_STATUS_SIG_B_DCM_KNOWN |
1741 				QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN |
1742 				QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN |
1743 				QDF_MON_STATUS_CHANNEL_1_RU_KNOWN |
1744 				QDF_MON_STATUS_CHANNEL_2_RU_KNOWN |
1745 				QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN |
1746 				QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN |
1747 				QDF_MON_STATUS_SIG_B_SYMBOL_USER_KNOWN;
1748 
1749 		/* MCS */
1750 		he_mu_flag_1 |= mcs_of_sig_b <<
1751 				QDF_MON_STATUS_SIG_B_MCS_SHIFT;
1752 		/* DCM */
1753 		he_mu_flag_1 |= dcm_of_sig_b <<
1754 				QDF_MON_STATUS_SIG_B_DCM_SHIFT;
1755 		/* Compression */
1756 		he_mu_flag_2 |= comp_mode_sig_b <<
1757 				QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT;
1758 		/* bandwidth */
1759 		he_mu_flag_2 |= QDF_MON_STATUS_SIG_A_BANDWIDTH_KNOWN;
1760 		he_mu_flag_2 |= sig_a_bw <<
1761 				QDF_MON_STATUS_SIG_A_BANDWIDTH_SHIFT;
1762 		he_mu_flag_2 |= comp_mode_sig_b <<
1763 				QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT;
1764 		/* number of symbol */
1765 		he_mu_flag_2 |= num_sig_b_symb <<
1766 				QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT;
1767 		/* puncture bw */
1768 		he_mu_flag_2 |= QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_KNOWN;
1769 		punc_bw = sig_a_bw;
1770 		he_mu_flag_2 |=
1771 			punc_bw << QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_SHIFT;
1772 
1773 		/* copy per user info to all user */
1774 		TXMON_HAL_STATUS(ppdu_info, he_mu_flags) = 1;
1775 		TXMON_HAL_STATUS(ppdu_info, he_flags1) = he_mu_flag_1;
1776 		TXMON_HAL_STATUS(ppdu_info, he_flags2) = he_mu_flag_2;
1777 
1778 		SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_DL_E);
1779 		break;
1780 	}
1781 	case WIFIMACTX_HE_SIG_A_MU_UL_E:
1782 	{
1783 		SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_UL_E);
1784 		break;
1785 	}
1786 	case WIFIMACTX_HE_SIG_B1_MU_E:
1787 	{
1788 		status = HAL_MON_MACTX_HE_SIG_B1_MU;
1789 		SHOW_DEFINED(WIFIMACTX_HE_SIG_B1_MU_E);
1790 		break;
1791 	}
1792 	case WIFIMACTX_HE_SIG_B2_MU_E:
1793 	{
1794 		/* user tlv */
1795 		uint16_t sta_id = 0;
1796 		uint16_t sta_spatial_config = 0;
1797 		uint8_t sta_mcs = 0;
1798 		uint8_t coding = 0;
1799 		uint8_t nss = 0;
1800 		uint8_t user_order = 0;
1801 
1802 		status = HAL_MON_MACTX_HE_SIG_B2_MU;
1803 
1804 		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
1805 
1806 		sta_id = HAL_TX_DESC_GET_64(tx_tlv,
1807 					    MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
1808 					    STA_ID);
1809 		sta_spatial_config = HAL_TX_DESC_GET_64(tx_tlv,
1810 							MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
1811 							STA_SPATIAL_CONFIG);
1812 		sta_mcs = HAL_TX_DESC_GET_64(tx_tlv,
1813 					     MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
1814 					     STA_MCS);
1815 		coding = HAL_TX_DESC_GET_64(tx_tlv,
1816 					    MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
1817 					    STA_CODING);
1818 		nss = HAL_TX_DESC_GET_64(tx_tlv,
1819 					 MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
1820 					 NSTS);
1821 		user_order = HAL_TX_DESC_GET_64(tx_tlv,
1822 						MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
1823 						USER_ORDER);
1824 
1825 		/* HE data 1 */
1826 		TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
1827 				QDF_MON_STATUS_HE_MCS_KNOWN |
1828 				QDF_MON_STATUS_HE_CODING_KNOWN;
1829 		/* HE data 2 */
1830 
1831 		/* HE data 3 */
1832 		TXMON_HAL_USER(ppdu_info, user_id, mcs) = sta_mcs;
1833 		TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
1834 				sta_mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
1835 		TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
1836 				coding << QDF_MON_STATUS_CODING_SHIFT;
1837 
1838 		/* HE data 4 */
1839 		TXMON_HAL_USER(ppdu_info, user_id, he_data4) |=
1840 				sta_id << QDF_MON_STATUS_STA_ID_SHIFT;
1841 
1842 		/* HE data 5 */
1843 
1844 		/* HE data 6 */
1845 		TXMON_HAL_USER(ppdu_info, user_id, nss) = nss;
1846 		TXMON_HAL_USER(ppdu_info, user_id, he_data6) |= nss;
1847 
1848 		SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_MU_E);
1849 		break;
1850 	}
1851 	case WIFIMACTX_HE_SIG_B2_OFDMA_E:
1852 	{
1853 		/* user tlv */
1854 		uint8_t *he_sig_b2_ofdma_info = NULL;
1855 		uint16_t sta_id = 0;
1856 		uint8_t nss = 0;
1857 		uint8_t txbf = 0;
1858 		uint8_t sta_mcs = 0;
1859 		uint8_t sta_dcm = 0;
1860 		uint8_t coding = 0;
1861 		uint8_t user_order = 0;
1862 
1863 		status = HAL_MON_MACTX_HE_SIG_B2_OFDMA;
1864 
1865 		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
1866 
1867 		he_sig_b2_ofdma_info = (uint8_t *)tx_tlv +
1868 			HAL_OFFSET(MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
1869 				   STA_ID);
1870 
1871 		sta_id = HAL_TX_DESC_GET_64(tx_tlv,
1872 					    MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
1873 					    STA_ID);
1874 		nss = HAL_TX_DESC_GET_64(tx_tlv,
1875 					 MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
1876 					 NSTS);
1877 		txbf = HAL_TX_DESC_GET_64(tx_tlv,
1878 					  MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
1879 					  TXBF);
1880 		sta_mcs = HAL_TX_DESC_GET_64(tx_tlv,
1881 					     MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
1882 					     STA_MCS);
1883 		sta_dcm = HAL_TX_DESC_GET_64(tx_tlv,
1884 					     MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
1885 					     STA_DCM);
1886 		coding = HAL_TX_DESC_GET_64(tx_tlv,
1887 					    MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
1888 					    STA_CODING);
1889 		user_order = HAL_TX_DESC_GET_64(tx_tlv,
1890 						MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
1891 						USER_ORDER);
1892 
1893 		/* HE data 1 */
1894 		TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
1895 				QDF_MON_STATUS_HE_MCS_KNOWN |
1896 				QDF_MON_STATUS_HE_CODING_KNOWN |
1897 				QDF_MON_STATUS_HE_DCM_KNOWN;
1898 		/* HE data 2 */
1899 		TXMON_HAL_USER(ppdu_info, user_id, he_data2) |=
1900 				QDF_MON_STATUS_TXBF_KNOWN;
1901 
1902 		/* HE data 3 */
1903 		TXMON_HAL_USER(ppdu_info, user_id, mcs) = sta_mcs;
1904 		TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
1905 				sta_mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
1906 		TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
1907 				sta_dcm << QDF_MON_STATUS_DCM_SHIFT;
1908 		TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
1909 				coding << QDF_MON_STATUS_CODING_SHIFT;
1910 
1911 		/* HE data 4 */
1912 		TXMON_HAL_USER(ppdu_info, user_id, he_data4) |=
1913 				sta_id << QDF_MON_STATUS_STA_ID_SHIFT;
1914 
1915 		/* HE data 5 */
1916 		TXMON_HAL_USER(ppdu_info, user_id, he_data5) |=
1917 				txbf << QDF_MON_STATUS_TXBF_SHIFT;
1918 
1919 		/* HE data 6 */
1920 		TXMON_HAL_USER(ppdu_info, user_id, nss) = nss;
1921 		TXMON_HAL_USER(ppdu_info, user_id, he_data6) |= nss;
1922 
1923 		SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_OFDMA_E);
1924 		break;
1925 	}
1926 	case WIFIMACTX_L_SIG_A_E:
1927 	{
1928 		uint8_t *l_sig_a_info = NULL;
1929 		uint8_t rate = 0;
1930 
1931 		status = HAL_MON_MACTX_L_SIG_A;
1932 
1933 		l_sig_a_info = (uint8_t *)tx_tlv +
1934 			HAL_OFFSET(MACTX_L_SIG_A_MACTX_L_SIG_A_INFO_DETAILS,
1935 				   RATE);
1936 		rate = HAL_TX_DESC_GET_64(tx_tlv,
1937 					  MACTX_L_SIG_A_MACTX_L_SIG_A_INFO_DETAILS,
1938 					  RATE);
1939 
1940 		switch (rate) {
1941 		case 8:
1942 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_0MCS;
1943 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS0;
1944 			break;
1945 		case 9:
1946 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_1MCS;
1947 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS1;
1948 			break;
1949 		case 10:
1950 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_2MCS;
1951 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS2;
1952 			break;
1953 		case 11:
1954 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_3MCS;
1955 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS3;
1956 			break;
1957 		case 12:
1958 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_4MCS;
1959 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS4;
1960 			break;
1961 		case 13:
1962 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_5MCS;
1963 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS5;
1964 			break;
1965 		case 14:
1966 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_6MCS;
1967 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS6;
1968 			break;
1969 		case 15:
1970 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_7MCS;
1971 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS7;
1972 			break;
1973 		default:
1974 			break;
1975 		}
1976 
1977 		TXMON_HAL_STATUS(ppdu_info, ofdm_flag) = 1;
1978 		TXMON_HAL_STATUS(ppdu_info, reception_type) = HAL_RX_TYPE_SU;
1979 		TXMON_HAL_STATUS(ppdu_info, l_sig_a_info) = *l_sig_a_info;
1980 
1981 		SHOW_DEFINED(WIFIMACTX_L_SIG_A_E);
1982 		break;
1983 	}
1984 	case WIFIMACTX_L_SIG_B_E:
1985 	{
1986 		uint8_t *l_sig_b_info = NULL;
1987 		uint8_t rate = 0;
1988 
1989 		status = HAL_MON_MACTX_L_SIG_B;
1990 
1991 		l_sig_b_info = (uint8_t *)tx_tlv +
1992 			HAL_OFFSET(MACTX_L_SIG_B_MACTX_L_SIG_B_INFO_DETAILS,
1993 				   RATE);
1994 		rate = HAL_TX_DESC_GET_64(tx_tlv,
1995 					  MACTX_L_SIG_B_MACTX_L_SIG_B_INFO_DETAILS,
1996 					  RATE);
1997 
1998 		switch (rate) {
1999 		case 1:
2000 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_3MCS;
2001 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS3;
2002 			break;
2003 		case 2:
2004 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_2MCS;
2005 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS2;
2006 			break;
2007 		case 3:
2008 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_1MCS;
2009 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS1;
2010 			break;
2011 		case 4:
2012 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_0MCS;
2013 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS0;
2014 			break;
2015 		case 5:
2016 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_6MCS;
2017 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS6;
2018 			break;
2019 		case 6:
2020 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_5MCS;
2021 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS5;
2022 			break;
2023 		case 7:
2024 			TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_4MCS;
2025 			TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS4;
2026 			break;
2027 		default:
2028 			break;
2029 		}
2030 
2031 		TXMON_HAL_STATUS(ppdu_info, cck_flag) = 1;
2032 		TXMON_HAL_STATUS(ppdu_info, reception_type) = HAL_RX_TYPE_SU;
2033 		TXMON_HAL_STATUS(ppdu_info, l_sig_b_info) = *l_sig_b_info;
2034 
2035 		SHOW_DEFINED(WIFIMACTX_L_SIG_B_E);
2036 		break;
2037 	}
2038 	case WIFIMACTX_HT_SIG_E:
2039 	{
2040 		uint8_t mcs = 0;
2041 		uint8_t bw = 0;
2042 		uint8_t is_stbc = 0;
2043 		uint8_t coding = 0;
2044 		uint8_t gi = 0;
2045 
2046 		status = HAL_MON_MACTX_HT_SIG;
2047 		mcs = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, MCS);
2048 		bw = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, CBW);
2049 		is_stbc = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, STBC);
2050 		coding = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, FEC_CODING);
2051 		gi = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, SHORT_GI);
2052 
2053 		TXMON_HAL_STATUS(ppdu_info, ldpc) =
2054 				(coding == HAL_SU_MU_CODING_LDPC) ? 1 : 0;
2055 		TXMON_HAL_STATUS(ppdu_info, ht_mcs) = mcs;
2056 		TXMON_HAL_STATUS(ppdu_info, bw) = bw;
2057 		TXMON_HAL_STATUS(ppdu_info, sgi) = gi;
2058 		TXMON_HAL_STATUS(ppdu_info, is_stbc) = is_stbc;
2059 		TXMON_HAL_STATUS(ppdu_info, reception_type) = HAL_RX_TYPE_SU;
2060 
2061 		SHOW_DEFINED(WIFIMACTX_HT_SIG_E);
2062 		break;
2063 	}
2064 	case WIFIMACTX_VHT_SIG_A_E:
2065 	{
2066 		uint8_t bandwidth = 0;
2067 		uint8_t is_stbc = 0;
2068 		uint8_t group_id = 0;
2069 		uint32_t nss_comb = 0;
2070 		uint8_t nss_su = 0;
2071 		uint8_t nss_mu[4] = {0};
2072 		uint8_t sgi = 0;
2073 		uint8_t coding = 0;
2074 		uint8_t mcs = 0;
2075 		uint8_t beamformed = 0;
2076 		uint8_t partial_aid = 0;
2077 
2078 		status = HAL_MON_MACTX_VHT_SIG_A;
2079 		bandwidth = HAL_TX_DESC_GET_64(tx_tlv,
2080 					       MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
2081 					       BANDWIDTH);
2082 		is_stbc = HAL_TX_DESC_GET_64(tx_tlv,
2083 					     MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
2084 					     STBC);
2085 		group_id = HAL_TX_DESC_GET_64(tx_tlv,
2086 					      MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
2087 					      GROUP_ID);
2088 		/* nss_comb is su nss, MU nss and partial AID */
2089 		nss_comb = HAL_TX_DESC_GET_64(tx_tlv,
2090 					      MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
2091 					      N_STS);
2092 		/* if it is SU */
2093 		nss_su = (nss_comb & 0x7) + 1;
2094 		/* partial aid - applicable only for SU */
2095 		partial_aid = (nss_comb >> 3) & 0x1F;
2096 		/* if it is MU */
2097 		nss_mu[0] = (nss_comb & 0x7) + 1;
2098 		nss_mu[1] = ((nss_comb >> 3) & 0x7) + 1;
2099 		nss_mu[2] = ((nss_comb >> 6) & 0x7) + 1;
2100 		nss_mu[3] = ((nss_comb >> 9) & 0x7) + 1;
2101 
2102 		sgi = HAL_TX_DESC_GET_64(tx_tlv,
2103 					 MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
2104 					 GI_SETTING);
2105 		coding = HAL_TX_DESC_GET_64(tx_tlv,
2106 					    MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
2107 					    SU_MU_CODING);
2108 		mcs = HAL_TX_DESC_GET_64(tx_tlv,
2109 					 MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
2110 					 MCS);
2111 		beamformed = HAL_TX_DESC_GET_64(tx_tlv,
2112 						MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
2113 						BEAMFORMED);
2114 
2115 		TXMON_HAL_STATUS(ppdu_info, ldpc) =
2116 			(coding == HAL_SU_MU_CODING_LDPC) ? 1 : 0;
2117 		TXMON_STATUS_INFO(tx_status_info, sw_frame_group_id) = group_id;
2118 
2119 		TXMON_HAL_STATUS(ppdu_info, sgi) = sgi;
2120 		TXMON_HAL_STATUS(ppdu_info, is_stbc) = is_stbc;
2121 		TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
2122 		TXMON_HAL_STATUS(ppdu_info, beamformed) = beamformed;
2123 
2124 		if (group_id == 0 || group_id == 63) {
2125 			TXMON_HAL_STATUS(ppdu_info, reception_type) =
2126 						HAL_RX_TYPE_SU;
2127 			TXMON_HAL_STATUS(ppdu_info, mcs) = mcs;
2128 			TXMON_HAL_STATUS(ppdu_info, nss) =
2129 						nss_su & VHT_SIG_SU_NSS_MASK;
2130 
2131 			TXMON_HAL_USER(ppdu_info, user_id,
2132 				       vht_flag_values3[0]) = ((mcs << 4) |
2133 							       nss_su);
2134 		} else {
2135 			TXMON_HAL_STATUS(ppdu_info, reception_type) =
2136 						HAL_RX_TYPE_MU_MIMO;
2137 			TXMON_HAL_USER(ppdu_info, user_id, mcs) = mcs;
2138 			TXMON_HAL_USER(ppdu_info, user_id, nss) =
2139 						nss_su & VHT_SIG_SU_NSS_MASK;
2140 
2141 			TXMON_HAL_USER(ppdu_info, user_id,
2142 				       vht_flag_values3[0]) = ((mcs << 4) |
2143 							       nss_su);
2144 			TXMON_HAL_USER(ppdu_info, user_id,
2145 				       vht_flag_values3[1]) = ((mcs << 4) |
2146 							       nss_mu[1]);
2147 			TXMON_HAL_USER(ppdu_info, user_id,
2148 				       vht_flag_values3[2]) = ((mcs << 4) |
2149 							       nss_mu[2]);
2150 			TXMON_HAL_USER(ppdu_info, user_id,
2151 				       vht_flag_values3[3]) = ((mcs << 4) |
2152 							       nss_mu[3]);
2153 		}
2154 
2155 		/* TODO: loop over multiple user */
2156 		TXMON_HAL_USER(ppdu_info, user_id,
2157 			       vht_flag_values2) = bandwidth;
2158 		TXMON_HAL_USER(ppdu_info, user_id,
2159 			       vht_flag_values4) = coding;
2160 		TXMON_HAL_USER(ppdu_info, user_id,
2161 			       vht_flag_values5) = group_id;
2162 		TXMON_HAL_USER(ppdu_info, user_id,
2163 			       vht_flag_values6) = partial_aid;
2164 		SHOW_DEFINED(WIFIMACTX_VHT_SIG_A_E);
2165 		break;
2166 	}
2167 	case WIFIMACTX_VHT_SIG_B_MU160_E:
2168 	{
2169 		SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU160_E);
2170 		break;
2171 	}
2172 	case WIFIMACTX_VHT_SIG_B_MU80_E:
2173 	{
2174 		SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU80_E);
2175 		break;
2176 	}
2177 	case WIFIMACTX_VHT_SIG_B_MU40_E:
2178 	{
2179 		SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU40_E);
2180 		break;
2181 	}
2182 	case WIFIMACTX_VHT_SIG_B_MU20_E:
2183 	{
2184 		SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU20_E);
2185 		break;
2186 	}
2187 	case WIFIMACTX_VHT_SIG_B_SU160_E:
2188 	{
2189 		SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU160_E);
2190 		break;
2191 	}
2192 	case WIFIMACTX_VHT_SIG_B_SU80_E:
2193 	{
2194 		SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU80_E);
2195 		break;
2196 	}
2197 	case WIFIMACTX_VHT_SIG_B_SU40_E:
2198 	{
2199 		SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU40_E);
2200 		break;
2201 	}
2202 	case WIFIMACTX_VHT_SIG_B_SU20_E:
2203 	{
2204 		SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU20_E);
2205 		break;
2206 	}
2207 	case WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E:
2208 	{
2209 		SHOW_DEFINED(WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E);
2210 		break;
2211 	}
2212 	case WIFIMACTX_USER_DESC_PER_USER_E:
2213 	{
2214 		uint32_t psdu_length = 0;
2215 		uint8_t ru_start_index = 0;
2216 		uint8_t ru_size = 0;
2217 		uint8_t nss = 0;
2218 		uint8_t mcs = 0;
2219 		uint8_t dcm = 0;
2220 		uint8_t fec_type = 0;
2221 		uint8_t is_ldpc_extra_symb = 0;
2222 		uint32_t he_data1 = 0;
2223 		uint32_t he_data2 = 0;
2224 		uint32_t he_data3 = 0;
2225 		uint32_t he_data4 = 0;
2226 		uint32_t he_data5 = 0;
2227 		uint32_t he_data6 = 0;
2228 
2229 		status = HAL_MON_MACTX_USER_DESC_PER_USER;
2230 
2231 		TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
2232 
2233 		psdu_length = HAL_TX_DESC_GET_64(tx_tlv,
2234 						 MACTX_USER_DESC_PER_USER,
2235 						 PSDU_LENGTH);
2236 		ru_start_index = HAL_TX_DESC_GET_64(tx_tlv,
2237 						    MACTX_USER_DESC_PER_USER,
2238 						    RU_START_INDEX);
2239 		ru_size = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
2240 					     RU_SIZE);
2241 		nss = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER, NSS);
2242 		mcs = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER, MCS);
2243 		dcm = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER, DCM);
2244 		fec_type = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
2245 					      FEC_TYPE);
2246 		is_ldpc_extra_symb =
2247 			HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
2248 					   LDPC_EXTRA_SYMBOL);
2249 
2250 		if (!TXMON_HAL_STATUS(ppdu_info, he_flags))
2251 			break;
2252 
2253 		/* update */
2254 		/* MCS */
2255 		he_data1 |= QDF_MON_STATUS_HE_MCS_KNOWN;
2256 		he_data3 |= (mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT);
2257 		/* DCM */
2258 		he_data1 |= QDF_MON_STATUS_HE_DCM_KNOWN;
2259 		he_data3 |= (dcm << QDF_MON_STATUS_DCM_SHIFT);
2260 		/* LDPC EXTRA SYMB */
2261 		he_data1 |= QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN;
2262 		he_data3 |= (is_ldpc_extra_symb <<
2263 			     QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT);
2264 		/* RU offset and RU */
2265 		he_data1 |= QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN;
2266 		he_data2 |= QDF_MON_STATUS_RU_ALLOCATION_OFFSET_KNOWN;
2267 		he_data2 |= (ru_start_index <<
2268 			     QDF_MON_STATUS_RU_ALLOCATION_SHIFT);
2269 
2270 		/* Data BW and RU allocation */
2271 		he_data1 |= QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN;
2272 		he_data5 |= ru_size << 2;
2273 
2274 		TXMON_HAL_USER(ppdu_info, user_id, mcs) = mcs;
2275 
2276 		/* update stack variable to ppdu_info */
2277 		TXMON_HAL_USER(ppdu_info, user_id, he_data1) |= he_data1;
2278 		TXMON_HAL_USER(ppdu_info, user_id, he_data2) |= he_data2;
2279 		TXMON_HAL_USER(ppdu_info, user_id, he_data3) |= he_data3;
2280 		TXMON_HAL_USER(ppdu_info, user_id, he_data4) |= he_data4;
2281 		TXMON_HAL_USER(ppdu_info, user_id, he_data5) |= he_data5;
2282 		TXMON_HAL_USER(ppdu_info, user_id, he_data6) |= he_data6;
2283 
2284 		SHOW_DEFINED(WIFIMACTX_USER_DESC_PER_USER_E);
2285 		break;
2286 	}
2287 	case WIFIMACTX_USER_DESC_COMMON_E:
2288 	{
2289 		SHOW_DEFINED(WIFIMACTX_USER_DESC_COMMON_E);
2290 		break;
2291 	}
2292 	case WIFIMACTX_PHY_DESC_E:
2293 	{
2294 		uint32_t bf_type = 0;
2295 		/* pkt_type - preamble type */
2296 		uint32_t pkt_type = 0;
2297 		uint8_t bandwidth = 0;
2298 		uint8_t mcs = 0;
2299 		uint8_t is_stbc = 0;
2300 		uint8_t nss = 0;
2301 		uint8_t is_triggered = 0;
2302 		uint8_t gi = 0;
2303 		uint8_t he_ppdu_subtype = 0;
2304 		uint32_t ltf_size = 0;
2305 		uint32_t ru_start = 0;
2306 		uint32_t he_data1 = 0;
2307 		uint32_t he_data2 = 0;
2308 		uint32_t he_data3 = 0;
2309 		uint32_t he_data4 = 0;
2310 		uint32_t he_data5 = 0;
2311 		uint32_t he_data6 = 0;
2312 		uint16_t he_mu_flag_1 = 0;
2313 		uint16_t he_mu_flag_2 = 0;
2314 		uint8_t i = 0;
2315 
2316 		status = HAL_MON_MACTX_PHY_DESC;
2317 
2318 		bf_type = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, BF_TYPE);
2319 		pkt_type = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, PKT_TYPE);
2320 
2321 		mcs = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, MCS);
2322 		is_stbc = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, STBC);
2323 		is_triggered = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
2324 						  TRIGGERED);
2325 		if (!is_triggered) {
2326 			nss = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
2327 						 HEAVY_CLIP_NSS);
2328 			bandwidth = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
2329 						       BANDWIDTH);
2330 		} else {
2331 			nss = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, NSS);
2332 			/*
2333 			 * is_triggered, bw is minimum of AP pkt bw
2334 			 * or STA bw
2335 			 */
2336 			bandwidth = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
2337 						       AP_PKT_BW);
2338 			if (pkt_type == TXMON_PKT_TYPE_11AX ||
2339 			    pkt_type == TXMON_PKT_TYPE_11BE)
2340 				ru_start =
2341 					HAL_TX_DESC_GET_64(tx_tlv,
2342 							   MACTX_PHY_DESC,
2343 							   RU_SIZE_UPDATED_V2);
2344 		}
2345 
2346 		gi = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
2347 					CP_SETTING);
2348 		ltf_size = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, LTF_SIZE);
2349 		he_ppdu_subtype = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
2350 						     HE_PPDU_SUBTYPE);
2351 
2352 		TXMON_HAL_STATUS(ppdu_info, beamformed) = bf_type;
2353 		TXMON_HAL_STATUS(ppdu_info, preamble_type) = pkt_type;
2354 		TXMON_HAL_STATUS(ppdu_info, mcs) = mcs;
2355 		TXMON_HAL_STATUS(ppdu_info, ltf_size) = ltf_size;
2356 		TXMON_HAL_STATUS(ppdu_info, nss) = nss;
2357 		TXMON_HAL_STATUS(ppdu_info, is_stbc) = is_stbc;
2358 		TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
2359 
2360 		switch (ppdu_info->rx_status.preamble_type) {
2361 		case TXMON_PKT_TYPE_11N_MM:
2362 			TXMON_HAL_STATUS(ppdu_info, ht_flags) = 1;
2363 			TXMON_HAL_STATUS(ppdu_info,
2364 					 rtap_flags) |= HT_SGI_PRESENT;
2365 			break;
2366 		case TXMON_PKT_TYPE_11AC:
2367 			TXMON_HAL_STATUS(ppdu_info, vht_flags) = 1;
2368 			break;
2369 		case TXMON_PKT_TYPE_11AX:
2370 			TXMON_HAL_STATUS(ppdu_info, he_flags) = 1;
2371 			break;
2372 		default:
2373 			break;
2374 		}
2375 
2376 		if (!TXMON_HAL_STATUS(ppdu_info, he_flags))
2377 			break;
2378 
2379 		/* update he flags */
2380 		/* PPDU FORMAT */
2381 		switch (he_ppdu_subtype) {
2382 		case TXMON_HE_SUBTYPE_SU:
2383 			TXMON_HAL_STATUS(ppdu_info, he_data1) |=
2384 					QDF_MON_STATUS_HE_SU_FORMAT_TYPE;
2385 			break;
2386 		case TXMON_HE_SUBTYPE_TRIG:
2387 			TXMON_HAL_STATUS(ppdu_info, he_data1) |=
2388 					QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
2389 			break;
2390 		case TXMON_HE_SUBTYPE_MU:
2391 			TXMON_HAL_STATUS(ppdu_info, he_data1) |=
2392 					QDF_MON_STATUS_HE_MU_FORMAT_TYPE;
2393 			break;
2394 		case TXMON_HE_SUBTYPE_EXT_SU:
2395 			TXMON_HAL_STATUS(ppdu_info, he_data1) |=
2396 					QDF_MON_STATUS_HE_EXT_SU_FORMAT_TYPE;
2397 			break;
2398 		};
2399 
2400 		/* BEAM CHANGE */
2401 		he_data1 |= QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN;
2402 		if (ppdu_info->rx_status.beamformed) {
2403 			he_data1 |= QDF_MON_STATUS_TXBF_KNOWN;
2404 			he_data5 |= (1 << QDF_MON_STATUS_TXBF_SHIFT);
2405 			he_data3 |= (1 << QDF_MON_STATUS_BEAM_CHANGE_SHIFT);
2406 		}
2407 
2408 		/* UL/DL known */
2409 		he_data1 |= QDF_MON_STATUS_HE_DL_UL_KNOWN;
2410 		he_data3 |= (1 << QDF_MON_STATUS_DL_UL_SHIFT);
2411 
2412 		/* MCS */
2413 		he_data1 |= QDF_MON_STATUS_HE_MCS_KNOWN;
2414 		he_data3 |= (mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT);
2415 
2416 		/* STBC */
2417 		he_data1 |= QDF_MON_STATUS_HE_STBC_KNOWN;
2418 		he_data3 |= (is_stbc << QDF_MON_STATUS_STBC_SHIFT);
2419 
2420 		/* GI */
2421 		he_data2 |= QDF_MON_STATUS_HE_GI_KNOWN;
2422 		he_data5 |= (gi << QDF_MON_STATUS_GI_SHIFT);
2423 
2424 		/* NSS */
2425 		he_data6 |= (nss << QDF_MON_STATUS_HE_DATA_6_NSS_SHIFT);
2426 
2427 		/* Data BW and RU allocation */
2428 		he_data1 |= QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN;
2429 		he_data5 |= bandwidth;
2430 
2431 		/* update stack variable to ppdu_info */
2432 		TXMON_HAL_STATUS(ppdu_info, he_data1) |= he_data1;
2433 		TXMON_HAL_STATUS(ppdu_info, he_data2) |= he_data2;
2434 		TXMON_HAL_STATUS(ppdu_info, he_data3) |= he_data3;
2435 		TXMON_HAL_STATUS(ppdu_info, he_data4) |= he_data4;
2436 		TXMON_HAL_STATUS(ppdu_info, he_data5) |= he_data5;
2437 		TXMON_HAL_STATUS(ppdu_info, he_data6) |= he_data6;
2438 
2439 		for (i = 0; i < TXMON_HAL(ppdu_info, num_users); i++) {
2440 			TXMON_HAL_USER(ppdu_info, i, he_data1) |= he_data1;
2441 			TXMON_HAL_USER(ppdu_info, i, he_data2) |= he_data2;
2442 			TXMON_HAL_USER(ppdu_info, i, he_data3) |= he_data3;
2443 			TXMON_HAL_USER(ppdu_info, i, he_data4) |= he_data4;
2444 			TXMON_HAL_USER(ppdu_info, i, he_data5) |= he_data5;
2445 			TXMON_HAL_USER(ppdu_info, i, he_data6) |= he_data6;
2446 			TXMON_HAL_USER(ppdu_info, i, he_flags1) = he_mu_flag_1;
2447 			TXMON_HAL_USER(ppdu_info, i, he_flags2) = he_mu_flag_2;
2448 		}
2449 
2450 		SHOW_DEFINED(WIFIMACTX_PHY_DESC_E);
2451 		break;
2452 	}
2453 	case WIFICOEX_RX_STATUS_E:
2454 	{
2455 		SHOW_DEFINED(WIFICOEX_RX_STATUS_E);
2456 		break;
2457 	}
2458 	case WIFIRX_PPDU_ACK_REPORT_E:
2459 	{
2460 		SHOW_DEFINED(WIFIRX_PPDU_ACK_REPORT_E);
2461 		break;
2462 	}
2463 	case WIFIRX_PPDU_NO_ACK_REPORT_E:
2464 	{
2465 		SHOW_DEFINED(WIFIRX_PPDU_NO_ACK_REPORT_E);
2466 		break;
2467 	}
2468 	case WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E:
2469 	{
2470 		SHOW_DEFINED(WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E);
2471 		break;
2472 	}
2473 	case WIFITXPCU_PHYTX_DEBUG32_E:
2474 	{
2475 		SHOW_DEFINED(WIFITXPCU_PHYTX_DEBUG32_E);
2476 		break;
2477 	}
2478 	case WIFITXPCU_PREAMBLE_DONE_E:
2479 	{
2480 		SHOW_DEFINED(WIFITXPCU_PREAMBLE_DONE_E);
2481 		break;
2482 	}
2483 	case WIFIRX_PHY_SLEEP_E:
2484 	{
2485 		SHOW_DEFINED(WIFIRX_PHY_SLEEP_E);
2486 		break;
2487 	}
2488 	case WIFIRX_FRAME_BITMAP_REQ_E:
2489 	{
2490 		SHOW_DEFINED(WIFIRX_FRAME_BITMAP_REQ_E);
2491 		break;
2492 	}
2493 	case WIFIRXPCU_TX_SETUP_CLEAR_E:
2494 	{
2495 		SHOW_DEFINED(WIFIRXPCU_TX_SETUP_CLEAR_E);
2496 		break;
2497 	}
2498 	case WIFIRX_TRIG_INFO_E:
2499 	{
2500 		SHOW_DEFINED(WIFIRX_TRIG_INFO_E);
2501 		break;
2502 	}
2503 	case WIFIEXPECTED_RESPONSE_E:
2504 	{
2505 		SHOW_DEFINED(WIFIEXPECTED_RESPONSE_E);
2506 		break;
2507 	}
2508 	case WIFITRIGGER_RESPONSE_TX_DONE_E:
2509 	{
2510 		SHOW_DEFINED(WIFITRIGGER_RESPONSE_TX_DONE_E);
2511 		break;
2512 	}
2513 	case WIFIFW2SW_MON_E:
2514 	{
2515 		SHOW_DEFINED(WIFIFW2SW_MON_E);
2516 		break;
2517 	}
2518 	}
2519 
2520 	return status;
2521 }
2522 #endif /* QCA_MONITOR_2_0_SUPPORT */
2523 
2524 #ifdef REO_SHARED_QREF_TABLE_EN
2525 static void hal_reo_shared_qaddr_cache_clear_be(hal_soc_handle_t hal_soc_hdl)
2526 {
2527 	struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
2528 	uint32_t reg_val = 0;
2529 
2530 	/* Set Qdesc clear bit to erase REO internal storage for Qdesc pointers
2531 	 * of 37 peer/tids
2532 	 */
2533 	reg_val = HAL_REG_READ(hal, HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE));
2534 	reg_val |= HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1);
2535 	HAL_REG_WRITE(hal,
2536 		      HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
2537 		      reg_val);
2538 
2539 	/* Clear Qdesc clear bit to erase REO internal storage for Qdesc pointers
2540 	 * of 37 peer/tids
2541 	 */
2542 	reg_val &= ~(HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1));
2543 	HAL_REG_WRITE(hal,
2544 		      HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
2545 		      reg_val);
2546 
2547 	hal_verbose_debug("hal_soc: %pK :Setting CLEAR_DESC_ARRAY field of"
2548 			  "WCSS_UMAC_REO_R0_QDESC_ADDR_READ and resetting back"
2549 			  "to erase stale entries in reo storage: regval:%x", hal, reg_val);
2550 }
2551 
2552 /* hal_reo_shared_qaddr_write(): Write REO tid queue addr
2553  * LUT shared by SW and HW at the index given by peer id
2554  * and tid.
2555  *
2556  * @hal_soc: hal soc pointer
2557  * @reo_qref_addr: pointer to index pointed to be peer_id
2558  * and tid
2559  * @tid: tid queue number
2560  * @hw_qdesc_paddr: reo queue addr
2561  */
2562 
2563 static void hal_reo_shared_qaddr_write_be(hal_soc_handle_t hal_soc_hdl,
2564 					  uint16_t peer_id,
2565 					  int tid,
2566 					  qdf_dma_addr_t hw_qdesc_paddr)
2567 {
2568 	struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
2569 	struct rx_reo_queue_reference *reo_qref;
2570 	uint32_t peer_tid_idx;
2571 
2572 	/* Plug hw_desc_addr in Host reo queue reference table */
2573 	if (HAL_PEER_ID_IS_MLO(peer_id)) {
2574 		peer_tid_idx = ((peer_id - HAL_ML_PEER_ID_START) *
2575 				DP_MAX_TIDS) + tid;
2576 		reo_qref = (struct rx_reo_queue_reference *)
2577 			&hal->reo_qref.mlo_reo_qref_table_vaddr[peer_tid_idx];
2578 	} else {
2579 		peer_tid_idx = (peer_id * DP_MAX_TIDS) + tid;
2580 		reo_qref = (struct rx_reo_queue_reference *)
2581 			&hal->reo_qref.non_mlo_reo_qref_table_vaddr[peer_tid_idx];
2582 	}
2583 	reo_qref->rx_reo_queue_desc_addr_31_0 =
2584 		hw_qdesc_paddr & 0xffffffff;
2585 	reo_qref->rx_reo_queue_desc_addr_39_32 =
2586 		(hw_qdesc_paddr & 0xff00000000) >> 32;
2587 	if (hw_qdesc_paddr != 0)
2588 		reo_qref->receive_queue_number = tid;
2589 	else
2590 		reo_qref->receive_queue_number = 0;
2591 
2592 	hal_reo_shared_qaddr_cache_clear_be(hal_soc_hdl);
2593 	hal_verbose_debug("hw_qdesc_paddr: %pK, tid: %d, reo_qref:%pK,"
2594 			  "rx_reo_queue_desc_addr_31_0: %x,"
2595 			  "rx_reo_queue_desc_addr_39_32: %x",
2596 			  (void *)hw_qdesc_paddr, tid, reo_qref,
2597 			  reo_qref->rx_reo_queue_desc_addr_31_0,
2598 			  reo_qref->rx_reo_queue_desc_addr_39_32);
2599 }
2600 
2601 /**
2602  * hal_reo_shared_qaddr_setup() - Allocate MLO and Non MLO reo queue
2603  * reference table shared between SW and HW and initialize in Qdesc Base0
2604  * base1 registers provided by HW.
2605  *
2606  * @hal_soc: HAL Soc handle
2607  *
2608  * Return: None
2609  */
2610 static void hal_reo_shared_qaddr_setup_be(hal_soc_handle_t hal_soc_hdl)
2611 {
2612 	struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
2613 
2614 	hal->reo_qref.reo_qref_table_en = 1;
2615 
2616 	hal->reo_qref.mlo_reo_qref_table_vaddr =
2617 		(uint64_t *)qdf_mem_alloc_consistent(
2618 				hal->qdf_dev, hal->qdf_dev->dev,
2619 				REO_QUEUE_REF_ML_TABLE_SIZE,
2620 				&hal->reo_qref.mlo_reo_qref_table_paddr);
2621 	hal->reo_qref.non_mlo_reo_qref_table_vaddr =
2622 		(uint64_t *)qdf_mem_alloc_consistent(
2623 				hal->qdf_dev, hal->qdf_dev->dev,
2624 				REO_QUEUE_REF_NON_ML_TABLE_SIZE,
2625 				&hal->reo_qref.non_mlo_reo_qref_table_paddr);
2626 
2627 	hal_verbose_debug("MLO table start paddr:%pK,"
2628 			  "Non-MLO table start paddr:%pK,"
2629 			  "MLO table start vaddr: %pK,"
2630 			  "Non MLO table start vaddr: %pK",
2631 			  (void *)hal->reo_qref.mlo_reo_qref_table_paddr,
2632 			  (void *)hal->reo_qref.non_mlo_reo_qref_table_paddr,
2633 			  hal->reo_qref.mlo_reo_qref_table_vaddr,
2634 			  hal->reo_qref.non_mlo_reo_qref_table_vaddr);
2635 }
2636 
2637 /**
2638  * hal_reo_shared_qaddr_init() - Zero out REO qref LUT and
2639  * write start addr of MLO and Non MLO table in HW
2640  *
2641  * @hal_soc: HAL Soc handle
2642  * @qref_reset: reset qref LUT
2643  *
2644  * Return: None
2645  */
2646 static void hal_reo_shared_qaddr_init_be(hal_soc_handle_t hal_soc_hdl,
2647 					 int qref_reset)
2648 {
2649 	struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
2650 
2651 	if (qref_reset) {
2652 		qdf_mem_zero(hal->reo_qref.mlo_reo_qref_table_vaddr,
2653 			     REO_QUEUE_REF_ML_TABLE_SIZE);
2654 		qdf_mem_zero(hal->reo_qref.non_mlo_reo_qref_table_vaddr,
2655 			     REO_QUEUE_REF_NON_ML_TABLE_SIZE);
2656 	}
2657 	/* LUT_BASE0 and BASE1 registers expect upper 32bits of LUT base address
2658 	 * and lower 8 bits to be 0. Shift the physical address by 8 to plug
2659 	 * upper 32bits only
2660 	 */
2661 	HAL_REG_WRITE(hal,
2662 		      HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
2663 		      hal->reo_qref.non_mlo_reo_qref_table_paddr >> 8);
2664 	HAL_REG_WRITE(hal,
2665 		      HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
2666 		      hal->reo_qref.mlo_reo_qref_table_paddr >> 8);
2667 	HAL_REG_WRITE(hal,
2668 		      HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
2669 		      HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, LUT_FEATURE_ENABLE,
2670 			     1));
2671 	HAL_REG_WRITE(hal,
2672 		      HWIO_REO_R0_QDESC_MAX_SW_PEER_ID_ADDR(REO_REG_REG_BASE),
2673 		      HAL_MS(HWIO_REO_R0_QDESC, MAX_SW_PEER_ID_MAX_SUPPORTED,
2674 			     0x1fff));
2675 }
2676 
2677 /**
2678  * hal_reo_shared_qaddr_detach() - Free MLO and Non MLO reo queue
2679  * reference table shared between SW and HW
2680  *
2681  * @hal_soc: HAL Soc handle
2682  *
2683  * Return: None
2684  */
2685 static void hal_reo_shared_qaddr_detach_be(hal_soc_handle_t hal_soc_hdl)
2686 {
2687 	struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
2688 
2689 	HAL_REG_WRITE(hal,
2690 		      HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
2691 		      0);
2692 	HAL_REG_WRITE(hal,
2693 		      HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
2694 		      0);
2695 
2696 	qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
2697 				REO_QUEUE_REF_ML_TABLE_SIZE,
2698 				hal->reo_qref.mlo_reo_qref_table_vaddr,
2699 				hal->reo_qref.mlo_reo_qref_table_paddr, 0);
2700 	qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
2701 				REO_QUEUE_REF_NON_ML_TABLE_SIZE,
2702 				hal->reo_qref.non_mlo_reo_qref_table_vaddr,
2703 				hal->reo_qref.non_mlo_reo_qref_table_paddr, 0);
2704 }
2705 #endif
2706 
2707 /**
2708  * hal_tx_vdev_mismatch_routing_set - set vdev mismatch exception routing
2709  * @hal_soc: HAL SoC context
2710  * @config: HAL_TX_VDEV_MISMATCH_TQM_NOTIFY - route via TQM
2711  *          HAL_TX_VDEV_MISMATCH_FW_NOTIFY - route via FW
2712  *
2713  * Return: void
2714  */
2715 #ifdef HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_BMSK
2716 static inline void
2717 hal_tx_vdev_mismatch_routing_set_generic_be(hal_soc_handle_t hal_soc_hdl,
2718 					    enum hal_tx_vdev_mismatch_notify
2719 					    config)
2720 {
2721 	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
2722 	uint32_t reg_addr, reg_val = 0;
2723 	uint32_t val = 0;
2724 
2725 	reg_addr = HWIO_TCL_R0_CMN_CONFIG_ADDR(MAC_TCL_REG_REG_BASE);
2726 
2727 	val = HAL_REG_READ(hal_soc, reg_addr);
2728 
2729 	/* reset the corresponding bits in register */
2730 	val &= (~(HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_BMSK));
2731 
2732 	/* set config value */
2733 	reg_val = val | (config <<
2734 			HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_SHFT);
2735 
2736 	HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
2737 }
2738 #else
2739 static inline void
2740 hal_tx_vdev_mismatch_routing_set_generic_be(hal_soc_handle_t hal_soc_hdl,
2741 					    enum hal_tx_vdev_mismatch_notify
2742 					    config)
2743 {
2744 }
2745 #endif
2746 
2747 /**
2748  * hal_tx_mcast_mlo_reinject_routing_set - set MLO multicast reinject routing
2749  * @hal_soc: HAL SoC context
2750  * @config: HAL_TX_MCAST_MLO_REINJECT_FW_NOTIFY - route via FW
2751  *          HAL_TX_MCAST_MLO_REINJECT_TQM_NOTIFY - route via TQM
2752  *
2753  * Return: void
2754  */
2755 #if defined(HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_BMSK) && \
2756 	defined(WLAN_MCAST_MLO)
2757 static inline void
2758 hal_tx_mcast_mlo_reinject_routing_set_generic_be(
2759 				hal_soc_handle_t hal_soc_hdl,
2760 				enum hal_tx_mcast_mlo_reinject_notify config)
2761 {
2762 	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
2763 	uint32_t reg_addr, reg_val = 0;
2764 	uint32_t val = 0;
2765 
2766 	reg_addr = HWIO_TCL_R0_CMN_CONFIG_ADDR(MAC_TCL_REG_REG_BASE);
2767 	val = HAL_REG_READ(hal_soc, reg_addr);
2768 
2769 	/* reset the corresponding bits in register */
2770 	val &= (~(HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_BMSK));
2771 
2772 	/* set config value */
2773 	reg_val = val | (config << HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_SHFT);
2774 
2775 	HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
2776 }
2777 #else
2778 static inline void
2779 hal_tx_mcast_mlo_reinject_routing_set_generic_be(
2780 				hal_soc_handle_t hal_soc_hdl,
2781 				enum hal_tx_mcast_mlo_reinject_notify config)
2782 {
2783 }
2784 #endif
2785 
2786 /**
2787  * hal_get_ba_aging_timeout_be - Get BA Aging timeout
2788  *
2789  * @hal_soc: Opaque HAL SOC handle
2790  * @ac: Access category
2791  * @value: window size to get
2792  */
2793 
2794 static inline
2795 void hal_get_ba_aging_timeout_be_generic(hal_soc_handle_t hal_soc_hdl,
2796 					 uint8_t ac, uint32_t *value)
2797 {
2798 	struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
2799 
2800 	switch (ac) {
2801 	case WME_AC_BE:
2802 		*value = HAL_REG_READ(soc,
2803 				      HWIO_REO_R0_AGING_THRESHOLD_IX_0_ADDR(
2804 				      REO_REG_REG_BASE)) / 1000;
2805 		break;
2806 	case WME_AC_BK:
2807 		*value = HAL_REG_READ(soc,
2808 				      HWIO_REO_R0_AGING_THRESHOLD_IX_1_ADDR(
2809 				      REO_REG_REG_BASE)) / 1000;
2810 		break;
2811 	case WME_AC_VI:
2812 		*value = HAL_REG_READ(soc,
2813 				      HWIO_REO_R0_AGING_THRESHOLD_IX_2_ADDR(
2814 				      REO_REG_REG_BASE)) / 1000;
2815 		break;
2816 	case WME_AC_VO:
2817 		*value = HAL_REG_READ(soc,
2818 				      HWIO_REO_R0_AGING_THRESHOLD_IX_3_ADDR(
2819 				      REO_REG_REG_BASE)) / 1000;
2820 		break;
2821 	default:
2822 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
2823 			  "Invalid AC: %d\n", ac);
2824 	}
2825 }
2826 
2827 /**
2828  * hal_setup_link_idle_list_generic_be - Setup scattered idle list using the
2829  * buffer list provided
2830  *
2831  * @hal_soc: Opaque HAL SOC handle
2832  * @scatter_bufs_base_paddr: Array of physical base addresses
2833  * @scatter_bufs_base_vaddr: Array of virtual base addresses
2834  * @num_scatter_bufs: Number of scatter buffers in the above lists
2835  * @scatter_buf_size: Size of each scatter buffer
2836  * @last_buf_end_offset: Offset to the last entry
2837  * @num_entries: Total entries of all scatter bufs
2838  *
2839  * Return: None
2840  */
2841 static inline void
2842 hal_setup_link_idle_list_generic_be(struct hal_soc *soc,
2843 				    qdf_dma_addr_t scatter_bufs_base_paddr[],
2844 				    void *scatter_bufs_base_vaddr[],
2845 				    uint32_t num_scatter_bufs,
2846 				    uint32_t scatter_buf_size,
2847 				    uint32_t last_buf_end_offset,
2848 				    uint32_t num_entries)
2849 {
2850 	int i;
2851 	uint32_t *prev_buf_link_ptr = NULL;
2852 	uint32_t reg_scatter_buf_size, reg_tot_scatter_buf_size;
2853 	uint32_t val;
2854 
2855 	/* Link the scatter buffers */
2856 	for (i = 0; i < num_scatter_bufs; i++) {
2857 		if (i > 0) {
2858 			prev_buf_link_ptr[0] =
2859 				scatter_bufs_base_paddr[i] & 0xffffffff;
2860 			prev_buf_link_ptr[1] = HAL_SM(
2861 				HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
2862 				BASE_ADDRESS_39_32,
2863 				((uint64_t)(scatter_bufs_base_paddr[i])
2864 				 >> 32)) | HAL_SM(
2865 				HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
2866 				ADDRESS_MATCH_TAG,
2867 				ADDRESS_MATCH_TAG_VAL);
2868 		}
2869 		prev_buf_link_ptr = (uint32_t *)(scatter_bufs_base_vaddr[i] +
2870 			scatter_buf_size - WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE);
2871 	}
2872 
2873 	/* TBD: Register programming partly based on MLD & the rest based on
2874 	 * inputs from HW team. Not complete yet.
2875 	 */
2876 
2877 	reg_scatter_buf_size = (scatter_buf_size -
2878 				WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE) / 64;
2879 	reg_tot_scatter_buf_size = ((scatter_buf_size -
2880 		WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE) * num_scatter_bufs) / 64;
2881 
2882 	HAL_REG_WRITE(soc,
2883 		HWIO_WBM_R0_IDLE_LIST_CONTROL_ADDR(
2884 		WBM_REG_REG_BASE),
2885 		HAL_SM(HWIO_WBM_R0_IDLE_LIST_CONTROL, SCATTER_BUFFER_SIZE,
2886 		reg_scatter_buf_size) |
2887 		HAL_SM(HWIO_WBM_R0_IDLE_LIST_CONTROL, LINK_DESC_IDLE_LIST_MODE,
2888 		0x1));
2889 
2890 	HAL_REG_WRITE(soc,
2891 		HWIO_WBM_R0_IDLE_LIST_SIZE_ADDR(
2892 		WBM_REG_REG_BASE),
2893 		HAL_SM(HWIO_WBM_R0_IDLE_LIST_SIZE,
2894 		SCATTER_RING_SIZE_OF_IDLE_LINK_DESC_LIST,
2895 		reg_tot_scatter_buf_size));
2896 
2897 	HAL_REG_WRITE(soc,
2898 		HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_LSB_ADDR(
2899 		WBM_REG_REG_BASE),
2900 		scatter_bufs_base_paddr[0] & 0xffffffff);
2901 
2902 	HAL_REG_WRITE(soc,
2903 		HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB_ADDR(
2904 		WBM_REG_REG_BASE),
2905 		((uint64_t)(scatter_bufs_base_paddr[0]) >> 32) &
2906 		HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB_BASE_ADDRESS_39_32_BMSK);
2907 
2908 	HAL_REG_WRITE(soc,
2909 		HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB_ADDR(
2910 		WBM_REG_REG_BASE),
2911 		HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
2912 		BASE_ADDRESS_39_32, ((uint64_t)(scatter_bufs_base_paddr[0])
2913 								>> 32)) |
2914 		HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
2915 		ADDRESS_MATCH_TAG, ADDRESS_MATCH_TAG_VAL));
2916 
2917 	/* ADDRESS_MATCH_TAG field in the above register is expected to match
2918 	 * with the upper bits of link pointer. The above write sets this field
2919 	 * to zero and we are also setting the upper bits of link pointers to
2920 	 * zero while setting up the link list of scatter buffers above
2921 	 */
2922 
2923 	/* Setup head and tail pointers for the idle list */
2924 	HAL_REG_WRITE(soc,
2925 		HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX0_ADDR(
2926 		WBM_REG_REG_BASE),
2927 		scatter_bufs_base_paddr[num_scatter_bufs - 1] & 0xffffffff);
2928 	HAL_REG_WRITE(soc,
2929 		HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX1_ADDR(
2930 		WBM_REG_REG_BASE),
2931 		HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX1,
2932 		BUFFER_ADDRESS_39_32,
2933 		((uint64_t)(scatter_bufs_base_paddr[num_scatter_bufs - 1])
2934 								>> 32)) |
2935 		HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX1,
2936 		HEAD_POINTER_OFFSET, last_buf_end_offset >> 2));
2937 
2938 	HAL_REG_WRITE(soc,
2939 		HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX0_ADDR(
2940 		WBM_REG_REG_BASE),
2941 		scatter_bufs_base_paddr[0] & 0xffffffff);
2942 
2943 	HAL_REG_WRITE(soc,
2944 		HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX0_ADDR(
2945 		WBM_REG_REG_BASE),
2946 		scatter_bufs_base_paddr[0] & 0xffffffff);
2947 	HAL_REG_WRITE(soc,
2948 		HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX1_ADDR(
2949 		WBM_REG_REG_BASE),
2950 		HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX1,
2951 		BUFFER_ADDRESS_39_32,
2952 		((uint64_t)(scatter_bufs_base_paddr[0]) >>
2953 		32)) | HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX1,
2954 		TAIL_POINTER_OFFSET, 0));
2955 
2956 	HAL_REG_WRITE(soc,
2957 		HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HP_ADDR(
2958 		WBM_REG_REG_BASE),
2959 		2 * num_entries);
2960 
2961 	/* Set RING_ID_DISABLE */
2962 	val = HAL_SM(HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC, RING_ID_DISABLE, 1);
2963 
2964 	/*
2965 	 * SRNG_ENABLE bit is not available in HWK v1 (QCA8074v1). Hence
2966 	 * check the presence of the bit before toggling it.
2967 	 */
2968 #ifdef HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC_SRNG_ENABLE_BMSK
2969 	val |= HAL_SM(HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC, SRNG_ENABLE, 1);
2970 #endif
2971 	HAL_REG_WRITE(soc,
2972 		      HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC_ADDR(WBM_REG_REG_BASE),
2973 		      val);
2974 }
2975 
2976 #ifdef DP_HW_COOKIE_CONVERT_EXCEPTION
2977 #define HAL_WBM_MISC_CONTROL_SPARE_CONTROL_FIELD_BIT15 0x8000
2978 #endif
2979 
2980 /**
2981  * hal_cookie_conversion_reg_cfg_generic_be() - set cookie conversion relevant register
2982  *					for REO/WBM
2983  * @soc: HAL soc handle
2984  * @cc_cfg: structure pointer for HW cookie conversion configuration
2985  *
2986  * Return: None
2987  */
2988 static inline
2989 void hal_cookie_conversion_reg_cfg_generic_be(hal_soc_handle_t hal_soc_hdl,
2990 					      struct hal_hw_cc_config *cc_cfg)
2991 {
2992 	uint32_t reg_addr, reg_val = 0;
2993 	struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
2994 
2995 	/* REO CFG */
2996 	reg_addr = HWIO_REO_R0_SW_COOKIE_CFG0_ADDR(REO_REG_REG_BASE);
2997 	reg_val = cc_cfg->lut_base_addr_31_0;
2998 	HAL_REG_WRITE(soc, reg_addr, reg_val);
2999 
3000 	reg_addr = HWIO_REO_R0_SW_COOKIE_CFG1_ADDR(REO_REG_REG_BASE);
3001 	reg_val = 0;
3002 	reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
3003 			  SW_COOKIE_CONVERT_GLOBAL_ENABLE,
3004 			  cc_cfg->cc_global_en);
3005 	reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
3006 			  SW_COOKIE_CONVERT_ENABLE,
3007 			  cc_cfg->cc_global_en);
3008 	reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
3009 			  PAGE_ALIGNMENT,
3010 			  cc_cfg->page_4k_align);
3011 	reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
3012 			  COOKIE_OFFSET_MSB,
3013 			  cc_cfg->cookie_offset_msb);
3014 	reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
3015 			  COOKIE_PAGE_MSB,
3016 			  cc_cfg->cookie_page_msb);
3017 	reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
3018 			  CMEM_LUT_BASE_ADDR_39_32,
3019 			  cc_cfg->lut_base_addr_39_32);
3020 	HAL_REG_WRITE(soc, reg_addr, reg_val);
3021 
3022 	/* WBM CFG */
3023 	reg_addr = HWIO_WBM_R0_SW_COOKIE_CFG0_ADDR(WBM_REG_REG_BASE);
3024 	reg_val = cc_cfg->lut_base_addr_31_0;
3025 	HAL_REG_WRITE(soc, reg_addr, reg_val);
3026 
3027 	reg_addr = HWIO_WBM_R0_SW_COOKIE_CFG1_ADDR(WBM_REG_REG_BASE);
3028 	reg_val = 0;
3029 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
3030 			  PAGE_ALIGNMENT,
3031 			  cc_cfg->page_4k_align);
3032 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
3033 			  COOKIE_OFFSET_MSB,
3034 			  cc_cfg->cookie_offset_msb);
3035 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
3036 			  COOKIE_PAGE_MSB,
3037 			  cc_cfg->cookie_page_msb);
3038 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
3039 			  CMEM_LUT_BASE_ADDR_39_32,
3040 			  cc_cfg->lut_base_addr_39_32);
3041 	HAL_REG_WRITE(soc, reg_addr, reg_val);
3042 
3043 	/*
3044 	 * WCSS_UMAC_WBM_R0_SW_COOKIE_CONVERT_CFG default value is 0x1FE,
3045 	 */
3046 	reg_addr = HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG_ADDR(WBM_REG_REG_BASE);
3047 	reg_val = 0;
3048 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
3049 			  WBM_COOKIE_CONV_GLOBAL_ENABLE,
3050 			  cc_cfg->cc_global_en);
3051 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
3052 			  WBM2SW6_COOKIE_CONVERSION_EN,
3053 			  cc_cfg->wbm2sw6_cc_en);
3054 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
3055 			  WBM2SW5_COOKIE_CONVERSION_EN,
3056 			  cc_cfg->wbm2sw5_cc_en);
3057 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
3058 			  WBM2SW4_COOKIE_CONVERSION_EN,
3059 			  cc_cfg->wbm2sw4_cc_en);
3060 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
3061 			  WBM2SW3_COOKIE_CONVERSION_EN,
3062 			  cc_cfg->wbm2sw3_cc_en);
3063 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
3064 			  WBM2SW2_COOKIE_CONVERSION_EN,
3065 			  cc_cfg->wbm2sw2_cc_en);
3066 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
3067 			  WBM2SW1_COOKIE_CONVERSION_EN,
3068 			  cc_cfg->wbm2sw1_cc_en);
3069 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
3070 			  WBM2SW0_COOKIE_CONVERSION_EN,
3071 			  cc_cfg->wbm2sw0_cc_en);
3072 	reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
3073 			  WBM2FW_COOKIE_CONVERSION_EN,
3074 			  cc_cfg->wbm2fw_cc_en);
3075 	HAL_REG_WRITE(soc, reg_addr, reg_val);
3076 
3077 #ifdef HWIO_WBM_R0_WBM_CFG_2_COOKIE_DEBUG_SEL_BMSK
3078 	reg_addr = HWIO_WBM_R0_WBM_CFG_2_ADDR(WBM_REG_REG_BASE);
3079 	reg_val = 0;
3080 	reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
3081 			  COOKIE_DEBUG_SEL,
3082 			  cc_cfg->cc_global_en);
3083 
3084 	reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
3085 			  COOKIE_CONV_INDICATION_EN,
3086 			  cc_cfg->cc_global_en);
3087 
3088 	reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
3089 			  ERROR_PATH_COOKIE_CONV_EN,
3090 			  cc_cfg->error_path_cookie_conv_en);
3091 
3092 	reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
3093 			  RELEASE_PATH_COOKIE_CONV_EN,
3094 			  cc_cfg->release_path_cookie_conv_en);
3095 
3096 	HAL_REG_WRITE(soc, reg_addr, reg_val);
3097 #endif
3098 #ifdef DP_HW_COOKIE_CONVERT_EXCEPTION
3099 	/*
3100 	 * To enable indication for HW cookie conversion done or not for
3101 	 * WBM, WCSS_UMAC_WBM_R0_MISC_CONTROL spare_control field 15th
3102 	 * bit spare_control[15] should be set.
3103 	 */
3104 	reg_addr = HWIO_WBM_R0_MISC_CONTROL_ADDR(WBM_REG_REG_BASE);
3105 	reg_val = HAL_REG_READ(soc, reg_addr);
3106 	reg_val |= HAL_SM(HWIO_WCSS_UMAC_WBM_R0_MISC_CONTROL,
3107 			  SPARE_CONTROL,
3108 			  HAL_WBM_MISC_CONTROL_SPARE_CONTROL_FIELD_BIT15);
3109 	HAL_REG_WRITE(soc, reg_addr, reg_val);
3110 #endif
3111 }
3112 
3113 /**
3114  * hal_set_ba_aging_timeout_be - Set BA Aging timeout
3115  *
3116  * @hal_soc: Opaque HAL SOC handle
3117  * @ac: Access category
3118  * ac: 0 - Background, 1 - Best Effort, 2 - Video, 3 - Voice
3119  * @value: Input value to set
3120  */
3121 static inline
3122 void hal_set_ba_aging_timeout_be_generic(hal_soc_handle_t hal_soc_hdl,
3123 					 uint8_t ac, uint32_t value)
3124 {
3125 	struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
3126 
3127 	switch (ac) {
3128 	case WME_AC_BE:
3129 		HAL_REG_WRITE(soc,
3130 			      HWIO_REO_R0_AGING_THRESHOLD_IX_0_ADDR(
3131 			      REO_REG_REG_BASE),
3132 			      value * 1000);
3133 		break;
3134 	case WME_AC_BK:
3135 		HAL_REG_WRITE(soc,
3136 			      HWIO_REO_R0_AGING_THRESHOLD_IX_1_ADDR(
3137 			      REO_REG_REG_BASE),
3138 			      value * 1000);
3139 		break;
3140 	case WME_AC_VI:
3141 		HAL_REG_WRITE(soc,
3142 			      HWIO_REO_R0_AGING_THRESHOLD_IX_2_ADDR(
3143 			      REO_REG_REG_BASE),
3144 			      value * 1000);
3145 		break;
3146 	case WME_AC_VO:
3147 		HAL_REG_WRITE(soc,
3148 			      HWIO_REO_R0_AGING_THRESHOLD_IX_3_ADDR(
3149 			      REO_REG_REG_BASE),
3150 			      value * 1000);
3151 		break;
3152 	default:
3153 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
3154 			  "Invalid AC: %d\n", ac);
3155 	}
3156 }
3157 
3158 /**
3159  * hal_tx_populate_bank_register() - populate the bank register with
3160  *		the software configs.
3161  * @soc: HAL soc handle
3162  * @config: bank config
3163  * @bank_id: bank id to be configured
3164  *
3165  * Returns: None
3166  */
3167 #ifdef HWIO_TCL_R0_SW_CONFIG_BANK_n_MCAST_PACKET_CTRL_SHFT
3168 static inline void
3169 hal_tx_populate_bank_register_be(hal_soc_handle_t hal_soc_hdl,
3170 				 union hal_tx_bank_config *config,
3171 				 uint8_t bank_id)
3172 {
3173 	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
3174 	uint32_t reg_addr, reg_val = 0;
3175 
3176 	reg_addr = HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDR(MAC_TCL_REG_REG_BASE,
3177 						     bank_id);
3178 
3179 	reg_val |= (config->epd << HWIO_TCL_R0_SW_CONFIG_BANK_n_EPD_SHFT);
3180 	reg_val |= (config->encap_type <<
3181 			HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCAP_TYPE_SHFT);
3182 	reg_val |= (config->encrypt_type <<
3183 			HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCRYPT_TYPE_SHFT);
3184 	reg_val |= (config->src_buffer_swap <<
3185 			HWIO_TCL_R0_SW_CONFIG_BANK_n_SRC_BUFFER_SWAP_SHFT);
3186 	reg_val |= (config->link_meta_swap <<
3187 			HWIO_TCL_R0_SW_CONFIG_BANK_n_LINK_META_SWAP_SHFT);
3188 	reg_val |= (config->index_lookup_enable <<
3189 			HWIO_TCL_R0_SW_CONFIG_BANK_n_INDEX_LOOKUP_ENABLE_SHFT);
3190 	reg_val |= (config->addrx_en <<
3191 			HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRX_EN_SHFT);
3192 	reg_val |= (config->addry_en <<
3193 			HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRY_EN_SHFT);
3194 	reg_val |= (config->mesh_enable <<
3195 			HWIO_TCL_R0_SW_CONFIG_BANK_n_MESH_ENABLE_SHFT);
3196 	reg_val |= (config->vdev_id_check_en <<
3197 			HWIO_TCL_R0_SW_CONFIG_BANK_n_VDEV_ID_CHECK_EN_SHFT);
3198 	reg_val |= (config->pmac_id <<
3199 			HWIO_TCL_R0_SW_CONFIG_BANK_n_PMAC_ID_SHFT);
3200 	reg_val |= (config->mcast_pkt_ctrl <<
3201 			HWIO_TCL_R0_SW_CONFIG_BANK_n_MCAST_PACKET_CTRL_SHFT);
3202 
3203 	HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
3204 }
3205 #else
3206 static inline void
3207 hal_tx_populate_bank_register_be(hal_soc_handle_t hal_soc_hdl,
3208 				 union hal_tx_bank_config *config,
3209 				 uint8_t bank_id)
3210 {
3211 	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
3212 	uint32_t reg_addr, reg_val = 0;
3213 
3214 	reg_addr = HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDR(MAC_TCL_REG_REG_BASE,
3215 						     bank_id);
3216 
3217 	reg_val |= (config->epd << HWIO_TCL_R0_SW_CONFIG_BANK_n_EPD_SHFT);
3218 	reg_val |= (config->encap_type <<
3219 			HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCAP_TYPE_SHFT);
3220 	reg_val |= (config->encrypt_type <<
3221 			HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCRYPT_TYPE_SHFT);
3222 	reg_val |= (config->src_buffer_swap <<
3223 			HWIO_TCL_R0_SW_CONFIG_BANK_n_SRC_BUFFER_SWAP_SHFT);
3224 	reg_val |= (config->link_meta_swap <<
3225 			HWIO_TCL_R0_SW_CONFIG_BANK_n_LINK_META_SWAP_SHFT);
3226 	reg_val |= (config->index_lookup_enable <<
3227 			HWIO_TCL_R0_SW_CONFIG_BANK_n_INDEX_LOOKUP_ENABLE_SHFT);
3228 	reg_val |= (config->addrx_en <<
3229 			HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRX_EN_SHFT);
3230 	reg_val |= (config->addry_en <<
3231 			HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRY_EN_SHFT);
3232 	reg_val |= (config->mesh_enable <<
3233 			HWIO_TCL_R0_SW_CONFIG_BANK_n_MESH_ENABLE_SHFT);
3234 	reg_val |= (config->vdev_id_check_en <<
3235 			HWIO_TCL_R0_SW_CONFIG_BANK_n_VDEV_ID_CHECK_EN_SHFT);
3236 	reg_val |= (config->pmac_id <<
3237 			HWIO_TCL_R0_SW_CONFIG_BANK_n_PMAC_ID_SHFT);
3238 	reg_val |= (config->dscp_tid_map_id <<
3239 			HWIO_TCL_R0_SW_CONFIG_BANK_n_DSCP_TID_TABLE_NUM_SHFT);
3240 
3241 	HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
3242 }
3243 #endif
3244 
3245 
3246 #ifdef HWIO_TCL_R0_VDEV_MCAST_PACKET_CTRL_MAP_n_VAL_SHFT
3247 
3248 #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_REG_ID(vdev_id) (vdev_id >> 0x4)
3249 #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_INDEX_IN_REG(vdev_id) (vdev_id & 0xF)
3250 #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK 0x3
3251 #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT 0x2
3252 
3253 /**
3254  * hal_tx_vdev_mcast_ctrl_set - set mcast_ctrl value
3255  * @hal_soc: HAL SoC context
3256  * @mcast_ctrl_val: mcast ctrl value for this VAP
3257  *
3258  * Return: void
3259  */
3260 static inline void
3261 hal_tx_vdev_mcast_ctrl_set_be(hal_soc_handle_t hal_soc_hdl,
3262 			      uint8_t vdev_id, uint8_t mcast_ctrl_val)
3263 {
3264 	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
3265 	uint32_t reg_addr, reg_val = 0;
3266 	uint32_t val;
3267 	uint8_t reg_idx = HAL_TCL_VDEV_MCAST_PACKET_CTRL_REG_ID(vdev_id);
3268 	uint8_t index_in_reg =
3269 		HAL_TCL_VDEV_MCAST_PACKET_CTRL_INDEX_IN_REG(vdev_id);
3270 
3271 	reg_addr =
3272 	HWIO_TCL_R0_VDEV_MCAST_PACKET_CTRL_MAP_n_ADDR(MAC_TCL_REG_REG_BASE,
3273 						      reg_idx);
3274 
3275 	val = HAL_REG_READ(hal_soc, reg_addr);
3276 
3277 	/* mask out other stored value */
3278 	val &= (~(HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK <<
3279 		  (HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT * index_in_reg)));
3280 
3281 	reg_val = val |
3282 		((HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK & mcast_ctrl_val) <<
3283 		 (HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT * index_in_reg));
3284 
3285 	HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
3286 }
3287 #else
3288 static inline void
3289 hal_tx_vdev_mcast_ctrl_set_be(hal_soc_handle_t hal_soc_hdl,
3290 			      uint8_t vdev_id, uint8_t mcast_ctrl_val)
3291 {
3292 }
3293 #endif
3294 
3295 #endif /* _HAL_BE_GENERIC_API_H_ */
3296