Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1333146 > unrolled thread

[PATCH RFC 2/3] net: bridge: set forwarding state on port removal

Started byVivien Didelot <vivien.didelot@savoirfairelinux.com>
First post2016-02-12 22:40 +0100
Last post2016-02-13 22:50 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH RFC 2/3] net: bridge: set forwarding state on port removal Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-02-12 22:40 +0100
    Re: [PATCH RFC 2/3] net: bridge: set forwarding state on port removal Ido Schimmel <idosch@mellanox.com> - 2016-02-13 22:00 +0100
      Re: [PATCH RFC 2/3] net: bridge: set forwarding state on port removal Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-02-13 22:50 +0100

#1333146 — [PATCH RFC 2/3] net: bridge: set forwarding state on port removal

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-02-12 22:40 +0100
Subject[PATCH RFC 2/3] net: bridge: set forwarding state on port removal
Message-ID<r1tBx-44h-17@gated-at.bofh.it>
When a port leaves a bridge, the bridge layer puts its STP state to
Disabled. If the port is part of an hardware switch, the mode needs to
be set to Forwarding in order to restore communication with the CPU.

Call br_set_state() in del_nbp(), which only affects switchdev users.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 net/bridge/br_if.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index c367b3e..93e7b24 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -251,6 +251,11 @@ static void del_nbp(struct net_bridge_port *p)
 
 	nbp_vlan_flush(p);
 	br_fdb_delete_by_port(br, p, 0, 1);
+
+	/* If the port is part of an hardware switch, set its STP state to
+	 * forwarding to restore communication with the CPU port.
+	 */
+	br_set_state(p, BR_STATE_FORWARDING);
 	switchdev_deferred_process();
 
 	nbp_update_port_count(br);
-- 
2.7.1

[toc] | [next] | [standalone]


#1333361

FromIdo Schimmel <idosch@mellanox.com>
Date2016-02-13 22:00 +0100
Message-ID<r1Psm-1ot-13@gated-at.bofh.it>
In reply to#1333146
Fri, Feb 12, 2016 at 11:34:19PM IST, vivien.didelot@savoirfairelinux.com wrote:

Hi Vivien,

>When a port leaves a bridge, the bridge layer puts its STP state to
>Disabled. If the port is part of an hardware switch, the mode needs to
>be set to Forwarding in order to restore communication with the CPU.
>
>Call br_set_state() in del_nbp(), which only affects switchdev users.
>
>Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
>---

If you have a LAG device in the bridge and one of the ports leaves the
LAG, then the bridge's teardown sequence isn't invoked and you need to
do the cleanup yourself, by calling your dsa_slave_bridge_port_leave()
function (just an example, I know you don't currently support this).

With this change, you'll have to call both the
dsa_slave_bridge_port_leave() function and dsa_slave_stp_update()
instead of always calling the same one when leaving a bridge.

Also, I think this kind of things should be done by drivers, as it's
specific to them. For example, in the case of a physical port, this
wouldn't benefit mlxsw at all, as STP state is a per-VLAN setting and
since VLANs were already flushed in nbp_vlan_flush(), then nothing would
happen.

Thanks!

> net/bridge/br_if.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
>index c367b3e..93e7b24 100644
>--- a/net/bridge/br_if.c
>+++ b/net/bridge/br_if.c
>@@ -251,6 +251,11 @@ static void del_nbp(struct net_bridge_port *p)
> 
> 	nbp_vlan_flush(p);
> 	br_fdb_delete_by_port(br, p, 0, 1);
>+
>+	/* If the port is part of an hardware switch, set its STP state to
>+	 * forwarding to restore communication with the CPU port.
>+	 */
>+	br_set_state(p, BR_STATE_FORWARDING);
> 	switchdev_deferred_process();
> 
> 	nbp_update_port_count(br);
>-- 
>2.7.1
>

[toc] | [prev] | [next] | [standalone]


#1333366

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-02-13 22:50 +0100
Message-ID<r1QeK-1UL-15@gated-at.bofh.it>
In reply to#1333361
Hi Ido,

Ido Schimmel <idosch@mellanox.com> writes:

> Fri, Feb 12, 2016 at 11:34:19PM IST, vivien.didelot@savoirfairelinux.com wrote:
>
> Hi Vivien,
>
>>When a port leaves a bridge, the bridge layer puts its STP state to
>>Disabled. If the port is part of an hardware switch, the mode needs to
>>be set to Forwarding in order to restore communication with the CPU.
>>
>>Call br_set_state() in del_nbp(), which only affects switchdev users.
>>
>>Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
>>---
>
> If you have a LAG device in the bridge and one of the ports leaves the
> LAG, then the bridge's teardown sequence isn't invoked and you need to
> do the cleanup yourself, by calling your dsa_slave_bridge_port_leave()
> function (just an example, I know you don't currently support this).
>
> With this change, you'll have to call both the
> dsa_slave_bridge_port_leave() function and dsa_slave_stp_update()
> instead of always calling the same one when leaving a bridge.
>
> Also, I think this kind of things should be done by drivers, as it's
> specific to them. For example, in the case of a physical port, this
> wouldn't benefit mlxsw at all, as STP state is a per-VLAN setting and
> since VLANs were already flushed in nbp_vlan_flush(), then nothing would
> happen.

Thanks for the explanation! I drop this RFC then.

Best,
-v

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web