Message ID | a385991bb4f36133e15d6eacb72ed22a3c02da16.1701722991.git.dxu@dxuuu.xyz |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3033151vqy; Mon, 4 Dec 2023 12:57:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCSsmCClT7GPJ0bWh4Q4t15JPVLPQWJLgqfm/cdY5HQ42DjH+U0TIU9aCOqz+TKH2y5z4c X-Received: by 2002:a17:90b:33c7:b0:286:9b69:a0f6 with SMTP id lk7-20020a17090b33c700b002869b69a0f6mr193950pjb.39.1701723428546; Mon, 04 Dec 2023 12:57:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701723428; cv=none; d=google.com; s=arc-20160816; b=WnSJhHZQFN7yrNN1ItJHC7Lb+2GkRg7u9/tHVTzACuWugK/GdCRtBzzRZE7amOs0T4 d0/xvyMMXh1Q4C91H043bfss1Iuq30aJweb/YUFSzS7mSwrDhciI5nUQz+FeR1iz+Rm1 gNZ8MAKba6raaqLirds8gUPjmL2mPK7vWy1CDafJ34AsGEuazpkIT7+xFisYegYLcCYw 6bw2oJe4spzUb48tYfnnx+8HQY2cBPLCY0CgnpDopU59ccT3m0LYEG8Arbv3ob0gY5W0 O/o6v7Z0H8KChPN9JqCdyelUtUk8TMxLmrNp15R9g3j2i7eQkBtILZ+6k6NndqawyZBf eTHA== 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:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=ODyk+ttANQamRuubWNRCDO8I/D2JxBDiCAh0nttU7d0=; fh=JT3DbXCycnDgjng2egvIc916cuzoOMwYuenI3anQzBw=; b=gVSuQtFQLe7mIVpl7cAd8vhZvGrYoZhdmAmEWSA0/UH5HLJRUlOv4o2axkDlaNwtGQ s90lMKZfebIGwN6EtnOn6VaNBuwDnKMPQkfFfIV5hIuwGSmHeZjKC7IfNcrRyR5NO901 n6kudbVn5IjSx3K0gAsPhlBkEOp9/6Cc08tpaVXd5kaCfv5xW2gehGvYUhokoljPZWGB OVpSClpGQQ4xt96iEUB7yTjI2QxJiZ9+VUcVsXig+LJygjgMDlfKXj2CZl8XxUh18IZj YzMirRDJd701Ejk1dfXb7nIalke4Er2QhMc1yaY1B257ioQZGLX+EJ8Zu4wMjrQxt6bT jtKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=r4oVnJbK; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=0epMzhcX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id kb2-20020a17090ae7c200b0028676beec1bsi4084488pjb.152.2023.12.04.12.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 12:57:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=r4oVnJbK; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=0epMzhcX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 543E080ADF3F; Mon, 4 Dec 2023 12:57:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233697AbjLDU45 (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Mon, 4 Dec 2023 15:56:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233753AbjLDU4w (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 4 Dec 2023 15:56:52 -0500 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B965C109; Mon, 4 Dec 2023 12:56:55 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DB9615C022F; Mon, 4 Dec 2023 15:56:54 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 04 Dec 2023 15:56:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dxuuu.xyz; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1701723414; x= 1701809814; bh=ODyk+ttANQamRuubWNRCDO8I/D2JxBDiCAh0nttU7d0=; b=r 4oVnJbKuvQFHQYEX8R56ZVtXrlkgzIKKVAXWi8AlDWZHZKFL8p/mnFE5y5wV+eK+ 9lOOSI2esM4aFE0BbGS+7tnSOFL+m4vzr8yDkEMwTSD2pPfCEVIpYPlT9ziUuffn AHS8Ww/tjVQFKDK7/+WCPd9NT/sVUjbECVwj6yFz5F7+DDNVHBK0ozgNQ1b8UXD7 HfqcPnc7d0/60iP1zeAHUz15pZSzCg0qDt6ChLSwMzsWqsWLQbafj5MZi/4d+U9M QRPeT4rc6NUiahJWVStSkybkfJTxRFH8iu27phHt1pKSxOr3z9YqslbyUFFZ2jjT Fprwp2xUClTWgZg2SqHvQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1701723414; x= 1701809814; bh=ODyk+ttANQamRuubWNRCDO8I/D2JxBDiCAh0nttU7d0=; b=0 epMzhcXlEAJh9hIhfZQNfzrbBwP6o7+vnL+hC48PCUaQtGZI2fOrXx/8caIwa5wq htQ/sixbVUcrurbCJzWkg9TxH7N/3+9CQ0eK3LIDRTlO4CdjM9kQDTzzNgULXWwx M/DiIVflIr3aKq2z8cQzheaYTDb9wVzOKr9qWw5VdbGItrnQnekMKpMbOqOUtpk5 ueNwd33L0Fwj40BKvK6X5TT2/uw07ldQO2fs86DAt9mavAqB0CAeoPPnGcQUPGTe 5vL4nb14Kp7jOvdr0dcwiIRMxmjO4u0asiV0FyIxCAGO0Z5rfl91H/fXU9U3Ie38 VZSe4IM+U6iZECSED1QdQ== X-ME-Sender: <xms:FT1uZRmFk5B_-6blBuW9JcVdLIq8XmRLcw6V3Rg2lPrzTNax_Ai9pQ> <xme:FT1uZc09ZsFU5GUVqW6mK_orRNU-BMv1_lqXpIHHg3Gpw6Vm81hGadGz8ZwZmAy9T 1FMndxdltTBJ6oGkw> X-ME-Received: <xmr:FT1uZXrWauoh36rU3tamwMHV3YT5QYEvTbjh4NnMa0JW4ftpPhB3iPXNCfQXOSl4MaWYlB1b3INAIXdBXnT2RlHBfwW6cjsRl_ctKfZLCtI> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudejiedgudeggecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdejtddmnecujfgurhephffvvefufffkofgjfhgggfestdekredt redttdenucfhrhhomhepffgrnhhivghlucgiuhcuoegugihusegugihuuhhurdighiiiqe enucggtffrrghtthgvrhhnpefgfefggeejhfduieekvdeuteffleeifeeuvdfhheejleej jeekgfffgefhtddtteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegugihusegugihuuhhurdighiii X-ME-Proxy: <xmx:FT1uZRlaipXpxgAYy4sxV6iFgFIHubndPMFFGkWzeLuRME2ENniPWw> <xmx:FT1uZf2WKvIicPL7J-isFRQDLKO8Cq3lOhitUBfSlf3cLqVUFx0-4g> <xmx:FT1uZQs07Hc5LWSsvbjf6US2JhIpxBTz-1igiXT7CG3vdNpEOiyWiw> <xmx:Fj1uZdMTZfylQc_6n1nOzXW922s0XkyGWdO3fEjktn8chQ9z3j_lPg> Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Dec 2023 15:56:52 -0500 (EST) From: Daniel Xu <dxu@dxuuu.xyz> To: davem@davemloft.net, Herbert Xu <herbert@gondor.apana.org.au>, steffen.klassert@secunet.com, pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, antony.antony@secunet.com, alexei.starovoitov@gmail.com, yonghong.song@linux.dev, eddyz87@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devel@linux-ipsec.org Subject: [PATCH bpf-next v4 01/10] xfrm: bpf: Move xfrm_interface_bpf.c to xfrm_bpf.c Date: Mon, 4 Dec 2023 13:56:21 -0700 Message-ID: <a385991bb4f36133e15d6eacb72ed22a3c02da16.1701722991.git.dxu@dxuuu.xyz> X-Mailer: git-send-email 2.42.1 In-Reply-To: <cover.1701722991.git.dxu@dxuuu.xyz> References: <cover.1701722991.git.dxu@dxuuu.xyz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 04 Dec 2023 12:57:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784386345729761579 X-GMAIL-MSGID: 1784386345729761579 |
Series |
Add bpf_xdp_get_xfrm_state() kfunc
|
|
Commit Message
Daniel Xu
Dec. 4, 2023, 8:56 p.m. UTC
This commit moves the contents of xfrm_interface_bpf.c into a new file,
xfrm_bpf.c This is in preparation for adding more xfrm kfuncs. We'd like
to keep all the bpf integrations in a single file.
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
net/xfrm/Makefile | 7 +------
net/xfrm/{xfrm_interface_bpf.c => xfrm_bpf.c} | 12 ++++++++----
2 files changed, 9 insertions(+), 10 deletions(-)
rename net/xfrm/{xfrm_interface_bpf.c => xfrm_bpf.c} (88%)
Comments
On Mon, Dec 4, 2023 at 12:56 PM Daniel Xu <dxu@dxuuu.xyz> wrote: > > This commit moves the contents of xfrm_interface_bpf.c into a new file, > xfrm_bpf.c This is in preparation for adding more xfrm kfuncs. We'd like > to keep all the bpf integrations in a single file. > > Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> > --- > net/xfrm/Makefile | 7 +------ > net/xfrm/{xfrm_interface_bpf.c => xfrm_bpf.c} | 12 ++++++++---- > 2 files changed, 9 insertions(+), 10 deletions(-) > rename net/xfrm/{xfrm_interface_bpf.c => xfrm_bpf.c} (88%) > > diff --git a/net/xfrm/Makefile b/net/xfrm/Makefile > index cd47f88921f5..29fff452280d 100644 > --- a/net/xfrm/Makefile > +++ b/net/xfrm/Makefile > @@ -5,12 +5,6 @@ > > xfrm_interface-$(CONFIG_XFRM_INTERFACE) += xfrm_interface_core.o > > -ifeq ($(CONFIG_XFRM_INTERFACE),m) > -xfrm_interface-$(CONFIG_DEBUG_INFO_BTF_MODULES) += xfrm_interface_bpf.o > -else ifeq ($(CONFIG_XFRM_INTERFACE),y) > -xfrm_interface-$(CONFIG_DEBUG_INFO_BTF) += xfrm_interface_bpf.o > -endif > - > obj-$(CONFIG_XFRM) := xfrm_policy.o xfrm_state.o xfrm_hash.o \ > xfrm_input.o xfrm_output.o \ > xfrm_sysctl.o xfrm_replay.o xfrm_device.o > @@ -21,3 +15,4 @@ obj-$(CONFIG_XFRM_USER_COMPAT) += xfrm_compat.o > obj-$(CONFIG_XFRM_IPCOMP) += xfrm_ipcomp.o > obj-$(CONFIG_XFRM_INTERFACE) += xfrm_interface.o > obj-$(CONFIG_XFRM_ESPINTCP) += espintcp.o > +obj-$(CONFIG_DEBUG_INFO_BTF) += xfrm_bpf.o ... > +#if IS_BUILTIN(CONFIG_XFRM_INTERFACE) || \ > + (IS_MODULE(CONFIG_XFRM_INTERFACE) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES)) > + > /* bpf_xfrm_info - XFRM metadata information > * > * Members: > @@ -108,3 +110,5 @@ int __init register_xfrm_interface_bpf(void) > return register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_CLS, > &xfrm_interface_kfunc_set); > } > + > +#endif /* xfrm interface */ imo the original approach was cleaner. #ifdefs in .c should be avoided when possible. But I'm not going to insist. ipsec folks please ack the first 3 patches.
On Mon, Dec 04, 2023 at 01:56:21PM -0700, Daniel Xu wrote: > This commit moves the contents of xfrm_interface_bpf.c into a new file, > xfrm_bpf.c This is in preparation for adding more xfrm kfuncs. We'd like > to keep all the bpf integrations in a single file. > > Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> > --- > net/xfrm/Makefile | 7 +------ > net/xfrm/{xfrm_interface_bpf.c => xfrm_bpf.c} | 12 ++++++++---- > 2 files changed, 9 insertions(+), 10 deletions(-) > rename net/xfrm/{xfrm_interface_bpf.c => xfrm_bpf.c} (88%) Adding Eyal to Cc, he added the xfrm_interface_bpf.c file. Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Hi Daniel, On Thu, Dec 7, 2023 at 3:52 AM Steffen Klassert via Devel <devel@linux-ipsec.org> wrote: > > On Mon, Dec 04, 2023 at 01:56:21PM -0700, Daniel Xu wrote: > > This commit moves the contents of xfrm_interface_bpf.c into a new file, > > xfrm_bpf.c This is in preparation for adding more xfrm kfuncs. We'd like > > to keep all the bpf integrations in a single file. This takes away the nice ability to reload the xfrm interface related kfuncs when reloading the xfrm interface. I also find it a little strange that the kfuncs would be available when the xfrm interface isn't loaded. So imho it makes sense that these kfuncs would be built as part of the module and not as part of the core. Eyal.
On Thu, Dec 07, 2023 at 01:08:08PM -0800, Eyal Birger wrote: > Hi Daniel, > > On Thu, Dec 7, 2023 at 3:52 AM Steffen Klassert via Devel > <devel@linux-ipsec.org> wrote: > > > > On Mon, Dec 04, 2023 at 01:56:21PM -0700, Daniel Xu wrote: > > > This commit moves the contents of xfrm_interface_bpf.c into a new file, > > > xfrm_bpf.c This is in preparation for adding more xfrm kfuncs. We'd like > > > to keep all the bpf integrations in a single file. > > This takes away the nice ability to reload the xfrm interface > related kfuncs when reloading the xfrm interface. > > I also find it a little strange that the kfuncs would be available > when the xfrm interface isn't loaded. > > So imho it makes sense that these kfuncs would be built > as part of the module and not as part of the core. I proposed to merge all the bpf extensions into one file. With that I wanted to avoid to have 'many' files under /net/xfrm that fall basically under bpf maintainance scope. But if there are practical reasons to have these spilted, I'm OK with that too.
Hi Eyal, On Thu, Dec 07, 2023 at 01:08:08PM -0800, Eyal Birger wrote: > Hi Daniel, > > On Thu, Dec 7, 2023 at 3:52 AM Steffen Klassert via Devel > <devel@linux-ipsec.org> wrote: > > > > On Mon, Dec 04, 2023 at 01:56:21PM -0700, Daniel Xu wrote: > > > This commit moves the contents of xfrm_interface_bpf.c into a new file, > > > xfrm_bpf.c This is in preparation for adding more xfrm kfuncs. We'd like > > > to keep all the bpf integrations in a single file. > > This takes away the nice ability to reload the xfrm interface > related kfuncs when reloading the xfrm interface. > > I also find it a little strange that the kfuncs would be available > when the xfrm interface isn't loaded. I think technically since the xfrm interface module does the kfunc registration, the kfuncs would only be available after the module is loaded. > > So imho it makes sense that these kfuncs would be built > as part of the module and not as part of the core. But yeah, point taken. I will revert this commit for v5. > > Eyal. Thanks, Daniel
diff --git a/net/xfrm/Makefile b/net/xfrm/Makefile index cd47f88921f5..29fff452280d 100644 --- a/net/xfrm/Makefile +++ b/net/xfrm/Makefile @@ -5,12 +5,6 @@ xfrm_interface-$(CONFIG_XFRM_INTERFACE) += xfrm_interface_core.o -ifeq ($(CONFIG_XFRM_INTERFACE),m) -xfrm_interface-$(CONFIG_DEBUG_INFO_BTF_MODULES) += xfrm_interface_bpf.o -else ifeq ($(CONFIG_XFRM_INTERFACE),y) -xfrm_interface-$(CONFIG_DEBUG_INFO_BTF) += xfrm_interface_bpf.o -endif - obj-$(CONFIG_XFRM) := xfrm_policy.o xfrm_state.o xfrm_hash.o \ xfrm_input.o xfrm_output.o \ xfrm_sysctl.o xfrm_replay.o xfrm_device.o @@ -21,3 +15,4 @@ obj-$(CONFIG_XFRM_USER_COMPAT) += xfrm_compat.o obj-$(CONFIG_XFRM_IPCOMP) += xfrm_ipcomp.o obj-$(CONFIG_XFRM_INTERFACE) += xfrm_interface.o obj-$(CONFIG_XFRM_ESPINTCP) += espintcp.o +obj-$(CONFIG_DEBUG_INFO_BTF) += xfrm_bpf.o diff --git a/net/xfrm/xfrm_interface_bpf.c b/net/xfrm/xfrm_bpf.c similarity index 88% rename from net/xfrm/xfrm_interface_bpf.c rename to net/xfrm/xfrm_bpf.c index 7d5e920141e9..3d3018b87f96 100644 --- a/net/xfrm/xfrm_interface_bpf.c +++ b/net/xfrm/xfrm_bpf.c @@ -1,9 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Unstable XFRM Helpers for TC-BPF hook +/* Unstable XFRM BPF helpers. * - * These are called from SCHED_CLS BPF programs. Note that it is - * allowed to break compatibility for these functions since the interface they - * are exposed through to BPF programs is explicitly unstable. + * Note that it is allowed to break compatibility for these functions since the + * interface they are exposed through to BPF programs is explicitly unstable. */ #include <linux/bpf.h> @@ -12,6 +11,9 @@ #include <net/dst_metadata.h> #include <net/xfrm.h> +#if IS_BUILTIN(CONFIG_XFRM_INTERFACE) || \ + (IS_MODULE(CONFIG_XFRM_INTERFACE) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES)) + /* bpf_xfrm_info - XFRM metadata information * * Members: @@ -108,3 +110,5 @@ int __init register_xfrm_interface_bpf(void) return register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_CLS, &xfrm_interface_kfunc_set); } + +#endif /* xfrm interface */