DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ariel Otilibili <ariel.otilibili@6wind.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, "Thomas Monjalon" <thomas@monjalon.net>,
	"David Marchand" <david.marchand@redhat.com>,
	"Ariel Otilibili" <ariel.otilibili@6wind.com>,
	"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Konstantin Ananyev" <konstantin.ananyev@huawei.com>
Subject: [PATCH v2 1/2] mempool: fix rte_errno in rte_mempool_create_empty
Date: Mon, 20 Jan 2025 13:21:55 +0100	[thread overview]
Message-ID: <20250120122156.2480524-2-ariel.otilibili@6wind.com> (raw)
In-Reply-To: <20250120122156.2480524-1-ariel.otilibili@6wind.com>

When returning from rte_mempool_set_ops_byname(), rte_errno is not set
for error exits.

The API requires rte_errno to be set in that case.

Bugzilla ID: 1559
Fixes: c2c6b2f41305 ("mempool: fix default ops for an empty mempool")
Link: https://doc.dpdk.org/api/rte__mempool_8h.html#a82e301ee33ed7a263ceb4582655dc3ea
Signed-off-by: Ariel Otilibili <ariel.otilibili@6wind.com>
---
 lib/mempool/rte_mempool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index d8e39e5c2072..1e4f24783c0b 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -928,8 +928,10 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
 	else
 		ret = rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL);
 
-	if (ret)
+	if (ret) {
+		rte_errno = -ret;
 		goto exit_unlock;
+	}
 
 	/*
 	 * local_cache pointer is set even if cache_size is zero.
-- 
2.30.2


  reply	other threads:[~2025-01-20 12:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-19 17:46 [PATCH 0/2] mempool: add rte_errno, and turn functions into single-exit ones Ariel Otilibili
2025-01-19 17:46 ` [PATCH 1/2] mempool: add rte_errno in rte_mempool_set_ops_byname Ariel Otilibili
2025-01-19 17:46 ` [PATCH 2/2] mempool: turn functions into single-exit ones Ariel Otilibili
2025-01-19 23:44   ` Konstantin Ananyev
2025-01-20 10:05     ` Ariel Otilibili
2025-01-20 12:21 ` [PATCH v2 0/2] add rte_errno to rte_mempool_create_empty, and refactor Ariel Otilibili
2025-01-20 12:21   ` Ariel Otilibili [this message]
2025-01-20 12:21   ` [PATCH v2 2/2] mempool: make rte_mempool_create_empty a single-exit Ariel Otilibili

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=20250120122156.2480524-2-ariel.otilibili@6wind.com \
    --to=ariel.otilibili@6wind.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@huawei.com \
    --cc=mb@smartsharesystems.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).