Skip to content

Commit

Permalink
net: switchdev: don't abort unsupported operations
Browse files Browse the repository at this point in the history
There is no need to abort attribute setting or object addition, if the
prepare phase returned operation not supported.

Thus, abort these two transactions only if the error is not -EOPNOTSUPP.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vivien Didelot authored and David S. Miller committed Jul 12, 2015
1 parent c590032 commit 2ee9401
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions net/switchdev/switchdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ int switchdev_port_attr_set(struct net_device *dev, struct switchdev_attr *attr)
* released.
*/

attr->trans = SWITCHDEV_TRANS_ABORT;
__switchdev_port_attr_set(dev, attr);
if (err != -EOPNOTSUPP) {
attr->trans = SWITCHDEV_TRANS_ABORT;
__switchdev_port_attr_set(dev, attr);
}

return err;
}
Expand Down Expand Up @@ -249,8 +251,10 @@ int switchdev_port_obj_add(struct net_device *dev, struct switchdev_obj *obj)
* released.
*/

obj->trans = SWITCHDEV_TRANS_ABORT;
__switchdev_port_obj_add(dev, obj);
if (err != -EOPNOTSUPP) {
obj->trans = SWITCHDEV_TRANS_ABORT;
__switchdev_port_obj_add(dev, obj);
}

return err;
}
Expand Down

0 comments on commit 2ee9401

Please sign in to comment.