Commit 6d872df3 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

net: annotate accesses to dev->gso_max_segs



dev->gso_max_segs is written under RTNL protection, or when the device is
not yet visible, but is read locklessly.

Add netif_set_gso_max_segs() helper.

Add the READ_ONCE()/WRITE_ONCE() pairs, and use netif_set_gso_max_segs()
where we can to better document what is going on.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4b66d216
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1460,7 +1460,7 @@ static void bond_compute_features(struct bonding *bond)
	bond_dev->hw_enc_features |= xfrm_features;
#endif /* CONFIG_XFRM_OFFLOAD */
	bond_dev->mpls_features = mpls_features;
	bond_dev->gso_max_segs = gso_max_segs;
	netif_set_gso_max_segs(bond_dev, gso_max_segs);
	netif_set_gso_max_size(bond_dev, gso_max_size);

	bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
+1 −1
Original line number Diff line number Diff line
@@ -3558,7 +3558,7 @@ static int fec_enet_init(struct net_device *ndev)
		ndev->features |= NETIF_F_HW_VLAN_CTAG_RX;

	if (fep->quirks & FEC_QUIRK_HAS_CSUM) {
		ndev->gso_max_segs = FEC_MAX_TSO_SEGS;
		netif_set_gso_max_segs(ndev, FEC_MAX_TSO_SEGS);

		/* enable hw accelerator */
		ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM
+1 −1
Original line number Diff line number Diff line
@@ -3201,7 +3201,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
	dev->hw_features = dev->features;

	dev->priv_flags |= IFF_UNICAST_FLT;
	dev->gso_max_segs = MV643XX_MAX_TSO_SEGS;
	netif_set_gso_max_segs(dev, MV643XX_MAX_TSO_SEGS);

	/* MTU range: 64 - 9500 */
	dev->min_mtu = 64;
+1 −1
Original line number Diff line number Diff line
@@ -5335,7 +5335,7 @@ static int mvneta_probe(struct platform_device *pdev)
	dev->hw_features |= dev->features;
	dev->vlan_features |= dev->features;
	dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
	dev->gso_max_segs = MVNETA_MAX_TSO_SEGS;
	netif_set_gso_max_segs(dev, MVNETA_MAX_TSO_SEGS);

	/* MTU range: 68 - 9676 */
	dev->min_mtu = ETH_MIN_MTU;
+1 −1
Original line number Diff line number Diff line
@@ -6857,7 +6857,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
		mvpp2_set_hw_csum(port, port->pool_long->id);

	dev->vlan_features |= features;
	dev->gso_max_segs = MVPP2_MAX_TSO_SEGS;
	netif_set_gso_max_segs(dev, MVPP2_MAX_TSO_SEGS);
	dev->priv_flags |= IFF_UNICAST_FLT;

	/* MTU range: 68 - 9704 */
Loading