Article View: linux.kernel.netdev
Article #19252[PATCH v5 net-next 02/13] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE
From: Maciej Fijalkowski
Date: Thu, 19 Nov 2026 16:46
Date: Thu, 19 Nov 2026 16:46
75 lines
12714 bytes
12714 bytes
HW_SW_MAX_RING_SIZE gives the RX UMEM 8k frames and 8k rings, then
sends batches of 2k and of the maximum HW TX ring size minus 8. This
only works in the single-interface mode, where the TX socket uses the
RX UMEM, and veth, which cannot change its ring sizes, skips the case.
With two interfaces, TX has its own UMEM of DEFAULT_UMEM_BUFFERS (1k)
frames and 2k rings: the in-flight limit in __send_pkts() turns
negative for a 2k batch, so TX never sends and RX times out, and the
second batch would not fit in the TX ring anyway.
The next patch removes the single-interface mode, so size the TX UMEM
like the RX one. The shared UMEM setup copies the RX UMEM over the TX
one and is not affected.
With a HW TX ring of more than 8200 descriptors, the second batch would
also outgrow the 8k XSK TX ring, and __send_pkts() would spin forever
waiting to reserve it, so cap the batch below the XSK ring size.
A HW TX ring of 8 descriptors or fewer would leave that batch empty
or underflow it, so skip the case on such a ring.
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
.../testing/selftests/net/lib/xsk/test_xsk.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/lib/xsk/test_xsk.c b/tools/testing/selftests/net/lib/xsk/test_xsk.c
index 74eea4a4dfeb..0b2aa6919d72 100644
--- a/tools/testing/selftests/net/lib/xsk/test_xsk.c
+++ b/tools/testing/selftests/net/lib/xsk/test_xsk.c
@@ -2504,8 +2504,16 @@ int testapp_hw_sw_min_ring_size(struct test_spec *test)
int testapp_hw_sw_max_ring_size(struct test_spec *test)
{
u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 4;
+ u32 batch_size;
int ret;
+ /* The second step sends batches of tx_max_pending - 8 descriptors. */
+ if (test->ifobj_tx->hw_ring_size_supp &&
+ test->ifobj_tx->ring.tx_max_pending <= 8) {
+ ksft_print_msg("HW TX ring too small.\n");
+ return TEST_SKIP;
+ }
+
test->set_ring = true;
test->total_steps = 2;
test->ifobj_tx->ring.tx_pending = test->ifobj_tx->ring.tx_max_pending;
@@ -2513,6 +2521,9 @@ int testapp_hw_sw_max_ring_size(struct test_spec *test)
test->ifobj_rx->xsk->umem->num_frames = max_descs;
test->ifobj_rx->xsk->umem->fill_size = max_descs;
test->ifobj_rx->xsk->umem->comp_size = max_descs;
+ test->ifobj_tx->xsk->umem->num_frames = max_descs;
+ test->ifobj_tx->xsk->umem->fill_size = max_descs;
+ test->ifobj_tx->xsk->umem->comp_size = max_descs;
test->ifobj_tx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
test->ifobj_rx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
@@ -2521,10 +2532,12 @@ int testapp_hw_sw_max_ring_size(struct test_spec *test)
return ret;
/* Set batch_size to 8152 for testing, as the ice HW ignores the 3 lowest bits when
- * updating the Rx HW tail register.
+ * updating the Rx HW tail register. __send_pkts() waits until a whole batch fits
+ * in the XSK TX ring, so keep it below that ring's size on NICs with larger rings.
*/
- test->ifobj_tx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending - 8;
- test->ifobj_rx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending - 8;
+ batch_size = min(test->ifobj_tx->ring.tx_max_pending, max_descs) - 8;
+ test->ifobj_tx->xsk->batch_size = batch_size;
+ test->ifobj_rx->xsk->batch_size = batch_size;
if (pkt_stream_replace(test, max_descs, MIN_PKT_SIZE)) {
clean_sockets(test, test->ifobj_tx);
clean_sockets(test, test->ifobj_rx);
--
2.43.0
Technical Details
Message-ID:
<20261119164636.1071385-3-maciej.fijalkowski@intel.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367153-linux-kernel-netdev=dewy.ruReferences:
<20261119164636.1071385-1-maciej.fijalkowski@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367153-linux-kernel-netdev=dewy.ru From: maciej.fijalkowski@intel.com (Maciej Fijalkowski) Newsgroups: linux.kernel.netdev Subject: [PATCH v5 net-next 02/13] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE Date: Thu, 19 Nov 2026 17:46:25 +0100 Organization: Usenet Network Message-ID: <20261119164636.1071385-3-maciej.fijalkowski@intel.com> References: <20261119164636.1071385-1-maciej.fijalkowski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2930190"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:aA6H9x4ROg5TPwxnXBWG62oh/aY= sha256:qertHCWV2CDMHzAVgRa0OaevuxmUeD1IiDBT4RZtYy4= sha1:BwGuMJ5TWynf5BAfQiZnkZNVsYc= sha256:TBFZZrsDPx9W1Z+/Ed06wFkoZV+Pkje/Wbns3dCqvYA= 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 10C961156EC; Thu, 19 Nov 2026 19:47:15 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 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, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com 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 wiO-luoMPMGW; Thu, 19 Nov 2026 19:47:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367153-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=intel.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 859D11156E2; Thu, 19 Nov 2026 19:47:03 +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 1199B2619B3; Thu, 19 Nov 2026 16:46:58 +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=1795106809; b=Yp7/B8VhFJ3ZP7+49y+N0MPX9S4Gm+g34QVFAgfZm1TCrh4a70K1DDUL7KQiAMJartYE RW/wgmDhW4zVaUp4zkwV8oy9BKRgU+GyJ4LBunGOvqigg1cqlu3dG2OLDKHEeEmGIUbSq DmBXVAo9/dp3K9HLBRJ77c1BUTHiuKVealpiIl2FRuyo9PEjBCLHILK2cu6oWWvTV7trx Fd+altHlM7TAavrQwTRB5WuMFRzYF9QddoQNuo9oYFICVMwq73MykLWEoocR9P+8c+Yft u/X7zNS9Pz9JXwQ/5I8FpWcLn9BhQyh6FLIRvoS0Z2oAjE+r7WxPvUkGBeCJmH6FLzg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795106809; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature: X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-IronPort-AV:X-IronPort-AV: Received:X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV: Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer: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=v5I0JfCt+2h9iMujFxbhWPUqraa/Wr+tvCoGhxYu0v0=; b=m31KanxEknziIr/Oi/e5YyyjgKY/OfEPrJXWAQTskFNhpNgxpV8OLT8VNNpbMryt2MVP usCdzeCYicTr03sfm9QM3wAPrtNqc16u258P0Nw5CNUU9oeXgcmQRIY2MgwQXfzjyp+bf gkf5e7OHuodO16L3FiAnzUpQai6HiEcOzdop6iZvmY3qkuLAPlN18l28xGncPLaNbwBlI +V9qcqlVLbP+GFpp7YrsMCIlTE1Ozdy7NoCN13cf/c3+77ump4hgf4RRZqfDkqWlT8lHZ hTdJDGdVhsJmb6iS3Knk6NDR7etpFjgTXxrHCOm5NfiSzamO6L8Cg0K4Eallh+nvL2Q== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JjKuQNIu; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; 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 C053E60A262B; Thu, 19 Nov 2026 16:46:49 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JjKuQNIu X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.16 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795106808; b=Q9PtRn61mjLXLrL60owvWsJ4Qvma/NPoSnRk9yVWRhEw1985FLqu3VFrI3ePqCIqq3rO YdsaB5Hx+BzlWQCQcH2bwdPICG9Gonxrkf7+fFrou+El4YPAI+GHmyfYf283r7nWErv/R /qG3ka0dBtcHXNxOmtHyXRHANT8MUOEvMMTbJc9iu2Y2RRRXgRoeMWFqzmBh/3SoDDnZa ETWLLPrRulsjjbympb8e7uq3Wrjfcn+llqT1QBE29nqMiZU/exJaIV8D7Tu3GXArQjbtc 0qK2y+aoTWvhyGZ00wCzvNOXcMVH0gKlqebW4IGaGH0uTfvjjwGxCbpLhPVhGKvSwaw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795106808; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=v5I0JfCt+2h9iMujFxbhWPUqraa/Wr+tvCoGhxYu0v0=; b=EG6ECmS1TxDnH2xgJiYim91sknvpGTEFQA/Z6H/bIB1e6po4y+DMXzQrFX69sx+hnCO1 GnZunsdJ0vJ2zYq42YC7BpKmS7ZNWkMLcFrTYbzZLhc2PsQ7VGfNNFkcMqxcGOIXBJqiX 1+IgWBeCK56SqYhp/HsOSVAAQ+KP0+I6P1HQ2qwgbZbtVelSSsu4qdUBhE41L+GFkPtXS Thtr1TXu4XN/heXo4+0NfEdeUwEr3y5WKah1GPmeo2oycmwgqBUcYXVs1xtpwweab7krG dSGE9waRI1RabyLHGoVeEBB7r6WLwdwZFIPAjT6tzlyc//LOH+3Dd48UbX5FRjcHW6Q== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JjKuQNIu; arc=none smtp.remote-ip=192.198.163.16 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12BC260A2604 for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 16:46:48 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 12BC260A2604 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1795106808; x=1826642808; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8XrJwvw7Vvxo2l7cIxqqcHVaiwoQNNCv1TSe5+vPFA8=; b=JjKuQNIuq2yVEgHevaLGvZmHYh/XV/IcTXZmsZywagXXR/LfjZRUrkVF k6fVG+cjj3YQiSBl9IFtZZIH5XtV3+D09Jj3Tv7XACWKiLDkH03wXoU6U hwlAcHyC7kKtRCCa0hhgqJ9EkwBAjGcbjeBbvUyQl3UwFMIn1CyRlV8w2 CCFY82cG9+uH4CThkt8ZOgBVaBy5mE9cd/kUg8GRnGzzsO6asdueJJH8A lbWkOP+haW0jYBeQui6W9limKF/WcrZUGhHXTgv3z4ruuhbxNFJVtETc9 h6hSJAiCdYw8fcgIkJ9qffcoWvPII2k0J/78V6/zkYHL9wnEBBU+U6Syd Q==; X-CSE-ConnectionGUID: ldTTkU7/Sm2ldg4p/JfLTw== X-CSE-MsgGUID: 4vNJV2+PR/CjFFPlypCGhg== X-IronPort-AV: E=McAfee;i="6800,10657,11971"; a="3991078" X-IronPort-AV: E=Sophos;i="6.27,221,1787036400"; d="scan'208";a="3991078" X-Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2026 08:46:48 -0800 X-CSE-ConnectionGUID: Wh653/HwTwyA/xk1qQpAZQ== X-CSE-MsgGUID: WhcSu+HoRv6CPgGxKIS3dQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,221,1787036400"; d="scan'208";a="10843340" X-Received: from boxer.igk.intel.com ([10.102.20.173]) by fmviesa007.fm.intel.com with ESMTP; 19 Nov 2026 08:46:46 -0800 X-Cc: magnus.karlsson@intel.com, stfomichev@gmail.com, kuba@kernel.org, pabeni@redhat.com, tushar.vyavahare@intel.com, kerneljasonxing@gmail.com, bjorn@kernel.org, Maciej Fijalkowski <maciej.fijalkowski@intel.com> X-Mailer: git-send-email 2.38.1 X-In-Reply-To: <20261119164636.1071385-1-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