diff options
author | Jakub Kicinski <kuba@kernel.org> | 2020-11-10 04:50:32 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-10 04:50:33 +0300 |
commit | 52643b7832d8dca9df647a6ce181e3faf86dc99f (patch) | |
tree | 70f8aa44af3ebdc99d57ac2d046c0d5e9f4cdc22 /net/dsa/dsa.c | |
parent | ca4d632aef031c7946c42a6eb873d24ab6474f17 (diff) | |
parent | 682036b2b9fbcf98e333bad717968ad6650a0d94 (diff) | |
download | linux-52643b7832d8dca9df647a6ce181e3faf86dc99f.tar.xz |
Merge branch 'net-add-and-use-dev_get_tstats64'
Heiner Kallweit says:
====================
net: add and use dev_get_tstats64
It's a frequent pattern to use netdev->stats for the less frequently
accessed counters and per-cpu counters for the frequently accessed
counters (rx/tx bytes/packets). Add a default ndo_get_stats64()
implementation for this use case. Subsequently switch more drivers
to use this pattern.
v2:
- add patches for replacing ip_tunnel_get_stats64
Requested additional migrations will come in a separate series.
v3:
- add atomic_long_t member rx_frame_errors in patch 3 for making
counter updates atomic
====================
Link: https://lore.kernel.org/r/99273e2f-c218-cd19-916e-9161d8ad8c56@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r-- | net/dsa/dsa.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 2131bf2b3a67..a1b1dc8a4d87 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -201,7 +201,6 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev, { struct dsa_port *cpu_dp = dev->dsa_ptr; struct sk_buff *nskb = NULL; - struct pcpu_sw_netstats *s; struct dsa_slave_priv *p; if (unlikely(!cpu_dp)) { @@ -234,11 +233,7 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev, skb = nskb; } - s = this_cpu_ptr(p->stats64); - u64_stats_update_begin(&s->syncp); - s->rx_packets++; - s->rx_bytes += skb->len; - u64_stats_update_end(&s->syncp); + dev_sw_netstats_rx_add(skb->dev, skb->len); if (dsa_skb_defer_rx_timestamp(p, skb)) return 0; |