patch 'mempool: fix default ops for an empty mempool' has been queued to stable release 22.11.4

Xueming Li xuemingl at nvidia.com
Sun Oct 22 16:20:31 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/15/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=36c07ef565121a9f2b6650ff804ec21c4d507a52

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 36c07ef565121a9f2b6650ff804ec21c4d507a52 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Wed, 16 Aug 2023 16:34:29 +0100
Subject: [PATCH] mempool: fix default ops for an empty mempool
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit c2c6b2f413051b022488518d040508b9ea6e0130 ]

An empty mempool's ops were not initialised to a default value wrt to
what the application requested via the flags parameter.  As
rte_mempool_create() relies on rte_mempool_create_empty(), simply move
this ops initialisation to rte_mempool_create_empty().

Fixes: aa10457eb4c2 ("mempool: make mempool populate and free api public")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Reviewed-by: Bruce Richardson <bruce.richardson at intel.com>
Reviewed-by: Morten Brørup <mb at smartsharesystems.com>
---
 lib/mempool/rte_mempool.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 950d01ffac..3de857abf5 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -915,6 +915,22 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
 	STAILQ_INIT(&mp->elt_list);
 	STAILQ_INIT(&mp->mem_list);

+	/*
+	 * Since we have 4 combinations of the SP/SC/MP/MC examine the flags to
+	 * set the correct index into the table of ops structs.
+	 */
+	if ((flags & RTE_MEMPOOL_F_SP_PUT) && (flags & RTE_MEMPOOL_F_SC_GET))
+		ret = rte_mempool_set_ops_byname(mp, "ring_sp_sc", NULL);
+	else if (flags & RTE_MEMPOOL_F_SP_PUT)
+		ret = rte_mempool_set_ops_byname(mp, "ring_sp_mc", NULL);
+	else if (flags & RTE_MEMPOOL_F_SC_GET)
+		ret = rte_mempool_set_ops_byname(mp, "ring_mp_sc", NULL);
+	else
+		ret = rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL);
+
+	if (ret)
+		goto exit_unlock;
+
 	/*
 	 * local_cache pointer is set even if cache_size is zero.
 	 * The local_cache points to just past the elt_pa[] array.
@@ -955,7 +971,6 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
 	rte_mempool_obj_cb_t *obj_init, void *obj_init_arg,
 	int socket_id, unsigned flags)
 {
-	int ret;
 	struct rte_mempool *mp;

 	mp = rte_mempool_create_empty(name, n, elt_size, cache_size,
@@ -963,22 +978,6 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
 	if (mp == NULL)
 		return NULL;

-	/*
-	 * Since we have 4 combinations of the SP/SC/MP/MC examine the flags to
-	 * set the correct index into the table of ops structs.
-	 */
-	if ((flags & RTE_MEMPOOL_F_SP_PUT) && (flags & RTE_MEMPOOL_F_SC_GET))
-		ret = rte_mempool_set_ops_byname(mp, "ring_sp_sc", NULL);
-	else if (flags & RTE_MEMPOOL_F_SP_PUT)
-		ret = rte_mempool_set_ops_byname(mp, "ring_sp_mc", NULL);
-	else if (flags & RTE_MEMPOOL_F_SC_GET)
-		ret = rte_mempool_set_ops_byname(mp, "ring_mp_sc", NULL);
-	else
-		ret = rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL);
-
-	if (ret)
-		goto fail;
-
 	/* call the mempool priv initializer */
 	if (mp_init)
 		mp_init(mp, mp_init_arg);
--
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-10-22 22:17:34.556367800 +0800
+++ 0002-mempool-fix-default-ops-for-an-empty-mempool.patch	2023-10-22 22:17:34.126723700 +0800
@@ -1 +1 @@
-From c2c6b2f413051b022488518d040508b9ea6e0130 Mon Sep 17 00:00:00 2001
+From 36c07ef565121a9f2b6650ff804ec21c4d507a52 Mon Sep 17 00:00:00 2001
@@ -7,0 +8,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit c2c6b2f413051b022488518d040508b9ea6e0130 ]
@@ -15 +17,0 @@
-Cc: stable at dpdk.org
@@ -25 +27 @@
-index 4d337fca8d..7a7a9bf6db 100644
+index 950d01ffac..3de857abf5 100644
@@ -28 +30 @@
-@@ -914,6 +914,22 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
+@@ -915,6 +915,22 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
@@ -51 +53 @@
-@@ -954,7 +970,6 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
+@@ -955,7 +971,6 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
@@ -59 +61 @@
-@@ -962,22 +977,6 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,
+@@ -963,22 +978,6 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,


More information about the stable mailing list