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

Commit 043b8413 authored by Vlad Buslov's avatar Vlad Buslov Committed by Jakub Kicinski
Browse files

net: devlink: remove redundant rtnl lock assert



It is enough for caller of devlink_compat_switch_id_get() to hold the net
device to guarantee that devlink port is not destroyed concurrently. Remove
rtnl lock assertion and modify comment to warn user that they must hold
either rtnl lock or reference to net device. This is necessary to
accommodate future implementation of rtnl-unlocked TC offloads driver
callbacks.

Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
parent 708852dc
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -6939,11 +6939,10 @@ int devlink_compat_switch_id_get(struct net_device *dev,
{
	struct devlink_port *devlink_port;

	/* RTNL mutex is held here which ensures that devlink_port
	 * instance cannot disappear in the middle. No need to take
	/* Caller must hold RTNL mutex or reference to dev, which ensures that
	 * devlink_port instance cannot disappear in the middle. No need to take
	 * any devlink lock as only permanent values are accessed.
	 */
	ASSERT_RTNL();
	devlink_port = netdev_to_devlink_port(dev);
	if (!devlink_port || !devlink_port->attrs.switch_port)
		return -EOPNOTSUPP;