From patchwork Thu Mar 29 16:59:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lebrun X-Patchwork-Id: 892883 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lCHgbJpu"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40Brb658dSz9s15 for ; Fri, 30 Mar 2018 04:00:02 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752058AbeC2Q77 (ORCPT ); Thu, 29 Mar 2018 12:59:59 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:50221 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751189AbeC2Q7z (ORCPT ); Thu, 29 Mar 2018 12:59:55 -0400 Received: by mail-wm0-f66.google.com with SMTP id l201so11943267wmg.0 for ; Thu, 29 Mar 2018 09:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=8e7hRRsWtdaozBlqEuIUDmmID/bEgvM1pdjFIxZ98TM=; b=lCHgbJpuxisH3CPN0RlMrmYn0KqhFKpVbMeL2REGy4AXmhnexERnHNIlTUZlOf9O0d hSPLzrbnupYICttV0mgG26hNdVTAEf9WCZlVJ/JajoZufBZF+TefDNc5MmXyxK+S8gvn T43zYRMIVE6usPWamV6tBL+t1odi2GP1AT0wFFian67LuMXdLQeAB2JeaRFIK9AULwk0 iDJ6NvprQkys/WiFWqhjWKSekvEkFZPFLY13zIKkrYZhJ5J73azzlcnipgwIxi9KvG1K 6b3Y3WClXO+jQTrCRz5bRwbSaKnqNVhQXatysJFksIGrPvhhDBosvP8ffKBiJFpQQvSB yWAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=8e7hRRsWtdaozBlqEuIUDmmID/bEgvM1pdjFIxZ98TM=; b=nnRYK4vpwkVhxqhyN+sBuhCq2cLrVlEa3IEWWuwqw9D2Onvei1//Qq2yu7emKgZeS/ hc5ikMyoH48jw12bVMDo/zeVXcubiCi5qd5jqF/bnNBbIY0S52ib98Im1OKpJ3sZX/0n lm2PRJkredTx/EdnMeGQ3GokgHy6uxJNrTsvJHm4ssFirCpXA/LulyVWWwcX/9h87C2H hrLkSp1eqVb7UYQPM9PjYepUYqCEg86os+4Xb4E6cEwUdahSsDSNQX9OfqrYOalnOH6j xBKjgEmwwQyKa+WeGOtE8PX9tP/OkPhjXMrr3wxD/1F2b0vzagsbYflLxaGQI66UiyxG F9kQ== X-Gm-Message-State: AElRT7GUjHAT7rRpQ3C9TCU3G++aUnOlaibM7l8i7XI08x/A0kmq674C zxv8fbuLVdqmBJ/YNg24auwKdHXUjFY= X-Google-Smtp-Source: AIpwx4/qv2TaFAF05wF6za5U+h7wJfKaaBUHsbjOavPRPGPPkz/u4+HcBB77MyVPZHWxe4Mw1LJOHw== X-Received: by 10.80.192.72 with SMTP id u8mr8100812edd.16.1522342793722; Thu, 29 Mar 2018 09:59:53 -0700 (PDT) Received: from suzaku.dub.corp.google.com ([2620:0:1040:2012:569d:fe6f:1c9c:e2b]) by smtp.gmail.com with ESMTPSA id e56sm4526503edb.84.2018.03.29.09.59.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 09:59:53 -0700 (PDT) From: David Lebrun To: netdev@vger.kernel.org Cc: David Lebrun , David Lebrun Subject: [PATCH net] ipv6: sr: fix seg6 encap performances with TSO enabled Date: Thu, 29 Mar 2018 17:59:36 +0100 Message-Id: <20180329165936.136443-1-dav.lebrun@gmail.com> X-Mailer: git-send-email 2.17.0.rc1.321.gba9d0f2565-goog Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Lebrun Enabling TSO can lead to abysmal performances when using seg6 in encap mode, such as with the ixgbe driver. This patch adds a call to iptunnel_handle_offloads() to remove the encapsulation bit if needed. Before: root@comp4-seg6bpf:~# iperf3 -c fc00::55 Connecting to host fc00::55, port 5201 [ 4] local fc45::4 port 36592 connected to fc00::55 port 5201 [ ID] Interval Transfer Bandwidth Retr Cwnd [ 4] 0.00-1.00 sec 196 KBytes 1.60 Mbits/sec 47 6.66 KBytes [ 4] 1.00-2.00 sec 304 KBytes 2.49 Mbits/sec 100 5.33 KBytes [ 4] 2.00-3.00 sec 284 KBytes 2.32 Mbits/sec 92 5.33 KBytes After: root@comp4-seg6bpf:~# iperf3 -c fc00::55 Connecting to host fc00::55, port 5201 [ 4] local fc45::4 port 43062 connected to fc00::55 port 5201 [ ID] Interval Transfer Bandwidth Retr Cwnd [ 4] 0.00-1.00 sec 1.03 GBytes 8.89 Gbits/sec 0 743 KBytes [ 4] 1.00-2.00 sec 1.03 GBytes 8.87 Gbits/sec 0 743 KBytes [ 4] 2.00-3.00 sec 1.03 GBytes 8.87 Gbits/sec 0 743 KBytes Reported-by: Tom Herbert Fixes: 6c8702c60b88 ("ipv6: sr: add support for SRH encapsulation and injection with lwtunnels") Signed-off-by: David Lebrun --- net/ipv6/seg6_iptunnel.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c index 7a78dcfda68a..f343e6f0fc95 100644 --- a/net/ipv6/seg6_iptunnel.c +++ b/net/ipv6/seg6_iptunnel.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -211,11 +212,6 @@ static int seg6_do_srh(struct sk_buff *skb) tinfo = seg6_encap_lwtunnel(dst->lwtstate); - if (likely(!skb->encapsulation)) { - skb_reset_inner_headers(skb); - skb->encapsulation = 1; - } - switch (tinfo->mode) { case SEG6_IPTUN_MODE_INLINE: if (skb->protocol != htons(ETH_P_IPV6)) @@ -224,10 +220,12 @@ static int seg6_do_srh(struct sk_buff *skb) err = seg6_do_srh_inline(skb, tinfo->srh); if (err) return err; - - skb_reset_inner_headers(skb); break; case SEG6_IPTUN_MODE_ENCAP: + err = iptunnel_handle_offloads(skb, SKB_GSO_IPXIP6); + if (err) + return err; + if (skb->protocol == htons(ETH_P_IPV6)) proto = IPPROTO_IPV6; else if (skb->protocol == htons(ETH_P_IP)) @@ -239,6 +237,8 @@ static int seg6_do_srh(struct sk_buff *skb) if (err) return err; + skb_set_inner_transport_header(skb, skb_transport_offset(skb)); + skb_set_inner_protocol(skb, skb->protocol); skb->protocol = htons(ETH_P_IPV6); break; case SEG6_IPTUN_MODE_L2ENCAP: @@ -262,8 +262,6 @@ static int seg6_do_srh(struct sk_buff *skb) ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); skb_set_transport_header(skb, sizeof(struct ipv6hdr)); - skb_set_inner_protocol(skb, skb->protocol); - return 0; }