Skip to content

Commit 0c63d80

Browse files
jpirkodavem330
authored andcommitted
switchdev: respect SKIP_EOPNOTSUPP flag in case there is no recursion
Caller passing down the SKIP_EOPNOTSUPP switchdev flag expects that -EOPNOTSUPP cannot be returned. But in case of direct op call without recurtion, this may happen. So fix this by checking it always on the end of __switchdev_port_attr_set function. Fixes: 464314e ("switchdev: skip over ports returning -EOPNOTSUPP when recursing ports") Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2a4f417 commit 0c63d80

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

net/switchdev/switchdev.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,10 @@ static int __switchdev_port_attr_set(struct net_device *dev,
225225
struct list_head *iter;
226226
int err = -EOPNOTSUPP;
227227

228-
if (ops && ops->switchdev_port_attr_set)
229-
return ops->switchdev_port_attr_set(dev, attr, trans);
228+
if (ops && ops->switchdev_port_attr_set) {
229+
err = ops->switchdev_port_attr_set(dev, attr, trans);
230+
goto done;
231+
}
230232

231233
if (attr->flags & SWITCHDEV_F_NO_RECURSE)
232234
goto done;
@@ -238,9 +240,6 @@ static int __switchdev_port_attr_set(struct net_device *dev,
238240

239241
netdev_for_each_lower_dev(dev, lower_dev, iter) {
240242
err = __switchdev_port_attr_set(lower_dev, attr, trans);
241-
if (err == -EOPNOTSUPP &&
242-
attr->flags & SWITCHDEV_F_SKIP_EOPNOTSUPP)
243-
continue;
244243
if (err)
245244
break;
246245
}

0 commit comments

Comments
 (0)