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