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

rtnetlink: prepare nla_put_iflink() to run under RCU



We want to be able to run rtnl_fill_ifinfo() under RCU protection
instead of RTNL in the future.

This patch prepares dev_get_iflink() and nla_put_iflink()
to run either with RTNL or RCU held.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5f6000aa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1272,10 +1272,10 @@ static int ipoib_get_iflink(const struct net_device *dev)

	/* parent interface */
	if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags))
		return dev->ifindex;
		return READ_ONCE(dev->ifindex);

	/* child/vlan interface */
	return priv->parent->ifindex;
	return READ_ONCE(priv->parent->ifindex);
}

static u32 ipoib_addr_hash(struct ipoib_neigh_hash *htbl, u8 *daddr)
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static int vxcan_get_iflink(const struct net_device *dev)

	rcu_read_lock();
	peer = rcu_dereference(priv->peer);
	iflink = peer ? peer->ifindex : 0;
	iflink = peer ? READ_ONCE(peer->ifindex) : 0;
	rcu_read_unlock();

	return iflink;
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ static int rmnet_vnd_get_iflink(const struct net_device *dev)
{
	struct rmnet_priv *priv = netdev_priv(dev);

	return priv->real_dev->ifindex;
	return READ_ONCE(priv->real_dev->ifindex);
}

static int rmnet_vnd_init(struct net_device *dev)
+1 −1
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ static int ipvlan_get_iflink(const struct net_device *dev)
{
	struct ipvl_dev *ipvlan = netdev_priv(dev);

	return ipvlan->phy_dev->ifindex;
	return READ_ONCE(ipvlan->phy_dev->ifindex);
}

static const struct net_device_ops ipvlan_netdev_ops = {
+1 −1
Original line number Diff line number Diff line
@@ -3753,7 +3753,7 @@ static void macsec_get_stats64(struct net_device *dev,

static int macsec_get_iflink(const struct net_device *dev)
{
	return macsec_priv(dev)->real_dev->ifindex;
	return READ_ONCE(macsec_priv(dev)->real_dev->ifindex);
}

static const struct net_device_ops macsec_netdev_ops = {
Loading