A VLAN-unaware bridge reports VID 0 for its FDB entries, but lookups run with the unaware FID (VID 4095). Entries added through switchdev were installed under FID 0 and could never be hit by the hardware lookups. Translate the unaware FID and VID 0 back and forth, so the software mapping stays symmetric with the hardware lookups. Signed-off-by: David Yang --- drivers/net/dsa/motorcomm/chip.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c index 907f7a5b0687..447736854870 100644 --- a/drivers/net/dsa/motorcomm/chip.c +++ b/drivers/net/dsa/motorcomm/chip.c @@ -590,6 +590,9 @@ yt921x_fdb_dump(struct yt921x_priv *priv, u16 ports_mask, res = yt921x_fdb_read(priv, addr, &vid, &pmask, &index, &status); if (res) return res; + + if (vid == YT921X_VID_UNWARE) + vid = 0; if ((pmask & ports_mask) && !is_multicast_ether_addr(addr)) { res = cb(addr, vid, status == YT921X_FDB_ENTRY_STATUS_STATIC, data); @@ -618,6 +621,8 @@ yt921x_fdb_dump(struct yt921x_priv *priv, u16 ports_mask, if (!pmask) break; + if (vid == YT921X_VID_UNWARE) + vid = 0; if ((pmask & ports_mask) && !is_multicast_ether_addr(addr)) { res = cb(addr, vid, status == YT921X_FDB_ENTRY_STATUS_STATIC, @@ -740,6 +745,10 @@ yt921x_fdb_leave(struct yt921x_priv *priv, const unsigned char *addr, u32 val; int res; + /* See yt921x_fdb_join() */ + if (!vid) + vid = YT921X_VID_UNWARE; + /* Check for presence */ res = yt921x_fdb_has(priv, addr, vid, &index); if (res) @@ -782,6 +791,13 @@ yt921x_fdb_join(struct yt921x_priv *priv, const unsigned char *addr, u16 vid, u32 val2; int res; + /* A vlan-unaware bridge reports vid 0, but untagged lookups on its + * ports run with the unaware FID; map so that static entries match the + * hardware lookups. + */ + if (!vid) + vid = YT921X_VID_UNWARE; + /* Check for presence */ res = yt921x_fdb_has(priv, addr, vid, &index); if (res) -- 2.53.0