Selaa lähdekoodia

net: dsa: mv88e6xxx: remap existing bridge members

When a local port of a switch chip becomes a member of a bridge group,
we need to reprogram the Cross-chip Port Based VLAN Table (PVT) to allow
existing cross-chip bridge members to egress frames on the new ports.

There is no functional changes yet, since the PVT is still programmed
with all ones, allowing any external port to egress frames locally.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Vivien Didelot 8 vuotta sitten
vanhempi
commit
e96a6e0275
1 muutettua tiedostoa jossa 20 lisäystä ja 0 poistoa
  1. 20 0
      drivers/net/dsa/mv88e6xxx/chip.c

+ 20 - 0
drivers/net/dsa/mv88e6xxx/chip.c

@@ -2143,7 +2143,9 @@ static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port,
 static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip,
 static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip,
 				struct net_device *br)
 				struct net_device *br)
 {
 {
+	struct dsa_switch *ds;
 	int port;
 	int port;
+	int dev;
 	int err;
 	int err;
 
 
 	/* Remap the Port VLAN of each local bridge group member */
 	/* Remap the Port VLAN of each local bridge group member */
@@ -2155,6 +2157,24 @@ static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip,
 		}
 		}
 	}
 	}
 
 
+	if (!mv88e6xxx_has_pvt(chip))
+		return 0;
+
+	/* Remap the Port VLAN of each cross-chip bridge group member */
+	for (dev = 0; dev < DSA_MAX_SWITCHES; ++dev) {
+		ds = chip->ds->dst->ds[dev];
+		if (!ds)
+			break;
+
+		for (port = 0; port < ds->num_ports; ++port) {
+			if (ds->ports[port].bridge_dev == br) {
+				err = mv88e6xxx_pvt_map(chip, dev, port);
+				if (err)
+					return err;
+			}
+		}
+	}
+
 	return 0;
 	return 0;
 }
 }