On AM62x/AM625 with both CPSW3G ports in dual EMAC mode and VLAN interfaces on top, reception of untagged frames on a port can stop. The port VLAN entry at ALE index 0 had been overwritten by an IPv6 multicast entry (33:33:...). Only link down/up recovers the port. Two independent causes were found, one patch each: 1. The ALE table is accessed through an index register and three data registers. The read-modify-write sequences in cpsw_ale.c run concurrently from different contexts, for example ndo_set_rx_mode() of one port against VLAN add/kill on the other, without any lock. Entries get lost or mixed. Patch 1 adds a lock to struct cpsw_ale. 2. Even with the lock held, a table read occasionally returns the content of another index or all zeros. Reading the data words again without rewriting the index stays wrong, rewriting the index and reading again returns the right entry. Either of two consecutive reads can be the bad one. If the VLAN entry reads as free, its index is handed out as a free slot and overwritten. Patch 2 reads every entry twice, rewriting the index each time, and retries until both reads match. The AM62x TRM (SPRUIV7) says that after a write to ALE_TBLCTL any ALE register access is stalled until the table operation completes, so the access sequence in the driver is as documented. TI lists a matching unresolved issue for the J7 CPSW in its public tracker as EXT_EP-12856 (workaround: trigger the read twice); AM62x is not listed there. Measured on a PHYTEC phyCORE-AM62x (CPSW3G, two ports in dual EMAC mode, VLAN sub-interfaces). Stress: multicast joins and leaves on both ports plus VLAN add/remove, 120 seconds per run. - net v7.4-rc3, patch 1 only: 2 of 19 runs failed - net v7.4-rc3, both patches: 60 runs passed, lockdep enabled, no warnings - TI/PHYTEC 6.18 vendor kernel, patch 1 only: 1 of 29 runs failed - same kernel, patch 2 only (no lock): failed in the first run, with torn entries - same kernel, both patches: 400 runs passed; mismatching reads were caught and corrected by the retry (seen at index 0 and index 64) - a 6.6 based kernel without the patches also fails (run 8); it does not have the commit named in patch 1, which points to cause 2 Test coverage: both patches together were run-tested on net v7.4-rc3 and on the 6.18 vendor kernel, which has the same cpsw_ale.c table access code. The legacy cpsw, cpsw_new and netcp users of the ALE are compile-tested only. Signed-off-by: Manuel Janocha <manu…@amperfied.com> --- Changes in v2: - Patch 1: use spin_lock_irqsave() instead of spin_lock_bh(): netcp calls cpsw_ale_add_vlan()/cpsw_ale_del_vlan() with interrupts disabled - Patch 1: also lock the read-modify-write in cpsw_ale_control_set() - Patch 1: correct the changelog: affected drivers (cpsw/cpsw_new are already serialized by their rx_mode work item), accessors are the _relaxed variants; test results updated - New patch 2: verify ALE table reads (hardware read glitch seen with the lock in place) - Link to v1: https://patch.msgid.link/2026…@amperfied.com --- Manuel Janocha (2): net: ethernet: ti: cpsw_ale: serialize ALE table accesses net: ethernet: ti: cpsw_ale: verify ALE table reads drivers/net/ethernet/ti/cpsw_ale.c | 117 ++++++++++++++++++++++++++++++++----- drivers/net/ethernet/ti/cpsw_ale.h | 2 + 2 files changed, 106 insertions(+), 13 deletions(-) --- base-commit: ef3e21c61baa74e39a49b75318bd4541562ec43f change-id: 20261126-cpsw-ale-lock-cc05d5bea7a0 Best regards, -- Manuel Janocha <manu…@amperfied.com>