Commit 0b068c71 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net: add DEV_STATS_READ() helper



Companion of DEV_STATS_INC() & DEV_STATS_ADD().

This is going to be used in the series.

Use it in macsec_get_stats64().

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a63df366
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3655,9 +3655,9 @@ static void macsec_get_stats64(struct net_device *dev,

	dev_fetch_sw_netstats(s, dev->tstats);

	s->rx_dropped = atomic_long_read(&dev->stats.__rx_dropped);
	s->tx_dropped = atomic_long_read(&dev->stats.__tx_dropped);
	s->rx_errors = atomic_long_read(&dev->stats.__rx_errors);
	s->rx_dropped = DEV_STATS_READ(dev, rx_dropped);
	s->tx_dropped = DEV_STATS_READ(dev, tx_dropped);
	s->rx_errors = DEV_STATS_READ(dev, rx_errors);
}

static int macsec_get_iflink(const struct net_device *dev)
+1 −0
Original line number Diff line number Diff line
@@ -5236,5 +5236,6 @@ extern struct net_device *blackhole_netdev;
#define DEV_STATS_INC(DEV, FIELD) atomic_long_inc(&(DEV)->stats.__##FIELD)
#define DEV_STATS_ADD(DEV, FIELD, VAL) 	\
		atomic_long_add((VAL), &(DEV)->stats.__##FIELD)
#define DEV_STATS_READ(DEV, FIELD) atomic_long_read(&(DEV)->stats.__##FIELD)

#endif	/* _LINUX_NETDEVICE_H */