xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_cmn_struct.h (revision 0626a4da6c07f30da06dd6747e8cc290a60371d8)
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_MAX
317 };
318 
319 /**
320  * struct cdp_sec_type - security type information
321  */
322 enum cdp_sec_type {
323     cdp_sec_type_none,
324     cdp_sec_type_wep128,
325     cdp_sec_type_wep104,
326     cdp_sec_type_wep40,
327     cdp_sec_type_tkip,
328     cdp_sec_type_tkip_nomic,
329     cdp_sec_type_aes_ccmp,
330     cdp_sec_type_wapi,
331     cdp_sec_type_aes_ccmp_256,
332     cdp_sec_type_aes_gcmp,
333     cdp_sec_type_aes_gcmp_256,
334 
335     /* keep this last! */
336     cdp_num_sec_types
337 };
338 
339 /**
340  *  struct cdp_tx_exception_metadata - Exception path parameters
341  *  @peer_id: Peer id of the peer
342  *  @tid: Transmit Identifier
343  *  @tx_encap_type: Transmit encap type (i.e. Raw, Native Wi-Fi, Ethernet)
344  *  @sec_type: sec_type to be passed to HAL
345  *
346  *  This structure holds the parameters needed in the exception path of tx
347  *
348  */
349 struct cdp_tx_exception_metadata {
350 	uint16_t peer_id;
351 	uint8_t tid;
352 	uint16_t tx_encap_type;
353 	enum cdp_sec_type sec_type;
354 };
355 
356 typedef struct cdp_soc_t *ol_txrx_soc_handle;
357 
358 /**
359  * ol_txrx_vdev_delete_cb - callback registered during vdev
360  * detach
361  */
362 typedef void (*ol_txrx_vdev_delete_cb)(void *context);
363 
364 /**
365  * ol_txrx_pkt_direction - Packet Direction
366  * @rx_direction: rx path packet
367  * @tx_direction: tx path packet
368  */
369 enum txrx_direction {
370 	rx_direction = 1,
371 	tx_direction = 0,
372 };
373 
374 /**
375  * ol_txrx_nbuf_classify - Packet classification object
376  * @peer_id: unique peer identifier from fw
377  * @tid: traffic identifier(could be overridden)
378  * @pkt_tid: traffic identifier(cannot be overridden)
379  * @pkt_tos: ip header tos value
380  * @pkt_dscp: ip header dscp value
381  * @tos: index value in map
382  * @dscp: DSCP_TID map index
383  * @is_mcast: multicast pkt check
384  * @is_eap: eapol pkt check
385  * @is_arp: arp pkt check
386  * @is_tcp: tcp pkt check
387  * @is_dhcp: dhcp pkt check
388  * @is_igmp: igmp pkt check
389  * @is_ipv4: ip version 4 pkt check
390  * @is_ipv6: ip version 6 pkt check
391  */
392 struct ol_txrx_nbuf_classify {
393 	uint16_t peer_id;
394 	uint8_t tid;
395 	uint8_t pkt_tid;
396 	uint8_t pkt_tos;
397 	uint8_t pkt_dscp;
398 	uint8_t tos;
399 	uint8_t dscp;
400 	uint8_t is_mcast;
401 	uint8_t is_eap;
402 	uint8_t is_arp;
403 	uint8_t is_tcp;
404 	uint8_t is_dhcp;
405 	uint8_t is_igmp;
406 	uint8_t is_ipv4;
407 	uint8_t is_ipv6;
408 };
409 
410 /**
411  * ol_osif_vdev_handle - paque handle for OS shim virtual device
412  * object
413  */
414 struct ol_osif_vdev_t;
415 typedef struct ol_osif_vdev_t *ol_osif_vdev_handle;
416 
417 /**
418  * wlan_op_mode - Virtual device operation mode
419  * @wlan_op_mode_unknown: Unknown mode
420  * @wlan_op_mode_ap: AP mode
421  * @wlan_op_mode_ibss: IBSS mode
422  * @wlan_op_mode_sta: STA (client) mode
423  * @wlan_op_mode_monitor: Monitor mode
424  * @wlan_op_mode_ocb: OCB mode
425  */
426 enum wlan_op_mode {
427 	wlan_op_mode_unknown,
428 	wlan_op_mode_ap,
429 	wlan_op_mode_ibss,
430 	wlan_op_mode_sta,
431 	wlan_op_mode_monitor,
432 	wlan_op_mode_ocb,
433 	wlan_op_mode_ndi,
434 };
435 
436 /**
437  * connectivity_stats_pkt_status - data pkt type
438  * @PKT_TYPE_REQ: Request packet
439  * @PKT_TYPE_RSP: Response packet
440  * @PKT_TYPE_TX_DROPPED: TX packet dropped
441  * @PKT_TYPE_RX_DROPPED: RX packet dropped
442  * @PKT_TYPE_RX_DELIVERED: RX packet delivered
443  * @PKT_TYPE_RX_REFUSED: RX packet refused
444  * @PKT_TYPE_TX_HOST_FW_SENT: TX packet FW sent
445  * @PKT_TYPE_TX_ACK_CNT:TC packet acked
446  * @PKT_TYPE_NONE: Invalid packet
447  */
448 enum connectivity_stats_pkt_status {
449 	PKT_TYPE_REQ,
450 	PKT_TYPE_RSP,
451 	PKT_TYPE_TX_DROPPED,
452 	PKT_TYPE_RX_DROPPED,
453 	PKT_TYPE_RX_DELIVERED,
454 	PKT_TYPE_RX_REFUSED,
455 	PKT_TYPE_TX_HOST_FW_SENT,
456 	PKT_TYPE_TX_ACK_CNT,
457 	PKT_TYPE_NONE,
458 };
459 
460 /**
461  * cdp_mgmt_tx_cb - tx management delivery notification
462  * callback function
463  */
464 typedef void
465 (*ol_txrx_mgmt_tx_cb)(void *ctxt, qdf_nbuf_t tx_mgmt_frm, int had_error);
466 
467 /**
468  * ol_txrx_data_tx_cb - Function registered with the data path
469  * that is called when tx frames marked as "no free" are
470  * done being transmitted
471  */
472 typedef void
473 (*ol_txrx_data_tx_cb)(void *ctxt, qdf_nbuf_t tx_frm, int had_error);
474 
475 /**
476  * ol_txrx_tx_fp - top-level transmit function
477  * @data_vdev - handle to the virtual device object
478  * @msdu_list - list of network buffers
479  */
480 typedef qdf_nbuf_t (*ol_txrx_tx_fp)(void *data_vdev,
481 				    qdf_nbuf_t msdu_list);
482 
483 /**
484  * ol_txrx_tx_exc_fp - top-level transmit function on exception path
485  * @data_vdev - handle to the virtual device object
486  * @msdu_list - list of network buffers
487  * @tx_exc_metadata - structure that holds parameters to exception path
488  */
489 typedef qdf_nbuf_t (*ol_txrx_tx_exc_fp)(void *data_vdev,
490 					qdf_nbuf_t msdu_list,
491 					struct cdp_tx_exception_metadata
492 						*tx_exc_metadata);
493 
494 /**
495  * ol_txrx_completion_fp - top-level transmit function
496  * for tx completion
497  * @skb: skb data
498  * @osif_dev: the virtual device's OS shim object
499  */
500 typedef void (*ol_txrx_completion_fp)(qdf_nbuf_t skb,
501 				      void *osif_dev);
502 /**
503  * ol_txrx_tx_flow_control_fp - tx flow control notification
504  * function from txrx to OS shim
505  * @osif_dev - the virtual device's OS shim object
506  * @tx_resume - tx os q should be resumed or not
507  */
508 typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev,
509 					    bool tx_resume);
510 
511 /**
512  * ol_txrx_tx_flow_control_is_pause_fp - is tx paused by flow control
513  * function from txrx to OS shim
514  * @osif_dev - the virtual device's OS shim object
515  *
516  * Return: true if tx is paused by flow control
517  */
518 typedef bool (*ol_txrx_tx_flow_control_is_pause_fp)(void *osif_dev);
519 
520 /**
521  * ol_txrx_rx_fp - receive function to hand batches of data
522  * frames from txrx to OS shim
523  * @data_vdev - handle to the OSIF virtual device object
524  * @msdu_list - list of network buffers
525  */
526 typedef QDF_STATUS(*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list);
527 
528 /**
529  * ol_txrx_stats_rx_fp - receive function to hand batches of data
530  * frames from txrx to OS shim
531  * @skb: skb data
532  * @osif_dev: the virtual device's OS shim object
533  * @action: data packet type
534  * @pkt_type: packet data type
535  */
536 typedef void (*ol_txrx_stats_rx_fp)(struct sk_buff *skb,
537 		void *osif_dev, enum connectivity_stats_pkt_status action,
538 		uint8_t *pkt_type);
539 
540 /**
541  * ol_txrx_get_key_fp - function to gey key based on keyix and peer
542  * mac address
543  * @osif_dev - the virtual device's OS shim object
544  * @key_buf - pointer to store key
545  * @mac_addr - pointer to mac address
546  * @keyix - key id
547  */
548 typedef QDF_STATUS(*ol_txrx_get_key_fp)(void *osif_dev, uint8_t *key_buf, uint8_t *mac_addr, uint8_t keyix);
549 
550 /**
551  * ol_txrx_rsim_rx_decap_fp - raw mode simulation function to decap the
552  * packets in receive path.
553  * @osif_dev  - the virtual device's OS shim object
554  * @list_head - poniter to head of receive packet queue to decap
555  * @list_tail - poniter to tail of receive packet queue to decap
556  * @peer      - Peer handler
557  */
558 typedef QDF_STATUS(*ol_txrx_rsim_rx_decap_fp)(void *osif_dev,
559 						qdf_nbuf_t *list_head,
560 						qdf_nbuf_t *list_tail,
561 						struct cdp_peer *peer);
562 
563 /* ol_txrx_rx_fp - external tx free function to read per packet stats and
564  *                            free tx buffer externally
565  * @netbuf - tx network buffer
566  */
567 typedef void (*ol_txrx_tx_free_ext_fp)(qdf_nbuf_t netbuf);
568 
569 /**
570  * ol_txrx_rx_check_wai_fp - OSIF WAPI receive function
571 */
572 typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev,
573 					    qdf_nbuf_t mpdu_head,
574 					    qdf_nbuf_t mpdu_tail);
575 /**
576  * ol_txrx_rx_mon_fp - OSIF monitor mode receive function for single
577  * MPDU (802.11 format)
578  */
579 typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev,
580 					    qdf_nbuf_t mpdu,
581 					    void *rx_status);
582 
583 /**
584  * ol_txrx_proxy_arp_fp - proxy arp function pointer
585 */
586 typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev,
587 					    qdf_nbuf_t netbuf);
588 
589 /*
590  * ol_txrx_mcast_me_fp - function pointer for multicast enhancement
591  */
592 typedef int (*ol_txrx_mcast_me_fp)(ol_osif_vdev_handle vdev,
593 						qdf_nbuf_t netbuf);
594 
595 /**
596  * ol_txrx_stats_callback - statistics notify callback
597  */
598 typedef void (*ol_txrx_stats_callback)(void *ctxt,
599 				       enum htt_cmn_dbg_stats_type type,
600 				       uint8_t *buf, int bytes);
601 
602 /**
603  * ol_txrx_ops - (pointers to) the functions used for tx and rx
604  * data xfer
605  *
606  * There are two portions of these txrx operations.
607  * The rx portion is filled in by OSIF SW before calling
608  * ol_txrx_osif_vdev_register; inside the ol_txrx_osif_vdev_register
609  * the txrx SW stores a copy of these rx function pointers, to use
610  * as it delivers rx data frames to the OSIF SW.
611  * The tx portion is filled in by the txrx SW inside
612  * ol_txrx_osif_vdev_register; when the function call returns,
613  * the OSIF SW stores a copy of these tx functions to use as it
614  * delivers tx data frames to the txrx SW.
615  *
616  * @tx.std -  the tx function pointer for standard data
617  * frames This function pointer is set by the txrx SW
618  * perform host-side transmit operations based on
619  * whether a HL or LL host/target interface is in use.
620  * @tx.flow_control_cb - the transmit flow control
621  * function that is registered by the
622  * OSIF which is called from txrx to
623  * indicate whether the transmit OS
624  * queues should be paused/resumed
625  * @rx.rx - the OS shim rx function to deliver rx data
626  * frames to. This can have different values for
627  * different virtual devices, e.g. so one virtual
628  * device's OS shim directly hands rx frames to the OS,
629  * but another virtual device's OS shim filters out P2P
630  * messages before sending the rx frames to the OS. The
631  * netbufs delivered to the osif_rx function are in the
632  * format specified by the OS to use for tx and rx
633  * frames (either 802.3 or native WiFi). In case RX Threads are enabled, pkts
634  * are given to the thread, instead of the stack via this pointer.
635  * @rx.stack - function to give packets to the stack. Differs from @rx.rx.
636  * In case RX Threads are enabled, this pointer holds the callback to give
637  * packets to the stack.
638  * @rx.wai_check - the tx function pointer for WAPI frames
639  * @rx.mon - the OS shim rx monitor function to deliver
640  * monitor data to Though in practice, it is probable
641  * that the same function will be used for delivering
642  * rx monitor data for all virtual devices, in theory
643  * each different virtual device can have a different
644  * OS shim function for accepting rx monitor data. The
645  * netbufs delivered to the osif_rx_mon function are in
646  * 802.11 format.  Each netbuf holds a 802.11 MPDU, not
647  * an 802.11 MSDU. Depending on compile-time
648  * configuration, each netbuf may also have a
649  * monitor-mode encapsulation header such as a radiotap
650  * header added before the MPDU contents.
651  * @rx.std - the OS shim rx function to deliver rx data
652  * @proxy_arp - proxy arp function pointer - specified by
653  * OS shim, stored by txrx
654  * @get_key - function pointer to get key of the peer with
655  * specific key index
656  */
657 struct ol_txrx_ops {
658 	/* tx function pointers - specified by txrx, stored by OS shim */
659 	struct {
660 		ol_txrx_tx_fp         tx;
661 		ol_txrx_tx_exc_fp     tx_exception;
662 		ol_txrx_tx_free_ext_fp tx_free_ext;
663 		ol_txrx_completion_fp tx_comp;
664 	} tx;
665 
666 	/* rx function pointers - specified by OS shim, stored by txrx */
667 	struct {
668 		ol_txrx_rx_fp           rx;
669 		ol_txrx_rx_fp           rx_stack;
670 		ol_txrx_rx_check_wai_fp wai_check;
671 		ol_txrx_rx_mon_fp       mon;
672 		ol_txrx_stats_rx_fp           stats_rx;
673 		ol_txrx_rsim_rx_decap_fp rsim_rx_decap;
674 	} rx;
675 	/* proxy arp function pointer - specified by OS shim, stored by txrx */
676 	ol_txrx_proxy_arp_fp      proxy_arp;
677 	ol_txrx_mcast_me_fp          me_convert;
678 
679 	ol_txrx_get_key_fp  get_key;
680 };
681 
682 /**
683  * ol_txrx_stats_req - specifications of the requested
684  * statistics
685  */
686 struct ol_txrx_stats_req {
687 	uint32_t stats_type_upload_mask;        /* which stats to upload */
688 	uint32_t stats_type_reset_mask; /* which stats to reset */
689 
690 	/* stats will be printed if either print element is set */
691 	struct {
692 		int verbose;    /* verbose stats printout */
693 		int concise;    /* concise stats printout (takes precedence) */
694 	} print;                /* print uploaded stats */
695 
696 	/* stats notify callback will be invoked if fp is non-NULL */
697 	struct {
698 		ol_txrx_stats_callback fp;
699 		void *ctxt;
700 	} callback;
701 
702 	/* stats will be copied into the specified buffer if buf is non-NULL */
703 	struct {
704 		uint8_t *buf;
705 		int byte_limit; /* don't copy more than this */
706 	} copy;
707 
708 	/*
709 	 * If blocking is true, the caller will take the specified semaphore
710 	 * to wait for the stats to be uploaded, and the driver will release
711 	 * the semaphore when the stats are done being uploaded.
712 	 */
713 	struct {
714 		int blocking;
715 		/*Note: this needs to change to some qdf_* type */
716 		qdf_semaphore_t *sem_ptr;
717 	} wait;
718 };
719 
720 
721 /* DP soc struct definition */
722 struct cdp_soc_t {
723 	struct cdp_ops *ops;
724 	struct ol_if_ops *ol_ops;
725 };
726 
727 /*
728  * cdp_pdev_param_type: different types of parameters
729  *			to set values in pdev
730  * @CDP_CONFIG_DEBUG_SNIFFER: Enable debug sniffer feature
731  * @CDP_CONFIG_BPR_ENABLE: Enable bcast probe feature
732  * @CDP_CONFIG_PRIMARY_RADIO: Configure radio as primary
733  */
734 enum cdp_pdev_param_type {
735 	CDP_CONFIG_DEBUG_SNIFFER,
736 	CDP_CONFIG_BPR_ENABLE,
737 	CDP_CONFIG_PRIMARY_RADIO,
738 };
739 
740 /*
741  * enum cdp_pdev_bpr_param - different types of parameters
742  *			     to set value in pdev
743  * @CDP_BPR_DISABLE: Set bpr to disable state
744  * @CDP_BPR_ENABLE: set bpr to enable state
745  *
746  * Enum indicating bpr state to enable/disable.
747  */
748 enum cdp_pdev_bpr_param {
749 	CDP_BPR_DISABLE,
750 	CDP_BPR_ENABLE,
751 };
752 
753 /*
754  * cdp_vdev_param_type: different types of parameters
755  *			to set values in vdev
756  * @CDP_ENABLE_NAWDS: set nawds enable/disable
757  * @CDP_ENABLE_MCAST_EN: enable/disable multicast enhancement
758  * @CDP_ENABLE_WDS: wds sta
759  * @CDP_ENABLE_PROXYSTA: proxy sta
760  * @CDP_UPDATE_TDLS_FLAGS: tdls link flags
761  * @CDP_ENABLE_AP_BRIDGE: set ap_bridging enable/disable
762  * @CDP_ENABLE_CIPHER : set cipher type based on security
763  * @CDP_ENABLE_QWRAP_ISOLATION: qwrap isolation mode
764  */
765 enum cdp_vdev_param_type {
766 	CDP_ENABLE_NAWDS,
767 	CDP_ENABLE_MCAST_EN,
768 	CDP_ENABLE_WDS,
769 	CDP_ENABLE_PROXYSTA,
770 	CDP_UPDATE_TDLS_FLAGS,
771 	CDP_CFG_WDS_AGING_TIMER,
772 	CDP_ENABLE_AP_BRIDGE,
773 	CDP_ENABLE_CIPHER,
774 	CDP_ENABLE_QWRAP_ISOLATION
775 };
776 
777 #define TXRX_FW_STATS_TXSTATS                     1
778 #define TXRX_FW_STATS_RXSTATS                     2
779 #define TXRX_FW_STATS_RX_RATE_INFO                3
780 #define TXRX_FW_STATS_PHYSTATS                    4
781 #define TXRX_FW_STATS_PHYSTATS_CONCISE            5
782 #define TXRX_FW_STATS_TX_RATE_INFO                6
783 #define TXRX_FW_STATS_TID_STATE                   7
784 #define TXRX_FW_STATS_HOST_STATS                  8
785 #define TXRX_FW_STATS_CLEAR_HOST_STATS            9
786 #define TXRX_FW_STATS_CE_STATS                   10
787 #define TXRX_FW_STATS_VOW_UMAC_COUNTER           11
788 #define TXRX_FW_STATS_ME_STATS                   12
789 #define TXRX_FW_STATS_TXBF_INFO                  13
790 #define TXRX_FW_STATS_SND_INFO                   14
791 #define TXRX_FW_STATS_ERROR_INFO                 15
792 #define TXRX_FW_STATS_TX_SELFGEN_INFO            16
793 #define TXRX_FW_STATS_TX_MU_INFO                 17
794 #define TXRX_FW_SIFS_RESP_INFO                   18
795 #define TXRX_FW_RESET_STATS                      19
796 #define TXRX_FW_MAC_WDOG_STATS                   20
797 #define TXRX_FW_MAC_DESC_STATS                   21
798 #define TXRX_FW_MAC_FETCH_MGR_STATS              22
799 #define TXRX_FW_MAC_PREFETCH_MGR_STATS           23
800 #define TXRX_FW_STATS_DURATION_INFO              24
801 #define TXRX_FW_STATS_DURATION_INFO_RESET        25
802 #define TXRX_FW_HALPHY_STATS                     26
803 #define TXRX_FW_COEX_STATS                       27
804 
805 #define PER_RADIO_FW_STATS_REQUEST 0
806 #define PER_VDEV_FW_STATS_REQUEST 1
807 /**
808  * enum data_stall_log_event_indicator - Module triggering data stall
809  * @DATA_STALL_LOG_INDICATOR_UNUSED: Unused
810  * @DATA_STALL_LOG_INDICATOR_HOST_DRIVER: Host driver indicates data stall
811  * @DATA_STALL_LOG_INDICATOR_FIRMWARE: FW indicates data stall
812  * @DATA_STALL_LOG_INDICATOR_FRAMEWORK: Framework indicates data stall
813  *
814  * Enum indicating the module that indicates data stall event
815  */
816 enum data_stall_log_event_indicator {
817 	DATA_STALL_LOG_INDICATOR_UNUSED,
818 	DATA_STALL_LOG_INDICATOR_HOST_DRIVER,
819 	DATA_STALL_LOG_INDICATOR_FIRMWARE,
820 	DATA_STALL_LOG_INDICATOR_FRAMEWORK,
821 };
822 
823 /**
824  * enum data_stall_log_event_type - data stall event type
825  * @DATA_STALL_LOG_NONE
826  * @DATA_STALL_LOG_FW_VDEV_PAUSE
827  * @DATA_STALL_LOG_HWSCHED_CMD_FILTER
828  * @DATA_STALL_LOG_HWSCHED_CMD_FLUSH
829  * @DATA_STALL_LOG_FW_RX_REFILL_FAILED
830  * @DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR
831  * @DATA_STALL_LOG_FW_WDOG_ERRORS
832  * @DATA_STALL_LOG_BB_WDOG_ERROR
833  * @DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR
834  * @DATA_STALL_LOG_HOST_STA_TX_TIMEOUT
835  * @DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT
836  * @DATA_STALL_LOG_NUD_FAILURE
837  *
838  * Enum indicating data stall event type
839  */
840 enum data_stall_log_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 	/* Stall events triggered by host/framework start from 0x100 onwards. */
851 	DATA_STALL_LOG_HOST_STA_TX_TIMEOUT = 0x100,
852 	DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT,
853 	DATA_STALL_LOG_NUD_FAILURE,
854 };
855 
856 /**
857  * enum data_stall_log_recovery_type - data stall recovery type
858  * @DATA_STALL_LOG_RECOVERY_NONE,
859  * @DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
860  * @DATA_STALL_LOG_RECOVERY_TRIGGER_PDR
861  *
862  * Enum indicating data stall recovery type
863  */
864 enum data_stall_log_recovery_type {
865 	DATA_STALL_LOG_RECOVERY_NONE = 0,
866 	DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
867 	DATA_STALL_LOG_RECOVERY_TRIGGER_PDR,
868 };
869 
870 /**
871  * struct data_stall_event_info - data stall info
872  * @indicator: Module triggering data stall
873  * @data_stall_type: data stall event type
874  * @vdev_id_bitmap: vdev_id_bitmap
875  * @pdev_id: pdev id
876  * @recovery_type: data stall recovery type
877  */
878 struct data_stall_event_info {
879 	uint32_t indicator;
880 	uint32_t data_stall_type;
881 	uint32_t vdev_id_bitmap;
882 	uint32_t pdev_id;
883 	uint32_t recovery_type;
884 };
885 
886 typedef void (*data_stall_detect_cb)(struct data_stall_event_info *);
887 
888 /*
889  * cdp_stats - options for host and firmware
890  * statistics
891 */
892 enum cdp_stats {
893 	CDP_TXRX_STATS_0  = 0,
894 	CDP_TXRX_STATS_1,
895 	CDP_TXRX_STATS_2,
896 	CDP_TXRX_STATS_3,
897 	CDP_TXRX_STATS_4,
898 	CDP_TXRX_STATS_5,
899 	CDP_TXRX_STATS_6,
900 	CDP_TXRX_STATS_7,
901 	CDP_TXRX_STATS_8,
902 	CDP_TXRX_STATS_9,
903 	CDP_TXRX_STATS_10,
904 	CDP_TXRX_STATS_11,
905 	CDP_TXRX_STATS_12,
906 	CDP_TXRX_STATS_13,
907 	CDP_TXRX_STATS_14,
908 	CDP_TXRX_STATS_15,
909 	CDP_TXRX_STATS_16,
910 	CDP_TXRX_STATS_17,
911 	CDP_TXRX_STATS_18,
912 	CDP_TXRX_STATS_19,
913 	CDP_TXRX_STATS_20,
914 	CDP_TXRX_STATS_21,
915 	CDP_TXRX_STATS_22,
916 	CDP_TXRX_STATS_23,
917 	CDP_TXRX_STATS_24,
918 	CDP_TXRX_STATS_25,
919 	CDP_TXRX_STATS_26,
920 	CDP_TXRX_STATS_27,
921 	CDP_TXRX_STATS_28,
922 	CDP_TXRX_STATS_HTT_MAX = 256,
923 	CDP_TXRX_MAX_STATS = 265,
924 };
925 
926 /*
927  * Different Stat update types sent to OL_IF
928  * @UPDATE_PEER_STATS: update peer stats
929  * @UPDATE_VDEV_STATS: update vdev stats
930  * @UPDATE_PDE_STATS: Update pdev stats
931  */
932 enum cdp_stat_update_type {
933 	UPDATE_PEER_STATS = 0,
934 	UPDATE_VDEV_STATS = 1,
935 	UPDATE_PDEV_STATS = 2,
936 };
937 
938 /*
939  * struct cdp_tx_sojourn_stats - Tx sojourn stats
940  * @ppdu_seq_id: ppdu_seq_id from tx completion
941  * @avg_sojourn_msdu: average sojourn msdu time
942  * @sum_sojourn_msdu: sum sojourn msdu time
943  * @num_msdu: number of msdus per ppdu
944  */
945 struct cdp_tx_sojourn_stats {
946 	uint32_t ppdu_seq_id;
947 	qdf_ewma_tx_lag avg_sojourn_msdu[CDP_DATA_TID_MAX];
948 	uint32_t sum_sojourn_msdu[CDP_DATA_TID_MAX];
949 	uint32_t num_msdus[CDP_DATA_TID_MAX];
950 };
951 
952 /**
953  * struct cdp_tx_completion_ppdu_user - Tx PPDU completion per-user information
954  * @completion_status: completion status - OK/Filter/Abort/Timeout
955  * @tid: TID number
956  * @peer_id: Peer ID
957  * @frame_ctrl: frame control field in 802.11 header
958  * @qos_ctrl: QoS control field in 802.11 header
959  * @mpdu_tried: number of mpdus tried
960  * @mpdu_success: number of mpdus successfully transmitted
961  * @long_retries: long retries
962  * @short_retries: short retries
963  * @is_ampdu: mpdu aggregate or non-aggregate?
964  * @success_bytes: bytes successfully transmitted
965  * @retry_bytes: bytes retried
966  * @failed_msdus: MSDUs failed transmission
967  * @duration: user duration in ppdu
968  * @ltf_size: ltf_size
969  * @stbc: stbc
970  * @he_re: he_re (range extension)
971  * @txbf: txbf
972  * @bw: Transmission bandwidth
973  *       <enum 2 transmit_bw_20_MHz>
974  *       <enum 3 transmit_bw_40_MHz>
975  *       <enum 4 transmit_bw_80_MHz>
976  *       <enum 5 transmit_bw_160_MHz>
977  * @nss: NSS 1,2, ...8
978  * @mcs: MCS index
979  * @preamble: preamble
980  * @gi: guard interval 800/400/1600/3200 ns
981  * @dcm: dcm
982  * @ldpc: ldpc
983  * @delayed_ba: delayed ba bit
984  * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
985  * UL_BSR_TRIG/UNKNOWN
986  * @ba_seq_no: Block Ack sequence number
987  * @ba_bitmap: Block Ack bitmap
988  * @start_seqa: Sequence number of first MPDU
989  * @enq_bitmap: Enqueue MPDU bitmap
990  * @is_mcast: MCAST or UCAST
991  * @tx_rate: Transmission Rate
992  */
993 struct cdp_tx_completion_ppdu_user {
994 	uint32_t completion_status:8,
995 		 tid:8,
996 		 peer_id:16;
997 	uint8_t mac_addr[6];
998 	uint32_t frame_ctrl:16,
999 		 qos_ctrl:16;
1000 	uint32_t mpdu_tried_ucast:16,
1001 		mpdu_tried_mcast:16;
1002 	uint16_t mpdu_success:16;
1003 	uint16_t mpdu_failed:16;
1004 	uint32_t long_retries:4,
1005 		 short_retries:4,
1006 		 tx_ratecode:8,
1007 		 is_ampdu:1,
1008 		 ppdu_type:5;
1009 	uint32_t success_bytes;
1010 	uint32_t retry_bytes;
1011 	uint32_t failed_bytes;
1012 	uint32_t success_msdus:16,
1013 		 retry_msdus:16;
1014 	uint32_t failed_msdus:16,
1015 		 duration:16;
1016 	uint32_t ltf_size:2,
1017 		 stbc:1,
1018 		 he_re:1,
1019 		 txbf:4,
1020 		 bw:4,
1021 		 nss:4,
1022 		 mcs:4,
1023 		 preamble:4,
1024 		 gi:4,
1025 		 dcm:1,
1026 		 ldpc:1,
1027 		 delayed_ba:1;
1028 	uint32_t ba_seq_no;
1029 	uint32_t ba_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1030 	uint32_t start_seq;
1031 	uint32_t enq_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1032 	uint32_t failed_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
1033 	uint32_t num_mpdu:9,
1034 		 num_msdu:16;
1035 	uint32_t tx_duration;
1036 	uint16_t ru_tones;
1037 	bool is_mcast;
1038 	uint32_t tx_rate;
1039 	uint32_t tx_ratekbps;
1040 	/*ack rssi for separate chains*/
1041 	uint32_t ack_rssi[CDP_RSSI_CHAIN_LEN];
1042 	bool ack_rssi_valid;
1043 };
1044 
1045 /**
1046  * struct cdp_tx_completion_ppdu - Tx PPDU completion information
1047  * @completion_status: completion status - OK/Filter/Abort/Timeout
1048  * @ppdu_id: PPDU Id
1049  * @ppdu_seq_id: ppdu sequence id for sojourn stats
1050  * @vdev_id: VAP Id
1051  * @num_users: Number of users
1052  * @num_mpdu: Number of MPDUs in PPDU
1053  * @num_msdu: Number of MSDUs in PPDU
1054  * @frame_type: frame SU or MU
1055  * @frame_ctrl: frame control of 80211 header
1056  * @channel: Channel informartion
1057  * @ack_rssi: RSSI value of last ack packet (units=dB above noise floor)
1058  * @tx_duration: PPDU airtime
1059  * @ppdu_start_timestamp: TSF at PPDU start
1060  * @ppdu_end_timestamp: TSF at PPDU end
1061  * @ack_timestamp: TSF at the reception of ACK
1062  * @user: per-User stats (array of per-user structures)
1063  */
1064 struct cdp_tx_completion_ppdu {
1065 	uint32_t ppdu_id;
1066 	uint32_t ppdu_seq_id;
1067 	uint16_t vdev_id;
1068 	uint32_t num_users;
1069 	uint32_t num_mpdu:9,
1070 		 num_msdu:16;
1071 	uint16_t frame_type;
1072 	uint16_t frame_ctrl;
1073 	uint16_t channel;
1074 	uint16_t phy_mode;
1075 	uint32_t ack_rssi;
1076 	uint32_t tx_duration;
1077 	uint32_t ppdu_start_timestamp;
1078 	uint32_t ppdu_end_timestamp;
1079 	uint32_t ack_timestamp;
1080 	struct cdp_tx_completion_ppdu_user user[CDP_MU_MAX_USERS];
1081 };
1082 
1083 /**
1084  * struct cdp_dev_stats - Network device stats structure
1085  * @tx_packets: Tx total packets transmitted
1086  * @tx_bytes  : Tx total bytes transmitted
1087  * @tx_errors : Tx error due to FW tx failure, Ring failure DMA etc
1088  * @tx_dropped: Tx dropped is same as tx errors as above
1089  * @rx_packets: Rx total packets transmitted
1090  * @rx_bytes  : Rx total bytes transmitted
1091  */
1092 struct cdp_dev_stats {
1093 	uint32_t tx_packets;
1094 	uint32_t tx_bytes;
1095 	uint32_t tx_errors;
1096 	uint32_t tx_dropped;
1097 	uint32_t rx_packets;
1098 	uint32_t rx_bytes;
1099 };
1100 
1101 /**
1102  * struct cdp_rate_stats - Tx/Rx Rate statistics
1103  * @bw: Indicates the BW of the upcoming transmission -
1104  *       <enum 2 transmit_bw_20_MHz>
1105  *       <enum 3 transmit_bw_40_MHz>
1106  *       <enum 4 transmit_bw_80_MHz>
1107  *       <enum 5 transmit_bw_160_MHz>
1108  * @pkt_type: Transmit Packet Type
1109  * @stbc: When set, STBC transmission rate was used
1110  * @ldpc: When set, use LDPC transmission rates
1111  * @sgi: <enum 0     0_8_us_sgi > Legacy normal GI
1112  *       <enum 1     0_4_us_sgi > Legacy short GI
1113  *       <enum 2     1_6_us_sgi > HE related GI
1114  *       <enum 3     3_2_us_sgi > HE
1115  * @mcs: Transmit MCS Rate
1116  * @ofdma: Set when the transmission was an OFDMA transmission
1117  * @tones_in_ru: The number of tones in the RU used.
1118  * @tsf: Lower 32 bits of the TSF (timestamp when ppdu transmission finished)
1119  * @peer_id: Peer ID of the flow or MPDU queue
1120  * @tid: TID of the flow or MPDU queue
1121  */
1122 struct cdp_rate_stats {
1123 	uint32_t rate_stats_info_valid:1,
1124 		 bw:2,
1125 		 pkt_type:4,
1126 		 stbc:1,
1127 		 ldpc:1,
1128 		 sgi:2,
1129 		 mcs:4,
1130 		 ofdma:1,
1131 		 tones_in_ru:12,
1132 		 resvd0:4;
1133 	uint32_t tsf;
1134 	uint16_t peer_id;
1135 	uint8_t tid;
1136 };
1137 
1138 /**
1139  * struct cdp_tx_completion_msdu - Tx MSDU completion descriptor
1140  * @ppdu_id: PPDU to which this MSDU belongs
1141  * @transmit_cnt: Number of times this frame has been transmitted
1142  * @ack_frame_rssi: RSSI of the received ACK or BA frame
1143  * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
1144  * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
1145  * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
1146  * @extd: Extended structure containing rate statistics
1147  */
1148 struct cdp_tx_completion_msdu {
1149 	uint32_t ppdu_id;
1150 	uint8_t transmit_cnt;
1151 	uint32_t ack_frame_rssi:8,
1152 		 resvd0:1,
1153 		 first_msdu:1,
1154 		 last_msdu:1,
1155 		 msdu_part_of_amsdu:1,
1156 		 resvd1:20;
1157 	struct cdp_rate_stats extd;
1158 };
1159 
1160 /**
1161  * struct cdp_rx_indication_ppdu - Rx PPDU indication structure
1162  * @ppdu_id: PPDU Id
1163  * @is_ampdu: mpdu aggregate or non-aggregate?
1164  * @num_mpdu: Number of MPDUs in PPDU
1165  * @reserved: Reserved bits for future use
1166  * @num_msdu: Number of MSDUs in PPDU
1167  * @udp_msdu_count: Number of UDP MSDUs in PPDU
1168  * @tcp_msdu_count: Number of TCP MSDUs in PPDU
1169  * @other_msdu_count: Number of MSDUs other than UDP and TCP MSDUs in PPDU
1170  * @duration: PPDU duration
1171  * @tid: TID number
1172  * @peer_id: Peer ID
1173  * @vdev_id: VAP ID
1174  * @mac_addr: Peer MAC Address
1175  * @first_data_seq_ctrl: Sequence control field of first data frame
1176  * @ltf_size: ltf_size
1177  * @stbc: When set, STBC rate was used
1178  * @he_re: he_re (range extension)
1179  * @bw: Bandwidth
1180  *       <enum 0 bw_20_MHz>
1181  *       <enum 1 bw_40_MHz>
1182  *       <enum 2 bw_80_MHz>
1183  *       <enum 3 bw_160_MHz>
1184  * @nss: NSS 1,2, ...8
1185  * @mcs: MCS index
1186  * @preamble: preamble
1187  * @gi: <enum 0     0_8_us_sgi > Legacy normal GI
1188  *       <enum 1     0_4_us_sgi > Legacy short GI
1189  *       <enum 2     1_6_us_sgi > HE related GI
1190  *       <enum 3     3_2_us_sgi > HE
1191  * @dcm: dcm
1192  * @ldpc: ldpc
1193  * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
1194  * UL_BSR_TRIG/UNKNOWN
1195  * @rssi: RSSI value (units = dB above noise floor)
1196  * @timestamp: TSF at the reception of PPDU
1197  * @length: PPDU length
1198  * @channel: Channel informartion
1199  * @lsig_A: L-SIG in 802.11 PHY header
1200  */
1201 struct cdp_rx_indication_ppdu {
1202 	uint32_t ppdu_id;
1203 	uint16_t is_ampdu:1,
1204 		 num_mpdu:9,
1205 		 reserved:6;
1206 	uint32_t num_msdu;
1207 	uint16_t udp_msdu_count;
1208 	uint16_t tcp_msdu_count;
1209 	uint16_t other_msdu_count;
1210 	uint16_t duration;
1211 	uint32_t tid:8,
1212 		 peer_id:16;
1213 	uint8_t vdev_id;
1214 	uint8_t mac_addr[6];
1215 	uint16_t first_data_seq_ctrl;
1216 	union {
1217 		uint32_t rate_info;
1218 		struct {
1219 			uint32_t ltf_size:2,
1220 				 stbc:1,
1221 				 he_re:1,
1222 				 bw:4,
1223 				 nss:4,
1224 				 mcs:4,
1225 				 preamble:4,
1226 				 gi:4,
1227 				 dcm:1,
1228 				 ldpc:1,
1229 				 ppdu_type:2;
1230 		};
1231 	} u;
1232 	uint32_t lsig_a;
1233 	uint32_t rssi;
1234 	uint64_t timestamp;
1235 	uint32_t length;
1236 	uint8_t channel;
1237 	uint8_t beamformed;
1238 
1239 	uint32_t rx_ratekbps;
1240 	uint32_t ppdu_rx_rate;
1241 
1242 	uint32_t retries;
1243 	uint32_t rx_byte_count;
1244 	uint8_t rx_ratecode;
1245 	uint8_t fcs_error_mpdus;
1246 
1247 };
1248 
1249 /**
1250  * struct cdp_rx_indication_msdu - Rx MSDU info
1251  * @ppdu_id: PPDU to which the MSDU belongs
1252  * @msdu_len: Length of MSDU in bytes
1253  * @ack_frame_rssi: RSSI of the received ACK or BA frame
1254  * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
1255  * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
1256  * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
1257  * @extd: Extended structure containing rate statistics
1258  */
1259 struct cdp_rx_indication_msdu {
1260 	uint32_t ppdu_id;
1261 	uint16_t msdu_len;
1262 	uint32_t ack_frame_rssi:8,
1263 		 resvd0:1,
1264 		 first_msdu:1,
1265 		 last_msdu:1,
1266 		 msdu_part_of_amsdu:1,
1267 		 msdu_part_of_ampdu:1,
1268 		 resvd1:19;
1269 	struct cdp_rate_stats extd;
1270 };
1271 
1272 /**
1273  * struct cdp_config_params - Propagate configuration parameters to datapath
1274  * @tso_enable: Enable/Disable TSO
1275  * @lro_enable: Enable/Disable LRO
1276  * @flow_steering_enable: Enable/Disable Rx Hash
1277  * @tcp_Udp_ChecksumOffload: Enable/Disable tcp-Udp checksum Offload
1278  * @napi_enable: Enable/Disable Napi
1279  * @tx_flow_stop_queue_threshold: Value to Pause tx queues
1280  * @tx_flow_start_queue_offset: Available Tx descriptors to unpause
1281  *				tx queue
1282  */
1283 struct cdp_config_params {
1284 	unsigned int tso_enable:1;
1285 	unsigned int lro_enable:1;
1286 	unsigned int flow_steering_enable:1;
1287 	unsigned int tcp_udp_checksumoffload:1;
1288 	unsigned int napi_enable:1;
1289 	/* Set when QCA_LL_TX_FLOW_CONTROL_V2 is enabled */
1290 	uint8_t tx_flow_stop_queue_threshold;
1291 	uint8_t tx_flow_start_queue_offset;
1292 };
1293 
1294 /**
1295  * cdp_txrx_stats_req: stats request wrapper
1296  *	used to pass request information to cdp layer
1297  * @stats: type of stats requested
1298  * @param0: opaque argument 0 to be passed to htt
1299  * @param1: opaque argument 1 to be passed to htt
1300  * @param2: opaque argument 2 to be passed to htt
1301  * @param3: opaque argument 3 to be passed to htt
1302  * @mac id: mac_id
1303  */
1304 struct cdp_txrx_stats_req {
1305 	enum cdp_stats	stats;
1306 	uint32_t	param0;
1307 	uint32_t	param1;
1308 	uint32_t	param2;
1309 	uint32_t	param3;
1310 	uint32_t	cookie_val;
1311 	uint8_t		mac_id;
1312 	char *peer_addr;
1313 };
1314 
1315 /**
1316  * struct cdp_monitor_filter - monitor filter info
1317  * @mode: set filter mode
1318  * @fp_mgmt: set Filter Pass MGMT Configuration
1319  * @fp_ctrl: set Filter Pass CTRL Configuration
1320  * @fp_data: set Filter Pass DATA Configuration
1321  * @mo_mgmt: set Monitor Other MGMT Configuration
1322  * @mo_ctrl: set Monitor Other CTRL Configuration
1323  * @mo_data: set Monitor other DATA Configuration
1324  *
1325  */
1326 struct cdp_monitor_filter {
1327 	uint16_t mode;
1328 	uint16_t fp_mgmt;
1329 	uint16_t fp_ctrl;
1330 	uint16_t fp_data;
1331 	uint16_t mo_mgmt;
1332 	uint16_t mo_ctrl;
1333 	uint16_t mo_data;
1334 };
1335 #endif
1336