Skip to content

Commit

Permalink
mac80211: use new function dev_fetch_sw_netstats
Browse files Browse the repository at this point in the history
Simplify the code by using new function dev_fetch_sw_netstats().

Signed-off-by: Heiner Kallweit <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
hkallweit authored and kuba-moo committed Oct 14, 2020
1 parent cf89f18 commit 6401297
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,28 +709,7 @@ static u16 ieee80211_netdev_select_queue(struct net_device *dev,
static void
ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{
int i;

for_each_possible_cpu(i) {
const struct pcpu_sw_netstats *tstats;
u64 rx_packets, rx_bytes, tx_packets, tx_bytes;
unsigned int start;

tstats = per_cpu_ptr(dev->tstats, i);

do {
start = u64_stats_fetch_begin_irq(&tstats->syncp);
rx_packets = tstats->rx_packets;
tx_packets = tstats->tx_packets;
rx_bytes = tstats->rx_bytes;
tx_bytes = tstats->tx_bytes;
} while (u64_stats_fetch_retry_irq(&tstats->syncp, start));

stats->rx_packets += rx_packets;
stats->tx_packets += tx_packets;
stats->rx_bytes += rx_bytes;
stats->tx_bytes += tx_bytes;
}
dev_fetch_sw_netstats(stats, dev->tstats);
}

static const struct net_device_ops ieee80211_dataif_ops = {
Expand Down

0 comments on commit 6401297

Please sign in to comment.