Linux Netfilter development
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, nbd@nbd.name
Subject: Re: [PATCH nf-next 2/2] net: ethernet: mtk_ppe: update stats on flow deletion
Date: Thu, 29 Oct 2026 12:29:04 +0100	[thread overview]
Message-ID: <auMuANNbWDrhUNnQ@lore-desk> (raw)
In-Reply-To: <20261029111431.179813-2-pablo@netfilter.org>

[-- Attachment #1: Type: text/plain, Size: 2580 bytes --]

> Update this driver to use the new approach to fetch stats on flow
> deletion, introduced by ("netfilter: flowtable: retrieve stats on flow
> deletion").
> 
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> ---
>  .../net/ethernet/mediatek/mtk_ppe_offload.c   | 32 ++++++++++++-------
>  1 file changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
> index 99b28aaa7cc4..8ca694bb5e1b 100644
> --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
> +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
> @@ -526,6 +526,24 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f,
>  	return err;
>  }
>  
> +static void
> +mtk_flow_offload_update_stats(struct mtk_eth *eth, struct flow_cls_offload *f,
> +			      struct mtk_flow_entry *entry)
> +{
> +	struct mtk_foe_accounting diff;
> +	u32 idle;
> +
> +	idle = mtk_foe_entry_idle_time(eth->ppe[entry->ppe_index], entry);
> +	f->stats.lastused = jiffies - idle * HZ;
> +
> +	if (entry->hash != 0xFFFF &&
> +	    mtk_foe_entry_get_mib(eth->ppe[entry->ppe_index], entry->hash,
> +				  &diff)) {
> +		f->stats.pkts += diff.packets;
> +		f->stats.bytes += diff.bytes;
> +	}
> +}
> +
>  static int
>  mtk_flow_offload_destroy(struct mtk_eth *eth, struct flow_cls_offload *f)
>  {
> @@ -536,6 +554,8 @@ mtk_flow_offload_destroy(struct mtk_eth *eth, struct flow_cls_offload *f)
>  	if (!entry)
>  		return -ENOENT;
>  
> +	mtk_flow_offload_update_stats(eth, f, entry);
> +
>  	mtk_foe_entry_clear(eth->ppe[entry->ppe_index], entry);
>  	rhashtable_remove_fast(&eth->flow_table, &entry->node,
>  			       mtk_flow_ht_params);
> @@ -550,23 +570,13 @@ static int
>  mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)
>  {
>  	struct mtk_flow_entry *entry;
> -	struct mtk_foe_accounting diff;
> -	u32 idle;
>  
>  	entry = rhashtable_lookup(&eth->flow_table, &f->cookie,
>  				  mtk_flow_ht_params);
>  	if (!entry)
>  		return -ENOENT;
>  
> -	idle = mtk_foe_entry_idle_time(eth->ppe[entry->ppe_index], entry);
> -	f->stats.lastused = jiffies - idle * HZ;
> -
> -	if (entry->hash != 0xFFFF &&
> -	    mtk_foe_entry_get_mib(eth->ppe[entry->ppe_index], entry->hash,
> -				  &diff)) {
> -		f->stats.pkts += diff.packets;
> -		f->stats.bytes += diff.bytes;
> -	}
> +	mtk_flow_offload_update_stats(eth, f, entry);
>  
>  	return 0;
>  }
> -- 
> 2.47.3
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-10-29 11:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 11:14 [PATCH nf-next 1/2] netfilter: flowtable: retrieve stats on flow deletion Pablo Neira Ayuso
2026-10-29 11:14 ` [PATCH nf-next 2/2] net: ethernet: mtk_ppe: update " Pablo Neira Ayuso
2026-10-29 11:29   ` Lorenzo Bianconi [this message]
2026-10-29 11:25 ` [PATCH nf-next 1/2] netfilter: flowtable: retrieve " Lorenzo Bianconi
2026-10-29 11:39   ` Pablo Neira Ayuso
2026-10-29 11:41     ` Lorenzo Bianconi
2026-10-29 11:44       ` Lorenzo Bianconi
2026-10-29 11:45         ` Pablo Neira Ayuso

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=auMuANNbWDrhUNnQ@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=netfilter-devel@vger.kernel.org \
    --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