Skip to content

Commit

Permalink
net: sched: cls_api: make reclassify return all the way back to the o…
Browse files Browse the repository at this point in the history
…riginal tp

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Pirko authored and David S. Miller committed May 25, 2017
1 parent abc7a4e commit ee538dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/sched/cls_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ee538dc

Please sign in to comment.