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