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