Message ID | cover.1701722991.git.dxu@dxuuu.xyz |
---|---|
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 r17csp3033159vqy; Mon, 4 Dec 2023 12:57:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IG95R0sc9c1LltXpQDr39dt9CUVObDrcyJzBex2eUCqgi8C352HpFqfG1HNMXA37HGNNRr+ X-Received: by 2002:a17:902:ced2:b0:1d0:c418:1754 with SMTP id d18-20020a170902ced200b001d0c4181754mr74478plg.93.1701723430681; Mon, 04 Dec 2023 12:57:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701723430; cv=none; d=google.com; s=arc-20160816; b=CfhVCq6Fmc1vNOjTaOSWy0noifIGEItkPiBgm2Goy9wqpoEhhu3ENfInjjPYA2wCTs orSuNbUdEC6uv8b+o/P6WcRPzW3x3xAMPlZsolLsOREzaNZETWFLvax0iPTzac6dOEVr JnqliLXy/xitEXD5DTeGxMuPV4oOIUqYz9AfyqfMUeaqXHOhh4jhaSN9L4553WC0ONy0 kXc+KkhktevLN567fXac8OFHyQddgwIBtR7KiimU5GfXWZEyhfpdLC4EoKhMNCwrtoHL Ey0ZW3WfJJfrUhI+GlCd+HbRbLRXqojc2Ct0AUI7xgBsoJ6MqneJ+NW4BUOEgEk+pbGH S10g== 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 :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=8GB/ov08iHjvBVcUgI6yH23procKO/e3iFK3yc6WqUI=; fh=rf5KriGIvO7T3QDkhP0BKDmXQzKQIEheVhsrpjGRTzY=; b=newL2oxWkTXVEbPFzh3T1Kd3pOcAWFtBlb4bohopFYluY6bE4Klxw/xqLvDFsBOGuD aws7c3JC2CCGjiT5Us7EixV7NEV4/AD8J4CHKal5/Ay7d5SpZkpMPZc3UzYY/bvaMWCF HKBLJhIz1wjhzkYOH4Za0GNPQzG27cp5u0g0HkI0IsUMxF3jm2TkTq/DkRCYKU93unar lt2CXQP3sQqfuGSl0Rc22Xpkrt2kOGVWO5NDx8289om089lpyaDx5JmMXbUGxFtvI469 5QtzHWRee3iiHrocTCAGMSxFBe5iaxrHOBppWXjG8ZvqPqwofc4yAGh7u6Z1+BBFmLFI MI1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm3 header.b=f0qpg284; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=UKTEbC2c; 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 q16-20020a170902eb9000b001d08f173f0dsi3023685plg.84.2023.12.04.12.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 12:57:10 -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=f0qpg284; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=UKTEbC2c; 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 7BF1E804B000; Mon, 4 Dec 2023 12:57:09 -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 S233902AbjLDU47 (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Mon, 4 Dec 2023 15:56:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233859AbjLDU4w (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 BB009111; 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 80A3B5C00B3; Mon, 4 Dec 2023 15:56:52 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 04 Dec 2023 15:56:52 -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:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm3; t=1701723412; x=1701809812; bh=8GB/ov08iH jvBVcUgI6yH23procKO/e3iFK3yc6WqUI=; b=f0qpg284bJpVVw1nPh/TnrCzv3 Gx2cCAU90XK8Vn4wuO26c1FdbQozmMDNw6d3By+luF4UAEclBr9QqmJJSNmoaWSe dghTKz7p5ao5uzWQ90LABJsuJqxZo3vblOBqenXnXYRMo4jsrJLTZbr+BSHN9juk F6mO5KJRC9PH2Gh4MgzKMLPE5a9NuWnCXR+aNudgkKzTnk2x2wouNWj0VG6m/1FY osZ692+6onWHgaKIiz9zhHUFsVMvyL8aM8JsSIeQywvDstLK10cFYBvUAlEyBfKW /nUBBhmdltV/avoZypJk0B8aqj0obuyz2/vM7Nr7G+GbGQDMKFQKHgms/9Mw== 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:message-id:mime-version: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=1701723412; x=1701809812; bh=8GB/ov08iHjvB VcUgI6yH23procKO/e3iFK3yc6WqUI=; b=UKTEbC2c27b9X/4abi4DjkBrcB+03 f+ducKIrmHS/cNvKIEtaWqz8KYtr3KieTOM9OgrSmNnvQJmqXdsZZoeBQjGnXCJd 96c+Cv7eCfcgHRQSpbL9VXJxmJMHfVKt3YlEiUBuPYDbW0+w6nKFmC7vOuvPFXBZ f8gVpflf98HKM6/DM2zo5bo50SEkHYUieVZqhREYQWLfAjcKUEiOvyrHtva8wHoS NhS44dpbEcTSpbZSJGOrIklLC6xAYMy7PKeXNEV3skcX6UOhkmY/Gl7+492d/qPE bYeZScmVy5Jq8Hhp27Tqn8H4MWc6R3lZ4CbW/hIpaR2aLQhovy/38e1OQ== X-ME-Sender: <xms:FD1uZYv_KetGYMWakHdAqH9jCWJN7W-oDkolZy2r5n8K8KFqCcHyVA> <xme:FD1uZVfMkkLL-dYVBYDo1Pc1-g3BPwuUqrZ6ALFwPG9BZtRv0JDm5-BQfq7dU1lwh 5Jzn1ebJBZDqB2X_w> X-ME-Received: <xmr:FD1uZTyDqwU8yuaaxqSxd5wDctbaAl-A6QyL5nJswiorb5IFYygsL0feLY57BdiyLgXa3nCH6Tx0mgZL_yuVMI1o_8s-QUh99K_8xmhe3-M> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudejiedgudeggecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecufghrlhcuvffnffculddvfedmnecujfgurhephf fvvefufffkofgggfestdekredtredttdenucfhrhhomhepffgrnhhivghlucgiuhcuoegu gihusegugihuuhhurdighiiiqeenucggtffrrghtthgvrhhnpeeikeehudegteevuddthf eilefhjefgueeuueffveevheeggfeufeejfeeuudekfeenucffohhmrghinhepihgvthhf rdhorhhgpdhgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpegugihusegugihuuhhurdighiii X-ME-Proxy: <xmx:FD1uZbM0IsrvwIyX70QLs1E167i6An8PHqCk_KlHVn1jNrPbz1Nzkg> <xmx:FD1uZY8GMdeLBalgSYt343IglU5Ep0BSvPQ-Duvj05_hl-Ct1TnfnA> <xmx:FD1uZTXhfjqxYahnQxTJDzhD8Mzz1Xl-HcxP6dGo-3HrmdYS8fb8yg> <xmx:FD1uZTboSbWyQ3clRaELqJGRcLHUzDhj38AsKU66QLVwO6X9fV8yPw> Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Dec 2023 15:56:51 -0500 (EST) From: Daniel Xu <dxu@dxuuu.xyz> To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, llvm@lists.linux.dev, steffen.klassert@secunet.com, antony.antony@secunet.com, alexei.starovoitov@gmail.com, yonghong.song@linux.dev, eddyz87@gmail.com Cc: devel@linux-ipsec.org Subject: [PATCH bpf-next v4 00/10] Add bpf_xdp_get_xfrm_state() kfunc Date: Mon, 4 Dec 2023 13:56:20 -0700 Message-ID: <cover.1701722991.git.dxu@dxuuu.xyz> X-Mailer: git-send-email 2.42.1 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:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784386347918172757 X-GMAIL-MSGID: 1784386347918172757 |
Series |
Add bpf_xdp_get_xfrm_state() kfunc
|
|
Message
Daniel Xu
Dec. 4, 2023, 8:56 p.m. UTC
This patchset adds two kfunc helpers, bpf_xdp_get_xfrm_state() and bpf_xdp_xfrm_state_release() that wrap xfrm_state_lookup() and xfrm_state_put(). The intent is to support software RSS (via XDP) for the ongoing/upcoming ipsec pcpu work [0]. Recent experiments performed on (hopefully) reproducible AWS testbeds indicate that single tunnel pcpu ipsec can reach line rate on 100G ENA nics. Note this patchset only tests/shows generic xfrm_state access. The "secret sauce" (if you can really even call it that) involves accessing a soon-to-be-upstreamed pcpu_num field in xfrm_state. Early example is available here [1]. [0]: https://datatracker.ietf.org/doc/draft-ietf-ipsecme-multi-sa-performance/03/ [1]: https://github.com/danobi/xdp-tools/blob/e89a1c617aba3b50d990f779357d6ce2863ecb27/xdp-bench/xdp_redirect_cpumap.bpf.c#L385-L406 Changes from v3: * Place all xfrm bpf integrations in xfrm_bpf.c * Avoid using nval as a temporary * Rebase to bpf-next * Remove extraneous __failure_unpriv annotation for verifier tests Changes from v2: * Fix/simplify BPF_CORE_WRITE_BITFIELD() algorithm * Added verifier tests for bitfield writes * Fix state leakage across test_tunnel subtests Changes from v1: * Move xfrm tunnel tests to test_progs * Fix writing to opts->error when opts is invalid * Use __bpf_kfunc_start_defs() * Remove unused vxlanhdr definition * Add and use BPF_CORE_WRITE_BITFIELD() macro * Make series bisect clean Changes from RFCv2: * Rebased to ipsec-next * Fix netns leak Changes from RFCv1: * Add Antony's commit tags * Add KF_ACQUIRE and KF_RELEASE semantics Daniel Xu (10): xfrm: bpf: Move xfrm_interface_bpf.c to xfrm_bpf.c bpf: xfrm: Add bpf_xdp_get_xfrm_state() kfunc bpf: xfrm: Add bpf_xdp_xfrm_state_release() kfunc libbpf: Add BPF_CORE_WRITE_BITFIELD() macro bpf: selftests: test_loader: Support __btf_path() annotation libbpf: selftests: Add verifier tests for CO-RE bitfield writes bpf: selftests: test_tunnel: Setup fresh topology for each subtest bpf: selftests: test_tunnel: Use vmlinux.h declarations bpf: selftests: Move xfrm tunnel test to test_progs bpf: xfrm: Add selftest for bpf_xdp_get_xfrm_state() include/net/xfrm.h | 9 + net/xfrm/Makefile | 7 +- net/xfrm/xfrm_bpf.c | 232 ++++++++++++++++++ net/xfrm/xfrm_interface_bpf.c | 110 --------- net/xfrm/xfrm_policy.c | 2 + tools/lib/bpf/bpf_core_read.h | 32 +++ .../selftests/bpf/prog_tests/test_tunnel.c | 162 +++++++++++- .../selftests/bpf/prog_tests/verifier.c | 2 + tools/testing/selftests/bpf/progs/bpf_misc.h | 1 + .../selftests/bpf/progs/bpf_tracing_net.h | 1 + .../selftests/bpf/progs/test_tunnel_kern.c | 138 ++++++----- .../bpf/progs/verifier_bitfield_write.c | 100 ++++++++ tools/testing/selftests/bpf/test_loader.c | 7 + tools/testing/selftests/bpf/test_tunnel.sh | 92 ------- 14 files changed, 624 insertions(+), 271 deletions(-) create mode 100644 net/xfrm/xfrm_bpf.c delete mode 100644 net/xfrm/xfrm_interface_bpf.c create mode 100644 tools/testing/selftests/bpf/progs/verifier_bitfield_write.c