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