xref: /wlan-driver/qca-wifi-host-cmn/dp/inc/cdp_txrx_stats.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2016-2017,2019,2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name /**
21*5113495bSYour Name  * DOC: cdp_txrx_stats.h
22*5113495bSYour Name  * Define the host data path statistics API functions
23*5113495bSYour Name  * called by the host control SW and the OS interface module
24*5113495bSYour Name  */
25*5113495bSYour Name #ifndef _CDP_TXRX_STATS_H_
26*5113495bSYour Name #define _CDP_TXRX_STATS_H_
27*5113495bSYour Name #include <cdp_txrx_ops.h>
28*5113495bSYour Name #include <cdp_txrx_cmn.h>
29*5113495bSYour Name 
30*5113495bSYour Name static inline QDF_STATUS
cdp_clear_stats(ol_txrx_soc_handle soc,uint8_t pdev_id,uint8_t bitmap)31*5113495bSYour Name cdp_clear_stats(ol_txrx_soc_handle soc, uint8_t pdev_id, uint8_t bitmap)
32*5113495bSYour Name {
33*5113495bSYour Name 
34*5113495bSYour Name 	if (!soc || !soc->ops) {
35*5113495bSYour Name 		dp_cdp_debug("Invalid Instance");
36*5113495bSYour Name 		QDF_BUG(0);
37*5113495bSYour Name 		return QDF_STATUS_E_INVAL;
38*5113495bSYour Name 	}
39*5113495bSYour Name 
40*5113495bSYour Name 	if (!soc->ops->mob_stats_ops ||
41*5113495bSYour Name 	    !soc->ops->mob_stats_ops->clear_stats)
42*5113495bSYour Name 		return QDF_STATUS_E_INVAL;
43*5113495bSYour Name 
44*5113495bSYour Name 	return soc->ops->mob_stats_ops->clear_stats(soc, pdev_id, bitmap);
45*5113495bSYour Name }
46*5113495bSYour Name 
47*5113495bSYour Name static inline int
cdp_stats(ol_txrx_soc_handle soc,uint8_t vdev_id,char * buffer,unsigned int buf_len)48*5113495bSYour Name cdp_stats(ol_txrx_soc_handle soc, uint8_t vdev_id, char *buffer,
49*5113495bSYour Name 		unsigned int buf_len)
50*5113495bSYour Name {
51*5113495bSYour Name 	if (!soc || !soc->ops) {
52*5113495bSYour Name 		dp_cdp_debug("Invalid Instance");
53*5113495bSYour Name 		QDF_BUG(0);
54*5113495bSYour Name 		return 0;
55*5113495bSYour Name 	}
56*5113495bSYour Name 
57*5113495bSYour Name 	if (!soc->ops->mob_stats_ops ||
58*5113495bSYour Name 	    !soc->ops->mob_stats_ops->stats)
59*5113495bSYour Name 		return 0;
60*5113495bSYour Name 
61*5113495bSYour Name 	return soc->ops->mob_stats_ops->stats(vdev_id, buffer, buf_len);
62*5113495bSYour Name }
63*5113495bSYour Name 
64*5113495bSYour Name #endif /* _CDP_TXRX_STATS_H_ */
65