Commit 38faa886 authored by Vivien Didelot's avatar Vivien Didelot Committed by Ezequiel Garcia
Browse files

zii: net: dsa: mv88e6xxx: add local MAC to CPU port



This allows us to get ATU violation interrupts when our local MAC
address comes in on an external switch port (which is indicative of
a loop on the network our own multicast/broadcast packets back to us.)

The local MAC is added to the default FID 0 and every new VLAN FIDs.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@gmail.com>
parent f7211184
...@@ -1243,6 +1243,22 @@ static int mv88e6xxx_rsvd2cpu_setup(struct mv88e6xxx_chip *chip) ...@@ -1243,6 +1243,22 @@ static int mv88e6xxx_rsvd2cpu_setup(struct mv88e6xxx_chip *chip)
return 0; return 0;
} }
#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_ZII)
static int mv88e6xxx_atu_add_local_mac(struct mv88e6xxx_chip *chip, int fid)
{
u8 *addr = chip->ds->dst->cpu_dp->master->dev_addr;
int port = chip->ds->dst->cpu_dp->index;
struct mv88e6xxx_atu_entry entry = {
.state = MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC,
.portvec = BIT(port),
};
ether_addr_copy(entry.mac, addr);
return mv88e6xxx_g1_atu_loadpurge(chip, fid, &entry);
}
#endif
static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip) static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip)
{ {
int err; int err;
...@@ -1251,6 +1267,12 @@ static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip) ...@@ -1251,6 +1267,12 @@ static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip)
if (err) if (err)
return err; return err;
#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_ZII)
err = mv88e6xxx_atu_add_local_mac(chip, 0);
if (err)
return err;
#endif
err = mv88e6xxx_g1_atu_set_learn2all(chip, true); err = mv88e6xxx_g1_atu_set_learn2all(chip, true);
if (err) if (err)
return err; return err;
...@@ -1415,7 +1437,17 @@ static int mv88e6xxx_atu_new(struct mv88e6xxx_chip *chip, u16 *fid) ...@@ -1415,7 +1437,17 @@ static int mv88e6xxx_atu_new(struct mv88e6xxx_chip *chip, u16 *fid)
return -ENOSPC; return -ENOSPC;
/* Clear the database */ /* Clear the database */
return mv88e6xxx_g1_atu_flush(chip, *fid, true); err = mv88e6xxx_g1_atu_flush(chip, *fid, true);
if (err)
return err;
#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_ZII)
err = mv88e6xxx_atu_add_local_mac(chip, *fid);
if (err)
return err;
#endif
return 0;
} }
static int mv88e6xxx_atu_get_hash(struct mv88e6xxx_chip *chip, u8 *hash) static int mv88e6xxx_atu_get_hash(struct mv88e6xxx_chip *chip, u8 *hash)
......
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