From: wenxu@ucloud.cn
To: kuba@kernel.org, marcelo.leitner@gmail.com, vladbu@nvidia.com
Cc: netdev@vger.kernel.org
Subject: [PATCH v10 net-next 2/3] net/sched: act_mirred: refactor the handle of xmit
Date: Thu, 12 Nov 2020 11:24:56 +0800 [thread overview]
Message-ID: <1605151497-29986-3-git-send-email-wenxu@ucloud.cn> (raw)
In-Reply-To: <1605151497-29986-1-git-send-email-wenxu@ucloud.cn>
From: wenxu <wenxu@ucloud.cn>
This one is prepare for the next patch.
Signed-off-by: wenxu <wenxu@ucloud.cn>
---
v10: no change
include/net/sch_generic.h | 5 -----
net/sched/act_mirred.c | 21 +++++++++++++++------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index d8fd867..dd74f06 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -1281,9 +1281,4 @@ void mini_qdisc_pair_init(struct mini_Qdisc_pair *miniqp, struct Qdisc *qdisc,
void mini_qdisc_pair_block_init(struct mini_Qdisc_pair *miniqp,
struct tcf_block *block);
-static inline int skb_tc_reinsert(struct sk_buff *skb, struct tcf_result *res)
-{
- return res->ingress ? netif_receive_skb(skb) : dev_queue_xmit(skb);
-}
-
#endif
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index e24b7e2..17d0095 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -205,6 +205,18 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
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);
--
1.8.3.1
next prev parent reply other threads:[~2020-11-12 5:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 3:24 [PATCH v10 net-next 0/3] net/sched: fix over mtu packet of defrag in wenxu
2020-11-12 3:24 ` [PATCH v10 net-next 1/3] net/sched: fix miss init the mru in qdisc_skb_cb wenxu
2020-11-12 3:24 ` wenxu [this message]
2020-11-12 3:24 ` [PATCH v10 net-next 3/3] net/sched: act_frag: add implict packet fragment support wenxu
2020-11-12 22:20 ` Jakub Kicinski
2020-11-13 2:25 ` Marcelo Ricardo Leitner
2020-11-13 17:04 ` Jakub Kicinski
2020-11-14 18:05 ` Cong Wang
2020-11-14 22:46 ` Marcelo Ricardo Leitner
2020-11-16 18:57 ` Cong Wang
2020-11-15 13:05 ` wenxu
2020-11-15 16:26 ` Jamal Hadi Salim
2020-11-16 1:09 ` wenxu
2020-11-16 19:01 ` Cong Wang
2020-11-17 4:01 ` wenxu
2020-11-17 22:43 ` Cong Wang
2020-11-17 23:21 ` wenxu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1605151497-29986-3-git-send-email-wenxu@ucloud.cn \
--to=wenxu@ucloud.cn \
--cc=kuba@kernel.org \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=vladbu@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox