netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next] net: sched: cls_api: make reclassify return all the way back to the original tp
@ 2017-05-23  7:11 Jiri Pirko
  2017-05-23 11:50 ` Simon Horman
  2017-05-25 16:12 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Pirko @ 2017-05-23  7:11 UTC (permalink / raw)
  To: netdev
  Cc: davem, jhs, xiyou.wangcong, dsa, edumazet, daniel,
	alexander.h.duyck, simon.horman, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

With the introduction of chain goto action, the reclassification would
cause the re-iteration of the actual chain. It makes more sense to restart
the whole thing and re-iterate starting from the original tp - start
of chain 0.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 net/sched/cls_api.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 01a8b8b..89fbb35 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -300,7 +300,8 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 	__be16 protocol = tc_skb_protocol(skb);
 #ifdef CONFIG_NET_CLS_ACT
 	const int max_reclassify_loop = 4;
-	const struct tcf_proto *old_tp = tp;
+	const struct tcf_proto *orig_tp = tp;
+	const struct tcf_proto *first_tp;
 	int limit = 0;
 
 reclassify:
@@ -315,9 +316,10 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 		err = tp->classify(skb, tp, res);
 #ifdef CONFIG_NET_CLS_ACT
 		if (unlikely(err == TC_ACT_RECLASSIFY && !compat_mode)) {
+			first_tp = orig_tp;
 			goto reset;
 		} else if (unlikely(TC_ACT_EXT_CMP(err, TC_ACT_GOTO_CHAIN))) {
-			old_tp = res->goto_tp;
+			first_tp = res->goto_tp;
 			goto reset;
 		}
 #endif
@@ -335,7 +337,7 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 		return TC_ACT_SHOT;
 	}
 
-	tp = old_tp;
+	tp = first_tp;
 	protocol = tc_skb_protocol(skb);
 	goto reclassify;
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch net-next] net: sched: cls_api: make reclassify return all the way back to the original tp
  2017-05-23  7:11 [patch net-next] net: sched: cls_api: make reclassify return all the way back to the original tp Jiri Pirko
@ 2017-05-23 11:50 ` Simon Horman
  2017-05-25 16:12 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2017-05-23 11:50 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, jhs, xiyou.wangcong, dsa, edumazet, daniel,
	alexander.h.duyck, mlxsw

On Tue, May 23, 2017 at 09:11:59AM +0200, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
> 
> With the introduction of chain goto action, the reclassification would
> cause the re-iteration of the actual chain. It makes more sense to restart
> the whole thing and re-iterate starting from the original tp - start
> of chain 0.
> 
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Reviewed-by: Simon Horman <simon.horman@netronome.com>

> ---
>  net/sched/cls_api.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
> index 01a8b8b..89fbb35 100644
> --- a/net/sched/cls_api.c
> +++ b/net/sched/cls_api.c
> @@ -300,7 +300,8 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
>  	__be16 protocol = tc_skb_protocol(skb);
>  #ifdef CONFIG_NET_CLS_ACT
>  	const int max_reclassify_loop = 4;
> -	const struct tcf_proto *old_tp = tp;
> +	const struct tcf_proto *orig_tp = tp;
> +	const struct tcf_proto *first_tp;
>  	int limit = 0;
>  
>  reclassify:
> @@ -315,9 +316,10 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
>  		err = tp->classify(skb, tp, res);
>  #ifdef CONFIG_NET_CLS_ACT
>  		if (unlikely(err == TC_ACT_RECLASSIFY && !compat_mode)) {
> +			first_tp = orig_tp;
>  			goto reset;
>  		} else if (unlikely(TC_ACT_EXT_CMP(err, TC_ACT_GOTO_CHAIN))) {
> -			old_tp = res->goto_tp;
> +			first_tp = res->goto_tp;
>  			goto reset;
>  		}
>  #endif
> @@ -335,7 +337,7 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
>  		return TC_ACT_SHOT;
>  	}
>  
> -	tp = old_tp;
> +	tp = first_tp;
>  	protocol = tc_skb_protocol(skb);
>  	goto reclassify;
>  #endif
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch net-next] net: sched: cls_api: make reclassify return all the way back to the original tp
  2017-05-23  7:11 [patch net-next] net: sched: cls_api: make reclassify return all the way back to the original tp Jiri Pirko
  2017-05-23 11:50 ` Simon Horman
@ 2017-05-25 16:12 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-05-25 16:12 UTC (permalink / raw)
  To: jiri
  Cc: netdev, jhs, xiyou.wangcong, dsa, edumazet, daniel,
	alexander.h.duyck, simon.horman, mlxsw

From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 23 May 2017 09:11:59 +0200

> From: Jiri Pirko <jiri@mellanox.com>
> 
> With the introduction of chain goto action, the reclassification would
> cause the re-iteration of the actual chain. It makes more sense to restart
> the whole thing and re-iterate starting from the original tp - start
> of chain 0.
> 
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Applied, thanks Jiri.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-25 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-23  7:11 [patch net-next] net: sched: cls_api: make reclassify return all the way back to the original tp Jiri Pirko
2017-05-23 11:50 ` Simon Horman
2017-05-25 16:12 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).