xref: /wlan-dirver/qca-wifi-host-cmn/qdf/linux/src/i_qdf_net_stats.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
1 /*
2  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
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 
19 /**
20  * DOC: qdf_net_dev_stats
21  * QCA driver framework (QDF) network interface stats management APIs
22  */
23 
24 #if !defined(__I_QDF_NET_STATS_H)
25 #define __I_QDF_NET_STATS_H
26 
27 /* Include Files */
28 #include <qdf_types.h>
29 #include <qdf_util.h>
30 #include <linux/netdevice.h>
31 
32 #define QDF_NET_DEV_STATS_INC_RX_PKTS(stats) \
33 	(((struct net_device_stats *)stats)->rx_packets++)
34 
35 #define QDF_NET_DEV_STATS_INC_TX_PKTS(stats) \
36 	(((struct net_device_stats *)stats)->tx_packets++)
37 
38 #define QDF_NET_DEV_STATS_INC_RX_BYTES(stats) \
39 	(((struct net_device_stats *)stats)->rx_bytes++)
40 
41 #define QDF_NET_DEV_STATS_INC_TX_BYTES(stats) \
42 	(((struct net_device_stats *)stats)->tx_bytes++)
43 
44 #define QDF_NET_DEV_STATS_INC_RX_ERRORS(stats) \
45 	(((struct net_device_stats *)stats)->rx_errors++)
46 
47 #define QDF_NET_DEV_STATS_INC_TX_ERRORS(stats) \
48 	(((struct net_device_stats *)stats)->tx_errors++)
49 
50 #define QDF_NET_DEV_STATS_INC_RX_DROPPED(stats) \
51 	(((struct net_device_stats *)stats)->rx_dropped++)
52 
53 #define QDF_NET_DEV_STATS_INC_TX_DROPEED(stats) \
54 	(((struct net_device_stats *)stats)->tx_dropped++)
55 
56 #define QDF_NET_DEV_STATS_RX_PKTS(stats) \
57 	(((struct net_device_stats *)stats)->rx_packets)
58 
59 #define QDF_NET_DEV_STATS_TX_PKTS(stats) \
60 	(((struct net_device_stats *)stats)->tx_packets)
61 
62 #define QDF_NET_DEV_STATS_RX_BYTES(stats) \
63 	(((struct net_device_stats *)stats)->rx_bytes)
64 
65 #define QDF_NET_DEV_STATS_TX_BYTES(stats) \
66 	(((struct net_device_stats *)stats)->tx_bytes)
67 
68 #define QDF_NET_DEV_STATS_RX_ERRORS(stats) \
69 	(((struct net_device_stats *)stats)->rx_errors)
70 
71 #define QDF_NET_DEV_STATS_TX_ERRORS(stats) \
72 	(((struct net_device_stats *)stats)->tx_errors)
73 
74 #define QDF_NET_DEV_STATS_RX_DROPPED(stats) \
75 	(((struct net_device_stats *)stats)->rx_dropped)
76 
77 #define QDF_NET_DEV_STATS_TX_DROPEED(stats) \
78 	(((struct net_device_stats *)stats)->tx_dropped)
79 
80 #endif /*__I_QDF_NET_STATS_H*/
81