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