From patchwork Thu Mar 13 10:48:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Curutchet X-Patchwork-Id: 14014714 X-Patchwork-Delegate: bpf@iogearbox.net Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90670267B05; Thu, 13 Mar 2025 10:48:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741862906; cv=none; b=JJd6VRSyoQW/VHbIawMgz8CeLgWHOHAb7ENq+HoxFbe2C0w/zTxb9pFJmuQbbyDO0DTe3+huUDM/iGthUczQl2542AhzHAt+PchgsdeF6B+YDBeQ/60u1MYMpTEdebQlb+yugJPKaBpu8Lue31nfYegko4LaDgWFD+dT/Ilm6Ng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741862906; c=relaxed/simple; bh=bn5FpKmiXbwrT2aMVsjwSzkfSMKma+UcIye4K/iLcoc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jySJDhoHUoeAJQggNV+SaHdgdqxPcIK743UNdq9eBAIaGLsKjSgfCzAR4IB3IgitG/VPSOzptf1V16/j+LxaW1zt/ez9TE9wZIMMQxPQpg5foiPAXRGtPBzxT+9T6ACKXn/Erw4HLWtEjyL1xL/Ob8M9BtYhVntjke3SU5BTjb0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=bPWBE/FG; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="bPWBE/FG" Received: by mail.gandi.net (Postfix) with ESMTPSA id 92A17441A1; Thu, 13 Mar 2025 10:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1741862900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1R9vn1noreVtGY0NwYCvBtkPGgC6mo1F56uk2WvJ90Y=; b=bPWBE/FGkZ4KHCfIjZiMYJBmut2w/KXlzzKMqPozWa20QwdjpdXMrwN3W4thWwbjPvZNe/ o9QaOLU7YCEuvziLYhZhPNFW9osgk/t697pKs6p6aXqV2uaDFTQ2ChPI19ejsvAi6+Psmo 8H/8t2IqiaKj99TEbM875NAA189YWWj+/mJRt3sz/0LILvXvr2Gv4WaUmV5cHfTwEg+VSZ OnSYuT6ees/ny1J+ULe79ni859TPVqzcPhUrvCrTuCT4m6mUt2p9vZLa9rq5lAC46RX0Gj wxb2sP+S+2EGsGDU5Thp3WXaPY4zdr4wJbamBahWDhF8+oA8ysiR4D9MJJyd7A== From: "Bastien Curutchet (eBPF Foundation)" Date: Thu, 13 Mar 2025 11:48:09 +0100 Subject: [PATCH 11/13] selftests/bpf: test_xsk: Make kselftest dependency optional Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250313-xsk-v1-11-7374729a93b9@bootlin.com> References: <20250313-xsk-v1-0-7374729a93b9@bootlin.com> In-Reply-To: <20250313-xsk-v1-0-7374729a93b9@bootlin.com> To: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer Cc: Thomas Petazzoni , Alexis Lothore , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (eBPF Foundation)" X-Mailer: b4 0.14.2 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdejjeehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomhepfdeurghsthhivghnucevuhhruhhttghhvghtucdlvgeurffhucfhohhunhgurghtihhonhdmfdcuoegsrghsthhivghnrdgtuhhruhhttghhvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeegfeduhfeutddtieffteffleejffekveeviedutdegjeelfedtjeegtdejtddthfenucfkphepvdgrtddumegtsgduleemkedvheefmeguuddttdemfhelvgdumeeftgejudemjeeitdgtmedutggsrgenucevlhhushhtvghrufhiiigvpeeknecurfgrrhgrmhepihhnvghtpedvrgdtudemtggsudelmeekvdehfeemugdutddtmehflegvudemfegtjedumeejiedttgemudgtsggrpdhhvghlohepfhgvughorhgrrdhhohhmvgdpmhgrihhlfhhrohhmpegsrghsthhivghnrdgtuhhruhhttghhvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvkedprhgtphhtthhopegvugguhiiikeejsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghlvgigihhsrdhlohhthhhorhgvsegsohhothhlihhnrdgtohhmpdhrtghpt hhtohepshhhuhgrhheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhihkhholhgrlhesfhgsrdgtohhmpdhrtghpthhtohephihonhhghhhonhhgrdhsohhngheslhhinhhugidruggvvhdprhgtphhtthhopehmrghgnhhushdrkhgrrhhlshhsohhnsehinhhtvghlrdgtohhmpdhrtghpthhtohepmhgrrhhtihhnrdhlrghusehlihhnuhigrdguvghvpdhrtghpthhtohepsggrshhtihgvnhdrtghurhhuthgthhgvthessghoohhtlhhinhdrtghomh X-GND-Sasl: bastien.curutchet@bootlin.com X-Patchwork-Delegate: bpf@iogearbox.net test_xsk.c uses the kselftest framework. This isn't compatible with the test_progs framework. Add a XSK_SELTFEST define that allows to enable/disable the kselftest usage. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/Makefile | 2 +- tools/testing/selftests/bpf/test_xsk.h | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index ca14999fe0d832b24536f3a4f956e987c3b53cd8..3cde86a6e9b1ca467de162e0ba9670ad2085b6a6 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -777,7 +777,7 @@ $(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT) EXTRA_SRC := $(TOOLSDIR)/lib/find_bit.c $(OUTPUT)/xskxceiver: $(EXTRA_SRC) test_xsk.c xskxceiver.c xskxceiver.h $(OUTPUT)/network_helpers.o $(OUTPUT)/xsk.o $(OUTPUT)/xsk_xdp_progs.skel.h $(BPFOBJ) | $(OUTPUT) $(call msg,BINARY,,$@) - $(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ + $(Q)$(CC) $(CFLAGS) -D XSK_KSELFTEST $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ $(OUTPUT)/xdp_hw_metadata: xdp_hw_metadata.c $(OUTPUT)/network_helpers.o $(OUTPUT)/xsk.o $(OUTPUT)/xdp_hw_metadata.skel.h | $(OUTPUT) $(call msg,BINARY,,$@) diff --git a/tools/testing/selftests/bpf/test_xsk.h b/tools/testing/selftests/bpf/test_xsk.h index 61246013816431dca2f84ce2fec44c5160adbdad..9653687087c122ec5fdb9f23e3343e37c82373f6 100644 --- a/tools/testing/selftests/bpf/test_xsk.h +++ b/tools/testing/selftests/bpf/test_xsk.h @@ -5,7 +5,6 @@ #include #include -#include "../kselftest.h" #include "xsk.h" #ifndef SO_PREFER_BUSY_POLL @@ -31,12 +30,29 @@ #define SOCK_RECONF_CTR 10 #define USLEEP_MAX 10000 + +#ifdef XSK_KSELFTEST +#include "../kselftest.h" + static bool opt_verbose; #define print_msg(x...) ksft_print_msg(x) #define print_verbose(x...) do { if (opt_verbose) ksft_print_msg(x); } while (0) #define skip_reason(x...) ksft_test_result_skip(x) #define fail_reason(x...) ksft_test_result_fail(x) +#else + +void xsk_log(const char *msg, ...); +void xsk_verbose(const char *msg, ...); +void xsk_skip(const char *msg); + +#define print_msg(x...) xsk_verbose(x) +#define print_verbose(x...) xsk_verbose(x) +#define skip_reason(x...) xsk_skip(x) +#define fail_reason(x...) xsk_log(x) + +#endif + static inline u32 ceil_u32(u32 a, u32 b) { return (a + b - 1) / b;