xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_cmn_struct.h (revision 6d768494e5ce14eb1603a695c86739d12ecc6ec2)
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  */
712 typedef void (*ol_txrx_completion_fp)(qdf_nbuf_t skb,
713 				      void *osif_dev);
714 /**
715  * ol_txrx_tx_flow_control_fp - tx flow control notification
716  * function from txrx to OS shim
717  * @osif_dev - the virtual device's OS shim object
718  * @tx_resume - tx os q should be resumed or not
719  */
720 typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev,
721 					    bool tx_resume);
722 
723 /**
724  * ol_txrx_tx_flow_control_is_pause_fp - is tx paused by flow control
725  * function from txrx to OS shim
726  * @osif_dev - the virtual device's OS shim object
727  *
728  * Return: true if tx is paused by flow control
729  */
730 typedef bool (*ol_txrx_tx_flow_control_is_pause_fp)(void *osif_dev);
731 
732 /**
733  * ol_txrx_rx_fp - receive function to hand batches of data
734  * frames from txrx to OS shim
735  * @data_vdev - handle to the OSIF virtual device object
736  * @msdu_list - list of network buffers
737  */
738 typedef QDF_STATUS(*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list);
739 
740 typedef QDF_STATUS(*ol_txrx_fisa_rx_fp)(void *soc,
741 					void *dp_vdev,
742 					qdf_nbuf_t msdu_list);
743 
744 typedef QDF_STATUS(*ol_txrx_fisa_flush_fp)(void *soc, int ring_num);
745 /**
746  * ol_txrx_rx_flush_fp - receive function to hand batches of data
747  * frames from txrx to OS shim
748  * @osif_dev: handle to the OSIF virtual device object
749  * @vdev_id: vdev_if of the packets to be flushed
750  */
751 typedef QDF_STATUS(*ol_txrx_rx_flush_fp)(void *osif_dev, uint8_t vdev_id);
752 
753 /**
754  * ol_txrx_rx_gro_flush_ind - function to send GRO flush indication to stack
755  * for a given RX Context Id.
756  * @osif_dev - handle to the OSIF virtual device object
757  * @rx_ctx_id - Rx context Id for which gro flush should happen
758  */
759 typedef QDF_STATUS(*ol_txrx_rx_gro_flush_ind_fp)(void *osif_dev,
760 						 int rx_ctx_id);
761 
762 /**
763  * ol_txrx_stats_rx_fp - receive function to hand batches of data
764  * frames from txrx to OS shim
765  * @skb: skb data
766  * @osif_dev: the virtual device's OS shim object
767  * @action: data packet type
768  * @pkt_type: packet data type
769  */
770 typedef void (*ol_txrx_stats_rx_fp)(struct sk_buff *skb,
771 		void *osif_dev, enum connectivity_stats_pkt_status action,
772 		uint8_t *pkt_type);
773 
774 /**
775  * ol_txrx_get_key_fp - function to gey key based on keyix and peer
776  * mac address
777  * @osif_dev - the virtual device's OS shim object
778  * @key_buf - pointer to store key
779  * @mac_addr - pointer to mac address
780  * @keyix - key id
781  */
782 typedef QDF_STATUS(*ol_txrx_get_key_fp)(void *osif_dev, uint8_t *key_buf, uint8_t *mac_addr, uint8_t keyix);
783 
784 /**
785  * ol_txrx_rsim_rx_decap_fp - raw mode simulation function to decap the
786  * packets in receive path.
787  * @osif_dev  - the virtual device's OS shim object
788  * @list_head - poniter to head of receive packet queue to decap
789  * @list_tail - poniter to tail of receive packet queue to decap
790  * @peer_mac  - mac address of peer handler
791  */
792 typedef QDF_STATUS(*ol_txrx_rsim_rx_decap_fp)(void *osif_dev,
793 						qdf_nbuf_t *list_head,
794 						qdf_nbuf_t *list_tail,
795 						uint8_t *peer_mac);
796 
797 /* ol_txrx_rx_fp - external tx free function to read per packet stats and
798  *                            free tx buffer externally
799  * @netbuf - tx network buffer
800  */
801 typedef void (*ol_txrx_tx_free_ext_fp)(qdf_nbuf_t netbuf);
802 
803 /**
804  * ol_txrx_rx_check_wai_fp - OSIF WAPI receive function
805 */
806 typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev,
807 					    qdf_nbuf_t mpdu_head,
808 					    qdf_nbuf_t mpdu_tail);
809 /**
810  * ol_txrx_rx_mon_fp - OSIF monitor mode receive function for single
811  * MPDU (802.11 format)
812  */
813 typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev,
814 					    qdf_nbuf_t mpdu,
815 					    void *rx_status);
816 
817 /**
818  * ol_txrx_proxy_arp_fp - proxy arp function pointer
819 */
820 typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev,
821 					    qdf_nbuf_t netbuf);
822 
823 /*
824  * ol_txrx_mcast_me_fp - function pointer for multicast enhancement
825  */
826 typedef int (*ol_txrx_mcast_me_fp)(ol_osif_vdev_handle vdev,
827 						qdf_nbuf_t netbuf);
828 
829 /**
830  * ol_txrx_stats_callback - statistics notify callback
831  */
832 typedef void (*ol_txrx_stats_callback)(void *ctxt,
833 				       enum htt_cmn_dbg_stats_type type,
834 				       uint8_t *buf, int bytes);
835 
836 /**
837  * ol_txrx_pktdump_cb - callback for packet dump feature
838  */
839 typedef void (*ol_txrx_pktdump_cb)(ol_txrx_soc_handle soc,
840 				   uint8_t pdev_id,
841 				   uint8_t vdev_id,
842 				   qdf_nbuf_t netbuf,
843 				   uint8_t status,
844 				   uint8_t type);
845 
846 /**
847  * ol_txrx_ops - (pointers to) the functions used for tx and rx
848  * data xfer
849  *
850  * There are two portions of these txrx operations.
851  * The rx portion is filled in by OSIF SW before calling
852  * ol_txrx_osif_vdev_register; inside the ol_txrx_osif_vdev_register
853  * the txrx SW stores a copy of these rx function pointers, to use
854  * as it delivers rx data frames to the OSIF SW.
855  * The tx portion is filled in by the txrx SW inside
856  * ol_txrx_osif_vdev_register; when the function call returns,
857  * the OSIF SW stores a copy of these tx functions to use as it
858  * delivers tx data frames to the txrx SW.
859  *
860  * @tx.std -  the tx function pointer for standard data
861  * frames This function pointer is set by the txrx SW
862  * perform host-side transmit operations based on
863  * whether a HL or LL host/target interface is in use.
864  * @tx.flow_control_cb - the transmit flow control
865  * function that is registered by the
866  * OSIF which is called from txrx to
867  * indicate whether the transmit OS
868  * queues should be paused/resumed
869  * @rx.rx - the OS shim rx function to deliver rx data
870  * frames to. This can have different values for
871  * different virtual devices, e.g. so one virtual
872  * device's OS shim directly hands rx frames to the OS,
873  * but another virtual device's OS shim filters out P2P
874  * messages before sending the rx frames to the OS. The
875  * netbufs delivered to the osif_rx function are in the
876  * format specified by the OS to use for tx and rx
877  * frames (either 802.3 or native WiFi). In case RX Threads are enabled, pkts
878  * are given to the thread, instead of the stack via this pointer.
879  * @rx.stack - function to give packets to the stack. Differs from @rx.rx.
880  * In case RX Threads are enabled, this pointer holds the callback to give
881  * packets to the stack.
882  * @rx.rx_gro_flush - GRO flush indication to stack for a given RX CTX ID
883  * @rx.wai_check - the tx function pointer for WAPI frames
884  * @rx.mon - the OS shim rx monitor function to deliver
885  * monitor data to Though in practice, it is probable
886  * that the same function will be used for delivering
887  * rx monitor data for all virtual devices, in theory
888  * each different virtual device can have a different
889  * OS shim function for accepting rx monitor data. The
890  * netbufs delivered to the osif_rx_mon function are in
891  * 802.11 format.  Each netbuf holds a 802.11 MPDU, not
892  * an 802.11 MSDU. Depending on compile-time
893  * configuration, each netbuf may also have a
894  * monitor-mode encapsulation header such as a radiotap
895  * header added before the MPDU contents.
896  * @rx.std - the OS shim rx function to deliver rx data
897  * @proxy_arp - proxy arp function pointer - specified by
898  * OS shim, stored by txrx
899  * @get_key - function pointer to get key of the peer with
900  * specific key index
901  */
902 struct ol_txrx_ops {
903 	/* tx function pointers - specified by txrx, stored by OS shim */
904 	struct {
905 		ol_txrx_tx_fp         tx;
906 		ol_txrx_tx_exc_fp     tx_exception;
907 		ol_txrx_tx_free_ext_fp tx_free_ext;
908 		ol_txrx_completion_fp tx_comp;
909 	} tx;
910 
911 	/* rx function pointers - specified by OS shim, stored by txrx */
912 	struct {
913 		ol_txrx_rx_fp           rx;
914 		ol_txrx_rx_fp           rx_stack;
915 		ol_txrx_rx_flush_fp     rx_flush;
916 		ol_txrx_rx_gro_flush_ind_fp           rx_gro_flush;
917 		ol_txrx_rx_check_wai_fp wai_check;
918 		ol_txrx_rx_mon_fp       mon;
919 		ol_txrx_stats_rx_fp           stats_rx;
920 		ol_txrx_rsim_rx_decap_fp rsim_rx_decap;
921 		ol_txrx_fisa_rx_fp	osif_fisa_rx;
922 		ol_txrx_fisa_flush_fp   osif_fisa_flush;
923 	} rx;
924 	/* proxy arp function pointer - specified by OS shim, stored by txrx */
925 	ol_txrx_proxy_arp_fp      proxy_arp;
926 	ol_txrx_mcast_me_fp          me_convert;
927 
928 	ol_txrx_get_key_fp  get_key;
929 };
930 
931 /**
932  * ol_txrx_stats_req - specifications of the requested
933  * statistics
934  */
935 struct ol_txrx_stats_req {
936 	uint32_t stats_type_upload_mask;        /* which stats to upload */
937 	uint32_t stats_type_reset_mask; /* which stats to reset */
938 
939 	/* stats will be printed if either print element is set */
940 	struct {
941 		int verbose;    /* verbose stats printout */
942 		int concise;    /* concise stats printout (takes precedence) */
943 	} print;                /* print uploaded stats */
944 
945 	/* stats notify callback will be invoked if fp is non-NULL */
946 	struct {
947 		ol_txrx_stats_callback fp;
948 		void *ctxt;
949 	} callback;
950 
951 	/* stats will be copied into the specified buffer if buf is non-NULL */
952 	struct {
953 		uint8_t *buf;
954 		int byte_limit; /* don't copy more than this */
955 	} copy;
956 
957 	/*
958 	 * If blocking is true, the caller will take the specified semaphore
959 	 * to wait for the stats to be uploaded, and the driver will release
960 	 * the semaphore when the stats are done being uploaded.
961 	 */
962 	struct {
963 		int blocking;
964 		/*Note: this needs to change to some qdf_* type */
965 		qdf_semaphore_t *sem_ptr;
966 	} wait;
967 };
968 
969 
970 /* DP soc struct definition */
971 struct cdp_soc_t {
972 	struct cdp_ops *ops;
973 	struct ol_if_ops *ol_ops;
974 };
975 
976 /*
977  * cdp_peer_param_type: different types of parameters
978  *			to set values in peer
979  * @CDP_CONFIG_NAWDS: Enable nawds mode
980  * @CDP_CONFIG_NAC: Enable nac
981  * @CDP_CONFIG_ISOLATION : Enable isolation
982  */
983 enum cdp_peer_param_type {
984 	CDP_CONFIG_NAWDS,
985 	CDP_CONFIG_NAC,
986 	CDP_CONFIG_ISOLATION,
987 };
988 
989 /*
990  * cdp_pdev_param_type: different types of parameters
991  *			to set values in pdev
992  * @CDP_CONFIG_DEBUG_SNIFFER: Enable debug sniffer feature
993  * @CDP_CONFIG_BPR_ENABLE: Enable bcast probe feature
994  * @CDP_CONFIG_PRIMARY_RADIO: Configure radio as primary
995  * @CDP_CONFIG_ENABLE_PERPKT_TXSTATS: Enable per packet statistics
996  * @CDP_CONFIG_IGMPMLD_OVERRIDE: Override IGMP/MLD
997  * @CDP_CONFIG_IGMPMLD_TID: Configurable TID value when igmmld_override is set
998  * @CDP_CONFIG_ARP_DBG_CONF: Enable ARP debug
999  * @CDP_CONFIG_CAPTURE_LATENCY: Capture time latency
1000  * @CDP_INGRESS_STATS: Accumulate ingress statistics
1001  * @CDP_OSIF_DROP: Accumulate drops in OSIF layer
1002  * @CDP_CONFIG_ENH_RX_CAPTURE: Enable enhanced RX capture
1003  * @CDP_CONFIG_ENH_TX_CAPTURE: Enable enhanced TX capture
1004  * @CDP_CONFIG_HMMC_TID_OVERRIDE: Enable hmmc tid override
1005  * @CDP_CONFIG_HMMC_TID_VALUE: set hmmc tid value
1006  * @CDP_CONFIG_TX_CAPTURE: set tx capture
1007  * @CDP_CHAN_NOISE_FLOOR: set channel noise floor
1008  * @CDP_CONFIG_VOW: set/get vow config
1009  * @CDP_TIDQ_OVERRIDE: set/get tid queue override
1010  * @CDP_TIDMAP_PRTY: set/get tid map prty
1011  * @CDP_TX_PENDING: get tx pending
1012  * @CDP_FILTER_NEIGH_PEERS: filter neighbour peers
1013  * @CDP_FILTER_UCAST_DATA: filter unicast data
1014  * @CDP_FILTER_MCAST_DATA: filter multicast data
1015  * @CDP_FILTER_NO_DATA: filter no data
1016  * @CDP_MONITOR_CHANNEL: monitor channel
1017  * @CDP_MONITOR_FREQUENCY: monitor frequency
1018  * @CDP_CONFIG_BSS_COLOR: configure bss color
1019  */
1020 enum cdp_pdev_param_type {
1021 	CDP_CONFIG_DEBUG_SNIFFER,
1022 	CDP_CONFIG_BPR_ENABLE,
1023 	CDP_CONFIG_PRIMARY_RADIO,
1024 	CDP_CONFIG_ENABLE_PERPKT_TXSTATS,
1025 	CDP_CONFIG_IGMPMLD_OVERRIDE,
1026 	CDP_CONFIG_IGMPMLD_TID,
1027 	CDP_CONFIG_ARP_DBG_CONF,
1028 	CDP_CONFIG_CAPTURE_LATENCY,
1029 	CDP_INGRESS_STATS,
1030 	CDP_OSIF_DROP,
1031 	CDP_CONFIG_ENH_RX_CAPTURE,
1032 	CDP_CONFIG_ENH_TX_CAPTURE,
1033 	CDP_CONFIG_HMMC_TID_OVERRIDE,
1034 	CDP_CONFIG_HMMC_TID_VALUE,
1035 	CDP_CONFIG_TX_CAPTURE,
1036 	CDP_CHAN_NOISE_FLOOR,
1037 	CDP_CONFIG_VOW,
1038 	CDP_TIDQ_OVERRIDE,
1039 	CDP_TIDMAP_PRTY,
1040 	CDP_TX_PENDING,
1041 	CDP_FILTER_NEIGH_PEERS,
1042 	CDP_FILTER_UCAST_DATA,
1043 	CDP_FILTER_MCAST_DATA,
1044 	CDP_FILTER_NO_DATA,
1045 	CDP_MONITOR_CHANNEL,
1046 	CDP_MONITOR_FREQUENCY,
1047 	CDP_CONFIG_BSS_COLOR,
1048 };
1049 
1050 /*
1051  * cdp_config_param_type: union of different types of parameters
1052  *			to set values into dp handles.
1053  *
1054  * @cdp_peer_param_nawds: Enable nawds mode
1055  * @cdp_peer_param_isolation: Enable isolation
1056  * @cdp_peer_param_nac: Enable nac
1057  *
1058  * @cdp_vdev_param_nawds: set nawds enable/disable
1059  * @cdp_vdev_param_mcast_en: enable/disable multicast enhancement
1060  * @cdp_vdev_param_wds: wds sta
1061  * @cdp_vdev_param_mec: MEC enable flags
1062  * @cdp_vdev_param_proxysta: proxy sta
1063  * @cdp_vdev_param_tdls_flags: tdls link flags
1064  * @cdp_vdev_param_ap_brdg_en: set ap_bridging enable/disable
1065  * @cdp_vdev_param_cipher_en: set cipher type based on security
1066  * @cdp_vdev_param_qwrap_isolation: qwrap isolation mode
1067  * @cdp_vdev_param_tx_encap: tx encap type
1068  * @cdp_vdev_param_rx_decap: rx decap type
1069  * @cdp_vdev_param_mesh_rx_filter: set mesh rx filter
1070  * @cdp_vdev_param_tidmap_prty: set tid vdev prty
1071  * @cdp_vdev_param_tidmap_tbl_id: set tidmap table id
1072  * @cdp_vdev_param_mesh_mode: set mesh mode
1073  * @cdp_vdev_param_safe_mode: set safe mode
1074  * @cdp_vdev_param_drop_unenc: set drop unencrypted flag
1075  *
1076  * @cdp_pdev_param_dbg_snf: Enable debug sniffer feature
1077  * @cdp_pdev_param_bpr_enable: Enable bcast probe feature
1078  * @cdp_pdev_param_primary_radio: Configure radio as primary
1079  * @cdp_pdev_param_en_perpkt_txstats: Enable per packet statistics
1080  * @cdp_pdev_param_igmpmld_override: Override IGMP/MLD
1081  * @cdp_pdev_param_igmpmld_tid: TID value when igmmld_override is set
1082  * @cdp_pdev_param_arp_dbg_conf: Enable ARP debug
1083  * @cdp_pdev_param_cptr_latcy: Capture time latency
1084  * @cdp_pdev_param_ingrs_stats: Accumulate ingress statistics
1085  * @cdp_pdev_param_osif_drop: Accumulate drops in OSIF layer
1086  * @cdp_pdev_param_en_rx_cap: Enable enhanced RX capture
1087  * @cdp_pdev_param_en_tx_cap: Enable enhanced TX capture
1088  * @cdp_pdev_param_hmmc_tid_ovrd: Enable hmmc tid override
1089  * @cdp_pdev_param_hmmc_tid: set hmmc tid value
1090  * @cdp_pdev_param_tx_capture: set tx capture
1091  * @cdp_pdev_param_chn_noise_flr: set channel noise floor
1092  * @cdp_pdev_param_cfg_vow: set/get vow config
1093  * @cdp_pdev_param_tidq_override: set/get tid queue override
1094  * @cdp_pdev_param_mon_freq: set monitor frequency
1095  * @cdp_pdev_param_bss_color: configure bss color
1096  * @cdp_pdev_param_tidmap_prty: set/get tid map prty
1097  * @cdp_pdev_param_tx_pending: get tx pending
1098  * @cdp_pdev_param_fltr_neigh_peers: filter neighbour peers
1099  * @cdp_pdev_param_fltr_ucast: filter unicast data
1100  * @cdp_pdev_param_fltr_mcast: filter multicast data
1101  * @cdp_pdev_param_fltr_none: filter no data
1102  * @cdp_pdev_param_monitor_chan: monitor channel
1103  *
1104  * @cdp_psoc_param_en_rate_stats: set rate stats enable/disable
1105  * @cdp_psoc_param_en_nss_cfg: set nss cfg
1106  */
1107 typedef union cdp_config_param_t {
1108 	/* peer params */
1109 	bool cdp_peer_param_nawds;
1110 	bool cdp_peer_param_isolation;
1111 	uint8_t cdp_peer_param_nac;
1112 
1113 	/* vdev params */
1114 	bool cdp_vdev_param_wds;
1115 	bool cdp_vdev_param_mec;
1116 	bool cdp_vdev_param_nawds;
1117 	bool cdp_vdev_param_proxysta;
1118 	bool cdp_vdev_param_tdls_flags;
1119 	bool cdp_vdev_param_ap_brdg_en;
1120 	bool cdp_vdev_param_qwrap_isolation;
1121 	bool cdp_vdev_param_update_multipass;
1122 	uint8_t cdp_vdev_param_da_war;
1123 	uint8_t cdp_vdev_param_mcast_en;
1124 	uint8_t cdp_vdev_param_tidmap_prty;
1125 	uint8_t cdp_vdev_param_tidmap_tbl_id;
1126 	uint32_t cdp_vdev_param_aging_tmr;
1127 	uint32_t cdp_vdev_param_cipher_en;
1128 	uint32_t cdp_vdev_param_tx_encap;
1129 	uint32_t cdp_vdev_param_rx_decap;
1130 	uint32_t cdp_vdev_param_mesh_rx_filter;
1131 	uint32_t cdp_vdev_param_mesh_mode;
1132 	uint32_t cdp_vdev_param_safe_mode;
1133 	uint32_t cdp_vdev_param_drop_unenc;
1134 
1135 	/* pdev params */
1136 	bool cdp_pdev_param_cptr_latcy;
1137 	bool cdp_pdev_param_hmmc_tid_ovrd;
1138 	bool cdp_pdev_param_fltr_neigh_peers;
1139 	bool cdp_pdev_param_cfg_vow;
1140 	bool cdp_pdev_param_fltr_mcast;
1141 	bool cdp_pdev_param_fltr_none;
1142 	bool cdp_pdev_param_fltr_ucast;
1143 	uint8_t cdp_pdev_param_primary_radio;
1144 	uint8_t cdp_pdev_param_en_rx_cap;
1145 	uint8_t cdp_pdev_param_en_tx_cap;
1146 	uint8_t cdp_pdev_param_tx_capture;
1147 	uint8_t cdp_pdev_param_hmmc_tid;
1148 	uint8_t cdp_pdev_param_tidmap_prty;
1149 	uint8_t cdp_pdev_param_igmpmld_override;
1150 	uint8_t cdp_pdev_param_igmpmld_tid;
1151 	uint8_t cdp_pdev_param_arp_dbg_conf;
1152 	uint8_t cdp_pdev_param_tidq_override;
1153 	uint8_t cdp_pdev_param_bss_color;
1154 	uint16_t cdp_pdev_param_chn_noise_flr;
1155 	qdf_freq_t cdp_pdev_param_mon_freq;
1156 	int cdp_pdev_param_dbg_snf;
1157 	int cdp_pdev_param_bpr_enable;
1158 	int cdp_pdev_param_monitor_chan;
1159 	uint32_t cdp_pdev_param_ingrs_stats;
1160 	uint32_t cdp_pdev_param_osif_drop;
1161 	uint32_t cdp_pdev_param_en_perpkt_txstats;
1162 	uint32_t cdp_pdev_param_tx_pending;
1163 
1164 	/* psoc params */
1165 	bool cdp_psoc_param_en_rate_stats;
1166 	int cdp_psoc_param_en_nss_cfg;
1167 	int cdp_psoc_param_preferred_hw_mode;
1168 } cdp_config_param_type;
1169 
1170 /**
1171  * cdp_rx_enh_capture_mode - Rx enhanced capture modes
1172  * @CDP_RX_ENH_CAPTURE_DISABLED: Disable Rx enhance capture
1173  * @CDP_RX_ENH_CAPTURE_MPDU: Enable capture of 128 bytes of each MPDU
1174  * @CDP_RX_ENH_CAPTURE_MPDU_MSDU: Enable capture of 128 bytes of each MSDU
1175  */
1176 enum cdp_rx_enh_capture_mode {
1177 	CDP_RX_ENH_CAPTURE_DISABLED = 0,
1178 	CDP_RX_ENH_CAPTURE_MPDU,
1179 	CDP_RX_ENH_CAPTURE_MPDU_MSDU,
1180 };
1181 
1182 /**
1183  * cdp_rx_enh_capture_peer - Rx enhanced capture peer filtering
1184  * @CDP_RX_ENH_CAPTURE_PEER_DISABLED: Disable Rx ENH capture peer filtering
1185  * @CDP_RX_ENH_CAPTURE_PEER_ENABLED: Enable Rx ENH capture peer filtering
1186  */
1187 enum cdp_rx_enh_capture_peer {
1188 	CDP_RX_ENH_CAPTURE_PEER_DISABLED = 0,
1189 	CDP_RX_ENH_CAPTURE_PEER_ENABLED,
1190 };
1191 
1192 /**
1193  * cdp_tx_enh_capture_mode - Tx enhanced capture modes
1194  * @CDP_TX_ENH_CAPTURE_DISABLED: Disable Tx enhance capture for all peers
1195  * @CDP_TX_ENH_CAPTURE_ENABLE_ALL_PEERS: Enable tx capture for all peers
1196  * @CDP_TX_ENH_CAPTURE_ENDIS_PER_PEER: Enable/disable per peer as necessary
1197  */
1198 enum cdp_tx_enh_capture_mode {
1199 	CDP_TX_ENH_CAPTURE_DISABLED = 0,
1200 	CDP_TX_ENH_CAPTURE_ENABLE_ALL_PEERS,
1201 	CDP_TX_ENH_CAPTURE_ENDIS_PER_PEER,
1202 	CDP_TX_ENH_CAPTURE_MAX,
1203 };
1204 
1205 /*
1206  * enum cdp_pdev_bpr_param - different types of parameters
1207  *			     to set value in pdev
1208  * @CDP_BPR_DISABLE: Set bpr to disable state
1209  * @CDP_BPR_ENABLE: set bpr to enable state
1210  *
1211  * Enum indicating bpr state to enable/disable.
1212  */
1213 enum cdp_pdev_bpr_param {
1214 	CDP_BPR_DISABLE,
1215 	CDP_BPR_ENABLE,
1216 };
1217 
1218 /*
1219  * cdp_vdev_param_type: different types of parameters
1220  *			to set values in vdev
1221  * @CDP_ENABLE_NAWDS: set nawds enable/disable
1222  * @CDP_ENABLE_MCAST_EN: enable/disable multicast enhancement
1223  * @CDP_ENABLE_WDS: wds sta
1224  * @CDP_ENABLE_MEC: MEC enable flags
1225  * @CDP_ENABLE_PROXYSTA: proxy sta
1226  * @CDP_UPDATE_TDLS_FLAGS: tdls link flags
1227  * @CDP_ENABLE_AP_BRIDGE: set ap_bridging enable/disable
1228  * @CDP_ENABLE_CIPHER : set cipher type based on security
1229  * @CDP_ENABLE_QWRAP_ISOLATION: qwrap isolation mode
1230  * @CDP_TX_ENCAP_TYPE: tx encap type
1231  * @CDP_RX_DECAP_TYPE: rx decap type
1232  * @CDP_MESH_RX_FILTER: set mesh rx filter
1233  * @CDP_TID_VDEV_PRTY: set tid vdev prty
1234  * @CDP_TIDMAP_TBL_ID: set tidmap table id
1235  * @CDP_MESH_MODE: set mesh mode
1236  * @CDP_SAFEMODE: set safe mode
1237  * @CDP_DROP_UNENC: set drop unencrypted flag
1238  */
1239 enum cdp_vdev_param_type {
1240 	CDP_ENABLE_NAWDS,
1241 	CDP_ENABLE_MCAST_EN,
1242 	CDP_ENABLE_WDS,
1243 	CDP_ENABLE_MEC,
1244 	CDP_ENABLE_DA_WAR,
1245 	CDP_ENABLE_PROXYSTA,
1246 	CDP_UPDATE_TDLS_FLAGS,
1247 	CDP_CFG_WDS_AGING_TIMER,
1248 	CDP_ENABLE_AP_BRIDGE,
1249 	CDP_ENABLE_CIPHER,
1250 	CDP_ENABLE_QWRAP_ISOLATION,
1251 	CDP_UPDATE_MULTIPASS,
1252 	CDP_TX_ENCAP_TYPE,
1253 	CDP_RX_DECAP_TYPE,
1254 	CDP_MESH_RX_FILTER,
1255 	CDP_TID_VDEV_PRTY,
1256 	CDP_TIDMAP_TBL_ID,
1257 #ifdef MESH_MODE_SUPPORT
1258 	CDP_MESH_MODE,
1259 #endif
1260 	CDP_SAFEMODE,
1261 	CDP_DROP_UNENC,
1262 };
1263 
1264 /*
1265  * cdp_psoc_param_type: different types of parameters
1266  *			to set values in psoc
1267  * @CDP_ENABLE_RATE_STATS: set rate stats enable/disable
1268  * @CDP_SET_NSS_CFG: set nss cfg
1269  * @CDP_SET_PREFERRED_HW_MODE: set preferred hw mode
1270  */
1271 enum cdp_psoc_param_type {
1272 	CDP_ENABLE_RATE_STATS,
1273 	CDP_SET_NSS_CFG,
1274 	CDP_SET_PREFERRED_HW_MODE,
1275 };
1276 
1277 #define TXRX_FW_STATS_TXSTATS                     1
1278 #define TXRX_FW_STATS_RXSTATS                     2
1279 #define TXRX_FW_STATS_RX_RATE_INFO                3
1280 #define TXRX_FW_STATS_PHYSTATS                    4
1281 #define TXRX_FW_STATS_PHYSTATS_CONCISE            5
1282 #define TXRX_FW_STATS_TX_RATE_INFO                6
1283 #define TXRX_FW_STATS_TID_STATE                   7
1284 #define TXRX_FW_STATS_HOST_STATS                  8
1285 #define TXRX_FW_STATS_CLEAR_HOST_STATS            9
1286 #define TXRX_FW_STATS_CE_STATS                   10
1287 #define TXRX_FW_STATS_VOW_UMAC_COUNTER           11
1288 #define TXRX_FW_STATS_ME_STATS                   12
1289 #define TXRX_FW_STATS_TXBF_INFO                  13
1290 #define TXRX_FW_STATS_SND_INFO                   14
1291 #define TXRX_FW_STATS_ERROR_INFO                 15
1292 #define TXRX_FW_STATS_TX_SELFGEN_INFO            16
1293 #define TXRX_FW_STATS_TX_MU_INFO                 17
1294 #define TXRX_FW_SIFS_RESP_INFO                   18
1295 #define TXRX_FW_RESET_STATS                      19
1296 #define TXRX_FW_MAC_WDOG_STATS                   20
1297 #define TXRX_FW_MAC_DESC_STATS                   21
1298 #define TXRX_FW_MAC_FETCH_MGR_STATS              22
1299 #define TXRX_FW_MAC_PREFETCH_MGR_STATS           23
1300 #define TXRX_FW_STATS_DURATION_INFO              24
1301 #define TXRX_FW_STATS_DURATION_INFO_RESET        25
1302 #define TXRX_FW_HALPHY_STATS                     26
1303 #define TXRX_FW_COEX_STATS                       27
1304 
1305 #define PER_RADIO_FW_STATS_REQUEST 0
1306 #define PER_VDEV_FW_STATS_REQUEST 1
1307 /**
1308  * enum data_stall_log_event_indicator - Module triggering data stall
1309  * @DATA_STALL_LOG_INDICATOR_UNUSED: Unused
1310  * @DATA_STALL_LOG_INDICATOR_HOST_DRIVER: Host driver indicates data stall
1311  * @DATA_STALL_LOG_INDICATOR_FIRMWARE: FW indicates data stall
1312  * @DATA_STALL_LOG_INDICATOR_FRAMEWORK: Framework indicates data stall
1313  *
1314  * Enum indicating the module that indicates data stall event
1315  */
1316 enum data_stall_log_event_indicator {
1317 	DATA_STALL_LOG_INDICATOR_UNUSED,
1318 	DATA_STALL_LOG_INDICATOR_HOST_DRIVER,
1319 	DATA_STALL_LOG_INDICATOR_FIRMWARE,
1320 	DATA_STALL_LOG_INDICATOR_FRAMEWORK,
1321 };
1322 
1323 /**
1324  * enum data_stall_log_event_type - data stall event type
1325  * @DATA_STALL_LOG_NONE
1326  * @DATA_STALL_LOG_FW_VDEV_PAUSE
1327  * @DATA_STALL_LOG_HWSCHED_CMD_FILTER
1328  * @DATA_STALL_LOG_HWSCHED_CMD_FLUSH
1329  * @DATA_STALL_LOG_FW_RX_REFILL_FAILED
1330  * @DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR
1331  * @DATA_STALL_LOG_FW_WDOG_ERRORS
1332  * @DATA_STALL_LOG_BB_WDOG_ERROR
1333  * @DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR
1334  * @DATA_STALL_LOG_HOST_STA_TX_TIMEOUT
1335  * @DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT
1336  * @DATA_STALL_LOG_NUD_FAILURE
1337  *
1338  * Enum indicating data stall event type
1339  */
1340 enum data_stall_log_event_type {
1341 	DATA_STALL_LOG_NONE,
1342 	DATA_STALL_LOG_FW_VDEV_PAUSE,
1343 	DATA_STALL_LOG_HWSCHED_CMD_FILTER,
1344 	DATA_STALL_LOG_HWSCHED_CMD_FLUSH,
1345 	DATA_STALL_LOG_FW_RX_REFILL_FAILED,
1346 	DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR,
1347 	DATA_STALL_LOG_FW_WDOG_ERRORS,
1348 	DATA_STALL_LOG_BB_WDOG_ERROR,
1349 	DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR,
1350 	/* Stall events triggered by host/framework start from 0x100 onwards. */
1351 	DATA_STALL_LOG_HOST_STA_TX_TIMEOUT = 0x100,
1352 	DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT,
1353 	DATA_STALL_LOG_NUD_FAILURE,
1354 };
1355 
1356 /**
1357  * enum data_stall_log_recovery_type - data stall recovery type
1358  * @DATA_STALL_LOG_RECOVERY_NONE,
1359  * @DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
1360  * @DATA_STALL_LOG_RECOVERY_TRIGGER_PDR
1361  *
1362  * Enum indicating data stall recovery type
1363  */
1364 enum data_stall_log_recovery_type {
1365 	DATA_STALL_LOG_RECOVERY_NONE = 0,
1366 	DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
1367 	DATA_STALL_LOG_RECOVERY_TRIGGER_PDR,
1368 };
1369 
1370 /**
1371  * struct data_stall_event_info - data stall info
1372  * @indicator: Module triggering data stall
1373  * @data_stall_type: data stall event type
1374  * @vdev_id_bitmap: vdev_id_bitmap
1375  * @pdev_id: pdev id
1376  * @recovery_type: data stall recovery type
1377  */
1378 struct data_stall_event_info {
1379 	uint32_t indicator;
1380 	uint32_t data_stall_type;
1381 	uint32_t vdev_id_bitmap;
1382 	uint32_t pdev_id;
1383 	uint32_t recovery_type;
1384 };
1385 
1386 typedef void (*data_stall_detect_cb)(struct data_stall_event_info *);
1387 
1388 /*
1389  * enum cdp_stats - options for host and firmware
1390  * statistics
1391  * @CDP_TXRX_STATS_1: HTT Pdev tx stats
1392  * @CDP_TXRX_STATS_2: HTT Pdev rx stats
1393  * @CDP_TXRX_STATS_3: HTT Pdev Tx HW Queue stats
1394  * @CDP_TXRX_STATS_4: HTT Pdev Tx HW Sched stats
1395  * @CDP_TXRX_STATS_5: HTT Pdev error stats
1396  * @CDP_TXRX_STATS_6: HTT TQM stats
1397  * @CDP_TXRX_STATS_7: HTT TQM CMDQ stats
1398  * @CDP_TXRX_STATS_8: HTT Tx_de_cmn thread stats
1399  * @CDP_TXRX_STATS_9: HTT Pdev Tx rate stats
1400  * @CDP_TXRX_STATS_10: HTT Pdev Rx rate stats
1401  * @CDP_TXRX_STATS_11: HTT Peer stats
1402  * @CDP_TXRX_STATS_12: HTT Tx Self Gen Info
1403  * @CDP_TXRX_STATS_13: HTT Tx MU HWQ stats
1404  * @CDP_TXRX_STATS_14: HTT Ring interface info stats
1405  * @CDP_TXRX_STATS_15: HTT SRNG info stats
1406  * @CDP_TXRX_STATS_16: HTT SFM info stats
1407  * @CDP_TXRX_STATS_17: HTT Pdev tx mu mimo sched info
1408  * @CDP_TXRX_STATS_18: HTT Peer list details
1409  * @CDP_TXRX_STATS_19: Reserved
1410  * @CDP_TXRX_STATS_20: Reset Host stats
1411  * @CDP_TXRX_STATS_21: Host Rx rate stats
1412  * @CDP_TXRX_STATS_22: Host Tx rate stats
1413  * @CDP_TXRX_STATS_23: Host Tx stats
1414  * @CDP_TXRX_STATS_24: Host Rx stats
1415  * @CDP_TXRX_STATS_25: Host Ast stats
1416  * @CDP_TXRX_STATS_26: Host Head/Tail Pointer stats
1417  * @CDP_TXRX_STATS_27: Host Monitor mode stats
1418  * @CDP_TXRX_STATS_28: Host Peer entry stats
1419  * @CDP_TXRX_STATS_29: Host Soc config params info
1420  * @CDP_TXRX_STATS_30: Host Pdev config params info
1421  * @CDP_TXRX_STATS_31: Host DP Interrupt Stats
1422  */
1423 enum cdp_stats {
1424 	CDP_TXRX_STATS_0  = 0,
1425 	CDP_TXRX_STATS_1,
1426 	CDP_TXRX_STATS_2,
1427 	CDP_TXRX_STATS_3,
1428 	CDP_TXRX_STATS_4,
1429 	CDP_TXRX_STATS_5,
1430 	CDP_TXRX_STATS_6,
1431 	CDP_TXRX_STATS_7,
1432 	CDP_TXRX_STATS_8,
1433 	CDP_TXRX_STATS_9,
1434 	CDP_TXRX_STATS_10,
1435 	CDP_TXRX_STATS_11,
1436 	CDP_TXRX_STATS_12,
1437 	CDP_TXRX_STATS_13,
1438 	CDP_TXRX_STATS_14,
1439 	CDP_TXRX_STATS_15,
1440 	CDP_TXRX_STATS_16,
1441 	CDP_TXRX_STATS_17,
1442 	CDP_TXRX_STATS_18,
1443 	CDP_TXRX_STATS_19,
1444 	CDP_TXRX_STATS_20,
1445 	CDP_TXRX_STATS_21,
1446 	CDP_TXRX_STATS_22,
1447 	CDP_TXRX_STATS_23,
1448 	CDP_TXRX_STATS_24,
1449 	CDP_TXRX_STATS_25,
1450 	CDP_TXRX_STATS_26,
1451 	CDP_TXRX_STATS_27,
1452 	CDP_TXRX_STATS_28,
1453 	CDP_TXRX_STATS_29,
1454 	CDP_TXRX_STATS_30,
1455 	CDP_TXRX_STATS_31,
1456 	CDP_TXRX_STATS_HTT_MAX = 256,
1457 	CDP_TXRX_MAX_STATS = 265,
1458 };
1459 
1460 /*
1461  * Different Stat update types sent to OL_IF
1462  * @UPDATE_PEER_STATS: update peer stats
1463  * @UPDATE_VDEV_STATS: update vdev stats
1464  * @UPDATE_PDE_STATS: Update pdev stats
1465  */
1466 enum cdp_stat_update_type {
1467 	UPDATE_PEER_STATS = 0,
1468 	UPDATE_VDEV_STATS = 1,
1469 	UPDATE_PDEV_STATS = 2,
1470 };
1471 
1472 /*
1473  * struct cdp_tx_sojourn_stats - Tx sojourn stats
1474  * @ppdu_seq_id: ppdu_seq_id from tx completion
1475  * @avg_sojourn_msdu: average sojourn msdu time
1476  * @sum_sojourn_msdu: sum sojourn msdu time
1477  * @num_msdu: number of msdus per ppdu
1478  * @cookie: cookie to be used by upper layer
1479  */
1480 struct cdp_tx_sojourn_stats {
1481 	uint32_t ppdu_seq_id;
1482 	qdf_ewma_tx_lag avg_sojourn_msdu[CDP_DATA_TID_MAX];
1483 	uint32_t sum_sojourn_msdu[CDP_DATA_TID_MAX];
1484 	uint32_t num_msdus[CDP_DATA_TID_MAX];
1485 	struct cdp_stats_cookie *cookie;
1486 };
1487 
1488 /**
1489  * struct cdp_delayed_tx_completion_ppdu_user - Delayed Tx PPDU completion
1490  * per-user information
1491  * @frame_ctrl: frame control field in 802.11 header
1492  * @qos_ctrl: QoS control field in 802.11 header
1493  * @mpdu_tried: number of mpdus tried
1494  * @ltf_size: ltf_size
1495  * @stbc: stbc
1496  * @he_re: he_re (range extension)
1497  * @txbf: txbf
1498  * @bw: Transmission bandwidth
1499  *       <enum 2 transmit_bw_20_MHz>
1500  *       <enum 3 transmit_bw_40_MHz>
1501  *       <enum 4 transmit_bw_80_MHz>
1502  *       <enum 5 transmit_bw_160_MHz>
1503  * @nss: NSS 1,2, ...8
1504  * @mcs: MCS index
1505  * @preamble: preamble
1506  * @gi: guard interval 800/400/1600/3200 ns
1507  * @dcm: dcm
1508  * @ldpc: ldpc
1509  * @ru_start: RU start index
1510  * @ru_tones: RU tones length
1511  * @is_mcast: MCAST or UCAST
1512  * @user_pos: user position
1513  * @mu_group_id: mu group id
1514  * @ppdu_start_timestamp: 64 bits ppdu start timestamp
1515  * @ppdu_end_timestamp: 64 bits ppdu end timestamp
1516  */
1517 struct cdp_delayed_tx_completion_ppdu_user {
1518 	uint32_t frame_ctrl:16,
1519 		 qos_ctrl:16;
1520 	uint32_t mpdu_tried_ucast:16,
1521 		mpdu_tried_mcast:16;
1522 	uint32_t ltf_size:2,
1523 		 stbc:1,
1524 		 he_re:1,
1525 		 txbf:4,
1526 		 bw:4,
1527 		 nss:4,
1528 		 mcs:4,
1529 		 preamble:4,
1530 		 gi:4,
1531 		 dcm:1,
1532 		 ldpc:1,
1533 		 delayed_ba:1;
1534 	uint16_t ru_start;
1535 	uint16_t ru_tones;
1536 	bool is_mcast;
1537 	uint32_t user_pos;
1538 	uint32_t mu_group_id;
1539 	uint64_t ppdu_start_timestamp;
1540 	uint64_t ppdu_end_timestamp;
1541 };
1542 
1543 /**
1544  * struct cdp_tx_completion_ppdu_user - Tx PPDU completion per-user information
1545  * @completion_status: completion status - OK/Filter/Abort/Timeout
1546  * @tid: TID number
1547  * @peer_id: Peer ID
1548  * @ba_size: Block-Ack size
1549  * @frame_ctrl: frame control field in 802.11 header
1550  * @qos_ctrl: QoS control field in 802.11 header
1551  * @mpdu_tried: number of mpdus tried
1552  * @mpdu_success: number of mpdus successfully transmitted
1553  * @long_retries: long retries
1554  * @short_retries: short retries
1555  * @is_ampdu: mpdu aggregate or non-aggregate?
1556  * @success_bytes: bytes successfully transmitted
1557  * @retry_bytes: bytes retried
1558  * @failed_msdus: MSDUs failed transmission
1559  * @duration: user duration in ppdu
1560  * @ltf_size: ltf_size
1561  * @stbc: stbc
1562  * @he_re: he_re (range extension)
1563  * @txbf: txbf
1564  * @bw: Transmission bandwidth
1565  *       <enum 2 transmit_bw_20_MHz>
1566  *       <enum 3 transmit_bw_40_MHz>
1567  *       <enum 4 transmit_bw_80_MHz>
1568  *       <enum 5 transmit_bw_160_MHz>
1569  * @nss: NSS 1,2, ...8
1570  * @mcs: MCS index
1571  * @preamble: preamble
1572  * @gi: guard interval 800/400/1600/3200 ns
1573  * @dcm: dcm
1574  * @ldpc: ldpc
1575  * @delayed_ba: delayed ba bit
1576  * @ack_ba_tlv: ack ba recv tlv bit
1577  * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
1578  * UL_BSR_TRIG/UNKNOWN
1579  * @ba_seq_no: Block Ack sequence number
1580  * @ba_bitmap: Block Ack bitmap
1581  * @start_seqa: Sequence number of first MPDU
1582  * @enq_bitmap: Enqueue MPDU bitmap
1583  * @ru_start: RU start index
1584  * @ru_tones: RU tones length
1585  * @is_mcast: MCAST or UCAST
1586  * @tx_rate: Transmission Rate
1587  * @user_pos: user position
1588  * @mu_group_id: mu group id
1589  * @rix: rate index
1590  * @cookie: cookie to used by upper layer
1591  * @is_ppdu_cookie_valid : Indicates that ppdu_cookie is valid
1592  * @ppdu_cookie: 16-bit ppdu_cookie
1593  * @sa_is_training: smart antenna training packets indication
1594  * @rssi_chain: rssi chain per bandwidth
1595  * @sa_tx_antenna: antenna in which packet is transmitted
1596  * @sa_max_rates: smart antenna tx feedback info max rates
1597  * @sa_goodput: smart antenna tx feedback info goodput
1598  * @current_rate_per: Moving average per
1599  * @last_enq_seq: last equeue sequence number
1600  * @mpdu_q: queue of mpdu in a ppdu
1601  * @mpdus: MPDU list based on enqueue sequence bitmap
1602  * @pending_retries: pending MPDUs (retries)
1603  * @tlv_bitmap: per user tlv bitmap
1604  * @skip: tx capture skip flag
1605  */
1606 struct cdp_tx_completion_ppdu_user {
1607 	uint32_t completion_status:8,
1608 		 tid:8,
1609 		 peer_id:16;
1610 	uint8_t mac_addr[6];
1611 	uint16_t ba_size;
1612 	uint32_t frame_ctrl:16,
1613 		 qos_ctrl:16;
1614 	uint32_t mpdu_tried_ucast:16,
1615 		mpdu_tried_mcast:16;
1616 	uint16_t mpdu_success:16;
1617 	uint16_t mpdu_failed:16;
1618 	uint32_t long_retries:4,
1619 		 short_retries:4,
1620 		 tx_ratecode:16,
1621 		 is_ampdu:1,
1622 		 ppdu_type:5;
1623 	uint32_t success_bytes;
1624 	uint32_t retry_bytes;
1625 	uint32_t failed_bytes;
1626 	uint32_t success_msdus:16,
1627 		 retry_msdus:16;
1628 	uint32_t failed_msdus:16,
1629 		 duration:16;
1630 	uint32_t ltf_size:2,
1631 		 stbc:1,
1632 		 he_re:1,
1633 		 txbf:4,
1634 		 bw:4,
1635 		 nss:4,
1636 		 mcs:4,
1637 		 preamble:4,
1638 		 gi:4,
1639 		 dcm:1,
1640 		 ldpc:1,
1641 		 delayed_ba:1,
1642 		 ack_ba_tlv:1;
1643 	uint32_t ba_seq_no;
1644 	uint32_t ba_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1645 	uint32_t start_seq;
1646 	uint32_t enq_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1647 	uint32_t failed_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1648 	uint32_t num_mpdu:9,
1649 		 num_msdu:16;
1650 	uint32_t tx_duration;
1651 	uint16_t ru_start;
1652 	uint16_t ru_tones;
1653 	bool is_mcast;
1654 	uint32_t tx_rate;
1655 	uint32_t tx_ratekbps;
1656 	/*ack rssi for separate chains*/
1657 	uint32_t ack_rssi[CDP_RSSI_CHAIN_LEN];
1658 	bool ack_rssi_valid;
1659 	uint32_t user_pos;
1660 	uint32_t mu_group_id;
1661 	uint32_t rix;
1662 	struct cdp_stats_cookie *cookie;
1663 	uint8_t is_ppdu_cookie_valid;
1664 	uint16_t ppdu_cookie;
1665 	uint8_t sa_is_training;
1666 	uint32_t rssi_chain[CDP_RSSI_CHAIN_LEN];
1667 	uint32_t sa_tx_antenna;
1668 	/*Max rates for BW: 20MHZ, 40MHZ and 80MHZ and 160MHZ
1669 	 * |---------------------------------------|
1670 	 * | 16 bits | 16 bits | 16 bits | 16 bits |
1671 	 * |   BW-1  |   BW-2  |   BW-3  |   BW-4  |
1672 	 * |      /\  \                            |
1673 	 * |     /  \  \                           |
1674 	 * |    /    \  \                          |
1675 	 * |   /      \  \                         |
1676 	 * |  /        \  \                        |
1677 	 * | /          \  \                       |
1678 	 * |/            \  \                      |
1679 	 * |[11|8]     [5|8] \                     |
1680 	 * | BW1      PADDED  \                    |
1681 	 * |---------------------------------------|
1682 	 */
1683 	uint16_t sa_max_rates[CDP_NUM_SA_BW];
1684 	uint32_t sa_goodput;
1685 	/* below field is used to calculate goodput in non-training period
1686 	 * Note: As host is exposing goodput and hence current_rate_per is
1687 	 * of no use. It is just for Host computation.
1688 	 */
1689 	uint32_t current_rate_per;
1690 	uint32_t last_enq_seq;
1691 
1692 	qdf_nbuf_queue_t mpdu_q;
1693 	qdf_nbuf_t *mpdus;
1694 	uint32_t pending_retries;
1695 	uint32_t tlv_bitmap;
1696 	bool skip;
1697 };
1698 
1699 /**
1700  * struct cdp_tx_indication_mpdu_info - Tx MPDU completion information
1701  * @ppdu_id: PPDU id
1702  * @duration: user duration in ppdu
1703  * @frame_type: frame type MGMT/CTRL/DATA/BAR
1704  * @frame_ctrl: frame control field in 802.11 header
1705  * @qos_ctrl: QoS control field in 802.11 header
1706  * @tid: TID number
1707  * @num_msdu: number of msdu in MPDU
1708  * @seq_no: Sequence number of first MPDU
1709  * @ltf_size: ltf_size
1710  * @stbc: stbc
1711  * @he_re: he_re (range extension)
1712  * @txbf: txbf
1713  * @bw: Transmission bandwidth
1714  *       <enum 2 transmit_bw_20_MHz>
1715  *       <enum 3 transmit_bw_40_MHz>
1716  *       <enum 4 transmit_bw_80_MHz>
1717  *       <enum 5 transmit_bw_160_MHz>
1718  * @nss: NSS 1,2, ...8
1719  * @mcs: MCS index
1720  * @preamble: preamble
1721  * @gi: guard interval 800/400/1600/3200 ns
1722  * @resp_type: response type
1723  * @mprot_type: medium protection type
1724  * @rts_success: rts success
1725  * @rts failure: rts failure
1726  * @channel: frequency
1727  * @channel_num: channel number
1728  * @ack_rssi: ack rssi
1729  * @ldpc: ldpc
1730  * @tx_rate: Transmission Rate
1731  * @mac_address: peer mac address
1732  * @bss_mac_address: bss mac address
1733  * @ppdu_start_timestamp: TSF at PPDU start
1734  * @ppdu_end_timestamp: TSF at PPDU end
1735  * @ba_start_seq: Block Ack sequence number
1736  * @ba_bitmap: Block Ack bitmap
1737  * @ppdu_cookie: 16-bit ppdu_cookie
1738  * @long_retries: long retries
1739  * @short_retries: short retries
1740  * @completion_status: completion status - OK/Filter/Abort/Timeout
1741  * @usr_idx: user index
1742  */
1743 struct cdp_tx_indication_mpdu_info {
1744 	uint32_t ppdu_id;
1745 	uint32_t tx_duration;
1746 	uint16_t frame_type;
1747 	uint16_t frame_ctrl;
1748 	uint16_t qos_ctrl;
1749 	uint8_t tid;
1750 	uint32_t num_msdu;
1751 	uint32_t seq_no;
1752 	uint32_t ltf_size:2,
1753 		 he_re:1,
1754 		 txbf:4,
1755 		 bw:4,
1756 		 nss:4,
1757 		 mcs:4,
1758 		 preamble:4,
1759 		 gi:4;
1760 	uint32_t channel;
1761 	uint8_t channel_num;
1762 	uint32_t ack_rssi;
1763 	uint32_t ldpc;
1764 	uint32_t tx_rate;
1765 	uint8_t mac_address[QDF_MAC_ADDR_SIZE];
1766 	uint8_t bss_mac_address[QDF_MAC_ADDR_SIZE];
1767 	uint64_t ppdu_start_timestamp;
1768 	uint64_t ppdu_end_timestamp;
1769 	uint32_t ba_start_seq;
1770 	uint32_t ba_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1771 	uint16_t ppdu_cookie;
1772 	uint16_t long_retries:4,
1773 		 short_retries:4,
1774 		 completion_status:8;
1775 	uint16_t resp_type:4,
1776 		 mprot_type:3,
1777 		 rts_success:1,
1778 		 rts_failure:1;
1779 	uint8_t usr_idx;
1780 };
1781 
1782 /**
1783  * struct cdp_tx_indication_info - Tx capture information
1784  * @mpdu_info: Tx MPDU completion information
1785  * @mpdu_nbuf: reconstructed mpdu packet
1786  * @ppdu_desc: tx completion ppdu
1787  */
1788 struct cdp_tx_indication_info {
1789 	struct cdp_tx_indication_mpdu_info mpdu_info;
1790 	qdf_nbuf_t mpdu_nbuf;
1791 	struct cdp_tx_completion_ppdu *ppdu_desc;
1792 };
1793 
1794 /**
1795  * struct cdp_tx_mgmt_comp_info - Tx mgmt comp info
1796  * @ppdu_id: ppdu_id
1797  * @is_sgen_pkt: payload recevied from wmi or htt path
1798  * @retries_count: retries count
1799  * @tx_tsf: 64 bit timestamp
1800  */
1801 struct cdp_tx_mgmt_comp_info {
1802 	uint32_t ppdu_id;
1803 	bool is_sgen_pkt;
1804 	uint16_t retries_count;
1805 	uint64_t tx_tsf;
1806 };
1807 
1808 /**
1809  * struct cdp_tx_completion_ppdu - Tx PPDU completion information
1810  * @completion_status: completion status - OK/Filter/Abort/Timeout
1811  * @ppdu_id: PPDU Id
1812  * @ppdu_seq_id: ppdu sequence id for sojourn stats
1813  * @vdev_id: VAP Id
1814  * @bar_num_users: BA response user count, based on completion common TLV
1815  * @num_users: Number of users
1816  * @drop_reason: drop reason from flush status
1817  * @is_flush: is_flush is set based on flush tlv
1818  * @flow_type: tx flow type from flush status
1819  * @queue_type: queue type from flush status
1820  * @num_mpdu: Number of MPDUs in PPDU
1821  * @num_msdu: Number of MSDUs in PPDU
1822  * @frame_type: frame SU or MU
1823  * @htt_frame_type: frame type from htt
1824  * @frame_ctrl: frame control of 80211 header
1825  * @channel: Channel informartion
1826  * @resp_type: response type
1827  * @mprot_type: medium protection type
1828  * @rts_success: rts success
1829  * @rts failure: rts failure
1830  * @phymode: phy mode
1831  * @ack_rssi: RSSI value of last ack packet (units=dB above noise floor)
1832  * @tx_duration: PPDU airtime
1833  * @ppdu_start_timestamp: TSF at PPDU start
1834  * @ppdu_end_timestamp: TSF at PPDU end
1835  * @ack_timestamp: TSF at the reception of ACK
1836  * @delayed_ba: Delayed ba flag
1837  * @beam_change: beam change bit in ppdu for he-information
1838  * @bss_color: 6 bit value for full bss color
1839  * @doppler: value for doppler (will be 0 most of the times)
1840  * @spatial_reuse: value for spatial reuse used in radiotap HE header
1841  * @user: per-User stats (array of per-user structures)
1842  * @bar_ppdu_id: BAR ppdu_id
1843  * @bar_tx_duration: BAR tx duration
1844  * @bar_ppdu_start_timestamp: BAR start timestamp
1845  * @bar_ppdu_end_timestamp: BAR end timestamp
1846  * @tlv_bitmap: tlv_bitmap for the PPDU
1847  * @sched_cmdid: schedule command id
1848  */
1849 struct cdp_tx_completion_ppdu {
1850 	uint32_t ppdu_id;
1851 	uint32_t ppdu_seq_id;
1852 	uint16_t vdev_id;
1853 	uint16_t bar_num_users;
1854 	uint32_t num_users;
1855 	uint8_t last_usr_index;
1856 	uint32_t drop_reason;
1857 	uint32_t is_flush:1,
1858 		 flow_type:8,
1859 		 queue_type:8;
1860 	uint32_t num_mpdu:9,
1861 		 num_msdu:16;
1862 	uint16_t frame_type;
1863 	uint16_t htt_frame_type;
1864 	uint16_t frame_ctrl;
1865 	uint16_t channel;
1866 	uint16_t resp_type:4,
1867 		 mprot_type:3,
1868 		 rts_success:1,
1869 		 rts_failure:1;
1870 	uint16_t phy_mode;
1871 	uint32_t ack_rssi;
1872 	uint32_t tx_duration;
1873 	uint64_t ppdu_start_timestamp;
1874 	uint64_t ppdu_end_timestamp;
1875 	uint64_t ack_timestamp;
1876 	bool delayed_ba;
1877 	uint8_t beam_change;
1878 	uint8_t bss_color;
1879 	uint8_t doppler;
1880 	uint8_t spatial_reuse;
1881 	struct cdp_tx_completion_ppdu_user user[CDP_MU_MAX_USERS];
1882 	uint32_t bar_ppdu_id;
1883 	uint32_t bar_tx_duration;
1884 	uint32_t bar_ppdu_start_timestamp;
1885 	uint32_t bar_ppdu_end_timestamp;
1886 	uint32_t tlv_bitmap;
1887 	uint16_t sched_cmdid;
1888 };
1889 
1890 /**
1891  * struct cdp_dev_stats - Network device stats structure
1892  * @tx_packets: Tx total packets transmitted
1893  * @tx_bytes  : Tx total bytes transmitted
1894  * @tx_errors : Tx error due to FW tx failure, Ring failure DMA etc
1895  * @tx_dropped: Tx dropped is same as tx errors as above
1896  * @rx_packets: Rx total packets transmitted
1897  * @rx_bytes  : Rx total bytes transmitted
1898  * @rx_errors : Rx erros
1899  * @rx_dropped: Rx dropped stats
1900  */
1901 struct cdp_dev_stats {
1902 	uint32_t tx_packets;
1903 	uint32_t tx_bytes;
1904 	uint32_t tx_errors;
1905 	uint32_t tx_dropped;
1906 	uint32_t rx_packets;
1907 	uint32_t rx_bytes;
1908 	uint32_t rx_errors;
1909 	uint32_t rx_dropped;
1910 };
1911 
1912 /**
1913  * struct cdp_rate_stats - Tx/Rx Rate statistics
1914  * @bw: Indicates the BW of the upcoming transmission -
1915  *       <enum 2 transmit_bw_20_MHz>
1916  *       <enum 3 transmit_bw_40_MHz>
1917  *       <enum 4 transmit_bw_80_MHz>
1918  *       <enum 5 transmit_bw_160_MHz>
1919  * @pkt_type: Transmit Packet Type
1920  * @stbc: When set, STBC transmission rate was used
1921  * @ldpc: When set, use LDPC transmission rates
1922  * @sgi: <enum 0     0_8_us_sgi > Legacy normal GI
1923  *       <enum 1     0_4_us_sgi > Legacy short GI
1924  *       <enum 2     1_6_us_sgi > HE related GI
1925  *       <enum 3     3_2_us_sgi > HE
1926  * @mcs: Transmit MCS Rate
1927  * @ofdma: Set when the transmission was an OFDMA transmission
1928  * @tones_in_ru: The number of tones in the RU used.
1929  * @tsf: Lower 32 bits of the TSF (timestamp when ppdu transmission finished)
1930  * @peer_id: Peer ID of the flow or MPDU queue
1931  * @tid: TID of the flow or MPDU queue
1932  */
1933 struct cdp_rate_stats {
1934 	uint32_t rate_stats_info_valid:1,
1935 		 bw:2,
1936 		 pkt_type:4,
1937 		 stbc:1,
1938 		 ldpc:1,
1939 		 sgi:2,
1940 		 mcs:4,
1941 		 ofdma:1,
1942 		 tones_in_ru:12,
1943 		 resvd0:4;
1944 	uint32_t tsf;
1945 	uint16_t peer_id;
1946 	uint8_t tid;
1947 };
1948 
1949 /**
1950  * struct cdp_tx_completion_msdu - Tx MSDU completion descriptor
1951  * @ppdu_id: PPDU to which this MSDU belongs
1952  * @transmit_cnt: Number of times this frame has been transmitted
1953  * @ack_frame_rssi: RSSI of the received ACK or BA frame
1954  * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
1955  * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
1956  * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
1957  * @extd: Extended structure containing rate statistics
1958  */
1959 struct cdp_tx_completion_msdu {
1960 	uint32_t ppdu_id;
1961 	uint8_t transmit_cnt;
1962 	uint32_t ack_frame_rssi:8,
1963 		 resvd0:1,
1964 		 first_msdu:1,
1965 		 last_msdu:1,
1966 		 msdu_part_of_amsdu:1,
1967 		 resvd1:20;
1968 	struct cdp_rate_stats extd;
1969 };
1970 
1971 /**
1972  * struct cdp_rx_stats_ppdu_user -- per user RX stats
1973  * @peer_id: Peer ID
1974  * @vdev_id: VAP ID
1975  * @is_ampdu: mpdu aggregate or non-aggregate?
1976  * @mu_ul_info_valid: MU UL info valid
1977  * @ofdma_ru_start_index: RU index number(0-73)
1978  * @ofdma_ru_width: size of RU in units of 1(26tone)RU
1979  * @nss: NSS 1,2, ...8
1980  * @mcs: MCS index
1981  * @user_index: user ID in multi-user case
1982  * @ast_index: ast index in multi-user case
1983  * @tid: TID number
1984  * @num_msdu: Number of MSDUs in PPDU
1985  * @udp_msdu_count: Number of UDP MSDUs in PPDU
1986  * @tcp_msdu_count: Number of TCP MSDUs in PPDU
1987  * @other_msdu_count: Number of MSDUs other than UDP and TCP MSDUs in PPDU
1988  * @frame_control: frame control field
1989  * @frame_control_info_valid: frame_control valid
1990  * @data_sequence_control_info_valid: data_sequence_control_info valid
1991  * @first_data_seq_ctrl: Sequence control field of first data frame
1992  * @preamble: preamble
1993  * @ht_flag: ht flag
1994  * @vht_flag: vht flag
1995  * @he_re: he_re (range extension)
1996  * @mpdu_cnt_fcs_ok: Number of MPDUs in PPDU with fcs ok
1997  * @mpdu_cnt_fcs_err: Number of MPDUs in PPDU with fcs err
1998  * @mpdu_fcs_ok_bitmap - MPDU with fcs ok bitmap
1999  * @retried - number of retries
2000  * @mac_addr: Peer MAC Address
2001  */
2002 struct cdp_rx_stats_ppdu_user {
2003 	uint16_t peer_id;
2004 	uint8_t vdev_id;
2005 	bool is_ampdu;
2006 	uint32_t mu_ul_info_valid:1,
2007 		 ofdma_ru_start_index:7,
2008 		 ofdma_ru_width:7,
2009 		 nss:4,
2010 		 mcs:4;
2011 	/* user id */
2012 	uint8_t  user_index;
2013 	uint32_t ast_index;
2014 	uint32_t tid;
2015 	uint32_t num_msdu;
2016 	uint16_t  tcp_msdu_count;
2017 	uint16_t  udp_msdu_count;
2018 	uint16_t  other_msdu_count;
2019 	uint16_t frame_control;
2020 	uint8_t  frame_control_info_valid;
2021 	uint8_t data_sequence_control_info_valid;
2022 	uint16_t first_data_seq_ctrl;
2023 	uint32_t preamble_type;
2024 	uint16_t ht_flags;
2025 	uint16_t vht_flags;
2026 	uint16_t he_flags;
2027 	uint32_t mpdu_cnt_fcs_ok;
2028 	uint32_t mpdu_cnt_fcs_err;
2029 	uint32_t mpdu_fcs_ok_bitmap[QDF_MON_STATUS_MPDU_FCS_BMAP_NWORDS];
2030 	uint32_t mpdu_ok_byte_count;
2031 	uint32_t mpdu_err_byte_count;
2032 	uint32_t retries;
2033 	uint8_t  mac_addr[QDF_MAC_ADDR_SIZE];
2034 };
2035 
2036 /**
2037  * struct cdp_rx_indication_ppdu - Rx PPDU indication structure
2038  * @ppdu_id: PPDU Id
2039  * @is_ampdu: mpdu aggregate or non-aggregate?
2040  * @num_mpdu: Number of MPDUs in PPDU
2041  * @reserved: Reserved bits for future use
2042  * @num_msdu: Number of MSDUs in PPDU
2043  * @udp_msdu_count: Number of UDP MSDUs in PPDU
2044  * @tcp_msdu_count: Number of TCP MSDUs in PPDU
2045  * @other_msdu_count: Number of MSDUs other than UDP and TCP MSDUs in PPDU
2046  * @duration: PPDU duration
2047  * @tid: TID number
2048  * @peer_id: Peer ID
2049  * @vdev_id: VAP ID
2050  * @mac_addr: Peer MAC Address
2051  * @first_data_seq_ctrl: Sequence control field of first data frame
2052  * @ltf_size: ltf_size
2053  * @stbc: When set, STBC rate was used
2054  * @he_re: he_re (range extension)
2055  * @bw: Bandwidth
2056  *       <enum 0 bw_20_MHz>
2057  *       <enum 1 bw_40_MHz>
2058  *       <enum 2 bw_80_MHz>
2059  *       <enum 3 bw_160_MHz>
2060  * @nss: NSS 1,2, ...8
2061  * @mcs: MCS index
2062  * @preamble: preamble
2063  * @gi: <enum 0     0_8_us_sgi > Legacy normal GI
2064  *       <enum 1     0_4_us_sgi > Legacy short GI
2065  *       <enum 2     1_6_us_sgi > HE related GI
2066  *       <enum 3     3_2_us_sgi > HE
2067  * @dcm: dcm
2068  * @ldpc: ldpc
2069  * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
2070  * UL_BSR_TRIG/UNKNOWN
2071  * @rssi: RSSI value (units = dB above noise floor)
2072  * @timestamp: TSF at the reception of PPDU
2073  * @length: PPDU length
2074  * @channel: Channel informartion
2075  * @lsig_A: L-SIG in 802.11 PHY header
2076  * @frame_ctrl: frame control field
2077  * @rix: rate index
2078  * @rssi_chain: rssi chain per nss per bw
2079  * @cookie: cookie to used by upper layer
2080  * @user: per user stats in MU-user case
2081  * @nf: noise floor
2082  * @per_chain_rssi: rssi per antenna
2083  */
2084 struct cdp_rx_indication_ppdu {
2085 	uint32_t ppdu_id;
2086 	uint16_t is_ampdu:1,
2087 		 num_mpdu:9,
2088 		 reserved:6;
2089 	uint32_t num_msdu;
2090 	uint32_t num_bytes;
2091 	uint16_t udp_msdu_count;
2092 	uint16_t tcp_msdu_count;
2093 	uint16_t other_msdu_count;
2094 	uint16_t duration;
2095 	uint32_t tid:8,
2096 		 peer_id:16;
2097 	uint8_t vdev_id;
2098 	uint8_t mac_addr[6];
2099 	uint16_t first_data_seq_ctrl;
2100 	union {
2101 		uint32_t rate_info;
2102 		struct {
2103 			uint32_t ltf_size:2,
2104 				 stbc:1,
2105 				 he_re:1,
2106 				 bw:4,
2107 				 nss:4,
2108 				 mcs:4,
2109 				 preamble:4,
2110 				 gi:4,
2111 				 dcm:1,
2112 				 ldpc:1,
2113 				 ppdu_type:5;
2114 		};
2115 	} u;
2116 	uint32_t rix;
2117 	uint32_t lsig_a;
2118 	uint32_t rssi;
2119 	uint64_t timestamp;
2120 	uint32_t length;
2121 	uint8_t channel;
2122 	uint8_t beamformed;
2123 
2124 	uint32_t rx_ratekbps;
2125 	uint32_t ppdu_rx_rate;
2126 
2127 	uint32_t retries;
2128 	uint32_t rx_byte_count;
2129 	uint16_t rx_ratecode;
2130 	uint8_t fcs_error_mpdus;
2131 	uint16_t frame_ctrl;
2132 	int8_t rssi_chain[SS_COUNT][MAX_BW];
2133 	struct cdp_stats_cookie *cookie;
2134 	struct cdp_rx_su_evm_info evm_info;
2135 	uint32_t rx_antenna;
2136 	uint8_t num_users;
2137 	struct cdp_rx_stats_ppdu_user user[CDP_MU_MAX_USERS];
2138 	uint32_t nf;
2139 	uint8_t  per_chain_rssi[MAX_CHAIN];
2140 	uint8_t is_mcast_bcast;
2141 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
2142 	struct cdp_rx_ppdu_cfr_info cfr_info;
2143 #endif
2144 };
2145 
2146 /**
2147  * struct cdp_rx_indication_msdu - Rx MSDU info
2148  * @ppdu_id: PPDU to which the MSDU belongs
2149  * @msdu_len: Length of MSDU in bytes
2150  * @ack_frame_rssi: RSSI of the received ACK or BA frame
2151  * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
2152  * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
2153  * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
2154  * @extd: Extended structure containing rate statistics
2155  */
2156 struct cdp_rx_indication_msdu {
2157 	uint32_t ppdu_id;
2158 	uint16_t msdu_len;
2159 	uint32_t ack_frame_rssi:8,
2160 		 resvd0:1,
2161 		 first_msdu:1,
2162 		 last_msdu:1,
2163 		 msdu_part_of_amsdu:1,
2164 		 msdu_part_of_ampdu:1,
2165 		 resvd1:19;
2166 	struct cdp_rate_stats extd;
2167 };
2168 
2169 /**
2170  * struct cdp_config_params - Propagate configuration parameters to datapath
2171  * @tso_enable: Enable/Disable TSO
2172  * @lro_enable: Enable/Disable LRO
2173  * @gro_enable: Enable/Disable GRO
2174  * @flow_steering_enable: Enable/Disable Rx Hash based flow steering
2175  * @nan_tcp_udp_checksumoffload: Enable/Disable TCP/UDP Checksum Offload for NAN
2176  * @tcp_udp_checksumoffload: Enable/Disable TCP/UDP Checksum Offload
2177  * @napi_enable: Enable/Disable Napi
2178  * @ipa_enable: Flag indicating if IPA is enabled or not
2179  * @tx_flow_stop_queue_threshold: Value to Pause tx queues
2180  * @tx_flow_start_queue_offset: Available Tx descriptors to unpause
2181  *				tx queue
2182  * @tx_comp_loop_pkt_limit: Max # of packets to be processed in 1 tx comp loop
2183  * @rx_reap_loop_pkt_limit: Max # of packets to be processed in 1 rx reap loop
2184  * @rx_hp_oos_update_limit: Max # of HP OOS (out of sync) updates
2185  */
2186 struct cdp_config_params {
2187 	unsigned int tso_enable:1;
2188 	unsigned int lro_enable:1;
2189 	unsigned int gro_enable:1;
2190 	unsigned int flow_steering_enable:1;
2191 	unsigned int nan_tcp_udp_checksumoffload:1;
2192 	unsigned int tcp_udp_checksumoffload:1;
2193 	unsigned int napi_enable:1;
2194 	unsigned int ipa_enable:1;
2195 	/* Set when QCA_LL_TX_FLOW_CONTROL_V2 is enabled */
2196 	uint8_t tx_flow_stop_queue_threshold;
2197 	uint8_t tx_flow_start_queue_offset;
2198 	uint32_t tx_comp_loop_pkt_limit;
2199 	uint32_t rx_reap_loop_pkt_limit;
2200 	uint32_t rx_hp_oos_update_limit;
2201 
2202 };
2203 
2204 /**
2205  * cdp_txrx_stats_req: stats request wrapper
2206  *	used to pass request information to cdp layer
2207  * @stats: type of stats requested
2208  * @param0: opaque argument 0 to be passed to htt
2209  * @param1: opaque argument 1 to be passed to htt
2210  * @param2: opaque argument 2 to be passed to htt
2211  * @param3: opaque argument 3 to be passed to htt
2212  * @mac id: mac_id
2213  */
2214 struct cdp_txrx_stats_req {
2215 	enum cdp_stats	stats;
2216 	uint32_t	param0;
2217 	uint32_t	param1;
2218 	uint32_t	param2;
2219 	uint32_t	param3;
2220 	uint32_t	cookie_val;
2221 	uint8_t		mac_id;
2222 	char *peer_addr;
2223 };
2224 
2225 /**
2226  * struct cdp_monitor_filter - monitor filter info
2227  * @mode: set filter mode
2228  * @fp_mgmt: set Filter Pass MGMT Configuration
2229  * @fp_ctrl: set Filter Pass CTRL Configuration
2230  * @fp_data: set Filter Pass DATA Configuration
2231  * @mo_mgmt: set Monitor Other MGMT Configuration
2232  * @mo_ctrl: set Monitor Other CTRL Configuration
2233  * @mo_data: set Monitor other DATA Configuration
2234  *
2235  */
2236 struct cdp_monitor_filter {
2237 	uint16_t mode;
2238 	uint16_t fp_mgmt;
2239 	uint16_t fp_ctrl;
2240 	uint16_t fp_data;
2241 	uint16_t mo_mgmt;
2242 	uint16_t mo_ctrl;
2243 	uint16_t mo_data;
2244 };
2245 
2246 /**
2247  * cdp_dp_cfg - dp ini config enum
2248  */
2249 enum cdp_dp_cfg {
2250 	cfg_dp_enable_data_stall,
2251 	/* checksum offload for NAN interface */
2252 	cfg_dp_enable_nan_ip_tcp_udp_checksum_offload,
2253 	/* generic checksum offload for other interfaces */
2254 	cfg_dp_enable_ip_tcp_udp_checksum_offload,
2255 	cfg_dp_tso_enable,
2256 	cfg_dp_lro_enable,
2257 	cfg_dp_gro_enable,
2258 	cfg_dp_tx_flow_start_queue_offset,
2259 	cfg_dp_tx_flow_stop_queue_threshold,
2260 	cfg_dp_ipa_uc_tx_buf_size,
2261 	cfg_dp_ipa_uc_tx_partition_base,
2262 	cfg_dp_ipa_uc_rx_ind_ring_count,
2263 	cfg_dp_enable_flow_steering,
2264 	cfg_dp_reorder_offload_supported,
2265 	cfg_dp_ce_classify_enable,
2266 	cfg_dp_disable_intra_bss_fwd,
2267 	cfg_dp_pktlog_buffer_size,
2268 };
2269 
2270 /**
2271  * struct cdp_peer_cookie - cookie used when creating peer
2272  * @ctx: context passed to be used by consumer
2273  * @mac_addr: MAC address of peer
2274  * @peer_id: peer id
2275  * @pdev_id: pdev_id
2276  * @cookie: cookie to be used by consumer
2277  */
2278 struct cdp_peer_cookie {
2279 	struct cdp_stats_cookie *ctx;
2280 	uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
2281 	uint8_t peer_id;
2282 	uint8_t pdev_id;
2283 	uint8_t cookie;
2284 };
2285 
2286 #ifdef WLAN_SUPPORT_RX_FISA
2287 struct cdp_flow_stats {
2288 	uint32_t aggr_count;
2289 	uint32_t curr_aggr_count;
2290 	uint32_t flush_count;
2291 	uint32_t bytes_aggregated;
2292 };
2293 #else
2294 /**
2295  * cdp_flow_stats - Per-Flow (5-tuple) statistics
2296  * @msdu_count: number of rx msdus matching this flow
2297  *
2298  * HW also includes msdu_byte_count and timestamp, which
2299  * are not currently tracked in SW.
2300  */
2301 struct cdp_flow_stats {
2302 	uint32_t msdu_count;
2303 };
2304 #endif
2305 
2306 /**
2307  * cdp_flow_fst_operation - RX FST operations allowed
2308  */
2309 enum cdp_flow_fst_operation {
2310 	CDP_FLOW_FST_ENTRY_ADD,
2311 	CDP_FLOW_FST_ENTRY_DEL,
2312 	CDP_FLOW_FST_RX_BYPASS_ENABLE,
2313 	CDP_FLOW_FST_RX_BYPASS_DISABLE
2314 };
2315 
2316 /**
2317  * cdp_flow_protocol_type - RX FST supported protocol types, mapped to HW spec
2318  */
2319 enum cdp_flow_protocol_type {
2320 	CDP_FLOW_PROTOCOL_TYPE_TCP = 6,
2321 	CDP_FLOW_PROTOCOL_TYPE_UDP = 17,
2322 };
2323 
2324 /**
2325  * cdp_rx_flow_tuple_info - RX flow tuple info used for addition/deletion
2326  * @dest_ip_127_96: destination IP address bit fields 96-127
2327  * @dest_ip_95_64: destination IP address bit fields 64-95
2328  * @dest_ip_63_32: destination IP address bit fields 32-63
2329  * @dest_ip_31_0: destination IP address bit fields 0-31
2330  * @src_ip_127_96: source IP address bit fields 96-127
2331  * @src_ip_95_64: source IP address bit fields 64-95
2332  * @src_ip_63_32: source IP address bit fields 32-63
2333  * @src_ip_31_0: source IP address bit fields 0-31
2334  * @dest_port: destination port of flow
2335  * @src_port: source port of flow
2336  * @l4_protocol: protocol type in flow (TCP/UDP)
2337  */
2338 struct cdp_rx_flow_tuple_info {
2339 #ifdef WLAN_SUPPORT_RX_FISA
2340 	uint8_t tuple_populated;
2341 #endif
2342 	uint32_t dest_ip_127_96;
2343 	uint32_t dest_ip_95_64;
2344 	uint32_t dest_ip_63_32;
2345 	uint32_t dest_ip_31_0;
2346 	uint32_t src_ip_127_96;
2347 	uint32_t src_ip_95_64;
2348 	uint32_t src_ip_63_32;
2349 	uint32_t src_ip_31_0;
2350 	uint16_t dest_port;
2351 	uint16_t src_port;
2352 	uint16_t l4_protocol;
2353 };
2354 
2355 /**
2356  * cdp_rx_flow_info - RX flow info used for addition/deletion
2357  * @is_addr_ipv4: indicates whether given IP address is IPv4/IPv6
2358  * @op_code: add/delete/enable/disable operation requested
2359  * @flow_tupe_info: structure containing tuple info
2360  * @fse_metadata: metadata to be set in RX flow
2361  */
2362 struct cdp_rx_flow_info {
2363 	bool is_addr_ipv4;
2364 	enum cdp_flow_fst_operation op_code;
2365 	struct cdp_rx_flow_tuple_info flow_tuple_info;
2366 	uint16_t fse_metadata;
2367 };
2368 #endif
2369