Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1490372lqp; Mon, 15 Apr 2024 08:01:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQjOlWkfvraj5VkhoQ/ACD8CBl2v96QMTV7u2ibcdTt0a9wUMasKrVp5Y/xCTYFSAec6GRkbkFsw/6OfA+eul73ZkC9fZRu+b+x8VIJQ== X-Google-Smtp-Source: AGHT+IEojMIahRZFSU8tMgz/o7B/0gauSDndcJ7sqaY+QdGpkCmq2j0/EMNPrbyR0GULqJmuSKod X-Received: by 2002:a05:6a21:3d89:b0:1a1:878d:d3f6 with SMTP id bj9-20020a056a213d8900b001a1878dd3f6mr9717423pzc.26.1713193256904; Mon, 15 Apr 2024 08:00:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713193256; cv=pass; d=google.com; s=arc-20160816; b=SKzYwWnz4DMcZX1ChAZLJe1+ygPP7VzaiI0XCFYjkU142++Y9/GHkk8sbnIgAB7RPu i0ca+7D6rbp5wza2HE3jRBkR49NLF97tsUAbmy+HV7z8c/z/XHIwbzOWVGGgD5VqbL7G XacUx1T/fPK0gcxVLh0Ax66ezhAeDdywv08uOIDw8NAgjZSLoFwJgBBX7tDisw7v9OZC S2kol95zVza3Od5LVODxS9cfZJlNULig6+pb9TOJFWrGgCER0VvTz8pdjj1+mKdvJYHv LXQtxHjz+oj79k3TOK4YrGGTzFR5zHSKcs2vzPeLL6jNB3KOwZc2Ty6cH6x8v48BYlS3 lfEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:references:in-reply-to :message-id:cc:to:from:date:dkim-signature; bh=WS6Pv+eMPVF9jwN1/da6sM3EbXPOKQ+l4+JLzAo2+5s=; fh=NH7wizidjn3TrVMzq3BM3IZEOscn3lTktYPTQrucAjM=; b=p75FjUVva13m25YGUvTkMwN8snjyk1ifTyr7qWdq9GGOaCvSyc035ULqtCnGdm70xr WwBaatk5c7F4OJQLLL9qRmUkokYFNGUVt0qgvdnvQ+FbaXlRcfgMwoihQjinwz56QTYy gC6C1wrQtN1iZNUOySed8m/fLTZxRQgJlibKK/pyHrrO8bNAe8glrstTwunAPl8gnYon OvRuh+D81dz+Ap5qsrxHPyCidndkuJzZjWL+xTg5nrVCtfiGQDe9LSqDZcrBoORqJIDI Ktb53x6c+DsVzexXs+VvW7AQAUeO8RmW/HN5d9IHNkWm4QrvN+NHUApLGM5GBSFmCkWk IHJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h+RGp9BL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-145409-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145409-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g132-20020a636b8a000000b005d8b8ca425esi7873661pgc.308.2024.04.15.08.00.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 08:00:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145409-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=h+RGp9BL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-145409-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145409-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8E44C282BCE for ; Mon, 15 Apr 2024 15:00:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E7A2762DC; Mon, 15 Apr 2024 15:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h+RGp9BL" Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9E9A74E37; Mon, 15 Apr 2024 15:00:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713193238; cv=none; b=obebo+p1dueGKO3HyeJa+5UGcSsITfpf07BS9+O6ASeoXKn/tixdOWiIwJAna+yTdIIEYHqxhSJP8QD149s0cQrUpgT90j81lNvsKmX+bnJ1uAg69J6i53VDpk2MLzrfdWZw4ynmWgs6En0igLqpepzVxbcDcFYSCOaosPuKODE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713193238; c=relaxed/simple; bh=OJhWkXaiZfR5vxgWccVDhgB7L5539O3TT+m0W3wEVJQ=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=kWkyHePVTFG4IVaCZ0ytViBqJB8WDUiFezQT1gaAOK0zvTwXLie8NNo5T9ZG7pxqRlRc4aeeI6pUqnNqBEl2iyXR4iDW0cyCB25r/flSR1UK65axGEAbSAi/+EV1FjJHzDzcegJTuCwA3w91UWR6seXWu0a+up4lSs1Hfdxcr6U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=h+RGp9BL; arc=none smtp.client-ip=209.85.221.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vk1-f172.google.com with SMTP id 71dfb90a1353d-4dac3cbc8fdso1306176e0c.0; Mon, 15 Apr 2024 08:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713193235; x=1713798035; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=WS6Pv+eMPVF9jwN1/da6sM3EbXPOKQ+l4+JLzAo2+5s=; b=h+RGp9BLkdMOdq5GQBRNkfjRnIMkpwJnIO6R9Z4W+gTlWhHDa72XUfnH4Q9g82aydR pWaP2mF137KxIPyNb0Y9/K767+g27Kr8/YNus/Z/GGjS1BfGh5luxSQDU2AnafaIYVzP L1Dz/xXK/a8idBQfZ/hzePyFkfr6yLlazOboQSfrMp5fxU6YgLe2PRqvLZiTNtMJMdT6 mjoVH/W04Es46vm53+xXJ9OofNOJem3iOMWSEyvyAdRVToyktMGPx04flfFN7/QJMHD6 ObCxYiGLyLJ8ujnHJMeriPagjhZ0I9sHIj0W3IOwD6J6iLdPbPEpShXC7Oha2aouk/HT 7AUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713193235; x=1713798035; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=WS6Pv+eMPVF9jwN1/da6sM3EbXPOKQ+l4+JLzAo2+5s=; b=a59QN9V5lOKyOGSG+VJcYlxdaHJdIXkvX4eqVhSuAHW/swxu6XoIHhXcn72+rP7qOw o1Rph4e4LRNq/mrcMSKBMgfEDy9jLFYD42r/HBIQ7jlYsJ3MRAPvbjZSrbxzn5VFMBMT A3MU/6HLSMcuSKZeu4J03Pkwjl3shxYrKTeI1/mVeLij3w8Nr/SXHLOK+lzfryKa5wNm cPC+3K+dlG9IoktMHqx94Z2gjyjko0eo0TWeLE0y/yg6rdZReQBBNRrOCXIJCzCLEmWw qmZ93yDyiKMs5TMWeFX7NamPlVkxAQksl24rUfMT6DFuGJMXRgta0AFDGlHkxJVtcEoz iDhg== X-Forwarded-Encrypted: i=1; AJvYcCXVJe3NWGXyyZtYCtr5jw0zSyslno6YrZhd2vvsHxaqyXccZJYmTAx5NAdmeqXCAIOAB6XxCtQ9aqBeIsdjg1b8Z5SLOO4J/beGsuktncWMTPDZGjk2URW/jsIJCPDu8XL9MSVS X-Gm-Message-State: AOJu0Yxb0WIotI1BA5YCaYlnApje0tr9jXqTQUTAhtVb/4t1fqoC8bls xoImD4DH5sMOkZPAyv2T0ul/ZN12HlNaoQVmCDS/KpyVmR3CxypA X-Received: by 2002:a05:6122:209e:b0:4cd:b718:4b08 with SMTP id i30-20020a056122209e00b004cdb7184b08mr7269652vkd.11.1713193233032; Mon, 15 Apr 2024 08:00:33 -0700 (PDT) Received: from localhost (73.84.86.34.bc.googleusercontent.com. [34.86.84.73]) by smtp.gmail.com with ESMTPSA id v13-20020a0cc60d000000b0069b75b8633dsm1963873qvi.67.2024.04.15.08.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 08:00:32 -0700 (PDT) Date: Mon, 15 Apr 2024 11:00:32 -0400 From: Willem de Bruijn To: Alexander Duyck , Willem de Bruijn Cc: Richard Gobert , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, dsahern@kernel.org, aleksander.lobakin@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <661d41106f996_c0c829445@willemb.c.googlers.com.notmuch> In-Reply-To: References: <20240412152120.115067-1-richardbgobert@gmail.com> <20240412152120.115067-2-richardbgobert@gmail.com> <661ad1136bc10_3be9a7294c2@willemb.c.googlers.com.notmuch> Subject: Re: [PATCH net v1 1/2] net: gro: add flush check in udp_gro_receive_segment Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Alexander Duyck wrote: > On Sat, Apr 13, 2024 at 11:38=E2=80=AFAM Willem de Bruijn > wrote: > > > > Richard Gobert wrote: > > > GRO-GSO path is supposed to be transparent and as such L3 flush che= cks are > > > relevant to all flows which call skb_gro_receive. This patch uses t= he same > > > logic and code from tcp_gro_receive but in the relevant flow path i= n > > > udp_gro_receive_segment. > > > > > > Fixes: 36707061d6ba ("udp: allow forwarding of plain (non-fragliste= d) UDP GRO packets") > > > Signed-off-by: Richard Gobert > > > > Reviewed-by: Willem de Bruijn > > > > > --- > > > net/ipv4/udp_offload.c | 13 ++++++++++++- > > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > > > diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c > > > index 3498dd1d0694..1f4e08f43c4b 100644 > > > --- a/net/ipv4/udp_offload.c > > > +++ b/net/ipv4/udp_offload.c > > > @@ -471,6 +471,7 @@ static struct sk_buff *udp_gro_receive_segment(= struct list_head *head, > > > struct sk_buff *p; > > > unsigned int ulen; > > > int ret =3D 0; > > > + int flush; > > > > > > /* requires non zero csum, for symmetry with GSO */ > > > if (!uh->check) { > > > @@ -528,7 +529,17 @@ static struct sk_buff *udp_gro_receive_segment= (struct list_head *head, > > > skb_gro_postpull_rcsum(skb, uh, > > > sizeof(struct = udphdr)); > > > > > > - ret =3D skb_gro_receive(p, skb); > > > + flush =3D NAPI_GRO_CB(p)->flush; > > > + > > > + if (NAPI_GRO_CB(p)->flush_id !=3D 1 |= | > > > + NAPI_GRO_CB(p)->count !=3D 1 || > > > + !NAPI_GRO_CB(p)->is_atomic) > > > + flush |=3D NAPI_GRO_CB(p)->fl= ush_id; > > > + else > > > + NAPI_GRO_CB(p)->is_atomic =3D= false; > > > + > > > + if (flush || skb_gro_receive(p, skb))= > > > + ret =3D 1; > > > > UDP_L4 does not have the SKB_GSO_TCP_FIXEDID that uses is_atomic as > > input. > > > > And I still don't fully internalize the flush_id logic after staring > > at it for more than one coffee. > = > The flush_id field is there to indicate the difference between the > current IPv4 ID of the previous IP header. It is meant to be used in > conjunction with the is_atomic for the frame coalescing. Basically > after the second frame we can decide the pattern either incrementing > IPv4 ID or fixed, so on frames 3 or later we can decide to drop the > frame if it doesn't follow that pattern. > = > > But even ignoring those, the flush signal of NAPI_GRO_CB(p)->flush > > set the network layer must be followed, so ACK. Thanks for the fix. > = > I'm not sure about the placement of this code though. That is the one > thing that seems off to me. Specifically this seems like it should be > done before we start the postpull, not after. It should be something > that can terminate the flow before we attempt to aggregate the UDP > headers. In principle agreed that we should conclude the flush checks before doing prep for coalescing. In practice it does not matter? NAPI_GRO_CB(skb)->csum will be ignored if the packet gets flushed.=