Re: [RFC PATCH v2 net-next 01/17] net: dsa: reference count the host mdb addresses
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: 2021-02-26 09:23:39
On Wed, Feb 24, 2021 at 13:43, Vladimir Oltean [off-list ref] wrote:
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Currently any DSA switch that is strict when implementing the mdb
operations prints these benign errors after the addresses expire, with
at least 2 ports bridged:
[ 286.013814] mscc_felix 0000:00:00.5 swp3: failed (err=-2) to del object (id=3)
The reason has to do with this piece of code:
netdev_for_each_lower_dev(dev, lower_dev, iter)
br_mdb_switchdev_host_port(dev, lower_dev, mp, type);
called from:
br_multicast_group_expired
-> br_multicast_host_leave
-> br_mdb_notify
-> br_mdb_switchdev_host
Basically, the bridge code is correct.How about "the bridge code is not wrong"? Is there any reason why we could not get rid of the duplicated messages at the source (br_mdb_switchdev_host)? The forward offloading we have talked about before requires that the bridge-internal port OFMs are bounded to some low value (e.g. BITS_PER_LONG) such that they can be tracked in a small bitfield. I have a patch that does this, it is tiny. With that in place, imagine a `br_switchdev_for_each_distinct_dev` helper that would wrap `netdev_for_each_lower_dev`, keeping track of OFMs it had already visited. For all host related switchdev calls, we should be able to use that instead of the full iterator to only contact each switchdev driver once.