]> Git Repo - linux.git/commitdiff
net: core: add dev_sw_netstats_tx_add
authorHeiner Kallweit <[email protected]>
Thu, 29 Oct 2020 17:29:59 +0000 (18:29 +0100)
committerJakub Kicinski <[email protected]>
Sat, 31 Oct 2020 17:21:31 +0000 (10:21 -0700)
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 <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
include/linux/netdevice.h

index 964b494b0e8d3ea893f4263236e80e0255f01b0d..568fab708ac6522d22480aaa3bb54fe4deff4060 100644 (file)
@@ -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);
This page took 0.063269 seconds and 4 git commands to generate.