xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_cmn_struct.h (revision 45a38684b07295822dc8eba39e293408f203eec8)
1 /*
2  * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19  /**
20  * @file cdp_txrx_cmn_struct.h
21  * @brief Define the host data path converged API functions
22  * called by the host control SW and the OS interface module
23  */
24 #ifndef _CDP_TXRX_CMN_STRUCT_H_
25 #define _CDP_TXRX_CMN_STRUCT_H_
26 
27 /**
28  * For WIN legacy header compilation
29  * Temporary add dummy definitions
30  * should be removed properly WIN legacy code handle
31  */
32 
33 #include "htc_api.h"
34 #include "qdf_types.h"
35 #include "qdf_nbuf.h"
36 #include "qdf_atomic.h"
37 #ifdef DP_MOB_DEFS
38 #include <cdp_txrx_mob_def.h>
39 #endif
40 #include <cdp_txrx_handle.h>
41 #include <cdp_txrx_stats_struct.h>
42 #ifdef WLAN_RX_PKT_CAPTURE_ENH
43 #include "cdp_txrx_extd_struct.h"
44 #endif
45 
46 #ifdef WLAN_MAX_CLIENTS_ALLOWED
47 #define OL_TXRX_NUM_LOCAL_PEER_IDS (WLAN_MAX_CLIENTS_ALLOWED + 1 + 1 + 1)
48 #endif
49 
50 #ifndef OL_TXRX_NUM_LOCAL_PEER_IDS
51 /*
52  * Each AP will occupy one ID, so it will occupy two IDs for AP-AP mode.
53  * Clients will be assigned max 32 IDs.
54  * STA(associated)/P2P DEV(self-PEER) will get one ID.
55  */
56 #define OL_TXRX_NUM_LOCAL_PEER_IDS (32 + 1 + 1 + 1)
57 #endif
58 
59 #define CDP_BA_256_BIT_MAP_SIZE_DWORDS 8
60 #define CDP_BA_64_BIT_MAP_SIZE_DWORDS 2
61 #define CDP_RSSI_CHAIN_LEN 8
62 
63 #define OL_TXRX_INVALID_PDEV_ID 0xff
64 #define OL_TXRX_INVALID_LOCAL_PEER_ID 0xffff
65 #define CDP_INVALID_VDEV_ID 0xff
66 /* Options for Dump Statistics */
67 #define CDP_HDD_STATS               0
68 #define CDP_TXRX_PATH_STATS         1
69 #define CDP_TXRX_HIST_STATS         2
70 #define CDP_TXRX_TSO_STATS          3
71 #define CDP_HDD_NETIF_OPER_HISTORY  4
72 #define CDP_DUMP_TX_FLOW_POOL_INFO  5
73 #define CDP_TXRX_DESC_STATS         6
74 #define CDP_HIF_STATS               7
75 #define CDP_LRO_STATS               8
76 #define CDP_NAPI_STATS              9
77 #define CDP_WLAN_RX_BUF_DEBUG_STATS 10
78 #define CDP_RX_RING_STATS          11
79 #define CDP_DP_NAPI_STATS          12
80 #define CDP_DP_RX_THREAD_STATS     13
81 #define CDP_SCHEDULER_STATS        21
82 #define CDP_TX_QUEUE_STATS         22
83 #define CDP_BUNDLE_STATS           23
84 #define CDP_CREDIT_STATS           24
85 #define CDP_DISCONNECT_STATS       25
86 #define CDP_DP_RX_FISA_STATS	   26
87 
88 #define WME_AC_TO_TID(_ac) (       \
89 		((_ac) == WME_AC_VO) ? 6 : \
90 		((_ac) == WME_AC_VI) ? 5 : \
91 		((_ac) == WME_AC_BK) ? 1 : \
92 		0)
93 
94 #define TID_TO_WME_AC(_tid) (      \
95 		(((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
96 		(((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
97 		(((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
98 		WME_AC_VO)
99 
100 #define CDP_MU_MAX_USERS 37
101 #define CDP_MU_MAX_USER_INDEX (CDP_MU_MAX_USERS - 1)
102 #define CDP_INVALID_PEER 0xffff
103 #define CDP_INVALID_TID	 31
104 #define CDP_INVALID_TX_ENCAP_TYPE	 6
105 #define CDP_INVALID_SEC_TYPE		12
106 
107 #define CDP_DATA_TID_MAX 8
108 #define CDP_DATA_NON_QOS_TID 16
109 
110 #define CDP_NUM_SA_BW 4
111 #define CDP_PERCENT_MACRO 100
112 #define CDP_NUM_KB_IN_MB 1000
113 /*
114  * advance rx monitor filter
115  * */
116 #define MON_FILTER_PASS			0x0001
117 #define MON_FILTER_OTHER		0x0002
118 #define MON_FILTER_ALL			0x0003
119 
120 #define FILTER_MGMT_ALL			0xFFFF
121 #define FILTER_MGMT_ASSOC_REQ		0x0001
122 #define FILTER_MGMT_ASSOC_RES		0x0002
123 #define FILTER_MGMT_REASSOC_REQ		0x0004
124 #define FILTER_MGMT_REASSOC_RES		0x0008
125 #define FILTER_MGMT_PROBE_REQ		0x0010
126 #define FILTER_MGMT_PROBE_RES		0x0020
127 #define FILTER_MGMT_TIM_ADVT		0x0040
128 #define FILTER_MGMT_RESERVED_7		0x0080
129 #define FILTER_MGMT_BEACON		0x0100
130 #define FILTER_MGMT_ATIM		0x0200
131 #define FILTER_MGMT_DISASSOC		0x0400
132 #define FILTER_MGMT_AUTH		0x0800
133 #define FILTER_MGMT_DEAUTH		0x1000
134 #define FILTER_MGMT_ACTION		0x2000
135 #define FILTER_MGMT_ACT_NO_ACK		0x4000
136 #define FILTER_MGMT_RESERVED_15		0x8000
137 
138 #define FILTER_CTRL_ALL			0xFFFF
139 #define FILTER_CTRL_RESERVED_1		0x0001
140 #define FILTER_CTRL_RESERVED_2		0x0002
141 #define FILTER_CTRL_TRIGGER		0x0004
142 #define FILTER_CTRL_RESERVED_4		0x0008
143 #define FILTER_CTRL_BF_REP_POLL		0x0010
144 #define FILTER_CTRL_VHT_NDP		0x0020
145 #define FILTER_CTRL_FRAME_EXT		0x0040
146 #define FILTER_CTRL_CTRLWRAP		0x0080
147 #define FILTER_CTRL_BA_REQ		0x0100
148 #define FILTER_CTRL_BA			0x0200
149 #define FILTER_CTRL_PSPOLL		0x0400
150 #define FILTER_CTRL_RTS			0x0800
151 #define FILTER_CTRL_CTS			0x1000
152 #define FILTER_CTRL_ACK			0x2000
153 #define FILTER_CTRL_CFEND		0x4000
154 #define FILTER_CTRL_CFEND_CFACK		0x8000
155 
156 #define FILTER_DATA_ALL			0xFFFF
157 #define FILTER_DATA_MCAST		0x4000
158 #define FILTER_DATA_UCAST		0x8000
159 #define FILTER_DATA_DATA		0x0001
160 #define FILTER_DATA_NULL		0x0008
161 
162 /*
163  * Multiply rate by 2 to avoid float point
164  * and get rate in units of 500kbps
165  */
166 #define CDP_11B_RATE_0MCS (11 * 2)
167 #define CDP_11B_RATE_1MCS (5.5 * 2)
168 #define CDP_11B_RATE_2MCS (2 * 2)
169 #define CDP_11B_RATE_3MCS (1 * 2)
170 #define CDP_11B_RATE_4MCS (11 * 2)
171 #define CDP_11B_RATE_5MCS (5.5 * 2)
172 #define CDP_11B_RATE_6MCS (2 * 2)
173 
174 #define CDP_11A_RATE_0MCS (48 * 2)
175 #define CDP_11A_RATE_1MCS (24 * 2)
176 #define CDP_11A_RATE_2MCS (12 * 2)
177 #define CDP_11A_RATE_3MCS (6 * 2)
178 #define CDP_11A_RATE_4MCS (54 * 2)
179 #define CDP_11A_RATE_5MCS (36 * 2)
180 #define CDP_11A_RATE_6MCS (18 * 2)
181 #define CDP_11A_RATE_7MCS (9 * 2)
182 
183 #define CDP_LEGACY_MCS0  0
184 #define CDP_LEGACY_MCS1  1
185 #define CDP_LEGACY_MCS2  2
186 #define CDP_LEGACY_MCS3  3
187 #define CDP_LEGACY_MCS4  4
188 #define CDP_LEGACY_MCS5  5
189 #define CDP_LEGACY_MCS6  6
190 #define CDP_LEGACY_MCS7  7
191 
192 QDF_DECLARE_EWMA(tx_lag, 1024, 8)
193 struct cdp_stats_cookie;
194 
195 /*
196  * DP configuration parameters
197  */
198 enum cdp_cfg_param_type {
199 	CDP_CFG_MAX_PEER_ID,
200 	CDP_CFG_CCE_DISABLE,
201 	CDP_CFG_NUM_PARAMS
202 };
203 
204 /*
205  * PPDU TYPE from FW -
206  * @CDP_PPDU_STATS_PPDU_TYPE_SU: single user type
207  * @CDP_PPDU_STATS_PPDU_TYPE_MU_MIMO: multi user mu-mimo
208  * @CDP_PPDU_STATS_PPDU_TYPE_MU_OFDMA: multi user ofdma
209  * @CDP_PPDU_STATS_PPDU_TYPE_MU_MIMO_OFDMA: multi user mu-mimo ofdma
210  * @CDP_PPDU_STATS_PPDU_TYPE_UL_TRIG: ul trigger ppdu
211  * @CDP_PPDU_STATS_PPDU_TYPE_BURST_BCN: burst beacon
212  * @CDP_PPDU_STATS_PPDU_TYPE_UL_BSR_RESP: bsr respond
213  * @CDP_PPDU_STATS_PPDU_TYPE_UL_BSR_TRIG: bsr trigger
214  * @CDP_PPDU_STATS_PPDU_TYPE_UL_RESP: ul response
215  * @CDP_PPDU_STATS_PPDU_TYPE_UNKNOWN
216  */
217 enum CDP_PPDU_STATS_PPDU_TYPE {
218 	CDP_PPDU_STATS_PPDU_TYPE_SU = 0,
219 	CDP_PPDU_STATS_PPDU_TYPE_MU_MIMO = 1,
220 	CDP_PPDU_STATS_PPDU_TYPE_MU_OFDMA = 2,
221 	CDP_PPDU_STATS_PPDU_TYPE_MU_MIMO_OFDMA = 4,
222 	CDP_PPDU_STATS_PPDU_TYPE_UL_TRIG = 5,
223 	CDP_PPDU_STATS_PPDU_TYPE_BURST_BCN = 6,
224 	CDP_PPDU_STATS_PPDU_TYPE_UL_BSR_RESP = 7,
225 	CDP_PPDU_STATS_PPDU_TYPE_UL_BSR_TRIG = 8,
226 	CDP_PPDU_STATS_PPDU_TYPE_UL_RESP = 9,
227 	CDP_PPDU_STATS_PPDU_TYPE_UNKNOWN = 0x1F,
228 };
229 
230 /*
231  * htt_dbg_stats_type -
232  * bit positions for each stats type within a stats type bitmask
233  * The bitmask contains 24 bits.
234  */
235 enum htt_cmn_dbg_stats_type {
236 	HTT_DBG_CMN_STATS_WAL_PDEV_TXRX      = 0,  /* bit 0 -> 0x1 */
237 	HTT_DBG_CMN_STATS_RX_REORDER         = 1,  /* bit 1 -> 0x2 */
238 	HTT_DBG_CMN_STATS_RX_RATE_INFO       = 2,  /* bit 2 -> 0x4 */
239 	HTT_DBG_CMN_STATS_TX_PPDU_LOG        = 3,  /* bit 3 -> 0x8 */
240 	HTT_DBG_CMN_STATS_TX_RATE_INFO       = 4,  /* bit 4 -> 0x10 */
241 	HTT_DBG_CMN_STATS_TIDQ               = 5,  /* bit 5 -> 0x20 */
242 	HTT_DBG_CMN_STATS_TXBF_INFO          = 6,  /* bit 6 -> 0x40 */
243 	HTT_DBG_CMN_STATS_SND_INFO           = 7,  /* bit 7 -> 0x80 */
244 	HTT_DBG_CMN_STATS_ERROR_INFO         = 8,  /* bit 8  -> 0x100 */
245 	HTT_DBG_CMN_STATS_TX_SELFGEN_INFO    = 9,  /* bit 9  -> 0x200 */
246 	HTT_DBG_CMN_STATS_TX_MU_INFO         = 10, /* bit 10 -> 0x400 */
247 	HTT_DBG_CMN_STATS_SIFS_RESP_INFO     = 11, /* bit 11 -> 0x800 */
248 	HTT_DBG_CMN_STATS_RESET_INFO         = 12, /* bit 12 -> 0x1000 */
249 	HTT_DBG_CMN_STATS_MAC_WDOG_INFO      = 13, /* bit 13 -> 0x2000 */
250 	HTT_DBG_CMN_STATS_TX_DESC_INFO       = 14, /* bit 14 -> 0x4000 */
251 	HTT_DBG_CMN_STATS_TX_FETCH_MGR_INFO  = 15, /* bit 15 -> 0x8000 */
252 	HTT_DBG_CMN_STATS_TX_PFSCHED_INFO    = 16, /* bit 16 -> 0x10000 */
253 	HTT_DBG_CMN_STATS_TX_PATH_STATS_INFO = 17, /* bit 17 -> 0x20000 */
254 	/* bits 18-23 currently reserved */
255 
256 	/* keep this last */
257 	HTT_DBG_CMN_NUM_STATS,
258 	HTT_DBG_CMN_NUM_STATS_INVALID        = 31, /* bit 31 -> 0x80000000 */
259 };
260 
261 /*
262  * cdp_host_txrx_stats: Different types of host stats
263  * @TXRX_HOST_STATS_INVALID: Invalid option
264  * @TXRX_RX_RATE_STATS: Rx rate info
265  * @TXRX_TX_RATE_STATS: Tx rate info
266  * @TXRX_TX_HOST_STATS: Print Tx stats
267  * @TXRX_RX_HOST_STATS: Print host Rx stats
268  * @TXRX_CLEAR_STATS: clear all host stats
269  * @TXRX_SRNG_PTR_STATS: Print SRNG pointer stats
270  * @TXRX_RX_MON_STATS: Print monitor mode stats
271  * @TXRX_REO_QUEUE_STATS: Print Per peer REO Queue Stats
272  * @TXRX_SOC_CFG_PARAMS: Print soc cfg params info
273  * @TXRX_PDEV_CFG_PARAMS: Print pdev cfg params info
274  * @TXRX_NAPI_STATS: Print NAPI scheduling statistics
275  * @TXRX_SOC_INTERRUPT_STATS: Print soc interrupt stats
276  * @TXRX_HAL_REG_WRITE_STATS: Hal Reg Write stats
277  */
278 enum cdp_host_txrx_stats {
279 	TXRX_HOST_STATS_INVALID  = -1,
280 	TXRX_CLEAR_STATS     = 0,
281 	TXRX_RX_RATE_STATS   = 1,
282 	TXRX_TX_RATE_STATS   = 2,
283 	TXRX_TX_HOST_STATS   = 3,
284 	TXRX_RX_HOST_STATS   = 4,
285 	TXRX_AST_STATS       = 5,
286 	TXRX_SRNG_PTR_STATS  = 6,
287 	TXRX_RX_MON_STATS    = 7,
288 	TXRX_REO_QUEUE_STATS = 8,
289 	TXRX_SOC_CFG_PARAMS   = 9,
290 	TXRX_PDEV_CFG_PARAMS  = 10,
291 	TXRX_NAPI_STATS       = 11,
292 	TXRX_SOC_INTERRUPT_STATS = 12,
293 	TXRX_SOC_FSE_STATS = 13,
294 	TXRX_HAL_REG_WRITE_STATS = 14,
295 	TXRX_HOST_STATS_MAX,
296 };
297 
298 /*
299  * cdp_ppdu_ftype: PPDU Frame Type
300  * @CDP_PPDU_FTYPE_DATA: SU or MU Data Frame
301  * @CDP_PPDU_FTYPE_CTRL: Control/Management Frames
302  * @CDP_PPDU_FTYPE_BAR: SU or MU BAR frames
303 */
304 enum cdp_ppdu_ftype {
305 	CDP_PPDU_FTYPE_CTRL,
306 	CDP_PPDU_FTYPE_DATA,
307 	CDP_PPDU_FTYPE_BAR,
308 	CDP_PPDU_FTYPE_MAX
309 };
310 
311 
312 /**
313  * @brief General specification of the tx frame contents
314  *
315  * @details
316  * for efficiency, the HTT packet type values correspond
317  * to the bit positions of the WAL packet type values, so the
318  * translation is a simple shift operation.
319  */
320 enum htt_cmn_pkt_type {
321 	htt_cmn_pkt_type_raw = 0,
322 	htt_cmn_pkt_type_native_wifi = 1,
323 	htt_cmn_pkt_type_ethernet = 2,
324 	htt_cmn_pkt_type_mgmt = 3,
325 	htt_cmn_pkt_type_eth2 = 4,
326 
327 	/* keep this last */
328 	htt_cmn_pkt_num_types
329 };
330 
331 /**
332  * @General description of HTT received packets status
333  * It is similar to htt_rx_status enum
334  * but is added as a cdp enum can be freely used in OL_IF layer
335  */
336 enum htt_cmn_rx_status {
337 	htt_cmn_rx_status_unknown = 0x0,
338 	htt_cmn_rx_status_ok,
339 	htt_cmn_rx_status_err_fcs,
340 	htt_cmn_rx_status_err_dup,
341 	htt_cmn_rx_status_err_replay,
342 	htt_cmn_rx_status_inv_peer,
343 	htt_cmn_rx_status_ctrl_mgmt_null = 0x08,
344 	htt_cmn_rx_status_tkip_mic_err = 0x09,
345 	htt_cmn_rx_status_decrypt_err = 0x0A,
346 	htt_cmn_rx_status_mpdu_length_err = 0x0B,
347 	htt_cmn_rx_status_err_misc = 0xFF
348 };
349 
350 
351 enum cdp_host_reo_dest_ring {
352     cdp_host_reo_dest_ring_unknown = 0,
353     cdp_host_reo_dest_ring_1 = 1,
354     cdp_host_reo_dest_ring_2 = 2,
355     cdp_host_reo_dest_ring_3 = 3,
356     cdp_host_reo_dest_ring_4 = 4,
357 };
358 
359 enum htt_cmn_t2h_en_stats_type {
360     /* keep this alwyas first */
361     HTT_CMN_T2H_EN_STATS_TYPE_START     = 0,
362 
363     /** ppdu_common_stats is the payload */
364     HTT_CMN_T2H_EN_STATS_TYPE_COMMON    = 1,
365     /** ppdu_sant_stats is the payload */
366     HTT_CMN_T2H_EN_STATS_TYPE_SANT      = 2,
367     /** ppdu_common_stats_v2 is the payload */
368     HTT_CMN_T2H_EN_STATS_TYPE_COMMON_V2 = 3,
369 
370     /* Keep this last */
371     HTT_CMN_T2H_EN_STATS_TYPE_END       = 0x1f,
372 };
373 
374 enum htt_cmn_t2h_en_stats_status {
375     /* Keep this first always */
376     HTT_CMN_T2H_EN_STATS_STATUS_PARTIAL     = 0,
377     HTT_CMN_T2H_EN_STATS_STATUS_PRESENT     = 1,
378     HTT_CMN_T2H_EN_STATS_STATUS_ERROR       = 2,
379     HTT_CMN_T2H_EN_STATS_STATUS_INVALID     = 3,
380 
381 
382     /* keep this always last */
383     HTT_CMN_T2H_EN_STATS_STATUS_SERIES_DONE         = 7,
384 };
385 
386 /**
387  * struct ol_txrx_peer_state - Peer state information
388  */
389 enum ol_txrx_peer_state {
390 	OL_TXRX_PEER_STATE_INVALID,
391 	OL_TXRX_PEER_STATE_DISC,    /* initial state */
392 	OL_TXRX_PEER_STATE_CONN,    /* authentication in progress */
393 	OL_TXRX_PEER_STATE_AUTH,    /* authentication successful */
394 };
395 
396 /**
397  * struct ol_txrx_ast_type - AST entry type information
398  */
399 enum cdp_txrx_ast_entry_type {
400 	CDP_TXRX_AST_TYPE_NONE,	/* static ast entry for connected peer */
401 	CDP_TXRX_AST_TYPE_STATIC, /* static ast entry for connected peer */
402 	CDP_TXRX_AST_TYPE_SELF, /* static ast entry for self peer (STA mode) */
403 	CDP_TXRX_AST_TYPE_WDS,	/* WDS peer ast entry type*/
404 	CDP_TXRX_AST_TYPE_MEC,	/* Multicast echo ast entry type */
405 	CDP_TXRX_AST_TYPE_WDS_HM, /* HM WDS entry */
406 	CDP_TXRX_AST_TYPE_STA_BSS,	 /* BSS entry(STA mode) */
407 	CDP_TXRX_AST_TYPE_DA,	/* AST entry based on Destination address */
408 	CDP_TXRX_AST_TYPE_WDS_HM_SEC, /* HM WDS entry for secondary radio */
409 	CDP_TXRX_AST_TYPE_MAX
410 };
411 
412 /*
413  * cdp_ast_free_status: status passed to callback function before freeing ast
414  * @CDP_TXRX_AST_DELETED - AST is deleted from FW and delete response received
415  * @CDP_TXRX_AST_DELETE_IN_PROGRESS - AST delete command sent to FW and host
416  *                                    is waiting for FW response
417  */
418 enum cdp_ast_free_status {
419 	CDP_TXRX_AST_DELETED,
420 	CDP_TXRX_AST_DELETE_IN_PROGRESS,
421 };
422 
423 /**
424  * txrx_ast_free_cb - callback registered for ast free
425  * @ctrl_soc: control path soc context
426  * @cdp_soc: DP soc context
427  * @cookie: cookie
428  * @cdp_ast_free_status: ast free status
429  */
430 typedef void (*txrx_ast_free_cb)(struct cdp_ctrl_objmgr_psoc *ctrl_soc,
431 				 struct cdp_soc *cdp_soc,
432 				 void *cookie,
433 				 enum cdp_ast_free_status);
434 
435 /**
436  *  struct cdp_ast_entry_info - AST entry information
437  *  @peer_mac_addr: mac address of peer on which AST entry is added
438  *  @type: ast entry type
439  *  @vdev_id: vdev_id
440  *  @pdev_id: pdev_id
441  *  @peer_id: peer_id
442  *
443  *  This structure holds the ast entry information
444  *
445  */
446 struct cdp_ast_entry_info {
447 	uint8_t peer_mac_addr[QDF_MAC_ADDR_SIZE];
448 	enum cdp_txrx_ast_entry_type type;
449 	uint8_t vdev_id;
450 	uint8_t pdev_id;
451 	uint16_t peer_id;
452 };
453 
454 #define MIC_SEQ_CTR_SIZE 6
455 
456 enum cdp_rx_frame_type {
457 	cdp_rx_frame_type_802_11,
458 	cdp_rx_frame_type_802_3,
459 };
460 
461 /**
462  *  struct cdp_rx_mic_err_info - rx mic error information
463  *  @frame_type: frame type - 0 - 802.11 frame
464  *                          - 1 - 802.3 frame
465  *  @data: 802.11 frame
466  *  @ta_mac_addr: transmitter mac address
467  *  @da_mac_addr: destination mac address
468  *  @tsc: sequence number
469  *  @key_id: Key ID
470  *  @multicast: flag for multicast
471  *  @vdev_id: vdev ID
472  *
473  *  This structure holds rx mic error information
474  *
475  */
476 struct cdp_rx_mic_err_info {
477 	uint8_t frame_type;
478 	uint8_t *data;
479 	struct qdf_mac_addr ta_mac_addr;
480 	struct qdf_mac_addr da_mac_addr;
481 	uint8_t tsc[MIC_SEQ_CTR_SIZE];
482 	uint8_t key_id;
483 	bool multicast;
484 	uint16_t vdev_id;
485 };
486 
487 /**
488  * struct cdp_sec_type - security type information
489  */
490 enum cdp_sec_type {
491     cdp_sec_type_none,
492     cdp_sec_type_wep128,
493     cdp_sec_type_wep104,
494     cdp_sec_type_wep40,
495     cdp_sec_type_tkip,
496     cdp_sec_type_tkip_nomic,
497     cdp_sec_type_aes_ccmp,
498     cdp_sec_type_wapi,
499     cdp_sec_type_aes_ccmp_256,
500     cdp_sec_type_aes_gcmp,
501     cdp_sec_type_aes_gcmp_256,
502 
503     /* keep this last! */
504     cdp_num_sec_types
505 };
506 
507 /**
508  *  struct cdp_tx_exception_metadata - Exception path parameters
509  *  @peer_id: Peer id of the peer
510  *  @tid: Transmit Identifier
511  *  @tx_encap_type: Transmit encap type (i.e. Raw, Native Wi-Fi, Ethernet)
512  *  @sec_type: sec_type to be passed to HAL
513  *  @is_tx_sniffer: Indicates if the packet has to be sniffed
514  *  @ppdu_cookie: 16-bit ppdu cookie that has to be replayed back in completions
515  *
516  *  This structure holds the parameters needed in the exception path of tx
517  *
518  */
519 struct cdp_tx_exception_metadata {
520 	uint16_t peer_id;
521 	uint8_t tid;
522 	uint16_t tx_encap_type;
523 	enum cdp_sec_type sec_type;
524 	uint8_t is_tx_sniffer;
525 	uint16_t ppdu_cookie;
526 };
527 
528 typedef struct cdp_soc_t *ol_txrx_soc_handle;
529 
530 /**
531  * ol_txrx_vdev_delete_cb - callback registered during vdev
532  * detach
533  */
534 typedef void (*ol_txrx_vdev_delete_cb)(void *context);
535 
536 /**
537  * ol_txrx_peer_unmap_sync_cb - callback registered during peer detach sync
538  */
539 typedef QDF_STATUS(*ol_txrx_peer_unmap_sync_cb)(uint8_t vdev_id,
540 						 uint32_t peer_id_cnt,
541 						 uint16_t *peer_id_list);
542 
543 /**
544  * ol_txrx_pkt_direction - Packet Direction
545  * @rx_direction: rx path packet
546  * @tx_direction: tx path packet
547  */
548 enum txrx_direction {
549 	rx_direction = 1,
550 	tx_direction = 0,
551 };
552 
553 /**
554  * cdp_capabilities- DP capabilities
555  */
556 enum cdp_capabilities {
557 	CDP_CFG_DP_TSO,
558 	CDP_CFG_DP_LRO,
559 	CDP_CFG_DP_SG,
560 	CDP_CFG_DP_GRO,
561 	CDP_CFG_DP_OL_TX_CSUM,
562 	CDP_CFG_DP_OL_RX_CSUM,
563 	CDP_CFG_DP_RAWMODE,
564 	CDP_CFG_DP_PEER_FLOW_CTRL,
565 };
566 
567 /**
568  * ol_txrx_nbuf_classify - Packet classification object
569  * @peer_id: unique peer identifier from fw
570  * @tid: traffic identifier(could be overridden)
571  * @pkt_tid: traffic identifier(cannot be overridden)
572  * @pkt_tos: ip header tos value
573  * @pkt_dscp: ip header dscp value
574  * @tos: index value in map
575  * @dscp: DSCP_TID map index
576  * @is_mcast: multicast pkt check
577  * @is_eap: eapol pkt check
578  * @is_arp: arp pkt check
579  * @is_tcp: tcp pkt check
580  * @is_dhcp: dhcp pkt check
581  * @is_igmp: igmp pkt check
582  * @is_ipv4: ip version 4 pkt check
583  * @is_ipv6: ip version 6 pkt check
584  */
585 struct ol_txrx_nbuf_classify {
586 	uint16_t peer_id;
587 	uint8_t tid;
588 	uint8_t pkt_tid;
589 	uint8_t pkt_tos;
590 	uint8_t pkt_dscp;
591 	uint8_t tos;
592 	uint8_t dscp;
593 	uint8_t is_mcast;
594 	uint8_t is_eap;
595 	uint8_t is_arp;
596 	uint8_t is_tcp;
597 	uint8_t is_dhcp;
598 	uint8_t is_igmp;
599 	uint8_t is_ipv4;
600 	uint8_t is_ipv6;
601 };
602 
603 /**
604  * ol_osif_vdev_handle - paque handle for OS shim virtual device
605  * object
606  */
607 struct ol_osif_vdev_t;
608 typedef struct ol_osif_vdev_t *ol_osif_vdev_handle;
609 
610 /**
611  * wlan_op_mode - Virtual device operation mode
612  * @wlan_op_mode_unknown: Unknown mode
613  * @wlan_op_mode_ap: AP mode
614  * @wlan_op_mode_ibss: IBSS mode
615  * @wlan_op_mode_sta: STA (client) mode
616  * @wlan_op_mode_monitor: Monitor mode
617  * @wlan_op_mode_ocb: OCB mode
618  */
619 enum wlan_op_mode {
620 	wlan_op_mode_unknown,
621 	wlan_op_mode_ap,
622 	wlan_op_mode_ibss,
623 	wlan_op_mode_sta,
624 	wlan_op_mode_monitor,
625 	wlan_op_mode_ocb,
626 	wlan_op_mode_ndi,
627 };
628 
629 /**
630  * enum wlan_op_subtype - Virtual device subtype
631  * @wlan_op_subtype_none: Subtype not applicable
632  * @wlan_op_subtype_p2p_device: P2P device
633  * @wlan_op_subtye_p2p_cli: P2P Client
634  * @wlan_op_subtype_p2p_go: P2P GO
635  *
636  * This enum lists the subtypes of a particular virtual
637  * device.
638  */
639 enum wlan_op_subtype {
640 	wlan_op_subtype_none,
641 	wlan_op_subtype_p2p_device,
642 	wlan_op_subtype_p2p_cli,
643 	wlan_op_subtype_p2p_go,
644 };
645 
646 /**
647  * connectivity_stats_pkt_status - data pkt type
648  * @PKT_TYPE_REQ: Request packet
649  * @PKT_TYPE_RSP: Response packet
650  * @PKT_TYPE_TX_DROPPED: TX packet dropped
651  * @PKT_TYPE_RX_DROPPED: RX packet dropped
652  * @PKT_TYPE_RX_DELIVERED: RX packet delivered
653  * @PKT_TYPE_RX_REFUSED: RX packet refused
654  * @PKT_TYPE_TX_HOST_FW_SENT: TX packet FW sent
655  * @PKT_TYPE_TX_ACK_CNT:TC packet acked
656  * @PKT_TYPE_NONE: Invalid packet
657  */
658 enum connectivity_stats_pkt_status {
659 	PKT_TYPE_REQ,
660 	PKT_TYPE_RSP,
661 	PKT_TYPE_TX_DROPPED,
662 	PKT_TYPE_RX_DROPPED,
663 	PKT_TYPE_RX_DELIVERED,
664 	PKT_TYPE_RX_REFUSED,
665 	PKT_TYPE_TX_HOST_FW_SENT,
666 	PKT_TYPE_TX_ACK_CNT,
667 	PKT_TYPE_NONE,
668 };
669 
670 /**
671  * ol_txrx_mgmt_tx_cb - tx management delivery notification
672  * callback function
673  */
674 typedef void
675 (*ol_txrx_mgmt_tx_cb)(void *ctxt, qdf_nbuf_t tx_mgmt_frm, int had_error);
676 
677 /**
678  * ol_txrx_data_tx_cb - Function registered with the data path
679  * that is called when tx frames marked as "no free" are
680  * done being transmitted
681  */
682 typedef void
683 (*ol_txrx_data_tx_cb)(void *ctxt, qdf_nbuf_t tx_frm, int had_error);
684 
685 /**
686  * ol_txrx_tx_fp - top-level transmit function
687  * @soc - dp soc handle
688  * @vdev_id - handle to the virtual device object
689  * @msdu_list - list of network buffers
690  */
691 typedef qdf_nbuf_t (*ol_txrx_tx_fp)(struct cdp_soc_t *soc, uint8_t vdev_id,
692 				    qdf_nbuf_t msdu_list);
693 
694 /**
695  * ol_txrx_tx_exc_fp - top-level transmit function on exception path
696  * @soc - dp soc handle
697  * @vdev_id - handle to the virtual device object
698  * @msdu_list - list of network buffers
699  * @tx_exc_metadata - structure that holds parameters to exception path
700  */
701 typedef qdf_nbuf_t (*ol_txrx_tx_exc_fp)(struct cdp_soc_t *soc, uint8_t vdev_id,
702 					qdf_nbuf_t msdu_list,
703 					struct cdp_tx_exception_metadata
704 						*tx_exc_metadata);
705 
706 /**
707  * ol_txrx_completion_fp - top-level transmit function
708  * for tx completion
709  * @skb: skb data
710  * @osif_dev: the virtual device's OS shim object
711  * @flag: flag
712  */
713 typedef void (*ol_txrx_completion_fp)(qdf_nbuf_t skb,
714 				      void *osif_dev, uint16_t flag);
715 /**
716  * ol_txrx_tx_flow_control_fp - tx flow control notification
717  * function from txrx to OS shim
718  * @osif_dev - the virtual device's OS shim object
719  * @tx_resume - tx os q should be resumed or not
720  */
721 typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev,
722 					    bool tx_resume);
723 
724 /**
725  * ol_txrx_tx_flow_control_is_pause_fp - is tx paused by flow control
726  * function from txrx to OS shim
727  * @osif_dev - the virtual device's OS shim object
728  *
729  * Return: true if tx is paused by flow control
730  */
731 typedef bool (*ol_txrx_tx_flow_control_is_pause_fp)(void *osif_dev);
732 
733 /**
734  * ol_txrx_rx_fp - receive function to hand batches of data
735  * frames from txrx to OS shim
736  * @data_vdev - handle to the OSIF virtual device object
737  * @msdu_list - list of network buffers
738  */
739 typedef QDF_STATUS(*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list);
740 
741 typedef QDF_STATUS(*ol_txrx_fisa_rx_fp)(void *soc,
742 					void *dp_vdev,
743 					qdf_nbuf_t msdu_list);
744 
745 typedef QDF_STATUS(*ol_txrx_fisa_flush_fp)(void *soc, int ring_num);
746 /**
747  * ol_txrx_rx_flush_fp - receive function to hand batches of data
748  * frames from txrx to OS shim
749  * @osif_dev: handle to the OSIF virtual device object
750  * @vdev_id: vdev_if of the packets to be flushed
751  */
752 typedef QDF_STATUS(*ol_txrx_rx_flush_fp)(void *osif_dev, uint8_t vdev_id);
753 
754 /**
755  * ol_txrx_rx_gro_flush_ind - function to send GRO flush indication to stack
756  * for a given RX Context Id.
757  * @osif_dev - handle to the OSIF virtual device object
758  * @rx_ctx_id - Rx context Id for which gro flush should happen
759  */
760 typedef QDF_STATUS(*ol_txrx_rx_gro_flush_ind_fp)(void *osif_dev,
761 						 int rx_ctx_id);
762 
763 /**
764  * ol_txrx_stats_rx_fp - receive function to hand batches of data
765  * frames from txrx to OS shim
766  * @skb: skb data
767  * @osif_dev: the virtual device's OS shim object
768  * @action: data packet type
769  * @pkt_type: packet data type
770  */
771 typedef void (*ol_txrx_stats_rx_fp)(struct sk_buff *skb,
772 		void *osif_dev, enum connectivity_stats_pkt_status action,
773 		uint8_t *pkt_type);
774 
775 /**
776  * ol_txrx_get_key_fp - function to gey key based on keyix and peer
777  * mac address
778  * @osif_dev - the virtual device's OS shim object
779  * @key_buf - pointer to store key
780  * @mac_addr - pointer to mac address
781  * @keyix - key id
782  */
783 typedef QDF_STATUS(*ol_txrx_get_key_fp)(void *osif_dev, uint8_t *key_buf, uint8_t *mac_addr, uint8_t keyix);
784 
785 /**
786  * ol_txrx_rsim_rx_decap_fp - raw mode simulation function to decap the
787  * packets in receive path.
788  * @osif_dev  - the virtual device's OS shim object
789  * @list_head - poniter to head of receive packet queue to decap
790  * @list_tail - poniter to tail of receive packet queue to decap
791  * @peer_mac  - mac address of peer handler
792  */
793 typedef QDF_STATUS(*ol_txrx_rsim_rx_decap_fp)(void *osif_dev,
794 						qdf_nbuf_t *list_head,
795 						qdf_nbuf_t *list_tail,
796 						uint8_t *peer_mac);
797 
798 /* ol_txrx_rx_fp - external tx free function to read per packet stats and
799  *                            free tx buffer externally
800  * @netbuf - tx network buffer
801  */
802 typedef void (*ol_txrx_tx_free_ext_fp)(qdf_nbuf_t netbuf);
803 
804 /**
805  * ol_txrx_rx_check_wai_fp - OSIF WAPI receive function
806 */
807 typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev,
808 					    qdf_nbuf_t mpdu_head,
809 					    qdf_nbuf_t mpdu_tail);
810 /**
811  * ol_txrx_rx_mon_fp - OSIF monitor mode receive function for single
812  * MPDU (802.11 format)
813  */
814 typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev,
815 					    qdf_nbuf_t mpdu,
816 					    void *rx_status);
817 
818 /**
819  * ol_txrx_proxy_arp_fp - proxy arp function pointer
820 */
821 typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev,
822 					    qdf_nbuf_t netbuf);
823 
824 /*
825  * ol_txrx_mcast_me_fp - function pointer for multicast enhancement
826  */
827 typedef int (*ol_txrx_mcast_me_fp)(ol_osif_vdev_handle vdev,
828 						qdf_nbuf_t netbuf);
829 
830 /**
831  * ol_txrx_stats_callback - statistics notify callback
832  */
833 typedef void (*ol_txrx_stats_callback)(void *ctxt,
834 				       enum htt_cmn_dbg_stats_type type,
835 				       uint8_t *buf, int bytes);
836 
837 /**
838  * ol_txrx_pktdump_cb - callback for packet dump feature
839  */
840 typedef void (*ol_txrx_pktdump_cb)(ol_txrx_soc_handle soc,
841 				   uint8_t pdev_id,
842 				   uint8_t vdev_id,
843 				   qdf_nbuf_t netbuf,
844 				   uint8_t status,
845 				   uint8_t type);
846 
847 /**
848  * ol_txrx_ops - (pointers to) the functions used for tx and rx
849  * data xfer
850  *
851  * There are two portions of these txrx operations.
852  * The rx portion is filled in by OSIF SW before calling
853  * ol_txrx_osif_vdev_register; inside the ol_txrx_osif_vdev_register
854  * the txrx SW stores a copy of these rx function pointers, to use
855  * as it delivers rx data frames to the OSIF SW.
856  * The tx portion is filled in by the txrx SW inside
857  * ol_txrx_osif_vdev_register; when the function call returns,
858  * the OSIF SW stores a copy of these tx functions to use as it
859  * delivers tx data frames to the txrx SW.
860  *
861  * @tx.std -  the tx function pointer for standard data
862  * frames This function pointer is set by the txrx SW
863  * perform host-side transmit operations based on
864  * whether a HL or LL host/target interface is in use.
865  * @tx.flow_control_cb - the transmit flow control
866  * function that is registered by the
867  * OSIF which is called from txrx to
868  * indicate whether the transmit OS
869  * queues should be paused/resumed
870  * @rx.rx - the OS shim rx function to deliver rx data
871  * frames to. This can have different values for
872  * different virtual devices, e.g. so one virtual
873  * device's OS shim directly hands rx frames to the OS,
874  * but another virtual device's OS shim filters out P2P
875  * messages before sending the rx frames to the OS. The
876  * netbufs delivered to the osif_rx function are in the
877  * format specified by the OS to use for tx and rx
878  * frames (either 802.3 or native WiFi). In case RX Threads are enabled, pkts
879  * are given to the thread, instead of the stack via this pointer.
880  * @rx.stack - function to give packets to the stack. Differs from @rx.rx.
881  * In case RX Threads are enabled, this pointer holds the callback to give
882  * packets to the stack.
883  * @rx.rx_gro_flush - GRO flush indication to stack for a given RX CTX ID
884  * @rx.wai_check - the tx function pointer for WAPI frames
885  * @rx.mon - the OS shim rx monitor function to deliver
886  * monitor data to Though in practice, it is probable
887  * that the same function will be used for delivering
888  * rx monitor data for all virtual devices, in theory
889  * each different virtual device can have a different
890  * OS shim function for accepting rx monitor data. The
891  * netbufs delivered to the osif_rx_mon function are in
892  * 802.11 format.  Each netbuf holds a 802.11 MPDU, not
893  * an 802.11 MSDU. Depending on compile-time
894  * configuration, each netbuf may also have a
895  * monitor-mode encapsulation header such as a radiotap
896  * header added before the MPDU contents.
897  * @rx.std - the OS shim rx function to deliver rx data
898  * @proxy_arp - proxy arp function pointer - specified by
899  * OS shim, stored by txrx
900  * @get_key - function pointer to get key of the peer with
901  * specific key index
902  */
903 struct ol_txrx_ops {
904 	/* tx function pointers - specified by txrx, stored by OS shim */
905 	struct {
906 		ol_txrx_tx_fp         tx;
907 		ol_txrx_tx_exc_fp     tx_exception;
908 		ol_txrx_tx_free_ext_fp tx_free_ext;
909 		ol_txrx_completion_fp tx_comp;
910 	} tx;
911 
912 	/* rx function pointers - specified by OS shim, stored by txrx */
913 	struct {
914 		ol_txrx_rx_fp           rx;
915 		ol_txrx_rx_fp           rx_stack;
916 		ol_txrx_rx_flush_fp     rx_flush;
917 		ol_txrx_rx_gro_flush_ind_fp           rx_gro_flush;
918 		ol_txrx_rx_check_wai_fp wai_check;
919 		ol_txrx_rx_mon_fp       mon;
920 		ol_txrx_stats_rx_fp           stats_rx;
921 		ol_txrx_rsim_rx_decap_fp rsim_rx_decap;
922 		ol_txrx_fisa_rx_fp	osif_fisa_rx;
923 		ol_txrx_fisa_flush_fp   osif_fisa_flush;
924 	} rx;
925 	/* proxy arp function pointer - specified by OS shim, stored by txrx */
926 	ol_txrx_proxy_arp_fp      proxy_arp;
927 	ol_txrx_mcast_me_fp          me_convert;
928 
929 	ol_txrx_get_key_fp  get_key;
930 };
931 
932 /**
933  * ol_txrx_stats_req - specifications of the requested
934  * statistics
935  */
936 struct ol_txrx_stats_req {
937 	uint32_t stats_type_upload_mask;        /* which stats to upload */
938 	uint32_t stats_type_reset_mask; /* which stats to reset */
939 
940 	/* stats will be printed if either print element is set */
941 	struct {
942 		int verbose;    /* verbose stats printout */
943 		int concise;    /* concise stats printout (takes precedence) */
944 	} print;                /* print uploaded stats */
945 
946 	/* stats notify callback will be invoked if fp is non-NULL */
947 	struct {
948 		ol_txrx_stats_callback fp;
949 		void *ctxt;
950 	} callback;
951 
952 	/* stats will be copied into the specified buffer if buf is non-NULL */
953 	struct {
954 		uint8_t *buf;
955 		int byte_limit; /* don't copy more than this */
956 	} copy;
957 
958 	/*
959 	 * If blocking is true, the caller will take the specified semaphore
960 	 * to wait for the stats to be uploaded, and the driver will release
961 	 * the semaphore when the stats are done being uploaded.
962 	 */
963 	struct {
964 		int blocking;
965 		/*Note: this needs to change to some qdf_* type */
966 		qdf_semaphore_t *sem_ptr;
967 	} wait;
968 };
969 
970 
971 /* DP soc struct definition */
972 struct cdp_soc_t {
973 	struct cdp_ops *ops;
974 	struct ol_if_ops *ol_ops;
975 };
976 
977 /*
978  * cdp_peer_param_type: different types of parameters
979  *			to set values in peer
980  * @CDP_CONFIG_NAWDS: Enable nawds mode
981  * @CDP_CONFIG_NAC: Enable nac
982  * @CDP_CONFIG_ISOLATION : Enable isolation
983  * @CDP_CONFIG_IN_TWT : In TWT session or not
984  */
985 enum cdp_peer_param_type {
986 	CDP_CONFIG_NAWDS,
987 	CDP_CONFIG_NAC,
988 	CDP_CONFIG_ISOLATION,
989 	CDP_CONFIG_IN_TWT,
990 };
991 
992 /*
993  * cdp_pdev_param_type: different types of parameters
994  *			to set values in pdev
995  * @CDP_CONFIG_DEBUG_SNIFFER: Enable debug sniffer feature
996  * @CDP_CONFIG_BPR_ENABLE: Enable bcast probe feature
997  * @CDP_CONFIG_PRIMARY_RADIO: Configure radio as primary
998  * @CDP_CONFIG_ENABLE_PERPKT_TXSTATS: Enable per packet statistics
999  * @CDP_CONFIG_IGMPMLD_OVERRIDE: Override IGMP/MLD
1000  * @CDP_CONFIG_IGMPMLD_TID: Configurable TID value when igmmld_override is set
1001  * @CDP_CONFIG_ARP_DBG_CONF: Enable ARP debug
1002  * @CDP_CONFIG_CAPTURE_LATENCY: Capture time latency
1003  * @CDP_INGRESS_STATS: Accumulate ingress statistics
1004  * @CDP_OSIF_DROP: Accumulate drops in OSIF layer
1005  * @CDP_CONFIG_ENH_RX_CAPTURE: Enable enhanced RX capture
1006  * @CDP_CONFIG_ENH_TX_CAPTURE: Enable enhanced TX capture
1007  * @CDP_CONFIG_HMMC_TID_OVERRIDE: Enable hmmc tid override
1008  * @CDP_CONFIG_HMMC_TID_VALUE: set hmmc tid value
1009  * @CDP_CONFIG_TX_CAPTURE: set tx capture
1010  * @CDP_CHAN_NOISE_FLOOR: set channel noise floor
1011  * @CDP_CONFIG_VOW: set/get vow config
1012  * @CDP_TIDQ_OVERRIDE: set/get tid queue override
1013  * @CDP_TIDMAP_PRTY: set/get tid map prty
1014  * @CDP_TX_PENDING: get tx pending
1015  * @CDP_FILTER_NEIGH_PEERS: filter neighbour peers
1016  * @CDP_FILTER_UCAST_DATA: filter unicast data
1017  * @CDP_FILTER_MCAST_DATA: filter multicast data
1018  * @CDP_FILTER_NO_DATA: filter no data
1019  * @CDP_MONITOR_CHANNEL: monitor channel
1020  * @CDP_MONITOR_FREQUENCY: monitor frequency
1021  * @CDP_CONFIG_BSS_COLOR: configure bss color
1022  * @CDP_SET_ATF_STATS_ENABLE: set ATF stats flag
1023  */
1024 enum cdp_pdev_param_type {
1025 	CDP_CONFIG_DEBUG_SNIFFER,
1026 	CDP_CONFIG_BPR_ENABLE,
1027 	CDP_CONFIG_PRIMARY_RADIO,
1028 	CDP_CONFIG_ENABLE_PERPKT_TXSTATS,
1029 	CDP_CONFIG_IGMPMLD_OVERRIDE,
1030 	CDP_CONFIG_IGMPMLD_TID,
1031 	CDP_CONFIG_ARP_DBG_CONF,
1032 	CDP_CONFIG_CAPTURE_LATENCY,
1033 	CDP_INGRESS_STATS,
1034 	CDP_OSIF_DROP,
1035 	CDP_CONFIG_ENH_RX_CAPTURE,
1036 	CDP_CONFIG_ENH_TX_CAPTURE,
1037 	CDP_CONFIG_HMMC_TID_OVERRIDE,
1038 	CDP_CONFIG_HMMC_TID_VALUE,
1039 	CDP_CONFIG_TX_CAPTURE,
1040 	CDP_CHAN_NOISE_FLOOR,
1041 	CDP_CONFIG_VOW,
1042 	CDP_TIDQ_OVERRIDE,
1043 	CDP_TIDMAP_PRTY,
1044 	CDP_TX_PENDING,
1045 	CDP_FILTER_NEIGH_PEERS,
1046 	CDP_FILTER_UCAST_DATA,
1047 	CDP_FILTER_MCAST_DATA,
1048 	CDP_FILTER_NO_DATA,
1049 	CDP_MONITOR_CHANNEL,
1050 	CDP_MONITOR_FREQUENCY,
1051 	CDP_CONFIG_BSS_COLOR,
1052 	CDP_SET_ATF_STATS_ENABLE,
1053 };
1054 
1055 /*
1056  * cdp_config_param_type: union of different types of parameters
1057  *			to set values into dp handles.
1058  *
1059  * @cdp_peer_param_nawds: Enable nawds mode
1060  * @cdp_peer_param_isolation: Enable isolation
1061  * @cdp_peer_param_in_twt: in TWT session or not
1062  * @cdp_peer_param_nac: Enable nac
1063  *
1064  * @cdp_vdev_param_nawds: set nawds enable/disable
1065  * @cdp_vdev_param_mcast_en: enable/disable multicast enhancement
1066  * @cdp_vdev_param_wds: wds sta
1067  * @cdp_vdev_param_mec: MEC enable flags
1068  * @cdp_vdev_param_proxysta: proxy sta
1069  * @cdp_vdev_param_tdls_flags: tdls link flags
1070  * @cdp_vdev_param_ap_brdg_en: set ap_bridging enable/disable
1071  * @cdp_vdev_param_cipher_en: set cipher type based on security
1072  * @cdp_vdev_param_qwrap_isolation: qwrap isolation mode
1073  * @cdp_vdev_param_tx_encap: tx encap type
1074  * @cdp_vdev_param_rx_decap: rx decap type
1075  * @cdp_vdev_param_mesh_rx_filter: set mesh rx filter
1076  * @cdp_vdev_param_tidmap_prty: set tid vdev prty
1077  * @cdp_vdev_param_tidmap_tbl_id: set tidmap table id
1078  * @cdp_vdev_param_mesh_mode: set mesh mode
1079  * @cdp_vdev_param_safe_mode: set safe mode
1080  * @cdp_vdev_param_drop_unenc: set drop unencrypted flag
1081  *
1082  * @cdp_pdev_param_dbg_snf: Enable debug sniffer feature
1083  * @cdp_pdev_param_bpr_enable: Enable bcast probe feature
1084  * @cdp_pdev_param_primary_radio: Configure radio as primary
1085  * @cdp_pdev_param_en_perpkt_txstats: Enable per packet statistics
1086  * @cdp_pdev_param_igmpmld_override: Override IGMP/MLD
1087  * @cdp_pdev_param_igmpmld_tid: TID value when igmmld_override is set
1088  * @cdp_pdev_param_arp_dbg_conf: Enable ARP debug
1089  * @cdp_pdev_param_cptr_latcy: Capture time latency
1090  * @cdp_pdev_param_ingrs_stats: Accumulate ingress statistics
1091  * @cdp_pdev_param_osif_drop: Accumulate drops in OSIF layer
1092  * @cdp_pdev_param_en_rx_cap: Enable enhanced RX capture
1093  * @cdp_pdev_param_en_tx_cap: Enable enhanced TX capture
1094  * @cdp_pdev_param_hmmc_tid_ovrd: Enable hmmc tid override
1095  * @cdp_pdev_param_hmmc_tid: set hmmc tid value
1096  * @cdp_pdev_param_tx_capture: set tx capture
1097  * @cdp_pdev_param_chn_noise_flr: set channel noise floor
1098  * @cdp_pdev_param_cfg_vow: set/get vow config
1099  * @cdp_pdev_param_tidq_override: set/get tid queue override
1100  * @cdp_pdev_param_mon_freq: set monitor frequency
1101  * @cdp_pdev_param_bss_color: configure bss color
1102  * @cdp_pdev_param_tidmap_prty: set/get tid map prty
1103  * @cdp_pdev_param_tx_pending: get tx pending
1104  * @cdp_pdev_param_fltr_neigh_peers: filter neighbour peers
1105  * @cdp_pdev_param_fltr_ucast: filter unicast data
1106  * @cdp_pdev_param_fltr_mcast: filter multicast data
1107  * @cdp_pdev_param_fltr_none: filter no data
1108  * @cdp_pdev_param_monitor_chan: monitor channel
1109  * @cdp_pdev_param_atf_stats_enable: ATF stats enable
1110  *
1111  * @cdp_psoc_param_en_rate_stats: set rate stats enable/disable
1112  * @cdp_psoc_param_en_nss_cfg: set nss cfg
1113  */
1114 typedef union cdp_config_param_t {
1115 	/* peer params */
1116 	bool cdp_peer_param_nawds;
1117 	bool cdp_peer_param_isolation;
1118 	uint8_t cdp_peer_param_nac;
1119 	bool cdp_peer_param_in_twt;
1120 
1121 	/* vdev params */
1122 	bool cdp_vdev_param_wds;
1123 	bool cdp_vdev_param_mec;
1124 	bool cdp_vdev_param_nawds;
1125 	bool cdp_vdev_param_proxysta;
1126 	bool cdp_vdev_param_tdls_flags;
1127 	bool cdp_vdev_param_ap_brdg_en;
1128 	bool cdp_vdev_param_qwrap_isolation;
1129 	bool cdp_vdev_param_update_multipass;
1130 	uint8_t cdp_vdev_param_da_war;
1131 	uint8_t cdp_vdev_param_mcast_en;
1132 	uint8_t cdp_vdev_param_tidmap_prty;
1133 	uint8_t cdp_vdev_param_tidmap_tbl_id;
1134 	uint32_t cdp_vdev_param_aging_tmr;
1135 	uint32_t cdp_vdev_param_cipher_en;
1136 	uint32_t cdp_vdev_param_tx_encap;
1137 	uint32_t cdp_vdev_param_rx_decap;
1138 	uint32_t cdp_vdev_param_mesh_rx_filter;
1139 	uint32_t cdp_vdev_param_mesh_mode;
1140 	uint32_t cdp_vdev_param_safe_mode;
1141 	uint32_t cdp_vdev_param_drop_unenc;
1142 
1143 	/* pdev params */
1144 	bool cdp_pdev_param_cptr_latcy;
1145 	bool cdp_pdev_param_hmmc_tid_ovrd;
1146 	bool cdp_pdev_param_fltr_neigh_peers;
1147 	bool cdp_pdev_param_cfg_vow;
1148 	bool cdp_pdev_param_fltr_mcast;
1149 	bool cdp_pdev_param_fltr_none;
1150 	bool cdp_pdev_param_fltr_ucast;
1151 	uint8_t cdp_pdev_param_primary_radio;
1152 	uint8_t cdp_pdev_param_en_rx_cap;
1153 	uint8_t cdp_pdev_param_en_tx_cap;
1154 	uint8_t cdp_pdev_param_tx_capture;
1155 	uint8_t cdp_pdev_param_hmmc_tid;
1156 	uint8_t cdp_pdev_param_tidmap_prty;
1157 	uint8_t cdp_pdev_param_igmpmld_override;
1158 	uint8_t cdp_pdev_param_igmpmld_tid;
1159 	uint8_t cdp_pdev_param_arp_dbg_conf;
1160 	uint8_t cdp_pdev_param_tidq_override;
1161 	uint8_t cdp_pdev_param_bss_color;
1162 	uint16_t cdp_pdev_param_chn_noise_flr;
1163 	qdf_freq_t cdp_pdev_param_mon_freq;
1164 	int cdp_pdev_param_dbg_snf;
1165 	int cdp_pdev_param_bpr_enable;
1166 	int cdp_pdev_param_monitor_chan;
1167 	uint32_t cdp_pdev_param_ingrs_stats;
1168 	uint32_t cdp_pdev_param_osif_drop;
1169 	uint32_t cdp_pdev_param_en_perpkt_txstats;
1170 	uint32_t cdp_pdev_param_tx_pending;
1171 	bool cdp_pdev_param_atf_stats_enable;
1172 
1173 	/* psoc params */
1174 	bool cdp_psoc_param_en_rate_stats;
1175 	int cdp_psoc_param_en_nss_cfg;
1176 	int cdp_psoc_param_preferred_hw_mode;
1177 	bool cdp_psoc_param_pext_stats;
1178 } cdp_config_param_type;
1179 
1180 /**
1181  * cdp_rx_enh_capture_mode - Rx enhanced capture modes
1182  * @CDP_RX_ENH_CAPTURE_DISABLED: Disable Rx enhance capture
1183  * @CDP_RX_ENH_CAPTURE_MPDU: Enable capture of 128 bytes of each MPDU
1184  * @CDP_RX_ENH_CAPTURE_MPDU_MSDU: Enable capture of 128 bytes of each MSDU
1185  */
1186 enum cdp_rx_enh_capture_mode {
1187 	CDP_RX_ENH_CAPTURE_DISABLED = 0,
1188 	CDP_RX_ENH_CAPTURE_MPDU,
1189 	CDP_RX_ENH_CAPTURE_MPDU_MSDU,
1190 };
1191 
1192 /**
1193  * cdp_rx_enh_capture_peer - Rx enhanced capture peer filtering
1194  * @CDP_RX_ENH_CAPTURE_PEER_DISABLED: Disable Rx ENH capture peer filtering
1195  * @CDP_RX_ENH_CAPTURE_PEER_ENABLED: Enable Rx ENH capture peer filtering
1196  */
1197 enum cdp_rx_enh_capture_peer {
1198 	CDP_RX_ENH_CAPTURE_PEER_DISABLED = 0,
1199 	CDP_RX_ENH_CAPTURE_PEER_ENABLED,
1200 };
1201 
1202 /**
1203  * cdp_tx_enh_capture_mode - Tx enhanced capture modes
1204  * @CDP_TX_ENH_CAPTURE_DISABLED: Disable Tx enhance capture for all peers
1205  * @CDP_TX_ENH_CAPTURE_ENABLE_ALL_PEERS: Enable tx capture for all peers
1206  * @CDP_TX_ENH_CAPTURE_ENDIS_PER_PEER: Enable/disable per peer as necessary
1207  */
1208 enum cdp_tx_enh_capture_mode {
1209 	CDP_TX_ENH_CAPTURE_DISABLED = 0,
1210 	CDP_TX_ENH_CAPTURE_ENABLE_ALL_PEERS,
1211 	CDP_TX_ENH_CAPTURE_ENDIS_PER_PEER,
1212 	CDP_TX_ENH_CAPTURE_MAX,
1213 };
1214 
1215 /*
1216  * enum cdp_pdev_bpr_param - different types of parameters
1217  *			     to set value in pdev
1218  * @CDP_BPR_DISABLE: Set bpr to disable state
1219  * @CDP_BPR_ENABLE: set bpr to enable state
1220  *
1221  * Enum indicating bpr state to enable/disable.
1222  */
1223 enum cdp_pdev_bpr_param {
1224 	CDP_BPR_DISABLE,
1225 	CDP_BPR_ENABLE,
1226 };
1227 
1228 /*
1229  * cdp_vdev_param_type: different types of parameters
1230  *			to set values in vdev
1231  * @CDP_ENABLE_NAWDS: set nawds enable/disable
1232  * @CDP_ENABLE_MCAST_EN: enable/disable multicast enhancement
1233  * @CDP_ENABLE_WDS: wds sta
1234  * @CDP_ENABLE_MEC: MEC enable flags
1235  * @CDP_ENABLE_PROXYSTA: proxy sta
1236  * @CDP_UPDATE_TDLS_FLAGS: tdls link flags
1237  * @CDP_ENABLE_AP_BRIDGE: set ap_bridging enable/disable
1238  * @CDP_ENABLE_CIPHER : set cipher type based on security
1239  * @CDP_ENABLE_QWRAP_ISOLATION: qwrap isolation mode
1240  * @CDP_TX_ENCAP_TYPE: tx encap type
1241  * @CDP_RX_DECAP_TYPE: rx decap type
1242  * @CDP_MESH_RX_FILTER: set mesh rx filter
1243  * @CDP_TID_VDEV_PRTY: set tid vdev prty
1244  * @CDP_TIDMAP_TBL_ID: set tidmap table id
1245  * @CDP_MESH_MODE: set mesh mode
1246  * @CDP_SAFEMODE: set safe mode
1247  * @CDP_DROP_UNENC: set drop unencrypted flag
1248  */
1249 enum cdp_vdev_param_type {
1250 	CDP_ENABLE_NAWDS,
1251 	CDP_ENABLE_MCAST_EN,
1252 	CDP_ENABLE_WDS,
1253 	CDP_ENABLE_MEC,
1254 	CDP_ENABLE_DA_WAR,
1255 	CDP_ENABLE_PROXYSTA,
1256 	CDP_UPDATE_TDLS_FLAGS,
1257 	CDP_CFG_WDS_AGING_TIMER,
1258 	CDP_ENABLE_AP_BRIDGE,
1259 	CDP_ENABLE_CIPHER,
1260 	CDP_ENABLE_QWRAP_ISOLATION,
1261 	CDP_UPDATE_MULTIPASS,
1262 	CDP_TX_ENCAP_TYPE,
1263 	CDP_RX_DECAP_TYPE,
1264 	CDP_MESH_RX_FILTER,
1265 	CDP_TID_VDEV_PRTY,
1266 	CDP_TIDMAP_TBL_ID,
1267 #ifdef MESH_MODE_SUPPORT
1268 	CDP_MESH_MODE,
1269 #endif
1270 	CDP_SAFEMODE,
1271 	CDP_DROP_UNENC,
1272 };
1273 
1274 /*
1275  * cdp_psoc_param_type: different types of parameters
1276  *			to set values in psoc
1277  * @CDP_ENABLE_RATE_STATS: set rate stats enable/disable
1278  * @CDP_SET_NSS_CFG: set nss cfg
1279  * @CDP_SET_PREFERRED_HW_MODE: set preferred hw mode
1280  * @CDP_CFG_PEER_EXT_STATS: Peer extended stats mode.
1281  */
1282 enum cdp_psoc_param_type {
1283 	CDP_ENABLE_RATE_STATS,
1284 	CDP_SET_NSS_CFG,
1285 	CDP_SET_PREFERRED_HW_MODE,
1286 	CDP_CFG_PEER_EXT_STATS,
1287 };
1288 
1289 #define TXRX_FW_STATS_TXSTATS                     1
1290 #define TXRX_FW_STATS_RXSTATS                     2
1291 #define TXRX_FW_STATS_RX_RATE_INFO                3
1292 #define TXRX_FW_STATS_PHYSTATS                    4
1293 #define TXRX_FW_STATS_PHYSTATS_CONCISE            5
1294 #define TXRX_FW_STATS_TX_RATE_INFO                6
1295 #define TXRX_FW_STATS_TID_STATE                   7
1296 #define TXRX_FW_STATS_HOST_STATS                  8
1297 #define TXRX_FW_STATS_CLEAR_HOST_STATS            9
1298 #define TXRX_FW_STATS_CE_STATS                   10
1299 #define TXRX_FW_STATS_VOW_UMAC_COUNTER           11
1300 #define TXRX_FW_STATS_ME_STATS                   12
1301 #define TXRX_FW_STATS_TXBF_INFO                  13
1302 #define TXRX_FW_STATS_SND_INFO                   14
1303 #define TXRX_FW_STATS_ERROR_INFO                 15
1304 #define TXRX_FW_STATS_TX_SELFGEN_INFO            16
1305 #define TXRX_FW_STATS_TX_MU_INFO                 17
1306 #define TXRX_FW_SIFS_RESP_INFO                   18
1307 #define TXRX_FW_RESET_STATS                      19
1308 #define TXRX_FW_MAC_WDOG_STATS                   20
1309 #define TXRX_FW_MAC_DESC_STATS                   21
1310 #define TXRX_FW_MAC_FETCH_MGR_STATS              22
1311 #define TXRX_FW_MAC_PREFETCH_MGR_STATS           23
1312 #define TXRX_FW_STATS_DURATION_INFO              24
1313 #define TXRX_FW_STATS_DURATION_INFO_RESET        25
1314 #define TXRX_FW_HALPHY_STATS                     26
1315 #define TXRX_FW_COEX_STATS                       27
1316 
1317 #define PER_RADIO_FW_STATS_REQUEST 0
1318 #define PER_VDEV_FW_STATS_REQUEST 1
1319 /**
1320  * enum data_stall_log_event_indicator - Module triggering data stall
1321  * @DATA_STALL_LOG_INDICATOR_UNUSED: Unused
1322  * @DATA_STALL_LOG_INDICATOR_HOST_DRIVER: Host driver indicates data stall
1323  * @DATA_STALL_LOG_INDICATOR_FIRMWARE: FW indicates data stall
1324  * @DATA_STALL_LOG_INDICATOR_FRAMEWORK: Framework indicates data stall
1325  *
1326  * Enum indicating the module that indicates data stall event
1327  */
1328 enum data_stall_log_event_indicator {
1329 	DATA_STALL_LOG_INDICATOR_UNUSED,
1330 	DATA_STALL_LOG_INDICATOR_HOST_DRIVER,
1331 	DATA_STALL_LOG_INDICATOR_FIRMWARE,
1332 	DATA_STALL_LOG_INDICATOR_FRAMEWORK,
1333 };
1334 
1335 /**
1336  * enum data_stall_log_event_type - data stall event type
1337  * @DATA_STALL_LOG_NONE
1338  * @DATA_STALL_LOG_FW_VDEV_PAUSE
1339  * @DATA_STALL_LOG_HWSCHED_CMD_FILTER
1340  * @DATA_STALL_LOG_HWSCHED_CMD_FLUSH
1341  * @DATA_STALL_LOG_FW_RX_REFILL_FAILED
1342  * @DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR
1343  * @DATA_STALL_LOG_FW_WDOG_ERRORS
1344  * @DATA_STALL_LOG_BB_WDOG_ERROR
1345  * @DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR
1346  * @DATA_STALL_LOG_HOST_STA_TX_TIMEOUT
1347  * @DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT
1348  * @DATA_STALL_LOG_NUD_FAILURE
1349  *
1350  * Enum indicating data stall event type
1351  */
1352 enum data_stall_log_event_type {
1353 	DATA_STALL_LOG_NONE,
1354 	DATA_STALL_LOG_FW_VDEV_PAUSE,
1355 	DATA_STALL_LOG_HWSCHED_CMD_FILTER,
1356 	DATA_STALL_LOG_HWSCHED_CMD_FLUSH,
1357 	DATA_STALL_LOG_FW_RX_REFILL_FAILED,
1358 	DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR,
1359 	DATA_STALL_LOG_FW_WDOG_ERRORS,
1360 	DATA_STALL_LOG_BB_WDOG_ERROR,
1361 	DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR,
1362 	/* Stall events triggered by host/framework start from 0x100 onwards. */
1363 	DATA_STALL_LOG_HOST_STA_TX_TIMEOUT = 0x100,
1364 	DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT,
1365 	DATA_STALL_LOG_NUD_FAILURE,
1366 };
1367 
1368 /**
1369  * enum data_stall_log_recovery_type - data stall recovery type
1370  * @DATA_STALL_LOG_RECOVERY_NONE,
1371  * @DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
1372  * @DATA_STALL_LOG_RECOVERY_TRIGGER_PDR
1373  *
1374  * Enum indicating data stall recovery type
1375  */
1376 enum data_stall_log_recovery_type {
1377 	DATA_STALL_LOG_RECOVERY_NONE = 0,
1378 	DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
1379 	DATA_STALL_LOG_RECOVERY_TRIGGER_PDR,
1380 };
1381 
1382 /**
1383  * struct data_stall_event_info - data stall info
1384  * @indicator: Module triggering data stall
1385  * @data_stall_type: data stall event type
1386  * @vdev_id_bitmap: vdev_id_bitmap
1387  * @pdev_id: pdev id
1388  * @recovery_type: data stall recovery type
1389  */
1390 struct data_stall_event_info {
1391 	uint32_t indicator;
1392 	uint32_t data_stall_type;
1393 	uint32_t vdev_id_bitmap;
1394 	uint32_t pdev_id;
1395 	uint32_t recovery_type;
1396 };
1397 
1398 typedef void (*data_stall_detect_cb)(struct data_stall_event_info *);
1399 
1400 /*
1401  * enum cdp_stats - options for host and firmware
1402  * statistics
1403  * @CDP_TXRX_STATS_1: HTT Pdev tx stats
1404  * @CDP_TXRX_STATS_2: HTT Pdev rx stats
1405  * @CDP_TXRX_STATS_3: HTT Pdev Tx HW Queue stats
1406  * @CDP_TXRX_STATS_4: HTT Pdev Tx HW Sched stats
1407  * @CDP_TXRX_STATS_5: HTT Pdev error stats
1408  * @CDP_TXRX_STATS_6: HTT TQM stats
1409  * @CDP_TXRX_STATS_7: HTT TQM CMDQ stats
1410  * @CDP_TXRX_STATS_8: HTT Tx_de_cmn thread stats
1411  * @CDP_TXRX_STATS_9: HTT Pdev Tx rate stats
1412  * @CDP_TXRX_STATS_10: HTT Pdev Rx rate stats
1413  * @CDP_TXRX_STATS_11: HTT Peer stats
1414  * @CDP_TXRX_STATS_12: HTT Tx Self Gen Info
1415  * @CDP_TXRX_STATS_13: HTT Tx MU HWQ stats
1416  * @CDP_TXRX_STATS_14: HTT Ring interface info stats
1417  * @CDP_TXRX_STATS_15: HTT SRNG info stats
1418  * @CDP_TXRX_STATS_16: HTT SFM info stats
1419  * @CDP_TXRX_STATS_17: HTT Pdev tx mu mimo sched info
1420  * @CDP_TXRX_STATS_18: HTT Peer list details
1421  * @CDP_TXRX_STATS_19: Reserved
1422  * @CDP_TXRX_STATS_20: Reset Host stats
1423  * @CDP_TXRX_STATS_21: Host Rx rate stats
1424  * @CDP_TXRX_STATS_22: Host Tx rate stats
1425  * @CDP_TXRX_STATS_23: Host Tx stats
1426  * @CDP_TXRX_STATS_24: Host Rx stats
1427  * @CDP_TXRX_STATS_25: Host Ast stats
1428  * @CDP_TXRX_STATS_26: Host Head/Tail Pointer stats
1429  * @CDP_TXRX_STATS_27: Host Monitor mode stats
1430  * @CDP_TXRX_STATS_28: Host Peer entry stats
1431  * @CDP_TXRX_STATS_29: Host Soc config params info
1432  * @CDP_TXRX_STATS_30: Host Pdev config params info
1433  * @CDP_TXRX_STATS_31: Host DP Interrupt Stats
1434  */
1435 enum cdp_stats {
1436 	CDP_TXRX_STATS_0  = 0,
1437 	CDP_TXRX_STATS_1,
1438 	CDP_TXRX_STATS_2,
1439 	CDP_TXRX_STATS_3,
1440 	CDP_TXRX_STATS_4,
1441 	CDP_TXRX_STATS_5,
1442 	CDP_TXRX_STATS_6,
1443 	CDP_TXRX_STATS_7,
1444 	CDP_TXRX_STATS_8,
1445 	CDP_TXRX_STATS_9,
1446 	CDP_TXRX_STATS_10,
1447 	CDP_TXRX_STATS_11,
1448 	CDP_TXRX_STATS_12,
1449 	CDP_TXRX_STATS_13,
1450 	CDP_TXRX_STATS_14,
1451 	CDP_TXRX_STATS_15,
1452 	CDP_TXRX_STATS_16,
1453 	CDP_TXRX_STATS_17,
1454 	CDP_TXRX_STATS_18,
1455 	CDP_TXRX_STATS_19,
1456 	CDP_TXRX_STATS_20,
1457 	CDP_TXRX_STATS_21,
1458 	CDP_TXRX_STATS_22,
1459 	CDP_TXRX_STATS_23,
1460 	CDP_TXRX_STATS_24,
1461 	CDP_TXRX_STATS_25,
1462 	CDP_TXRX_STATS_26,
1463 	CDP_TXRX_STATS_27,
1464 	CDP_TXRX_STATS_28,
1465 	CDP_TXRX_STATS_29,
1466 	CDP_TXRX_STATS_30,
1467 	CDP_TXRX_STATS_31,
1468 	CDP_TXRX_STATS_HTT_MAX = 256,
1469 	CDP_TXRX_MAX_STATS = 265,
1470 };
1471 
1472 /*
1473  * Different Stat update types sent to OL_IF
1474  * @UPDATE_PEER_STATS: update peer stats
1475  * @UPDATE_VDEV_STATS: update vdev stats
1476  * @UPDATE_PDE_STATS: Update pdev stats
1477  */
1478 enum cdp_stat_update_type {
1479 	UPDATE_PEER_STATS = 0,
1480 	UPDATE_VDEV_STATS = 1,
1481 	UPDATE_PDEV_STATS = 2,
1482 };
1483 
1484 /*
1485  * struct cdp_tx_sojourn_stats - Tx sojourn stats
1486  * @ppdu_seq_id: ppdu_seq_id from tx completion
1487  * @avg_sojourn_msdu: average sojourn msdu time
1488  * @sum_sojourn_msdu: sum sojourn msdu time
1489  * @num_msdu: number of msdus per ppdu
1490  * @cookie: cookie to be used by upper layer
1491  */
1492 struct cdp_tx_sojourn_stats {
1493 	uint32_t ppdu_seq_id;
1494 	qdf_ewma_tx_lag avg_sojourn_msdu[CDP_DATA_TID_MAX];
1495 	uint32_t sum_sojourn_msdu[CDP_DATA_TID_MAX];
1496 	uint32_t num_msdus[CDP_DATA_TID_MAX];
1497 	struct cdp_stats_cookie *cookie;
1498 };
1499 
1500 /**
1501  * struct cdp_delayed_tx_completion_ppdu_user - Delayed Tx PPDU completion
1502  * per-user information
1503  * @frame_ctrl: frame control field in 802.11 header
1504  * @qos_ctrl: QoS control field in 802.11 header
1505  * @mpdu_tried: number of mpdus tried
1506  * @ltf_size: ltf_size
1507  * @stbc: stbc
1508  * @he_re: he_re (range extension)
1509  * @txbf: txbf
1510  * @bw: Transmission bandwidth
1511  *       <enum 2 transmit_bw_20_MHz>
1512  *       <enum 3 transmit_bw_40_MHz>
1513  *       <enum 4 transmit_bw_80_MHz>
1514  *       <enum 5 transmit_bw_160_MHz>
1515  * @nss: NSS 1,2, ...8
1516  * @mcs: MCS index
1517  * @preamble: preamble
1518  * @gi: guard interval 800/400/1600/3200 ns
1519  * @dcm: dcm
1520  * @ldpc: ldpc
1521  * @ru_start: RU start index
1522  * @ru_tones: RU tones length
1523  * @is_mcast: MCAST or UCAST
1524  * @user_pos: user position
1525  * @mu_group_id: mu group id
1526  * @ppdu_start_timestamp: 64 bits ppdu start timestamp
1527  * @ppdu_end_timestamp: 64 bits ppdu end timestamp
1528  */
1529 struct cdp_delayed_tx_completion_ppdu_user {
1530 	uint32_t frame_ctrl:16,
1531 		 qos_ctrl:16;
1532 	uint32_t mpdu_tried_ucast:16,
1533 		mpdu_tried_mcast:16;
1534 	uint32_t ltf_size:2,
1535 		 stbc:1,
1536 		 he_re:1,
1537 		 txbf:4,
1538 		 bw:4,
1539 		 nss:4,
1540 		 mcs:4,
1541 		 preamble:4,
1542 		 gi:4,
1543 		 dcm:1,
1544 		 ldpc:1,
1545 		 delayed_ba:1;
1546 	uint16_t ru_start;
1547 	uint16_t ru_tones;
1548 	bool is_mcast;
1549 	uint32_t user_pos;
1550 	uint32_t mu_group_id;
1551 	uint64_t ppdu_start_timestamp;
1552 	uint64_t ppdu_end_timestamp;
1553 };
1554 
1555 /**
1556  * struct cdp_tx_completion_ppdu_user - Tx PPDU completion per-user information
1557  * @completion_status: completion status - OK/Filter/Abort/Timeout
1558  * @tid: TID number
1559  * @peer_id: Peer ID
1560  * @ba_size: Block-Ack size
1561  * @frame_ctrl: frame control field in 802.11 header
1562  * @qos_ctrl: QoS control field in 802.11 header
1563  * @mpdu_tried: number of mpdus tried
1564  * @mpdu_success: number of mpdus successfully transmitted
1565  * @long_retries: long retries
1566  * @short_retries: short retries
1567  * @is_ampdu: mpdu aggregate or non-aggregate?
1568  * @success_bytes: bytes successfully transmitted
1569  * @retry_bytes: bytes retried
1570  * @failed_msdus: MSDUs failed transmission
1571  * @duration: user duration in ppdu
1572  * @ltf_size: ltf_size
1573  * @stbc: stbc
1574  * @he_re: he_re (range extension)
1575  * @txbf: txbf
1576  * @bw: Transmission bandwidth
1577  *       <enum 2 transmit_bw_20_MHz>
1578  *       <enum 3 transmit_bw_40_MHz>
1579  *       <enum 4 transmit_bw_80_MHz>
1580  *       <enum 5 transmit_bw_160_MHz>
1581  * @nss: NSS 1,2, ...8
1582  * @mcs: MCS index
1583  * @preamble: preamble
1584  * @gi: guard interval 800/400/1600/3200 ns
1585  * @dcm: dcm
1586  * @ldpc: ldpc
1587  * @delayed_ba: delayed ba bit
1588  * @ack_ba_tlv: ack ba recv tlv bit
1589  * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
1590  * UL_BSR_TRIG/UNKNOWN
1591  * @ba_seq_no: Block Ack sequence number
1592  * @ba_bitmap: Block Ack bitmap
1593  * @start_seqa: Sequence number of first MPDU
1594  * @enq_bitmap: Enqueue MPDU bitmap
1595  * @ru_start: RU start index
1596  * @ru_tones: RU tones length
1597  * @is_mcast: MCAST or UCAST
1598  * @tx_rate: Transmission Rate
1599  * @user_pos: user position
1600  * @mu_group_id: mu group id
1601  * @rix: rate index
1602  * @cookie: cookie to used by upper layer
1603  * @is_ppdu_cookie_valid : Indicates that ppdu_cookie is valid
1604  * @ppdu_cookie: 16-bit ppdu_cookie
1605  * @sa_is_training: smart antenna training packets indication
1606  * @rssi_chain: rssi chain per bandwidth
1607  * @sa_tx_antenna: antenna in which packet is transmitted
1608  * @sa_max_rates: smart antenna tx feedback info max rates
1609  * @sa_goodput: smart antenna tx feedback info goodput
1610  * @current_rate_per: Moving average per
1611  * @last_enq_seq: last equeue sequence number
1612  * @mpdu_q: queue of mpdu in a ppdu
1613  * @mpdus: MPDU list based on enqueue sequence bitmap
1614  * @pending_retries: pending MPDUs (retries)
1615  * @tlv_bitmap: per user tlv bitmap
1616  * @skip: tx capture skip flag
1617  * @mon_procd: to indicate user processed in ppdu of the sched cmd
1618  * @debug_copied: flag to indicate bar frame copied
1619  * @peer_last_delayed_ba: flag to indicate peer last delayed ba
1620  * @phy_tx_time_us: Phy TX duration for the User
1621  */
1622 struct cdp_tx_completion_ppdu_user {
1623 	uint32_t completion_status:8,
1624 		 tid:8,
1625 		 peer_id:16;
1626 	uint8_t mac_addr[6];
1627 	uint16_t ba_size;
1628 	uint32_t frame_ctrl:16,
1629 		 qos_ctrl:16;
1630 	uint32_t mpdu_tried_ucast:16,
1631 		mpdu_tried_mcast:16;
1632 	uint16_t mpdu_success:16;
1633 	uint16_t mpdu_failed:16;
1634 	uint32_t long_retries:4,
1635 		 short_retries:4,
1636 		 tx_ratecode:16,
1637 		 is_ampdu:1,
1638 		 ppdu_type:5;
1639 	uint32_t success_bytes;
1640 	uint32_t retry_bytes;
1641 	uint32_t failed_bytes;
1642 	uint32_t success_msdus:16,
1643 		 retry_msdus:16;
1644 	uint32_t failed_msdus:16,
1645 		 duration:16;
1646 	uint32_t ltf_size:2,
1647 		 stbc:1,
1648 		 he_re:1,
1649 		 txbf:4,
1650 		 bw:4,
1651 		 nss:4,
1652 		 mcs:4,
1653 		 preamble:4,
1654 		 gi:4,
1655 		 dcm:1,
1656 		 ldpc:1,
1657 		 delayed_ba:1,
1658 		 ack_ba_tlv:1;
1659 	uint32_t ba_seq_no;
1660 	uint32_t ba_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1661 	uint32_t start_seq;
1662 	uint32_t enq_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1663 	uint32_t failed_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1664 	uint32_t num_mpdu:9,
1665 		 num_msdu:16;
1666 	uint32_t tx_duration;
1667 	uint16_t ru_start;
1668 	uint16_t ru_tones;
1669 	bool is_mcast;
1670 	uint32_t tx_rate;
1671 	uint32_t tx_ratekbps;
1672 	/*ack rssi for separate chains*/
1673 	uint32_t ack_rssi[CDP_RSSI_CHAIN_LEN];
1674 	bool ack_rssi_valid;
1675 	uint32_t user_pos;
1676 	uint32_t mu_group_id;
1677 	uint32_t rix;
1678 	struct cdp_stats_cookie *cookie;
1679 	uint8_t is_ppdu_cookie_valid;
1680 	uint16_t ppdu_cookie;
1681 	uint8_t sa_is_training;
1682 	uint32_t rssi_chain[CDP_RSSI_CHAIN_LEN];
1683 	uint32_t sa_tx_antenna;
1684 	/*Max rates for BW: 20MHZ, 40MHZ and 80MHZ and 160MHZ
1685 	 * |---------------------------------------|
1686 	 * | 16 bits | 16 bits | 16 bits | 16 bits |
1687 	 * |   BW-1  |   BW-2  |   BW-3  |   BW-4  |
1688 	 * |      /\  \                            |
1689 	 * |     /  \  \                           |
1690 	 * |    /    \  \                          |
1691 	 * |   /      \  \                         |
1692 	 * |  /        \  \                        |
1693 	 * | /          \  \                       |
1694 	 * |/            \  \                      |
1695 	 * |[11|8]     [5|8] \                     |
1696 	 * | BW1      PADDED  \                    |
1697 	 * |---------------------------------------|
1698 	 */
1699 	uint16_t sa_max_rates[CDP_NUM_SA_BW];
1700 	uint32_t sa_goodput;
1701 	/* below field is used to calculate goodput in non-training period
1702 	 * Note: As host is exposing goodput and hence current_rate_per is
1703 	 * of no use. It is just for Host computation.
1704 	 */
1705 	uint32_t current_rate_per;
1706 	uint32_t last_enq_seq;
1707 
1708 	qdf_nbuf_queue_t mpdu_q;
1709 	qdf_nbuf_t *mpdus;
1710 	uint32_t pending_retries;
1711 	uint32_t tlv_bitmap;
1712 	bool skip;
1713 	bool mon_procd;
1714 	bool debug_copied;
1715 	bool peer_last_delayed_ba;
1716 
1717 	uint16_t phy_tx_time_us;
1718 };
1719 
1720 /**
1721  * struct cdp_tx_indication_mpdu_info - Tx MPDU completion information
1722  * @ppdu_id: PPDU id
1723  * @duration: user duration in ppdu
1724  * @frame_type: frame type MGMT/CTRL/DATA/BAR
1725  * @frame_ctrl: frame control field in 802.11 header
1726  * @qos_ctrl: QoS control field in 802.11 header
1727  * @tid: TID number
1728  * @num_msdu: number of msdu in MPDU
1729  * @seq_no: Sequence number of first MPDU
1730  * @ltf_size: ltf_size
1731  * @stbc: stbc
1732  * @he_re: he_re (range extension)
1733  * @txbf: txbf
1734  * @bw: Transmission bandwidth
1735  *       <enum 2 transmit_bw_20_MHz>
1736  *       <enum 3 transmit_bw_40_MHz>
1737  *       <enum 4 transmit_bw_80_MHz>
1738  *       <enum 5 transmit_bw_160_MHz>
1739  * @nss: NSS 1,2, ...8
1740  * @mcs: MCS index
1741  * @preamble: preamble
1742  * @gi: guard interval 800/400/1600/3200 ns
1743  * @resp_type: response type
1744  * @mprot_type: medium protection type
1745  * @rts_success: rts success
1746  * @rts failure: rts failure
1747  * @channel: frequency
1748  * @channel_num: channel number
1749  * @ack_rssi: ack rssi
1750  * @ldpc: ldpc
1751  * @tx_rate: Transmission Rate
1752  * @mac_address: peer mac address
1753  * @bss_mac_address: bss mac address
1754  * @ppdu_start_timestamp: TSF at PPDU start
1755  * @ppdu_end_timestamp: TSF at PPDU end
1756  * @ba_start_seq: Block Ack sequence number
1757  * @ba_bitmap: Block Ack bitmap
1758  * @ppdu_cookie: 16-bit ppdu_cookie
1759  * @long_retries: long retries
1760  * @short_retries: short retries
1761  * @completion_status: completion status - OK/Filter/Abort/Timeout
1762  * @usr_idx: user index
1763  */
1764 struct cdp_tx_indication_mpdu_info {
1765 	uint32_t ppdu_id;
1766 	uint32_t tx_duration;
1767 	uint16_t frame_type;
1768 	uint16_t frame_ctrl;
1769 	uint16_t qos_ctrl;
1770 	uint8_t tid;
1771 	uint32_t num_msdu;
1772 	uint32_t seq_no;
1773 	uint32_t ltf_size:2,
1774 		 he_re:1,
1775 		 txbf:4,
1776 		 bw:4,
1777 		 nss:4,
1778 		 mcs:4,
1779 		 preamble:4,
1780 		 gi:4;
1781 	uint32_t channel;
1782 	uint8_t channel_num;
1783 	uint32_t ack_rssi;
1784 	uint32_t ldpc;
1785 	uint32_t tx_rate;
1786 	uint8_t mac_address[QDF_MAC_ADDR_SIZE];
1787 	uint8_t bss_mac_address[QDF_MAC_ADDR_SIZE];
1788 	uint64_t ppdu_start_timestamp;
1789 	uint64_t ppdu_end_timestamp;
1790 	uint32_t ba_start_seq;
1791 	uint32_t ba_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1792 	uint16_t ppdu_cookie;
1793 	uint16_t long_retries:4,
1794 		 short_retries:4,
1795 		 completion_status:8;
1796 	uint16_t resp_type:4,
1797 		 mprot_type:3,
1798 		 rts_success:1,
1799 		 rts_failure:1;
1800 	uint8_t usr_idx;
1801 };
1802 
1803 /**
1804  * struct cdp_tx_indication_info - Tx capture information
1805  * @mpdu_info: Tx MPDU completion information
1806  * @mpdu_nbuf: reconstructed mpdu packet
1807  * @ppdu_desc: tx completion ppdu
1808  */
1809 struct cdp_tx_indication_info {
1810 	struct cdp_tx_indication_mpdu_info mpdu_info;
1811 	qdf_nbuf_t mpdu_nbuf;
1812 	struct cdp_tx_completion_ppdu *ppdu_desc;
1813 };
1814 
1815 /**
1816  * struct cdp_tx_mgmt_comp_info - Tx mgmt comp info
1817  * @ppdu_id: ppdu_id
1818  * @is_sgen_pkt: payload recevied from wmi or htt path
1819  * @retries_count: retries count
1820  * @tx_tsf: 64 bit timestamp
1821  */
1822 struct cdp_tx_mgmt_comp_info {
1823 	uint32_t ppdu_id;
1824 	bool is_sgen_pkt;
1825 	uint16_t retries_count;
1826 	uint64_t tx_tsf;
1827 };
1828 
1829 /**
1830  * struct cdp_tx_completion_ppdu - Tx PPDU completion information
1831  * @completion_status: completion status - OK/Filter/Abort/Timeout
1832  * @ppdu_id: PPDU Id
1833  * @ppdu_seq_id: ppdu sequence id for sojourn stats
1834  * @vdev_id: VAP Id
1835  * @bar_num_users: BA response user count, based on completion common TLV
1836  * @num_users: Number of users
1837  * @max_users: Number of users from USR_INFO TLV
1838  * @drop_reason: drop reason from flush status
1839  * @is_flush: is_flush is set based on flush tlv
1840  * @flow_type: tx flow type from flush status
1841  * @queue_type: queue type from flush status
1842  * @num_mpdu: Number of MPDUs in PPDU
1843  * @num_msdu: Number of MSDUs in PPDU
1844  * @frame_type: frame SU or MU
1845  * @htt_frame_type: frame type from htt
1846  * @frame_ctrl: frame control of 80211 header
1847  * @channel: Channel informartion
1848  * @resp_type: response type
1849  * @mprot_type: medium protection type
1850  * @rts_success: rts success
1851  * @rts failure: rts failure
1852  * @phymode: phy mode
1853  * @ack_rssi: RSSI value of last ack packet (units=dB above noise floor)
1854  * @tx_duration: PPDU airtime
1855  * @ppdu_start_timestamp: TSF at PPDU start
1856  * @ppdu_end_timestamp: TSF at PPDU end
1857  * @ack_timestamp: TSF at the reception of ACK
1858  * @delayed_ba: Delayed ba flag
1859  * @beam_change: beam change bit in ppdu for he-information
1860  * @bss_color: 6 bit value for full bss color
1861  * @doppler: value for doppler (will be 0 most of the times)
1862  * @spatial_reuse: value for spatial reuse used in radiotap HE header
1863  * @usr_nss_sum: Sum of user nss
1864  * @usr_ru_tones_sum: Sum of user ru_tones
1865  * @bar_ppdu_id: BAR ppdu_id
1866  * @bar_tx_duration: BAR tx duration
1867  * @bar_ppdu_start_timestamp: BAR start timestamp
1868  * @bar_ppdu_end_timestamp: BAR end timestamp
1869  * @tlv_bitmap: tlv_bitmap for the PPDU
1870  * @sched_cmdid: schedule command id
1871  * @phy_ppdu_tx_time_us: Phy per PPDU TX duration
1872  * @user: per-User stats (array of per-user structures)
1873  */
1874 struct cdp_tx_completion_ppdu {
1875 	uint32_t ppdu_id;
1876 	uint32_t ppdu_seq_id;
1877 	uint16_t vdev_id;
1878 	uint16_t bar_num_users;
1879 	uint32_t num_users;
1880 	uint8_t  max_users;
1881 	uint8_t last_usr_index;
1882 	uint32_t drop_reason;
1883 	uint32_t is_flush:1,
1884 		 flow_type:8,
1885 		 queue_type:8;
1886 	uint32_t num_mpdu:9,
1887 		 num_msdu:16;
1888 	uint16_t frame_type;
1889 	uint16_t htt_frame_type;
1890 	uint16_t frame_ctrl;
1891 	uint16_t channel;
1892 	uint16_t resp_type:4,
1893 		 mprot_type:3,
1894 		 rts_success:1,
1895 		 rts_failure:1;
1896 	uint16_t phy_mode;
1897 	uint32_t ack_rssi;
1898 	uint32_t tx_duration;
1899 	uint64_t ppdu_start_timestamp;
1900 	uint64_t ppdu_end_timestamp;
1901 	uint64_t ack_timestamp;
1902 	bool delayed_ba;
1903 	uint8_t beam_change;
1904 	uint8_t bss_color;
1905 	uint8_t doppler;
1906 	uint8_t spatial_reuse;
1907 	uint8_t usr_nss_sum;
1908 	uint32_t usr_ru_tones_sum;
1909 	uint32_t bar_ppdu_id;
1910 	uint32_t bar_tx_duration;
1911 	uint32_t bar_ppdu_start_timestamp;
1912 	uint32_t bar_ppdu_end_timestamp;
1913 	uint32_t tlv_bitmap;
1914 	uint16_t sched_cmdid;
1915 	uint16_t phy_ppdu_tx_time_us;
1916 	struct cdp_tx_completion_ppdu_user user[];
1917 };
1918 
1919 /**
1920  * struct cdp_dev_stats - Network device stats structure
1921  * @tx_packets: Tx total packets transmitted
1922  * @tx_bytes  : Tx total bytes transmitted
1923  * @tx_errors : Tx error due to FW tx failure, Ring failure DMA etc
1924  * @tx_dropped: Tx dropped is same as tx errors as above
1925  * @rx_packets: Rx total packets transmitted
1926  * @rx_bytes  : Rx total bytes transmitted
1927  * @rx_errors : Rx erros
1928  * @rx_dropped: Rx dropped stats
1929  */
1930 struct cdp_dev_stats {
1931 	uint32_t tx_packets;
1932 	uint32_t tx_bytes;
1933 	uint32_t tx_errors;
1934 	uint32_t tx_dropped;
1935 	uint32_t rx_packets;
1936 	uint32_t rx_bytes;
1937 	uint32_t rx_errors;
1938 	uint32_t rx_dropped;
1939 };
1940 
1941 /**
1942  * struct cdp_rate_stats - Tx/Rx Rate statistics
1943  * @bw: Indicates the BW of the upcoming transmission -
1944  *       <enum 2 transmit_bw_20_MHz>
1945  *       <enum 3 transmit_bw_40_MHz>
1946  *       <enum 4 transmit_bw_80_MHz>
1947  *       <enum 5 transmit_bw_160_MHz>
1948  * @pkt_type: Transmit Packet Type
1949  * @stbc: When set, STBC transmission rate was used
1950  * @ldpc: When set, use LDPC transmission rates
1951  * @sgi: <enum 0     0_8_us_sgi > Legacy normal GI
1952  *       <enum 1     0_4_us_sgi > Legacy short GI
1953  *       <enum 2     1_6_us_sgi > HE related GI
1954  *       <enum 3     3_2_us_sgi > HE
1955  * @mcs: Transmit MCS Rate
1956  * @ofdma: Set when the transmission was an OFDMA transmission
1957  * @tones_in_ru: The number of tones in the RU used.
1958  * @tsf: Lower 32 bits of the TSF (timestamp when ppdu transmission finished)
1959  * @peer_id: Peer ID of the flow or MPDU queue
1960  * @tid: TID of the flow or MPDU queue
1961  */
1962 struct cdp_rate_stats {
1963 	uint32_t rate_stats_info_valid:1,
1964 		 bw:2,
1965 		 pkt_type:4,
1966 		 stbc:1,
1967 		 ldpc:1,
1968 		 sgi:2,
1969 		 mcs:4,
1970 		 ofdma:1,
1971 		 tones_in_ru:12,
1972 		 resvd0:4;
1973 	uint32_t tsf;
1974 	uint16_t peer_id;
1975 	uint8_t tid;
1976 };
1977 
1978 /**
1979  * struct cdp_tx_completion_msdu - Tx MSDU completion descriptor
1980  * @ppdu_id: PPDU to which this MSDU belongs
1981  * @transmit_cnt: Number of times this frame has been transmitted
1982  * @ack_frame_rssi: RSSI of the received ACK or BA frame
1983  * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
1984  * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
1985  * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
1986  * @extd: Extended structure containing rate statistics
1987  */
1988 struct cdp_tx_completion_msdu {
1989 	uint32_t ppdu_id;
1990 	uint8_t transmit_cnt;
1991 	uint32_t ack_frame_rssi:8,
1992 		 resvd0:1,
1993 		 first_msdu:1,
1994 		 last_msdu:1,
1995 		 msdu_part_of_amsdu:1,
1996 		 resvd1:20;
1997 	struct cdp_rate_stats extd;
1998 };
1999 
2000 /**
2001  * struct cdp_rx_stats_ppdu_user -- per user RX stats
2002  * @peer_id: Peer ID
2003  * @vdev_id: VAP ID
2004  * @is_ampdu: mpdu aggregate or non-aggregate?
2005  * @mu_ul_info_valid: MU UL info valid
2006  * @ofdma_ru_start_index: RU index number(0-73)
2007  * @ofdma_ru_width: size of RU in units of 1(26tone)RU
2008  * @nss: NSS 1,2, ...8
2009  * @mcs: MCS index
2010  * @user_index: user ID in multi-user case
2011  * @ast_index: ast index in multi-user case
2012  * @tid: TID number
2013  * @num_msdu: Number of MSDUs in PPDU
2014  * @udp_msdu_count: Number of UDP MSDUs in PPDU
2015  * @tcp_msdu_count: Number of TCP MSDUs in PPDU
2016  * @other_msdu_count: Number of MSDUs other than UDP and TCP MSDUs in PPDU
2017  * @frame_control: frame control field
2018  * @frame_control_info_valid: frame_control valid
2019  * @data_sequence_control_info_valid: data_sequence_control_info valid
2020  * @first_data_seq_ctrl: Sequence control field of first data frame
2021  * @preamble: preamble
2022  * @ht_flag: ht flag
2023  * @vht_flag: vht flag
2024  * @he_re: he_re (range extension)
2025  * @mpdu_cnt_fcs_ok: Number of MPDUs in PPDU with fcs ok
2026  * @mpdu_cnt_fcs_err: Number of MPDUs in PPDU with fcs err
2027  * @mpdu_fcs_ok_bitmap - MPDU with fcs ok bitmap
2028  * @retried - number of retries
2029  * @mac_addr: Peer MAC Address
2030  */
2031 struct cdp_rx_stats_ppdu_user {
2032 	uint16_t peer_id;
2033 	uint8_t vdev_id;
2034 	bool is_ampdu;
2035 	uint32_t mu_ul_info_valid:1,
2036 		 ofdma_ru_start_index:7,
2037 		 ofdma_ru_width:7,
2038 		 nss:4,
2039 		 mcs:4;
2040 	/* user id */
2041 	uint8_t  user_index;
2042 	uint32_t ast_index;
2043 	uint32_t tid;
2044 	uint32_t num_msdu;
2045 	uint16_t  tcp_msdu_count;
2046 	uint16_t  udp_msdu_count;
2047 	uint16_t  other_msdu_count;
2048 	uint16_t frame_control;
2049 	uint8_t  frame_control_info_valid;
2050 	uint8_t data_sequence_control_info_valid;
2051 	uint16_t first_data_seq_ctrl;
2052 	uint32_t preamble_type;
2053 	uint16_t ht_flags;
2054 	uint16_t vht_flags;
2055 	uint16_t he_flags;
2056 	uint32_t mpdu_cnt_fcs_ok;
2057 	uint32_t mpdu_cnt_fcs_err;
2058 	uint32_t mpdu_fcs_ok_bitmap[QDF_MON_STATUS_MPDU_FCS_BMAP_NWORDS];
2059 	uint32_t mpdu_ok_byte_count;
2060 	uint32_t mpdu_err_byte_count;
2061 	uint32_t retries;
2062 	uint8_t  mac_addr[QDF_MAC_ADDR_SIZE];
2063 };
2064 
2065 /**
2066  * struct cdp_rx_indication_ppdu - Rx PPDU indication structure
2067  * @ppdu_id: PPDU Id
2068  * @is_ampdu: mpdu aggregate or non-aggregate?
2069  * @num_mpdu: Number of MPDUs in PPDU
2070  * @reserved: Reserved bits for future use
2071  * @num_msdu: Number of MSDUs in PPDU
2072  * @udp_msdu_count: Number of UDP MSDUs in PPDU
2073  * @tcp_msdu_count: Number of TCP MSDUs in PPDU
2074  * @other_msdu_count: Number of MSDUs other than UDP and TCP MSDUs in PPDU
2075  * @duration: PPDU duration
2076  * @tid: TID number
2077  * @peer_id: Peer ID
2078  * @vdev_id: VAP ID
2079  * @mac_addr: Peer MAC Address
2080  * @first_data_seq_ctrl: Sequence control field of first data frame
2081  * @ltf_size: ltf_size
2082  * @stbc: When set, STBC rate was used
2083  * @he_re: he_re (range extension)
2084  * @bw: Bandwidth
2085  *       <enum 0 bw_20_MHz>
2086  *       <enum 1 bw_40_MHz>
2087  *       <enum 2 bw_80_MHz>
2088  *       <enum 3 bw_160_MHz>
2089  * @nss: NSS 1,2, ...8
2090  * @mcs: MCS index
2091  * @preamble: preamble
2092  * @gi: <enum 0     0_8_us_sgi > Legacy normal GI
2093  *       <enum 1     0_4_us_sgi > Legacy short GI
2094  *       <enum 2     1_6_us_sgi > HE related GI
2095  *       <enum 3     3_2_us_sgi > HE
2096  * @dcm: dcm
2097  * @ldpc: ldpc
2098  * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
2099  * UL_BSR_TRIG/UNKNOWN
2100  * @rssi: RSSI value (units = dB above noise floor)
2101  * @timestamp: TSF at the reception of PPDU
2102  * @length: PPDU length
2103  * @channel: Channel informartion
2104  * @lsig_A: L-SIG in 802.11 PHY header
2105  * @frame_ctrl: frame control field
2106  * @rix: rate index
2107  * @rssi_chain: rssi chain per nss per bw
2108  * @cookie: cookie to used by upper layer
2109  * @user: per user stats in MU-user case
2110  * @nf: noise floor
2111  * @per_chain_rssi: rssi per antenna
2112  */
2113 struct cdp_rx_indication_ppdu {
2114 	uint32_t ppdu_id;
2115 	uint16_t is_ampdu:1,
2116 		 num_mpdu:9,
2117 		 reserved:6;
2118 	uint32_t num_msdu;
2119 	uint32_t num_bytes;
2120 	uint16_t udp_msdu_count;
2121 	uint16_t tcp_msdu_count;
2122 	uint16_t other_msdu_count;
2123 	uint16_t duration;
2124 	uint32_t tid:8,
2125 		 peer_id:16;
2126 	uint8_t vdev_id;
2127 	uint8_t mac_addr[6];
2128 	uint16_t first_data_seq_ctrl;
2129 	union {
2130 		uint32_t rate_info;
2131 		struct {
2132 			uint32_t ltf_size:2,
2133 				 stbc:1,
2134 				 he_re:1,
2135 				 bw:4,
2136 				 nss:4,
2137 				 mcs:4,
2138 				 preamble:4,
2139 				 gi:4,
2140 				 dcm:1,
2141 				 ldpc:1,
2142 				 ppdu_type:5;
2143 		};
2144 	} u;
2145 	uint32_t rix;
2146 	uint32_t lsig_a;
2147 	uint32_t rssi;
2148 	uint64_t timestamp;
2149 	uint32_t length;
2150 	uint8_t channel;
2151 	uint8_t beamformed;
2152 
2153 	uint32_t rx_ratekbps;
2154 	uint32_t ppdu_rx_rate;
2155 
2156 	uint32_t retries;
2157 	uint32_t rx_byte_count;
2158 	uint16_t rx_ratecode;
2159 	uint8_t fcs_error_mpdus;
2160 	uint16_t frame_ctrl;
2161 	int8_t rssi_chain[SS_COUNT][MAX_BW];
2162 	struct cdp_stats_cookie *cookie;
2163 	struct cdp_rx_su_evm_info evm_info;
2164 	uint32_t rx_antenna;
2165 	uint8_t num_users;
2166 	struct cdp_rx_stats_ppdu_user user[CDP_MU_MAX_USERS];
2167 	uint32_t nf;
2168 	uint8_t  per_chain_rssi[MAX_CHAIN];
2169 	uint8_t is_mcast_bcast;
2170 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
2171 	struct cdp_rx_ppdu_cfr_info cfr_info;
2172 #endif
2173 };
2174 
2175 /**
2176  * struct cdp_rx_indication_msdu - Rx MSDU info
2177  * @ppdu_id: PPDU to which the MSDU belongs
2178  * @msdu_len: Length of MSDU in bytes
2179  * @ack_frame_rssi: RSSI of the received ACK or BA frame
2180  * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
2181  * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
2182  * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
2183  * @extd: Extended structure containing rate statistics
2184  */
2185 struct cdp_rx_indication_msdu {
2186 	uint32_t ppdu_id;
2187 	uint16_t msdu_len;
2188 	uint32_t ack_frame_rssi:8,
2189 		 resvd0:1,
2190 		 first_msdu:1,
2191 		 last_msdu:1,
2192 		 msdu_part_of_amsdu:1,
2193 		 msdu_part_of_ampdu:1,
2194 		 resvd1:19;
2195 	struct cdp_rate_stats extd;
2196 };
2197 
2198 /**
2199  * struct cdp_config_params - Propagate configuration parameters to datapath
2200  * @tso_enable: Enable/Disable TSO
2201  * @lro_enable: Enable/Disable LRO
2202  * @gro_enable: Enable/Disable GRO
2203  * @flow_steering_enable: Enable/Disable Rx Hash based flow steering
2204  * @p2p_tcp_udp_checksumoffload: Enable/Disable TCP/UDP Checksum Offload for P2P
2205  * @nan_tcp_udp_checksumoffload: Enable/Disable TCP/UDP Checksum Offload for NAN
2206  * @tcp_udp_checksumoffload: Enable/Disable TCP/UDP Checksum Offload
2207  * @napi_enable: Enable/Disable Napi
2208  * @ipa_enable: Flag indicating if IPA is enabled or not
2209  * @tx_flow_stop_queue_threshold: Value to Pause tx queues
2210  * @tx_flow_start_queue_offset: Available Tx descriptors to unpause
2211  *				tx queue
2212  * @tx_comp_loop_pkt_limit: Max # of packets to be processed in 1 tx comp loop
2213  * @rx_reap_loop_pkt_limit: Max # of packets to be processed in 1 rx reap loop
2214  * @rx_hp_oos_update_limit: Max # of HP OOS (out of sync) updates
2215  */
2216 struct cdp_config_params {
2217 	unsigned int tso_enable:1;
2218 	unsigned int lro_enable:1;
2219 	unsigned int gro_enable:1;
2220 	unsigned int flow_steering_enable:1;
2221 	unsigned int p2p_tcp_udp_checksumoffload:1;
2222 	unsigned int nan_tcp_udp_checksumoffload:1;
2223 	unsigned int tcp_udp_checksumoffload:1;
2224 	unsigned int napi_enable:1;
2225 	unsigned int ipa_enable:1;
2226 	/* Set when QCA_LL_TX_FLOW_CONTROL_V2 is enabled */
2227 	uint8_t tx_flow_stop_queue_threshold;
2228 	uint8_t tx_flow_start_queue_offset;
2229 	uint32_t tx_comp_loop_pkt_limit;
2230 	uint32_t rx_reap_loop_pkt_limit;
2231 	uint32_t rx_hp_oos_update_limit;
2232 
2233 };
2234 
2235 /**
2236  * cdp_txrx_stats_req: stats request wrapper
2237  *	used to pass request information to cdp layer
2238  * @stats: type of stats requested
2239  * @param0: opaque argument 0 to be passed to htt
2240  * @param1: opaque argument 1 to be passed to htt
2241  * @param2: opaque argument 2 to be passed to htt
2242  * @param3: opaque argument 3 to be passed to htt
2243  * @mac id: mac_id
2244  */
2245 struct cdp_txrx_stats_req {
2246 	enum cdp_stats	stats;
2247 	uint32_t	param0;
2248 	uint32_t	param1;
2249 	uint32_t	param2;
2250 	uint32_t	param3;
2251 	uint32_t	cookie_val;
2252 	uint8_t		mac_id;
2253 	char *peer_addr;
2254 };
2255 
2256 /**
2257  * struct cdp_monitor_filter - monitor filter info
2258  * @mode: set filter mode
2259  * @fp_mgmt: set Filter Pass MGMT Configuration
2260  * @fp_ctrl: set Filter Pass CTRL Configuration
2261  * @fp_data: set Filter Pass DATA Configuration
2262  * @mo_mgmt: set Monitor Other MGMT Configuration
2263  * @mo_ctrl: set Monitor Other CTRL Configuration
2264  * @mo_data: set Monitor other DATA Configuration
2265  *
2266  */
2267 struct cdp_monitor_filter {
2268 	uint16_t mode;
2269 	uint16_t fp_mgmt;
2270 	uint16_t fp_ctrl;
2271 	uint16_t fp_data;
2272 	uint16_t mo_mgmt;
2273 	uint16_t mo_ctrl;
2274 	uint16_t mo_data;
2275 };
2276 
2277 /**
2278  * enum cdp_dp_cfg - CDP ENUMs to get to DP configation
2279  * @cfg_dp_enable_data_stall: context passed to be used by consumer
2280  * @cfg_dp_enable_p2p_ip_tcp_udp_checksum_offload: get P2P checksum config
2281  * @cfg_dp_enable_nan_ip_tcp_udp_checksum_offload: get NAN TX checksum config
2282  * @cfg_dp_enable_ip_tcp_udp_checksum_offload: get TX checksum config for others
2283  * @cfg_dp_tso_enable: get TSO enable config
2284  * @cfg_dp_lro_enable: get LRO enable config
2285  * @cfg_dp_gro_enable: get GRP enable config
2286  * @cfg_dp_tx_flow_start_queue_offset: get DP TX flow start queue offset
2287  * @cfg_dp_tx_flow_stop_queue_threshold: get DP TX flow stop queue threshold
2288  * @cfg_dp_ipa_uc_tx_buf_size: get IPA TX buf size config
2289  * @cfg_dp_ipa_uc_tx_partition_base: get IPA UC TX partition base config
2290  * @cfg_dp_ipa_uc_rx_ind_ring_count: get IPA rx indication ring count config
2291  * @cfg_dp_enable_flow_steering: get flow steerint enable config
2292  * @cfg_dp_reorder_offload_supported: get reorder offload support config
2293  * @cfg_dp_ce_classify_enable: get CE classify enable config
2294  * @cfg_dp_disable_intra_bss_fwd: get intra bss fwd config
2295  * @cfg_dp_pktlog_buffer_size: get packet log buffer size config
2296  */
2297 enum cdp_dp_cfg {
2298 	cfg_dp_enable_data_stall,
2299 	cfg_dp_enable_p2p_ip_tcp_udp_checksum_offload,
2300 	cfg_dp_enable_nan_ip_tcp_udp_checksum_offload,
2301 	cfg_dp_enable_ip_tcp_udp_checksum_offload,
2302 	cfg_dp_tso_enable,
2303 	cfg_dp_lro_enable,
2304 	cfg_dp_gro_enable,
2305 	cfg_dp_tx_flow_start_queue_offset,
2306 	cfg_dp_tx_flow_stop_queue_threshold,
2307 	cfg_dp_ipa_uc_tx_buf_size,
2308 	cfg_dp_ipa_uc_tx_partition_base,
2309 	cfg_dp_ipa_uc_rx_ind_ring_count,
2310 	cfg_dp_enable_flow_steering,
2311 	cfg_dp_reorder_offload_supported,
2312 	cfg_dp_ce_classify_enable,
2313 	cfg_dp_disable_intra_bss_fwd,
2314 	cfg_dp_pktlog_buffer_size,
2315 };
2316 
2317 /**
2318  * struct cdp_peer_cookie - cookie used when creating peer
2319  * @ctx: context passed to be used by consumer
2320  * @mac_addr: MAC address of peer
2321  * @peer_id: peer id
2322  * @pdev_id: pdev_id
2323  * @cookie: cookie to be used by consumer
2324  */
2325 struct cdp_peer_cookie {
2326 	struct cdp_stats_cookie *ctx;
2327 	uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
2328 	uint8_t peer_id;
2329 	uint8_t pdev_id;
2330 	uint8_t cookie;
2331 };
2332 
2333 #ifdef WLAN_SUPPORT_RX_FISA
2334 struct cdp_flow_stats {
2335 	uint32_t aggr_count;
2336 	uint32_t curr_aggr_count;
2337 	uint32_t flush_count;
2338 	uint32_t bytes_aggregated;
2339 };
2340 #else
2341 /**
2342  * cdp_flow_stats - Per-Flow (5-tuple) statistics
2343  * @msdu_count: number of rx msdus matching this flow
2344  *
2345  * HW also includes msdu_byte_count and timestamp, which
2346  * are not currently tracked in SW.
2347  */
2348 struct cdp_flow_stats {
2349 	uint32_t msdu_count;
2350 };
2351 #endif
2352 
2353 /**
2354  * cdp_flow_fst_operation - RX FST operations allowed
2355  */
2356 enum cdp_flow_fst_operation {
2357 	CDP_FLOW_FST_ENTRY_ADD,
2358 	CDP_FLOW_FST_ENTRY_DEL,
2359 	CDP_FLOW_FST_RX_BYPASS_ENABLE,
2360 	CDP_FLOW_FST_RX_BYPASS_DISABLE
2361 };
2362 
2363 /**
2364  * cdp_flow_protocol_type - RX FST supported protocol types, mapped to HW spec
2365  */
2366 enum cdp_flow_protocol_type {
2367 	CDP_FLOW_PROTOCOL_TYPE_TCP = 6,
2368 	CDP_FLOW_PROTOCOL_TYPE_UDP = 17,
2369 };
2370 
2371 /**
2372  * cdp_rx_flow_tuple_info - RX flow tuple info used for addition/deletion
2373  * @dest_ip_127_96: destination IP address bit fields 96-127
2374  * @dest_ip_95_64: destination IP address bit fields 64-95
2375  * @dest_ip_63_32: destination IP address bit fields 32-63
2376  * @dest_ip_31_0: destination IP address bit fields 0-31
2377  * @src_ip_127_96: source IP address bit fields 96-127
2378  * @src_ip_95_64: source IP address bit fields 64-95
2379  * @src_ip_63_32: source IP address bit fields 32-63
2380  * @src_ip_31_0: source IP address bit fields 0-31
2381  * @dest_port: destination port of flow
2382  * @src_port: source port of flow
2383  * @l4_protocol: protocol type in flow (TCP/UDP)
2384  */
2385 struct cdp_rx_flow_tuple_info {
2386 #ifdef WLAN_SUPPORT_RX_FISA
2387 	uint8_t tuple_populated;
2388 #endif
2389 	uint32_t dest_ip_127_96;
2390 	uint32_t dest_ip_95_64;
2391 	uint32_t dest_ip_63_32;
2392 	uint32_t dest_ip_31_0;
2393 	uint32_t src_ip_127_96;
2394 	uint32_t src_ip_95_64;
2395 	uint32_t src_ip_63_32;
2396 	uint32_t src_ip_31_0;
2397 	uint16_t dest_port;
2398 	uint16_t src_port;
2399 	uint16_t l4_protocol;
2400 };
2401 
2402 /**
2403  * cdp_rx_flow_info - RX flow info used for addition/deletion
2404  * @is_addr_ipv4: indicates whether given IP address is IPv4/IPv6
2405  * @op_code: add/delete/enable/disable operation requested
2406  * @flow_tupe_info: structure containing tuple info
2407  * @fse_metadata: metadata to be set in RX flow
2408  */
2409 struct cdp_rx_flow_info {
2410 	bool is_addr_ipv4;
2411 	enum cdp_flow_fst_operation op_code;
2412 	struct cdp_rx_flow_tuple_info flow_tuple_info;
2413 	uint16_t fse_metadata;
2414 };
2415 #endif
2416