Skip to content

Commit ef2025e

Browse files
vivienJakub Kicinski
authored andcommitted
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: Vivien Didelot <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9dc8b13 commit ef2025e

File tree

1 file changed

+18
-21
lines changed
  • drivers/net/dsa/mv88e6xxx

1 file changed

+18
-21
lines changed

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,29 +2043,26 @@ static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port,
20432043
static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip,
20442044
struct net_device *br)
20452045
{
2046-
struct dsa_switch *ds;
2047-
int port;
2048-
int dev;
2046+
struct dsa_switch *ds = chip->ds;
2047+
struct dsa_switch_tree *dst = ds->dst;
2048+
struct dsa_port *dp;
20492049
int err;
20502050

2051-
/* Remap the Port VLAN of each local bridge group member */
2052-
for (port = 0; port < mv88e6xxx_num_ports(chip); ++port) {
2053-
if (dsa_to_port(chip->ds, port)->bridge_dev == br) {
2054-
err = mv88e6xxx_port_vlan_map(chip, port);
2055-
if (err)
2056-
return err;
2057-
}
2058-
}
2059-
2060-
/* Remap the Port VLAN of each cross-chip bridge group member */
2061-
for (dev = 0; dev < DSA_MAX_SWITCHES; ++dev) {
2062-
ds = chip->ds->dst->ds[dev];
2063-
if (!ds)
2064-
break;
2065-
2066-
for (port = 0; port < ds->num_ports; ++port) {
2067-
if (dsa_to_port(ds, port)->bridge_dev == br) {
2068-
err = mv88e6xxx_pvt_map(chip, dev, port);
2051+
list_for_each_entry(dp, &dst->ports, list) {
2052+
if (dp->bridge_dev == br) {
2053+
if (dp->ds == ds) {
2054+
/* This is a local bridge group member,
2055+
* remap its Port VLAN Map.
2056+
*/
2057+
err = mv88e6xxx_port_vlan_map(chip, dp->index);
2058+
if (err)
2059+
return err;
2060+
} else {
2061+
/* This is an external bridge group member,
2062+
* remap its cross-chip Port VLAN Table entry.
2063+
*/
2064+
err = mv88e6xxx_pvt_map(chip, dp->ds->index,
2065+
dp->index);
20692066
if (err)
20702067
return err;
20712068
}

0 commit comments

Comments
 (0)