From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
stable@dpdk.org, Maayan Kashani <mkashani@nvidia.com>,
Aman Singh <aman.deep.singh@intel.com>
Subject: [PATCH 1/4] app/testpmd: fix port socket ID with NUMA disabled
Date: Thu, 2 Jul 2026 09:10:11 -0700 [thread overview]
Message-ID: <20260702161244.363233-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20260702161244.363233-1-stephen@networkplumber.org>
When NUMA support is disabled, mbuf pools are created on
SOCKET_ID_ANY but port->socket_id is still set to 0 (or
--socket-num). Pool lookup is by name, and the name embeds the
socket id the pool was created with, so every lookup that does not
go through the one workaround in start_port() misses:
- the per-lcore pool assignment in init_config() leaves
fwd_lcores[]->mbp NULL, so "testpmd --no-numa
--forward-mode=txonly" crashes with a NULL dereference in
pkt_burst_transmit();
- the per-segment and multi-mempool lookups in rx_queue_setup()
fall back to the first pool, so buffer split fails when a later
segment needs a larger mbuf
(e.g. --mbuf-size=314,978 --rxpkts=186,978);
- the interactive "port <id> rxq|txq <id> setup" command cannot
find a pool.
The --socket-num option is also ignored for pool allocation since
the offending commit.
Fix this at the source instead of adding another workaround at a
lookup site: make port->socket_id hold the same socket id the
pools are created and named with. Add uma_socket_id() returning
the pool socket key used when NUMA support is disabled
(--socket-num if given, otherwise SOCKET_ID_ANY) and use it for
pool creation, port->socket_id and the per-lcore pool fallback.
The workaround in start_port() is then unnecessary.
Passing SOCKET_ID_ANY to rte_eth_rx/tx_queue_setup() is allowed by
the ethdev API and matches the cross-NUMA intent of the offending
commit.
Fixes: 835fd4893a31 ("app/testpmd: support cross-NUMA allocations")
Cc: stable@dpdk.org
Reported-by: Maayan Kashani <mkashani@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test-pmd/testpmd.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index fcd8a90967..b5dca03047 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1729,6 +1729,17 @@ init_config_port_offloads(portid_t pid, uint32_t socket_id)
}
}
+/*
+ * Socket id that mbuf pools are created (and named) with when NUMA
+ * support is disabled: --socket-num if given, otherwise SOCKET_ID_ANY.
+ */
+static unsigned int
+uma_socket_id(void)
+{
+ return socket_num == UMA_NO_CONFIG ?
+ (unsigned int)SOCKET_ID_ANY : socket_num;
+}
+
static void
init_config(void)
{
@@ -1778,8 +1789,7 @@ init_config(void)
socket_id = socket_ids[0];
}
} else {
- socket_id = (socket_num == UMA_NO_CONFIG) ?
- 0 : socket_num;
+ socket_id = uma_socket_id();
}
/* Apply default TxRx configuration for all ports */
init_config_port_offloads(pid, socket_id);
@@ -1823,7 +1833,7 @@ init_config(void)
mempools[i] = mbuf_pool_create
(mbuf_data_size[i],
nb_mbuf_per_pool,
- SOCKET_ID_ANY, i);
+ uma_socket_id(), i);
}
}
@@ -1841,7 +1851,8 @@ init_config(void)
rte_lcore_to_socket_id(fwd_lcores_cpuids[lc_id]));
if (mbp == NULL)
- mbp = mbuf_pool_find_first(0);
+ mbp = mbuf_pool_find_first(numa_support ?
+ 0 : uma_socket_id());
fwd_lcores[lc_id]->mbp = mbp;
#ifdef RTE_LIB_GSO
/* initialize GSO context */
@@ -1920,10 +1931,7 @@ init_fwd_streams(void)
}
}
else {
- if (socket_num == UMA_NO_CONFIG)
- port->socket_id = 0;
- else
- port->socket_id = socket_num;
+ port->socket_id = uma_socket_id();
}
}
@@ -3153,8 +3161,7 @@ start_port(portid_t pid)
} else {
struct rte_mempool *mp =
mbuf_pool_find_first
- ((numa_support ? port->socket_id :
- (unsigned int)SOCKET_ID_ANY));
+ (port->socket_id);
if (mp == NULL) {
fprintf(stderr,
"Failed to setup RX queue: No mempool allocation on the socket %d\n",
--
2.53.0
next prev parent reply other threads:[~2026-07-02 16:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 13:07 [PATCH] app/testpmd: fix multi-pool Rx setup with --no-NUMA Maayan Kashani
2026-07-02 16:10 ` [PATCH 0/4] app/testpmd: fix socket id handling with NUMA disabled Stephen Hemminger
2026-07-02 16:10 ` Stephen Hemminger [this message]
2026-07-02 16:10 ` [PATCH 2/4] app/testpmd: consolidate port socket ID computation Stephen Hemminger
2026-07-02 16:10 ` [PATCH 3/4] app/testpmd: display any socket ID as text Stephen Hemminger
2026-07-02 16:10 ` [PATCH 4/4] app/testpmd: report reason when queue setup command fails Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260702161244.363233-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=mkashani@nvidia.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.