Commit c353c7b7 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net-device: move lstats in net_device_read_txrx

dev->lstats is notably used from loopback ndo_start_xmit()
and other virtual drivers.

Per cpu stats updates are dirtying per-cpu data,
but the pointer itself is read-only.

Fixes: 43a71cd6 ("net-device: reorganize net_device fast path variables")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Coco Li <lixiaoyan@google.com>
Cc: Simon Horman <horms@kernel.org>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 666a877d
...@@ -136,8 +136,8 @@ struct_netpoll_info* npinfo - ...@@ -136,8 +136,8 @@ struct_netpoll_info* npinfo -
possible_net_t nd_net - read_mostly (dev_net)napi_busy_loop,tcp_v(4/6)_rcv,ip(v6)_rcv,ip(6)_input,ip(6)_input_finish possible_net_t nd_net - read_mostly (dev_net)napi_busy_loop,tcp_v(4/6)_rcv,ip(v6)_rcv,ip(6)_input,ip(6)_input_finish
void* ml_priv void* ml_priv
enum_netdev_ml_priv_type ml_priv_type enum_netdev_ml_priv_type ml_priv_type
struct_pcpu_lstats__percpu* lstats struct_pcpu_lstats__percpu* lstats read_mostly dev_lstats_add()
struct_pcpu_sw_netstats__percpu* tstats struct_pcpu_sw_netstats__percpu* tstats read_mostly dev_sw_netstats_tx_add()
struct_pcpu_dstats__percpu* dstats struct_pcpu_dstats__percpu* dstats
struct_garp_port* garp_port struct_garp_port* garp_port
struct_mrp_port* mrp_port struct_mrp_port* mrp_port
......
...@@ -2141,6 +2141,11 @@ struct net_device { ...@@ -2141,6 +2141,11 @@ struct net_device {
/* TXRX read-mostly hotpath */ /* TXRX read-mostly hotpath */
__cacheline_group_begin(net_device_read_txrx); __cacheline_group_begin(net_device_read_txrx);
union {
struct pcpu_lstats __percpu *lstats;
struct pcpu_sw_netstats __percpu *tstats;
struct pcpu_dstats __percpu *dstats;
};
unsigned int flags; unsigned int flags;
unsigned short hard_header_len; unsigned short hard_header_len;
netdev_features_t features; netdev_features_t features;
...@@ -2395,11 +2400,6 @@ struct net_device { ...@@ -2395,11 +2400,6 @@ struct net_device {
enum netdev_ml_priv_type ml_priv_type; enum netdev_ml_priv_type ml_priv_type;
enum netdev_stat_type pcpu_stat_type:8; enum netdev_stat_type pcpu_stat_type:8;
union {
struct pcpu_lstats __percpu *lstats;
struct pcpu_sw_netstats __percpu *tstats;
struct pcpu_dstats __percpu *dstats;
};
#if IS_ENABLED(CONFIG_GARP) #if IS_ENABLED(CONFIG_GARP)
struct garp_port __rcu *garp_port; struct garp_port __rcu *garp_port;
......
...@@ -11652,11 +11652,12 @@ static void __init net_dev_struct_check(void) ...@@ -11652,11 +11652,12 @@ static void __init net_dev_struct_check(void)
CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_tx, 160); CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_tx, 160);
/* TXRX read-mostly hotpath */ /* TXRX read-mostly hotpath */
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, lstats);
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, flags); CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, flags);
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, hard_header_len); CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, hard_header_len);
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, features); CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, features);
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, ip6_ptr); CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, ip6_ptr);
CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_txrx, 30); CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_txrx, 38);
/* RX read-mostly hotpath */ /* RX read-mostly hotpath */
CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_rx, ptype_specific); CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_rx, ptype_specific);
......
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