1  /*
2   * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
3   * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4   *
5   * Permission to use, copy, modify, and/or distribute this software for any
6   * purpose with or without fee is hereby granted, provided that the above
7   * copyright notice and this permission notice appear in all copies.
8   *
9   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11   * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12   * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13   * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16   */
17  /**
18   * DOC: Implement API's specific to cp stats component.
19   */
20  
21  #include "wmi_unified_priv.h"
22  #include "wmi_unified_param.h"
23  #include "wmi_unified_mc_cp_stats_api.h"
24  
25  QDF_STATUS
wmi_extract_per_chain_rssi_stats(wmi_unified_t wmi_handle,void * evt_buf,uint32_t index,struct wmi_host_per_chain_rssi_stats * rssi_stats)26  wmi_extract_per_chain_rssi_stats(wmi_unified_t wmi_handle, void *evt_buf,
27  			       uint32_t index,
28  			       struct wmi_host_per_chain_rssi_stats *rssi_stats)
29  {
30  	if (wmi_handle->ops->extract_per_chain_rssi_stats)
31  		return wmi_handle->ops->extract_per_chain_rssi_stats(wmi_handle,
32  			evt_buf, index, rssi_stats);
33  
34  	return QDF_STATUS_E_FAILURE;
35  }
36  
37  QDF_STATUS
wmi_extract_peer_adv_stats(wmi_unified_t wmi_handle,void * evt_buf,struct wmi_host_peer_adv_stats * peer_adv_stats)38  wmi_extract_peer_adv_stats(wmi_unified_t wmi_handle, void *evt_buf,
39  			   struct wmi_host_peer_adv_stats *peer_adv_stats)
40  {
41  	if (wmi_handle->ops->extract_peer_adv_stats)
42  		return wmi_handle->ops->extract_peer_adv_stats(wmi_handle,
43  			evt_buf, peer_adv_stats);
44  
45  	return QDF_STATUS_E_FAILURE;
46  }
47  
48  #ifdef WLAN_FEATURE_MIB_STATS
wmi_extract_mib_stats(wmi_unified_t wmi_handle,void * evt_buf,struct mib_stats_metrics * mib_stats)49  QDF_STATUS wmi_extract_mib_stats(wmi_unified_t wmi_handle, void *evt_buf,
50  				 struct mib_stats_metrics *mib_stats)
51  {
52  	if (wmi_handle->ops->extract_mib_stats)
53  		return wmi_handle->ops->extract_mib_stats(wmi_handle,
54  							  evt_buf,
55  							  mib_stats);
56  
57  	return QDF_STATUS_E_FAILURE;
58  }
59  #endif
60  
61  QDF_STATUS
wmi_unified_peer_stats_request_send(wmi_unified_t wmi_handle,struct peer_stats_request_params * param)62  wmi_unified_peer_stats_request_send(wmi_unified_t wmi_handle,
63  				    struct peer_stats_request_params *param)
64  {
65  	if (wmi_handle->ops->send_request_peer_stats_info_cmd)
66  		return wmi_handle->ops->send_request_peer_stats_info_cmd(
67  							     wmi_handle, param);
68  
69  	return QDF_STATUS_E_FAILURE;
70  }
71  
72  QDF_STATUS
wmi_extract_peer_stats_param(wmi_unified_t wmi_handle,void * evt_buf,wmi_host_stats_event * stats_param)73  wmi_extract_peer_stats_param(wmi_unified_t wmi_handle, void *evt_buf,
74  			     wmi_host_stats_event *stats_param)
75  {
76  	if (wmi_handle->ops->extract_peer_stats_count)
77  		return wmi_handle->ops->extract_peer_stats_count(wmi_handle,
78  			evt_buf, stats_param);
79  
80  	return QDF_STATUS_E_FAILURE;
81  }
82  
83  QDF_STATUS
wmi_extract_peer_tx_pkt_per_mcs(wmi_unified_t wmi_handle,void * evt_buf,uint32_t index,wmi_host_peer_stats_info * peer_stats_info)84  wmi_extract_peer_tx_pkt_per_mcs(wmi_unified_t wmi_handle, void *evt_buf,
85  				uint32_t index,
86  				wmi_host_peer_stats_info *peer_stats_info)
87  {
88  	if (wmi_handle->ops->extract_peer_tx_pkt_per_mcs)
89  		return wmi_handle->ops->extract_peer_tx_pkt_per_mcs(wmi_handle,
90  				evt_buf, index, peer_stats_info);
91  
92  	return QDF_STATUS_E_FAILURE;
93  }
94  
95  QDF_STATUS
wmi_extract_peer_rx_pkt_per_mcs(wmi_unified_t wmi_handle,void * evt_buf,uint32_t index,wmi_host_peer_stats_info * peer_stats_info)96  wmi_extract_peer_rx_pkt_per_mcs(wmi_unified_t wmi_handle, void *evt_buf,
97  				uint32_t index,
98  				wmi_host_peer_stats_info *peer_stats_info)
99  {
100  	if (wmi_handle->ops->extract_peer_rx_pkt_per_mcs)
101  		return wmi_handle->ops->extract_peer_rx_pkt_per_mcs(wmi_handle,
102  				evt_buf, index, peer_stats_info);
103  
104  	return QDF_STATUS_E_FAILURE;
105  }
106  
107  QDF_STATUS
wmi_extract_peer_stats_info(wmi_unified_t wmi_handle,void * evt_buf,uint32_t index,wmi_host_peer_stats_info * peer_stats_info)108  wmi_extract_peer_stats_info(wmi_unified_t wmi_handle, void *evt_buf,
109  			    uint32_t index,
110  			    wmi_host_peer_stats_info *peer_stats_info)
111  {
112  	if (wmi_handle->ops->extract_peer_stats_info)
113  		return wmi_handle->ops->extract_peer_stats_info(wmi_handle,
114  				evt_buf, index, peer_stats_info);
115  
116  	return QDF_STATUS_E_FAILURE;
117  }
118  
119  #ifdef WLAN_FEATURE_BIG_DATA_STATS
120  QDF_STATUS
wmi_extract_big_data_stats_param(wmi_unified_t wmi_handle,void * evt_buf,struct big_data_stats_event * stats_param)121  wmi_extract_big_data_stats_param(wmi_unified_t wmi_handle, void *evt_buf,
122  				 struct big_data_stats_event *stats_param)
123  {
124  	if (wmi_handle->ops->extract_big_data_stats)
125  		return wmi_handle->ops->extract_big_data_stats(wmi_handle,
126  				evt_buf, stats_param);
127  
128  	return QDF_STATUS_E_FAILURE;
129  }
130  #endif
131