From patchwork Mon Jan 11 12:38:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 12010521 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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 0DEAAC433E9 for ; Mon, 11 Jan 2021 12:40:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD0332242A for ; Mon, 11 Jan 2021 12:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbhAKMjr (ORCPT ); Mon, 11 Jan 2021 07:39:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbhAKMjr (ORCPT ); Mon, 11 Jan 2021 07:39:47 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFFF0C061795; Mon, 11 Jan 2021 04:39:06 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id t22so10887854pfl.3; Mon, 11 Jan 2021 04:39:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=PaokGmO6qWSPL+k2UjYk5nu0nOURlCVutGfozluGv3E=; b=hn0P4l59kgByZoOhcADJpAIuYWHE2y78X1nZpCRdYokx1zPBqINoeknlh3fg24jE8A yYH0xxcXTbwkkoHO+fWFRHrGSW+eh8xJb+ASjbkvK2nhqxQOgVYboDpoKJhSkmrIfUR/ O6VCmSqQcx4ptym26pHVxfDei+skWS1wknxYPXMXVQ0l9WUCmAippKzPons1w8z4wsx2 RUHvTytwjVSBhH+Gm5BjfFOWsGDXaFaDcMvZfhk1cDGn9x64zqQICqMRdJKYK9J2R+KJ 682pez2rGAeknLj4lbBLcxwTcHF4D8Clad1TSZVg7qtYTIik/Sv088JY+Tht9r+iVwD8 wiMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=PaokGmO6qWSPL+k2UjYk5nu0nOURlCVutGfozluGv3E=; b=ADJGJHF081gD638T2SrHAqI6roacjRCG7LLSOkCDwOT/CGO5PqfPSrmJs5ZbrbWf01 lNZIXHi6I0QLTZuHfgpKuV6LiOIECvDqb/ZF95e6MvIdUp27NYnMFwbNWtUTZEUYzKvA jyLRSMvcVJdfEtBFkY8nnRfuyOjQ0AxIu/gcRmovyboMdcS6BnBCyp2k4kYeZdfzPkpD 23XTO+feWoo0+xxzsAcy4xhYutqZ1E6qX9Xopn6lx57kjnmG1lOpr8Z4sTRUvIacjnsi pRLqG9mX7uUzwdQ3vELGQmGV/CC/YSzwOP8H96X11n+pBXsLwZFTW3X/CxZO195uniDu iYcw== X-Gm-Message-State: AOAM533HsuVTUNxN481cRJnNYbXecGrPkfzQeeUT2tgTucBu07FhT9Xq 2nDnHkT4mlILENsnXLVSzdQtQEBjdr1PGw== X-Google-Smtp-Source: ABdhPJxIyQpQgepMNy/4W5snHEA4X9URyV3ZWBidbRcHgHhrl9x8eD22ONbppprRR3RVrRJqdlKy8A== X-Received: by 2002:a65:6409:: with SMTP id a9mr19357839pgv.171.1610368746325; Mon, 11 Jan 2021 04:39:06 -0800 (PST) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id c3sm19945209pfi.135.2021.01.11.04.39.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jan 2021 04:39:05 -0800 (PST) From: Xin Long To: network dev , linux-sctp@vger.kernel.org Cc: davem@davemloft.net, Jakub Kicinski , pabeni@redhat.com, Willem de Bruijn , Martin Varghese Subject: [PATCH net-next 1/2] udp: call udp_encap_enable for v6 sockets when enabling encap Date: Mon, 11 Jan 2021 20:38:48 +0800 Message-Id: <8636d49cb2d5deb966ba1112b6d0907f2f595526.1610368263.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When enabling encap for a ipv6 socket without udp_encap_needed_key increased, UDP GRO won't work for v4 mapped v6 address packets as sk will be NULL in udp4_gro_receive(). This patch is to enable it by increasing udp_encap_needed_key for v6 sockets in udp_tunnel_encap_enable(), and correspondingly decrease udp_encap_needed_key in udpv6_destroy_sock(). Reported-by: Chen Yi Signed-off-by: Xin Long Reported-by: kernel test robot --- include/net/udp_tunnel.h | 3 +-- net/ipv6/udp.c | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index 282d10e..afc7ce7 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h @@ -181,9 +181,8 @@ static inline void udp_tunnel_encap_enable(struct socket *sock) #if IS_ENABLED(CONFIG_IPV6) if (sock->sk->sk_family == PF_INET6) ipv6_stub->udpv6_encap_enable(); - else #endif - udp_encap_enable(); + udp_encap_enable(); } #define UDP_TUNNEL_NIC_MAX_TABLES 4 diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index b9f3dfd..265b6a0 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -1608,8 +1608,10 @@ void udpv6_destroy_sock(struct sock *sk) if (encap_destroy) encap_destroy(sk); } - if (up->encap_enabled) + if (up->encap_enabled) { static_branch_dec(&udpv6_encap_needed_key); + static_branch_dec(&udp_encap_needed_key); + } } inet6_destroy_sock(sk); From patchwork Mon Jan 11 12:38:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 12010519 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 X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 46F53C4332B for ; Mon, 11 Jan 2021 12:40:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24DBA2242A for ; Mon, 11 Jan 2021 12:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727010AbhAKMj4 (ORCPT ); Mon, 11 Jan 2021 07:39:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbhAKMjz (ORCPT ); Mon, 11 Jan 2021 07:39:55 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B0EDC06179F; Mon, 11 Jan 2021 04:39:15 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id m6so5314989pfk.1; Mon, 11 Jan 2021 04:39:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=LN8iCFkEESN0ochju51DttjgCNR10tVmwy/p3ps8lpk=; b=od/VJAVV3AUfx5X4yiqa9SB96KL+e0rqJ7X6sB1bVKWf3NXM+vMkSvFYqwY4IDMGqO 395tg/N7zv2ztEGmemp1GAWsCl7zXeGaJtUJ+O2Tcj++4BwxxbWf9HLO+75vSPIdt6Zo ogJ895vH3VasHiNGL25irLQ4OZ09BIiWGpk2hrEk2OwkWTxavEYcsTW9PGxqIdJIn7+Z hH6FV8JzM5qCbG6qGvnH/lgdODnTtkUdfQ1JxV+6LVKpdmOi92i9z0T26swC0pD2/Ypa TlxO9yMmP90dxJtBsQUGYaEKXvApb5O4Pl23FI4kntP4pNKz+7C0He/uswOu17gCgobb 1Gnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=LN8iCFkEESN0ochju51DttjgCNR10tVmwy/p3ps8lpk=; b=jhrxEMau4IFafw+qkVTZcC3d7OfA3LkcaHcIWKHIv1tX9ldkrcVZ716p28SxH91ynU kcTFycVZLwl5uZabg6ghR6tr6VvGXbKrsE0Lkkv1W8+ttg+VhmUmywETL2Ia+cTTXKSe rHsVxxtfgGtdYSietJl1AZhHAaDgKTDrMTNImOPtsM1gK7/RQesNDbCRUGD9lpK4OBcS 1W0gjAEvVAZcZ4U7Nr4+8jzaTGLVp+lDP469t1QqC9K6q5CIFrMqjNV3rJ02qURQ3hnJ p6LVJipn7uyDNkucwMBJzhQfaadx7/Kj3NNKELGNGYiQsJPy+7XA1wsk/qYOkcGEGnZr OYmA== X-Gm-Message-State: AOAM532g8f4zn51NA1Sp0ALkZwtwYaArOV8kIPKDeNEdDo05X9OyW9Iv Why5QCbfJx5CW0F4wXXmyi5rgA/JVIKQQw== X-Google-Smtp-Source: ABdhPJwqkqwf7nh1xqWs8FtOMDcBQEuUQuiVRlg9e+Z7waoBBPLQWsoU5d3MXD6Wq8dMxHu3kZnaMw== X-Received: by 2002:a05:6a00:212a:b029:1a8:6d7b:d62e with SMTP id n10-20020a056a00212ab02901a86d7bd62emr19170407pfj.23.1610368754732; Mon, 11 Jan 2021 04:39:14 -0800 (PST) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id f67sm19483908pfg.159.2021.01.11.04.39.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jan 2021 04:39:14 -0800 (PST) From: Xin Long To: network dev , linux-sctp@vger.kernel.org Cc: davem@davemloft.net, Jakub Kicinski , pabeni@redhat.com, Willem de Bruijn , Martin Varghese Subject: [PATCH net-next 2/2] Revert "bareudp: Fixed bareudp receive handling" Date: Mon, 11 Jan 2021 20:38:49 +0800 Message-Id: <7119d2c8d500ce50e610df3f5a55d5fe7005d8a1.1610368263.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <8636d49cb2d5deb966ba1112b6d0907f2f595526.1610368263.git.lucien.xin@gmail.com> References: <8636d49cb2d5deb966ba1112b6d0907f2f595526.1610368263.git.lucien.xin@gmail.com> In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org As udp_encap_enable() is already called in udp_tunnel_encap_enable() since the last patch, and we don't need it any more. So remove it by reverting commit 81f954a44567567c7d74a97b1db78fb43afc253d. --- drivers/net/bareudp.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index 85de5f9..aed5049 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -240,12 +240,6 @@ static int bareudp_socket_create(struct bareudp_dev *bareudp, __be16 port) tunnel_cfg.encap_destroy = NULL; setup_udp_tunnel_sock(bareudp->net, sock, &tunnel_cfg); - /* As the setup_udp_tunnel_sock does not call udp_encap_enable if the - * socket type is v6 an explicit call to udp_encap_enable is needed. - */ - if (sock->sk->sk_family == AF_INET6) - udp_encap_enable(); - rcu_assign_pointer(bareudp->sock, sock); return 0; }