diff options
author | Jiri Pirko <jiri@mellanox.com> | 2015-11-03 11:40:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-03 13:39:21 -0500 |
commit | 0c63d80c3fac4e6eb0f01dff756e47bc7cd50092 (patch) | |
tree | d9fc65ba40a8d6e3c444a29dab3ef37ad6c99c4a /net/switchdev | |
parent | 2a4f4176217d3a29176dff83f2647c48ebaa30a4 (diff) |
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: 464314ea6c11 ("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>
Diffstat (limited to 'net/switchdev')
-rw-r--r-- | net/switchdev/switchdev.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 6dfd19e52938..f34e535e93bd 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c | |||
@@ -225,8 +225,10 @@ static int __switchdev_port_attr_set(struct net_device *dev, | |||
225 | struct list_head *iter; | 225 | struct list_head *iter; |
226 | int err = -EOPNOTSUPP; | 226 | int err = -EOPNOTSUPP; |
227 | 227 | ||
228 | if (ops && ops->switchdev_port_attr_set) | 228 | if (ops && ops->switchdev_port_attr_set) { |
229 | return ops->switchdev_port_attr_set(dev, attr, trans); | 229 | err = ops->switchdev_port_attr_set(dev, attr, trans); |
230 | goto done; | ||
231 | } | ||
230 | 232 | ||
231 | if (attr->flags & SWITCHDEV_F_NO_RECURSE) | 233 | if (attr->flags & SWITCHDEV_F_NO_RECURSE) |
232 | goto done; | 234 | goto done; |
@@ -238,9 +240,6 @@ static int __switchdev_port_attr_set(struct net_device *dev, | |||
238 | 240 | ||
239 | netdev_for_each_lower_dev(dev, lower_dev, iter) { | 241 | netdev_for_each_lower_dev(dev, lower_dev, iter) { |
240 | err = __switchdev_port_attr_set(lower_dev, attr, trans); | 242 | err = __switchdev_port_attr_set(lower_dev, attr, trans); |
241 | if (err == -EOPNOTSUPP && | ||
242 | attr->flags & SWITCHDEV_F_SKIP_EOPNOTSUPP) | ||
243 | continue; | ||
244 | if (err) | 243 | if (err) |
245 | break; | 244 | break; |
246 | } | 245 | } |