Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp418311pxb; Wed, 11 Nov 2020 07:00:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJwScRR4K1qu3PsSSob8PchdvpaTWNoN43ITCEUdhgMy1zJWGcZAtLhzi+WhDU/1354tQipi X-Received: by 2002:ab0:e04:: with SMTP id g4mr7928913uak.68.1605106859738; Wed, 11 Nov 2020 07:00:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605106859; cv=none; d=google.com; s=arc-20160816; b=EpRbeesh4jbm11fqG5ZEM6Lk5ZQO+acOThIOYdD0tZQsQhfFfL+oiT3ezbvJw9B97Q PoOqp61yz32HpITxHTa+40diUBJNMimuqfdagExdUN8FXAj2bXXcc5P+CXx2Ttr6r0mV w64TDxGbydOMi2Fe22h/TmWajLsWQ0swy5IWIJbV9T+7CW+E3cwo3j73ypZ4agyTYj6m UZnTedi5wuOOxAIGJ7XTzLjlxB2clGKm5ljhQpMBzixCG+fmAQyMz+Gm4hpmhW8jx2++ MOYE10LsuL5b/4PpsX0KNgG1g/Dx5tsX++uu+OX7jGcos4r5bQczEx37K1LGoCahFKtz cc+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ymEvgJS7rVbY5xVZhevn94lQHneRjvkfCvwDRO8xie0=; b=JtrB2RSw5gn6yxpxIF2/YqUjbF+7SqKfWV3o64JLcQV5tByrIKeARzLI08cv+JOxKS BYfUia3cdGDhFuJF74GA79xdYY2zyPyUDoOCw/UooAcWWCC0GPqY6h/hhF1HxIh6LWhL 1yClCnvIuWOVY4qiBi6HipCxcjwZedj7aFp4nwGxdy5S3mHXJ6S8fZxZ37f04iTJ3eHv OP2u9NJXK2DX5bGZtgN5A+GyWRVcip90C3RQQd2GQU8naYws5MSI08j4W64Hk5KzU6zj oqsMyG7O8yc/mDkfPQgt6zrytnAzM/p9ykCvhFjoLExyrs9Rgn7d+AK8iKv1UmJa7d1P xgsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZghKI3Qi; 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 b15si1507986eja.538.2020.11.11.07.00.30; Wed, 11 Nov 2020 07:00:59 -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=ZghKI3Qi; 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 S1727321AbgKKO6z (ORCPT + 99 others); Wed, 11 Nov 2020 09:58:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726740AbgKKO6v (ORCPT ); Wed, 11 Nov 2020 09:58:51 -0500 Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A102BC0613D1 for ; Wed, 11 Nov 2020 06:58:51 -0800 (PST) Received: by mail-vs1-xe42.google.com with SMTP id u24so1299033vsl.9 for ; Wed, 11 Nov 2020 06:58:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ymEvgJS7rVbY5xVZhevn94lQHneRjvkfCvwDRO8xie0=; b=ZghKI3QiRUOD7epvEcjCkm2x5OmXbfdOwP07/1zFHYgFbUDsISeOqY6HnA61S4QxSj qW64wt7QdXHCxCNqVBrKtlK4rO3Opip0/x/SVNA38DsiPdv6xzPytjwCaNi7vGs52ANU a4jcMS/reMNkJKvttl1hXcWrHGek4sZG2KWwV+DL6OlZM2rdgaCqrrhGowDyOiEf3AcH ifSNQhvqrmoXaTGeiWSyhA0TVNY1MBiVbMuDldlTDloEQVFcdlzQM+fIzSIwt7NDC9rQ ht9CY+dKjPm2+WWdyLOynPYwu144U1u07WhT1gZ+jLACW8VPSbm6U65jbtSiLkXc0zVI lrMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ymEvgJS7rVbY5xVZhevn94lQHneRjvkfCvwDRO8xie0=; b=ZiYF76ymu5ZpIGdfGWhulLe7cnQqhD/hfBCJMnLPkAIVzJNFP+LzWLuzatgQIY6i3i NzloOELEHW8RszD91NnZeL3RfQlD3kMs/626JwudbcLmGptBsRQANN75JuEb0mGHp/gc 8BlvKi+elHtQITFOemAuPWFBCgh/YcItOVWMX0jYt5L4s7BDDFIXgCjwygkIPgqgWm9A 2r1zV2rIEmP3LVkDPWddghfT8cQv0PuaD8zQB8i0zVVTxbm6wA/eNiDRW8df6wZlV+ay 3pG3DlocbwMNdKb6m+0ezSi5yZWL0heRuXDrhkkDGev91VZeSDK84/vwqphQOrQnqbDH EQHQ== X-Gm-Message-State: AOAM532/yhIjoDXaxUtGGghnuB5+ZOSVKGHb0UvIXAaBZEMEM/M9aBOO VsM0LOdZQIpzOwzyHCWW4/tQ6kbeEjA= X-Received: by 2002:a67:e2c1:: with SMTP id i1mr16869400vsm.2.1605106730437; Wed, 11 Nov 2020 06:58:50 -0800 (PST) Received: from mail-vk1-f180.google.com (mail-vk1-f180.google.com. [209.85.221.180]) by smtp.gmail.com with ESMTPSA id t127sm266261vka.3.2020.11.11.06.58.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Nov 2020 06:58:49 -0800 (PST) Received: by mail-vk1-f180.google.com with SMTP id i3so534679vkk.11 for ; Wed, 11 Nov 2020 06:58:48 -0800 (PST) X-Received: by 2002:a1f:6dc4:: with SMTP id i187mr10642006vkc.12.1605106727755; Wed, 11 Nov 2020 06:58:47 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Willem de Bruijn Date: Wed, 11 Nov 2020 09:58:10 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 net] net: udp: fix Fast/frag0 UDP GRO To: Alexander Lobakin Cc: "David S. Miller" , Jakub Kicinski , Alexey Kuznetsov , Hideaki YOSHIFUJI , Paolo Abeni , Steffen Klassert , Eric Dumazet , Network Development , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 11, 2020 at 6:29 AM Alexander Lobakin wrote: > > From: Willem de Bruijn > Date: Tue, 10 Nov 2020 13:49:56 -0500 > > > On Mon, Nov 9, 2020 at 7:29 PM Alexander Lobakin wrote: > >> > >> From: Alexander Lobakin > >> Date: Tue, 10 Nov 2020 00:17:18 +0000 > >> > >>> While testing UDP GSO fraglists forwarding through driver that uses > >>> Fast GRO (via napi_gro_frags()), I was observing lots of out-of-order > >>> iperf packets: > >>> > >>> [ ID] Interval Transfer Bitrate Jitter > >>> [SUM] 0.0-40.0 sec 12106 datagrams received out-of-order > >>> > >>> Simple switch to napi_gro_receive() or any other method without frag0 > >>> shortcut completely resolved them. > >>> > >>> I've found that UDP GRO uses udp_hdr(skb) in its .gro_receive() > >>> callback. While it's probably OK for non-frag0 paths (when all > >>> headers or even the entire frame are already in skb->data), this > >>> inline points to junk when using Fast GRO (napi_gro_frags() or > >>> napi_gro_receive() with only Ethernet header in skb->data and all > >>> the rest in shinfo->frags) and breaks GRO packet compilation and > >>> the packet flow itself. > >>> To support both modes, skb_gro_header_fast() + skb_gro_header_slow() > >>> are typically used. UDP even has an inline helper that makes use of > >>> them, udp_gro_udphdr(). Use that instead of troublemaking udp_hdr() > >>> to get rid of the out-of-order delivers. > >>> > >>> Present since the introduction of plain UDP GRO in 5.0-rc1. > >>> > >>> Since v3 [1]: > >>> - restore the original {,__}udp{4,6}_lib_lookup_skb() and use > >>> private versions of them inside GRO code (Willem). > >> > >> Note: this doesn't cover a support for nested tunnels as it's out of > >> the subject and requires more invasive changes. It will be handled > >> separately in net-next series. > > > > Thanks for looking into that. > > Thank you (and Eric) for all your comments and reviews :) > > > In that case, should the p->data + off change be deferred to that, > > too? It adds some risk unrelated to the bug fix. > > Change to p->data + off is absolutely safe and even can prevent from > any other potentional problems with Fast/frag0 GRO of UDP fraglists. > I find them pretty fragile currently. Especially for fixes that go to net and eventually stable branches, I'm in favor of the smallest possible change, minimizing odds of unintended side effects. Skipping this would also avoid the int to u32 change. But admittedly at some point it is a matter of preference. Overall makes sense to me. Thanks for the fix! Acked-by: Willem de Bruijn