xref: /wlan-driver/qca-wifi-host-cmn/dp/inc/cdp_txrx_tx_delay.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name /**
21*5113495bSYour Name  * DOC: cdp_txrx_tx_delay.h
22*5113495bSYour Name  * Define the host data path histogram API functions
23*5113495bSYour Name  * called by the host control SW and the OS interface module
24*5113495bSYour Name  */
25*5113495bSYour Name #ifndef _CDP_TXRX_COMPUTE_TX_DELAY_H_
26*5113495bSYour Name #define _CDP_TXRX_COMPUTE_TX_DELAY_H_
27*5113495bSYour Name #include "cdp_txrx_handle.h"
28*5113495bSYour Name /**
29*5113495bSYour Name  * cdp_tx_delay() - get tx packet delay
30*5113495bSYour Name  * @soc: data path soc handle
31*5113495bSYour Name  * @pdev_id: id of data path pdev handle
32*5113495bSYour Name  * @queue_delay_microsec: tx packet delay within queue, usec
33*5113495bSYour Name  * @tx_delay_microsec: tx packet delay, usec
34*5113495bSYour Name  * @category: packet category
35*5113495bSYour Name  *
36*5113495bSYour Name  * Return: NONE
37*5113495bSYour Name  */
38*5113495bSYour Name static inline void
cdp_tx_delay(ol_txrx_soc_handle soc,uint8_t pdev_id,uint32_t * queue_delay_microsec,uint32_t * tx_delay_microsec,int category)39*5113495bSYour Name cdp_tx_delay(ol_txrx_soc_handle soc, uint8_t pdev_id,
40*5113495bSYour Name 	     uint32_t *queue_delay_microsec, uint32_t *tx_delay_microsec,
41*5113495bSYour Name 	     int category)
42*5113495bSYour Name {
43*5113495bSYour Name 	if (!soc || !soc->ops || !soc->ops->delay_ops) {
44*5113495bSYour Name 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
45*5113495bSYour Name 			"%s invalid instance", __func__);
46*5113495bSYour Name 		return;
47*5113495bSYour Name 	}
48*5113495bSYour Name 
49*5113495bSYour Name 	if (soc->ops->delay_ops->tx_delay)
50*5113495bSYour Name 		return soc->ops->delay_ops->tx_delay(soc, pdev_id,
51*5113495bSYour Name 			queue_delay_microsec, tx_delay_microsec, category);
52*5113495bSYour Name 	return;
53*5113495bSYour Name }
54*5113495bSYour Name 
55*5113495bSYour Name /**
56*5113495bSYour Name  * cdp_tx_delay_hist() - get tx packet delay histogram
57*5113495bSYour Name  * @soc: data path soc handle
58*5113495bSYour Name  * @pdev_id: id of data path pdev handle
59*5113495bSYour Name  * @bin_values: bin
60*5113495bSYour Name  * @category: packet category
61*5113495bSYour Name  *
62*5113495bSYour Name  * Return: NONE
63*5113495bSYour Name  */
64*5113495bSYour Name static inline void
cdp_tx_delay_hist(ol_txrx_soc_handle soc,uint8_t pdev_id,uint16_t * bin_values,int category)65*5113495bSYour Name cdp_tx_delay_hist(ol_txrx_soc_handle soc, uint8_t pdev_id,
66*5113495bSYour Name 		  uint16_t *bin_values, int category)
67*5113495bSYour Name {
68*5113495bSYour Name 	if (!soc || !soc->ops || !soc->ops->delay_ops) {
69*5113495bSYour Name 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
70*5113495bSYour Name 			"%s invalid instance", __func__);
71*5113495bSYour Name 		return;
72*5113495bSYour Name 	}
73*5113495bSYour Name 
74*5113495bSYour Name 	if (soc->ops->delay_ops->tx_delay_hist)
75*5113495bSYour Name 		return soc->ops->delay_ops->tx_delay_hist(soc, pdev_id,
76*5113495bSYour Name 			bin_values, category);
77*5113495bSYour Name 	return;
78*5113495bSYour Name }
79*5113495bSYour Name 
80*5113495bSYour Name /**
81*5113495bSYour Name  * cdp_tx_packet_count() - get tx packet count
82*5113495bSYour Name  * @soc: data path soc handle
83*5113495bSYour Name  * @pdev_id: id of data path pdev handle
84*5113495bSYour Name  * @out_packet_count: packet count
85*5113495bSYour Name  * @out_packet_loss_count: packet loss count
86*5113495bSYour Name  * @category: packet category
87*5113495bSYour Name  *
88*5113495bSYour Name  * Return: NONE
89*5113495bSYour Name  */
90*5113495bSYour Name static inline void
cdp_tx_packet_count(ol_txrx_soc_handle soc,uint8_t pdev_id,uint16_t * out_packet_count,uint16_t * out_packet_loss_count,int category)91*5113495bSYour Name cdp_tx_packet_count(ol_txrx_soc_handle soc, uint8_t pdev_id,
92*5113495bSYour Name 		    uint16_t *out_packet_count, uint16_t *out_packet_loss_count,
93*5113495bSYour Name 		    int category)
94*5113495bSYour Name {
95*5113495bSYour Name 	if (!soc || !soc->ops || !soc->ops->delay_ops) {
96*5113495bSYour Name 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
97*5113495bSYour Name 			"%s invalid instance", __func__);
98*5113495bSYour Name 		return;
99*5113495bSYour Name 	}
100*5113495bSYour Name 
101*5113495bSYour Name 	if (soc->ops->delay_ops->tx_packet_count)
102*5113495bSYour Name 		return soc->ops->delay_ops->tx_packet_count(soc, pdev_id,
103*5113495bSYour Name 			out_packet_count, out_packet_loss_count, category);
104*5113495bSYour Name 	return;
105*5113495bSYour Name }
106*5113495bSYour Name 
107*5113495bSYour Name /**
108*5113495bSYour Name  * cdp_tx_set_compute_interval() - set tx packet stat compute interval
109*5113495bSYour Name  * @soc: data path soc handle
110*5113495bSYour Name  * @pdev_id: id of data path pdev handle
111*5113495bSYour Name  * @interval: compute interval
112*5113495bSYour Name  *
113*5113495bSYour Name  * Return: NONE
114*5113495bSYour Name  */
115*5113495bSYour Name static inline void
cdp_tx_set_compute_interval(ol_txrx_soc_handle soc,uint8_t pdev_id,uint32_t interval)116*5113495bSYour Name cdp_tx_set_compute_interval(ol_txrx_soc_handle soc, uint8_t pdev_id,
117*5113495bSYour Name 			    uint32_t interval)
118*5113495bSYour Name {
119*5113495bSYour Name 	if (!soc || !soc->ops || !soc->ops->delay_ops) {
120*5113495bSYour Name 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
121*5113495bSYour Name 			"%s invalid instance", __func__);
122*5113495bSYour Name 		return;
123*5113495bSYour Name 	}
124*5113495bSYour Name 
125*5113495bSYour Name 	if (soc->ops->delay_ops->tx_set_compute_interval)
126*5113495bSYour Name 		return soc->ops->delay_ops->tx_set_compute_interval(soc,
127*5113495bSYour Name 								    pdev_id,
128*5113495bSYour Name 								    interval);
129*5113495bSYour Name 	return;
130*5113495bSYour Name }
131*5113495bSYour Name #endif /* _CDP_TXRX_COMPUTE_TX_DELAY_H_ */
132