Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef2df7fc authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'Pass-extack-to-NETDEV_PRE_UP'



Petr Machata says:

====================
Pass extack to NETDEV_PRE_UP

Drivers may need to validate configuration of a device that's about to
be upped. An example is mlxsw, which needs to check the configuration of
a VXLAN device attached to an offloaded bridge. Should the validation
fail, there's currently no way to communicate details of the failure to
the user, beyond an error number.

Therefore this patch set extends the NETDEV_PRE_UP event to include
extack, if available.

There are three vectors through which NETDEV_PRE_UP invocation can be
reached. The two major ones are dev_open() and dev_change_flags(), the
last is then __dev_change_flags().

In patch #1, the first access vector, dev_open() is addressed. An extack
parameter is added and all users converted to use it.

Before addressing the second vector, two preparatory patches propagate
extack argument to the proximity of the dev_change_flags() call in VRF
and IPVLAN drivers. That happens in patches #2 and #3. Then in patch #4,
dev_change_flags() is treated similarly to dev_open().

Likewise in patch #5, __dev_change_flags() is extended.

Then in patches #6 and #7, the extack is finally propagated all the way
to the point where the notification is emitted.

This change allows particularly mlxsw (which already has code to
leverage extack if available) to communicate to the user error messages
regarding VXLAN configuration. In patch #8, add a test case that
exercises this code and checks that an error message is propagated.

For example:

	local 192.0.2.17 remote 192.0.2.18 \
	dstport 4789 nolearning noudpcsum tos inherit ttl 100
	local 192.0.2.17 remote 192.0.2.18 \
	dstport 4789 nolearning noudpcsum tos inherit ttl 100
Error: mlxsw_spectrum: Conflicting NVE tunnels configuration.

v2:
- Add David Ahern's tags.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents fdb8b298 1ba1daed
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
@@ -1538,7 +1538,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
	slave_dev->flags |= IFF_SLAVE;

	/* open the slave since the application closed it */
	res = dev_open(slave_dev);
	res = dev_open(slave_dev, extack);
	if (res) {
		netdev_dbg(bond_dev, "Opening slave %s failed\n", slave_dev->name);
		goto err_restore_mac;
+1 −1
Original line number Diff line number Diff line
@@ -525,7 +525,7 @@ static int aq_set_ringparam(struct net_device *ndev,
		}
	}
	if (ndev_running)
		err = dev_open(ndev);
		err = dev_open(ndev, NULL);

err_exit:
	return err;
+1 −1
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ static int enic_set_ringparam(struct net_device *netdev,
	}
	enic_init_vnic_resources(enic);
	if (running) {
		err = dev_open(netdev);
		err = dev_open(netdev, NULL);
		if (err)
			goto err_out;
	}
+1 −1
Original line number Diff line number Diff line
@@ -624,7 +624,7 @@ static void hns_nic_self_test(struct net_device *ndev,
		clear_bit(NIC_STATE_TESTING, &priv->state);

		if (if_running)
			(void)dev_open(ndev);
			(void)dev_open(ndev, NULL);
	}
	/* Online tests aren't run; pass by default */

Loading