Skip to content

Commit aec5ac8

Browse files
viviendavem330
authored andcommitted
net: dsa: mv88e6xxx: add cross-chip bridging
Implement the DSA cross-chip bridging operations by remapping the local ports an external source port can egress frames to, when this cross-chip port joins or leaves a bridge. The PVT is no longer configured with all ones allowing any external frame to egress any local port. Only DSA and CPU ports, as well as bridge group members, can egress frames on local ports. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 40ef2c9 commit aec5ac8

File tree

1 file changed

+33
-1
lines changed
  • drivers/net/dsa/mv88e6xxx

1 file changed

+33
-1
lines changed

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ static int mv88e6xxx_pvt_map(struct mv88e6xxx_chip *chip, int dev, int port)
12221222

12231223
/* Skip the local source device, which uses in-chip port VLAN */
12241224
if (dev != chip->ds->index)
1225-
pvlan = mv88e6xxx_port_mask(chip);
1225+
pvlan = mv88e6xxx_port_vlan(chip, dev, port);
12261226

12271227
return mv88e6xxx_g2_pvt_write(chip, dev, port, pvlan);
12281228
}
@@ -2203,6 +2203,36 @@ static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port,
22032203
mutex_unlock(&chip->reg_lock);
22042204
}
22052205

2206+
static int mv88e6xxx_crosschip_bridge_join(struct dsa_switch *ds, int dev,
2207+
int port, struct net_device *br)
2208+
{
2209+
struct mv88e6xxx_chip *chip = ds->priv;
2210+
int err;
2211+
2212+
if (!mv88e6xxx_has_pvt(chip))
2213+
return 0;
2214+
2215+
mutex_lock(&chip->reg_lock);
2216+
err = mv88e6xxx_pvt_map(chip, dev, port);
2217+
mutex_unlock(&chip->reg_lock);
2218+
2219+
return err;
2220+
}
2221+
2222+
static void mv88e6xxx_crosschip_bridge_leave(struct dsa_switch *ds, int dev,
2223+
int port, struct net_device *br)
2224+
{
2225+
struct mv88e6xxx_chip *chip = ds->priv;
2226+
2227+
if (!mv88e6xxx_has_pvt(chip))
2228+
return;
2229+
2230+
mutex_lock(&chip->reg_lock);
2231+
if (mv88e6xxx_pvt_map(chip, dev, port))
2232+
dev_err(ds->dev, "failed to remap cross-chip Port VLAN\n");
2233+
mutex_unlock(&chip->reg_lock);
2234+
}
2235+
22062236
static int mv88e6xxx_software_reset(struct mv88e6xxx_chip *chip)
22072237
{
22082238
if (chip->info->ops->reset)
@@ -4313,6 +4343,8 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
43134343
.port_mdb_add = mv88e6xxx_port_mdb_add,
43144344
.port_mdb_del = mv88e6xxx_port_mdb_del,
43154345
.port_mdb_dump = mv88e6xxx_port_mdb_dump,
4346+
.crosschip_bridge_join = mv88e6xxx_crosschip_bridge_join,
4347+
.crosschip_bridge_leave = mv88e6xxx_crosschip_bridge_leave,
43164348
};
43174349

43184350
static struct dsa_switch_driver mv88e6xxx_switch_drv = {

0 commit comments

Comments
 (0)