xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_cmn_struct.h (revision fa47688f04ef001a6dcafaebdcc3c031f15ee75e)
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 #ifndef CONFIG_WIN
38 #include <cdp_txrx_mob_def.h>
39 #endif /* CONFIG_WIN */
40 #include <cdp_txrx_handle.h>
41 
42 #ifndef OL_TXRX_NUM_LOCAL_PEER_IDS
43 /*
44  * Each AP will occupy one ID, so it will occupy two IDs for AP-AP mode.
45  * Clients will be assigned max 32 IDs.
46  * STA(associated)/P2P DEV(self-PEER) will get one ID.
47  */
48 #define OL_TXRX_NUM_LOCAL_PEER_IDS (32 + 1 + 1 + 1)
49 #endif
50 
51 #define CDP_BA_256_BIT_MAP_SIZE_DWORDS 8
52 #define CDP_BA_64_BIT_MAP_SIZE_DWORDS 2
53 #define CDP_RSSI_CHAIN_LEN 8
54 
55 #define OL_TXRX_INVALID_LOCAL_PEER_ID 0xffff
56 #define CDP_INVALID_VDEV_ID 0xff
57 /* Options for Dump Statistics */
58 #define CDP_HDD_STATS               0
59 #define CDP_TXRX_PATH_STATS         1
60 #define CDP_TXRX_HIST_STATS         2
61 #define CDP_TXRX_TSO_STATS          3
62 #define CDP_HDD_NETIF_OPER_HISTORY  4
63 #define CDP_DUMP_TX_FLOW_POOL_INFO  5
64 #define CDP_TXRX_DESC_STATS         6
65 #define CDP_HIF_STATS               7
66 #define CDP_LRO_STATS               8
67 #define CDP_NAPI_STATS              9
68 #define CDP_WLAN_RX_BUF_DEBUG_STATS 10
69 #define CDP_RX_RING_STATS          11
70 #define CDP_DP_NAPI_STATS          12
71 #define CDP_DP_RX_THREAD_STATS     13
72 #define CDP_SCHEDULER_STATS        21
73 #define CDP_TX_QUEUE_STATS         22
74 #define CDP_BUNDLE_STATS           23
75 #define CDP_CREDIT_STATS           24
76 #define CDP_DISCONNECT_STATS       25
77 
78 #define WME_AC_TO_TID(_ac) (       \
79 		((_ac) == WME_AC_VO) ? 6 : \
80 		((_ac) == WME_AC_VI) ? 5 : \
81 		((_ac) == WME_AC_BK) ? 1 : \
82 		0)
83 
84 #define TID_TO_WME_AC(_tid) (      \
85 		(((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
86 		(((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
87 		(((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
88 		WME_AC_VO)
89 
90 #define CDP_MU_MAX_USERS 8
91 #define CDP_MU_MAX_USER_INDEX (CDP_MU_MAX_USERS - 1)
92 #define CDP_INVALID_PEER 0xffff
93 #define CDP_INVALID_TID	 31
94 
95 #define CDP_DATA_TID_MAX 8
96 /*
97  * advance rx monitor filter
98  * */
99 #define MON_FILTER_PASS			0x0001
100 #define MON_FILTER_OTHER		0x0002
101 #define MON_FILTER_ALL			0x0003
102 
103 #define FILTER_MGMT_ALL			0xFFFF
104 #define FILTER_MGMT_ASSOC_REQ		0x0001
105 #define FILTER_MGMT_ASSOC_RES		0x0002
106 #define FILTER_MGMT_REASSOC_REQ		0x0004
107 #define FILTER_MGMT_REASSOC_RES		0x0008
108 #define FILTER_MGMT_PROBE_REQ		0x0010
109 #define FILTER_MGMT_PROBE_RES		0x0020
110 #define FILTER_MGMT_TIM_ADVT		0x0040
111 #define FILTER_MGMT_RESERVED_7		0x0080
112 #define FILTER_MGMT_BEACON		0x0100
113 #define FILTER_MGMT_ATIM		0x0200
114 #define FILTER_MGMT_DISASSOC		0x0400
115 #define FILTER_MGMT_AUTH		0x0800
116 #define FILTER_MGMT_DEAUTH		0x1000
117 #define FILTER_MGMT_ACTION		0x2000
118 #define FILTER_MGMT_ACT_NO_ACK		0x4000
119 #define FILTER_MGMT_RESERVED_15		0x8000
120 
121 #define FILTER_CTRL_ALL			0xFFFF
122 #define FILTER_CTRL_RESERVED_1		0x0001
123 #define FILTER_CTRL_RESERVED_2		0x0002
124 #define FILTER_CTRL_TRIGGER		0x0004
125 #define FILTER_CTRL_RESERVED_4		0x0008
126 #define FILTER_CTRL_BF_REP_POLL		0x0010
127 #define FILTER_CTRL_VHT_NDP		0x0020
128 #define FILTER_CTRL_FRAME_EXT		0x0040
129 #define FILTER_CTRL_CTRLWRAP		0x0080
130 #define FILTER_CTRL_BA_REQ		0x0100
131 #define FILTER_CTRL_BA			0x0200
132 #define FILTER_CTRL_PSPOLL		0x0400
133 #define FILTER_CTRL_RTS			0x0800
134 #define FILTER_CTRL_CTS			0x1000
135 #define FILTER_CTRL_ACK			0x2000
136 #define FILTER_CTRL_CFEND		0x4000
137 #define FILTER_CTRL_CFEND_CFACK		0x8000
138 
139 #define FILTER_DATA_ALL			0xFFFF
140 #define FILTER_DATA_MCAST		0x4000
141 #define FILTER_DATA_UCAST		0x8000
142 #define FILTER_DATA_DATA		0x0001
143 #define FILTER_DATA_NULL		0x0008
144 
145 QDF_DECLARE_EWMA(tx_lag, 1024, 8)
146 
147 /*
148  * DP configuration parameters
149  */
150 enum cdp_cfg_param_type {
151 	CDP_CFG_MAX_PEER_ID,
152 	CDP_CFG_CCE_DISABLE,
153 	CDP_CFG_NUM_PARAMS
154 };
155 
156 /*
157  * htt_dbg_stats_type -
158  * bit positions for each stats type within a stats type bitmask
159  * The bitmask contains 24 bits.
160  */
161 enum htt_cmn_dbg_stats_type {
162 	HTT_DBG_CMN_STATS_WAL_PDEV_TXRX      = 0,  /* bit 0 -> 0x1 */
163 	HTT_DBG_CMN_STATS_RX_REORDER         = 1,  /* bit 1 -> 0x2 */
164 	HTT_DBG_CMN_STATS_RX_RATE_INFO       = 2,  /* bit 2 -> 0x4 */
165 	HTT_DBG_CMN_STATS_TX_PPDU_LOG        = 3,  /* bit 3 -> 0x8 */
166 	HTT_DBG_CMN_STATS_TX_RATE_INFO       = 4,  /* bit 4 -> 0x10 */
167 	HTT_DBG_CMN_STATS_TIDQ               = 5,  /* bit 5 -> 0x20 */
168 	HTT_DBG_CMN_STATS_TXBF_INFO          = 6,  /* bit 6 -> 0x40 */
169 	HTT_DBG_CMN_STATS_SND_INFO           = 7,  /* bit 7 -> 0x80 */
170 	HTT_DBG_CMN_STATS_ERROR_INFO         = 8,  /* bit 8  -> 0x100 */
171 	HTT_DBG_CMN_STATS_TX_SELFGEN_INFO    = 9,  /* bit 9  -> 0x200 */
172 	HTT_DBG_CMN_STATS_TX_MU_INFO         = 10, /* bit 10 -> 0x400 */
173 	HTT_DBG_CMN_STATS_SIFS_RESP_INFO     = 11, /* bit 11 -> 0x800 */
174 	HTT_DBG_CMN_STATS_RESET_INFO         = 12, /* bit 12 -> 0x1000 */
175 	HTT_DBG_CMN_STATS_MAC_WDOG_INFO      = 13, /* bit 13 -> 0x2000 */
176 	HTT_DBG_CMN_STATS_TX_DESC_INFO       = 14, /* bit 14 -> 0x4000 */
177 	HTT_DBG_CMN_STATS_TX_FETCH_MGR_INFO  = 15, /* bit 15 -> 0x8000 */
178 	HTT_DBG_CMN_STATS_TX_PFSCHED_INFO    = 16, /* bit 16 -> 0x10000 */
179 	HTT_DBG_CMN_STATS_TX_PATH_STATS_INFO = 17, /* bit 17 -> 0x20000 */
180 	/* bits 18-23 currently reserved */
181 
182 	/* keep this last */
183 	HTT_DBG_CMN_NUM_STATS,
184 	HTT_DBG_CMN_NUM_STATS_INVALID        = 31, /* bit 31 -> 0x80000000 */
185 };
186 
187 /*
188  * cdp_host_txrx_stats: Different types of host stats
189  * @TXRX_HOST_STATS_INVALID: Invalid option
190  * @TXRX_RX_RATE_STATS: Rx rate info
191  * @TXRX_TX_RATE_STATS: Tx rate info
192  * @TXRX_TX_HOST_STATS: Print Tx stats
193  * @TXRX_RX_HOST_STATS: Print host Rx stats
194  * @TXRX_CLEAR_STATS: clear all host stats
195  * @TXRX_SRNG_PTR_STATS: Print SRNG pointer stats
196  * @TXRX_RX_MON_STATS: Print monitor mode stats
197  * @TXRX_REO_QUEUE_STATS: Print Per peer REO Queue Stats
198  * @TXRX_SOC_CFG_PARAMS: Print soc cfg params info
199  * @TXRX_PDEV_CFG_PARAMS: Print pdev cfg params info
200  */
201 enum cdp_host_txrx_stats {
202 	TXRX_HOST_STATS_INVALID  = -1,
203 	TXRX_CLEAR_STATS     = 0,
204 	TXRX_RX_RATE_STATS   = 1,
205 	TXRX_TX_RATE_STATS   = 2,
206 	TXRX_TX_HOST_STATS   = 3,
207 	TXRX_RX_HOST_STATS   = 4,
208 	TXRX_AST_STATS       = 5,
209 	TXRX_SRNG_PTR_STATS  = 6,
210 	TXRX_RX_MON_STATS    = 7,
211 	TXRX_REO_QUEUE_STATS = 8,
212 	TXRX_SOC_CFG_PARAMS   = 9,
213 	TXRX_PDEV_CFG_PARAMS  = 10,
214 	TXRX_HOST_STATS_MAX,
215 };
216 
217 /*
218  * cdp_ppdu_ftype: PPDU Frame Type
219  * @CDP_PPDU_FTYPE_DATA: SU or MU Data Frame
220  * @CDP_PPDU_FTYPE_CTRL: Control/Management Frames
221  * @CDP_PPDU_FTYPE_BAR: SU or MU BAR frames
222 */
223 enum cdp_ppdu_ftype {
224 	CDP_PPDU_FTYPE_CTRL,
225 	CDP_PPDU_FTYPE_DATA,
226 	CDP_PPDU_FTYPE_BAR,
227 	CDP_PPDU_FTYPE_MAX
228 };
229 
230 
231 /**
232  * @brief General specification of the tx frame contents
233  *
234  * @details
235  * for efficiency, the HTT packet type values correspond
236  * to the bit positions of the WAL packet type values, so the
237  * translation is a simple shift operation.
238  */
239 enum htt_cmn_pkt_type {
240 	htt_cmn_pkt_type_raw = 0,
241 	htt_cmn_pkt_type_native_wifi = 1,
242 	htt_cmn_pkt_type_ethernet = 2,
243 	htt_cmn_pkt_type_mgmt = 3,
244 	htt_cmn_pkt_type_eth2 = 4,
245 
246 	/* keep this last */
247 	htt_cmn_pkt_num_types
248 };
249 
250 /**
251  * @General description of HTT received packets status
252  * It is similar to htt_rx_status enum
253  * but is added as a cdp enum can be freely used in OL_IF layer
254  */
255 enum htt_cmn_rx_status {
256 	htt_cmn_rx_status_unknown = 0x0,
257 	htt_cmn_rx_status_ok,
258 	htt_cmn_rx_status_err_fcs,
259 	htt_cmn_rx_status_err_dup,
260 	htt_cmn_rx_status_err_replay,
261 	htt_cmn_rx_status_inv_peer,
262 	htt_cmn_rx_status_ctrl_mgmt_null = 0x08,
263 	htt_cmn_rx_status_tkip_mic_err = 0x09,
264 	htt_cmn_rx_status_decrypt_err = 0x0A,
265 	htt_cmn_rx_status_mpdu_length_err = 0x0B,
266 	htt_cmn_rx_status_err_misc = 0xFF
267 };
268 
269 
270 enum cdp_host_reo_dest_ring {
271     cdp_host_reo_dest_ring_unknown = 0,
272     cdp_host_reo_dest_ring_1 = 1,
273     cdp_host_reo_dest_ring_2 = 2,
274     cdp_host_reo_dest_ring_3 = 3,
275     cdp_host_reo_dest_ring_4 = 4,
276 };
277 
278 enum htt_cmn_t2h_en_stats_type {
279     /* keep this alwyas first */
280     HTT_CMN_T2H_EN_STATS_TYPE_START     = 0,
281 
282     /** ppdu_common_stats is the payload */
283     HTT_CMN_T2H_EN_STATS_TYPE_COMMON    = 1,
284     /** ppdu_sant_stats is the payload */
285     HTT_CMN_T2H_EN_STATS_TYPE_SANT      = 2,
286     /** ppdu_common_stats_v2 is the payload */
287     HTT_CMN_T2H_EN_STATS_TYPE_COMMON_V2 = 3,
288 
289     /* Keep this last */
290     HTT_CMN_T2H_EN_STATS_TYPE_END       = 0x1f,
291 };
292 
293 enum htt_cmn_t2h_en_stats_status {
294     /* Keep this first always */
295     HTT_CMN_T2H_EN_STATS_STATUS_PARTIAL     = 0,
296     HTT_CMN_T2H_EN_STATS_STATUS_PRESENT     = 1,
297     HTT_CMN_T2H_EN_STATS_STATUS_ERROR       = 2,
298     HTT_CMN_T2H_EN_STATS_STATUS_INVALID     = 3,
299 
300 
301     /* keep this always last */
302     HTT_CMN_T2H_EN_STATS_STATUS_SERIES_DONE         = 7,
303 };
304 
305 /**
306  * struct ol_txrx_peer_state - Peer state information
307  */
308 enum ol_txrx_peer_state {
309 	OL_TXRX_PEER_STATE_INVALID,
310 	OL_TXRX_PEER_STATE_DISC,    /* initial state */
311 	OL_TXRX_PEER_STATE_CONN,    /* authentication in progress */
312 	OL_TXRX_PEER_STATE_AUTH,    /* authentication successful */
313 };
314 
315 /**
316  * struct ol_txrx_ast_type - AST entry type information
317  */
318 enum cdp_txrx_ast_entry_type {
319 	CDP_TXRX_AST_TYPE_NONE,	/* static ast entry for connected peer */
320 	CDP_TXRX_AST_TYPE_STATIC, /* static ast entry for connected peer */
321 	CDP_TXRX_AST_TYPE_SELF, /* static ast entry for self peer (STA mode) */
322 	CDP_TXRX_AST_TYPE_WDS,	/* WDS peer ast entry type*/
323 	CDP_TXRX_AST_TYPE_MEC,	/* Multicast echo ast entry type */
324 	CDP_TXRX_AST_TYPE_WDS_HM, /* HM WDS entry */
325 	CDP_TXRX_AST_TYPE_STA_BSS,	 /* BSS entry(STA mode) */
326 	CDP_TXRX_AST_TYPE_DA,	/* AST entry based on Destination address */
327 	CDP_TXRX_AST_TYPE_WDS_HM_SEC, /* HM WDS entry for secondary radio */
328 	CDP_TXRX_AST_TYPE_MAX
329 };
330 
331 /*
332  * cdp_ast_free_status: status passed to callback function before freeing ast
333  * @CDP_TXRX_AST_DELETED - AST is deleted from FW and delete response received
334  * @CDP_TXRX_AST_DELETE_IN_PROGRESS - AST delete command sent to FW and host
335  *                                    is waiting for FW response
336  */
337 enum cdp_ast_free_status {
338 	CDP_TXRX_AST_DELETED,
339 	CDP_TXRX_AST_DELETE_IN_PROGRESS,
340 };
341 
342 /**
343  * txrx_ast_free_cb - callback registered for ast free
344  * @ctrl_soc: control path soc context
345  * @cdp_soc: DP soc context
346  * @cookie: cookie
347  * @cdp_ast_free_status: ast free status
348  */
349 typedef void (*txrx_ast_free_cb)(void *ctrl_soc,
350 				 void *cdp_soc,
351 				 void *cookie,
352 				 enum cdp_ast_free_status);
353 
354 #define CDP_MAC_ADDR_LEN 6
355 
356 /**
357  *  struct cdp_ast_entry_info - AST entry information
358  *  @peer_mac_addr: mac address of peer on which AST entry is added
359  *  @type: ast entry type
360  *  @vdev_id: vdev_id
361  *  @pdev_id: pdev_id
362  *  @peer_id: peer_id
363  *
364  *  This structure holds the ast entry information
365  *
366  */
367 struct cdp_ast_entry_info {
368 	uint8_t peer_mac_addr[CDP_MAC_ADDR_LEN];
369 	enum cdp_txrx_ast_entry_type type;
370 	uint8_t vdev_id;
371 	uint8_t pdev_id;
372 	uint16_t peer_id;
373 };
374 
375 /**
376  * struct cdp_sec_type - security type information
377  */
378 enum cdp_sec_type {
379     cdp_sec_type_none,
380     cdp_sec_type_wep128,
381     cdp_sec_type_wep104,
382     cdp_sec_type_wep40,
383     cdp_sec_type_tkip,
384     cdp_sec_type_tkip_nomic,
385     cdp_sec_type_aes_ccmp,
386     cdp_sec_type_wapi,
387     cdp_sec_type_aes_ccmp_256,
388     cdp_sec_type_aes_gcmp,
389     cdp_sec_type_aes_gcmp_256,
390 
391     /* keep this last! */
392     cdp_num_sec_types
393 };
394 
395 /**
396  *  struct cdp_tx_exception_metadata - Exception path parameters
397  *  @peer_id: Peer id of the peer
398  *  @tid: Transmit Identifier
399  *  @tx_encap_type: Transmit encap type (i.e. Raw, Native Wi-Fi, Ethernet)
400  *  @sec_type: sec_type to be passed to HAL
401  *
402  *  This structure holds the parameters needed in the exception path of tx
403  *
404  */
405 struct cdp_tx_exception_metadata {
406 	uint16_t peer_id;
407 	uint8_t tid;
408 	uint16_t tx_encap_type;
409 	enum cdp_sec_type sec_type;
410 };
411 
412 typedef struct cdp_soc_t *ol_txrx_soc_handle;
413 
414 /**
415  * ol_txrx_vdev_delete_cb - callback registered during vdev
416  * detach
417  */
418 typedef void (*ol_txrx_vdev_delete_cb)(void *context);
419 
420 /**
421  * ol_txrx_peer_unmap_sync_cb - callback registered during peer detach sync
422  */
423 typedef QDF_STATUS(*ol_txrx_peer_unmap_sync_cb)(uint8_t vdev_id,
424 						 uint32_t peer_id_cnt,
425 						 uint16_t *peer_id_list);
426 
427 /**
428  * ol_txrx_pkt_direction - Packet Direction
429  * @rx_direction: rx path packet
430  * @tx_direction: tx path packet
431  */
432 enum txrx_direction {
433 	rx_direction = 1,
434 	tx_direction = 0,
435 };
436 
437 /**
438  * cdp_capabilities- DP capabilities
439  */
440 enum cdp_capabilities {
441 	CDP_CFG_DP_TSO,
442 	CDP_CFG_DP_LRO,
443 	CDP_CFG_DP_SG,
444 	CDP_CFG_DP_GRO,
445 	CDP_CFG_DP_OL_TX_CSUM,
446 	CDP_CFG_DP_OL_RX_CSUM,
447 	CDP_CFG_DP_RAWMODE,
448 	CDP_CFG_DP_PEER_FLOW_CTRL,
449 };
450 
451 /**
452  * ol_txrx_nbuf_classify - Packet classification object
453  * @peer_id: unique peer identifier from fw
454  * @tid: traffic identifier(could be overridden)
455  * @pkt_tid: traffic identifier(cannot be overridden)
456  * @pkt_tos: ip header tos value
457  * @pkt_dscp: ip header dscp value
458  * @tos: index value in map
459  * @dscp: DSCP_TID map index
460  * @is_mcast: multicast pkt check
461  * @is_eap: eapol pkt check
462  * @is_arp: arp pkt check
463  * @is_tcp: tcp pkt check
464  * @is_dhcp: dhcp pkt check
465  * @is_igmp: igmp pkt check
466  * @is_ipv4: ip version 4 pkt check
467  * @is_ipv6: ip version 6 pkt check
468  */
469 struct ol_txrx_nbuf_classify {
470 	uint16_t peer_id;
471 	uint8_t tid;
472 	uint8_t pkt_tid;
473 	uint8_t pkt_tos;
474 	uint8_t pkt_dscp;
475 	uint8_t tos;
476 	uint8_t dscp;
477 	uint8_t is_mcast;
478 	uint8_t is_eap;
479 	uint8_t is_arp;
480 	uint8_t is_tcp;
481 	uint8_t is_dhcp;
482 	uint8_t is_igmp;
483 	uint8_t is_ipv4;
484 	uint8_t is_ipv6;
485 };
486 
487 /**
488  * ol_osif_vdev_handle - paque handle for OS shim virtual device
489  * object
490  */
491 struct ol_osif_vdev_t;
492 typedef struct ol_osif_vdev_t *ol_osif_vdev_handle;
493 
494 /**
495  * wlan_op_mode - Virtual device operation mode
496  * @wlan_op_mode_unknown: Unknown mode
497  * @wlan_op_mode_ap: AP mode
498  * @wlan_op_mode_ibss: IBSS mode
499  * @wlan_op_mode_sta: STA (client) mode
500  * @wlan_op_mode_monitor: Monitor mode
501  * @wlan_op_mode_ocb: OCB mode
502  */
503 enum wlan_op_mode {
504 	wlan_op_mode_unknown,
505 	wlan_op_mode_ap,
506 	wlan_op_mode_ibss,
507 	wlan_op_mode_sta,
508 	wlan_op_mode_monitor,
509 	wlan_op_mode_ocb,
510 	wlan_op_mode_ndi,
511 };
512 
513 /**
514  * connectivity_stats_pkt_status - data pkt type
515  * @PKT_TYPE_REQ: Request packet
516  * @PKT_TYPE_RSP: Response packet
517  * @PKT_TYPE_TX_DROPPED: TX packet dropped
518  * @PKT_TYPE_RX_DROPPED: RX packet dropped
519  * @PKT_TYPE_RX_DELIVERED: RX packet delivered
520  * @PKT_TYPE_RX_REFUSED: RX packet refused
521  * @PKT_TYPE_TX_HOST_FW_SENT: TX packet FW sent
522  * @PKT_TYPE_TX_ACK_CNT:TC packet acked
523  * @PKT_TYPE_NONE: Invalid packet
524  */
525 enum connectivity_stats_pkt_status {
526 	PKT_TYPE_REQ,
527 	PKT_TYPE_RSP,
528 	PKT_TYPE_TX_DROPPED,
529 	PKT_TYPE_RX_DROPPED,
530 	PKT_TYPE_RX_DELIVERED,
531 	PKT_TYPE_RX_REFUSED,
532 	PKT_TYPE_TX_HOST_FW_SENT,
533 	PKT_TYPE_TX_ACK_CNT,
534 	PKT_TYPE_NONE,
535 };
536 
537 /**
538  * ol_txrx_mgmt_tx_cb - tx management delivery notification
539  * callback function
540  */
541 typedef void
542 (*ol_txrx_mgmt_tx_cb)(void *ctxt, qdf_nbuf_t tx_mgmt_frm, int had_error);
543 
544 /**
545  * ol_txrx_data_tx_cb - Function registered with the data path
546  * that is called when tx frames marked as "no free" are
547  * done being transmitted
548  */
549 typedef void
550 (*ol_txrx_data_tx_cb)(void *ctxt, qdf_nbuf_t tx_frm, int had_error);
551 
552 /**
553  * ol_txrx_tx_fp - top-level transmit function
554  * @data_vdev - handle to the virtual device object
555  * @msdu_list - list of network buffers
556  */
557 typedef qdf_nbuf_t (*ol_txrx_tx_fp)(void *data_vdev,
558 				    qdf_nbuf_t msdu_list);
559 
560 /**
561  * ol_txrx_tx_exc_fp - top-level transmit function on exception path
562  * @data_vdev - handle to the virtual device object
563  * @msdu_list - list of network buffers
564  * @tx_exc_metadata - structure that holds parameters to exception path
565  */
566 typedef qdf_nbuf_t (*ol_txrx_tx_exc_fp)(void *data_vdev,
567 					qdf_nbuf_t msdu_list,
568 					struct cdp_tx_exception_metadata
569 						*tx_exc_metadata);
570 
571 /**
572  * ol_txrx_completion_fp - top-level transmit function
573  * for tx completion
574  * @skb: skb data
575  * @osif_dev: the virtual device's OS shim object
576  */
577 typedef void (*ol_txrx_completion_fp)(qdf_nbuf_t skb,
578 				      void *osif_dev);
579 /**
580  * ol_txrx_tx_flow_control_fp - tx flow control notification
581  * function from txrx to OS shim
582  * @osif_dev - the virtual device's OS shim object
583  * @tx_resume - tx os q should be resumed or not
584  */
585 typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev,
586 					    bool tx_resume);
587 
588 /**
589  * ol_txrx_tx_flow_control_is_pause_fp - is tx paused by flow control
590  * function from txrx to OS shim
591  * @osif_dev - the virtual device's OS shim object
592  *
593  * Return: true if tx is paused by flow control
594  */
595 typedef bool (*ol_txrx_tx_flow_control_is_pause_fp)(void *osif_dev);
596 
597 /**
598  * ol_txrx_rx_fp - receive function to hand batches of data
599  * frames from txrx to OS shim
600  * @data_vdev - handle to the OSIF virtual device object
601  * @msdu_list - list of network buffers
602  */
603 typedef QDF_STATUS(*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list);
604 
605 /**
606  * ol_txrx_stats_rx_fp - receive function to hand batches of data
607  * frames from txrx to OS shim
608  * @skb: skb data
609  * @osif_dev: the virtual device's OS shim object
610  * @action: data packet type
611  * @pkt_type: packet data type
612  */
613 typedef void (*ol_txrx_stats_rx_fp)(struct sk_buff *skb,
614 		void *osif_dev, enum connectivity_stats_pkt_status action,
615 		uint8_t *pkt_type);
616 
617 /**
618  * ol_txrx_get_key_fp - function to gey key based on keyix and peer
619  * mac address
620  * @osif_dev - the virtual device's OS shim object
621  * @key_buf - pointer to store key
622  * @mac_addr - pointer to mac address
623  * @keyix - key id
624  */
625 typedef QDF_STATUS(*ol_txrx_get_key_fp)(void *osif_dev, uint8_t *key_buf, uint8_t *mac_addr, uint8_t keyix);
626 
627 /**
628  * ol_txrx_rsim_rx_decap_fp - raw mode simulation function to decap the
629  * packets in receive path.
630  * @osif_dev  - the virtual device's OS shim object
631  * @list_head - poniter to head of receive packet queue to decap
632  * @list_tail - poniter to tail of receive packet queue to decap
633  * @peer      - Peer handler
634  */
635 typedef QDF_STATUS(*ol_txrx_rsim_rx_decap_fp)(void *osif_dev,
636 						qdf_nbuf_t *list_head,
637 						qdf_nbuf_t *list_tail,
638 						struct cdp_peer *peer);
639 
640 /* ol_txrx_rx_fp - external tx free function to read per packet stats and
641  *                            free tx buffer externally
642  * @netbuf - tx network buffer
643  */
644 typedef void (*ol_txrx_tx_free_ext_fp)(qdf_nbuf_t netbuf);
645 
646 /**
647  * ol_txrx_rx_check_wai_fp - OSIF WAPI receive function
648 */
649 typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev,
650 					    qdf_nbuf_t mpdu_head,
651 					    qdf_nbuf_t mpdu_tail);
652 /**
653  * ol_txrx_rx_mon_fp - OSIF monitor mode receive function for single
654  * MPDU (802.11 format)
655  */
656 typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev,
657 					    qdf_nbuf_t mpdu,
658 					    void *rx_status);
659 
660 /**
661  * ol_txrx_proxy_arp_fp - proxy arp function pointer
662 */
663 typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev,
664 					    qdf_nbuf_t netbuf);
665 
666 /*
667  * ol_txrx_mcast_me_fp - function pointer for multicast enhancement
668  */
669 typedef int (*ol_txrx_mcast_me_fp)(ol_osif_vdev_handle vdev,
670 						qdf_nbuf_t netbuf);
671 
672 /**
673  * ol_txrx_stats_callback - statistics notify callback
674  */
675 typedef void (*ol_txrx_stats_callback)(void *ctxt,
676 				       enum htt_cmn_dbg_stats_type type,
677 				       uint8_t *buf, int bytes);
678 
679 /**
680  * ol_txrx_pktdump_cb - callback for packet dump feature
681  */
682 typedef void (*ol_txrx_pktdump_cb)(qdf_nbuf_t netbuf, uint8_t status,
683 				   uint8_t vdev_id, uint8_t type);
684 
685 /**
686  * ol_txrx_ops - (pointers to) the functions used for tx and rx
687  * data xfer
688  *
689  * There are two portions of these txrx operations.
690  * The rx portion is filled in by OSIF SW before calling
691  * ol_txrx_osif_vdev_register; inside the ol_txrx_osif_vdev_register
692  * the txrx SW stores a copy of these rx function pointers, to use
693  * as it delivers rx data frames to the OSIF SW.
694  * The tx portion is filled in by the txrx SW inside
695  * ol_txrx_osif_vdev_register; when the function call returns,
696  * the OSIF SW stores a copy of these tx functions to use as it
697  * delivers tx data frames to the txrx SW.
698  *
699  * @tx.std -  the tx function pointer for standard data
700  * frames This function pointer is set by the txrx SW
701  * perform host-side transmit operations based on
702  * whether a HL or LL host/target interface is in use.
703  * @tx.flow_control_cb - the transmit flow control
704  * function that is registered by the
705  * OSIF which is called from txrx to
706  * indicate whether the transmit OS
707  * queues should be paused/resumed
708  * @rx.rx - the OS shim rx function to deliver rx data
709  * frames to. This can have different values for
710  * different virtual devices, e.g. so one virtual
711  * device's OS shim directly hands rx frames to the OS,
712  * but another virtual device's OS shim filters out P2P
713  * messages before sending the rx frames to the OS. The
714  * netbufs delivered to the osif_rx function are in the
715  * format specified by the OS to use for tx and rx
716  * frames (either 802.3 or native WiFi). In case RX Threads are enabled, pkts
717  * are given to the thread, instead of the stack via this pointer.
718  * @rx.stack - function to give packets to the stack. Differs from @rx.rx.
719  * In case RX Threads are enabled, this pointer holds the callback to give
720  * packets to the stack.
721  * @rx.wai_check - the tx function pointer for WAPI frames
722  * @rx.mon - the OS shim rx monitor function to deliver
723  * monitor data to Though in practice, it is probable
724  * that the same function will be used for delivering
725  * rx monitor data for all virtual devices, in theory
726  * each different virtual device can have a different
727  * OS shim function for accepting rx monitor data. The
728  * netbufs delivered to the osif_rx_mon function are in
729  * 802.11 format.  Each netbuf holds a 802.11 MPDU, not
730  * an 802.11 MSDU. Depending on compile-time
731  * configuration, each netbuf may also have a
732  * monitor-mode encapsulation header such as a radiotap
733  * header added before the MPDU contents.
734  * @rx.std - the OS shim rx function to deliver rx data
735  * @proxy_arp - proxy arp function pointer - specified by
736  * OS shim, stored by txrx
737  * @get_key - function pointer to get key of the peer with
738  * specific key index
739  */
740 struct ol_txrx_ops {
741 	/* tx function pointers - specified by txrx, stored by OS shim */
742 	struct {
743 		ol_txrx_tx_fp         tx;
744 		ol_txrx_tx_exc_fp     tx_exception;
745 		ol_txrx_tx_free_ext_fp tx_free_ext;
746 		ol_txrx_completion_fp tx_comp;
747 	} tx;
748 
749 	/* rx function pointers - specified by OS shim, stored by txrx */
750 	struct {
751 		ol_txrx_rx_fp           rx;
752 		ol_txrx_rx_fp           rx_stack;
753 		ol_txrx_rx_check_wai_fp wai_check;
754 		ol_txrx_rx_mon_fp       mon;
755 		ol_txrx_stats_rx_fp           stats_rx;
756 		ol_txrx_rsim_rx_decap_fp rsim_rx_decap;
757 	} rx;
758 	/* proxy arp function pointer - specified by OS shim, stored by txrx */
759 	ol_txrx_proxy_arp_fp      proxy_arp;
760 	ol_txrx_mcast_me_fp          me_convert;
761 
762 	ol_txrx_get_key_fp  get_key;
763 };
764 
765 /**
766  * ol_txrx_stats_req - specifications of the requested
767  * statistics
768  */
769 struct ol_txrx_stats_req {
770 	uint32_t stats_type_upload_mask;        /* which stats to upload */
771 	uint32_t stats_type_reset_mask; /* which stats to reset */
772 
773 	/* stats will be printed if either print element is set */
774 	struct {
775 		int verbose;    /* verbose stats printout */
776 		int concise;    /* concise stats printout (takes precedence) */
777 	} print;                /* print uploaded stats */
778 
779 	/* stats notify callback will be invoked if fp is non-NULL */
780 	struct {
781 		ol_txrx_stats_callback fp;
782 		void *ctxt;
783 	} callback;
784 
785 	/* stats will be copied into the specified buffer if buf is non-NULL */
786 	struct {
787 		uint8_t *buf;
788 		int byte_limit; /* don't copy more than this */
789 	} copy;
790 
791 	/*
792 	 * If blocking is true, the caller will take the specified semaphore
793 	 * to wait for the stats to be uploaded, and the driver will release
794 	 * the semaphore when the stats are done being uploaded.
795 	 */
796 	struct {
797 		int blocking;
798 		/*Note: this needs to change to some qdf_* type */
799 		qdf_semaphore_t *sem_ptr;
800 	} wait;
801 };
802 
803 
804 /* DP soc struct definition */
805 struct cdp_soc_t {
806 	struct cdp_ops *ops;
807 	struct ol_if_ops *ol_ops;
808 };
809 
810 /*
811  * cdp_pdev_param_type: different types of parameters
812  *			to set values in pdev
813  * @CDP_CONFIG_DEBUG_SNIFFER: Enable debug sniffer feature
814  * @CDP_CONFIG_BPR_ENABLE: Enable bcast probe feature
815  * @CDP_CONFIG_PRIMARY_RADIO: Configure radio as primary
816  * @CDP_CONFIG_ENABLE_PERPKT_TXSTATS: Enable per packet statistics
817  * @CDP_CONFIG_IGMPMLD_OVERRIDE: Override IGMP/MLD
818  * @CDP_CONFIG_IGMPMLD_TID: Configurable TID value when igmmld_override is set
819  * @CDP_CONFIG_ARP_DBG_CONF: Enable ARP debug
820  */
821 enum cdp_pdev_param_type {
822 	CDP_CONFIG_DEBUG_SNIFFER,
823 	CDP_CONFIG_BPR_ENABLE,
824 	CDP_CONFIG_PRIMARY_RADIO,
825 	CDP_CONFIG_ENABLE_PERPKT_TXSTATS,
826 	CDP_CONFIG_IGMPMLD_OVERRIDE,
827 	CDP_CONFIG_IGMPMLD_TID,
828 	CDP_CONFIG_ARP_DBG_CONF,
829 };
830 
831 /*
832  * enum cdp_pdev_bpr_param - different types of parameters
833  *			     to set value in pdev
834  * @CDP_BPR_DISABLE: Set bpr to disable state
835  * @CDP_BPR_ENABLE: set bpr to enable state
836  *
837  * Enum indicating bpr state to enable/disable.
838  */
839 enum cdp_pdev_bpr_param {
840 	CDP_BPR_DISABLE,
841 	CDP_BPR_ENABLE,
842 };
843 
844 /*
845  * cdp_vdev_param_type: different types of parameters
846  *			to set values in vdev
847  * @CDP_ENABLE_NAWDS: set nawds enable/disable
848  * @CDP_ENABLE_MCAST_EN: enable/disable multicast enhancement
849  * @CDP_ENABLE_WDS: wds sta
850  * @CDP_ENABLE_MEC: MEC enable flags
851  * @CDP_ENABLE_PROXYSTA: proxy sta
852  * @CDP_UPDATE_TDLS_FLAGS: tdls link flags
853  * @CDP_ENABLE_AP_BRIDGE: set ap_bridging enable/disable
854  * @CDP_ENABLE_CIPHER : set cipher type based on security
855  * @CDP_ENABLE_QWRAP_ISOLATION: qwrap isolation mode
856  */
857 enum cdp_vdev_param_type {
858 	CDP_ENABLE_NAWDS,
859 	CDP_ENABLE_MCAST_EN,
860 	CDP_ENABLE_WDS,
861 	CDP_ENABLE_MEC,
862 	CDP_ENABLE_DA_WAR,
863 	CDP_ENABLE_PROXYSTA,
864 	CDP_UPDATE_TDLS_FLAGS,
865 	CDP_CFG_WDS_AGING_TIMER,
866 	CDP_ENABLE_AP_BRIDGE,
867 	CDP_ENABLE_CIPHER,
868 	CDP_ENABLE_QWRAP_ISOLATION
869 };
870 
871 #define TXRX_FW_STATS_TXSTATS                     1
872 #define TXRX_FW_STATS_RXSTATS                     2
873 #define TXRX_FW_STATS_RX_RATE_INFO                3
874 #define TXRX_FW_STATS_PHYSTATS                    4
875 #define TXRX_FW_STATS_PHYSTATS_CONCISE            5
876 #define TXRX_FW_STATS_TX_RATE_INFO                6
877 #define TXRX_FW_STATS_TID_STATE                   7
878 #define TXRX_FW_STATS_HOST_STATS                  8
879 #define TXRX_FW_STATS_CLEAR_HOST_STATS            9
880 #define TXRX_FW_STATS_CE_STATS                   10
881 #define TXRX_FW_STATS_VOW_UMAC_COUNTER           11
882 #define TXRX_FW_STATS_ME_STATS                   12
883 #define TXRX_FW_STATS_TXBF_INFO                  13
884 #define TXRX_FW_STATS_SND_INFO                   14
885 #define TXRX_FW_STATS_ERROR_INFO                 15
886 #define TXRX_FW_STATS_TX_SELFGEN_INFO            16
887 #define TXRX_FW_STATS_TX_MU_INFO                 17
888 #define TXRX_FW_SIFS_RESP_INFO                   18
889 #define TXRX_FW_RESET_STATS                      19
890 #define TXRX_FW_MAC_WDOG_STATS                   20
891 #define TXRX_FW_MAC_DESC_STATS                   21
892 #define TXRX_FW_MAC_FETCH_MGR_STATS              22
893 #define TXRX_FW_MAC_PREFETCH_MGR_STATS           23
894 #define TXRX_FW_STATS_DURATION_INFO              24
895 #define TXRX_FW_STATS_DURATION_INFO_RESET        25
896 #define TXRX_FW_HALPHY_STATS                     26
897 #define TXRX_FW_COEX_STATS                       27
898 
899 #define PER_RADIO_FW_STATS_REQUEST 0
900 #define PER_VDEV_FW_STATS_REQUEST 1
901 /**
902  * enum data_stall_log_event_indicator - Module triggering data stall
903  * @DATA_STALL_LOG_INDICATOR_UNUSED: Unused
904  * @DATA_STALL_LOG_INDICATOR_HOST_DRIVER: Host driver indicates data stall
905  * @DATA_STALL_LOG_INDICATOR_FIRMWARE: FW indicates data stall
906  * @DATA_STALL_LOG_INDICATOR_FRAMEWORK: Framework indicates data stall
907  *
908  * Enum indicating the module that indicates data stall event
909  */
910 enum data_stall_log_event_indicator {
911 	DATA_STALL_LOG_INDICATOR_UNUSED,
912 	DATA_STALL_LOG_INDICATOR_HOST_DRIVER,
913 	DATA_STALL_LOG_INDICATOR_FIRMWARE,
914 	DATA_STALL_LOG_INDICATOR_FRAMEWORK,
915 };
916 
917 /**
918  * enum data_stall_log_event_type - data stall event type
919  * @DATA_STALL_LOG_NONE
920  * @DATA_STALL_LOG_FW_VDEV_PAUSE
921  * @DATA_STALL_LOG_HWSCHED_CMD_FILTER
922  * @DATA_STALL_LOG_HWSCHED_CMD_FLUSH
923  * @DATA_STALL_LOG_FW_RX_REFILL_FAILED
924  * @DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR
925  * @DATA_STALL_LOG_FW_WDOG_ERRORS
926  * @DATA_STALL_LOG_BB_WDOG_ERROR
927  * @DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR
928  * @DATA_STALL_LOG_HOST_STA_TX_TIMEOUT
929  * @DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT
930  * @DATA_STALL_LOG_NUD_FAILURE
931  *
932  * Enum indicating data stall event type
933  */
934 enum data_stall_log_event_type {
935 	DATA_STALL_LOG_NONE,
936 	DATA_STALL_LOG_FW_VDEV_PAUSE,
937 	DATA_STALL_LOG_HWSCHED_CMD_FILTER,
938 	DATA_STALL_LOG_HWSCHED_CMD_FLUSH,
939 	DATA_STALL_LOG_FW_RX_REFILL_FAILED,
940 	DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR,
941 	DATA_STALL_LOG_FW_WDOG_ERRORS,
942 	DATA_STALL_LOG_BB_WDOG_ERROR,
943 	DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR,
944 	/* Stall events triggered by host/framework start from 0x100 onwards. */
945 	DATA_STALL_LOG_HOST_STA_TX_TIMEOUT = 0x100,
946 	DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT,
947 	DATA_STALL_LOG_NUD_FAILURE,
948 };
949 
950 /**
951  * enum data_stall_log_recovery_type - data stall recovery type
952  * @DATA_STALL_LOG_RECOVERY_NONE,
953  * @DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
954  * @DATA_STALL_LOG_RECOVERY_TRIGGER_PDR
955  *
956  * Enum indicating data stall recovery type
957  */
958 enum data_stall_log_recovery_type {
959 	DATA_STALL_LOG_RECOVERY_NONE = 0,
960 	DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
961 	DATA_STALL_LOG_RECOVERY_TRIGGER_PDR,
962 };
963 
964 /**
965  * struct data_stall_event_info - data stall info
966  * @indicator: Module triggering data stall
967  * @data_stall_type: data stall event type
968  * @vdev_id_bitmap: vdev_id_bitmap
969  * @pdev_id: pdev id
970  * @recovery_type: data stall recovery type
971  */
972 struct data_stall_event_info {
973 	uint32_t indicator;
974 	uint32_t data_stall_type;
975 	uint32_t vdev_id_bitmap;
976 	uint32_t pdev_id;
977 	uint32_t recovery_type;
978 };
979 
980 typedef void (*data_stall_detect_cb)(struct data_stall_event_info *);
981 
982 /*
983  * enum cdp_stats - options for host and firmware
984  * statistics
985  * @CDP_TXRX_STATS_1: HTT Pdev tx stats
986  * @CDP_TXRX_STATS_2: HTT Pdev rx stats
987  * @CDP_TXRX_STATS_3: HTT Pdev Tx HW Queue stats
988  * @CDP_TXRX_STATS_4: HTT Pdev Tx HW Sched stats
989  * @CDP_TXRX_STATS_5: HTT Pdev error stats
990  * @CDP_TXRX_STATS_6: HTT TQM stats
991  * @CDP_TXRX_STATS_7: HTT TQM CMDQ stats
992  * @CDP_TXRX_STATS_8: HTT Tx_de_cmn thread stats
993  * @CDP_TXRX_STATS_9: HTT Pdev Tx rate stats
994  * @CDP_TXRX_STATS_10: HTT Pdev Rx rate stats
995  * @CDP_TXRX_STATS_11: HTT Peer stats
996  * @CDP_TXRX_STATS_12: HTT Tx Self Gen Info
997  * @CDP_TXRX_STATS_13: HTT Tx MU HWQ stats
998  * @CDP_TXRX_STATS_14: HTT Ring interface info stats
999  * @CDP_TXRX_STATS_15: HTT SRNG info stats
1000  * @CDP_TXRX_STATS_16: HTT SFM info stats
1001  * @CDP_TXRX_STATS_17: HTT Pdev tx mu mimo sched info
1002  * @CDP_TXRX_STATS_18: HTT Peer list details
1003  * @CDP_TXRX_STATS_19: Reserved
1004  * @CDP_TXRX_STATS_20: Reset Host stats
1005  * @CDP_TXRX_STATS_21: Host Rx rate stats
1006  * @CDP_TXRX_STATS_22: Host Tx rate stats
1007  * @CDP_TXRX_STATS_23: Host Tx stats
1008  * @CDP_TXRX_STATS_24: Host Rx stats
1009  * @CDP_TXRX_STATS_25: Host Ast stats
1010  * @CDP_TXRX_STATS_26: Host Head/Tail Pointer stats
1011  * @CDP_TXRX_STATS_27: Host Monitor mode stats
1012  * @CDP_TXRX_STATS_28: Host Peer entry stats
1013  * @CDP_TXRX_STATS_29: Host Soc config params info
1014  * @CDP_TXRX_STATS_30: Host Pdev config params info
1015  */
1016 enum cdp_stats {
1017 	CDP_TXRX_STATS_0  = 0,
1018 	CDP_TXRX_STATS_1,
1019 	CDP_TXRX_STATS_2,
1020 	CDP_TXRX_STATS_3,
1021 	CDP_TXRX_STATS_4,
1022 	CDP_TXRX_STATS_5,
1023 	CDP_TXRX_STATS_6,
1024 	CDP_TXRX_STATS_7,
1025 	CDP_TXRX_STATS_8,
1026 	CDP_TXRX_STATS_9,
1027 	CDP_TXRX_STATS_10,
1028 	CDP_TXRX_STATS_11,
1029 	CDP_TXRX_STATS_12,
1030 	CDP_TXRX_STATS_13,
1031 	CDP_TXRX_STATS_14,
1032 	CDP_TXRX_STATS_15,
1033 	CDP_TXRX_STATS_16,
1034 	CDP_TXRX_STATS_17,
1035 	CDP_TXRX_STATS_18,
1036 	CDP_TXRX_STATS_19,
1037 	CDP_TXRX_STATS_20,
1038 	CDP_TXRX_STATS_21,
1039 	CDP_TXRX_STATS_22,
1040 	CDP_TXRX_STATS_23,
1041 	CDP_TXRX_STATS_24,
1042 	CDP_TXRX_STATS_25,
1043 	CDP_TXRX_STATS_26,
1044 	CDP_TXRX_STATS_27,
1045 	CDP_TXRX_STATS_28,
1046 	CDP_TXRX_STATS_29,
1047 	CDP_TXRX_STATS_30,
1048 	CDP_TXRX_STATS_HTT_MAX = 256,
1049 	CDP_TXRX_MAX_STATS = 265,
1050 };
1051 
1052 /*
1053  * Different Stat update types sent to OL_IF
1054  * @UPDATE_PEER_STATS: update peer stats
1055  * @UPDATE_VDEV_STATS: update vdev stats
1056  * @UPDATE_PDE_STATS: Update pdev stats
1057  */
1058 enum cdp_stat_update_type {
1059 	UPDATE_PEER_STATS = 0,
1060 	UPDATE_VDEV_STATS = 1,
1061 	UPDATE_PDEV_STATS = 2,
1062 };
1063 
1064 /*
1065  * struct cdp_tx_sojourn_stats - Tx sojourn stats
1066  * @ppdu_seq_id: ppdu_seq_id from tx completion
1067  * @avg_sojourn_msdu: average sojourn msdu time
1068  * @sum_sojourn_msdu: sum sojourn msdu time
1069  * @num_msdu: number of msdus per ppdu
1070  */
1071 struct cdp_tx_sojourn_stats {
1072 	uint32_t ppdu_seq_id;
1073 	qdf_ewma_tx_lag avg_sojourn_msdu[CDP_DATA_TID_MAX];
1074 	uint32_t sum_sojourn_msdu[CDP_DATA_TID_MAX];
1075 	uint32_t num_msdus[CDP_DATA_TID_MAX];
1076 };
1077 
1078 /**
1079  * struct cdp_tx_completion_ppdu_user - Tx PPDU completion per-user information
1080  * @completion_status: completion status - OK/Filter/Abort/Timeout
1081  * @tid: TID number
1082  * @peer_id: Peer ID
1083  * @frame_ctrl: frame control field in 802.11 header
1084  * @qos_ctrl: QoS control field in 802.11 header
1085  * @mpdu_tried: number of mpdus tried
1086  * @mpdu_success: number of mpdus successfully transmitted
1087  * @long_retries: long retries
1088  * @short_retries: short retries
1089  * @is_ampdu: mpdu aggregate or non-aggregate?
1090  * @success_bytes: bytes successfully transmitted
1091  * @retry_bytes: bytes retried
1092  * @failed_msdus: MSDUs failed transmission
1093  * @duration: user duration in ppdu
1094  * @ltf_size: ltf_size
1095  * @stbc: stbc
1096  * @he_re: he_re (range extension)
1097  * @txbf: txbf
1098  * @bw: Transmission bandwidth
1099  *       <enum 2 transmit_bw_20_MHz>
1100  *       <enum 3 transmit_bw_40_MHz>
1101  *       <enum 4 transmit_bw_80_MHz>
1102  *       <enum 5 transmit_bw_160_MHz>
1103  * @nss: NSS 1,2, ...8
1104  * @mcs: MCS index
1105  * @preamble: preamble
1106  * @gi: guard interval 800/400/1600/3200 ns
1107  * @dcm: dcm
1108  * @ldpc: ldpc
1109  * @delayed_ba: delayed ba bit
1110  * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
1111  * UL_BSR_TRIG/UNKNOWN
1112  * @ba_seq_no: Block Ack sequence number
1113  * @ba_bitmap: Block Ack bitmap
1114  * @start_seqa: Sequence number of first MPDU
1115  * @enq_bitmap: Enqueue MPDU bitmap
1116  * @ru_start: RU start index
1117  * @ru_tones: RU tones length
1118  * @is_mcast: MCAST or UCAST
1119  * @tx_rate: Transmission Rate
1120  * @user_pos: user position
1121  * @mu_group_id: mu group id
1122  */
1123 struct cdp_tx_completion_ppdu_user {
1124 	uint32_t completion_status:8,
1125 		 tid:8,
1126 		 peer_id:16;
1127 	uint8_t mac_addr[6];
1128 	uint32_t frame_ctrl:16,
1129 		 qos_ctrl:16;
1130 	uint32_t mpdu_tried_ucast:16,
1131 		mpdu_tried_mcast:16;
1132 	uint16_t mpdu_success:16;
1133 	uint16_t mpdu_failed:16;
1134 	uint32_t long_retries:4,
1135 		 short_retries:4,
1136 		 tx_ratecode:8,
1137 		 is_ampdu:1,
1138 		 ppdu_type:5;
1139 	uint32_t success_bytes;
1140 	uint32_t retry_bytes;
1141 	uint32_t failed_bytes;
1142 	uint32_t success_msdus:16,
1143 		 retry_msdus:16;
1144 	uint32_t failed_msdus:16,
1145 		 duration:16;
1146 	uint32_t ltf_size:2,
1147 		 stbc:1,
1148 		 he_re:1,
1149 		 txbf:4,
1150 		 bw:4,
1151 		 nss:4,
1152 		 mcs:4,
1153 		 preamble:4,
1154 		 gi:4,
1155 		 dcm:1,
1156 		 ldpc:1,
1157 		 delayed_ba:1;
1158 	uint32_t ba_seq_no;
1159 	uint32_t ba_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1160 	uint32_t start_seq;
1161 	uint32_t enq_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1162 	uint32_t failed_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1163 	uint32_t num_mpdu:9,
1164 		 num_msdu:16;
1165 	uint32_t tx_duration;
1166 	uint16_t ru_start;
1167 	uint16_t ru_tones;
1168 	bool is_mcast;
1169 	uint32_t tx_rate;
1170 	uint32_t tx_ratekbps;
1171 	/*ack rssi for separate chains*/
1172 	uint32_t ack_rssi[CDP_RSSI_CHAIN_LEN];
1173 	bool ack_rssi_valid;
1174 	uint32_t user_pos;
1175 	uint32_t mu_group_id;
1176 };
1177 
1178 /**
1179  * struct cdp_tx_completion_ppdu - Tx PPDU completion information
1180  * @completion_status: completion status - OK/Filter/Abort/Timeout
1181  * @ppdu_id: PPDU Id
1182  * @ppdu_seq_id: ppdu sequence id for sojourn stats
1183  * @vdev_id: VAP Id
1184  * @num_users: Number of users
1185  * @num_mpdu: Number of MPDUs in PPDU
1186  * @num_msdu: Number of MSDUs in PPDU
1187  * @frame_type: frame SU or MU
1188  * @frame_ctrl: frame control of 80211 header
1189  * @channel: Channel informartion
1190  * @ack_rssi: RSSI value of last ack packet (units=dB above noise floor)
1191  * @tx_duration: PPDU airtime
1192  * @ppdu_start_timestamp: TSF at PPDU start
1193  * @ppdu_end_timestamp: TSF at PPDU end
1194  * @ack_timestamp: TSF at the reception of ACK
1195  * @user: per-User stats (array of per-user structures)
1196  */
1197 struct cdp_tx_completion_ppdu {
1198 	uint32_t ppdu_id;
1199 	uint32_t ppdu_seq_id;
1200 	uint16_t vdev_id;
1201 	uint32_t num_users;
1202 	uint32_t num_mpdu:9,
1203 		 num_msdu:16;
1204 	uint16_t frame_type;
1205 	uint16_t frame_ctrl;
1206 	uint16_t channel;
1207 	uint16_t phy_mode;
1208 	uint32_t ack_rssi;
1209 	uint32_t tx_duration;
1210 	uint32_t ppdu_start_timestamp;
1211 	uint32_t ppdu_end_timestamp;
1212 	uint32_t ack_timestamp;
1213 	struct cdp_tx_completion_ppdu_user user[CDP_MU_MAX_USERS];
1214 };
1215 
1216 /**
1217  * struct cdp_dev_stats - Network device stats structure
1218  * @tx_packets: Tx total packets transmitted
1219  * @tx_bytes  : Tx total bytes transmitted
1220  * @tx_errors : Tx error due to FW tx failure, Ring failure DMA etc
1221  * @tx_dropped: Tx dropped is same as tx errors as above
1222  * @rx_packets: Rx total packets transmitted
1223  * @rx_bytes  : Rx total bytes transmitted
1224  */
1225 struct cdp_dev_stats {
1226 	uint32_t tx_packets;
1227 	uint32_t tx_bytes;
1228 	uint32_t tx_errors;
1229 	uint32_t tx_dropped;
1230 	uint32_t rx_packets;
1231 	uint32_t rx_bytes;
1232 };
1233 
1234 /**
1235  * struct cdp_rate_stats - Tx/Rx Rate statistics
1236  * @bw: Indicates the BW of the upcoming transmission -
1237  *       <enum 2 transmit_bw_20_MHz>
1238  *       <enum 3 transmit_bw_40_MHz>
1239  *       <enum 4 transmit_bw_80_MHz>
1240  *       <enum 5 transmit_bw_160_MHz>
1241  * @pkt_type: Transmit Packet Type
1242  * @stbc: When set, STBC transmission rate was used
1243  * @ldpc: When set, use LDPC transmission rates
1244  * @sgi: <enum 0     0_8_us_sgi > Legacy normal GI
1245  *       <enum 1     0_4_us_sgi > Legacy short GI
1246  *       <enum 2     1_6_us_sgi > HE related GI
1247  *       <enum 3     3_2_us_sgi > HE
1248  * @mcs: Transmit MCS Rate
1249  * @ofdma: Set when the transmission was an OFDMA transmission
1250  * @tones_in_ru: The number of tones in the RU used.
1251  * @tsf: Lower 32 bits of the TSF (timestamp when ppdu transmission finished)
1252  * @peer_id: Peer ID of the flow or MPDU queue
1253  * @tid: TID of the flow or MPDU queue
1254  */
1255 struct cdp_rate_stats {
1256 	uint32_t rate_stats_info_valid:1,
1257 		 bw:2,
1258 		 pkt_type:4,
1259 		 stbc:1,
1260 		 ldpc:1,
1261 		 sgi:2,
1262 		 mcs:4,
1263 		 ofdma:1,
1264 		 tones_in_ru:12,
1265 		 resvd0:4;
1266 	uint32_t tsf;
1267 	uint16_t peer_id;
1268 	uint8_t tid;
1269 };
1270 
1271 /**
1272  * struct cdp_tx_completion_msdu - Tx MSDU completion descriptor
1273  * @ppdu_id: PPDU to which this MSDU belongs
1274  * @transmit_cnt: Number of times this frame has been transmitted
1275  * @ack_frame_rssi: RSSI of the received ACK or BA frame
1276  * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
1277  * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
1278  * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
1279  * @extd: Extended structure containing rate statistics
1280  */
1281 struct cdp_tx_completion_msdu {
1282 	uint32_t ppdu_id;
1283 	uint8_t transmit_cnt;
1284 	uint32_t ack_frame_rssi:8,
1285 		 resvd0:1,
1286 		 first_msdu:1,
1287 		 last_msdu:1,
1288 		 msdu_part_of_amsdu:1,
1289 		 resvd1:20;
1290 	struct cdp_rate_stats extd;
1291 };
1292 
1293 /**
1294  * struct cdp_rx_indication_ppdu - Rx PPDU indication structure
1295  * @ppdu_id: PPDU Id
1296  * @is_ampdu: mpdu aggregate or non-aggregate?
1297  * @num_mpdu: Number of MPDUs in PPDU
1298  * @reserved: Reserved bits for future use
1299  * @num_msdu: Number of MSDUs in PPDU
1300  * @udp_msdu_count: Number of UDP MSDUs in PPDU
1301  * @tcp_msdu_count: Number of TCP MSDUs in PPDU
1302  * @other_msdu_count: Number of MSDUs other than UDP and TCP MSDUs in PPDU
1303  * @duration: PPDU duration
1304  * @tid: TID number
1305  * @peer_id: Peer ID
1306  * @vdev_id: VAP ID
1307  * @mac_addr: Peer MAC Address
1308  * @first_data_seq_ctrl: Sequence control field of first data frame
1309  * @ltf_size: ltf_size
1310  * @stbc: When set, STBC rate was used
1311  * @he_re: he_re (range extension)
1312  * @bw: Bandwidth
1313  *       <enum 0 bw_20_MHz>
1314  *       <enum 1 bw_40_MHz>
1315  *       <enum 2 bw_80_MHz>
1316  *       <enum 3 bw_160_MHz>
1317  * @nss: NSS 1,2, ...8
1318  * @mcs: MCS index
1319  * @preamble: preamble
1320  * @gi: <enum 0     0_8_us_sgi > Legacy normal GI
1321  *       <enum 1     0_4_us_sgi > Legacy short GI
1322  *       <enum 2     1_6_us_sgi > HE related GI
1323  *       <enum 3     3_2_us_sgi > HE
1324  * @dcm: dcm
1325  * @ldpc: ldpc
1326  * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
1327  * UL_BSR_TRIG/UNKNOWN
1328  * @rssi: RSSI value (units = dB above noise floor)
1329  * @timestamp: TSF at the reception of PPDU
1330  * @length: PPDU length
1331  * @channel: Channel informartion
1332  * @lsig_A: L-SIG in 802.11 PHY header
1333  * @frame_ctrl: frame control field
1334  */
1335 struct cdp_rx_indication_ppdu {
1336 	uint32_t ppdu_id;
1337 	uint16_t is_ampdu:1,
1338 		 num_mpdu:9,
1339 		 reserved:6;
1340 	uint32_t num_msdu;
1341 	uint16_t udp_msdu_count;
1342 	uint16_t tcp_msdu_count;
1343 	uint16_t other_msdu_count;
1344 	uint16_t duration;
1345 	uint32_t tid:8,
1346 		 peer_id:16;
1347 	uint8_t vdev_id;
1348 	uint8_t mac_addr[6];
1349 	uint16_t first_data_seq_ctrl;
1350 	union {
1351 		uint32_t rate_info;
1352 		struct {
1353 			uint32_t ltf_size:2,
1354 				 stbc:1,
1355 				 he_re:1,
1356 				 bw:4,
1357 				 nss:4,
1358 				 mcs:4,
1359 				 preamble:4,
1360 				 gi:4,
1361 				 dcm:1,
1362 				 ldpc:1,
1363 				 ppdu_type:5;
1364 		};
1365 	} u;
1366 	uint32_t lsig_a;
1367 	uint32_t rssi;
1368 	uint64_t timestamp;
1369 	uint32_t length;
1370 	uint8_t channel;
1371 	uint8_t beamformed;
1372 
1373 	uint32_t rx_ratekbps;
1374 	uint32_t ppdu_rx_rate;
1375 
1376 	uint32_t retries;
1377 	uint32_t rx_byte_count;
1378 	uint8_t rx_ratecode;
1379 	uint8_t fcs_error_mpdus;
1380 	uint16_t frame_ctrl;
1381 };
1382 
1383 /**
1384  * struct cdp_rx_indication_msdu - Rx MSDU info
1385  * @ppdu_id: PPDU to which the MSDU belongs
1386  * @msdu_len: Length of MSDU in bytes
1387  * @ack_frame_rssi: RSSI of the received ACK or BA frame
1388  * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
1389  * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
1390  * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
1391  * @extd: Extended structure containing rate statistics
1392  */
1393 struct cdp_rx_indication_msdu {
1394 	uint32_t ppdu_id;
1395 	uint16_t msdu_len;
1396 	uint32_t ack_frame_rssi:8,
1397 		 resvd0:1,
1398 		 first_msdu:1,
1399 		 last_msdu:1,
1400 		 msdu_part_of_amsdu:1,
1401 		 msdu_part_of_ampdu:1,
1402 		 resvd1:19;
1403 	struct cdp_rate_stats extd;
1404 };
1405 
1406 /**
1407  * struct cdp_config_params - Propagate configuration parameters to datapath
1408  * @tso_enable: Enable/Disable TSO
1409  * @lro_enable: Enable/Disable LRO
1410  * @gro_enable: Enable/Disable GRO
1411  * @flow_steering_enable: Enable/Disable Rx Hash based flow steering
1412  * @tcp_Udp_ChecksumOffload: Enable/Disable tcp-Udp checksum Offload
1413  * @napi_enable: Enable/Disable Napi
1414  * @ipa_enable: Flag indicating if IPA is enabled or not
1415  * @tx_flow_stop_queue_threshold: Value to Pause tx queues
1416  * @tx_flow_start_queue_offset: Available Tx descriptors to unpause
1417  *				tx queue
1418  */
1419 struct cdp_config_params {
1420 	unsigned int tso_enable:1;
1421 	unsigned int lro_enable:1;
1422 	unsigned int gro_enable:1;
1423 	unsigned int flow_steering_enable:1;
1424 	unsigned int tcp_udp_checksumoffload:1;
1425 	unsigned int napi_enable:1;
1426 	unsigned int ipa_enable:1;
1427 	/* Set when QCA_LL_TX_FLOW_CONTROL_V2 is enabled */
1428 	uint8_t tx_flow_stop_queue_threshold;
1429 	uint8_t tx_flow_start_queue_offset;
1430 
1431 };
1432 
1433 /**
1434  * cdp_txrx_stats_req: stats request wrapper
1435  *	used to pass request information to cdp layer
1436  * @stats: type of stats requested
1437  * @param0: opaque argument 0 to be passed to htt
1438  * @param1: opaque argument 1 to be passed to htt
1439  * @param2: opaque argument 2 to be passed to htt
1440  * @param3: opaque argument 3 to be passed to htt
1441  * @mac id: mac_id
1442  */
1443 struct cdp_txrx_stats_req {
1444 	enum cdp_stats	stats;
1445 	uint32_t	param0;
1446 	uint32_t	param1;
1447 	uint32_t	param2;
1448 	uint32_t	param3;
1449 	uint32_t	cookie_val;
1450 	uint8_t		mac_id;
1451 	char *peer_addr;
1452 };
1453 
1454 /**
1455  * struct cdp_monitor_filter - monitor filter info
1456  * @mode: set filter mode
1457  * @fp_mgmt: set Filter Pass MGMT Configuration
1458  * @fp_ctrl: set Filter Pass CTRL Configuration
1459  * @fp_data: set Filter Pass DATA Configuration
1460  * @mo_mgmt: set Monitor Other MGMT Configuration
1461  * @mo_ctrl: set Monitor Other CTRL Configuration
1462  * @mo_data: set Monitor other DATA Configuration
1463  *
1464  */
1465 struct cdp_monitor_filter {
1466 	uint16_t mode;
1467 	uint16_t fp_mgmt;
1468 	uint16_t fp_ctrl;
1469 	uint16_t fp_data;
1470 	uint16_t mo_mgmt;
1471 	uint16_t mo_ctrl;
1472 	uint16_t mo_data;
1473 };
1474 
1475 /**
1476  * cdp_dp_cfg - dp ini config enum
1477  */
1478 enum cdp_dp_cfg {
1479 	cfg_dp_enable_data_stall,
1480 	cfg_dp_enable_ip_tcp_udp_checksum_offload,
1481 	cfg_dp_tso_enable,
1482 	cfg_dp_lro_enable,
1483 	cfg_dp_gro_enable,
1484 	cfg_dp_tx_flow_start_queue_offset,
1485 	cfg_dp_tx_flow_stop_queue_threshold,
1486 	cfg_dp_ipa_uc_tx_buf_size,
1487 	cfg_dp_ipa_uc_tx_partition_base,
1488 	cfg_dp_ipa_uc_rx_ind_ring_count,
1489 	cfg_dp_enable_flow_steering,
1490 	cfg_dp_reorder_offload_supported,
1491 	cfg_dp_ce_classify_enable,
1492 	cfg_dp_disable_intra_bss_fwd,
1493 };
1494 #endif
1495