diff options
author | wenxu <wenxu@ucloud.cn> | 2020-11-25 12:01:22 +0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-27 14:36:02 -0800 |
commit | fa6d639930ee5cd3f932cc314f3407f07a06582d (patch) | |
tree | 45ba46c4afbe2ee321c88882713381ce8d391a01 /net/sched | |
parent | aadaca9e7c392dbf877af8cefb156199f1a67bbe (diff) |
net/sched: act_mirred: refactor the handle of xmit
This one is prepare for the next patch.
Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/act_mirred.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index e24b7e2331cd..17d00958047e 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -205,6 +205,18 @@ release_idr: return err; } +static int tcf_mirred_forward(bool want_ingress, struct sk_buff *skb) +{ + int err; + + if (!want_ingress) + err = dev_queue_xmit(skb); + else + err = netif_receive_skb(skb); + + return err; +} + static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res) { @@ -287,18 +299,15 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, /* let's the caller reinsert the packet, if possible */ if (use_reinsert) { res->ingress = want_ingress; - if (skb_tc_reinsert(skb, res)) + err = tcf_mirred_forward(res->ingress, skb); + if (err) tcf_action_inc_overlimit_qstats(&m->common); __this_cpu_dec(mirred_rec_level); return TC_ACT_CONSUMED; } } - if (!want_ingress) - err = dev_queue_xmit(skb2); - else - err = netif_receive_skb(skb2); - + err = tcf_mirred_forward(want_ingress, skb2); if (err) { out: tcf_action_inc_overlimit_qstats(&m->common); |