Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The comment this patch adds to struct cpsw_ale (drivers/net/ethernet/ti/cpsw_ale.h, lines 99-101) says ale->lock… -- net: ethernet: ti: cpsw_ale: serialize ALE table accesses This patch adds a spinlock to struct cpsw_ale. The lock is taken with spin_lock_bh() in all exported ALE functions that access the table through the shared index and data registers. With it, concurrent ndo_set_rx_mode() and VLAN or address operations on different ports can no longer interleave register accesses and corrupt table entries. [ ... ]
> diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h > index 87b7d1b3a34a9..f72db771bfa99 100644 > --- a/drivers/net/ethernet/ti/cpsw_ale.h > +++ b/drivers/net/ethernet/ti/cpsw_ale.h > @@ -96,6 +96,10 @@ struct cpsw_ale { > u32 vlan_field_bits; > unsigned long *p0_untag_vid_mask; > const struct ale_entry_fld *vlan_entry_tbl; > + /* serializes access to the ALE table (index and data registers), > + * the VLAN mask mux registers and p0_untag_vid_mask > + */ > + spinlock_t lock; > };
[Severity: Low] This isn't a bug, but is the comment accurate for p0_untag_vid_mask? Only the writers of the bitmap take the lock. The reader in the same header does not: drivers/net/ethernet/ti/cpsw_ale.h: static inline int cpsw_ale_get_vlan_p0_untag(struct cpsw_ale *ale, u16 vid) { return test_bit(vid, ale->p0_untag_vid_mask); } Its caller, cpsw_rx_vlan_encap() in cpsw_priv.c, runs in the RX path without ale->lock: if (!cpsw_ale_get_vlan_p0_untag(cpsw->ale, vid)) { The writer is cpsw_ale_set_vlan_untag(). It is reached from __cpsw_ale_add_vlan(), cpsw_ale_vlan_del_modify_int() and cpsw_ale_del_vlan(), which all hold ale->lock now. It uses bitmap_set()/bitmap_clear() with nbits == 1, and these compile to the non-atomic __set_bit()/__clear_bit(). Would it be clearer to say that the lock serializes writers of p0_untag_vid_mask and that the RX path reads it without the lock? The other option is to switch the writer to set_bit()/clear_bit(), which makes the lockless read explicit. The comment is also unchanged later in the series apart from the added mention of the control registers.
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40amperfied.com