From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eyal Birger Subject: Re: [PATCH net-next 4/4] act_mirred: use ACT_REDIRECT when possible Date: Tue, 17 Jul 2018 10:01:27 +0300 Message-ID: <20180717100127.1ed136fb@jimi> References: <95034fe41fa132b2216686eeb41deaefd997e85b.1531473946.git.pabeni@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Paolo Abeni , Linux Kernel Network Developers , Jamal Hadi Salim , Jiri Pirko , Alexei Starovoitov , Daniel Borkmann , Marcelo Ricardo Leitner , shmulik.ladkani@gmail.com To: Cong Wang Return-path: Received: from mail-wr1-f68.google.com ([209.85.221.68]:39923 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727481AbeGQHck (ORCPT ); Tue, 17 Jul 2018 03:32:40 -0400 Received: by mail-wr1-f68.google.com with SMTP id h10-v6so63337wre.6 for ; Tue, 17 Jul 2018 00:01:33 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: Hi, On Mon, 16 Jul 2018 16:39:55 -0700 Cong Wang wrote: > On Fri, Jul 13, 2018 at 2:55 AM Paolo Abeni wrote: > > > > 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. > > Avoiding skb_clone() for redirection is cool, but why need to use > skb_do_redirect() here? > > There is a subtle difference here: > > skb_do_redirect() calls __bpf_rx_skb() which calls > dev_forward_skb(). > > while the current mirred action doesn't scrub packets when > redirecting to ingress (from egress). Although I forget if it is > intentionally. > > Also, skb->skb_iif is unset in skb_do_redirect() when > redirecting to ingress, I recall we have to set it correctly > for input routing. Probably yet another reason why we > can't scrub it, unless my memory goes wrong. :) Also dev_forward_skb() enforces MTU checks on the packet which are not done at the moment. I am aware of deployments where this would break things. Eyal.