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