mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v2] net: ethernet: mediatek: preserve sibling PPE bindings
@ 2026-10-30  1:05 Alexander Goodkind
  2026-11-03 11:35 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Goodkind @ 2026-10-30  1:05 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi
  Cc: Simon Horman, Alexander Goodkind, andrew+netdev, davem, edumazet,
	kuba, pabeni, matthias.bgg, angelogioacchino.delregno, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek, Tarick Bedeir

__mtk_ppe_check_skb() clears entry->hash for flows bound to other
hardware slots in the same software hash bucket. mtk_flow_offload_stats()
then skips their hardware counter updates. L2 cleanup also frees sibling
subflows without invalidating their hardware rules.

Restrict both cleanup paths to entries assigned to the inspected slot.

Two UDP trials reproduced the counter failure on a GL-MT3000/MT7981
running unmodified OpenWrt 25.12.5 with Linux 6.12.94:

1. Start a UDP connection.
2. Add a control connection in a different hash bucket.
3. Add a connection in the first connection's hash bucket.

AI code review of the original patch identified the cleanup problem
in L2 subflows.

Full ARM64 builds with allmodconfig and allyesconfig passed before
and after the patch using GCC 14.2.0 and W=1, without new warnings.
The builds used CONFIG_WERROR=n because the unmodified ARM64 kernel
already emits warnings. Hardware testing has not run for this revision.

Fixes: c4f033d9e03e ("net: ethernet: mtk_eth_soc: rework hardware flow table management")
Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
Link: https://github.com/openwrt/openwrt/pull/26107
Assisted-by: LLM
Signed-off-by: Alexander Goodkind <alex@goodkind.io>
---
Changes in v2:
- Apply the slot check to L2 subflow cleanup as well.
- Add the Fixes tag for L2 offload support.

V1: https://lore.kernel.org/netdev/20261023012529.5994-1-alex@goodkind.io/

Codex assisted with investigating the counters and preparing the patch.

 drivers/net/ethernet/mediatek/mtk_ppe.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -754,18 +754,17 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
 
 	hlist_for_each_entry_safe(entry, n, head, list) {
 		if (entry->type == MTK_FLOW_TYPE_L2_SUBFLOW) {
-			if (unlikely(FIELD_GET(MTK_FOE_IB1_STATE, hwe->ib1) ==
-				     MTK_FOE_STATE_BIND))
+			if (entry->hash != hash)
 				continue;
 
 			entry->hash = 0xffff;
 			__mtk_foe_entry_clear(ppe, entry);
 			continue;
 		}
 
 		if (found || !mtk_flow_entry_match(ppe->eth, entry, hwe)) {
-			if (entry->hash != 0xffff)
+			if (entry->hash == hash)
 				entry->hash = 0xffff;
 			continue;
 		}
 

base-commit: ffdf678dd16610e3f006dac904bd37c09684673c

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net v2] net: ethernet: mediatek: preserve sibling PPE bindings
  2026-10-30  1:05 [PATCH net v2] net: ethernet: mediatek: preserve sibling PPE bindings Alexander Goodkind
@ 2026-11-03 11:35 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2026-11-03 11:35 UTC (permalink / raw)
  To: Alexander Goodkind
  Cc: Felix Fietkau, Lorenzo Bianconi, andrew+netdev, davem, edumazet,
	kuba, pabeni, matthias.bgg, angelogioacchino.delregno, netdev,
	linux-kernel, linux-arm-kernel, linux-mediatek, Tarick Bedeir

On Thu, Oct 29, 2026 at 06:05:17PM -0700, Alexander Goodkind wrote:
> __mtk_ppe_check_skb() clears entry->hash for flows bound to other
> hardware slots in the same software hash bucket. mtk_flow_offload_stats()
> then skips their hardware counter updates. L2 cleanup also frees sibling
> subflows without invalidating their hardware rules.
> 
> Restrict both cleanup paths to entries assigned to the inspected slot.
> 
> Two UDP trials reproduced the counter failure on a GL-MT3000/MT7981
> running unmodified OpenWrt 25.12.5 with Linux 6.12.94:
> 
> 1. Start a UDP connection.
> 2. Add a control connection in a different hash bucket.
> 3. Add a connection in the first connection's hash bucket.
> 
> AI code review of the original patch identified the cleanup problem
> in L2 subflows.
> 
> Full ARM64 builds with allmodconfig and allyesconfig passed before
> and after the patch using GCC 14.2.0 and W=1, without new warnings.
> The builds used CONFIG_WERROR=n because the unmodified ARM64 kernel
> already emits warnings. Hardware testing has not run for this revision.
> 
> Fixes: c4f033d9e03e ("net: ethernet: mtk_eth_soc: rework hardware flow table management")
> Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
> Link: https://github.com/openwrt/openwrt/pull/26107
> Assisted-by: LLM
> Signed-off-by: Alexander Goodkind <alex@goodkind.io>
> ---
> Changes in v2:
> - Apply the slot check to L2 subflow cleanup as well.
> - Add the Fixes tag for L2 offload support.
> 
> V1: https://lore.kernel.org/netdev/20261023012529.5994-1-alex@goodkind.io/
> 
> Codex assisted with investigating the counters and preparing the patch.

Thanks for the updates.

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-03 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30  1:05 [PATCH net v2] net: ethernet: mediatek: preserve sibling PPE bindings Alexander Goodkind
2026-11-03 11:35 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®