From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98947606A322 for ; Sat, 5 Dec 2026 06:27:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=J9EGLvWv Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 815DF40E41; Sat, 5 Dec 2026 07:26:05 +0100 (CET) Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by mails.dpdk.org (Postfix) with ESMTPS id EA01E40E1F for ; Sat, 5 Dec 2026 07:26:01 +0100 (CET) Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-8dff56e9033so48740b3a.0 for ; Fri, 04 Dec 2026 22:26:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796451960; x=1797056760; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=a3o5Dlb0ggM9ElV6xlBTia7r2EgQEuZF/M05vaDYGfw=; b=J9EGLvWvzMXW2ftFIYCy8m1JtnjZk5eSVAxubf55VmKMn/bAV0/o02fdDimD9/V0YE Uh3ZxaZBiplMCGnEZbJO8KhC1keE4GkWfYlo6VVUcql2r3T3bWdK4c4HZaG6YMD9Gxoe NKvq0K59u22YptrOKzTj0yE7bU+AOC2NutodESQmgtMFd8BniAtBzzBhXE2RLQDnMMZJ qxerX4AiPKT3I2TU8h73ihx8TQbuSosiL0qGYNv5P44jK03i7BR85C/j1HfVdaMGsnn5 VSzPZCshuC6wPML7iNCeDuNmJcONdPzjAtUZB0IJ6aMqS2KMsU+W3ayN5Ah3tniHExgt kKFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796451960; x=1797056760; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=a3o5Dlb0ggM9ElV6xlBTia7r2EgQEuZF/M05vaDYGfw=; b=R3uKEzAeQj7rzKxLrDCWJLkpHSB/vD3HK+z9P3A8fQr6jqsTOczpW6/DCmzmLIm7BY M7Qe2IACu3tmWSYC3J8a5cpJ4Md2kXzjdagLirysqe9DCPN3/vL/1x7vb2fKwDgdAQbt yzhrJe0AIO6BTsdibTJr7gYEK8W0dFSZZwkUthhaU47o3xHxGYbSK5zOYJzGlY/+sTqk DmhH7P9XZM1eIrib3jxTFH2Hs5kmGLC1we7/AmvRDujP0trUBSOhzfwdqgAcg7fKvMVw NF/CWjIfQWM5Q9KEDk7CLCl9oltBADrXhP2TzEUSUFvHWdF7aWBeJwwdB23zbcz7tIad NXFw== X-Gm-Message-State: AB4q+uEPan21X3/BZYfyVqwi23rni1QqgZQdAz5zJlZRZHBBV/lD/4y1 nXwyyiV4TsoFCqZsEguKLX+iMb8KbaQ0qH0yW+n02sB1pobp20/6ARFjS6MK/LE+inWRNh/Gt/7 OxtKKKAM= X-Gm-Gg: AZFdTZe/ila67yhGR5SMf/G0FFZoL4aQNQ6eDFANe28MIRSy0whszqNzcc3Y9sxwBlE Hjuy60Ekz1ykwCu0BksC4hDCep0eDU+397i+pzYU3wP70qlxKg5Aa9g2MSlfiBT1+zhfMZldYj6 hLuO+redF7XaxNsH5w0uawzEOeGT12M+BAjvoEvQP+x3hBLIiVBBEWivFwJMaCJTt9HRM/VI8iv 9kjS8JL/GguekAIRc9AJ8M/Jrs6eXPAn6x4JTwsZu3EWRQHY8788XbpsqNwLds/xjMxcQ3awuM8 AOeDgSi6nQqti9z1YHj+07bsM9CKCLTa30OerhfsXuoboxbD3QPd60unRiCDzdYq3uBK3I1akbu y/AV3PBiub84zn5GrFcU5qasFxTQbjVvZ7AXznDar+9adgZVuSB8ccThd41Ej9V5WexpP72a5a/ r6Yw1HPZcx05M/G7Lj4a3Haan+V6snuRcNbtrUDcgX7id17DpDbDP6NyKUUxIQpzU7fLJmEW+cA s3vQpZnTMHjr4UGXOaASUzh2AhPco+Xv2jk+AZZNb7uUuKYVNNw9cTHipfE5JwXgd2YbT2/TMKh 2+xLRwn1d2JZIInuSNqLTWK6y0fo6S8U4JZVtTY7sR2P5xg5AloB34b4YAdw6sxxY9Cs X-Received: by 2002:a17:90b:5287:b0:3b5:32db:11c with SMTP id 98e67ed59e1d1-3b5e0692b4fmr3692131a91.12.1796451960321; Fri, 04 Dec 2026 22:26:00 -0800 (PST) Received: from phoenix.lan (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b6168d3e2fsm1162797a91.2.2026.12.04.22.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 22:26:00 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson Subject: [PATCH v4 08/68] net/ring: make NUMA node signed Date: Fri, 4 Dec 2026 22:19:45 -0800 Message-ID: <20261205062551.19553-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261205062551.19553-1-stephen@networkplumber.org> References: <20260914054912.755403-1-stephen@networkplumber.org> <20261205062551.19553-1-stephen@networkplumber.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 rte_eth_from_rings() takes a numa node (socket) but used unsigned where int should have been used to allow for SOCKET_ID_ANY. The only usage is in call rte_malloc routines with socket and those functions expect int. Change the parameter to int socket_id and carry that through the two internal create functions. The devargs path keeps working as before: "nodeaction=name:-1:CREATE" was already accepted, since strtol() returned -1 into an unsigned int which became SOCKET_ID_ANY again at the allocation. Signed-off-by: Stephen Hemminger --- doc/guides/rel_notes/release_27_03.rst | 4 +++ drivers/net/ring/rte_eth_ring.c | 38 +++++++++++++------------- drivers/net/ring/rte_eth_ring.h | 11 ++++---- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/doc/guides/rel_notes/release_27_03.rst b/doc/guides/rel_notes/release_27_03.rst index a91813faca..36101f52d6 100644 --- a/doc/guides/rel_notes/release_27_03.rst +++ b/doc/guides/rel_notes/release_27_03.rst @@ -84,6 +84,10 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= +* net/ring: the last parameter of ``rte_eth_from_rings()`` changed from + ``const unsigned numa_node`` to ``int socket_id``, so that + ``SOCKET_ID_ANY`` can be passed. + ABI Changes ----------- diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index d75ae2cbed..4204e1d661 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -32,7 +32,7 @@ struct ring_internal_args { const unsigned int nb_rx_queues; struct rte_ring * const *tx_queues; const unsigned int nb_tx_queues; - const unsigned int numa_node; + int socket_id; }; /* rte_eth_from_rings() stashes a pointer to its on-stack args here */ @@ -361,7 +361,7 @@ do_eth_dev_ring_create(const char *name, const unsigned int nb_rx_queues, struct rte_ring *const tx_queues[], const unsigned int nb_tx_queues, - const unsigned int numa_node, enum dev_action action, + int socket_id, enum dev_action action, struct rte_eth_dev **eth_dev_p) { struct rte_eth_dev_data *data = NULL; @@ -371,24 +371,24 @@ do_eth_dev_ring_create(const char *name, void **tx_queues_local = NULL; unsigned int i; - PMD_LOG(INFO, "Creating rings-backed ethdev on numa socket %u", - numa_node); + PMD_LOG(INFO, "Creating rings-backed ethdev on numa socket %d", + socket_id); rx_queues_local = rte_calloc_socket(name, nb_rx_queues, - sizeof(void *), 0, numa_node); + sizeof(void *), 0, socket_id); if (rx_queues_local == NULL) { rte_errno = ENOMEM; goto error; } tx_queues_local = rte_calloc_socket(name, nb_tx_queues, - sizeof(void *), 0, numa_node); + sizeof(void *), 0, socket_id); if (tx_queues_local == NULL) { rte_errno = ENOMEM; goto error; } - internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node); + internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id); if (internals == NULL) { rte_errno = ENOMEM; goto error; @@ -404,7 +404,7 @@ do_eth_dev_ring_create(const char *name, /* now put it all together * - store EAL device in eth_dev, * - store queue data in internals, - * - store numa_node info in eth_dev_data + * - store socket id info in eth_dev_data * - point eth_dev_data to internals * - and point eth_dev structure to new eth_dev_data structure */ @@ -439,7 +439,7 @@ do_eth_dev_ring_create(const char *name, data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; eth_dev->dev_ops = &ops; - data->numa_node = numa_node; + data->numa_node = socket_id; /* finally assign rx and tx ops */ eth_dev->rx_pkt_burst = eth_ring_rx; @@ -464,14 +464,14 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], const unsigned int nb_rx_queues, struct rte_ring *const tx_queues[], const unsigned int nb_tx_queues, - const unsigned int numa_node) + int socket_id) { struct ring_internal_args args = { .rx_queues = rx_queues, .nb_rx_queues = nb_rx_queues, .tx_queues = tx_queues, .nb_tx_queues = nb_tx_queues, - .numa_node = numa_node, + .socket_id = socket_id, }; char ring_name[RTE_RING_NAMESIZE]; uint16_t port_id = RTE_MAX_ETHPORTS; @@ -526,7 +526,7 @@ rte_eth_from_ring(struct rte_ring *r) static int eth_dev_ring_create(const char *name, struct rte_vdev_device *vdev, - const unsigned int numa_node, + int socket_id, enum dev_action action, struct rte_eth_dev **eth_dev) { /* rx and tx are so-called from point of view of first port. @@ -549,7 +549,7 @@ eth_dev_ring_create(const char *name, } rxtx[i] = (action == DEV_CREATE) ? - rte_ring_create(rng_name, 1024, numa_node, + rte_ring_create(rng_name, 1024, socket_id, RING_F_SP_ENQ|RING_F_SC_DEQ) : rte_ring_lookup(rng_name); if (rxtx[i] == NULL) @@ -557,7 +557,7 @@ eth_dev_ring_create(const char *name, } if (do_eth_dev_ring_create(name, vdev, rxtx, num_rings, rxtx, num_rings, - numa_node, action, eth_dev) < 0) + socket_id, action, eth_dev) < 0) return -1; return 0; @@ -565,7 +565,7 @@ eth_dev_ring_create(const char *name, struct node_action_pair { char name[ETH_RING_ACTION_MAX_LEN]; - unsigned int node; + int socket_id; enum dev_action action; }; @@ -626,7 +626,7 @@ static int parse_kvlist(const char *key __rte_unused, goto out; errno = 0; - info->list[info->count].node = strtol(node, &end, 10); + info->list[info->count].socket_id = strtol(node, &end, 10); if ((errno != 0) || (*end != '\0')) { PMD_LOG(WARNING, @@ -686,7 +686,7 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev) internal_args->nb_rx_queues, internal_args->tx_queues, internal_args->nb_tx_queues, - internal_args->numa_node, + internal_args->socket_id, DEV_ATTACH, ð_dev); return ret >= 0 ? 0 : ret; @@ -740,7 +740,7 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev) for (info->count = 0; info->count < info->total; info->count++) { ret = eth_dev_ring_create(info->list[info->count].name, dev, - info->list[info->count].node, + info->list[info->count].socket_id, info->list[info->count].action, ð_dev); if (ret == -1 && info->list[info->count].action == DEV_CREATE) { @@ -748,7 +748,7 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev) "Attach to pmd_ring for %s", name); ret = eth_dev_ring_create(name, dev, - info->list[info->count].node, + info->list[info->count].socket_id, DEV_ATTACH, ð_dev); } diff --git a/drivers/net/ring/rte_eth_ring.h b/drivers/net/ring/rte_eth_ring.h index 98292c7b33..dfbfce9f2f 100644 --- a/drivers/net/ring/rte_eth_ring.h +++ b/drivers/net/ring/rte_eth_ring.h @@ -24,17 +24,18 @@ extern "C" { * pointer to array of rte_rings to be used as TX queues * @param nb_tx_queues * number of elements in the tx_queues array - * @param numa_node - * the numa node on which the memory for this port is to be allocated + * @param socket_id + * the NUMA socket on which the memory for this port is to be allocated, + * or SOCKET_ID_ANY * @return * the port number of the newly created the ethdev or -1 on error. */ int rte_eth_from_rings(const char *name, struct rte_ring * const rx_queues[], - const unsigned nb_rx_queues, + const unsigned int nb_rx_queues, struct rte_ring *const tx_queues[], - const unsigned nb_tx_queues, - const unsigned numa_node); + const unsigned int nb_tx_queues, + int socket_id); /** * Create a new ethdev port from a ring -- 2.53.0