net: add per-cpu storage and net->core_stats
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2130850 Conflicts: - drivers/net/vxlan.c: file is not moved to drivers/net/vxlan/vxlan_core.c due to missing 67653936 ("vxlan: move to its own directory"); context difference due to missing 4095e0e1 ("drivers: vxlan: vnifilter: per vni stats") - net/core/dev.c: code difference in __netif_receive_skb_core due to already applied 9f8ed577 ("net: skb: rename SKB_DROP_REASON_PTYPE_ABSENT"). Result is like upstream now. - net/core/gro_cells.c: context difference due to already applied 5dcd08cd ("net: Fix data-races around netdev_max_backlog.") commit 625788b5 Author: Eric Dumazet <edumazet@google.com> Date: Thu Mar 10 21:14:20 2022 -0800 net: add per-cpu storage and net->core_stats Before adding yet another possibly contended atomic_long_t, it is time to add per-cpu storage for existing ones: dev->tx_dropped, dev->rx_dropped, and dev->rx_nohandler Because many devices do not have to increment such counters, allocate the per-cpu storage on demand, so that dev_get_stats() does not have to spend considerable time folding zero counters. Note that some drivers have abused these counters which were supposed to be only used by core networking stack. v4: should use per_cpu_ptr() in dev_get_stats() (Jakub) v3: added a READ_ONCE() in netdev_core_stats_alloc() (Paolo) v2: add a missing include (reported by kernel test robot <lkp@intel.com>) Change in netdev_core_stats_alloc() (Jakub) Signed-off-by:Eric Dumazet <edumazet@google.com> Cc: jeffreyji <jeffreyji@google.com> Reviewed-by:
Brian Vazquez <brianvv@google.com> Reviewed-by:
Jakub Kicinski <kuba@kernel.org> Acked-by:
Paolo Abeni <pabeni@redhat.com> Link: https://lore.kernel.org/r/20220311051420.2608812-1-eric.dumazet@gmail.com Signed-off-by:
Jakub Kicinski <kuba@kernel.org> Signed-off-by:
Felix Maurer <fmaurer@redhat.com>
Showing
- drivers/net/bonding/bond_main.c 1 addition, 1 deletiondrivers/net/bonding/bond_main.c
- drivers/net/ethernet/broadcom/bnxt/bnxt.c 2 additions, 2 deletionsdrivers/net/ethernet/broadcom/bnxt/bnxt.c
- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c 2 additions, 2 deletionsdrivers/net/ethernet/hisilicon/hns/hns_ethtool.c
- drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c 1 addition, 1 deletiondrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
- drivers/net/ipvlan/ipvlan_core.c 1 addition, 1 deletiondrivers/net/ipvlan/ipvlan_core.c
- drivers/net/macvlan.c 1 addition, 1 deletiondrivers/net/macvlan.c
- drivers/net/net_failover.c 1 addition, 1 deletiondrivers/net/net_failover.c
- drivers/net/tun.c 8 additions, 8 deletionsdrivers/net/tun.c
- drivers/net/vxlan.c 1 addition, 1 deletiondrivers/net/vxlan.c
- include/linux/netdevice.h 37 additions, 9 deletionsinclude/linux/netdevice.h
- include/net/bonding.h 1 addition, 1 deletioninclude/net/bonding.h
- net/core/dev.c 42 additions, 9 deletionsnet/core/dev.c
- net/core/gro_cells.c 1 addition, 1 deletionnet/core/gro_cells.c
- net/hsr/hsr_device.c 1 addition, 1 deletionnet/hsr/hsr_device.c
- net/xfrm/xfrm_device.c 1 addition, 1 deletionnet/xfrm/xfrm_device.c
Loading
Please register or sign in to comment