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>
Subject: [PATCH 1/2] mempool: add rte_errno in rte_mempool_set_ops_byname
Date: Sun, 19 Jan 2025 18:46:42 +0100	[thread overview]
Message-ID: <20250119174643.2162110-2-ariel.otilibili@6wind.com> (raw)
In-Reply-To: <20250119174643.2162110-1-ariel.otilibili@6wind.com>

rte_errno is not set for error exits. For the scenario described in
BugZilla ID 1559, rte_mempool_create_empty() calls
rte_mempool_set_ops_byname(), but does not set as well the proper
rte_errno.

rte_errno is now set in rte_mempool_set_ops_byname(); from there it
cascades down to the calling function.

Bugzilla ID: 1559
Signed-off-by: Ariel Otilibili <ariel.otilibili@6wind.com>
---
 lib/mempool/rte_mempool_ops.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 1b33380259b3..b5c68ac61b67 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -169,8 +169,10 @@ rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name,
 	unsigned i;
 
 	/* too late, the mempool is already populated. */
-	if (mp->flags & RTE_MEMPOOL_F_POOL_CREATED)
-		return -EEXIST;
+	if (mp->flags & RTE_MEMPOOL_F_POOL_CREATED) {
+		rte_errno = EEXIST;
+		return -rte_errno;
+	}
 
 	for (i = 0; i < rte_mempool_ops_table.num_ops; i++) {
 		if (!strcmp(name,
@@ -180,8 +182,10 @@ rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name,
 		}
 	}
 
-	if (ops == NULL)
-		return -EINVAL;
+	if (ops == NULL) {
+		rte_errno = EINVAL;
+		return -rte_errno;
+	}
 
 	mp->ops_index = i;
 	mp->pool_config = pool_config;
-- 
2.30.2


  reply	other threads:[~2025-01-19 17:47 UTC|newest]

Thread overview: 4+ 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 ` Ariel Otilibili [this message]
2025-01-19 17:46 ` [PATCH 2/2] mempool: " Ariel Otilibili
2025-01-19 23:44   ` Konstantin Ananyev

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=20250119174643.2162110-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=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).