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