Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp218754lql; Fri, 12 Apr 2024 08:23:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUlHlani4q9ixLivvA/5ZhRcO4TdbiaHb4h4oBdjECknxYguYFUM30U3D3++7g5uitkPYPijy1lz3UpBd03JYK8arCPq3Q37KfdCHMKRg== X-Google-Smtp-Source: AGHT+IFoiNkgEmPHh0Kpzn38OTOF5268ZKYXIC0MGCBCywhTLBaoXTjKVSCPlqUwTCQMo66eTq8W X-Received: by 2002:a17:902:9a0b:b0:1e4:911b:7a6e with SMTP id v11-20020a1709029a0b00b001e4911b7a6emr2638788plp.46.1712935428589; Fri, 12 Apr 2024 08:23:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712935428; cv=pass; d=google.com; s=arc-20160816; b=bg3YdmfPnzg9LdpqbO0I7BFsIsywFKJtrMvw+eO4u391VF1lbK3jidVbnRBxb011KR 5+cfC4iD2ZawbEIGEmNOYLCR9ct4KAuZcOoGDBxyhvkVPfCSSlJZ6L7LqgHlYNbz71fi x+Jsn0MECAO3LdWbY4KRG6Gmb/wwYpSRHTTpZ+1sETHfky+AakxKxw3/Ne2Q+VcBkRU0 v7Ov9nTVUBW6IzptIiT7mZGftI4iw/RApLAIMSWkpee119ipTs4kUaPjO97Eh6j5tmBr FVwk5DQG4az1cfFT6Gh6oNKN5tdhXG3O0w8wHo5NSNsUuErZF6yOxvWAYH+FvTbkY6fo 3IBQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=68baX53kYRdqiSV3OuL3sThzmNqdOFLBEOv/P9LxiMo=; fh=6AF2Sg7Epl1SH1zll3LCeBdII2ZIybDUu4tP5QRyRGE=; b=a3bGvLAd0r/O2CjIREA4HycYKmcNMJBtzwKTzEttrFAYPyW4K3QZwwvkwi4xYGGJQN 2ws5V7+NBkiNG6t+WN2zd78G6x7rdUUC0xynIf9Rd93Ucicfw+cApF669uh0z7iQYoIy 2v0gA50UAEvD7LHntSAgzbsebgllisxQcDWCKBQhvKpOsHwMd3/nkvi3kn1LV7z1gB4/ Wxlcc77QPASOROmTBvk3KMFxvYHigesQL4EDmkvPeULXNsnnHGDnMz3w/8HItDbEEXFg kS2zoEF547HSfcQbBVrs6KNrb1Xnl16gs1DEZaF9ua+5qTFI2yTiQoeY9AzKCp3jGHOy fSHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bk1bW2Vl; 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-142939-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142939-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 v11-20020a170903238b00b001e0892bb867si3554910plh.0.2024.04.12.08.23.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 08:23:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142939-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=bk1bW2Vl; 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-142939-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142939-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 4777628318A for ; Fri, 12 Apr 2024 15:23:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 133301494D5; Fri, 12 Apr 2024 15:22:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bk1bW2Vl" Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 B6A5A148FEE; Fri, 12 Apr 2024 15:22:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712935336; cv=none; b=diuax6p3YasavAsQ17s3vPSrYViqCo8hV1Tui+Z/pmexuTpwx9lWFNntpw835kjznlLiRWDG+PzDiVW334sQkT8ND0/hjkIdEFIr0LjTyDGeb+xCBA+HRB89Vh8IwixOqVt//zpSdxF2NgpDYl+ANunFXt67zErgbTRezxJQvUI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712935336; c=relaxed/simple; bh=vWx8hjmgbGaYijZPOHAFQF3Diarftvn5nTcDZWxUfWQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l+pzAjOZoTv16nCqicd22IbaLOnmi1EcughVFTUi8LwjSMHesYh3oIHTmV3s5P5WGiwqg2LdSv0Q2/oOt4pwMX0e+qXZ4duh7oMdn7WlIn9caiPXHN3K/y34A6CBOn7KlHysnDyqa9O5K6gJ3vhlE7gbW0p0xKUEJYc6J8M3MxI= 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=bk1bW2Vl; arc=none smtp.client-ip=209.85.128.43 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-wm1-f43.google.com with SMTP id 5b1f17b1804b1-417f5268b12so9539265e9.1; Fri, 12 Apr 2024 08:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712935333; x=1713540133; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=68baX53kYRdqiSV3OuL3sThzmNqdOFLBEOv/P9LxiMo=; b=bk1bW2Vl0rAKZh3WwPhZlovjXbexko1sJNYuqP7OmCoktMa5e4eyj5KOzyY/4myE4Q 5xhfRslGXb/R8aoq+Sl7Q1YGKf7jJLDbO9ROujuqUGC48l0xUGWFg1ztNarzUntp08Vp jN3Q0TGlKqR+4DciDAcPvwFLalMJ/TN9Mie+m9PAuh1C68tgXS6DMct6use87Bip7GB8 f0BopJTotNGcsxQxfVhcj5U/L+4gWKcdFK/eVhPB7GOQ1rsgQ7WawtdBX2h5N0MUELQ8 xF4BvbAsM+8ykr9acs4KK8zKSrQMumr/0ipTUSw3QaRCDxojIjA5+LWjMECMBHE/6vr4 gQkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712935333; x=1713540133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=68baX53kYRdqiSV3OuL3sThzmNqdOFLBEOv/P9LxiMo=; b=CkJJtzdrbqegLDqQjK1fxgmJoRbcrlvSVfbDptNVSY0FSRSaTsztHYBlJ0irvTyFPe KzcvNEuUWIyneygjyC9aTBUi2+qXPqwD+x4u3m7N1NH4a3KPDFKIGsQCkUsPwCxu3Osd vfZr/nODqJIk5fwEiQHyWy4znZo2JdNJo/8bTEfVn4SZxmo97JmCzG5cBEpP4DkxF8Kb xxZlwtxJyYw+MG/YNR2xEMusWk25eleI3F3CuWFrpT6QCjZ1qc/wmRGwg4z2boTzkXPs pDt/XJY4dTF7BVCtL8MiUAmMTul7o12CFK3TsToARiLrzVrzgE1v7mpl+q3bntvHLf3T dhEg== X-Forwarded-Encrypted: i=1; AJvYcCX8ZAhvVV/WWTmn6uB1z2Zyoe9jHDvtye1lIHYLPJiAq8fPEBQsurMDFr+eQC8l9g5AVsQdoSShSnSVbSc1kJwBP3fPyNGbY5NExU9riDc39KnBdN4CkswRoN8XXBzrrAqZNG4u X-Gm-Message-State: AOJu0YwqXcLNEJNCvaB5AyyWexAHIQeG+DMDOuaY6ShzT+6mc6N4mR4D LMI5JIQriYHxDba9Cv0RBNQoejNsmBZHkpT0VzA38gbJqgwMCsIx X-Received: by 2002:a05:600c:1e0b:b0:418:1447:711d with SMTP id ay11-20020a05600c1e0b00b004181447711dmr453539wmb.24.1712935332801; Fri, 12 Apr 2024 08:22:12 -0700 (PDT) Received: from localhost ([146.70.204.204]) by smtp.gmail.com with ESMTPSA id n21-20020a05600c3b9500b00416928e239csm6005029wms.35.2024.04.12.08.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 08:22:12 -0700 (PDT) From: Richard Gobert To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, willemdebruijn.kernel@gmail.com, dsahern@kernel.org, aleksander.lobakin@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Gobert Subject: [PATCH net v1 1/2] net: gro: add flush check in udp_gro_receive_segment Date: Fri, 12 Apr 2024 17:21:19 +0200 Message-Id: <20240412152120.115067-2-richardbgobert@gmail.com> In-Reply-To: <20240412152120.115067-1-richardbgobert@gmail.com> References: <20240412152120.115067-1-richardbgobert@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit GRO-GSO path is supposed to be transparent and as such L3 flush checks are relevant to all flows which call skb_gro_receive. This patch uses the same logic and code from tcp_gro_receive but in the relevant flow path in udp_gro_receive_segment. Fixes: 36707061d6ba ("udp: allow forwarding of plain (non-fraglisted) UDP GRO packets") Signed-off-by: Richard Gobert --- 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 = 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 = skb_gro_receive(p, skb); + flush = NAPI_GRO_CB(p)->flush; + + if (NAPI_GRO_CB(p)->flush_id != 1 || + NAPI_GRO_CB(p)->count != 1 || + !NAPI_GRO_CB(p)->is_atomic) + flush |= NAPI_GRO_CB(p)->flush_id; + else + NAPI_GRO_CB(p)->is_atomic = false; + + if (flush || skb_gro_receive(p, skb)) + ret = 1; } } -- 2.36.1