Commit ec173778 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Jakub Kicinski

net: usb: qmi_wwan: use new function dev_fetch_sw_netstats

Simplify the code by using new function dev_fetch_sw_netstats().
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Acked-by: default avatarBjørn Mork <bjorn@mork.no>
Link: https://lore.kernel.org/r/2c97b75b-107e-0ab6-d9ef-9f38bb03f495@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9d015167
...@@ -126,31 +126,9 @@ static void qmimux_get_stats64(struct net_device *net, ...@@ -126,31 +126,9 @@ static void qmimux_get_stats64(struct net_device *net,
struct rtnl_link_stats64 *stats) struct rtnl_link_stats64 *stats)
{ {
struct qmimux_priv *priv = netdev_priv(net); struct qmimux_priv *priv = netdev_priv(net);
unsigned int start;
int cpu;
netdev_stats_to_stats64(stats, &net->stats); netdev_stats_to_stats64(stats, &net->stats);
dev_fetch_sw_netstats(stats, priv->stats64);
for_each_possible_cpu(cpu) {
struct pcpu_sw_netstats *stats64;
u64 rx_packets, rx_bytes;
u64 tx_packets, tx_bytes;
stats64 = per_cpu_ptr(priv->stats64, cpu);
do {
start = u64_stats_fetch_begin_irq(&stats64->syncp);
rx_packets = stats64->rx_packets;
rx_bytes = stats64->rx_bytes;
tx_packets = stats64->tx_packets;
tx_bytes = stats64->tx_bytes;
} while (u64_stats_fetch_retry_irq(&stats64->syncp, start));
stats->rx_packets += rx_packets;
stats->rx_bytes += rx_bytes;
stats->tx_packets += tx_packets;
stats->tx_bytes += tx_bytes;
}
} }
static const struct net_device_ops qmimux_netdev_ops = { static const struct net_device_ops qmimux_netdev_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment