summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivien Didelot2015-07-11 01:48:58 +0200
committerDavid S. Miller2015-07-12 06:29:55 +0200
commit2ee94014d9bd3868b1c0d17405f96d63bec83f28 (patch)
treec3de5eb5e5eac625aab00c7bb23b885b6b6eb244
parentnet: bcmgenet: fix accounting of packet drops vs errors (diff)
downloadkernel-qcow2-linux-2ee94014d9bd3868b1c0d17405f96d63bec83f28.tar.gz
kernel-qcow2-linux-2ee94014d9bd3868b1c0d17405f96d63bec83f28.tar.xz
kernel-qcow2-linux-2ee94014d9bd3868b1c0d17405f96d63bec83f28.zip
net: switchdev: don't abort unsupported operations
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>
-rw-r--r--net/switchdev/switchdev.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 84f77a054025..9f2add3cba26 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -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;
}
@@ -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;
}