Copy dev_sw_netstats_rx_add() and dev_sw_netstats_tx_add() from the upstream kernel. Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx> --- backport/backport-include/linux/netdevice.h | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h index d854faef..5c30426d 100644 --- a/backport/backport-include/linux/netdevice.h +++ b/backport/backport-include/linux/netdevice.h @@ -113,6 +113,34 @@ void dev_fetch_sw_netstats(struct rtnl_link_stats64 *s, int netif_rx_any_context(struct sk_buff *skb); #endif /* < 5.10 */ +#if LINUX_VERSION_IS_LESS(5,10,0) +#define dev_sw_netstats_rx_add LINUX_BACKPORT(dev_sw_netstats_rx_add) +static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int len) +{ + struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); + + u64_stats_update_begin(&tstats->syncp); + tstats->rx_bytes += len; + tstats->rx_packets++; + u64_stats_update_end(&tstats->syncp); +} +#endif /* < 5.10 */ + +#if LINUX_VERSION_IS_LESS(5,11,0) +#define dev_sw_netstats_tx_add LINUX_BACKPORT(dev_sw_netstats_tx_add) +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); +} +#endif /* < 5.11 */ + #if LINUX_VERSION_IS_LESS(5,11,0) #define dev_get_tstats64 LINUX_BACKPORT(dev_get_tstats64) void dev_get_tstats64(struct net_device *dev, struct rtnl_link_stats64 *s); -- 2.30.2 -- To unsubscribe from this list: send the line "unsubscribe backports" in