Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3343089pxb; Mon, 9 Nov 2020 08:45:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFveo9Vbdoqg/RQm/AbdQWOxA20PBg6Zl2JUjtxhxKbc/xd4OtxJ0o1tU4hrJtqozYNZAQ X-Received: by 2002:a17:906:8398:: with SMTP id p24mr16308871ejx.401.1604940306605; Mon, 09 Nov 2020 08:45:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604940306; cv=none; d=google.com; s=arc-20160816; b=Sq8STV/cu7U7+Pe2zWPd/CymnQ66AfnDK9Dyww9FWEaqEPzntAo09cFiHXhfScBUBC 3ZGt24k40OvhkiR2Dujj61jWn7ZxCI6zFFVeNyuYG5AgcIui02hDCpb+Xuv1Vk8QlxX/ YTHSmJQEzEtRC/wdLrGLfCcLBTyvxj/N6yE3qDlw1s2/kcJw3Pu3wjA4BsDw7G6s+3jf qBsOpM2k9nY1AC3l8qxz/znkh7+bB2BbrYcqZp6qBQRyWsxe2ozi5EscGNGH8vBJQVUd amPP4eVTFSTIhqH0qsUFOvNw0AnDBhyMFO9XD8+l6tOvcB8ZE8brVK6M9bHZmcrQiAWS AH1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=B3gjp1cx0ay+GW92ZkmYrI76+YY6rmkXid9EU3kmo4M=; b=G7+3GS/Yrko4MLbB7OHeQChpRRJwhRSOr4uDgC/nl4xqqYiUB3ekDzxsHVGQQyc1aU 1lb6JNiLHKex1GWFoA/QyJm+iBqB7MKAvYGTCYdQf6fuqQ/dQMFhXbuXner3KIgkirx4 y8xUsqcA5n6mXAN65qWYkPriQoNnf4jvdSbjuzwZGK1IvSEnw7ZQvbCToUryj+0K26CX vrOia762dgsjBzGjhyLCxI1Hs1SgrAb6mnNIT7Gn17I4B8fwU9/ewOxTdDccgW04Q5nR I2EH5sV5wBBvBZWnq/b7B0EpIno6Ot5gWJYH8nzKBEiAUmW57uYAoSjJTz4kWqXdKHpL bYBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b="cHg3+r/V"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co26si7377627edb.209.2020.11.09.08.44.39; Mon, 09 Nov 2020 08:45:06 -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=@pm.me header.s=protonmail header.b="cHg3+r/V"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730403AbgKIQmy (ORCPT + 99 others); Mon, 9 Nov 2020 11:42:54 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:36031 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgKIQmx (ORCPT ); Mon, 9 Nov 2020 11:42:53 -0500 Date: Mon, 09 Nov 2020 16:42:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1604940170; bh=B3gjp1cx0ay+GW92ZkmYrI76+YY6rmkXid9EU3kmo4M=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=cHg3+r/VBaOAQAqKH7+E2qA9Hc9DX0O2NnWAHfX+/aedZZOas+n2vI0jWC/816fSq zjs9J4sOo/Cr8uOuHaxIBf8bFtVMP+QsG/qmybPsLDTiVG1o7sTJqYhE/NWQrxJT/T IdQjGmpSidm5ASb6acIiDSOXEy4/Seq1bHl3kEh8S+tMrto/GkeTFEIZXkk2c8neeA WyIKivXtWw5sGzcccnPZi5HDx+aiCb899aGkUX1jLgepX3w7C8a5J5wY6MeVx7ipGI geMD+EtF/ZbiDcFUTLULkT0LiITrtt7uHM5VNJtrnXYasLphmsr8bHHQQGAPW5+rP1 lhk0Zyc/Ydd7g== To: Willem de Bruijn From: Alexander Lobakin Cc: Alexander Lobakin , "David S. Miller" , Jakub Kicinski , Alexey Kuznetsov , Hideaki YOSHIFUJI , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: Re: [PATCH net] net: udp: fix Fast/frag0 UDP GRO Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Willem de Bruijn Date: Mon, 9 Nov 2020 09:36:12 -0500 > On Sat, Nov 7, 2020 at 8:11 PM Alexander Lobakin wrote: >> >> 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() 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. >> >> Fixes: e20cf8d3f1f7 ("udp: implement GRO for plain UDP sockets.") >> Signed-off-by: Alexander Lobakin >> --- >> net/ipv4/udp_offload.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c >> index e67a66fbf27b..13740e9fe6ec 100644 >> --- a/net/ipv4/udp_offload.c >> +++ b/net/ipv4/udp_offload.c >> @@ -366,7 +366,7 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_b= uff *skb, >> static struct sk_buff *udp_gro_receive_segment(struct list_head *head, >> struct sk_buff *skb) >> { >> - struct udphdr *uh =3D udp_hdr(skb); >> + struct udphdr *uh =3D udp_gro_udphdr(skb); >> struct sk_buff *pp =3D NULL; >> struct udphdr *uh2; >> struct sk_buff *p; > > Good catch. skb_gro_header_slow may fail and return NULL. Need to > check that before dereferencing uh below in Ah, sure. It's very unlikely condition, but "better safe than sorry" (c). Thanks, will do v2 soon. >> /* requires non zero csum, for symmetry with GSO */ >> if (!uh->check) { >> NAPI_GRO_CB(skb)->flush =3D 1; >> return NULL; >> } Al