>From d81c15dda9fd84895caa67e4c187ad0b6b33af1f Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Thu, 21 Sep 2017 13:35:35 +1000 Subject: [PATCH] net: dsa: mv88e6xxx: fix first-use port breakage The very first time you configure a switch port for use - as a stand alone port - the interface cannot pass packets. If you configure the interface as part of a bridge it works. If you then remove it from the bridge and again try to use it as a stand alone port it will now work. Commit e5887a2a11094 ("net: dsa: mv88e6xxx: rework in-chip bridging") changes the switch initialization code and introduces the different behavior. To fix I changed the initialization behavior to make it similar to the older code for the case at system startup (before all data structures associated with this switch device have been fully setup). Signed-off-by: Greg Ungerer --- drivers/net/dsa/mv88e6xxx/chip.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 929b62c..38527e0 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -911,8 +911,11 @@ static u16 mv88e6xxx_port_vlan(struct mv88e6xxx_chip *chip, int dev, int port) u16 pvlan; int i; - if (dev < DSA_MAX_SWITCHES) + if (dev < DSA_MAX_SWITCHES) { ds = chip->ds->dst->ds[dev]; + if (ds == NULL) + ds = chip->ds; + } /* Prevent frames from unknown switch or port */ if (!ds || port >= ds->num_ports) -- 1.9.1