2015-07-11 06:59:25

by Vivien Didelot

[permalink] [raw]
Subject: [PATCH] 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 <[email protected]>
---
net/switchdev/switchdev.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 84f77a0..9f2add3 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;
}
--
2.4.5


2015-07-11 09:55:55

by Jiri Pirko

[permalink] [raw]
Subject: Re: [PATCH] net: switchdev: don't abort unsupported operations

Sat, Jul 11, 2015 at 01:48:58AM CEST, [email protected] wrote:
>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 <[email protected]>

Sounds reasonable.

Acked-by: Jiri Pirko <[email protected]>

2015-07-11 17:10:48

by Scott Feldman

[permalink] [raw]
Subject: Re: [PATCH] net: switchdev: don't abort unsupported operations

On Fri, Jul 10, 2015 at 4:48 PM, Vivien Didelot
<[email protected]> wrote:
> 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 <[email protected]>

Acked-by: Scott Feldman <[email protected]>

2015-07-12 04:30:37

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] net: switchdev: don't abort unsupported operations

From: Vivien Didelot <[email protected]>
Date: Fri, 10 Jul 2015 19:48:58 -0400

> 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 <[email protected]>

Applied, thanks.