Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
From: Dave Taht <dave.taht@gmail.com>
To: Cake List <cake@lists.bufferbloat.net>
Subject: [Cake] Fwd: [PATCH net-next 4/4] act_mirred: use ACT_REDIRECT when possible
Date: Mon, 16 Jul 2018 20:15:52 -0700	[thread overview]
Message-ID: <CAA93jw48YMuuxTTbWmoCWZooRTtt9DrrGueOUn6PhVcQAzq33w@mail.gmail.com> (raw)
In-Reply-To: <95034fe41fa132b2216686eeb41deaefd997e85b.1531473946.git.pabeni@redhat.com>

oooh!

---------- Forwarded message ---------
From: Paolo Abeni <pabeni@redhat.com>
Date: Fri, Jul 13, 2018 at 2:56 AM
Subject: [PATCH net-next 4/4] act_mirred: use ACT_REDIRECT when possible
To: <netdev@vger.kernel.org>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>, Cong Wang
<xiyou.wangcong@gmail.com>, Jiri Pirko <jiri@resnulli.us>, Alexei
Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>,
Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>


When mirred is invoked from the ingress path, and it wants to redirect
the processed packet, it can now use the ACT_REDIRECT action,
filling the tcf_result accordingly.

This avoids a skb_clone() in the TC S/W data path giving a ~10%
improvement in forwarding performances. Overall TC S/W performances
are now comparable to the kernel openswitch datapath.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/sched/act_mirred.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index eeb335f03102..b19317426117 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -175,6 +175,7 @@ static int tcf_mirred(struct sk_buff *skb, const
struct tc_action *a,
        struct net_device *dev;
        struct sk_buff *skb2;
        int retval, err = 0;
+       bool want_ingress;
        int m_eaction;
        int mac_len;

@@ -185,6 +186,17 @@ static int tcf_mirred(struct sk_buff *skb, const
struct tc_action *a,
        m_eaction = READ_ONCE(m->tcfm_eaction);
        retval = READ_ONCE(m->tcf_action);
        dev = rcu_dereference_bh(m->tcfm_dev);
+       want_ingress = tcf_mirred_act_wants_ingress(m_eaction);
+       if (skb_at_tc_ingress(skb) && tcf_mirred_is_act_redirect(m_eaction)) {
+               skb->tc_redirected = 1;
+               skb->tc_from_ingress = 1;
+
+               /* the core redirect code will check dev and its status */
+               TCF_RESULT_SET_REDIRECT(res, dev, want_ingress);
+               res->qstats = this_cpu_ptr(m->common.cpu_qstats);
+               return TC_ACT_REDIRECT;
+       }
+
        if (unlikely(!dev)) {
                pr_notice_once("tc mirred: target device is gone\n");
                goto out;
@@ -204,8 +216,7 @@ static int tcf_mirred(struct sk_buff *skb, const
struct tc_action *a,
         * and devices expect a mac header on xmit, then mac push/pull is
         * needed.
         */
-       if (skb_at_tc_ingress(skb) != tcf_mirred_act_wants_ingress(m_eaction) &&
-           m_mac_header_xmit) {
+       if (skb_at_tc_ingress(skb) != want_ingress && m_mac_header_xmit) {
                if (!skb_at_tc_ingress(skb)) {
                        /* caught at egress, act ingress: pull mac */
                        mac_len = skb_network_header(skb) - skb_mac_header(skb);
--
2.17.1



-- 

Dave Täht
CEO, TekLibre, LLC
http://www.teklibre.com
Tel: 1-669-226-2619

           reply	other threads:[~2018-07-17  3:16 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <95034fe41fa132b2216686eeb41deaefd997e85b.1531473946.git.pabeni@redhat.com>]

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

  List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA93jw48YMuuxTTbWmoCWZooRTtt9DrrGueOUn6PhVcQAzq33w@mail.gmail.com \
    --to=dave.taht@gmail.com \
    --cc=cake@lists.bufferbloat.net \
    /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