Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2412173lqt; Mon, 22 Apr 2024 09:56:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcF2QGNu20wzEmndznp0NbpBG6YdvsTB4Ef5rGr93dFHNmwSlsCf7v/MGAcCgg0Hr0QJfsmqdoVjCeehQEKZ9hrR3aOazm5vUGdgfaPA== X-Google-Smtp-Source: AGHT+IHr8A/j6PzoCM7yWVjMpi25lqk0ApZHdjUJ/Sq0aOZRxgARk7Y/TTxSzp4anOm6wt3FCvy3 X-Received: by 2002:a37:e116:0:b0:78e:d10a:865c with SMTP id c22-20020a37e116000000b0078ed10a865cmr11243083qkm.58.1713804997479; Mon, 22 Apr 2024 09:56:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713804997; cv=pass; d=google.com; s=arc-20160816; b=wfZ1NBYUsmk4DV4GXrBR/CgrDSddNmr+8k6+FaIgG+PsuKkEs0+VzHomH/4ZNZlZF0 piSJz/7+abzCNvPW9Cb+I8yASmDAg31y8SlE1JjnsJZHF6xdK/zNjQokVabkFkKCMM2Z IwmIhT5CiJpqzm9trHfqSLr7EF01BdPw65t7WULQTHURajsyPO68FF2Hhizhnuczq8wN blgX5gEHVx1wlsOzhDAfbSE3HPpTNxKaxZ94JHmFmdB4FkKqwOKgOp5YXOkyD/3uaCg/ KZZYzmTMrh1yjec2Q5HiQ9H3sUCJ3hq0S7da7AEVpzWcgKAAAmMKVbjfHwPB/RRPd7gY AoVQ== 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:to:from:date:dkim-signature; bh=eYGnqB6cLZlaQwsHWZl+iTgeW0O4NVhhWrlNqA0+Fpc=; fh=dK3pNlMYlxVr52q2FFK+YnV9/icXn1oJ/KqBUcJar/M=; b=cuOdhlmguWh5hCQrBFZujts+g3I/kLSff3bTUSy9hqmhJPSYxmbYpWt4W3rWk4aaWq KhIwmp+1iRExzFrtWMD6Ts7lZZZamutH/n0q/Rs+4aOy708TBiQ/pD8bUPWHYe5/oTPU 0vYCwCqSbb8YQJj2a3naRprIeIje5PMKCk5iTAwbk7/2cuBPzp3M7b6VFkWyZ7CZGsEH WDmY/GqI8tOEveJ1Kd0FvnH8vyXTLx0Z9hHSeoieLPsSzFkEocdKNpmlWUn3wilDdMpa bhgG3N5ZnABkQ7eVf9eIFk3Jw40M/cuVp3KUuoUxpuEFgqSAlB0bIVylfEGNngNNsexu eY8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HuArZazZ; 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-153759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a12-20020a05620a16cc00b0078f10329b3dsi9702288qkn.154.2024.04.22.09.56.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 09:56:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HuArZazZ; 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-153759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153759-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 223701C20F1F for ; Mon, 22 Apr 2024 16:56:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47339153BC0; Mon, 22 Apr 2024 16:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HuArZazZ" Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (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 0F9A9152197; Mon, 22 Apr 2024 16:56:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713804986; cv=none; b=j14faVxe/edwTDqOKfR81noYWutEcBbq7yLUc9T7B7PxGKDRA4Fkdq02o+NwasKQmM1+JkBuGUKHAkbpVTz9S6RaYAvQUckGuBS64b7w1S2fnkxILoVLG1zEKNEeKCXpvT+EW5+6c+0sC30JcpRR1WdX5y5RrprirLYhq1xYocc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713804986; c=relaxed/simple; bh=epyq96Q/BEQILWBmybkdBBkT6+BvOaud2QIeKDhtbak=; h=Date:From:To:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=FrvKBLIi+EGzy0qF/P7tFOYpvlrG2QCgA5EEsJErej6d25lVGDxp0u9vUwz6F3MwdRPdAEhBqUiwGYdTnQM4wDO1e16+gfCCYauSyfx4866orUhmPyExUprq1HU7JExm+DM5CXrZ0eJBf6tg5WL+aZRH1OwnL4sCKe0r8vWwQvg= 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=HuArZazZ; arc=none smtp.client-ip=209.85.222.173 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-qk1-f173.google.com with SMTP id af79cd13be357-790605809cbso210943785a.3; Mon, 22 Apr 2024 09:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713804984; x=1714409784; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=eYGnqB6cLZlaQwsHWZl+iTgeW0O4NVhhWrlNqA0+Fpc=; b=HuArZazZyPisN75wzamw6TTgWdWe7ddW7rF6lDZuNHLKuhJSzlj0fsV7BlzzOWKWhJ Eg45vk5i8BCUNmnOtIeGEniGtm1754xgD/Uapfo6D71pqOVzFKnvRR42RsxaoI5lr4d8 Zukb2TDYqXqKtQZuKRh5a18gzj5ga0GF1q3nq1v6QpKf+QuEP5mGweWn271XUG9mtr7y f0ZEGbU3uGJ0GVzAtAlkuCZDLonux9pqtewR6gh4ioaRrdJkJ2w4C3vwSwEOc9Pi0X8N NNZZhXZTNIVs3dg3nwNSnb0aCdE15HkfoJ3JNodYP8m49ghiZFTlJumMsIfrhjscFVkk je0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713804984; x=1714409784; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eYGnqB6cLZlaQwsHWZl+iTgeW0O4NVhhWrlNqA0+Fpc=; b=OPgKa7xiNZIM6nEh2DPemkOZ30gqltPSiVYgJeFF0EoqVg79RQohrS5fVqnVugE5Ug 8hqaUehyjytAIEKP+eEoFsI/0u4Oc5cYX0sLgHV/AE6yArMHfLFM65dZLZpkcqIuEkhW no8HWL1bZHOXKGA8rkrFqcUESj59c7ygbqgM9kCsL8QOPDRJmu8vQMPvhh6AoA+NaBVD YOS2QugEjc+/kcCikYKA7CdbItKBBMGSFgxII+lxawqGeq7BDgCO6+WpH+NcwIoQpZBU I/bQL1LroFvG6QGFydUaUP+NeU8WsTgPlJzonmEkOqgZYHRiGRu9/DPTxkoQN+BGVYdQ ZbSQ== X-Forwarded-Encrypted: i=1; AJvYcCWO7zTkllMyVI0HhqosAwt9WHgaPyzXMyq/Fs0D49mbyOzhPI7yP6MhsZOCOqo/vXz/uO1xu+uH1bcNl4Jtzf85E7TOl/r8qs7JrmtjbPcknprsao3K+J3fxMGOzX6vwpbLS8Nf X-Gm-Message-State: AOJu0Yw2RX8n4LoKFQi0jRL4aMKWRT0y+vm61paCyB00r2lUzJlo92tM 98Z8r3dg3xX29d/HomYm+/mJIL8rfh97q3/w51fxd2cy5brhiRe8txcR+3lZ X-Received: by 2002:ad4:4485:0:b0:6a0:412f:8496 with SMTP id m5-20020ad44485000000b006a0412f8496mr11314151qvt.52.1713804983800; Mon, 22 Apr 2024 09:56:23 -0700 (PDT) Received: from localhost (164.146.150.34.bc.googleusercontent.com. [34.150.146.164]) by smtp.gmail.com with ESMTPSA id z12-20020a0cf00c000000b006a0441c4d15sm4377553qvk.38.2024.04.22.09.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 09:56:23 -0700 (PDT) Date: Mon, 22 Apr 2024 12:56:23 -0400 From: Willem de Bruijn To: Richard Gobert , Willem de Bruijn , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, dsahern@kernel.org, alexander.duyck@gmail.com, aleksander.lobakin@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <662696b7c257_7539294ba@willemb.c.googlers.com.notmuch> In-Reply-To: References: <20240419153542.121087-1-richardbgobert@gmail.com> <20240419153542.121087-2-richardbgobert@gmail.com> <6622bd416e567_1241e229425@willemb.c.googlers.com.notmuch> Subject: Re: [PATCH net v2 1/3] net: gro: add {inner_}network_offset to napi_gro_cb 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: 7bit Richard Gobert wrote: > Willem de Bruijn wrote: > > Richard Gobert wrote: > >> This patch adds network_offset and inner_network_offset to napi_gro_cb, and > >> makes sure both are set correctly. In the common path there's only one > >> write (skb_gro_reset_offset, which replaces skb_set_network_header). > >> > >> Signed-off-by: Richard Gobert > >> --- > >> drivers/net/geneve.c | 1 + > >> drivers/net/vxlan/vxlan_core.c | 1 + > >> include/net/gro.h | 18 ++++++++++++++++-- > >> net/8021q/vlan_core.c | 2 ++ > >> net/core/gro.c | 1 + > >> net/ethernet/eth.c | 1 + > >> net/ipv4/af_inet.c | 5 +---- > >> net/ipv4/gre_offload.c | 1 + > >> net/ipv6/ip6_offload.c | 8 ++++---- > >> 9 files changed, 28 insertions(+), 10 deletions(-) > >> > > > >> +static inline int skb_gro_network_offset(const struct sk_buff *skb) > >> +{ > >> + return NAPI_GRO_CB(skb)->network_offsets[NAPI_GRO_CB(skb)->encap_mark]; > >> +} > >> + > > > > > >> @@ -236,8 +236,6 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head, > >> if (unlikely(!iph)) > >> goto out; > >> > >> - skb_set_network_header(skb, off); > >> - > > > > Especially for net, this is still a large patch. > > > > Can we avoid touching all those tunnel callbacks and just set the > > offsets in inet_gro_receive and ipv6_gro_receive themselves, just > > as skb_set_network_header now: > > > > @@ -236,7 +236,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head, > > if (unlikely(!iph)) > > goto out; > > > > - skb_set_network_header(skb, off); > > + NAPI_GRO_CB(skb)->network_offsets[NAPI_GRO_CB(skb)->encap_mark] = off; > > > > Thanks for the reply! > > Setting network_offset on dev_gro_receive and inner_network_offset only > in the tunnel callbacks is the best option IMO. I agree that > we want a small patch to net that solves the problem, although I > think always using ->encap_mark in the common path is not ideal. > > We can avoid changing all the tunnel callbacks by always setting > inner_network_offset in {ipv6,inet}_gro_receive and initialize > network_offset to 0 in dev_gro_receive. It will result in a small > change, without using ->encap_mark. > > What are your thoughts? That works. It's a bit ugly that inner_network_offset will always be set, even if a packet only traverses inet_gro_receive once. What is your concern with testing encap_mark? How do you want to detect in udp[46]_lib_lookup_skb which of the two offsets to use? That would still be encap_mark based?