Skip to content

Commit 2ee9401

Browse files
viviendavem330
authored andcommitted
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>
1 parent c590032 commit 2ee9401

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

net/switchdev/switchdev.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ int switchdev_port_attr_set(struct net_device *dev, struct switchdev_attr *attr)
171171
* released.
172172
*/
173173

174-
attr->trans = SWITCHDEV_TRANS_ABORT;
175-
__switchdev_port_attr_set(dev, attr);
174+
if (err != -EOPNOTSUPP) {
175+
attr->trans = SWITCHDEV_TRANS_ABORT;
176+
__switchdev_port_attr_set(dev, attr);
177+
}
176178

177179
return err;
178180
}
@@ -249,8 +251,10 @@ int switchdev_port_obj_add(struct net_device *dev, struct switchdev_obj *obj)
249251
* released.
250252
*/
251253

252-
obj->trans = SWITCHDEV_TRANS_ABORT;
253-
__switchdev_port_obj_add(dev, obj);
254+
if (err != -EOPNOTSUPP) {
255+
obj->trans = SWITCHDEV_TRANS_ABORT;
256+
__switchdev_port_obj_add(dev, obj);
257+
}
254258

255259
return err;
256260
}

0 commit comments

Comments
 (0)