diff options
author | Eric Dumazet <edumazet@google.com> | 2021-11-19 07:43:31 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-11-22 12:49:42 +0000 |
commit | 4b66d2161b8125b6caa6971815e85631cf3cf36f (patch) | |
tree | 10eeca9981b607abc9fe4801577a1434826ddfa6 /net | |
parent | 8e2a2f90511aec3e076ecfac6de3bd96737f2282 (diff) |
net: annotate accesses to dev->gso_max_size
dev->gso_max_size is written under RTNL protection, or when the device is
not yet visible, but is read locklessly.
Add the READ_ONCE()/WRITE_ONCE() pairs, and use netif_set_gso_max_size()
where we can to better document what is going on.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/8021q/vlan.c | 2 | ||||
-rw-r--r-- | net/8021q/vlan_dev.c | 2 | ||||
-rw-r--r-- | net/bridge/br_if.c | 2 | ||||
-rw-r--r-- | net/core/sock.c | 3 | ||||
-rw-r--r-- | net/sctp/output.c | 2 |
5 files changed, 6 insertions, 5 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index a3a0a5e994f5..34c0ffa81e5f 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -322,7 +322,7 @@ static void vlan_transfer_features(struct net_device *dev, { struct vlan_dev_priv *vlan = vlan_dev_priv(vlandev); - vlandev->gso_max_size = dev->gso_max_size; + netif_set_gso_max_size(vlandev, dev->gso_max_size); vlandev->gso_max_segs = dev->gso_max_segs; if (vlan_hw_offload_capable(dev->features, vlan->vlan_proto)) diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index ab6dee28536d..208f6845f6dd 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -573,7 +573,7 @@ static int vlan_dev_init(struct net_device *dev) NETIF_F_ALL_FCOE; dev->features |= dev->hw_features | NETIF_F_LLTX; - dev->gso_max_size = real_dev->gso_max_size; + netif_set_gso_max_size(dev, real_dev->gso_max_size); dev->gso_max_segs = real_dev->gso_max_segs; if (dev->features & NETIF_F_VLAN_FEATURES) netdev_warn(real_dev, "VLAN features are set incorrectly. Q-in-Q configurations may not work correctly.\n"); diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 64b2d4fb50f5..d3e1c2276551 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -525,7 +525,7 @@ static void br_set_gso_limits(struct net_bridge *br) gso_max_size = min(gso_max_size, p->dev->gso_max_size); gso_max_segs = min(gso_max_segs, p->dev->gso_max_segs); } - br->dev->gso_max_size = gso_max_size; + netif_set_gso_max_size(br->dev, gso_max_size); br->dev->gso_max_segs = gso_max_segs; } diff --git a/net/core/sock.c b/net/core/sock.c index 1f9be266e586..4418e2a07c34 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2257,7 +2257,8 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst) sk->sk_route_caps &= ~NETIF_F_GSO_MASK; } else { sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; - sk->sk_gso_max_size = dst->dev->gso_max_size; + /* pairs with the WRITE_ONCE() in netif_set_gso_max_size() */ + sk->sk_gso_max_size = READ_ONCE(dst->dev->gso_max_size); max_segs = max_t(u32, dst->dev->gso_max_segs, 1); } } diff --git a/net/sctp/output.c b/net/sctp/output.c index cdfdbd353c67..72fe6669c50d 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c @@ -134,7 +134,7 @@ void sctp_packet_config(struct sctp_packet *packet, __u32 vtag, dst_hold(tp->dst); sk_setup_caps(sk, tp->dst); } - packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size + packet->max_size = sk_can_gso(sk) ? READ_ONCE(tp->dst->dev->gso_max_size) : asoc->pathmtu; rcu_read_unlock(); } |