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