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