1 From 9f6b606b6b37e61427412708411e8e04b1a858e8 Mon Sep 17 00:00:00 2001
2 From: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Mon, 18 Aug 2025 11:58:25 +0200
4 Subject: [PATCH] net: airoha: ppe: Do not invalid PPE entries in case of SW
7 SW hash computed by airoha_ppe_foe_get_entry_hash routine (used for
8 foe_flow hlist) can theoretically produce collisions between two
9 different HW PPE entries.
10 In airoha_ppe_foe_insert_entry() if the collision occurs we will mark
11 the second PPE entry in the list as stale (setting the hw hash to 0xffff).
12 Stale entries are no more updated in airoha_ppe_foe_flow_entry_update
13 routine and so they are removed by Netfilter.
14 Fix the problem not marking the second entry as stale in
15 airoha_ppe_foe_insert_entry routine if we have already inserted the
16 brand new entry in the PPE table and let Netfilter remove real stale
17 entries according to their timestamp.
18 Please note this is just a theoretical issue spotted reviewing the code
19 and not faced running the system.
21 Fixes: cd53f622611f9 ("net: airoha: Add L2 hw acceleration support")
22 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
23 Link: https://patch.msgid.link/20250818-airoha-en7581-hash-collision-fix-v1-1-d190c4b53d1c@kernel.org
24 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
26 drivers/net/ethernet/airoha/airoha_ppe.c | 4 +---
27 1 file changed, 1 insertion(+), 3 deletions(-)
29 --- a/drivers/net/ethernet/airoha/airoha_ppe.c
30 +++ b/drivers/net/ethernet/airoha/airoha_ppe.c
31 @@ -736,10 +736,8 @@ static void airoha_ppe_foe_insert_entry(
35 - if (commit_done || !airoha_ppe_foe_compare_entry(e, hwe)) {
37 + if (!airoha_ppe_foe_compare_entry(e, hwe))
41 airoha_ppe_foe_commit_entry(ppe, &e->data, hash);