diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2020-10-29 18:29:59 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-10-31 10:21:31 -0700 |
commit | d3fd65484c78102bac92f176c53537a7691a38b2 (patch) | |
tree | d14e1624b861176295051e7bef385faa8dbb1cc7 /include | |
parent | 4e5d79bbe82eb172641f07ebdd2a62f09520e422 (diff) | |
download | linux-d3fd65484c78102bac92f176c53537a7691a38b2.tar.bz2 |
net: core: add dev_sw_netstats_tx_add
Add dev_sw_netstats_tx_add(), complementing already existing
dev_sw_netstats_rx_add(). Other than dev_sw_netstats_rx_add allow to
pass the number of packets as function argument.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netdevice.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 964b494b0e8d..568fab708ac6 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2557,6 +2557,18 @@ static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int l u64_stats_update_end(&tstats->syncp); } +static inline void dev_sw_netstats_tx_add(struct net_device *dev, + unsigned int packets, + unsigned int len) +{ + struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); + + u64_stats_update_begin(&tstats->syncp); + tstats->tx_bytes += len; + tstats->tx_packets += packets; + u64_stats_update_end(&tstats->syncp); +} + static inline void dev_lstats_add(struct net_device *dev, unsigned int len) { struct pcpu_lstats *lstats = this_cpu_ptr(dev->lstats); |