🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #3490

Re: [PATCH v3 net-next 07/15] selftests: xsk: collect interface capabilities in struct xsk_caps

#3490
From: Björn Töpel
Date: Thu, 15 Oct 2026 08:27
64 lines
8128 bytes
Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:

> A later patch runs the TX and RX endpoints of a case as separate
> processes, possibly on different hosts, each binding only its own
> interface. The shared test code still looks at the capabilities of both
> ifobjects, e.g. to check both for multi-buffer support or to size the
> RX batch from the TX ring limit. As the endpoints do not exchange
> capabilities, a process will represent the other side by a shadow
> ifobject that mirrors the local ones.
>
> Prepare for that by replacing the per-interface support booleans and
> limits in struct ifobject with one struct xsk_caps, so that mirroring
> takes a single struct assignment and a capability added later cannot
> be left out of the copy. The maximum TX ring size, which comes from the
> ethtool ring parameters that a shadow does not mirror, is copied there
> too. ifobj_has_cap() and ifobj_set_cap() test and set the flags, and
> xsk_get_cap() reads a limit from the TX ifobject, the only one that has
> all of them set, as the open-coded reads did.
>
> The unaligned UMEM check now looks at the RX ifobject only: the flag
> comes from a huge page probe that does not depend on the interface, and
> test_spec_set_unaligned() switches both UMEMs together.
>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
>  .../testing/selftests/net/lib/xsk/test_xsk.c  | 84 +++++++++++--------
>  .../testing/selftests/net/lib/xsk/test_xsk.h  | 34 ++++++--
>  .../selftests/net/lib/xsk/xskxceiver.c        | 13 +--
>  3 files changed, 81 insertions(+), 50 deletions(-)

[...]

> diff --git a/tools/testing/selftests/net/lib/xsk/test_xsk.h b/tools/testing/selftests/net/lib/xsk/test_xsk.h
> index 0717d855e4df..1d17e214db91 100644
> --- a/tools/testing/selftests/net/lib/xsk/test_xsk.h
> +++ b/tools/testing/selftests/net/lib/xsk/test_xsk.h
> @@ -144,11 +155,20 @@ struct ifobject {
>  	bool use_fill_ring;
>  	bool release_rx;
>  	bool use_metadata;
> -	bool unaligned_supp;
> -	bool multi_buff_supp;
> -	bool multi_buff_zc_supp;
> -	bool hw_ring_size_supp;
>  };
> +
> +static inline bool ifobj_has_cap(const struct ifobject *ifobj, u32 cap)
> +{
> +	return ifobj && (ifobj->caps.flags & cap);
> +}
> +
> +static inline void ifobj_set_cap(struct ifobject *ifobj, u32 cap)
> +{
> +	ifobj->caps.flags |= cap;
> +}
> +
> +#define xsk_get_cap(test, cap) ((test)->ifobj_tx->caps.cap)

nit, and iff respin: I'd leave the whole inlining out. Keep it simple.
Also, please functions instead of macros.

Reviewed-by: Björn Töpel <bjorn@kernel.org>
Technical Details
Message-ID: <87fqy774he.fsf@all.your.base.are.belong.to.us>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346606-linux-kernel-netdev=dewy.ru
References: <20261014184539.774708-1-maciej.fijalkowski@intel.com> <20261014184539.774708-8-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-346606-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v3 net-next 07/15] selftests: xsk: collect interface
 capabilities in struct xsk_caps
Date: Thu, 15 Oct 2026 10:27:57 +0200
Organization: Usenet Network
Message-ID: <87fqy774he.fsf@all.your.base.are.belong.to.us>
References: <20261014184539.774708-1-maciej.fijalkowski@intel.com>
 <20261014184539.774708-8-maciej.fijalkowski@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="2485015"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:HyNdfOk8fQ5boLGvxXY4ONzhxog= sha256:ilMg36/Yd7FFCY812cJIn4BptHy63NXeVJJWnfVF40U=
	sha1:W0PrzigKNC+0Y0y93qGAxhWp5yw= sha256:bPx0ZiCV03zptz7mfSrCk6+QgE+Vx1+L8hoJSLFfFnU=
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 EA49E11027F; Thu, 15 Oct 2026 11:35:41 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.64
X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, 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 4uLkRgx1yXkO;
	Thu, 15 Oct 2026 11:35:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-346606-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 11E1111027C; Thu, 15 Oct 2026 11:35:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 07A20347FB; Thu, 15 Oct 2026 08:28:06 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B06C4B8296;
	Thu, 15 Oct 2026 08:28:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vz92MHxZ"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(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 5F1A34BE45E;
	Thu, 15 Oct 2026 08:28:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792052883; cv=none; b=ouGyyrOU+dpIU1CwhoCvbojlSXVZ8YT81+F626l/lpysP4Pvbk9Qk3tKcdlNhgAe8nqESOY+oBb73TBai7oefnIwvJWi0DZoFp+NGxPMjBK1DzOtXXh7SMGETHHHjRj2+Btgy2LYHptFlVQBF+qiL++bzms5zVPagjpnbgRJCv0=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792052883; c=relaxed/simple;
	bh=pA5pdyFX1UxzMIQQlheJlHsNFDoU6iH8bBoP4vYaWkU=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
	 MIME-Version:Content-Type; b=SYGQjsRed27VT5nHPbPPx83OwzImRfXoqtyShkAWogqPWhJyDJqerpvPDdNcHMx+Sz9YlG4tPDiRJglafWNqVKN5UANMSpiU4UTPOAPeD72eqcR0e9e15KCimzdlW/YUM+ttWo9BRtV+CyOm6vDOM7u3lzDr9esq7iZMvzbK3rI=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vz92MHxZ; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 154961F000C4;
	Thu, 15 Oct 2026 08:27:59 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792052880;
	bh=PszMguYC+OPtDzMvLLBU4BgcfG4LyvpkBov/KvdqA54=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date;
	b=Vz92MHxZIsaqsU1Ts0o5Bi9ri0gOhxUkeK4wJKJTEI6uIu2C8Kb3SM7TNXByK2Y4W
	 uhiuFDiOqI43XjczT6qzePvZAQMabpcKsxrbifx+MGvsiZPJ+LSDpiq3IEGkdUjTcq
	 6pb/X3y/sOoc8Z/HD3zA1yFO5UU/nJTAN5IeXE1MURTf85Z6qZL+fFjcihZDdvXDI7
	 pO2c94YX1IuvfepCKNfap5YKis1xC0UyxFkX7k1Y092EqoJuZV3hp7BvEFLRKFH5KM
	 eNs6YH2JvmI5qkk7s2EyD4iu8lYtgBqmGDNprcXaqG2/JIgbQOJYl7/UB9MRI5beYU
	 beKt7p+t6rqgw==
X-Cc: bpf@vger.kernel.org, magnus.karlsson@intel.com, stfomichev@gmail.com,
 kuba@kernel.org, pabeni@redhat.com, tushar.vyavahare@intel.com,
 kerneljasonxing@gmail.com, Maciej Fijalkowski
 <maciej.fijalkowski@intel.com>
X-In-Reply-To: <20261014184539.774708-8-maciej.fijalkowski@intel.com>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>