Skip to content

Commit 3567e23

Browse files
marceloleitnerkuba-moo
authored andcommitted
net/sched: act_ct: enable stats for HW offloaded entries
By setting NF_FLOWTABLE_COUNTER. Otherwise, the updates added by commit ef803b3 ("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 beb97d3 ("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 <[email protected]> Acked-by: wenxu <[email protected]> Acked-by: Pablo Neira Ayuso <[email protected]> Link: https://lore.kernel.org/r/481a65741261fd81b0a0813e698af163477467ec.1606415787.git.marcelo.leitner@gmail.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5c39f26 commit 3567e23

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/sched/act_ct.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ static int tcf_ct_flow_table_get(struct tcf_ct_params *params)
296296
goto err_insert;
297297

298298
ct_ft->nf_ft.type = &flowtable_ct;
299-
ct_ft->nf_ft.flags |= NF_FLOWTABLE_HW_OFFLOAD;
299+
ct_ft->nf_ft.flags |= NF_FLOWTABLE_HW_OFFLOAD |
300+
NF_FLOWTABLE_COUNTER;
300301
err = nf_flow_table_init(&ct_ft->nf_ft);
301302
if (err)
302303
goto err_init;
@@ -540,7 +541,8 @@ static bool tcf_ct_flow_table_lookup(struct tcf_ct_params *p,
540541
flow_offload_refresh(nf_ft, flow);
541542
nf_conntrack_get(&ct->ct_general);
542543
nf_ct_set(skb, ct, ctinfo);
543-
nf_ct_acct_update(ct, dir, skb->len);
544+
if (nf_ft->flags & NF_FLOWTABLE_COUNTER)
545+
nf_ct_acct_update(ct, dir, skb->len);
544546

545547
return true;
546548
}

0 commit comments

Comments
 (0)