Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp51390pxb; Tue, 12 Jan 2021 19:46:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2llc7gB0KdblQcmzSRn+wjP/jD2vcB+jk2fulvoXXLzw84alASqnzTNBXEp60cB3dOBmn X-Received: by 2002:a05:6402:14c5:: with SMTP id f5mr191948edx.232.1610509585596; Tue, 12 Jan 2021 19:46:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610509585; cv=none; d=google.com; s=arc-20160816; b=gOewTfNAVPDQhsRlxHI7rHgrFGz3pVbbf09YWpgQOxKcWlPISzNWPdYfR0SNbveAl9 CPDghC8Ncl8uQLFx9sU7jJfmCtW65fu9sCxcIaL5lO2zAkIsHiRgBoHEBFKWKg7IwABd FBhMKxA7IrO8rywnflsbPAGNPVJcv/GhfMfcr8XiEbWHdM2s/FFfuvvVazABKrAIDfvO /5neuLOEP+jWq5UycQKiPUyWKN0aF9/QrxzHYQKBmyUE4HSRgLGvSu44Hvh90FMwWXwP zQPYIhEqRb/FOSagWbsYQSoIRxHKUxbksjlixg7brf1G6gZL+MLDmTyfb98afHE7qV2r T2rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=n+GtAJdX02GEobGs/GY4hI1xOo4ulcWjQuscSmciDpA=; b=pgvFQvi/qpD07Si4I5EvzpH4fRpZcX9ykoMb0t5//w5cg2KFop5pwW1KB/RSGGOHCB oUAx1v824bAbVwbkCt2+B/ofbJ5yrkezQv7DSMLhJiyAB5/kW7A4/xKm9yOHw4Qu2KiF GDInRnHs8G1VIBtDQAv48lHhBvvjFCHPCYscTf3BymDsGpXBGfYEdRfUDua6/P32SAgc LOyjEWX8Y76019KLNWuxgfX9l9fEpB1meZ6IjvAxDBR3BuOm2lVDHVVPISSe92k3/NPh Ni26o0TRO7zRZOvL/uYZvIhWcSdbQSQDdJvCNENlnEI6Stl0K/bws/icnIWgbrLfUMc6 dwlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nSaZ1ABE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn23si300560edb.27.2021.01.12.19.46.02; Tue, 12 Jan 2021 19:46:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nSaZ1ABE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728882AbhAMDNd (ORCPT + 99 others); Tue, 12 Jan 2021 22:13:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728874AbhAMDNc (ORCPT ); Tue, 12 Jan 2021 22:13:32 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1BBCC061786; Tue, 12 Jan 2021 19:12:52 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id c132so586944pga.3; Tue, 12 Jan 2021 19:12:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=n+GtAJdX02GEobGs/GY4hI1xOo4ulcWjQuscSmciDpA=; b=nSaZ1ABEqPUOTcU+VP9TtnSmHLljgDsCErzkwBQhku4uuJWzXnLxU6iWNrGrMj+xrl hprOlTkdSOyiE/kd6A7Q24LAyNMAptoAgjdEngZETNoF8LZImoZb9ra/qzECPkETvJwS /EqjXJepj6qnrm2AS8cR2QL63jsACbDsXx3TiANJWBq5OFsd0/VSn8wlrgz7sx2Xv9+b kQnmp8NVYc5BvQOnL2zdBHwap1XABHTpUZOHuh3PuA+LfD0GZ6NaUTsosDxcMqol/wyN sx+9TSrsKzMvruWl/xl9KCrLzZKjyDiO0M2+/rQ0njsvN+B31VqXnhfK4Xmz99Rv2Gin /cZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=n+GtAJdX02GEobGs/GY4hI1xOo4ulcWjQuscSmciDpA=; b=M4bmthLrH9J1c5WNaUGREJijwrkJhoCNLuLRKi+JR0Gggrvq7bsewNWz9EbQWpMprq e+jqw5hjWx6WQ9UiQ4lAUJsJzj01iNu70Zk5YFb6XlyszTy3bNVQERKzNZBgK9RmFPjb MxAVjNAJyxIrXv4s1jklSKxM62HaeBqVMQ8FhMoL/8LPX1FZ4/TsLZoBEZSTxsKHq8ao pyfhis79mexqNRpeTxKQPbfSyLCis0VoVCAFN7LDp9WIjFxQ8qGitRLyhivPaqbjddVj t5RAujvufqrxFSKDV26MtpnuMSV+nE6f1GUFKP0EJWQ+zyBFZ0qRcahK2H7yDngrGrQS 8ZCg== X-Gm-Message-State: AOAM533RF+Yt1WtLCFMyGdWVgM/BqpsSYooM6I8XNMEVeWtVmcKP5DhQ vCbhxp85hXzYuD1s90YYKuPaaymo3VYODw== X-Received: by 2002:a63:c444:: with SMTP id m4mr44594pgg.420.1610507571950; Tue, 12 Jan 2021 19:12:51 -0800 (PST) Received: from [192.168.1.188] ([50.39.189.65]) by smtp.googlemail.com with ESMTPSA id i25sm528341pfo.137.2021.01.12.19.12.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Jan 2021 19:12:51 -0800 (PST) Subject: Re: [PATCH net-next] udp: allow forwarding of plain (non-fraglisted) UDP GRO packets To: Alexander Lobakin , "David S. Miller" , Jakub Kicinski Cc: Eric Dumazet , Edward Cree , Willem de Bruijn , Steffen Klassert , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210112211536.261172-1-alobakin@pm.me> From: Alexander Duyck Message-ID: <6fb72534-d4d4-94d8-28d1-aabf16e11488@gmail.com> Date: Tue, 12 Jan 2021 19:10:40 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210112211536.261172-1-alobakin@pm.me> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-MW Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/12/21 1:16 PM, Alexander Lobakin wrote: > Commit 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.") actually > not only added a support for fraglisted UDP GRO, but also tweaked > some logics the way that non-fraglisted UDP GRO started to work for > forwarding too. > Tests showed that currently forwarding and NATing of plain UDP GRO > packets are performed fully correctly, regardless if the target > netdevice has a support for hardware/driver GSO UDP L4 or not. > Add the last element and allow to form plain UDP GRO packets if > there is no socket -> we are on forwarding path. > > Plain UDP GRO forwarding even shows better performance than fraglisted > UDP GRO in some cases due to not wasting one skbuff_head per every > segment. > > Signed-off-by: Alexander Lobakin > --- > net/ipv4/udp_offload.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c > index ff39e94781bf..9d71df3d52ce 100644 > --- a/net/ipv4/udp_offload.c > +++ b/net/ipv4/udp_offload.c > @@ -460,12 +460,13 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, > if (skb->dev->features & NETIF_F_GRO_FRAGLIST) > NAPI_GRO_CB(skb)->is_flist = sk ? !udp_sk(sk)->gro_enabled: 1; > > - if ((sk && udp_sk(sk)->gro_enabled) || NAPI_GRO_CB(skb)->is_flist) { > + if (!sk || (sk && udp_sk(sk)->gro_enabled) || > + NAPI_GRO_CB(skb)->is_flist) { > pp = call_gro_receive(udp_gro_receive_segment, head, skb); > return pp; > } > The second check for sk in "(sk && udp_sk(sk)->gro_enabled)" is redundant and can be dropped. You already verified it is present when you checked for !sk before the logical OR. > - if (!sk || NAPI_GRO_CB(skb)->encap_mark || > + if (NAPI_GRO_CB(skb)->encap_mark || > (skb->ip_summed != CHECKSUM_PARTIAL && > NAPI_GRO_CB(skb)->csum_cnt == 0 && > !NAPI_GRO_CB(skb)->csum_valid) || >