blob: cccc9debea591fc39d9a6361d3c7aaa1e0595e9e [file] [log] [blame]
Dhanashri Atrefe5662c2016-03-25 12:57:53 -07001/*
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -08002 * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
Dhanashri Atrefe5662c2016-03-25 12:57:53 -07003 *
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 Manchalaf2a125a2016-11-28 18:10:11 -080034#include "cdp_txrx_handle.h"
Dhanashri Atrefe5662c2016-03-25 12:57:53 -070035/* 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 Jainbc2d91f2017-01-03 18:14:54 +053040/**
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 Easwarane5444bc2016-10-20 13:23:23 +053048static inline int cdp_host_stats_get(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080049 struct cdp_vdev *vdev,
Ishank Jainbc2d91f2017-01-03 18:14:54 +053050 struct ol_txrx_stats_req *req, enum cdp_host_txrx_stats type)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053051{
52 if (soc->ops->host_stats_ops->txrx_host_stats_get)
Ishank Jainbc2d91f2017-01-03 18:14:54 +053053 return soc->ops->host_stats_ops->txrx_host_stats_get(vdev, req,
54 type);
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053055 return 0;
56}
Dhanashri Atrefe5662c2016-03-25 12:57:53 -070057
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053058static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080059cdp_host_ce_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053060{
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 Atrefe5662c2016-03-25 12:57:53 -070065
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053066static inline int cdp_stats_publish
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080067 (ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053068 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 Atrefe5662c2016-03-25 12:57:53 -070074/**
75 * @brief Enable enhanced stats functionality.
76 *
77 * @param pdev - the physical device object
78 * @return - void
79 */
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053080static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080081cdp_enable_enhanced_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053082{
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 Atrefe5662c2016-03-25 12:57:53 -070088
89/**
90 * @brief Disable enhanced stats functionality.
91 *
92 * @param pdev - the physical device object
93 * @return - void
94 */
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053095static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080096cdp_disable_enhanced_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +053097{
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 Atrefe5662c2016-03-25 12:57:53 -0700103
Dhanashri Atrefe5662c2016-03-25 12:57:53 -0700104/**
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 Easwarane5444bc2016-10-20 13:23:23 +0530112static inline uint32_t *cdp_get_stats_base
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800113 (ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530114 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 Easwarane5444bc2016-10-20 13:23:23 +0530121static inline void
122cdp_tx_print_tso_stats(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800123 struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530124{
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 Atrefe5662c2016-03-25 12:57:53 -0700129
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530130static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800131cdp_tx_rst_tso_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530132{
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 Atrefe5662c2016-03-25 12:57:53 -0700137
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530138static inline void
139cdp_tx_print_sg_stats(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800140 struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530141{
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 Atrefe5662c2016-03-25 12:57:53 -0700146
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530147static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800148cdp_tx_rst_sg_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530149{
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 Atrefe5662c2016-03-25 12:57:53 -0700154
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530155static inline void
156cdp_print_rx_cksum_stats(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800157 struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530158{
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 Atrefe5662c2016-03-25 12:57:53 -0700163
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530164static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800165cdp_rst_rx_cksum_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530166{
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 Atrefe5662c2016-03-25 12:57:53 -0700171
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530172static inline A_STATUS
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800173cdp_host_me_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530174{
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 Easwarane5444bc2016-10-20 13:23:23 +0530179static inline void cdp_per_peer_stats
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800180 (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, char *addr)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530181{
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 Easwarane5444bc2016-10-20 13:23:23 +0530188static inline int cdp_host_msdu_ttl_stats(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800189 struct cdp_vdev *vdev,
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530190 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 Atrefe5662c2016-03-25 12:57:53 -0700197
Dhanashri Atrefe5662c2016-03-25 12:57:53 -0700198
Dhanashri Atrefe5662c2016-03-25 12:57:53 -0700199
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530200static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800201cdp_print_lro_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530202{
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 Atrefe5662c2016-03-25 12:57:53 -0700207
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530208static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800209cdp_reset_lro_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Nandha Kishore Easwarane5444bc2016-10-20 13:23:23 +0530210{
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 Atrefe5662c2016-03-25 12:57:53 -0700215
Nandha Kishore Easwaran4b8148b2016-09-02 11:47:00 +0530216/**
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 Easwaran2bfa2212016-09-15 12:20:06 +0530227#if ATH_BAND_STEERING || ENHANCED_STATS
Nandha Kishore Easwaran4b8148b2016-09-02 11:47:00 +0530228uint32_t *ol_txrx_get_en_stats_base(ol_txrx_pdev_handle txrx_pdev, uint32_t *msg_word,
Nandha Kishore Easwaran870abda2016-11-16 17:37:19 +0530229 uint32_t msg_len, enum htt_cmn_t2h_en_stats_type *type, enum htt_cmn_t2h_en_stats_status *status);
Dhanashri Atrefe5662c2016-03-25 12:57:53 -0700230#endif
Nandha Kishore Easwaran4b8148b2016-09-02 11:47:00 +0530231#endif /* _CDP_TXRX_HOST_STATS_H_ */