Skip to content

Commit a0d2698

Browse files
hkallweitkuba-moo
authored andcommitted
net: dsa: use new function dev_fetch_sw_netstats
Simplify the code by using new function dev_fetch_sw_netstats(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Tested-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/b6047017-8226-6b7e-a3cd-064e69fdfa27@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent f3f04f0 commit a0d2698

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

‎net/dsa/slave.c‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,28 +1221,9 @@ static void dsa_slave_get_stats64(struct net_device *dev,
12211221
struct rtnl_link_stats64 *stats)
12221222
{
12231223
struct dsa_slave_priv *p = netdev_priv(dev);
1224-
struct pcpu_sw_netstats *s;
1225-
unsigned int start;
1226-
int i;
12271224

12281225
netdev_stats_to_stats64(stats, &dev->stats);
1229-
for_each_possible_cpu(i) {
1230-
u64 tx_packets, tx_bytes, rx_packets, rx_bytes;
1231-
1232-
s = per_cpu_ptr(p->stats64, i);
1233-
do {
1234-
start = u64_stats_fetch_begin_irq(&s->syncp);
1235-
tx_packets = s->tx_packets;
1236-
tx_bytes = s->tx_bytes;
1237-
rx_packets = s->rx_packets;
1238-
rx_bytes = s->rx_bytes;
1239-
} while (u64_stats_fetch_retry_irq(&s->syncp, start));
1240-
1241-
stats->tx_packets += tx_packets;
1242-
stats->tx_bytes += tx_bytes;
1243-
stats->rx_packets += rx_packets;
1244-
stats->rx_bytes += rx_bytes;
1245-
}
1226+
dev_fetch_sw_netstats(stats, p->stats64);
12461227
}
12471228

12481229
static int dsa_slave_get_rxnfc(struct net_device *dev,

0 commit comments

Comments
 (0)