Commit ef2025ec authored by Vivien Didelot's avatar Vivien Didelot Committed by Jakub Kicinski

net: dsa: mv88e6xxx: use ports list to map bridge

Instead of digging into the other dsa_switch structures of the fabric
and relying too much on the dsa_to_port helper, use the new list
of switch fabric ports to remap the Port VLAN Map of local bridge
group members or remap the Port VLAN Table entry of external bridge
group members.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@gmail.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
parent 9dc8b13e
...@@ -2043,29 +2043,26 @@ static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, ...@@ -2043,29 +2043,26 @@ 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; struct dsa_switch *ds = chip->ds;
int port; struct dsa_switch_tree *dst = ds->dst;
int dev; struct dsa_port *dp;
int err; int err;
/* Remap the Port VLAN of each local bridge group member */ list_for_each_entry(dp, &dst->ports, list) {
for (port = 0; port < mv88e6xxx_num_ports(chip); ++port) { if (dp->bridge_dev == br) {
if (dsa_to_port(chip->ds, port)->bridge_dev == br) { if (dp->ds == ds) {
err = mv88e6xxx_port_vlan_map(chip, port); /* This is a local bridge group member,
* remap its Port VLAN Map.
*/
err = mv88e6xxx_port_vlan_map(chip, dp->index);
if (err) if (err)
return err; return err;
} } else {
} /* This is an external bridge group member,
* remap its cross-chip Port VLAN Table entry.
/* Remap the Port VLAN of each cross-chip bridge group member */ */
for (dev = 0; dev < DSA_MAX_SWITCHES; ++dev) { err = mv88e6xxx_pvt_map(chip, dp->ds->index,
ds = chip->ds->dst->ds[dev]; dp->index);
if (!ds)
break;
for (port = 0; port < ds->num_ports; ++port) {
if (dsa_to_port(ds, port)->bridge_dev == br) {
err = mv88e6xxx_pvt_map(chip, dev, port);
if (err) if (err)
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment