Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp655369pxb; Wed, 11 Nov 2020 12:46:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFrymbsiueAhjW5UcUTAxgpu1Yce56H7Wf+aI+h8Y7K+1+IG1txNEgcQ0N5D9edCKhpFTX X-Received: by 2002:a17:906:17d1:: with SMTP id u17mr25783140eje.229.1605127586747; Wed, 11 Nov 2020 12:46:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605127586; cv=none; d=google.com; s=arc-20160816; b=0gtSKgXGQxqpIg/p2u3yUrWwKEfQ4AucyisxBmOW/u7PzZCi6rW5asmNS+fyNNFIXi kcM6ana6vny7lK6fiz14p084D6XGv624kLLAw7nsUwxVJXDg5imJQIxU3K3F5jMrHhdW OvMiZYPVvO9vxx1+oVpCFEUzdbm70L6NDtLrki0LsY0R6O5GD1772Qx45tFaNDcPpJUl vlPmMADAIxjJ8v0kT4SHe6JglpTP4kAO6SI2S+hqcDDH85RmGB8Gb4P8a2p1i1IKTTRz RjIaNvjDxTLP++HA0azXefLR61n7OI2xkXYhTU6GXh0sxh1GHgI/9wibqIkpjbd8dAlB wf+g== 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 :message-id:subject:reply-to:cc:from:to:dkim-signature:date; bh=cjnSs7ggKuxNW/h5Wnq+CXkLVSWDuqP6wXc3zMUiSOA=; b=XBVw1xuc+PS1ajFoToa7c8YAyf33YetKPWyETa83qcViHRSMGFMH7rfcSyi3byCeFi oao4KPXE8HXEKajDntW8bwaRITe+tRMt7Z2HVNQvJW8smh9R0yQGqBhNDEvl3DcjF3ss bH/iWrOSOkqsHzw01Jbri9p/YRRChawpXHpcyfZvlx1T6T6g2OW64Wp+NDKaa9pu+ILN EuGsVtL7kVXqfI16+YxIuImq1NbQn4KdoJJ3VHKdkkp2p9CO0Dao8IscZP5he5kPjrk3 dyauUOHwdYCvXiVKPwtA3z11t/3WlwUhseeslcvRycKFKuoKgchsqu6JBwwtdhSYC5iq yLGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=bV+XkA5q; 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 u2si2044382ejo.423.2020.11.11.12.46.02; Wed, 11 Nov 2020 12:46:26 -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=bV+XkA5q; 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 S1726748AbgKKUoS (ORCPT + 99 others); Wed, 11 Nov 2020 15:44:18 -0500 Received: from mail2.protonmail.ch ([185.70.40.22]:36967 "EHLO mail2.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbgKKUoR (ORCPT ); Wed, 11 Nov 2020 15:44:17 -0500 Date: Wed, 11 Nov 2020 20:44:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1605127454; bh=cjnSs7ggKuxNW/h5Wnq+CXkLVSWDuqP6wXc3zMUiSOA=; h=Date:To:From:Cc:Reply-To:Subject:From; b=bV+XkA5q3D9jxeC3YIesV5yGTAjx3vv/JBTesm6v1zru4MyGkKBFRMZwfoyR3Hsz0 bZPrBmw5+eop5UT8vCChwTW/ieUzI6bcuLYm9JmVsw+DKmEhhHTnZvKjK9fxEzLC0g oUUQGUV6UwDiuEu8btxMUpK9AFoq/Lh704g7kql24ESVYGgYo6W0A5HaeeA7Kw0WD+ Tvv3Cxltp08zYm8QCum3dtkxvp/iILQSIURXfXiK4GEDbcbk0E8ox/D7C0qi9TUCF7 uj79/YbkeePMozxqVqHWaTP8ZyY5hwYja8m1QdGsEll/hi0XX/H/sC+Q4PBLe2hNCJ L2yYTnBXmQ4+A== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Alexey Kuznetsov , Hideaki YOSHIFUJI , Paolo Abeni , Willem de Bruijn , Steffen Klassert , Alexander Lobakin , Eric Dumazet , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v5 net 0/2] net: udp: fix Fast/frag0 UDP GRO Message-ID: 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 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 two incorrect header accesses in GRO receive callback(s): - udp_hdr() (instead of udp_gro_udphdr()) that always points to junk in "fast" mode and could probably do this in "regular". This was the actual bug that caused all out-of-order delivers; - udp{4,6}_lib_lookup_skb() -> ip{,v6}_hdr() (instead of skb_gro_network_header()) that potentionally might return odd pointers in both modes. Each patch addresses one of these two issues. 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. Credits: Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Willem de Bruijn Since v4 [0]: - split the fix into two logical ones (Willem); - replace ternaries with plain ifs to beautify the code (Jakub); - drop p->data part to reintroduce it later in abovementioned set. Since v3 [1]: - restore the original {,__}udp{4,6}_lib_lookup_skb() and use private versions of them inside GRO code (Willem). Since v2 [2]: - dropped redundant check introduced in v2 as it's performed right before (thanks to Eric); - udp_hdr() switched to data + off for skbs from list (also Eric); - fixed possible malfunction of {,__}udp{4,6}_lib_lookup_skb() with Fast/frag0 due to ip{,v6}_hdr() usage (Willem). Since v1 [3]: - added a NULL pointer check for "uh" as suggested by Willem. [0] https://lore.kernel.org/netdev/Ha2hou5eJPcblo4abjAqxZRzIl1RaLs2Hy0oOAgF= s@cp4-web-036.plabs.ch [1] https://lore.kernel.org/netdev/MgZce9htmEtCtHg7pmWxXXfdhmQ6AHrnltXC41zO= oo@cp7-web-042.plabs.ch [2] https://lore.kernel.org/netdev/0eaG8xtbtKY1dEKCTKUBubGiC9QawGgB3tVZtNqV= dY@cp4-web-030.plabs.ch [3] https://lore.kernel.org/netdev/YazU6GEzBdpyZMDMwJirxDX7B4sualpDG68ADZYv= JI@cp4-web-034.plabs.ch Alexander Lobakin (2): net: udp: fix UDP header access on Fast/frag0 UDP GRO net: udp: fix IP header access and skb lookup on Fast/frag0 UDP GRO net/ipv4/udp_offload.c | 19 ++++++++++++++++--- net/ipv6/udp_offload.c | 17 +++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) --=20 2.29.2