From patchwork Mon Nov 9 23:47:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 322022 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D83C6C2D0A3 for ; Mon, 9 Nov 2020 23:47:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F217206ED for ; Mon, 9 Nov 2020 23:47:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="l7C3WflO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730456AbgKIXr3 (ORCPT ); Mon, 9 Nov 2020 18:47:29 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:55815 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727311AbgKIXr3 (ORCPT ); Mon, 9 Nov 2020 18:47:29 -0500 Date: Mon, 09 Nov 2020 23:47:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1604965646; bh=uYN8M4VNUEQtV4L58BW2W4twRUw/8B/3sQ69oqzf5Ik=; h=Date:To:From:Cc:Reply-To:Subject:From; b=l7C3WflOqe8XWnTmLJY+5gpnzVnH/Mjgx398KZnT/BnobLVmztvbroExU0Dp1Tio+ RW9bmknOO7ODew6S59iR0JKK3T4mVRpiP4/WWVzZ5ip2x5+IGleQIV5jJdyQxNiex3 svHiWc6NUOCSszEawyMOelTTyAiLaZmqMYOr+OUCRqNI9A+Pe4+v+znt5uxWS3vaRP pQZ3Vo1y9JzyGHEJftnTMFxbV0l2mIbIpYLq7r25dGVVrwqTNYNP5l/jMoZbU/JNSb rQMlFRiUkqanXDR9i/d4crF6kY7oFl/a6m4vvax/P8pphaNiNAa1ReX2MrG9njpwaR jzhuNk4w0ZH1w== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Eric Dumazet , Miaohe Lin , Martin Varghese , Pravin B Shelar , Willem de Bruijn , Guillaume Nault , Al Viro , Florian Westphal , Steffen Klassert , Paolo Abeni , Yadu Kishore , Vladimir Oltean , Alexander Lobakin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v2 net-next] net: skb_vlan_untag(): don't reset transport offset if set by GRO layer Message-ID: <7JgIkgEztzt0W6ZtC9V9Cnk5qfkrUFYcpN871syCi8@cp4-web-040.plabs.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Similar to commit fda55eca5a33f ("net: introduce skb_transport_header_was_set()"), avoid resetting transport offsets that were already set by GRO layer. This not only mirrors the behavior of __netif_receive_skb_core(), but also makes sense when it comes to UDP GSO fraglists forwarding: transport offset of such skbs is set only once by GRO receive callback and remains untouched and correct up to the xmitting driver in 1:1 case, but becomes junk after untagging in ingress VLAN case and breaks UDP GSO offload. This does not happen after this change, and all types of forwarding of UDP GSO fraglists work as expected. Since v1 [1]: - keep the code 1:1 with __netif_receive_skb_core() (Jakub). [1] https://lore.kernel.org/netdev/zYurwsZRN7BkqSoikWQLVqHyxz18h4LhHU4NFa2Vw@cp4-web-038.plabs.ch Signed-off-by: Alexander Lobakin --- net/core/skbuff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 1ba8f0163744..aa3d2828b7a2 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -5430,7 +5430,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb) goto err_free; skb_reset_network_header(skb); - skb_reset_transport_header(skb); + if (!skb_transport_header_was_set(skb)) + skb_reset_transport_header(skb); skb_reset_mac_len(skb); return skb;