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