diff mbox

net: dsa: Handle non-bridge master change

Message ID 1427296117-1805-1-git-send-email-linux@roeck-us.net
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Guenter Roeck March 25, 2015, 3:08 p.m. UTC
Master change notifications may occur other than when joining or
leaving a bridge, for example when being added to or removed from
a bond or Open vSwitch. In that case, do nothing instead of asking
the switch driver to remove a port from a bridge that it didn't join.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Modeled after 'rocker: handle non-bridge master change',
after confirming that the condition is seen on dsa interfaces.

 net/dsa/slave.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Florian Fainelli March 25, 2015, 5:09 p.m. UTC | #1
On 25/03/15 08:08, Guenter Roeck wrote:
> Master change notifications may occur other than when joining or
> leaving a bridge, for example when being added to or removed from
> a bond or Open vSwitch. In that case, do nothing instead of asking
> the switch driver to remove a port from a bridge that it didn't join.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
David Miller March 25, 2015, 6:07 p.m. UTC | #2
From: Guenter Roeck <linux@roeck-us.net>
Date: Wed, 25 Mar 2015 08:08:37 -0700

> Master change notifications may occur other than when joining or
> leaving a bridge, for example when being added to or removed from
> a bond or Open vSwitch. In that case, do nothing instead of asking
> the switch driver to remove a port from a bridge that it didn't join.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index f0af7aa331c1..39555f3f263b 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -830,12 +830,13 @@  static bool dsa_slave_dev_check(struct net_device *dev)
 static int dsa_slave_master_changed(struct net_device *dev)
 {
 	struct net_device *master = netdev_master_upper_dev_get(dev);
+	struct dsa_slave_priv *p = netdev_priv(dev);
 	int err = 0;
 
 	if (master && master->rtnl_link_ops &&
 	    !strcmp(master->rtnl_link_ops->kind, "bridge"))
 		err = dsa_slave_bridge_port_join(dev, master);
-	else
+	else if (dsa_port_is_bridged(p))
 		err = dsa_slave_bridge_port_leave(dev);
 
 	return err;