netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: Handle non-bridge master change
@ 2015-03-25 15:08 Guenter Roeck
  2015-03-25 17:09 ` Florian Fainelli
  2015-03-25 18:07 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2015-03-25 15:08 UTC (permalink / raw)
  To: David S. Miller
  Cc: Florian Fainelli, Andrew Lunn, Scott Feldman, netdev,
	Guenter Roeck

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(-)

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;
-- 
2.1.0

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

end of thread, other threads:[~2015-03-25 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-25 15:08 [PATCH] net: dsa: Handle non-bridge master change Guenter Roeck
2015-03-25 17:09 ` Florian Fainelli
2015-03-25 18:07 ` 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).