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