🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6194

Re: [PATCH v4 net-next 06/15] selftests: xsk: move the AF_XDP test suite to selftests/net

#6194
From: Jakub Kicinski
Date: Wed, 21 Oct 2026 21:55
67 lines
10793 bytes
On Fri, 16 Oct 2026 19:43:29 +0200 Maciej Fijalkowski wrote:
> Move the xskxceiver engine, the AF_XDP userspace library, the test
> definitions and the XDP program to net/lib/xsk, and test_xsk.sh with
> its prerequisites script to selftests/net. A later patch drives the
> same engine against real NICs from drivers/net/hw, and net/lib is where
> both suites take shared helpers from.
> 
> net/lib builds xskxceiver with its XDP program and skeleton, using the
> bpftool in PATH, and skips it with a warning when bpftool is missing or
> does not run; test_xsk.sh then skips too. xskxceiver links -lpthread,
> which glibc older than 2.34 needs for the threads of test_xsk.c.
> 
> Like the rest of net/lib, xskxceiver builds against the installed uapi
> headers, so include linux/kernel.h for min_t() directly rather than via
> the tools copy of linux/netlink.h. tools/include goes ahead of CFLAGS,
> so that O= builds take linux/kernel.h and linux/types.h from it rather
> than from a source tree usr/include.

To be clear the expectation is that user runs

 make headers

first, so installed != system headers. There's no requirement 
that selftests build without running make headers first.

> Move the ethtool ring helper from network_helpers into xsk.c and
> point the kselftest.h include of test_xsk.h at the net/lib include
> path. The XDP program moves unchanged; its Ethernet header bound check
> compares pointers of distinct types, so net/lib builds it with
> -Wno-compare-distinct-pointer-types, as the bpf selftests do.
> xdp_hw_metadata and the xdp_metadata test keep using xsk.c and xsk.h
> from their new location. Update the AF_XDP entry in MAINTAINERS.
> 

> +# AF_XDP test engine used by net/test_xsk.sh.
> +XSK_DIR := xsk
> +XSK_BPF_OBJ := $(OUTPUT)/xsk_xdp_progs.bpf.o
> +XSK_SKEL := $(OUTPUT)/xsk_xdp_progs.skel.h
> +XSK_SOURCES := $(addprefix $(XSK_DIR)/,xskxceiver.c xsk.c test_xsk.c) \
> +	$(top_srcdir)/tools/lib/find_bit.c
> +XSK_HEADERS := $(wildcard $(XSK_DIR)/*.h)
> +
> +PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
> +XSK_LDLIBS := $(shell $(PKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf) -lz
> +XSK_LDLIBS += -lpthread
> +
> +$(XSK_BPF_OBJ): $(XSK_DIR)/xsk_xdp_progs.bpf.c $(XSK_DIR)/xsk_xdp_common.h $(BPFOBJ)
> +	$(call msg,BPF_PROG,,$@)
> +	$(Q)$(CLANG) -O2 -g --target=bpf $(CCINCLUDE) $(CLANG_SYS_INCLUDES) \
> +		-Wno-compare-distinct-pointer-types -c $< -o $@
> +
> +$(OUTPUT)/xskxceiver: $(XSK_SOURCES) $(XSK_HEADERS) $(XSK_SKEL) $(BPFOBJ)
> +	$(call msg,CC,,$@)
> +	$(Q)$(CC) -I$(top_srcdir)/tools/include $(CFLAGS) -I$(OUTPUT) \
> +		-I$(SCRATCH_DIR)/include \
> +		$(XSK_SOURCES) $(BPFOBJ) $(LDLIBS) $(XSK_LDLIBS) -o $@

Why do we need all these extra rules to build the xsk stuff?
bpf.mk should build all %.bpf.c into objects
You seem to do similar thing for skel.
We shouldn't need 20 lines of Makefile for each test.
We are not using any bleeding edge toolchain features here

> +EXTRA_CLEAN += $(XSK_BPF_OBJ) $(XSK_SKEL)

This should also somehow be covered by wildcards not obj by obj.
Technical Details
Message-ID: <20261021145510.6ab6b982@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350259-linux-kernel-netdev=dewy.ru
References: <20261016174338.787135-1-maciej.fijalkowski@intel.com> <20261016174338.787135-7-maciej.fijalkowski@intel.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350259-linux-kernel-netdev=dewy.ru
From: kuba@kernel.org (Jakub Kicinski)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v4 net-next 06/15] selftests: xsk: move the AF_XDP test
 suite to selftests/net
Date: Wed, 21 Oct 2026 14:55:10 -0700
Organization: Usenet Network
Message-ID: <20261021145510.6ab6b982@kernel.org>
References: <20261016174338.787135-1-maciej.fijalkowski@intel.com>
	<20261016174338.787135-7-maciej.fijalkowski@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="71587"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:uMmPa82rflzTvtkMooygMpVhFLo= sha256:BI+U9hZh+zqzdKi1N74nK+oCZa+4v3BYkERioTAE/G8=
	sha1:qChNL3cd2qAKvyRyGhpuzM2QfrY= sha256:5l3ojKT/ORIkhDOtNNjW0XZ3l1FP4tTcfVlzlXVAMOM=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 8799D1110F9; Thu, 22 Oct 2026 00:56:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id YZtd7nFKdumq;
	Thu, 22 Oct 2026 00:55:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350259-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id D5E7B111115; Thu, 22 Oct 2026 00:55:47 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7CAFB3CADD; Wed, 21 Oct 2026 21:55:23 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792619723;
	b=UmZ2zEt14abdOyUcEcdPDJDSgepr+dynMvbFjK9v8/8fYj3j0Ssot0J7TfykwtbYYcGy
	 YxwV+hKkwqtg/UeX51Un3SPWl8i/0gvoPcvfGtMDyLKj799UAIdkBe069lkbSqBr05NPR
	 dl/ZQi80ihI7tVS/PAsUozGFjJQERoTJqyrvdXbhASCP5gp/BJd5xpUrePXgg3LJY+GgN
	 stH2ofnqdw1qRwnATGF7mJgFxFH/a6SEKNm3BKWUWc6noGGuPtFxZwYlRfo3hqBOnL7jM
	 FaR+M8SfziC6SA8QDRGzTmjZUBwXVIUq/Ax2isU6I68OMac6fYA4rrM56ZhbhpBM7Zw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792619723;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:In-Reply-To:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=nvVTH1Es7T77G63IC0TSBaGlf+EIxLYCrQxGzH7CDvs=;
	b=yWdC5ub46LcWnhC8dNfRtvwjVpzoi6k0cNcYbBlFSz9301wlT16H2+CeNCYO1TlaJkKq
	 AKJDS1LUaVBm6yCqHKtuuKieqNFFJsb2aSWh+DzdWDDLQZ9bbm4DCXILYB7+SKF9Qz2/S
	 v2aQgjRfT+D2wl4X4a5BbOZhsmv0k9wEdo+zgixFp/9ISrPDus1/XUQXE7nKolRIyrosO
	 6GZ4uNXGRSLaV9OibzmDbtsMUbgtOzKnKXAYrCBT450BGwsF4q+7RpL7Ea5qM3BPNHDBB
	 1kDCxxSubUbnHSu2/h/bBfrFPt2Zx2xqvm2zRX5i0qwYtxsZ0TDdFbYjVHwf1JaG9MA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ioZ6Jebn;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id ECFF2606A321;
	Wed, 21 Oct 2026 21:55:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ioZ6Jebn
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792619712;
	b=C2Wnh2Aq8t8qlMIflwhVAqQcExwNW7GAEp4rKM4+r1Vjaoaah9cQF4XIGAQPwShGzwjX
	 xJph2rmmKlmusmGJ+uitIHblfhmw+9KfgY6MuDCpl6HcO6MxNyKfgFGcd0itZby7Uvx5k
	 eHgn/qTgsYRooX5kuutg0fKKB1mVU2MCHv60KvxPOkVxfzBq8i5mzUrHAPKvzNUCzntDv
	 5hLKQcGcRkTQpX2HG8+JNwWifOr/hlFa1iaRxC0ClmOtM2i/W52lXKIFAJeEZAixe9JvT
	 AJbGcOkiNOyWRUXlMUR6ea1V0Dd5hyMkrrTaVUkFcGh+rdoEGkl6l04OMQiiqyFBVPw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792619712;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=nvVTH1Es7T77G63IC0TSBaGlf+EIxLYCrQxGzH7CDvs=;
	b=GTOdvPMsTyR9DgbLgRE5aVYmB/HqPocIQLMi5HR+5xY1VywNLkCe8NhFPGkmvWzrvEYc
	 Yep7ShfADWH4wXMFyf/s2kHRMbxBeHfp0weVhmL5oL3esqSXdeajwYh/nKcdxTBmhXzIO
	 r3GsxqrByJF2sR4kq+T47Q1O3knVLiQqDDQVTUJTBQccK0eROFRElcVjVSrWz4MjD9yU/
	 qmKwWYid8uQu1UKZlYwi1BVKgjMtPoWsNG1hQIYaP+JW/DPe+/bsc5fBIh2USwjLbI3tw
	 eNkgnceTedjTtkaMNM0W00nrcy9yi+SB0mjORU5GMd3Wmte9OdqJrxlG+zy3hQVrJLA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ioZ6Jebn;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4FDB606A319;
	Wed, 21 Oct 2026 21:55:11 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EA731F000C1;
	Wed, 21 Oct 2026 21:55:11 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792619711;
	bh=nvVTH1Es7T77G63IC0TSBaGlf+EIxLYCrQxGzH7CDvs=;
	h=Date:From:To:Cc:Subject:In-Reply-To:References;
	b=ioZ6JebnKO6f8kDym91x683UBKX3jQbhC6QbpgpukkZx+TpqIKnS3nK+p0cjCcmWG
	 OIFm5DoAqsMDHbD2VqZ/zz9RzkERc5VklHOHORC7TCeGEdi1q6f/vxRpJtGjHWg49R
	 mbW54Q+V0cropVL9ei8p9vJsgFxX7ZI8ZKM619O9wHgvq2mxg3sxDnId2jqBAD6yfL
	 rGjZ3JJ2kw4MoLvcn6UF38jxKpYGq+MZOqqKg569HLKuLKA7lgJup4lFOquwxmXYPa
	 bQahoBXEyZ5jV+9HEh3qAbLMZ6cBUEJ97JN9myZxMKdnUUffYaSzbDsDI6aexwftkM
	 1qckj1jVOMNaA==
X-Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, magnus.karlsson@intel.com,
 stfomichev@gmail.com, pabeni@redhat.com, tushar.vyavahare@intel.com,
 kerneljasonxing@gmail.com, bjorn@kernel.org
X-In-Reply-To: <20261016174338.787135-7-maciej.fijalkowski@intel.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list