Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 1 | /* |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 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_host_stats.h |
| 29 | * @brief Define the host data path stats API functions |
| 30 | * called by the host control SW and the OS interface module |
| 31 | */ |
| 32 | #ifndef _CDP_TXRX_HOST_STATS_H_ |
| 33 | #define _CDP_TXRX_HOST_STATS_H_ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 34 | #include "cdp_txrx_handle.h" |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 35 | /* WIN */ |
| 36 | /* Need to remove the "req" parameter */ |
| 37 | /* Need to rename the function to reflect the functionality "show" / "display" |
| 38 | * WIN -- to figure out whether to change OSIF to converge (not an immediate AI) |
| 39 | * */ |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame^] | 40 | /** |
| 41 | * cdp_host_stats_get: cdp call to get host stats |
| 42 | * @soc: SOC handle |
| 43 | * @req: Requirement type |
| 44 | * @type: Host stat type |
| 45 | * |
| 46 | * return: 0 for Success, Failure returns error message |
| 47 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 48 | static inline int cdp_host_stats_get(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 49 | struct cdp_vdev *vdev, |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame^] | 50 | struct ol_txrx_stats_req *req, enum cdp_host_txrx_stats type) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 51 | { |
| 52 | if (soc->ops->host_stats_ops->txrx_host_stats_get) |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame^] | 53 | return soc->ops->host_stats_ops->txrx_host_stats_get(vdev, req, |
| 54 | type); |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 55 | return 0; |
| 56 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 57 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 58 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 59 | cdp_host_ce_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 60 | { |
| 61 | if (soc->ops->host_stats_ops->txrx_host_ce_stats) |
| 62 | return soc->ops->host_stats_ops->txrx_host_ce_stats(vdev); |
| 63 | return; |
| 64 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 65 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 66 | static inline int cdp_stats_publish |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 67 | (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 68 | struct ol_txrx_stats *buf) |
| 69 | { |
| 70 | if (soc->ops->host_stats_ops->txrx_stats_publish) |
| 71 | return soc->ops->host_stats_ops->txrx_stats_publish(pdev, buf); |
| 72 | return 0; |
| 73 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 74 | /** |
| 75 | * @brief Enable enhanced stats functionality. |
| 76 | * |
| 77 | * @param pdev - the physical device object |
| 78 | * @return - void |
| 79 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 80 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 81 | cdp_enable_enhanced_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 82 | { |
| 83 | if (soc->ops->host_stats_ops->txrx_enable_enhanced_stats) |
| 84 | return soc->ops->host_stats_ops->txrx_enable_enhanced_stats |
| 85 | (pdev); |
| 86 | return; |
| 87 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * @brief Disable enhanced stats functionality. |
| 91 | * |
| 92 | * @param pdev - the physical device object |
| 93 | * @return - void |
| 94 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 95 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 96 | cdp_disable_enhanced_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 97 | { |
| 98 | if (soc->ops->host_stats_ops->txrx_disable_enhanced_stats) |
| 99 | return soc->ops->host_stats_ops->txrx_disable_enhanced_stats |
| 100 | (pdev); |
| 101 | return; |
| 102 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 103 | |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 104 | /** |
| 105 | * @brief Get the desired stats from the message. |
| 106 | * |
| 107 | * @param pdev - the physical device object |
| 108 | * @param stats_base - stats buffer recieved from FW |
| 109 | * @param type - stats type. |
| 110 | * @return - pointer to requested stat identified by type |
| 111 | */ |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 112 | static inline uint32_t *cdp_get_stats_base |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 113 | (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 114 | uint32_t *stats_base, uint32_t msg_len, uint8_t type) |
| 115 | { |
| 116 | if (soc->ops->host_stats_ops->txrx_get_stats_base) |
| 117 | return (uint32_t *)soc->ops->host_stats_ops->txrx_get_stats_base |
| 118 | (pdev, stats_base, msg_len, type); |
| 119 | return 0; |
| 120 | } |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 121 | static inline void |
| 122 | cdp_tx_print_tso_stats(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 123 | struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 124 | { |
| 125 | if (soc->ops->host_stats_ops->tx_print_tso_stats) |
| 126 | return soc->ops->host_stats_ops->tx_print_tso_stats(vdev); |
| 127 | return; |
| 128 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 129 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 130 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 131 | cdp_tx_rst_tso_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 132 | { |
| 133 | if (soc->ops->host_stats_ops->tx_rst_tso_stats) |
| 134 | return soc->ops->host_stats_ops->tx_rst_tso_stats(vdev); |
| 135 | return; |
| 136 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 137 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 138 | static inline void |
| 139 | cdp_tx_print_sg_stats(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 140 | struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 141 | { |
| 142 | if (soc->ops->host_stats_ops->tx_print_sg_stats) |
| 143 | return soc->ops->host_stats_ops->tx_print_sg_stats(vdev); |
| 144 | return; |
| 145 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 146 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 147 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 148 | cdp_tx_rst_sg_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 149 | { |
| 150 | if (soc->ops->host_stats_ops->tx_rst_sg_stats) |
| 151 | return soc->ops->host_stats_ops->tx_rst_sg_stats(vdev); |
| 152 | return; |
| 153 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 154 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 155 | static inline void |
| 156 | cdp_print_rx_cksum_stats(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 157 | struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 158 | { |
| 159 | if (soc->ops->host_stats_ops->print_rx_cksum_stats) |
| 160 | return soc->ops->host_stats_ops->print_rx_cksum_stats(vdev); |
| 161 | return; |
| 162 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 163 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 164 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 165 | cdp_rst_rx_cksum_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 166 | { |
| 167 | if (soc->ops->host_stats_ops->rst_rx_cksum_stats) |
| 168 | return soc->ops->host_stats_ops->rst_rx_cksum_stats(vdev); |
| 169 | return; |
| 170 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 171 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 172 | static inline A_STATUS |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 173 | cdp_host_me_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 174 | { |
| 175 | if (soc->ops->host_stats_ops->txrx_host_me_stats) |
| 176 | return soc->ops->host_stats_ops->txrx_host_me_stats(vdev); |
| 177 | return 0; |
| 178 | } |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 179 | static inline void cdp_per_peer_stats |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 180 | (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, char *addr) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 181 | { |
| 182 | if (soc->ops->host_stats_ops->txrx_per_peer_stats) |
| 183 | return soc->ops->host_stats_ops->txrx_per_peer_stats |
| 184 | (pdev, addr); |
| 185 | return; |
| 186 | } |
| 187 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 188 | static inline int cdp_host_msdu_ttl_stats(ol_txrx_soc_handle soc, |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 189 | struct cdp_vdev *vdev, |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 190 | struct ol_txrx_stats_req *req) |
| 191 | { |
| 192 | if (soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats) |
| 193 | return soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats |
| 194 | (vdev, req); |
| 195 | return 0; |
| 196 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 197 | |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 198 | |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 199 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 200 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 201 | cdp_print_lro_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 202 | { |
| 203 | if (soc->ops->host_stats_ops->print_lro_stats) |
| 204 | return soc->ops->host_stats_ops->print_lro_stats(vdev); |
| 205 | return; |
| 206 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 207 | |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 208 | static inline void |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 209 | cdp_reset_lro_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) |
Nandha Kishore Easwaran | e5444bc | 2016-10-20 13:23:23 +0530 | [diff] [blame] | 210 | { |
| 211 | if (soc->ops->host_stats_ops->reset_lro_stats) |
| 212 | return soc->ops->host_stats_ops->reset_lro_stats(vdev); |
| 213 | return; |
| 214 | } |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 215 | |
Nandha Kishore Easwaran | 4b8148b | 2016-09-02 11:47:00 +0530 | [diff] [blame] | 216 | /** |
| 217 | * @brief Parse the stats header and get the payload from the message. |
| 218 | * |
| 219 | * @param pdev - the physical device object |
| 220 | * @param msg_word - stats buffer recieved from FW |
| 221 | * @param msg_len - length of the message |
| 222 | * @param type - place holder for parsed message type |
| 223 | * @param status - place holder for parsed message status |
| 224 | * @return - pointer to received stat payload |
| 225 | */ |
| 226 | |
Nandha Kishore Easwaran | 2bfa221 | 2016-09-15 12:20:06 +0530 | [diff] [blame] | 227 | #if ATH_BAND_STEERING || ENHANCED_STATS |
Nandha Kishore Easwaran | 4b8148b | 2016-09-02 11:47:00 +0530 | [diff] [blame] | 228 | uint32_t *ol_txrx_get_en_stats_base(ol_txrx_pdev_handle txrx_pdev, uint32_t *msg_word, |
Nandha Kishore Easwaran | 870abda | 2016-11-16 17:37:19 +0530 | [diff] [blame] | 229 | uint32_t msg_len, enum htt_cmn_t2h_en_stats_type *type, enum htt_cmn_t2h_en_stats_status *status); |
Dhanashri Atre | fe5662c | 2016-03-25 12:57:53 -0700 | [diff] [blame] | 230 | #endif |
Nandha Kishore Easwaran | 4b8148b | 2016-09-02 11:47:00 +0530 | [diff] [blame] | 231 | #endif /* _CDP_TXRX_HOST_STATS_H_ */ |