Re: [PATCH v8 net-next 11/12] net: dsa: mv88e6xxx: add blackhole ATU entries

Vladimir Oltean
2022-10-20T13:25:23Z

On Tue, Oct 18, 2022 at 06:56:18PM +0200, Hans J. Schultz wrote:
> Blackhole FDB entries can now be added, deleted or replaced in the
> driver ATU.

Why is this necessary, why is it useful?

>
> Signed-off-by: Hans J. Schultz <netdev@kapio-technology.com>
> ---
> static int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
> const unsigned char *addr, u16 vid,
> u16 fdb_flags, struct dsa_db db)
> @@ -2742,9 +2794,10 @@ static int mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
> struct mv88e6xxx_chip *chip = ds->priv;
> int err;
>
> - /* Ignore entries with flags set */
> - if (fdb_flags)
> + if (fdb_flags & DSA_FDB_FLAG_LOCKED)
> return 0;

I don't understand this. If no driver looks at DSA_FDB_FLAG_LOCKED
(not even mv88e6xxx, up until the end of the series), then why was it
propagated all the way in the first place?

> + if (fdb_flags & DSA_FDB_FLAG_BLACKHOLE)
> + return mv88e6xxx_blackhole_fdb_add(ds, addr, vid);
>
> if (mv88e6xxx_port_is_locked(chip, port))
> mv88e6xxx_atu_locked_entry_find_purge(ds, port, addr, vid);
> @@ -2765,9 +2818,10 @@ static int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port,
> bool locked_found = false;
> int err = 0;
>
> - /* Ignore entries with flags set */
> - if (fdb_flags)
> + if (fdb_flags & DSA_FDB_FLAG_LOCKED)
> return 0;
> + if (fdb_flags & DSA_FDB_FLAG_BLACKHOLE)
> + return mv88e6xxx_blackhole_fdb_del(ds, addr, vid);
>
> if (mv88e6xxx_port_is_locked(chip, port))
> locked_found = mv88e6xxx_atu_locked_entry_find_purge(ds, port, addr, vid);
> --
> 2.34.1