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