Received: by 10.223.176.5 with SMTP id f5csp806611wra; Sat, 3 Feb 2018 10:43:16 -0800 (PST) X-Google-Smtp-Source: AH8x227aafP0ShSQbzKzwXb7I0KgsVnsbgttOkMvBcuOFRGZzaPXioD6/MDzYUyJ8gXqkRYP90g/ X-Received: by 2002:a17:902:4464:: with SMTP id k91-v6mr10959420pld.267.1517683396432; Sat, 03 Feb 2018 10:43:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517683396; cv=none; d=google.com; s=arc-20160816; b=jQDL0G6nolGUWYN8v/zyz+wu7bMuGSBIOPyS5FTjTldMkALmcM21dbkCy1I6vI695n e22ecJnp0GVhl3pCm5yD/Hr7idRNe7b9ovWiWcTM3mVEyzZzERJUeatOBddMTfpU83/5 YkuvpVHKEdySwkzwsYRam/7R6Z7w4Zgbr5UoMfLZg4PQ5F8kkIRu2harUJhvmRrJ3bZU dEmw9ifIR6L7IKoSBXySqI5vn+aeBeWKlD9wNEQb8oDtBnRfUDW5pAZPDDo/MHoLfiZ7 aUaeoL7RFZWT169xiKKdjWwTl1qDtaDRJ1PyqxpeKzMNsUd3lY47xjQL4iUPGmxB94pp OSWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=3hq2hVx/aRhyim5Xo9BmcMxqOOGh4SD4/CmZc3h34So=; b=MGSCVShgPgVrbBaHVSrMrnxCQ1903cvBOaC3sfWI0uy8/d1VdAYbJ1D/y8J/4T7ZPh sHPFxuOoJ0QO0IwSqjBhuhYH1pL0b1v89zQ8iVCLWbSjuXC+zkOczYHgUvA+6jTLniO5 J3jMcJnHwrvtM/AeKMNB1xeMhYY4okoyn6rFC+ap1rdxDIMSEbN+CfUWapmgX49FR3ED LMHlar+UPwGU8ytBEXyNIagx2K9dDC0ajfyP744f4PsXBrBER3XFWJEPy3xuCGk85pts 2VjrUopj3dH8V4RSRmdo3lVpXEuwWTmXTtpGF6nJGbcCTgS+rFWH0R8nsqV+1osvf09Y HXZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ikCCjkd7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e29si1507008pga.146.2018.02.03.10.43.02; Sat, 03 Feb 2018 10:43:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ikCCjkd7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755119AbeBCSmJ (ORCPT + 99 others); Sat, 3 Feb 2018 13:42:09 -0500 Received: from mail-bl2nam02on0134.outbound.protection.outlook.com ([104.47.38.134]:35168 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753234AbeBCSDZ (ORCPT ); Sat, 3 Feb 2018 13:03:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3hq2hVx/aRhyim5Xo9BmcMxqOOGh4SD4/CmZc3h34So=; b=ikCCjkd7kbBSUSAoagYYKF3E3UuPrVbLFmGWQPgzE1cObX0oBY3qQpcyT7LIH3J9JS/iy5UUCEtBXYE4LviFHl0CVx0/kZsZVJ7Mr50ry5n8AiyLuhnnf64Gwdo/YCvjZBSAQ1K2yjqPNtRSWe2MeSXijr5Hc7svovrbCtij1Vc= Received: from BL0PR2101MB1027.namprd21.prod.outlook.com (52.132.20.161) by BL0PR2101MB1090.namprd21.prod.outlook.com (52.132.24.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.506.1; Sat, 3 Feb 2018 18:01:20 +0000 Received: from BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9]) by BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9%3]) with mapi id 15.20.0485.006; Sat, 3 Feb 2018 18:01:20 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Xin Long , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 038/110] ip6_tunnel: get the min mtu properly in ip6_tnl_xmit Thread-Topic: [PATCH AUTOSEL for 4.14 038/110] ip6_tunnel: get the min mtu properly in ip6_tnl_xmit Thread-Index: AQHTnRjqox8RCZNktESa7e7LyonRUQ== Date: Sat, 3 Feb 2018 18:00:47 +0000 Message-ID: <20180203180015.29073-38-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BL0PR2101MB1090;6:DY0N25kajU4Y1Tn34rVpNmJ1w8oBMXPI2mmabaPrw6z2c9sccUO02C6IMWe7jeJLjwaozFv3c0NkIJiz3p1QNsYV+FUxbkGnM+xS4m1bPKY/Brhr+owX7mWYPSVLJ4onNk/O1Prjsqc8gVmJkRWwh2jWvRcr6L19eIfrGu+7qooXhg6O5NHplNdhvojewrdWACX/AK2yO1a3VjpmqFS+wnB5+6fRo5lmMQp5FpvajZdbitIte30kNoeZW2DbMy5PWxwbHlt3AUDSJb8HaLECIzIYJaZ41PTEBh6IdY6tBUEsCotTqxLheozb8rSiTxWkmdGffcqEuhOwgKqMdTL3HFAMgx3pjOh3bqn0CHCcsqylxWKJu5b5ATy28f3HHFiR;5:yDMBhJoj4u9FHuEnxJYdkE+4e/d700B5XQnXs1pNL47B0m0fhbqZ3qk9gYzbnAR9eA+jWkwEvbpw2dDxqstZUs+BbUKWlGXfAgH6iUE0CiR5QetVt2Xw2bN527mXOFf42w7tHUutzeH/dObmaFwgQ3OS10a8FhqmHxjCbxyPQkU=;24:R5eX0QQjGfEI/UHTfOQYCM6rqSEcxUL/d3j5ezg1cp8ceWndSzy4qacYrU29n44WFCOqj8ruzk6Mo8WuxHocAl5jkggrToxmshU7W6RLFpw=;7:1iB1T26zeSOD8l/MyX4VdnCHHiAwQ8l8Fmshzh9EdhX31TMnEKVKC4hV0jfSdt0rSQt3fYPiZMD5igtCMzHFRpLlAIkJjijqH8POkIk/8Q4gZkEna9ZC7o2bhb4dKdPEHInxBYdY1ZwN/vE7eSyeNCAEK4ecHyP1XvFsm4JRR5lGzOLzf1UF5XwVgTuBMv8wrDAPpE+Xsz3YvrlNQAEqXTy7goi5+XQpSXVq0qvsQY4h5CM80fT61XnC5Yz6Plgv x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: a22a4b4a-283e-47dd-f6a5-08d56b302126 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:BL0PR2101MB1090; x-ms-traffictypediagnostic: BL0PR2101MB1090: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231101)(2400082)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:BL0PR2101MB1090;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB1090; x-forefront-prvs: 05724A8921 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(366004)(396003)(39380400002)(39860400002)(346002)(199004)(189003)(2900100001)(5660300001)(316002)(25786009)(4326008)(14454004)(2950100002)(478600001)(575784001)(39060400002)(107886003)(72206003)(6666003)(22452003)(10290500003)(186003)(3660700001)(86612001)(76176011)(86362001)(53936002)(3280700002)(106356001)(6436002)(6486002)(59450400001)(81166006)(81156014)(2501003)(6506007)(97736004)(26005)(7736002)(6512007)(6346003)(102836004)(105586002)(68736007)(8936002)(5250100002)(305945005)(36756003)(1076002)(6116002)(3846002)(8676002)(110136005)(66066001)(54906003)(2906002)(10090500001)(99286004)(22906009)(15583001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB1090;H:BL0PR2101MB1027.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: EwvhsptZFXoX7akVN/yTvsufwE942vH3mUjMEJSnuSUezg6EXkeYjPa5Zxes9AoI8pmtuVFCpYHvkMQgjc1FMw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: a22a4b4a-283e-47dd-f6a5-08d56b302126 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:00:47.0190 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1090 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xin Long [ Upstream commit c9fefa08190fc879fb2e681035d7774e0a8c5170 ] Now it's using IPV6_MIN_MTU as the min mtu in ip6_tnl_xmit, but IPV6_MIN_MTU actually only works when the inner packet is ipv6. With IPV6_MIN_MTU for ipv4 packets, the new pmtu for inner dst couldn't be set less than 1280. It would cause tx_err and the packet to be dropped when the outer dst pmtu is close to 1280. Jianlin found it by running ipv4 traffic with the topo: (client) gre6 <---> eth1 (route) eth2 <---> gre6 (server) After changing eth2 mtu to 1300, the performance became very low, or the connection was even broken. The issue also affects ip4ip6 and ip6ip6 tunnels. So if the inner packet is ipv4, 576 should be considered as the min mtu. Note that for ip4ip6 and ip6ip6 tunnels, the inner packet can only be ipv4 or ipv6, but for gre6 tunnel, it may also be ARP. This patch using 576 as the min mtu for non-ipv6 packet works for all those cases. Reported-by: Jianlin Shi Signed-off-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/ip6_tunnel.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 3f46121ad139..c3e963a2a017 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1131,8 +1131,13 @@ route_lookup: max_headroom +=3D 8; mtu -=3D 8; } - if (mtu < IPV6_MIN_MTU) - mtu =3D IPV6_MIN_MTU; + if (skb->protocol =3D=3D htons(ETH_P_IPV6)) { + if (mtu < IPV6_MIN_MTU) + mtu =3D IPV6_MIN_MTU; + } else if (mtu < 576) { + mtu =3D 576; + } + if (skb_dst(skb) && !t->parms.collect_md) skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu); if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) { --=20 2.11.0