linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bridge: Allow set bridge ageing time when switchdev disabled
@ 2016-03-29 10:48 Haishuang Yan
  2016-03-29 21:34 ` Ido Schimmel
  2016-03-30 19:40 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Haishuang Yan @ 2016-03-29 10:48 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller
  Cc: bridge, netdev, linux-kernel, Haishuang Yan

When NET_SWITCHDEV=n, switchdev_port_attr_set will return -EOPNOTSUPP,
we should ignore this error code and continue to set the ageing time.

Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
---
 net/bridge/br_stp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index e234490..9cb7044 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -582,7 +582,7 @@ int br_set_ageing_time(struct net_bridge *br, u32 ageing_time)
 	int err;
 
 	err = switchdev_port_attr_set(br->dev, &attr);
-	if (err)
+	if (err && err != -EOPNOTSUPP)
 		return err;
 
 	br->ageing_time = t;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bridge: Allow set bridge ageing time when switchdev disabled
  2016-03-29 10:48 [PATCH] bridge: Allow set bridge ageing time when switchdev disabled Haishuang Yan
@ 2016-03-29 21:34 ` Ido Schimmel
  2016-03-30 19:40 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2016-03-29 21:34 UTC (permalink / raw)
  To: Haishuang Yan
  Cc: Stephen Hemminger, David S. Miller, bridge, netdev, linux-kernel, jiri

Tue, Mar 29, 2016 at 01:48:08PM IDT, yanhaishuang@cmss.chinamobile.com wrote:
>When NET_SWITCHDEV=n, switchdev_port_attr_set will return -EOPNOTSUPP,
>we should ignore this error code and continue to set the ageing time.
>
>Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

Fixes: c62987bbd8a1 ("bridge: push bridge setting ageing_time down to switchdev")
Acked-by: Ido Schimmel <idosch@mellanox.com>

Thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bridge: Allow set bridge ageing time when switchdev disabled
  2016-03-29 10:48 [PATCH] bridge: Allow set bridge ageing time when switchdev disabled Haishuang Yan
  2016-03-29 21:34 ` Ido Schimmel
@ 2016-03-30 19:40 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-03-30 19:40 UTC (permalink / raw)
  To: yanhaishuang; +Cc: stephen, bridge, netdev, linux-kernel

From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Date: Tue, 29 Mar 2016 18:48:08 +0800

> When NET_SWITCHDEV=n, switchdev_port_attr_set will return -EOPNOTSUPP,
> we should ignore this error code and continue to set the ageing time.
> 
> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

Applied and queued up for -stable, thanks.

> @@ -582,7 +582,7 @@ int br_set_ageing_time(struct net_bridge *br, u32 ageing_time)
>  	int err;
>  
>  	err = switchdev_port_attr_set(br->dev, &attr);
> -	if (err)
> +	if (err && err != -EOPNOTSUPP)
>  		return err;
>  
>  	br->ageing_time = t;

This is at least the 5th time I've had to apply a bug fix exactly like
this one.

If this doesn't convince everyone that this whole -EOPNOTSUPP
mechanism is extremely error prone, I don't know what will.

There should be only one or two strictly controlled locations that
reinterpret the return value from all of these routines that have this
special way of signalling lack of switchdev support via -EOPNOTSUPP.

It can't be spread all over the place like this, it simply does NOT work.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-30 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-29 10:48 [PATCH] bridge: Allow set bridge ageing time when switchdev disabled Haishuang Yan
2016-03-29 21:34 ` Ido Schimmel
2016-03-30 19:40 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).