From: netdev-bot+sashiko@kernel.org
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg
Subject: Re: [PATCH net-next 04/13] net: airoha: update stats on flow deletion
Date: Tue, 17 Nov 2026 00:22:47 +0000 [thread overview]
Message-ID: <179487496757.3136.17841889831992200764@kernel.org> (raw)
In-Reply-To: <20261116001612.2806263-5-pablo@netfilter.org>
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] airoha_ppe_flow_offload_destroy()
(drivers/net/ethernet/airoha/airoha_ppe.c:1315-1316) takes the 'final'…
--
net: airoha: update stats on flow deletion
This moves the per-flow stats collection into a new helper,
airoha_ppe_flow_update_stats(). The helper is now also called from
airoha_ppe_flow_offload_destroy(), so the flowtable gets the final
counters when a flow is deleted, following ("netfilter: flowtable:
retrieve stats on flow deletion").
> diff --git a/drivers/net/ethernet/airoha/airoha_ppe.c b/drivers/net/ethernet/airoha/airoha_ppe.c
> index f5369c45766d2..af8c7fe9b7f09 100644
> --- a/drivers/net/ethernet/airoha/airoha_ppe.c
> +++ b/drivers/net/ethernet/airoha/airoha_ppe.c
[ ... ]
> @@ -1295,6 +1312,7 @@ static int airoha_ppe_flow_offload_destroy(struct airoha_eth *eth,
> if (!e)
> return -ENOENT;
>
> + airoha_ppe_flow_update_stats(eth, f, e);
> airoha_ppe_foe_flow_remove_entry(eth->ppe, e);
[Severity: Low]
Can packets counted by the hardware after this snapshot be lost from the
final stats?
airoha_ppe_flow_update_stats() reads the counters through
airoha_ppe_foe_entry_get_stats() (memcpy_fromio() of npu->stats[index]
plus ppe->foe_stats[index]). It does this without ppe_lock, while the FOE
entry is still in BIND state.
After that, airoha_ppe_foe_flow_remove_entry() takes ppe_lock and calls:
airoha_ppe_foe_remove_flow()
e->data.ib1 |= FIELD_PREP(AIROHA_FOE_IB1_BIND_STATE,
AIROHA_FOE_STATE_INVALID);
airoha_ppe_foe_commit_entry(ppe, &e->data, e->hash, false);
Since rx_wlan is false, the commit goes through
airoha_ppe_foe_flow_stats_update(). That function zeroes the counters
for this hash:
airoha_ppe_foe_flow_stat_entry_reset(ppe, npu, index);
Between the snapshot and the invalidating commit, the PPE keeps
forwarding and counting packets for this flow. That window includes:
- waiting for ppe_lock, which the NAPI path also takes
(airoha_qdma_rx_process()->airoha_ppe_check_skb()->
airoha_ppe_foe_insert_entry())
- the SRAM MMIO writes
- the ack poll
Packets counted in that window are then reset and never reach
flow_offload_update_stats() / nf_ct_acct_add(). Flows torn down for idle
timeout are not affected. Flows deleted while still carrying traffic
(conntrack flush, route or device change, one-sided TCP teardown) would
under-report.
Would it work to do this under ppe_lock instead? Save the hash,
invalidate the entry without resetting the counters, read the stats,
then reset them.
The mtk peer patch "net: ethernet: mtk_ppe: update stats on flow
deletion" appears to use the same snapshot-then-clear order.
> rhashtable_remove_fast(ð->flow_table, &e->node,
> airoha_flow_table_params);
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116001612.2806263-2-pablo%40netfilter.org
next prev parent reply other threads:[~2026-11-17 0:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 0:15 [PATCH net-next,v2 00/13] Netfilter updates for net-next Pablo Neira Ayuso
2026-11-16 0:16 ` [PATCH net-next 01/13] netfilter: flowtable: do not hw offload flows in teardown state Pablo Neira Ayuso
2026-11-16 0:23 ` netdev-bot+sinfo
2026-11-16 0:27 ` Pablo Neira Ayuso
2026-11-17 0:22 ` netdev-bot+sashiko
2026-11-16 0:16 ` [PATCH net-next 02/13] netfilter: flowtable: retrieve stats on flow deletion Pablo Neira Ayuso
2026-11-17 0:22 ` netdev-bot+sashiko
2026-11-16 0:16 ` [PATCH net-next 03/13] net: ethernet: mtk_ppe: update " Pablo Neira Ayuso
2026-11-17 0:22 ` netdev-bot+sashiko
2026-11-16 0:16 ` [PATCH net-next 04/13] net: airoha: " Pablo Neira Ayuso
2026-11-17 0:22 ` netdev-bot+sashiko [this message]
2026-11-16 0:16 ` [PATCH net-next 05/13] netfilter: xt_time: fix monthday computation for dates past 2039 Pablo Neira Ayuso
2026-11-17 0:22 ` netdev-bot+sashiko
2026-11-16 0:16 ` [PATCH net-next 06/13] netfilter: nft_flow_offload: do not offload multicast Pablo Neira Ayuso
2026-11-17 0:22 ` netdev-bot+sashiko
2026-11-16 0:16 ` [PATCH net-next 07/13] netfilter: flowtable: purge entries immediately when destroying the flowtable Pablo Neira Ayuso
2026-11-17 0:22 ` netdev-bot+sashiko
2026-11-16 0:16 ` [PATCH net-next 08/13] selftests: netfilter: nf_queue: drop the no-op loop initializer Pablo Neira Ayuso
2026-11-16 0:16 ` [PATCH net-next 09/13] netfilter: flowtable: do not scrub as crossing netns Pablo Neira Ayuso
2026-11-17 0:22 ` netdev-bot+sashiko
2026-11-16 0:16 ` [PATCH net-next 10/13] netfilter: flowtable: tunnel device poisons h_source of fast-path frames Pablo Neira Ayuso
2026-11-16 0:16 ` [PATCH net-next 11/13] netfilter: flowtable: do not clear the offload bit twice Pablo Neira Ayuso
2026-11-16 0:16 ` [PATCH net-next 12/13] netfilter: nfnetlink_queue: make skb writable before writing NFQA_L2HDR Pablo Neira Ayuso
2026-11-16 0:16 ` [PATCH net-next 13/13] selftests: netfilter: add UDP flowtable offload test Pablo Neira Ayuso
2026-11-17 0:22 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179487496757.3136.17841889831992200764@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox