From patchwork Fri Apr 29 05:25:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peilin Ye X-Patchwork-Id: 12831451 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 988FEC433EF for ; Fri, 29 Apr 2022 05:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243588AbiD2F25 (ORCPT ); Fri, 29 Apr 2022 01:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237794AbiD2F2z (ORCPT ); Fri, 29 Apr 2022 01:28:55 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1CD684EFB; Thu, 28 Apr 2022 22:25:36 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id t16so5010988qtr.9; Thu, 28 Apr 2022 22:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OAy3D8KG1WItCo1uWz9O7MRxic5ddgVF3Xz+AKLcLUY=; b=At6SVEC2gv812iSE4kuSDMTI+RBFdYYB10jFvxc8t3pGZ/KBr3kvnGKBKh7H8S/+kS Gm5gnYy1/nEqMO7mt2zPSEgsQc2bx8XP1SDmVWn26cVShMENDcUD9lPZQ6jsmgtV0QKk 52gVj8SBhZ6ZHHrSpZIUyZIvI7n5xVRr/ztkX9pta1iUcD06qB7xsuYYGoVDFc5oJU18 AcdSHHplpCdWse9CNq+nH+45rbM1DB+Pgp/IYDsoEIdBhVjPIc3xxmmvp2qyT0U3xIf9 ftESFwfAlO+GZlN0ZFIXDRg+QQden6nbRIvmLvn+wglJ5vU6w98Q3DVPmgX3YmExpkIK vKjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OAy3D8KG1WItCo1uWz9O7MRxic5ddgVF3Xz+AKLcLUY=; b=62SiHGHvTV0ReCl9NOueiq/uQB32gRMg32qvSYRJmtsUPkiI3GYVg6OI1YIE5Wf8Xs MjK9WEZPlGA9z/DtpJprhAsbkSx1iop+XGhw/Ld5bnEC/kjip1rZfzkB4Y/3hVxUa+fG d+5wZ+olfhPJGhXhqUdp/TOHc24aMrjGZtDqdbmrikIHYMgqSZflgArfUkMHqSCx9Nov p78FcEjWMasWriHvsP2Otpm5rgXc/6aQlyR4Mk/vwnwFmw82ktmWCOITvKNbDb2XHg9T gRIF1ULpCASJetMJEV1DQdSMYUzllWTU3CYZ+OHvWLejrNptChJQJJHj0vIvMET7h35t Z79g== X-Gm-Message-State: AOAM530KPvz8iOYj0x7iJn3ErJ1ztTroiQpYAARiJA5vDTQYr6q+qSOc b2ngOtN+govd+xBY0iOtA26DL7gozw== X-Google-Smtp-Source: ABdhPJxS3GgNNWmG4T2iFaq+IwKU8jIFjSmEMcLGLOXWZJB3RJ1uF6KGiKPBhEAJT3HLCIjRiDtpYQ== X-Received: by 2002:ac8:5c0d:0:b0:2f3:6774:7496 with SMTP id i13-20020ac85c0d000000b002f367747496mr17325176qti.414.1651209935823; Thu, 28 Apr 2022 22:25:35 -0700 (PDT) Received: from bytedance.attlocal.net (ec2-52-52-7-82.us-west-1.compute.amazonaws.com. [52.52.7.82]) by smtp.gmail.com with ESMTPSA id i68-20020a375447000000b006809e0adfffsm1041053qkb.25.2022.04.28.22.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 22:25:35 -0700 (PDT) From: Peilin Ye To: "David S. Miller" , Jakub Kicinski , Eric Dumazet , Hideaki YOSHIFUJI , David Ahern , Paolo Abeni Cc: Peilin Ye , William Tu , Cong Wang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Peilin Ye Subject: [PATCH v2 net-next 1/2] ip_gre: Make GRE and GRETAP devices always NETIF_F_LLTX Date: Thu, 28 Apr 2022 22:25:21 -0700 Message-Id: <9898b5249aa3c188cb02179aa7d6d4e7e831cbf9.1651207788.git.peilin.ye@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Peilin Ye Recently we made o_seqno atomic_t. Stop special-casing TUNNEL_SEQ, and always mark GRE[TAP] devices as NETIF_F_LLTX, since we no longer need the TX lock (&txq->_xmit_lock). Signed-off-by: Peilin Ye --- change since v1: - deleted "depends on patch..." in commit message net/ipv4/ip_gre.c | 50 +++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 8cf86e42c1d1..a81c2964f70b 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -748,6 +748,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb, static void ipgre_link_update(struct net_device *dev, bool set_mtu) { struct ip_tunnel *tunnel = netdev_priv(dev); + __be16 flags; int len; len = tunnel->tun_hlen; @@ -763,19 +764,15 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu) if (set_mtu) dev->mtu = max_t(int, dev->mtu - len, 68); - if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { - if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || - tunnel->encap.type == TUNNEL_ENCAP_NONE) { - dev->features |= NETIF_F_GSO_SOFTWARE; - dev->hw_features |= NETIF_F_GSO_SOFTWARE; - } else { - dev->features &= ~NETIF_F_GSO_SOFTWARE; - dev->hw_features &= ~NETIF_F_GSO_SOFTWARE; - } - dev->features |= NETIF_F_LLTX; - } else { + flags = tunnel->parms.o_flags; + + if (flags & TUNNEL_SEQ || + (flags & TUNNEL_CSUM && tunnel->encap.type != TUNNEL_ENCAP_NONE)) { + dev->features &= ~NETIF_F_GSO_SOFTWARE; dev->hw_features &= ~NETIF_F_GSO_SOFTWARE; - dev->features &= ~(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE); + } else { + dev->features |= NETIF_F_GSO_SOFTWARE; + dev->hw_features |= NETIF_F_GSO_SOFTWARE; } } @@ -949,6 +946,7 @@ static void ipgre_tunnel_setup(struct net_device *dev) static void __gre_tunnel_init(struct net_device *dev) { struct ip_tunnel *tunnel; + __be16 flags; tunnel = netdev_priv(dev); tunnel->tun_hlen = gre_calc_hlen(tunnel->parms.o_flags); @@ -957,25 +955,21 @@ static void __gre_tunnel_init(struct net_device *dev) tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; dev->needed_headroom = tunnel->hlen + sizeof(tunnel->parms.iph); - dev->features |= GRE_FEATURES; + dev->features |= GRE_FEATURES | NETIF_F_LLTX; dev->hw_features |= GRE_FEATURES; - if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { - /* TCP offload with GRE SEQ is not supported, nor - * can we support 2 levels of outer headers requiring - * an update. - */ - if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || - (tunnel->encap.type == TUNNEL_ENCAP_NONE)) { - dev->features |= NETIF_F_GSO_SOFTWARE; - dev->hw_features |= NETIF_F_GSO_SOFTWARE; - } + flags = tunnel->parms.o_flags; - /* Can use a lockless transmit, unless we generate - * output sequences - */ - dev->features |= NETIF_F_LLTX; - } + /* TCP offload with GRE SEQ is not supported, nor can we support 2 + * levels of outer headers requiring an update. + */ + if (flags & TUNNEL_SEQ) + return; + if (flags & TUNNEL_CSUM && tunnel->encap.type != TUNNEL_ENCAP_NONE) + return; + + dev->features |= NETIF_F_GSO_SOFTWARE; + dev->hw_features |= NETIF_F_GSO_SOFTWARE; } static int ipgre_tunnel_init(struct net_device *dev) From patchwork Fri Apr 29 05:25:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peilin Ye X-Patchwork-Id: 12831452 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D7F6C433EF for ; Fri, 29 Apr 2022 05:26:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344183AbiD2F3X (ORCPT ); Fri, 29 Apr 2022 01:29:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237794AbiD2F3W (ORCPT ); Fri, 29 Apr 2022 01:29:22 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D2D686E32; Thu, 28 Apr 2022 22:26:05 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id hf18so5048378qtb.0; Thu, 28 Apr 2022 22:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Uhh8KkVQKj93He9mfBmvkNfU4S0Pc0yD3FtSa0pLqVA=; b=Mb/7wwh4831Z0tDdbn6KvWW0haocqyUf9NwCWIqttad4W4eQ58+8sNL7hc05f8pFb/ BFWrIe7Iz17kU6XRHfrMHRuYgcamwFZH5lEUNhLs465dvrGd2bEPyQQIESz/WGZPWJ6v ng+OzSrK6vpm0f/0lJqwfzh5Yeoi041VwaYpNdR/+V+hx4G1Dp3dKNpsifoIFvqhyVPH CSW1vJdnDEig1tJdA8UyxI8/pXpxel5Ev/xonqQE3lPNZJpSrCJI+QE0oUjoEg1wd0Bt PaZpOnox5bqEQ9d3AbROMidRa/dN1XTYuzCUSIbGgyioeHG5tze4K3Hrovp7Rr1tUtS0 J8FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Uhh8KkVQKj93He9mfBmvkNfU4S0Pc0yD3FtSa0pLqVA=; b=Eb+QzFL7zXXAl4cm3qI/TKu4EIyzjp6f4akilxcQdenV/BWx5HMM3WV6uBOXtx/Nqx XnFGx+Rvv3ysEoVEIkFZ1VCkN9YMOoJ0zjAD80bM/ONYTuWaFEAi3iCYYTTpFrFJL8Bo ZXMP9z0qX5pD3qwM0QYz6IsMJ8w9PnWRemq8aBqMaod/DGenIvn3Lq5lREh10JjxUU7S VuC5sm36YL4Q94MZQ9+SyepAO+r6JH6ixbScBnM/o32w6NdQDK/Uu2gmWgA2C3hSow+M j60xjehY0DDjYnhRfpmtdo7PfEPQ0l2GEtbB42fXIPDjGd4o0PzNS6CxdC6leZufFIL/ n4Uw== X-Gm-Message-State: AOAM533tbUwuz7oWSk2sPikzFIM8P2mvK7W5qTJod9IvnTe5vLj/RxaW bEbGrPJ4NPAObb9eSaDFzQ== X-Google-Smtp-Source: ABdhPJx6ng4fNeivixfLu5EH2N9vzutg/NCqQjeNYY0mGmu8xNDkEgZzrgcOblRhQ1q5SraMraRswQ== X-Received: by 2002:a05:622a:1113:b0:2f3:716a:1e04 with SMTP id e19-20020a05622a111300b002f3716a1e04mr14622930qty.388.1651209964767; Thu, 28 Apr 2022 22:26:04 -0700 (PDT) Received: from bytedance.attlocal.net (ec2-52-52-7-82.us-west-1.compute.amazonaws.com. [52.52.7.82]) by smtp.gmail.com with ESMTPSA id v67-20020a376146000000b0069ec181a0c6sm995098qkb.10.2022.04.28.22.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 22:26:04 -0700 (PDT) From: Peilin Ye To: "David S. Miller" , Jakub Kicinski , Eric Dumazet , Hideaki YOSHIFUJI , David Ahern , Paolo Abeni Cc: Peilin Ye , William Tu , Cong Wang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Peilin Ye Subject: [PATCH v2 net-next 2/2] ip6_gre: Make IP6GRE and IP6GRETAP devices always NETIF_F_LLTX Date: Thu, 28 Apr 2022 22:25:47 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Peilin Ye Recently we made o_seqno atomic_t. Stop special-casing TUNNEL_SEQ, and always mark IP6GRE[TAP] devices as NETIF_F_LLTX, since we no longer need the TX lock (&txq->_xmit_lock). Signed-off-by: Peilin Ye --- (no changes since v1) net/ipv6/ip6_gre.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 5136959b3dc5..4e37f7c29900 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -382,11 +382,6 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net, goto failed_free; ip6gre_tnl_link_config(nt, 1); - - /* Can use a lockless transmit, unless we generate output sequences */ - if (!(nt->parms.o_flags & TUNNEL_SEQ)) - dev->features |= NETIF_F_LLTX; - ip6gre_tunnel_link(ign, nt); return nt; @@ -1445,26 +1440,23 @@ static void ip6gre_tunnel_setup(struct net_device *dev) static void ip6gre_tnl_init_features(struct net_device *dev) { struct ip6_tnl *nt = netdev_priv(dev); + __be16 flags; - dev->features |= GRE6_FEATURES; + dev->features |= GRE6_FEATURES | NETIF_F_LLTX; dev->hw_features |= GRE6_FEATURES; - if (!(nt->parms.o_flags & TUNNEL_SEQ)) { - /* TCP offload with GRE SEQ is not supported, nor - * can we support 2 levels of outer headers requiring - * an update. - */ - if (!(nt->parms.o_flags & TUNNEL_CSUM) || - nt->encap.type == TUNNEL_ENCAP_NONE) { - dev->features |= NETIF_F_GSO_SOFTWARE; - dev->hw_features |= NETIF_F_GSO_SOFTWARE; - } + flags = nt->parms.o_flags; - /* Can use a lockless transmit, unless we generate - * output sequences - */ - dev->features |= NETIF_F_LLTX; - } + /* TCP offload with GRE SEQ is not supported, nor can we support 2 + * levels of outer headers requiring an update. + */ + if (flags & TUNNEL_SEQ) + return; + if (flags & TUNNEL_CSUM && nt->encap.type != TUNNEL_ENCAP_NONE) + return; + + dev->features |= NETIF_F_GSO_SOFTWARE; + dev->hw_features |= NETIF_F_GSO_SOFTWARE; } static int ip6gre_tunnel_init_common(struct net_device *dev)