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_stats_public API 21 * This file defines the net dev stats abstraction. 22 */ 23 24 #if !defined(__QDF_NET_STATS_H) 25 #define __QDF_NET_STATS_H 26 27 #include <qdf_types.h> 28 #include <i_qdf_net_stats.h> 29 #include <qdf_net_types.h> 30 31 /** 32 * qdf_net_stats_add_rx_pkts() - Add RX pkts in n/w stats 33 * @stats: Network stats instance 34 * @value: Value to be added 35 * 36 * Return: None. 37 */ 38 static inline 39 void qdf_net_stats_add_rx_pkts(qdf_net_dev_stats *stats, uint32_t value) 40 { 41 __qdf_net_stats_add_rx_pkts(stats, value); 42 } 43 44 /** 45 * qdf_net_stats_get_rx_pkts() - Get RX pkts in net stats 46 * @stats: Network stats instance 47 * 48 * Return: Rx packets received on N/W interface 49 */ 50 static inline 51 unsigned long qdf_net_stats_get_rx_pkts(qdf_net_dev_stats *stats) 52 { 53 return __qdf_net_stats_get_rx_pkts(stats); 54 } 55 56 /** 57 * qdf_net_stats_add_rx_bytes() - Add RX bytes in n/w stats 58 * @stats: Network stats instance 59 * @value: Value to be added 60 * 61 * Return: None. 62 */ 63 static inline 64 void qdf_net_stats_add_rx_bytes(qdf_net_dev_stats *stats, uint32_t value) 65 { 66 __qdf_net_stats_add_rx_bytes(stats, value); 67 } 68 69 /** 70 * qdf_net_stats_get_rx_bytes() - Get RX bytes in net stats 71 * @stats: Network stats instance 72 * 73 * Return: Rx bytes received on N/W interface 74 */ 75 static inline 76 unsigned long qdf_net_stats_get_rx_bytes(qdf_net_dev_stats *stats) 77 { 78 return __qdf_net_stats_get_rx_bytes(stats); 79 } 80 81 /** 82 * qdf_net_stats_inc_rx_errors() - inc RX errors n/w stats 83 * @stats: Network stats instance 84 * 85 * Return: None. 86 */ 87 static inline 88 void qdf_net_stats_inc_rx_errors(qdf_net_dev_stats *stats) 89 { 90 __qdf_net_stats_inc_rx_errors(stats); 91 } 92 93 /** 94 * qdf_net_stats_get_rx_errors() - Get RX errors in net stats 95 * @stats: Network stats instance 96 * 97 * Return: Rx packet errors on N/W interface 98 */ 99 static inline 100 unsigned long qdf_net_stats_get_rx_errors(qdf_net_dev_stats *stats) 101 { 102 return __qdf_net_stats_get_rx_errors(stats); 103 } 104 105 /** 106 * qdf_net_stats_inc_rx_dropped() - inc RX dropped n/w stats 107 * @stats: Network stats instance 108 * 109 * Return: None. 110 */ 111 static inline 112 void qdf_net_stats_inc_rx_dropped(qdf_net_dev_stats *stats) 113 { 114 __qdf_net_stats_inc_rx_dropped(stats); 115 } 116 117 /** 118 * qdf_net_stats_get_rx_dropped() - Get RX dropped in net stats 119 * @stats: Network stats instance 120 * 121 * Return: Rx packet dropped on N/W interface 122 */ 123 static inline 124 unsigned long qdf_net_stats_get_rx_dropped(qdf_net_dev_stats *stats) 125 { 126 return __qdf_net_stats_get_rx_dropped(stats); 127 } 128 129 /** 130 * qdf_net_stats_add_tx_pkts() - Add Tx packets in n/w stats 131 * @stats: Network stats instance 132 * @value: Value to be added 133 * 134 * Return: None. 135 */ 136 static inline 137 void qdf_net_stats_add_tx_pkts(qdf_net_dev_stats *stats, uint32_t value) 138 { 139 __qdf_net_stats_add_tx_pkts(stats, value); 140 } 141 142 /** 143 * qdf_net_stats_get_tx_pkts() - Get Tx packets in net stats 144 * @stats: Network stats instance 145 * 146 * Return: Tx packets transmitted on N/W interface 147 */ 148 static inline 149 unsigned long qdf_net_stats_get_tx_pkts(qdf_net_dev_stats *stats) 150 { 151 return __qdf_net_stats_get_tx_pkts(stats); 152 } 153 154 /** 155 * qdf_net_stats_add_tx_bytes() - Add Tx bytes in n/w stats 156 * @stats: Network stats instance 157 * @value: Value to be added 158 * 159 * Return: None. 160 */ 161 static inline 162 void qdf_net_stats_add_tx_bytes(qdf_net_dev_stats *stats, uint32_t value) 163 { 164 __qdf_net_stats_add_tx_bytes(stats, value); 165 } 166 167 /** 168 * qdf_net_stats_get_tx_bytes() - Get Tx bytes in net stats 169 * @stats: Network stats instance 170 * 171 * Return: Tx bytes transmitted on N/W interface 172 */ 173 static inline 174 unsigned long qdf_net_stats_get_tx_bytes(qdf_net_dev_stats *stats) 175 { 176 return __qdf_net_stats_get_tx_bytes(stats); 177 } 178 179 /** 180 * qdf_net_stats_inc_tx_errors() - inc Tx errors n/w stats 181 * @stats: Network stats instance 182 * 183 * Return: None. 184 */ 185 static inline 186 void qdf_net_stats_inc_tx_errors(qdf_net_dev_stats *stats) 187 { 188 __qdf_net_stats_inc_tx_errors(stats); 189 } 190 191 /** 192 * qdf_net_stats_get_tx_errors() - Get Tx errors in net stats 193 * @stats: Network stats instance 194 * 195 * Return: Tx errors on N/W interface 196 */ 197 static inline 198 unsigned long qdf_net_stats_get_tx_errors(qdf_net_dev_stats *stats) 199 { 200 return __qdf_net_stats_get_tx_errors(stats); 201 } 202 203 /** 204 * qdf_net_stats_inc_tx_dropped() - inc Tx dropped n/w stats 205 * @stats: Network stats instance 206 * 207 * Return: None. 208 */ 209 static inline 210 void qdf_net_stats_inc_tx_dropped(qdf_net_dev_stats *stats) 211 { 212 __qdf_net_stats_inc_tx_dropped(stats); 213 } 214 215 /** 216 * qdf_net_stats_get_tx_dropped() - Get Tx dropped in net stats 217 * @stats: Network stats instance 218 * 219 * Return: Tx dropped on N/W interface 220 */ 221 static inline 222 unsigned long qdf_net_stats_get_tx_dropped(qdf_net_dev_stats *stats) 223 { 224 return __qdf_net_stats_get_tx_dropped(stats); 225 } 226 #endif /*__QDF_NET_STATS_H*/ 227