Message ID | 45124c8da4d96f4e87da540dfe41b3fd7aea878e.1702325874.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 r17csp7316669vqy; Mon, 11 Dec 2023 12:20:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIP+0LLAzAHW17/3QqyWiQMuag/LstRvw0FZ5Ht0C8SlTUbLlv+8wAllrEcGaNAs65CyHR X-Received: by 2002:a05:6a20:1a95:b0:18f:c90a:4d1e with SMTP id ci21-20020a056a201a9500b0018fc90a4d1emr4755047pzb.6.1702326047545; Mon, 11 Dec 2023 12:20:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702326047; cv=none; d=google.com; s=arc-20160816; b=xLCRebd0aSpa+afNhXqh+4oumWLP5H8Decg232j+afZz7oTJXEiQse1unSMBUpugZz Lz2x0i7yJ8aXYRcXtzfcKLvMJc04UIWEPNHW9N7sMHfqhZvCcLET3JZCx6LDmAmEu51B iBI1FxBhCDxYVgDqbAbZzqAmnFYFqRUmc3b5syOg2Hx9+ZKtWC3D0hTheZNuLh2+Y0S2 ypXNJNuZOpYLMY2ZTVe9JhpW/qWsaniv6aGjPQJG80ouSAJruFwgdr5NwZyf9X9vVbkT 2FxAPWAMpGVlMUpSwxR2A/rOjS4BnMGB1BL0ZrIYrmCdivn4mYubb8x1AgZzBesqKgxo 6z7w== 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=wvipjySugI619NXNdRelseHYrba3lRKAMvJgNzRoOuk=; fh=nI74ol1tNn4TkLqVL9fS6S6ZIWMv7HFiP+uU6/jzOAY=; b=Wut1t64UoKlW6dWzlbxIGOfAH8RrTuaoaA263PoPWI8Zuac57eFgP8BdXzfnY5IXV4 94iQfLxxXi2Ia7ZT1GrLICYdf79Vfnp3HQGr2DTiwP61iShGlvgMtcWVulu4sHkunQqt 07yMCwH+tGjRFY9UFriRt2fJnHhiqLkX8DvermkpLkR+Um+kY2YWV6daaAWRMTJrJyK6 fL7S039CsYgLRlrz7rjO2EjRMb0Ld3ZX8eJvBgSW4iKGQdd40vAAPETv9A4jjF7afSVy 7CENOgpTdhqEnForFBIrvPEKp6CckN8KTfTRY63m+4AzTweO2icUEGOQF+kkxbONoiFF JhVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=NwgRGCpT; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=1YRYnJbR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q12-20020a056a0002ac00b006ce203493f6si6342387pfs.357.2023.12.11.12.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 12:20:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=NwgRGCpT; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=1YRYnJbR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 662CD8051939; Mon, 11 Dec 2023 12:20:46 -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 S1344999AbjLKUUa (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Mon, 11 Dec 2023 15:20:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344986AbjLKUU1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 11 Dec 2023 15:20:27 -0500 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 591C1E4; Mon, 11 Dec 2023 12:20:34 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C34965C03D8; Mon, 11 Dec 2023 15:20:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 11 Dec 2023 15:20:33 -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=1702326033; x= 1702412433; bh=wvipjySugI619NXNdRelseHYrba3lRKAMvJgNzRoOuk=; b=N wgRGCpTOXc3wzmvq1QtNsLHZfWBPf8XUYx+Qkn4dGq47VBctPVoT/F209lSG4pPr VnxUGr/PjAlURQCr+wPwSOd8P8d1FrksHxWRyMuRfyidNoNgULXnInnSr52RkKVO nQnxD5Kmn1kWsVGxUxpxxRG6rf9lqx8h0nFNcqsFrVes1gLahIpfD3OVQK7wm+gc 4oxAAu5uWFYB/t8m1H8NLEDxWc/ePA0NG+Az6+KV+foxFqDwoiUYLEbP6cLQB0ge /GyTAfHPYz5DBj+oQTXYgsxzh1HOzsx8IUBcdFvE2VuZLxE+jtff1SSuJ5Yh17al U5/s449iu8dppjsFLoFiA== 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=1702326033; x= 1702412433; bh=wvipjySugI619NXNdRelseHYrba3lRKAMvJgNzRoOuk=; b=1 YRYnJbRbgtCn7zOXPOeJ1usXbCfQUyfJyJlmPd4OkwDkFaqGj1Oy5dioSM2MXsx7 yUfWfXiglNIW5ijmjRkDENJiwEKjUhbRe+uhjO55EU3YCWTgmGUKuAsvsVMPZgX6 ISL3ijOBTDrRSVGnb8LuBWPyi8ZeHg6DG5u7OLnD5/VvHR51aitYGKMrE8OF66sI xuSnVhAU7/ij5lOpAqlfgIetWyp4zsz/jItbP20mfKe/WVdhMCjSdPFwsq9pGyAS wW6EmlVZF9y8tDvJPDQWnThDl7rxewP1gsTu+9TgckYwsSYmubn1x18kUyCkSLxR 5P6mfvFGTMdJhsvLdgJug== X-ME-Sender: <xms:EW93ZfN1R2dStXm2CDZLvM6zWcA5mV8TzRmOQ6IXaHqgRz33Z-HfmA> <xme:EW93ZZ-mX-sRNS8r5Nf9f5zUxPRHEtWRXb0Zd1WDZtNzJzl429qcU6-WVITzzHF8Y FQmYOGYBj7oRd3lZw> X-ME-Received: <xmr:EW93ZeQjYZt2gnXmXDV-InV7y9iifdswRSENFy7qz0z0LfBMREXJkYFBngOD-ChoOaRQSqA6lJvX8RvM9yHEubXyDQe3GGmL1hVN424Q-eE> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudelvddgudefkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdefhedmnecujfgurhephffvvefufffkofgjfhgggfestdekredt redttdenucfhrhhomhepffgrnhhivghlucgiuhcuoegugihusegugihuuhhurdighiiiqe enucggtffrrghtthgvrhhnpefgfefggeejhfduieekvdeuteffleeifeeuvdfhheejleej jeekgfffgefhtddtteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegugihusegugihuuhhurdighiii X-ME-Proxy: <xmx:EW93ZTuMroGTfT3fdqBOM-fpOsSfL7GQqsHC6C-ojOhV4cv0OwtZXw> <xmx:EW93ZXd79rUGeTPGLotgno63YwBm3BmsWYkUCv_GS87zMbvxjaMOpA> <xmx:EW93Zf0XenFcoBD5aLGWqNT2eIMcLjk92ukLj1ZDRW5W9T_a24YreQ> <xmx:EW93ZSDHDmyS7os5m2RMhnqTAMz74oeaTZidj2HoAsy-JUr0BovCeA> Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 11 Dec 2023 15:20:32 -0500 (EST) From: Daniel Xu <dxu@dxuuu.xyz> To: daniel@iogearbox.net, davem@davemloft.net, edumazet@google.com, Herbert Xu <herbert@gondor.apana.org.au>, ast@kernel.org, john.fastabend@gmail.com, kuba@kernel.org, steffen.klassert@secunet.com, pabeni@redhat.com, hawk@kernel.org, antony.antony@secunet.com, alexei.starovoitov@gmail.com, yonghong.song@linux.dev, eddyz87@gmail.com, eyal.birger@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devel@linux-ipsec.org Subject: [PATCH bpf-next v5 2/9] bpf: xfrm: Add bpf_xdp_xfrm_state_release() kfunc Date: Mon, 11 Dec 2023 13:20:06 -0700 Message-ID: <45124c8da4d96f4e87da540dfe41b3fd7aea878e.1702325874.git.dxu@dxuuu.xyz> X-Mailer: git-send-email 2.42.1 In-Reply-To: <cover.1702325874.git.dxu@dxuuu.xyz> References: <cover.1702325874.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_H3,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, 11 Dec 2023 12:20:46 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785018237321531492 X-GMAIL-MSGID: 1785018237321531492 |
Series |
Add bpf_xdp_get_xfrm_state() kfunc
|
|
Commit Message
Daniel Xu
Dec. 11, 2023, 8:20 p.m. UTC
This kfunc releases a previously acquired xfrm_state from bpf_xdp_get_xfrm_state(). Co-developed-by: Antony Antony <antony.antony@secunet.com> Signed-off-by: Antony Antony <antony.antony@secunet.com> Acked-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> --- net/xfrm/xfrm_state_bpf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/net/xfrm/xfrm_state_bpf.c b/net/xfrm/xfrm_state_bpf.c index 21630974c27d..b84adec4451c 100644 --- a/net/xfrm/xfrm_state_bpf.c +++ b/net/xfrm/xfrm_state_bpf.c @@ -96,10 +96,26 @@ bpf_xdp_get_xfrm_state(struct xdp_md *ctx, struct bpf_xfrm_state_opts *opts, u32 return x; } +/* bpf_xdp_xfrm_state_release - Release acquired xfrm_state object + * + * This must be invoked for referenced PTR_TO_BTF_ID, and the verifier rejects + * the program if any references remain in the program in all of the explored + * states. + * + * Parameters: + * @x - Pointer to referenced xfrm_state object, obtained using + * bpf_xdp_get_xfrm_state. + */ +__bpf_kfunc void bpf_xdp_xfrm_state_release(struct xfrm_state *x) +{ + xfrm_state_put(x); +} + __bpf_kfunc_end_defs(); BTF_SET8_START(xfrm_state_kfunc_set) BTF_ID_FLAGS(func, bpf_xdp_get_xfrm_state, KF_RET_NULL | KF_ACQUIRE) +BTF_ID_FLAGS(func, bpf_xdp_xfrm_state_release, KF_RELEASE) BTF_SET8_END(xfrm_state_kfunc_set) static const struct btf_kfunc_id_set xfrm_state_xdp_kfunc_set = {