1 /* 2 * Copyright (c) 2016-2017 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: physical device instance 31 * @queue_delay_microsec: tx packet delay within queue, usec 32 * @tx_delay_microsec: tx packet delay, usec 33 * @category: packet catagory 34 * 35 * Return: NONE 36 */ 37 static inline void 38 cdp_tx_delay(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, 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(pdev, 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: physical device instance 58 * @bin_values: bin 59 * @category: packet catagory 60 * 61 * Return: NONE 62 */ 63 static inline void 64 cdp_tx_delay_hist(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, 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(pdev, 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: physical device instance 83 * @out_packet_loss_count: packet loss count 84 * @category: packet catagory 85 * 86 * Return: NONE 87 */ 88 static inline void 89 cdp_tx_packet_count(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, 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(pdev, 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: physical device instance 109 * @interval: compute interval 110 * 111 * Return: NONE 112 */ 113 static inline void 114 cdp_tx_set_compute_interval(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, 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(pdev, 125 interval); 126 return; 127 } 128 #endif /* _CDP_TXRX_COMPUTE_TX_DELAY_H_ */ 129