linux-brain/drivers/net/dsa/sja1105
Vladimir Oltean 2b8ab7aec0 net: dsa: sja1105: invalidate dynamic FDB entries learned concurrently with statically added ones
[ Upstream commit 6c5fc159e0927531707895709eee1f8bfa04289f ]

The procedure to add a static FDB entry in sja1105 is concurrent with
dynamic learning performed on all bridge ports and the CPU port.

The switch looks up the FDB from left to right, and also learns
dynamically from left to right, so it is possible that between the
moment when we pick up a free slot to install an FDB entry, another slot
to the left of that one becomes free due to an address ageing out, and
that other slot is then immediately used by the switch to learn
dynamically the same address as we're trying to add statically.

The result is that we succeeded to add our static FDB entry, but it is
being shadowed by a dynamic FDB entry to its left, and the switch will
behave as if our static FDB entry did not exist.

We cannot really prevent this from happening unless we make the entire
process to add a static FDB entry a huge critical section where address
learning is temporarily disabled on _all_ ports, and then re-enabled
according to the configuration done by sja1105_port_set_learning.
However, that is kind of disruptive for the operation of the network.

What we can do alternatively is to simply read back the FDB for dynamic
entries located before our newly added static one, and delete them.
This will guarantee that our static FDB entry is now operational. It
will still not guarantee that there aren't dynamic FDB entries to the
_right_ of that static FDB entry, but at least those entries will age
out by themselves since they aren't hit, and won't bother anyone.

Fixes: 291d1e72b7 ("net: dsa: sja1105: Add support for FDB and MDB management")
Fixes: 1da7382134 ("net: dsa: sja1105: Add FDB operations for P/Q/R/S series")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-08-12 13:20:56 +02:00
..
Kconfig net: dsa: sja1105: improve NET_DSA_SJA1105_TAS dependency 2019-10-28 16:33:42 -07:00
Makefile net: dsa: sja1105: Configure the Time-Aware Scheduler via tc-taprio offload 2019-09-16 21:32:58 +02:00
sja1105.h net: dsa: sja1105: Use the correct style for SPDX License Identifier 2019-10-15 20:16:26 -07:00
sja1105_clocking.c net: dsa: sja1105: Add RGMII delay support for P/Q/R/S chips 2019-06-09 20:06:54 -07:00
sja1105_dynamic_config.c net: dsa: sja1105: Add static config tables for scheduling 2019-09-16 21:32:57 +02:00
sja1105_dynamic_config.h net: dsa: sja1105: Use the correct style for SPDX License Identifier 2019-10-15 20:16:26 -07:00
sja1105_ethtool.c net: dsa: sja1105: Fix status initialization in sja1105_get_ethtool_stats 2019-05-07 12:20:46 -07:00
sja1105_main.c net: dsa: sja1105: invalidate dynamic FDB entries learned concurrently with statically added ones 2021-08-12 13:20:56 +02:00
sja1105_ptp.c net: dsa: sja1105: Really fix panic on unregistering PTP clock 2019-08-06 14:37:02 -07:00
sja1105_ptp.h net: dsa: sja1105: Use the correct style for SPDX License Identifier 2019-10-15 20:16:26 -07:00
sja1105_spi.c net: dsa: sja1105: Prevent leaking memory 2019-09-30 17:24:43 -07:00
sja1105_static_config.c net: dsa: sja1105: Reconcile the meaning of TPID and TPID2 for E/T and P/Q/R/S 2020-01-04 19:19:06 +01:00
sja1105_static_config.h net: dsa: sja1105: Use the correct style for SPDX License Identifier 2019-10-15 20:16:26 -07:00
sja1105_tas.c net: dsa: sja1105: Configure the Time-Aware Scheduler via tc-taprio offload 2019-09-16 21:32:58 +02:00
sja1105_tas.h net: dsa: sja1105: Use the correct style for SPDX License Identifier 2019-10-15 20:16:26 -07:00