From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-x22c.google.com (mail-qk0-x22c.google.com [IPv6:2607:f8b0:400d:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 435013BA8E for ; Mon, 16 Jul 2018 23:16:06 -0400 (EDT) Received: by mail-qk0-x22c.google.com with SMTP id v17-v6so19151174qkb.11 for ; Mon, 16 Jul 2018 20:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=rABkn3pnKl9ZtQVu/GTMdZ6ue2LBY3yP5XuAcyA9KeQ=; b=EaACg0GsEsmiU+8rVkLcertoIjRxdLO1mCOAqMnKK2Q/PRIbCvjxlCjyGMJJsq4wfc vTHggXkyCr2SQ1bwPPooLdooaYfR0phLQZAJ9weHHo3sgvplYFqqCenNUaPPDSV6bqm1 szFwoOzV9IuVAhWO0yv1ysBT2Xqe3A5hl+ZbxVUoGqPbQWhwerqdK35usq2fhHfvgbV2 dsFmlngm0M8vrIedOkcmaA5YRR+y458FXCDZD/qsl1AEM+bxt4DMGlwMnyn9JlOwRn67 6/FqNJvzMs5lpYbfr5+YcYxd1OEYms6wapzETn9fSLXYxVrgQD4+K9hwkHL4e4+86lIn GfrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=rABkn3pnKl9ZtQVu/GTMdZ6ue2LBY3yP5XuAcyA9KeQ=; b=ZSNL943DtGL4MoSHyvGq4fNgPglhcM3QWFanN0u0fOyqJm7Juj4lOh5BUnkTTtud6+ NOLblIlujwN1QNp+se0+RJqxHborT+W0F4d/cowRwZb3QSFPCUxRmO9yTbLguO8SnG/1 1PxT+LQYHBlFBP4yaPAbsOsh7xG7QIOEZdUWAQQVqTs+LjoYJ2h1zz3u2tf/3U+b0iv5 ee7cns6p0HVsjZAlHmXep8gDP2cZPLuxkuZP7a7TdhKWM3lcnJljdygSNbXsjV+0dGzU 7ou3nm+XwJIp+m3jo1prTqJh2rmePsdPmcAc1+gLdXdRAimqPab9oeSsqHUk8zLFVV1d IaoA== X-Gm-Message-State: AOUpUlHoAoVupJv+9jm8eIkuRXWzhdKetPiHOAv4A73AtN/SHpZYbi5J 7TVfMDYW1+rGok8rmpdH+gxK7FrAd5O54tD89Rs= X-Google-Smtp-Source: AAOMgpfuDkYYzJTS1BVWgl5MK33/xYpcOy8Agjcm3AOWxo3TIoRefXcLlU+xparQrt4fMuC8MNv4wAnSTt9MytWeO4w= X-Received: by 2002:a37:21e6:: with SMTP id f99-v6mr15356193qki.206.1531797365447; Mon, 16 Jul 2018 20:16:05 -0700 (PDT) MIME-Version: 1.0 References: <95034fe41fa132b2216686eeb41deaefd997e85b.1531473946.git.pabeni@redhat.com> In-Reply-To: <95034fe41fa132b2216686eeb41deaefd997e85b.1531473946.git.pabeni@redhat.com> From: Dave Taht Date: Mon, 16 Jul 2018 20:15:52 -0700 Message-ID: To: Cake List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: [Cake] Fwd: [PATCH net-next 4/4] act_mirred: use ACT_REDIRECT when possible X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2018 03:16:06 -0000 oooh! ---------- Forwarded message --------- From: Paolo Abeni Date: Fri, Jul 13, 2018 at 2:56 AM Subject: [PATCH net-next 4/4] act_mirred: use ACT_REDIRECT when possible To: Cc: Jamal Hadi Salim , Cong Wang , Jiri Pirko , Alexei Starovoitov , Daniel Borkmann , Marcelo Ricardo Leitner 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 --- 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 =3D 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 =3D READ_ONCE(m->tcfm_eaction); retval =3D READ_ONCE(m->tcf_action); dev =3D rcu_dereference_bh(m->tcfm_dev); + want_ingress =3D tcf_mirred_act_wants_ingress(m_eaction); + if (skb_at_tc_ingress(skb) && tcf_mirred_is_act_redirect(m_eaction)= ) { + skb->tc_redirected =3D 1; + skb->tc_from_ingress =3D 1; + + /* the core redirect code will check dev and its status */ + TCF_RESULT_SET_REDIRECT(res, dev, want_ingress); + res->qstats =3D 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) !=3D tcf_mirred_act_wants_ingress(m_eact= ion) && - m_mac_header_xmit) { + if (skb_at_tc_ingress(skb) !=3D want_ingress && m_mac_header_xmit) = { if (!skb_at_tc_ingress(skb)) { /* caught at egress, act ingress: pull mac */ mac_len =3D skb_network_header(skb) - skb_mac_heade= r(skb); -- 2.17.1 --=20 Dave T=C3=A4ht CEO, TekLibre, LLC http://www.teklibre.com Tel: 1-669-226-2619