NACK/Cmnt: [SRU][F:linux-bluefield][PATCH] net/sched: act_ct: enable stats for HW offloaded entries

Stefan Bader stefan.bader at canonical.com
Tue Dec 6 08:31:46 UTC 2022


On 05.12.22 22:54, Bodong Wang wrote:
> From: Marcelo Ricardo Leitner <marcelo.leitner at gmail.com>
> 
> By setting NF_FLOWTABLE_COUNTER. Otherwise, the updates added by
> commit ef803b3cf96a ("netfilter: flowtable: add counter support in HW
> offload") are not effective when using act_ct.
> 
> While at it, now that we have the flag set, protect the call to
> nf_ct_acct_update() by commit beb97d3a3192 ("net/sched: act_ct: update
> nf_conn_acct for act_ct SW offload in flowtable") with the check on
> NF_FLOWTABLE_COUNTER, as also done on other places.
> 
> Note that this shouldn't impact performance as these stats are only
> enabled when net.netfilter.nf_conntrack_acct is enabled.
> 
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner at gmail.com>
> Acked-by: wenxu <wenxu at ucloud.cn>
> Acked-by: Pablo Neira Ayuso <pablo at netfilter.org>
> Link: https://lore.kernel.org/r/481a65741261fd81b0a0813e698af163477467ec.1606415787.git.marcelo.leitner@gmail.com
> Signed-off-by: Jakub Kicinski <kuba at kernel.org>
> (Backported from commit 3567e23379046a1c7fa730c2af7f5f3e53ff0039)
> Signed-off-by: Bodong Wang <bodong at nvidia.com>
> [Bodong: conflict on new line]
> ---

I can see no BugLink.

-Stefan
>   net/sched/act_ct.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
> index 32a720edc6a6..914a9438c6a8 100644
> --- a/net/sched/act_ct.c
> +++ b/net/sched/act_ct.c
> @@ -300,7 +300,8 @@ static int tcf_ct_flow_table_get(struct tcf_ct_params *params)
>   		goto err_insert;
>   
>   	ct_ft->nf_ft.type = &flowtable_ct;
> -	ct_ft->nf_ft.flags |= NF_FLOWTABLE_HW_OFFLOAD;
> +	ct_ft->nf_ft.flags |= NF_FLOWTABLE_HW_OFFLOAD |
> +			      NF_FLOWTABLE_COUNTER;
>   	err = nf_flow_table_init(&ct_ft->nf_ft);
>   	if (err)
>   		goto err_init;
> @@ -565,6 +566,8 @@ static bool tcf_ct_flow_table_lookup(struct tcf_ct_params *p,
>   	flow_offload_refresh(nf_ft, flow);
>   	nf_conntrack_get(&ct->ct_general);
>   	nf_ct_set(skb, ct, ctinfo);
> +	if (nf_ft->flags & NF_FLOWTABLE_COUNTER)
> +		nf_ct_acct_update(ct, dir, skb->len);
>   
>   	return true;
>   }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20221206/c3f50952/attachment.sig>


More information about the kernel-team mailing list