Re: [PATCH/RFC net] net: dsa: lantiq_gswip: honor dsa_db passed to port_fdb_{add,del}
From: Vladimir Oltean
Date: Sun Aug 10 2025 - 09:06:59 EST
On Sat, Aug 09, 2025 at 11:35:28PM +0100, Daniel Golle wrote:
> Commit c9eb3e0f8701 ("net: dsa: Add support for learning FDB through
> notification") added a dev_close() call "to indicate inconsistent
> situation" when we could not delete an FDB entry from the port. In case
> of the lantiq_gswip driver this is problematic on standalone ports for
> which all calls to either .port_fdb_add() or .port_fdb_del() would just
> always return -EINVAL as adding or removing FDB entries is currently
> only supported for ports which are a member of a bridge.
>
> As since commit c26933639b54 ("net: dsa: request drivers to perform FDB
> isolation") the dsa_db is passed to the .port_fdb_add() or
> .port_fdb_del() calls we can use that to set the FID accordingly,
> similar to how it was for bridge ports, and to FID 0 for standalone
> ports. In order for FID 0 to work at all we also need to set bit 1 in
> val[1], so always set it.
>
> This solution was found in a downstream driver provided by MaxLinear
> (which is the current owner of the former Lantiq switch IP) under
> GPL-2.0. Import the implementation and the copyright headers from that
> driver.
>
> Fixes: c9eb3e0f8701 ("net: dsa: Add support for learning FDB through notification")
> Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>
> ---
1. The dev_close() call was removed in commit 2fd186501b1c ("net: dsa:
be louder when a non-legacy FDB operation fails"); what kernel are you
seeing failures on?
2. The call paths which set DSA_DB_PORT should be all guarded by
dsa_switch_supports_uc_filtering(), which the gswip driver doesn't
fulfill (it's missing ds->fdb_isolation). Can you put a dump_stack()
in the DSA_DB_PORT handler and let me know where it's called from?
3. You haven't actually explained the context that leads to
gswip_port_fdb() returning -EINVAL. It would be great to have that as
a starting point, perhaps a dump_stack() in the unmodified code could
reveal more.