Commit 567c5e13 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller
Browse files

net: core: dev: Add extack argument to dev_change_flags()



In order to pass extack together with NETDEV_PRE_UP notifications, it's
necessary to route the extack to __dev_open() from diverse (possibly
indirect) callers. One prominent API through which the notification is
invoked is dev_change_flags().

Therefore extend dev_change_flags() with and extra extack argument and
update all users. Most of the calls end up just encoding NULL, but
several sites (VLAN, ipvlan, VRF, rtnetlink) do have extack available.

Since the function declaration line is changed anyway, name the other
function arguments to placate checkpatch.

Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cf7686a0
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ int ipoib_open(struct net_device *dev)
			if (flags & IFF_UP)
				continue;

			dev_change_flags(cpriv->dev, flags | IFF_UP);
			dev_change_flags(cpriv->dev, flags | IFF_UP, NULL);
		}
		up_read(&priv->vlan_rwsem);
	}
@@ -207,7 +207,7 @@ static int ipoib_stop(struct net_device *dev)
			if (!(flags & IFF_UP))
				continue;

			dev_change_flags(cpriv->dev, flags & ~IFF_UP);
			dev_change_flags(cpriv->dev, flags & ~IFF_UP, NULL);
		}
		up_read(&priv->vlan_rwsem);
	}
@@ -1823,7 +1823,7 @@ static void ipoib_parent_unregister_pre(struct net_device *ndev)
	 * running ensures the it will not add more work.
	 */
	rtnl_lock();
	dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP);
	dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP, NULL);
	rtnl_unlock();

	/* ipoib_event() cannot be running once this returns */
+1 −1
Original line number Diff line number Diff line
@@ -1993,7 +1993,7 @@ static void __netvsc_vf_setup(struct net_device *ndev,
			    "unable to change mtu to %u\n", ndev->mtu);

	/* set multicast etc flags on VF */
	dev_change_flags(vf_netdev, ndev->flags | IFF_SLAVE);
	dev_change_flags(vf_netdev, ndev->flags | IFF_SLAVE, NULL);

	/* sync address list from ndev to VF */
	netif_addr_lock_bh(ndev);
+8 −4
Original line number Diff line number Diff line
@@ -85,10 +85,12 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval,
			flags = ipvlan->dev->flags;
			if (nval == IPVLAN_MODE_L3 || nval == IPVLAN_MODE_L3S) {
				err = dev_change_flags(ipvlan->dev,
						       flags | IFF_NOARP);
						       flags | IFF_NOARP,
						       extack);
			} else {
				err = dev_change_flags(ipvlan->dev,
						       flags & ~IFF_NOARP);
						       flags & ~IFF_NOARP,
						       extack);
			}
			if (unlikely(err))
				goto fail;
@@ -117,9 +119,11 @@ fail:
		flags = ipvlan->dev->flags;
		if (port->mode == IPVLAN_MODE_L3 ||
		    port->mode == IPVLAN_MODE_L3S)
			dev_change_flags(ipvlan->dev, flags | IFF_NOARP);
			dev_change_flags(ipvlan->dev, flags | IFF_NOARP,
					 NULL);
		else
			dev_change_flags(ipvlan->dev, flags & ~IFF_NOARP);
			dev_change_flags(ipvlan->dev, flags & ~IFF_NOARP,
					 NULL);
	}

	return err;
+2 −2
Original line number Diff line number Diff line
@@ -756,9 +756,9 @@ static void cycle_netdev(struct net_device *dev,
	if (!netif_running(dev))
		return;

	ret = dev_change_flags(dev, flags & ~IFF_UP);
	ret = dev_change_flags(dev, flags & ~IFF_UP, extack);
	if (ret >= 0)
		ret = dev_change_flags(dev, flags);
		ret = dev_change_flags(dev, flags, extack);

	if (ret < 0) {
		netdev_err(dev,
+2 −1
Original line number Diff line number Diff line
@@ -3612,7 +3612,8 @@ int dev_ifconf(struct net *net, struct ifconf *, int);
int dev_ethtool(struct net *net, struct ifreq *);
unsigned int dev_get_flags(const struct net_device *);
int __dev_change_flags(struct net_device *, unsigned int flags);
int dev_change_flags(struct net_device *, unsigned int);
int dev_change_flags(struct net_device *dev, unsigned int flags,
		     struct netlink_ext_ack *extack);
void __dev_notify_flags(struct net_device *, unsigned int old_flags,
			unsigned int gchanges);
int dev_change_name(struct net_device *, const char *);
Loading