net: dsa: felix: migrate host FDB and MDB entries when changing tag proto
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 2 Mar 2022 19:14:13 +0000 (21:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Mar 2022 14:15:31 +0000 (14:15 +0000)
commitf9cef64fa23f6c1ff177be5082113c5a94e34e5d
tree782023f61d4dd137c7242a1b92589c6bfc3be079
parent7569459a52c95bc6e82c0b4075c4380df55cd343
net: dsa: felix: migrate host FDB and MDB entries when changing tag proto

The "ocelot" and "ocelot-8021q" tagging protocols make use of different
hardware resources, and host FDB entries have different destination
ports in the switch analyzer module, practically speaking.

So when the user requests a tagging protocol change, the driver must
migrate all host FDB and MDB entries from the NPI port (in fact CPU port
module) towards the same physical port, but this time used as a regular
port.

It is pointless for the felix driver to keep a copy of the host
addresses, when we can create and export DSA helpers for walking through
the addresses that it already needs to keep on the CPU port, for
refcounting purposes.

felix_classify_db() is moved up to avoid a forward declaration.

We pass "bool change" because dp->fdbs and dp->mdbs are uninitialized
lists when felix_setup() first calls felix_set_tag_protocol(), so we
need to avoid calling dsa_port_walk_fdbs() during probe time.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/ocelot/felix.c
include/net/dsa.h
net/dsa/dsa.c