diff mbox series

[net] net/sched: act_ctinfo: use percpu stats

Message ID 20230210200824.444856-1-pctammela@mojatatu.com (mailing list archive)
State Accepted
Commit 21c167aa0ba943a7cac2f6969814f83bb701666b
Delegated to: Netdev Maintainers
Headers show
Series [net] net/sched: act_ctinfo: use percpu stats | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Pedro Tammela Feb. 10, 2023, 8:08 p.m. UTC
The tc action act_ctinfo was using shared stats, fix it to use percpu stats
since bstats_update() must be called with locks or with a percpu pointer argument.

tdc results:
1..12
ok 1 c826 - Add ctinfo action with default setting
ok 2 0286 - Add ctinfo action with dscp
ok 3 4938 - Add ctinfo action with valid cpmark and zone
ok 4 7593 - Add ctinfo action with drop control
ok 5 2961 - Replace ctinfo action zone and action control
ok 6 e567 - Delete ctinfo action with valid index
ok 7 6a91 - Delete ctinfo action with invalid index
ok 8 5232 - List ctinfo actions
ok 9 7702 - Flush ctinfo actions
ok 10 3201 - Add ctinfo action with duplicate index
ok 11 8295 - Add ctinfo action with invalid index
ok 12 3964 - Replace ctinfo action with invalid goto_chain control

Fixes: 24ec483cec98 ("net: sched: Introduce act_ctinfo action")
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
---
 net/sched/act_ctinfo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Larysa Zaremba Feb. 13, 2023, 3:10 p.m. UTC | #1
On Fri, Feb 10, 2023 at 05:08:25PM -0300, Pedro Tammela wrote:
> The tc action act_ctinfo was using shared stats, fix it to use percpu stats
> since bstats_update() must be called with locks or with a percpu pointer argument.
> 
> tdc results:
> 1..12
> ok 1 c826 - Add ctinfo action with default setting
> ok 2 0286 - Add ctinfo action with dscp
> ok 3 4938 - Add ctinfo action with valid cpmark and zone
> ok 4 7593 - Add ctinfo action with drop control
> ok 5 2961 - Replace ctinfo action zone and action control
> ok 6 e567 - Delete ctinfo action with valid index
> ok 7 6a91 - Delete ctinfo action with invalid index
> ok 8 5232 - List ctinfo actions
> ok 9 7702 - Flush ctinfo actions
> ok 10 3201 - Add ctinfo action with duplicate index
> ok 11 8295 - Add ctinfo action with invalid index
> ok 12 3964 - Replace ctinfo action with invalid goto_chain control
> 
> Fixes: 24ec483cec98 ("net: sched: Introduce act_ctinfo action")
> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>

Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>

> ---
>  net/sched/act_ctinfo.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sched/act_ctinfo.c b/net/sched/act_ctinfo.c
> index 4b1b59da5..4d15b6a61 100644
> --- a/net/sched/act_ctinfo.c
> +++ b/net/sched/act_ctinfo.c
> @@ -93,7 +93,7 @@ TC_INDIRECT_SCOPE int tcf_ctinfo_act(struct sk_buff *skb,
>  	cp = rcu_dereference_bh(ca->params);
>  
>  	tcf_lastuse_update(&ca->tcf_tm);
> -	bstats_update(&ca->tcf_bstats, skb);
> +	tcf_action_update_bstats(&ca->common, skb);
>  	action = READ_ONCE(ca->tcf_action);
>  
>  	wlen = skb_network_offset(skb);
> @@ -212,8 +212,8 @@ static int tcf_ctinfo_init(struct net *net, struct nlattr *nla,
>  	index = actparm->index;
>  	err = tcf_idr_check_alloc(tn, &index, a, bind);
>  	if (!err) {
> -		ret = tcf_idr_create(tn, index, est, a,
> -				     &act_ctinfo_ops, bind, false, flags);
> +		ret = tcf_idr_create_from_flags(tn, index, est, a,
> +						&act_ctinfo_ops, bind, flags);
>  		if (ret) {
>  			tcf_idr_cleanup(tn, index);
>  			return ret;
> -- 
> 2.34.1
>
patchwork-bot+netdevbpf@kernel.org Feb. 14, 2023, 7 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 10 Feb 2023 17:08:25 -0300 you wrote:
> The tc action act_ctinfo was using shared stats, fix it to use percpu stats
> since bstats_update() must be called with locks or with a percpu pointer argument.
> 
> tdc results:
> 1..12
> ok 1 c826 - Add ctinfo action with default setting
> ok 2 0286 - Add ctinfo action with dscp
> ok 3 4938 - Add ctinfo action with valid cpmark and zone
> ok 4 7593 - Add ctinfo action with drop control
> ok 5 2961 - Replace ctinfo action zone and action control
> ok 6 e567 - Delete ctinfo action with valid index
> ok 7 6a91 - Delete ctinfo action with invalid index
> ok 8 5232 - List ctinfo actions
> ok 9 7702 - Flush ctinfo actions
> ok 10 3201 - Add ctinfo action with duplicate index
> ok 11 8295 - Add ctinfo action with invalid index
> ok 12 3964 - Replace ctinfo action with invalid goto_chain control
> 
> [...]

Here is the summary with links:
  - [net] net/sched: act_ctinfo: use percpu stats
    https://git.kernel.org/netdev/net/c/21c167aa0ba9

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/sched/act_ctinfo.c b/net/sched/act_ctinfo.c
index 4b1b59da5..4d15b6a61 100644
--- a/net/sched/act_ctinfo.c
+++ b/net/sched/act_ctinfo.c
@@ -93,7 +93,7 @@  TC_INDIRECT_SCOPE int tcf_ctinfo_act(struct sk_buff *skb,
 	cp = rcu_dereference_bh(ca->params);
 
 	tcf_lastuse_update(&ca->tcf_tm);
-	bstats_update(&ca->tcf_bstats, skb);
+	tcf_action_update_bstats(&ca->common, skb);
 	action = READ_ONCE(ca->tcf_action);
 
 	wlen = skb_network_offset(skb);
@@ -212,8 +212,8 @@  static int tcf_ctinfo_init(struct net *net, struct nlattr *nla,
 	index = actparm->index;
 	err = tcf_idr_check_alloc(tn, &index, a, bind);
 	if (!err) {
-		ret = tcf_idr_create(tn, index, est, a,
-				     &act_ctinfo_ops, bind, false, flags);
+		ret = tcf_idr_create_from_flags(tn, index, est, a,
+						&act_ctinfo_ops, bind, flags);
 		if (ret) {
 			tcf_idr_cleanup(tn, index);
 			return ret;