Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 1 | /* |
Amir Patel | 1ea85d4 | 2019-01-09 15:19:10 +0530 | [diff] [blame] | 2 | * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 3 | * |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 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 | |
Yun Park | 7b64874 | 2017-04-02 14:17:59 -0700 | [diff] [blame] | 19 | /** |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 20 | * @file cdp_txrx_host_stats.h |
| 21 | * @brief Define the host data path stats API functions |
| 22 | * called by the host control SW and the OS interface module |
| 23 | */ |
| 24 | #ifndef _CDP_TXRX_HOST_STATS_H_ |
| 25 | #define _CDP_TXRX_HOST_STATS_H_ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 26 | #include "cdp_txrx_handle.h" |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 27 | #include <wmi_unified_api.h> |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame] | 28 | /** |
| 29 | * cdp_host_stats_get: cdp call to get host stats |
| 30 | * @soc: SOC handle |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 31 | * @vdev_id: vdev id of vdev |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame] | 32 | * @req: Requirement type |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame] | 33 | * |
| 34 | * return: 0 for Success, Failure returns error message |
| 35 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 36 | static inline int cdp_host_stats_get(ol_txrx_soc_handle soc, |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 37 | uint8_t vdev_id, |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 38 | struct ol_txrx_stats_req *req) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 39 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 40 | if (!soc || !soc->ops) { |
| 41 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 42 | "%s: Invalid Instance", __func__); |
| 43 | QDF_BUG(0); |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | if (!soc->ops->host_stats_ops || |
| 48 | !soc->ops->host_stats_ops->txrx_host_stats_get) |
| 49 | return 0; |
| 50 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 51 | return soc->ops->host_stats_ops->txrx_host_stats_get(soc, vdev_id, req); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 52 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 53 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 54 | /** |
Surya Prakash Raajen | 3a01bdd | 2019-02-19 13:19:36 +0530 | [diff] [blame] | 55 | * cdp_host_stats_get_ratekbps: cdp call to get rate in kbps |
| 56 | * @soc: SOC handle |
| 57 | * @preamb: Preamble |
| 58 | * @mcs: Modulation and Coding scheme index |
| 59 | * @htflag: Flag to identify HT or VHT |
| 60 | * @gintval: Gaurd Interval value |
| 61 | * |
| 62 | * return: 0 for Failure, Returns rate on Success |
| 63 | */ |
| 64 | static inline int cdp_host_stats_get_ratekbps(ol_txrx_soc_handle soc, |
| 65 | int preamb, int mcs, |
| 66 | int htflag, int gintval) |
| 67 | { |
| 68 | if (!soc || !soc->ops) { |
| 69 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 70 | "%s: Invalid Instance", __func__); |
| 71 | QDF_BUG(0); |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | if (!soc->ops->host_stats_ops || |
| 76 | !soc->ops->host_stats_ops->txrx_get_ratekbps) |
| 77 | return 0; |
| 78 | |
| 79 | return soc->ops->host_stats_ops->txrx_get_ratekbps(preamb, |
| 80 | mcs, htflag, |
| 81 | gintval); |
| 82 | } |
| 83 | |
| 84 | /** |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 85 | * cdp_host_stats_clr: cdp call to clear host stats |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 86 | * @soc: soc handle |
| 87 | * @vdev_id: vdev handle id |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 88 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 89 | * return: QDF_STATUS |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 90 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 91 | static inline QDF_STATUS |
| 92 | cdp_host_stats_clr(ol_txrx_soc_handle soc, uint8_t vdev_id) |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 93 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 94 | if (!soc || !soc->ops) { |
| 95 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 96 | "%s: Invalid Instance", __func__); |
| 97 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 98 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | if (!soc->ops->host_stats_ops || |
| 102 | !soc->ops->host_stats_ops->txrx_host_stats_clr) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 103 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 104 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 105 | return soc->ops->host_stats_ops->txrx_host_stats_clr(soc, vdev_id); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 106 | } |
| 107 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 108 | static inline QDF_STATUS |
| 109 | cdp_host_ce_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 110 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 111 | if (!soc || !soc->ops) { |
| 112 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 113 | "%s: Invalid Instance", __func__); |
| 114 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 115 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | if (!soc->ops->host_stats_ops || |
| 119 | !soc->ops->host_stats_ops->txrx_host_ce_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 120 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 121 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 122 | return soc->ops->host_stats_ops->txrx_host_ce_stats(soc, vdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 123 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 124 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 125 | static inline int cdp_stats_publish |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 126 | (ol_txrx_soc_handle soc, uint8_t pdev_id, |
Pranita Solanke | 71371bc | 2018-11-26 16:57:22 +0530 | [diff] [blame] | 127 | struct cdp_stats_extd *buf) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 128 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 129 | if (!soc || !soc->ops) { |
| 130 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 131 | "%s: Invalid Instance", __func__); |
| 132 | QDF_BUG(0); |
| 133 | return 0; |
| 134 | } |
| 135 | |
| 136 | if (!soc->ops->host_stats_ops || |
| 137 | !soc->ops->host_stats_ops->txrx_stats_publish) |
| 138 | return 0; |
| 139 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 140 | return soc->ops->host_stats_ops->txrx_stats_publish(soc, pdev_id, buf); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 141 | } |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 142 | |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 143 | /** |
| 144 | * @brief Enable enhanced stats functionality. |
| 145 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 146 | * @param soc - the soc object |
| 147 | * @param pdev_id - id of the physical device object |
| 148 | * @return - QDF_STATUS |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 149 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 150 | static inline QDF_STATUS |
| 151 | cdp_enable_enhanced_stats(ol_txrx_soc_handle soc, uint8_t pdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 152 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 153 | if (!soc || !soc->ops) { |
| 154 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 155 | "%s: Invalid Instance", __func__); |
| 156 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 157 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | if (!soc->ops->host_stats_ops || |
| 161 | !soc->ops->host_stats_ops->txrx_enable_enhanced_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 162 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 163 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 164 | return soc->ops->host_stats_ops->txrx_enable_enhanced_stats |
| 165 | (soc, pdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 166 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 167 | |
| 168 | /** |
| 169 | * @brief Disable enhanced stats functionality. |
| 170 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 171 | * @param soc - the soc object |
| 172 | * @param pdev_id - id of the physical device object |
| 173 | * @return - QDF_STATUS |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 174 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 175 | static inline QDF_STATUS |
| 176 | cdp_disable_enhanced_stats(ol_txrx_soc_handle soc, uint8_t pdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 177 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 178 | if (!soc || !soc->ops) { |
| 179 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 180 | "%s: Invalid Instance", __func__); |
| 181 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 182 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | if (!soc->ops->host_stats_ops || |
| 186 | !soc->ops->host_stats_ops->txrx_disable_enhanced_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 187 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 188 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 189 | return soc->ops->host_stats_ops->txrx_disable_enhanced_stats |
| 190 | (soc, pdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 191 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 192 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 193 | static inline QDF_STATUS |
| 194 | cdp_tx_print_tso_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 195 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 196 | if (!soc || !soc->ops) { |
| 197 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 198 | "%s: Invalid Instance", __func__); |
| 199 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 200 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | if (!soc->ops->host_stats_ops || |
| 204 | !soc->ops->host_stats_ops->tx_print_tso_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 205 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 206 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 207 | return soc->ops->host_stats_ops->tx_print_tso_stats(soc, vdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 208 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 209 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 210 | static inline QDF_STATUS |
| 211 | cdp_tx_rst_tso_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 212 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 213 | if (!soc || !soc->ops) { |
| 214 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 215 | "%s: Invalid Instance", __func__); |
| 216 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 217 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | if (!soc->ops->host_stats_ops || |
| 221 | !soc->ops->host_stats_ops->tx_rst_tso_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 222 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 223 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 224 | return soc->ops->host_stats_ops->tx_rst_tso_stats(soc, vdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 225 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 226 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 227 | static inline QDF_STATUS |
| 228 | cdp_tx_print_sg_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 229 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 230 | if (!soc || !soc->ops) { |
| 231 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 232 | "%s: Invalid Instance", __func__); |
| 233 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 234 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | if (!soc->ops->host_stats_ops || |
| 238 | !soc->ops->host_stats_ops->tx_print_sg_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 239 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 240 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 241 | return soc->ops->host_stats_ops->tx_print_sg_stats(soc, vdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 242 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 243 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 244 | static inline QDF_STATUS |
| 245 | cdp_tx_rst_sg_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 246 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 247 | if (!soc || !soc->ops) { |
| 248 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 249 | "%s: Invalid Instance", __func__); |
| 250 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 251 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | if (!soc->ops->host_stats_ops || |
| 255 | !soc->ops->host_stats_ops->tx_rst_sg_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 256 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 257 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 258 | return soc->ops->host_stats_ops->tx_rst_sg_stats(soc, vdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 259 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 260 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 261 | static inline QDF_STATUS |
| 262 | cdp_print_rx_cksum_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 263 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 264 | if (!soc || !soc->ops) { |
| 265 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 266 | "%s: Invalid Instance", __func__); |
| 267 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 268 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | if (!soc->ops->host_stats_ops || |
| 272 | !soc->ops->host_stats_ops->print_rx_cksum_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 273 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 274 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 275 | return soc->ops->host_stats_ops->print_rx_cksum_stats(soc, vdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 276 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 277 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 278 | static inline QDF_STATUS |
| 279 | cdp_rst_rx_cksum_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 280 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 281 | if (!soc || !soc->ops) { |
| 282 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 283 | "%s: Invalid Instance", __func__); |
| 284 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 285 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | if (!soc->ops->host_stats_ops || |
| 289 | !soc->ops->host_stats_ops->rst_rx_cksum_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 290 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 291 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 292 | return soc->ops->host_stats_ops->rst_rx_cksum_stats(soc, vdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 293 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 294 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 295 | static inline QDF_STATUS |
| 296 | cdp_host_me_stats(ol_txrx_soc_handle soc, uint8_t vdev_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 297 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 298 | if (!soc || !soc->ops) { |
| 299 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 300 | "%s: Invalid Instance", __func__); |
| 301 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 302 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | if (!soc->ops->host_stats_ops || |
| 306 | !soc->ops->host_stats_ops->txrx_host_me_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 307 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 308 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 309 | return soc->ops->host_stats_ops->txrx_host_me_stats(soc, vdev_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 310 | } |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 311 | |
Venkata Sharath Chandra Manchala | 0cb3198 | 2018-03-30 15:55:26 -0700 | [diff] [blame] | 312 | /** |
| 313 | * cdp_per_peer_stats(): function to print per peer REO Queue stats |
| 314 | * @soc: soc handle |
| 315 | * @pdev: physical device |
| 316 | * @addr: peer address |
| 317 | * |
| 318 | * return: status |
| 319 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 320 | static inline QDF_STATUS cdp_per_peer_stats(ol_txrx_soc_handle soc, |
| 321 | uint8_t *addr) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 322 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 323 | if (!soc || !soc->ops) { |
| 324 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
Venkata Sharath Chandra Manchala | 0cb3198 | 2018-03-30 15:55:26 -0700 | [diff] [blame] | 325 | "%s: Invalid Instance", __func__); |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 326 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 327 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | if (!soc->ops->host_stats_ops || |
| 331 | !soc->ops->host_stats_ops->txrx_per_peer_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 332 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 333 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 334 | return soc->ops->host_stats_ops->txrx_per_peer_stats(soc, addr); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 335 | } |
| 336 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 337 | static inline int cdp_host_msdu_ttl_stats(ol_txrx_soc_handle soc, |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 338 | uint8_t vdev_id, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 339 | struct ol_txrx_stats_req *req) |
| 340 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 341 | if (!soc || !soc->ops) { |
| 342 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 343 | "%s: Invalid Instance", __func__); |
| 344 | QDF_BUG(0); |
| 345 | return 0; |
| 346 | } |
| 347 | |
| 348 | if (!soc->ops->host_stats_ops || |
| 349 | !soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats) |
| 350 | return 0; |
| 351 | |
| 352 | return soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 353 | (soc, vdev_id, req); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 354 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 355 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 356 | static inline QDF_STATUS cdp_update_peer_stats(ol_txrx_soc_handle soc, |
| 357 | uint8_t vdev_id, uint8_t *mac, |
| 358 | void *stats, |
| 359 | uint32_t last_tx_rate_mcs, |
| 360 | uint32_t stats_id) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 361 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 362 | if (!soc || !soc->ops) { |
| 363 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 364 | "%s: Invalid Instance", __func__); |
| 365 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 366 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 367 | } |
| 368 | |
| 369 | if (!soc->ops->host_stats_ops || |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 370 | !soc->ops->host_stats_ops->txrx_update_peer_stats) |
| 371 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 372 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 373 | return soc->ops->host_stats_ops->txrx_update_peer_stats |
| 374 | (soc, vdev_id, mac, stats, last_tx_rate_mcs, stats_id); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 375 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 376 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 377 | static inline QDF_STATUS cdp_get_dp_fw_peer_stats(ol_txrx_soc_handle soc, |
| 378 | uint8_t pdev_id, |
| 379 | uint8_t *mac, uint32_t caps, |
| 380 | uint32_t copy_stats) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 381 | { |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 382 | if (!soc || !soc->ops) { |
| 383 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 384 | "%s: Invalid Instance", __func__); |
| 385 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 386 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | if (!soc->ops->host_stats_ops || |
| 390 | !soc->ops->host_stats_ops->get_fw_peer_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 391 | return QDF_STATUS_E_FAILURE; |
Venkata Sharath Chandra Manchala | c4a6b84 | 2017-10-25 12:18:08 -0700 | [diff] [blame] | 392 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 393 | return soc->ops->host_stats_ops->get_fw_peer_stats |
| 394 | (soc, pdev_id, mac, caps, copy_stats); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 395 | } |
| 396 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 397 | static inline QDF_STATUS cdp_get_dp_htt_stats(ol_txrx_soc_handle soc, |
| 398 | uint8_t pdev_id, |
| 399 | void *data, uint32_t data_len) |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 400 | { |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 401 | if (!soc || !soc->ops) { |
| 402 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 403 | "%s: Invalid Instance", __func__); |
| 404 | QDF_BUG(0); |
| 405 | return QDF_STATUS_E_FAILURE; |
| 406 | } |
| 407 | |
| 408 | if (!soc->ops->host_stats_ops || |
| 409 | !soc->ops->host_stats_ops->get_htt_stats) |
| 410 | return QDF_STATUS_E_FAILURE; |
| 411 | |
| 412 | return soc->ops->host_stats_ops->get_htt_stats(soc, pdev_id, data, |
| 413 | data_len); |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 414 | } |
| 415 | |
Nandha Kishore Easwaran | 4b8148b | 2016-09-02 11:47:00 +0530 | [diff] [blame] | 416 | /** |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 417 | * @brief Update pdev host stats received from firmware |
| 418 | * (wmi_host_pdev_stats and wmi_host_pdev_ext_stats) into dp |
| 419 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 420 | * @param soc - soc handle |
| 421 | * @param pdev_id - id of the physical device object |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 422 | * @param data - pdev stats |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 423 | * @return - QDF_STATUS |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 424 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 425 | static inline QDF_STATUS |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 426 | cdp_update_pdev_host_stats(ol_txrx_soc_handle soc, |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 427 | uint8_t pdev_id, |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 428 | void *data, |
| 429 | uint16_t stats_id) |
| 430 | { |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 431 | if (!soc || !soc->ops) { |
| 432 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 433 | "%s: Invalid Instance", __func__); |
| 434 | QDF_BUG(0); |
| 435 | return QDF_STATUS_E_FAILURE; |
| 436 | } |
| 437 | |
| 438 | if (!soc->ops->host_stats_ops || |
| 439 | !soc->ops->host_stats_ops->txrx_update_pdev_stats) |
| 440 | return QDF_STATUS_E_FAILURE; |
| 441 | |
| 442 | return soc->ops->host_stats_ops->txrx_update_pdev_stats(soc, pdev_id, |
| 443 | data, |
| 444 | stats_id); |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 445 | } |
| 446 | |
| 447 | /** |
Aditya Sathish | 8482a0c | 2019-05-09 11:03:42 +0530 | [diff] [blame] | 448 | * @brief Update vdev host stats |
| 449 | * |
| 450 | * @param soc - soc handle |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 451 | * @param vdev_id - id of the virtual device object |
Aditya Sathish | 8482a0c | 2019-05-09 11:03:42 +0530 | [diff] [blame] | 452 | * @param data - pdev stats |
| 453 | * @param stats_id - type of stats |
| 454 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 455 | * @return - QDF_STATUS |
Aditya Sathish | 8482a0c | 2019-05-09 11:03:42 +0530 | [diff] [blame] | 456 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 457 | static inline QDF_STATUS |
Aditya Sathish | 8482a0c | 2019-05-09 11:03:42 +0530 | [diff] [blame] | 458 | cdp_update_vdev_host_stats(ol_txrx_soc_handle soc, |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 459 | uint8_t vdev_id, |
Aditya Sathish | 8482a0c | 2019-05-09 11:03:42 +0530 | [diff] [blame] | 460 | void *data, |
| 461 | uint16_t stats_id) |
| 462 | { |
| 463 | if (!soc || !soc->ops) { |
| 464 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 465 | "%s: Invalid Instance", __func__); |
| 466 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 467 | return QDF_STATUS_E_FAILURE; |
Aditya Sathish | 8482a0c | 2019-05-09 11:03:42 +0530 | [diff] [blame] | 468 | } |
| 469 | |
| 470 | if (!soc->ops->host_stats_ops || |
| 471 | !soc->ops->host_stats_ops->txrx_update_vdev_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 472 | return QDF_STATUS_E_FAILURE; |
Aditya Sathish | 8482a0c | 2019-05-09 11:03:42 +0530 | [diff] [blame] | 473 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 474 | return soc->ops->host_stats_ops->txrx_update_vdev_stats(soc, vdev_id, |
| 475 | data, |
Aditya Sathish | 8482a0c | 2019-05-09 11:03:42 +0530 | [diff] [blame] | 476 | stats_id); |
| 477 | } |
| 478 | |
| 479 | /** |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 480 | * @brief Call to get peer stats |
| 481 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 482 | * @param soc - soc handle |
| 483 | * @param vdev_id - vdev_id of vdev object |
| 484 | * @param peer_mac - mac address of the peer |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 485 | * @return - struct cdp_peer_stats |
| 486 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 487 | static inline QDF_STATUS |
| 488 | cdp_host_get_peer_stats(ol_txrx_soc_handle soc, uint8_t vdev_id, |
| 489 | uint8_t *peer_mac, |
| 490 | struct cdp_peer_stats *peer_stats) |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 491 | { |
| 492 | if (!soc || !soc->ops) { |
| 493 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 494 | "%s: Invalid Instance", __func__); |
| 495 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 496 | return QDF_STATUS_E_FAILURE; |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 497 | } |
| 498 | |
| 499 | if (!soc->ops->host_stats_ops || |
| 500 | !soc->ops->host_stats_ops->txrx_get_peer_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 501 | return QDF_STATUS_E_FAILURE; |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 502 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 503 | return soc->ops->host_stats_ops->txrx_get_peer_stats(soc, vdev_id, |
| 504 | peer_mac, |
| 505 | peer_stats); |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | /** |
| 509 | * @brief Call to reset ald stats |
| 510 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 511 | * @param soc - soc handle |
| 512 | * @param vdev_id - vdev_id of vdev object |
| 513 | * @param peer_mac - mac address of the peer |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 514 | * @return - void |
| 515 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 516 | static inline QDF_STATUS |
| 517 | cdp_host_reset_peer_ald_stats(ol_txrx_soc_handle soc, uint8_t vdev_id, |
| 518 | uint8_t *peer_mac) |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 519 | { |
| 520 | if (!soc || !soc->ops) { |
| 521 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 522 | "%s: Invalid Instance", __func__); |
| 523 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 524 | return QDF_STATUS_E_FAILURE; |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 525 | } |
| 526 | |
| 527 | if (!soc->ops->host_stats_ops || |
| 528 | !soc->ops->host_stats_ops->txrx_reset_peer_ald_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 529 | return QDF_STATUS_E_FAILURE; |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 530 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 531 | return soc->ops->host_stats_ops->txrx_reset_peer_ald_stats(soc, |
| 532 | vdev_id, |
| 533 | peer_mac); |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 534 | } |
| 535 | |
| 536 | /** |
| 537 | * @brief Call to reset peer stats |
| 538 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 539 | * @param soc - soc handle |
| 540 | * @param vdev_id - vdev_id of vdev object |
| 541 | * @param peer_mac - mac address of the peer |
| 542 | * @return - QDF_STATUS |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 543 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 544 | static inline QDF_STATUS |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 545 | cdp_host_reset_peer_stats(ol_txrx_soc_handle soc, |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 546 | uint8_t vdev_id, uint8_t *peer_mac) |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 547 | { |
| 548 | if (!soc || !soc->ops) { |
| 549 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 550 | "%s: Invalid Instance", __func__); |
| 551 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 552 | return QDF_STATUS_E_FAILURE; |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 553 | } |
| 554 | |
| 555 | if (!soc->ops->host_stats_ops || |
| 556 | !soc->ops->host_stats_ops->txrx_reset_peer_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 557 | return QDF_STATUS_E_FAILURE; |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 558 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 559 | return soc->ops->host_stats_ops->txrx_reset_peer_stats(soc, |
| 560 | vdev_id, |
| 561 | peer_mac); |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 562 | } |
| 563 | |
| 564 | /** |
| 565 | * @brief Call to get vdev stats |
| 566 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 567 | * @param soc - dp soc object |
| 568 | * @param vdev_id - id of dp vdev object |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 569 | * @param buf - buffer |
| 570 | * @return - int |
| 571 | */ |
| 572 | static inline int |
| 573 | cdp_host_get_vdev_stats(ol_txrx_soc_handle soc, |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 574 | uint8_t vdev_id, |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 575 | struct cdp_vdev_stats *buf, |
| 576 | bool is_aggregate) |
| 577 | { |
| 578 | if (!soc || !soc->ops) { |
| 579 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 580 | "%s: Invalid Instance", __func__); |
| 581 | QDF_BUG(0); |
| 582 | return 0; |
| 583 | } |
| 584 | |
| 585 | if (!soc->ops->host_stats_ops || |
| 586 | !soc->ops->host_stats_ops->txrx_get_vdev_stats) |
| 587 | return 0; |
| 588 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 589 | return soc->ops->host_stats_ops->txrx_get_vdev_stats(soc, vdev_id, |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 590 | buf, |
| 591 | is_aggregate); |
| 592 | } |
| 593 | |
| 594 | /** |
| 595 | * @brief Call to update vdev stats received from firmware |
| 596 | * (wmi_host_vdev_stats and wmi_host_vdev_extd_stats) into dp |
| 597 | * |
| 598 | * @param data - stats data to be updated |
| 599 | * @param size - size of stats data |
| 600 | * @param stats_id - stats id |
| 601 | * @return - int |
| 602 | */ |
| 603 | static inline int |
| 604 | cdp_update_host_vdev_stats(ol_txrx_soc_handle soc, |
| 605 | void *data, |
| 606 | uint32_t size, |
| 607 | uint32_t stats_id) |
| 608 | { |
| 609 | if (!soc || !soc->ops) { |
| 610 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 611 | "%s: Invalid Instance", __func__); |
| 612 | QDF_BUG(0); |
| 613 | return 0; |
| 614 | } |
| 615 | |
| 616 | if (!soc->ops->host_stats_ops || |
| 617 | !soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats) |
| 618 | return 0; |
| 619 | |
| 620 | return soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats |
| 621 | (soc, |
| 622 | data, |
| 623 | size, |
| 624 | stats_id); |
| 625 | } |
| 626 | |
| 627 | /** |
| 628 | * @brief Call to get vdev extd stats |
| 629 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 630 | * @param soc - soc handle |
| 631 | * @param vdev_id - id of dp vdev object |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 632 | * @param buf - buffer |
| 633 | * @return - int |
| 634 | */ |
| 635 | static inline int |
| 636 | cdp_get_vdev_extd_stats(ol_txrx_soc_handle soc, |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 637 | uint8_t vdev_id, |
| 638 | wmi_host_vdev_extd_stats *buf) |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 639 | { |
| 640 | if (!soc || !soc->ops) { |
| 641 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 642 | "%s: Invalid Instance", __func__); |
| 643 | QDF_BUG(0); |
| 644 | return 0; |
| 645 | } |
| 646 | |
| 647 | if (!soc->ops->host_stats_ops || |
| 648 | !soc->ops->host_stats_ops->txrx_get_vdev_extd_stats) |
| 649 | return 0; |
| 650 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 651 | return soc->ops->host_stats_ops->txrx_get_vdev_extd_stats(soc, vdev_id, |
| 652 | buf); |
Amir Patel | 253053f | 2018-07-17 00:20:57 +0530 | [diff] [blame] | 653 | } |
| 654 | |
| 655 | /** |
Amir Patel | 756d05e | 2018-10-10 12:35:30 +0530 | [diff] [blame] | 656 | * @brief Call to get cdp_pdev_stats |
| 657 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 658 | * @param soc - soc handle |
| 659 | * @param pdev_id - id of dp pdev object |
| 660 | * @param buf - buffer to hold cdp_pdev_stats |
| 661 | * @return - success/failure |
Amir Patel | 756d05e | 2018-10-10 12:35:30 +0530 | [diff] [blame] | 662 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 663 | static inline int |
Amir Patel | 756d05e | 2018-10-10 12:35:30 +0530 | [diff] [blame] | 664 | cdp_host_get_pdev_stats(ol_txrx_soc_handle soc, |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 665 | uint8_t pdev_id, struct cdp_pdev_stats *buf) |
Amir Patel | 756d05e | 2018-10-10 12:35:30 +0530 | [diff] [blame] | 666 | { |
| 667 | if (!soc || !soc->ops) { |
| 668 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 669 | "%s: Invalid Instance", __func__); |
| 670 | QDF_BUG(0); |
| 671 | return 0; |
| 672 | } |
| 673 | |
| 674 | if (!soc->ops->host_stats_ops || |
| 675 | !soc->ops->host_stats_ops->txrx_get_pdev_stats) |
| 676 | return 0; |
| 677 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 678 | return soc->ops->host_stats_ops->txrx_get_pdev_stats(soc, pdev_id, buf); |
Amir Patel | 756d05e | 2018-10-10 12:35:30 +0530 | [diff] [blame] | 679 | } |
| 680 | |
| 681 | /** |
| 682 | * @brief Call to get radio stats |
| 683 | * |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 684 | * @param soc - soc handle |
| 685 | * @param pdev_id - id of dp pdev object |
Amir Patel | 756d05e | 2018-10-10 12:35:30 +0530 | [diff] [blame] | 686 | * @param scn_stats_user - stats buffer |
| 687 | * @return - int |
| 688 | */ |
| 689 | static inline int |
| 690 | cdp_host_get_radio_stats(ol_txrx_soc_handle soc, |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 691 | uint8_t pdev_id, |
Amir Patel | 756d05e | 2018-10-10 12:35:30 +0530 | [diff] [blame] | 692 | void *buf) |
| 693 | { |
| 694 | if (!soc || !soc->ops) { |
| 695 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 696 | "%s: Invalid Instance", __func__); |
| 697 | QDF_BUG(0); |
| 698 | return 0; |
| 699 | } |
| 700 | |
| 701 | if (!soc->ops->host_stats_ops || |
| 702 | !soc->ops->host_stats_ops->txrx_get_radio_stats) |
| 703 | return 0; |
| 704 | |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 705 | return soc->ops->host_stats_ops->txrx_get_radio_stats(soc, pdev_id, |
Amir Patel | 756d05e | 2018-10-10 12:35:30 +0530 | [diff] [blame] | 706 | buf); |
| 707 | } |
| 708 | |
| 709 | /** |
Amir Patel | 256dcbe | 2019-02-26 21:49:24 +0530 | [diff] [blame] | 710 | * @brief confgure rate stats at soc |
| 711 | * |
| 712 | * @param soc - opaque soc handle |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 713 | * @param val - capabilities |
| 714 | * @return - QDF_STATUS |
Amir Patel | 256dcbe | 2019-02-26 21:49:24 +0530 | [diff] [blame] | 715 | */ |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 716 | static inline QDF_STATUS |
Amir Patel | 256dcbe | 2019-02-26 21:49:24 +0530 | [diff] [blame] | 717 | cdp_soc_configure_rate_stats(ol_txrx_soc_handle soc, uint8_t val) |
| 718 | { |
| 719 | if (!soc || !soc->ops) { |
| 720 | QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, |
| 721 | "%s: Invalid Instance", __func__); |
| 722 | QDF_BUG(0); |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 723 | return QDF_STATUS_E_FAILURE; |
Amir Patel | 256dcbe | 2019-02-26 21:49:24 +0530 | [diff] [blame] | 724 | } |
| 725 | |
| 726 | if (!soc->ops->host_stats_ops || |
| 727 | !soc->ops->host_stats_ops->configure_rate_stats) |
Pavankumar Nandeshwar | e54c584 | 2019-09-29 16:01:09 +0530 | [diff] [blame] | 728 | return QDF_STATUS_E_FAILURE; |
Amir Patel | 256dcbe | 2019-02-26 21:49:24 +0530 | [diff] [blame] | 729 | |
| 730 | return soc->ops->host_stats_ops->configure_rate_stats(soc, val); |
| 731 | } |
| 732 | |
Nandha Kishore Easwaran | 4b8148b | 2016-09-02 11:47:00 +0530 | [diff] [blame] | 733 | #endif /* _CDP_TXRX_HOST_STATS_H_ */ |