Skip to contentSkip to conversation

eal: increase memzone name size to 64

PATCH In review Stephen Hemminger 6 participants 18 messages Sep 21 – Oct 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: increase memzone name size to 64

Memzone names are limited to 31 characters, and ring, mempool and stack names lose the length of their prefixes on top of that. A mempool name is limited to 25 characters, which leaves little room for libraries such as rib and fib that derive names from the name given by the application.

Increase RTE_MEMZONE_NAMESIZE to 64. The derived ring, mempool, stack and RCU defer queue sizes follow.

Move name out of the first cache line of struct rte_ring and struct rte_mempool so the larger name does not push datapath fields into another cache line. For mempool this also brings local_cache, cache_size and ops_index into the first cache line, where previously they were in the second. struct rte_mempool stays 192 bytes; struct rte_ring grows by one cache line.

---
 doc/guides/rel_notes/release_26_11.rst | 19 +++++++++++++++++++
 lib/eal/include/rte_memzone.h          |  2 +-
 lib/mempool/rte_mempool.h              |  8 ++++----
 lib/ring/rte_ring_core.h               |  5 ++---
 4 files changed, 26 insertions(+), 8 deletions(-)
doc/guides/rel_notes/release_26_11.rst +19 -0
index 4b3e5d995c..380aecb5a7 100644
@@ -139,6 +139,25 @@ ABI Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* **Increased memzone maximum name size.**
+
+  ``RTE_MEMZONE_NAMESIZE`` was increased from 32 to 64,
+  and the derived ``RTE_RING_NAMESIZE``, ``RTE_MEMPOOL_NAMESIZE``,
+  ``RTE_STACK_NAMESIZE`` and ``RTE_RCU_QSBR_DQ_NAMESIZE`` grew accordingly.
+  This impacts the following structures:
+
+  * ``struct rte_memzone`` grew by 32 bytes.
+
+  * ``struct rte_ring`` grew by one cache line,
+    and ``name`` was moved after the size fields
+    to keep the datapath fields in the first cache line.
+
+  * ``struct rte_mempool`` is unchanged in size,
+    but ``name``, ``pool_config`` and ``mz`` were moved
+    after the fields used in the datapath.
+
+  * ``struct rte_stack`` grew by one cache line.
+
 
 Known Issues
 ------------
lib/eal/include/rte_memzone.h +1 -1
index 5a0e1b8a15..d5c92fe0ec 100644
@@ -47,7 +47,7 @@ extern "C" {
  */
 struct __rte_packed_begin rte_memzone {
 
-#define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
+#define RTE_MEMZONE_NAMESIZE 64       /**< Maximum length of memory zone name.*/
 	char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
 
 	rte_iova_t iova;                  /**< Start IO address. */
lib/mempool/rte_mempool.h +4 -4
index 50d958c7c6..d2ae56e49f 100644
@@ -230,13 +230,11 @@ struct __rte_cache_aligned rte_mempool_info {
  * The RTE mempool structure.
  */
 struct __rte_cache_aligned rte_mempool {
-	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 	union {
 		void *pool_data;         /**< Ring or pool to store objects. */
 		uint64_t pool_id;        /**< External mempool identifier. */
 	};
-	void *pool_config;               /**< optional args for ops alloc. */
-	const struct rte_memzone *mz;    /**< Memzone where pool is alloc'd. */
+	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache */
 	unsigned int flags;              /**< Flags of the mempool. */
 	int socket_id;                   /**< Socket id passed at create. */
 	uint32_t size;                   /**< Max size of the mempool. */
@@ -257,7 +255,9 @@ struct __rte_cache_aligned rte_mempool {
 	 */
 	int32_t ops_index;
 
-	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache */
+	void *pool_config;               /**< optional args for ops alloc. */
+	const struct rte_memzone *mz;    /**< Memzone where pool is alloc'd. */
+	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 
 	uint32_t populated_size;         /**< Number of populated objects. */
 	struct rte_mempool_objhdr_list elt_list; /**< List of objects in pool */
lib/ring/rte_ring_core.h +2 -3
index 6cd6ce9884..4359ca8006 100644
@@ -114,14 +114,13 @@ struct rte_ring_hts_headtail {
  * a problem.
  */
 struct rte_ring {
-	alignas(RTE_CACHE_LINE_SIZE) char name[RTE_RING_NAMESIZE];
-	/**< Name of the ring. */
-	int flags;               /**< Flags supplied at creation. */
+	alignas(RTE_CACHE_LINE_SIZE) int flags; /**< Flags supplied at creation. */
 	const struct rte_memzone *memzone;
 			/**< Memzone, if any, containing the rte_ring */
 	uint32_t size;           /**< Size of ring. */
 	uint32_t mask;           /**< Mask (size-1) of ring. */
 	uint32_t capacity;       /**< Usable size of ring */
+	char name[RTE_RING_NAMESIZE]; /**< Name of the ring. */
 
 	RTE_CACHE_GUARD;
 
Signature · 1 line
2.53.0
#1 lore raw
Quoted 12 lines

From: Stephen Hemminger [mailto:[email protected]]
Sent: Monday, 21 September 2026 23.57

Memzone names are limited to 31 characters, and ring, mempool and stack names lose the length of their prefixes on top of that. A mempool name is limited to 25 characters, which leaves little room for libraries such as rib and fib that derive names from the name given by the application.

Increase RTE_MEMZONE_NAMESIZE to 64. The derived ring, mempool, stack and RCU defer queue sizes follow.

Quoted 8 lines

Move name out of the first cache line of struct rte_ring and struct rte_mempool so the larger name does not push datapath fields into another cache line. For mempool this also brings local_cache, cache_size and ops_index into the first cache line, where previously they were in the second. struct rte_mempool stays 192 bytes; struct rte_ring grows by one cache line.

The name length limits are there for practical reasons only; they are not there to impose restrictions on names. And with the prefixes being stacked in front of the names, the current 31 character limit is too small.

This is a good improvement.
Not a qualifying as a "bugfix", but absolutely lifting a silly restriction.

A few improvements (read: feature creep) suggested inline below.

Quoted 94 lines
---
 doc/guides/rel_notes/release_26_11.rst | 19 +++++++++++++++++++
 lib/eal/include/rte_memzone.h          |  2 +-
 lib/mempool/rte_mempool.h              |  8 ++++----
 lib/ring/rte_ring_core.h               |  5 ++---
 4 files changed, 26 insertions(+), 8 deletions(-)
doc/guides/rel_notes/release_26_11.rst +5 -0
index 4b3e5d995c..380aecb5a7 100644
@@ -139,6 +139,25 @@ ABI Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* **Increased memzone maximum name size.**
+
+  ``RTE_MEMZONE_NAMESIZE`` was increased from 32 to 64,
+  and the derived ``RTE_RING_NAMESIZE``, ``RTE_MEMPOOL_NAMESIZE``,
+  ``RTE_STACK_NAMESIZE`` and ``RTE_RCU_QSBR_DQ_NAMESIZE`` grew

accordingly.

doc/guides/rel_notes/release_26_11.rst +14 -0
+  This impacts the following structures:
+
+  * ``struct rte_memzone`` grew by 32 bytes.
+
+  * ``struct rte_ring`` grew by one cache line,
+    and ``name`` was moved after the size fields
+    to keep the datapath fields in the first cache line.
+
+  * ``struct rte_mempool`` is unchanged in size,
+    but ``name``, ``pool_config`` and ``mz`` were moved
+    after the fields used in the datapath.
+
+  * ``struct rte_stack`` grew by one cache line.
+
 
 Known Issues
 ------------
lib/eal/include/rte_memzone.h +0 -1
index 5a0e1b8a15..d5c92fe0ec 100644
@@ -47,7 +47,7 @@ extern "C" {
  */
 struct __rte_packed_begin rte_memzone {
 
-#define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory

zone name.*/
+#define RTE_MEMZONE_NAMESIZE 64 /**< Maximum length of memory
zone name.*/
char name[RTE_MEMZONE_NAMESIZE]; /**< Name of the memory zone.
*/

lib/eal/include/rte_memzone.h +0 -0
 	rte_iova_t iova;                  /**< Start IO address. */
lib/mempool/rte_mempool.h +0 -1
index 50d958c7c6..d2ae56e49f 100644
@@ -230,13 +230,11 @@ struct __rte_cache_aligned rte_mempool_info {
  * The RTE mempool structure.
  */
 struct __rte_cache_aligned rte_mempool {
-	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 	union {
 		void *pool_data;         /**< Ring or pool to store

objects. */
uint64_t pool_id; /**< External mempool identifier.
*/

lib/mempool/rte_mempool.h +0 -1
 	};
-	void *pool_config;               /**< optional args for ops

alloc. */

lib/mempool/rte_mempool.h +0 -1
-	const struct rte_memzone *mz;    /**< Memzone where pool is

alloc'd. */

lib/mempool/rte_mempool.h +1 -0
+	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache

*/

lib/mempool/rte_mempool.h +0 -0
 	unsigned int flags;              /**< Flags of the mempool. */
 	int socket_id;                   /**< Socket id passed at create.

*/

lib/mempool/rte_mempool.h +1 -1
 	uint32_t size;                   /**< Max size of the mempool. */
@@ -257,7 +255,9 @@ struct __rte_cache_aligned rte_mempool {
 	 */
 	int32_t ops_index;
 
-	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache
 */
+	void *pool_config;               /**< optional args for ops

alloc. */

lib/mempool/rte_mempool.h +1 -0
+	const struct rte_memzone *mz;    /**< Memzone where pool is

alloc'd. */

lib/mempool/rte_mempool.h +1 -0
+	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 
 	uint32_t populated_size;         /**< Number of populated
Quoted 3 lines

objects. */
struct rte_mempool_objhdr_list elt_list; /**< List of objects in
pool */

I have submitted a patch introducing a new "sizeof_cache_per_lcore" field [1]. This new field must be close to the "local_cache" field.

Also, for mempool cache misses, the "ops_index" and "pool_data" fields should be close together. Optimally also close to the "local_cache" field, so they have been fetched with it.

[1]: https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

AFAIK, only these four fields hot in the dataplane:
- local_cache, sizeof_cache_per_lcore (new field):
Used for access to objects in cache.
- ops_index, pool_data/pool_id:
Used on cache miss for access to objects in backing store.

The other fields are not used in the dataplane, and can be moved down below these four, which should be first.

Note: The cache_size field is currently hot, but my patch makes it cold.

Quoted 23 lines
lib/ring/rte_ring_core.h +1 -3
index 6cd6ce9884..4359ca8006 100644
@@ -114,14 +114,13 @@ struct rte_ring_hts_headtail {
  * a problem.
  */
 struct rte_ring {
-	alignas(RTE_CACHE_LINE_SIZE) char name[RTE_RING_NAMESIZE];
-	/**< Name of the ring. */
-	int flags;               /**< Flags supplied at creation. */
+	alignas(RTE_CACHE_LINE_SIZE) int flags; /**< Flags supplied at

creation. */

lib/ring/rte_ring_core.h +1 -1
 	const struct rte_memzone *memzone;
 			/**< Memzone, if any, containing the rte_ring */
 	uint32_t size;           /**< Size of ring. */
 	uint32_t mask;           /**< Mask (size-1) of ring. */
 	uint32_t capacity;       /**< Usable size of ring */
+	char name[RTE_RING_NAMESIZE]; /**< Name of the ring. */
 
 	RTE_CACHE_GUARD;
 
--
Quoted 1 line

2.53.0

Suggest rearranging the ring slightly more, like the mempool...

1. Move cache alignment to the structure itself, instead of its first field:
"struct __rte_cache_aligned rte_ring" instead of "alignas(RTE_CACHE_LINE_SIZE) int flags".

2. Move the memzone pointer down too, just ahead of the name.

#2 lore raw

22/09/2026 12:42, Morten Brørup:

Quoted 54 lines

From: Stephen Hemminger [mailto:[email protected]]

Quoted 36 lines
lib/mempool/rte_mempool.h +0 -1
@@ -230,13 +230,11 @@ struct __rte_cache_aligned rte_mempool_info {
  * The RTE mempool structure.
  */
 struct __rte_cache_aligned rte_mempool {
-	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 	union {
 		void *pool_data;         /**< Ring or pool to store

objects. */
uint64_t pool_id; /**< External mempool identifier.
*/

lib/mempool/rte_mempool.h +0 -1
 	};
-	void *pool_config;               /**< optional args for ops

alloc. */

lib/mempool/rte_mempool.h +0 -1
-	const struct rte_memzone *mz;    /**< Memzone where pool is

alloc'd. */

lib/mempool/rte_mempool.h +1 -0
+	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache

*/

lib/mempool/rte_mempool.h +0 -0
 	unsigned int flags;              /**< Flags of the mempool. */
 	int socket_id;                   /**< Socket id passed at create.

*/

lib/mempool/rte_mempool.h +1 -1
 	uint32_t size;                   /**< Max size of the mempool. */
@@ -257,7 +255,9 @@ struct __rte_cache_aligned rte_mempool {
 	 */
 	int32_t ops_index;
 
-	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache
 */
+	void *pool_config;               /**< optional args for ops

alloc. */

lib/mempool/rte_mempool.h +1 -0
+	const struct rte_memzone *mz;    /**< Memzone where pool is

alloc'd. */

lib/mempool/rte_mempool.h +1 -0
+	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 
 	uint32_t populated_size;         /**< Number of populated
Quoted 3 lines

objects. */
struct rte_mempool_objhdr_list elt_list; /**< List of objects in
pool */

I have submitted a patch introducing a new "sizeof_cache_per_lcore" field [1]. This new field must be close to the "local_cache" field.

Also, for mempool cache misses, the "ops_index" and "pool_data" fields should be close together. Optimally also close to the "local_cache" field, so they have been fetched with it.

[1]: https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

AFAIK, only these four fields hot in the dataplane:
- local_cache, sizeof_cache_per_lcore (new field):
Used for access to objects in cache.
- ops_index, pool_data/pool_id:
Used on cache miss for access to objects in backing store.

Quoted 3 lines

The other fields are not used in the dataplane, and can be moved down below these four, which should be first.

Note: The cache_size field is currently hot, but my patch makes it cold.

These changes in mempool are marged in main.
So this memzone series needs to be rebased.

#3 lore raw

v2 cover increase memzone name size and fix rib/fib prefixes

In reply to Stephen Hemminger

This series increases memzone name size and also incorporates the patch to check FIB and RIB namesizes.

Memzone names are limited to 31 characters, and ring, mempool and stack names lose the length of their prefixes on top of that.

Patches:
1. fixes hardcoded 32 size in crypto-perf app.
2. increases RTE_MEMZONE_NAMESIZE to 64 and reorders slightly.
3. Anurag Mandal's "fib, rib: fix name prefixes" v2, rebased.

v2 - merge in name size and rib, fib
- incorporate review comments

Anurag Mandal (1):
fib, rib: fix name prefixes

Stephen Hemminger (2):
app/crypto-perf: fix asymmetric op pool name size
eal: increase memzone name size to 64

 app/test-crypto-perf/cperf_test_common.c |  4 +--
 doc/guides/rel_notes/release_26_11.rst   | 36 ++++++++++++++++++++++++
 lib/eal/include/rte_memzone.h            |  2 +-
 lib/fib/rte_fib.c                        | 16 +++++++++--
 lib/fib/rte_fib6.c                       | 16 +++++++++--
 lib/mempool/rte_mempool.h                | 29 ++++++++++---------
 lib/rib/rte_rib.c                        | 14 +++++++--
 lib/rib/rte_rib6.c                       | 14 +++++++--
 lib/ring/rte_ring_core.h                 |  9 +++---
 9 files changed, 108 insertions(+), 32 deletions(-)
Signature · 1 line
2.53.0
#4 lore raw

PATCH v2 1/3 app/crypto-perf: fix asymmetric op pool name size

The asymmetric op pool name buffer is 32 bytes but snprintf is given RTE_MEMPOOL_NAMESIZE as the size. This is harmless only as long as RTE_MEMPOOL_NAMESIZE is not larger than 32.

Size the buffer with RTE_MEMPOOL_NAMESIZE and use sizeof() for the snprintf limit, as the symmetric path already does.

Fixes ba588ce3f933 ("test/crypto-perf: test asymmetric crypto throughput")
---
 app/test-crypto-perf/cperf_test_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-crypto-perf/cperf_test_common.c +2 -2
index 0bcaa6dfd8..b2eabf470e 100644
@@ -145,7 +145,7 @@ cperf_alloc_common_memory(const struct cperf_options *options,
 			struct rte_mempool **pool)
 {
 	const char *mp_ops_name;
-	char pool_name[32] = "";
+	char pool_name[RTE_MEMPOOL_NAMESIZE] = "";
 	int ret;
 
 	/* Calculate the object size */
@@ -154,7 +154,7 @@ cperf_alloc_common_memory(const struct cperf_options *options,
 
 	if (cperf_is_asym_test(options)) {
 		crypto_op_size += sizeof(struct rte_crypto_asym_op);
-		snprintf(pool_name, RTE_MEMPOOL_NAMESIZE, "perf_asym_op_pool%u",
+		snprintf(pool_name, sizeof(pool_name), "perf_asym_op_pool%u",
 			 rte_socket_id());
 		*pool = rte_crypto_op_pool_create(
 			pool_name, RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
Signature · 1 line
2.53.0
Acked-by on v2 1/3
#5 lore raw

RE: [EXTERNAL] [PATCH v2 1/3] app/crypto-perf: fix asymmetric op pool name size

Quoted 4 lines

The asymmetric op pool name buffer is 32 bytes but snprintf is given RTE_MEMPOOL_NAMESIZE as the size. This is harmless only as long as RTE_MEMPOOL_NAMESIZE is not larger than 32.

Quoted 8 lines

Size the buffer with RTE_MEMPOOL_NAMESIZE and use sizeof() for the snprintf limit, as the symmetric path already does.

Fixes ba588ce3f933 ("test/crypto-perf: test asymmetric crypto throughput")
---
 app/test-crypto-perf/cperf_test_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#6 lore raw

PATCH v2 2/3 eal: increase memzone name size to 64

In reply to Stephen Hemminger

Memzone names are limited to 31 characters, and ring, mempool and stack names lose the length of their prefixes on top of that. A mempool name is limited to 25 characters, which leaves little room for libraries such as rib and fib that derive names from the name given by the application.

Increase RTE_MEMZONE_NAMESIZE to 64. The derived ring, mempool, stack and RCU defer queue sizes follow.

Reorder struct rte_ring and struct rte_mempool so the larger name does not push datapath fields into another cache line.

For rte_ring, flags and the size fields come first, followed by the memzone pointer and the name. The cache alignment moves from the first field to the structure itself. struct rte_ring grows by one cache line.

For rte_mempool the fields used in the datapath are gathered at the
start: pool_data/pool_id, local_cache, ops_index and cache_size. The remaining fields, along with pool_config, mz and name, follow. Previously local_cache and ops_index were in the second cache line. struct rte_mempool stays 192 bytes.

---
 doc/guides/rel_notes/release_26_11.rst | 21 +++++++++++++++++++
 lib/eal/include/rte_memzone.h          |  2 +-
 lib/mempool/rte_mempool.h              | 29 +++++++++++++-------------
 lib/ring/rte_ring_core.h               |  9 ++++----
 4 files changed, 41 insertions(+), 20 deletions(-)
doc/guides/rel_notes/release_26_11.rst +21 -0
index 4b3e5d995c..99847e9745 100644
@@ -139,6 +139,27 @@ ABI Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* **Increased memzone maximum name size.**
+
+  ``RTE_MEMZONE_NAMESIZE`` was increased from 32 to 64,
+  and the derived ``RTE_RING_NAMESIZE``, ``RTE_MEMPOOL_NAMESIZE``,
+  ``RTE_STACK_NAMESIZE`` and ``RTE_RCU_QSBR_DQ_NAMESIZE`` grew accordingly.
+  This impacts the following structures:
+
+  * ``struct rte_memzone`` grew by 32 bytes.
+
+  * ``struct rte_ring`` grew by one cache line,
+    and ``memzone`` and ``name`` were moved after the size fields
+    to keep the datapath fields in the first cache line.
+
+  * ``struct rte_mempool`` is unchanged in size,
+    but the fields were reordered so the datapath fields
+    (``pool_data``/``pool_id``, ``local_cache``, ``ops_index``
+    and ``cache_size``) come first,
+    and ``name``, ``pool_config`` and ``mz`` were moved after them.
+
+  * ``struct rte_stack`` grew by one cache line.
+
 
 Known Issues
 ------------
lib/eal/include/rte_memzone.h +1 -1
index 5a0e1b8a15..d5c92fe0ec 100644
@@ -47,7 +47,7 @@ extern "C" {
  */
 struct __rte_packed_begin rte_memzone {
 
-#define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
+#define RTE_MEMZONE_NAMESIZE 64       /**< Maximum length of memory zone name.*/
 	char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
 
 	rte_iova_t iova;                  /**< Start IO address. */
lib/mempool/rte_mempool.h +15 -14
index 50d958c7c6..5c7fd46720 100644
@@ -230,34 +230,35 @@ struct __rte_cache_aligned rte_mempool_info {
  * The RTE mempool structure.
  */
 struct __rte_cache_aligned rte_mempool {
-	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 	union {
 		void *pool_data;         /**< Ring or pool to store objects. */
 		uint64_t pool_id;        /**< External mempool identifier. */
 	};
-	void *pool_config;               /**< optional args for ops alloc. */
-	const struct rte_memzone *mz;    /**< Memzone where pool is alloc'd. */
+	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache */
+	/**
+	 * Index into rte_mempool_ops_table array of mempool ops
+	 * structs, which contain callback function pointers.
+	 * We're using an index here rather than pointers to the callbacks
+	 * to facilitate any secondary processes that may want to use
+	 * this mempool.
+	 */
+	int32_t ops_index;
+	uint32_t cache_size;
+	/**< Size of per-lcore default local cache. */
+
 	unsigned int flags;              /**< Flags of the mempool. */
 	int socket_id;                   /**< Socket id passed at create. */
 	uint32_t size;                   /**< Max size of the mempool. */
-	uint32_t cache_size;
-	/**< Size of per-lcore default local cache. */
 
 	uint32_t elt_size;               /**< Size of an element. */
 	uint32_t header_size;            /**< Size of header (before elt). */
 	uint32_t trailer_size;           /**< Size of trailer (after elt). */
 
 	unsigned private_data_size;      /**< Size of private data. */
-	/**
-	 * Index into rte_mempool_ops_table array of mempool ops
-	 * structs, which contain callback function pointers.
-	 * We're using an index here rather than pointers to the callbacks
-	 * to facilitate any secondary processes that may want to use
-	 * this mempool.
-	 */
-	int32_t ops_index;
 
-	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache */
+	void *pool_config;               /**< optional args for ops alloc. */
+	const struct rte_memzone *mz;    /**< Memzone where pool is alloc'd. */
+	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 
 	uint32_t populated_size;         /**< Number of populated objects. */
 	struct rte_mempool_objhdr_list elt_list; /**< List of objects in pool */
lib/ring/rte_ring_core.h +4 -5
index 6cd6ce9884..5425cdcef2 100644
@@ -113,15 +113,14 @@ struct rte_ring_hts_headtail {
  * values in a modulo-32bit base: that's why the overflow of the indexes is not
  * a problem.
  */
-struct rte_ring {
-	alignas(RTE_CACHE_LINE_SIZE) char name[RTE_RING_NAMESIZE];
-	/**< Name of the ring. */
+struct __rte_cache_aligned rte_ring {
 	int flags;               /**< Flags supplied at creation. */
-	const struct rte_memzone *memzone;
-			/**< Memzone, if any, containing the rte_ring */
 	uint32_t size;           /**< Size of ring. */
 	uint32_t mask;           /**< Mask (size-1) of ring. */
 	uint32_t capacity;       /**< Usable size of ring */
+	const struct rte_memzone *memzone;
+			/**< Memzone, if any, containing the rte_ring */
+	char name[RTE_RING_NAMESIZE]; /**< Name of the ring. */
 
 	RTE_CACHE_GUARD;
 
Signature · 1 line
2.53.0
#7 lore raw

22/09/2026 17:52, Stephen Hemminger:

Quoted 23 lines

Memzone names are limited to 31 characters, and ring, mempool and stack names lose the length of their prefixes on top of that. A mempool name is limited to 25 characters, which leaves little room for libraries such as rib and fib that derive names from the name given by the application.

Increase RTE_MEMZONE_NAMESIZE to 64. The derived ring, mempool, stack and RCU defer queue sizes follow.

Reorder struct rte_ring and struct rte_mempool so the larger name does not push datapath fields into another cache line.

For rte_ring, flags and the size fields come first, followed by the memzone pointer and the name. The cache alignment moves from the first field to the structure itself. struct rte_ring grows by one cache line.

For rte_mempool the fields used in the datapath are gathered at the
start: pool_data/pool_id, local_cache, ops_index and cache_size. The remaining fields, along with pool_config, mz and name, follow. Previously local_cache and ops_index were in the second cache line. struct rte_mempool stays 192 bytes.

Quoted 7 lines
---
 doc/guides/rel_notes/release_26_11.rst | 21 +++++++++++++++++++
 lib/eal/include/rte_memzone.h          |  2 +-
 lib/mempool/rte_mempool.h              | 29 +++++++++++++-------------
 lib/ring/rte_ring_core.h               |  9 ++++----
 4 files changed, 41 insertions(+), 20 deletions(-)

Please rebase on top of mempool changes in main.

#8 lore raw

PATCH v2 3/3 fib, rib: fix name prefixes

In reply to Stephen Hemminger

From: Anurag Mandal <[email protected]>

The RIB library named the mempool holding its nodes "MP_<name>". That prefix is the one the mempool library itself prepends to the backing memzone, so the memzone ended up named "MP_MP_<name>" which is improper.

The FIB library passed its own name unchanged to the underlying RIB and did not add a prefix to the RIB name.

This patch names each object after its owner.
The node mempool of a RIB is now "RIB_<name>" or "RIB6_<name>", and the RIB owned by a FIB is now "FIB_<name>" or "FIB6_<name>".

A mempool name is limited to RTE_MEMPOOL_NAMESIZE, which is shorter than RTE_RIB_NAMESIZE.
The name was passed down silently and an oversized one surfaced as an opaque rte_mempool_create() failure, so check the derived name up front and return ENAMETOOLONG instead.
As the prefixes above are added on top of the name, the maximum length of a name is limited to the following:
RIB : 53 characters
RIB6: 52 characters
FIB : 49 characters
FIB6: 47 characters

Bugzilla ID: 1981 1982

Fixes 5a5793a5ffa2 ("rib: add RIB library")
Fixes f7e861e21c46 ("rib: support IPv6")
Fixes 39e927248416 ("fib: add FIB library")
Fixes 40d41a8a7b34 ("fib: support IPv6")

[stephen: recomputed the name length limits for 64 byte memzone
names, dropped the now unneeded test, example and node renames]

---
 doc/guides/rel_notes/release_26_11.rst | 15 +++++++++++++++
 lib/fib/rte_fib.c                      | 16 +++++++++++++---
 lib/fib/rte_fib6.c                     | 16 +++++++++++++---
 lib/rib/rte_rib.c                      | 14 ++++++++++++--
 lib/rib/rte_rib6.c                     | 14 ++++++++++++--
 5 files changed, 65 insertions(+), 10 deletions(-)
doc/guides/rel_notes/release_26_11.rst +15 -0
index 99847e9745..31de764a9d 100644
@@ -123,6 +123,21 @@ API Changes
   * ``rte_tel_data_add_dict_uint_hex``
   * ``rte_telemetry_register_cmd_arg``
 
+* rib: The node mempool created by ``rte_rib_create()`` and ``rte_rib6_create()``
+  is now named ``RIB_<name>`` and ``RIB6_<name>`` instead of ``MP_<name>``.
+
+* fib: The RIB created by ``rte_fib_create()`` and ``rte_fib6_create()``
+  is now named ``FIB_<name>`` and ``FIB6_<name>``.
+
+* rib, fib: The name of a RIB, RIB6, FIB or FIB6 is used to derive the name of
+  its node mempool, which is bounded by ``RTE_MEMPOOL_NAMESIZE``.
+  As the prefixes above are added on top of the name,
+  the maximum length of a name is the following:
+
+  * RIB  - 53 characters.
+  * RIB6 - 52 characters.
+  * FIB  - 49 characters.
+  * FIB6 - 47 characters.
 
 ABI Changes
 -----------
lib/fib/rte_fib.c +13 -3
index 184210f380..7a587820ad 100644
@@ -37,6 +37,9 @@ EAL_REGISTER_TAILQ(rte_fib_tailq)
 #define FIB_RETURN_IF_TRUE(cond, retval)
 #endif
 
+/* Prefix used for the memory objects owned by a FIB. */
+#define FIB_MEM_PREFIX		"FIB_"
+
 struct rte_fib {
 	char			name[RTE_FIB_NAMESIZE];
 	enum rte_fib_type	type;	/**< Type of FIB struct */
@@ -173,14 +176,21 @@ rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf)
 	rib_conf.ext_sz = conf->rib_ext_sz;
 	rib_conf.max_nodes = conf->max_routes * 2;
 
-	rib = rte_rib_create(name, socket_id, &rib_conf);
+	/* Add FIB Prefix to its mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), FIB_MEM_PREFIX "%s", name);
+	if (ret < 0 || ret >= (int)sizeof(mem_name)) {
+		FIB_LOG(ERR, "FIB name %s is too long", name);
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
+	rib = rte_rib_create(mem_name, socket_id, &rib_conf);
 	if (rib == NULL) {
 		FIB_LOG(ERR,
-			"Can not allocate RIB %s", name);
+			"Can not allocate RIB for FIB: %s", mem_name);
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "FIB_%s", name);
 	fib_list = RTE_TAILQ_CAST(rte_fib_tailq.head, rte_fib_list);
 
 	rte_mcfg_tailq_write_lock();
lib/fib/rte_fib6.c +13 -3
index 770becdb61..1a31ab09aa 100644
@@ -37,6 +37,9 @@ EAL_REGISTER_TAILQ(rte_fib6_tailq)
 #define FIB6_RETURN_IF_TRUE(cond, retval)
 #endif
 
+/* Prefix used for the memory objects owned by a FIB6. */
+#define FIB6_MEM_PREFIX		"FIB6_"
+
 struct rte_fib6 {
 	char			name[RTE_FIB6_NAMESIZE];
 	enum rte_fib6_type	type;	/**< Type of FIB struct */
@@ -172,14 +175,21 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf)
 	rib_conf.ext_sz = conf->rib_ext_sz;
 	rib_conf.max_nodes = conf->max_routes * 2;
 
-	rib = rte_rib6_create(name, socket_id, &rib_conf);
+	/* Add FIB6 Prefix to its mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), FIB6_MEM_PREFIX "%s", name);
+	if (ret < 0 || ret >= (int)sizeof(mem_name)) {
+		FIB_LOG(ERR, "FIB6 name %s is too long", name);
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
+	rib = rte_rib6_create(mem_name, socket_id, &rib_conf);
 	if (rib == NULL) {
 		FIB_LOG(ERR,
-			"Can not allocate RIB %s", name);
+			"Can not allocate RIB6 for FIB6 %s", mem_name);
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "FIB6_%s", name);
 	fib_list = RTE_TAILQ_CAST(rte_fib6_tailq.head, rte_fib6_list);
 
 	rte_mcfg_tailq_write_lock();
lib/rib/rte_rib.c +12 -2
index 046db131ca..55802f0060 100644
@@ -32,6 +32,8 @@ EAL_REGISTER_TAILQ(rte_rib_tailq)
 #define RIB_MAXDEPTH		32
 /* Maximum length of a RIB name. */
 #define RTE_RIB_NAMESIZE	64
+/* Prefix used for the memory objects owned by a RIB. */
+#define RIB_MEM_PREFIX		"RIB_"
 
 struct rte_rib_node {
 	struct rte_rib_node	*left;
@@ -417,6 +419,7 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
 	struct rte_tailq_entry *te;
 	struct rte_rib_list *rib_list;
 	struct rte_mempool *node_pool;
+	int ret;
 
 	/* Check user arguments. */
 	if (unlikely(name == NULL || conf == NULL || conf->max_nodes <= 0)) {
@@ -424,7 +427,15 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "MP_%s", name);
+	/* Add RIB Prefix to its node mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), RIB_MEM_PREFIX "%s", name);
+	if (unlikely(ret < 0 || ret >= (int)RTE_MEMPOOL_NAMESIZE)) {
+		RIB_LOG(ERR, "RIB name %s is too long, limit is %zu characters",
+			name, RTE_MEMPOOL_NAMESIZE - sizeof(RIB_MEM_PREFIX));
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
 	node_pool = rte_mempool_create(mem_name, conf->max_nodes,
 		sizeof(struct rte_rib_node) + conf->ext_sz, 0, 0,
 		NULL, NULL, NULL, NULL, socket_id, 0);
@@ -435,7 +446,6 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "RIB_%s", name);
 	rib_list = RTE_TAILQ_CAST(rte_rib_tailq.head, rte_rib_list);
 
 	rte_mcfg_tailq_write_lock();
lib/rib/rte_rib6.c +12 -2
index 918ddbdfd3..7d9a0ba36f 100644
@@ -24,6 +24,8 @@
 #define RTE_RIB_VALID_NODE	1
 /* Maximum length of a RIB6 name. */
 #define RTE_RIB6_NAMESIZE	64
+/* Prefix used for the memory objects owned by a RIB6. */
+#define RIB6_MEM_PREFIX		"RIB6_"
 
 TAILQ_HEAD(rte_rib6_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_rib6_tailq = {
@@ -480,6 +482,7 @@ rte_rib6_create(const char *name, int socket_id,
 	struct rte_tailq_entry *te;
 	struct rte_rib6_list *rib6_list;
 	struct rte_mempool *node_pool;
+	int ret;
 
 	/* Check user arguments. */
 	if (unlikely(name == NULL || conf == NULL || conf->max_nodes <= 0)) {
@@ -487,7 +490,15 @@ rte_rib6_create(const char *name, int socket_id,
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "MP_%s", name);
+	/* Add RIB6 Prefix to its node mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), RIB6_MEM_PREFIX "%s", name);
+	if (unlikely(ret < 0 || ret >= (int)RTE_MEMPOOL_NAMESIZE)) {
+		RIB_LOG(ERR, "RIB6 name %s is too long, limit is %zu characters",
+			name, RTE_MEMPOOL_NAMESIZE - sizeof(RIB6_MEM_PREFIX));
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
 	node_pool = rte_mempool_create(mem_name, conf->max_nodes,
 		sizeof(struct rte_rib6_node) + conf->ext_sz, 0, 0,
 		NULL, NULL, NULL, NULL, socket_id, 0);
@@ -498,7 +509,6 @@ rte_rib6_create(const char *name, int socket_id,
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "RIB6_%s", name);
 	rib6_list = RTE_TAILQ_CAST(rte_rib6_tailq.head, rte_rib6_list);
 
 	rte_mcfg_tailq_write_lock();
Signature · 1 line
2.53.0
Acked-by on v2 3/3
#9 lore raw

Re: [PATCH v2 3/3] fib, rib: fix name prefixes

Quoted 241 lines · Stephen Hemminger

From: Anurag Mandal <[email protected]>

The RIB library named the mempool holding its nodes "MP_<name>". That prefix is the one the mempool library itself prepends to the backing memzone, so the memzone ended up named "MP_MP_<name>" which is improper.

The FIB library passed its own name unchanged to the underlying RIB and did not add a prefix to the RIB name.

This patch names each object after its owner.
The node mempool of a RIB is now "RIB_<name>" or "RIB6_<name>", and the RIB owned by a FIB is now "FIB_<name>" or "FIB6_<name>".

A mempool name is limited to RTE_MEMPOOL_NAMESIZE, which is shorter than RTE_RIB_NAMESIZE.
The name was passed down silently and an oversized one surfaced as an opaque rte_mempool_create() failure, so check the derived name up front and return ENAMETOOLONG instead.
As the prefixes above are added on top of the name, the maximum length of a name is limited to the following:
RIB : 53 characters
RIB6: 52 characters
FIB : 49 characters
FIB6: 47 characters

Bugzilla ID: 1981 1982

Fixes 5a5793a5ffa2 ("rib: add RIB library")
Fixes f7e861e21c46 ("rib: support IPv6")
Fixes 39e927248416 ("fib: add FIB library")
Fixes 40d41a8a7b34 ("fib: support IPv6")

[stephen: recomputed the name length limits for 64 byte memzone
names, dropped the now unneeded test, example and node renames]

---
  doc/guides/rel_notes/release_26_11.rst | 15 +++++++++++++++
  lib/fib/rte_fib.c                      | 16 +++++++++++++---
  lib/fib/rte_fib6.c                     | 16 +++++++++++++---
  lib/rib/rte_rib.c                      | 14 ++++++++++++--
  lib/rib/rte_rib6.c                     | 14 ++++++++++++--
  5 files changed, 65 insertions(+), 10 deletions(-)
doc/guides/rel_notes/release_26_11.rst +15 -0
index 99847e9745..31de764a9d 100644
@@ -123,6 +123,21 @@ API Changes
    * ``rte_tel_data_add_dict_uint_hex``
    * ``rte_telemetry_register_cmd_arg``
 
+* rib: The node mempool created by ``rte_rib_create()`` and ``rte_rib6_create()``
+  is now named ``RIB_<name>`` and ``RIB6_<name>`` instead of ``MP_<name>``.
+
+* fib: The RIB created by ``rte_fib_create()`` and ``rte_fib6_create()``
+  is now named ``FIB_<name>`` and ``FIB6_<name>``.
+
+* rib, fib: The name of a RIB, RIB6, FIB or FIB6 is used to derive the name of
+  its node mempool, which is bounded by ``RTE_MEMPOOL_NAMESIZE``.
+  As the prefixes above are added on top of the name,
+  the maximum length of a name is the following:
+
+  * RIB  - 53 characters.
+  * RIB6 - 52 characters.
+  * FIB  - 49 characters.
+  * FIB6 - 47 characters.
 
  ABI Changes
  -----------
lib/fib/rte_fib.c +13 -3
index 184210f380..7a587820ad 100644
@@ -37,6 +37,9 @@ EAL_REGISTER_TAILQ(rte_fib_tailq)
  #define FIB_RETURN_IF_TRUE(cond, retval)
  #endif
 
+/* Prefix used for the memory objects owned by a FIB. */
+#define FIB_MEM_PREFIX		"FIB_"
+
  struct rte_fib {
  	char			name[RTE_FIB_NAMESIZE];
  	enum rte_fib_type	type;	/**< Type of FIB struct */
@@ -173,14 +176,21 @@ rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf)
  	rib_conf.ext_sz = conf->rib_ext_sz;
  	rib_conf.max_nodes = conf->max_routes * 2;
 
-	rib = rte_rib_create(name, socket_id, &rib_conf);
+	/* Add FIB Prefix to its mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), FIB_MEM_PREFIX "%s", name);
+	if (ret < 0 || ret >= (int)sizeof(mem_name)) {
+		FIB_LOG(ERR, "FIB name %s is too long", name);
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
+	rib = rte_rib_create(mem_name, socket_id, &rib_conf);
  	if (rib == NULL) {
  		FIB_LOG(ERR,
-			"Can not allocate RIB %s", name);
+			"Can not allocate RIB for FIB: %s", mem_name);
  		return NULL;
  	}
 
-	snprintf(mem_name, sizeof(mem_name), "FIB_%s", name);
  	fib_list = RTE_TAILQ_CAST(rte_fib_tailq.head, rte_fib_list);
 
  	rte_mcfg_tailq_write_lock();
lib/fib/rte_fib6.c +13 -3
index 770becdb61..1a31ab09aa 100644
@@ -37,6 +37,9 @@ EAL_REGISTER_TAILQ(rte_fib6_tailq)
  #define FIB6_RETURN_IF_TRUE(cond, retval)
  #endif
 
+/* Prefix used for the memory objects owned by a FIB6. */
+#define FIB6_MEM_PREFIX		"FIB6_"
+
  struct rte_fib6 {
  	char			name[RTE_FIB6_NAMESIZE];
  	enum rte_fib6_type	type;	/**< Type of FIB struct */
@@ -172,14 +175,21 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf)
  	rib_conf.ext_sz = conf->rib_ext_sz;
  	rib_conf.max_nodes = conf->max_routes * 2;
 
-	rib = rte_rib6_create(name, socket_id, &rib_conf);
+	/* Add FIB6 Prefix to its mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), FIB6_MEM_PREFIX "%s", name);
+	if (ret < 0 || ret >= (int)sizeof(mem_name)) {
+		FIB_LOG(ERR, "FIB6 name %s is too long", name);
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
+	rib = rte_rib6_create(mem_name, socket_id, &rib_conf);
  	if (rib == NULL) {
  		FIB_LOG(ERR,
-			"Can not allocate RIB %s", name);
+			"Can not allocate RIB6 for FIB6 %s", mem_name);
  		return NULL;
  	}
 
-	snprintf(mem_name, sizeof(mem_name), "FIB6_%s", name);
  	fib_list = RTE_TAILQ_CAST(rte_fib6_tailq.head, rte_fib6_list);
 
  	rte_mcfg_tailq_write_lock();
lib/rib/rte_rib.c +12 -2
index 046db131ca..55802f0060 100644
@@ -32,6 +32,8 @@ EAL_REGISTER_TAILQ(rte_rib_tailq)
  #define RIB_MAXDEPTH		32
  /* Maximum length of a RIB name. */
  #define RTE_RIB_NAMESIZE	64
+/* Prefix used for the memory objects owned by a RIB. */
+#define RIB_MEM_PREFIX		"RIB_"
 
  struct rte_rib_node {
  	struct rte_rib_node	*left;
@@ -417,6 +419,7 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
  	struct rte_tailq_entry *te;
  	struct rte_rib_list *rib_list;
  	struct rte_mempool *node_pool;
+	int ret;
 
  	/* Check user arguments. */
  	if (unlikely(name == NULL || conf == NULL || conf->max_nodes <= 0)) {
@@ -424,7 +427,15 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
  		return NULL;
  	}
 
-	snprintf(mem_name, sizeof(mem_name), "MP_%s", name);
+	/* Add RIB Prefix to its node mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), RIB_MEM_PREFIX "%s", name);
+	if (unlikely(ret < 0 || ret >= (int)RTE_MEMPOOL_NAMESIZE)) {
+		RIB_LOG(ERR, "RIB name %s is too long, limit is %zu characters",
+			name, RTE_MEMPOOL_NAMESIZE - sizeof(RIB_MEM_PREFIX));
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
  	node_pool = rte_mempool_create(mem_name, conf->max_nodes,
  		sizeof(struct rte_rib_node) + conf->ext_sz, 0, 0,
  		NULL, NULL, NULL, NULL, socket_id, 0);
@@ -435,7 +446,6 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
  		return NULL;
  	}
 
-	snprintf(mem_name, sizeof(mem_name), "RIB_%s", name);
  	rib_list = RTE_TAILQ_CAST(rte_rib_tailq.head, rte_rib_list);
 
  	rte_mcfg_tailq_write_lock();
lib/rib/rte_rib6.c +12 -2
index 918ddbdfd3..7d9a0ba36f 100644
@@ -24,6 +24,8 @@
  #define RTE_RIB_VALID_NODE	1
  /* Maximum length of a RIB6 name. */
  #define RTE_RIB6_NAMESIZE	64
+/* Prefix used for the memory objects owned by a RIB6. */
+#define RIB6_MEM_PREFIX		"RIB6_"
 
  TAILQ_HEAD(rte_rib6_list, rte_tailq_entry);
  static struct rte_tailq_elem rte_rib6_tailq = {
@@ -480,6 +482,7 @@ rte_rib6_create(const char *name, int socket_id,
  	struct rte_tailq_entry *te;
  	struct rte_rib6_list *rib6_list;
  	struct rte_mempool *node_pool;
+	int ret;
 
  	/* Check user arguments. */
  	if (unlikely(name == NULL || conf == NULL || conf->max_nodes <= 0)) {
@@ -487,7 +490,15 @@ rte_rib6_create(const char *name, int socket_id,
  		return NULL;
  	}
 
-	snprintf(mem_name, sizeof(mem_name), "MP_%s", name);
+	/* Add RIB6 Prefix to its node mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), RIB6_MEM_PREFIX "%s", name);
+	if (unlikely(ret < 0 || ret >= (int)RTE_MEMPOOL_NAMESIZE)) {
+		RIB_LOG(ERR, "RIB6 name %s is too long, limit is %zu characters",
+			name, RTE_MEMPOOL_NAMESIZE - sizeof(RIB6_MEM_PREFIX));
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
  	node_pool = rte_mempool_create(mem_name, conf->max_nodes,
  		sizeof(struct rte_rib6_node) + conf->ext_sz, 0, 0,
  		NULL, NULL, NULL, NULL, socket_id, 0);
@@ -498,7 +509,6 @@ rte_rib6_create(const char *name, int socket_id,
  		return NULL;
  	}
 
-	snprintf(mem_name, sizeof(mem_name), "RIB6_%s", name);
  	rib6_list = RTE_TAILQ_CAST(rte_rib6_tailq.head, rte_rib6_list);
 
  	rte_mcfg_tailq_write_lock();
Signature · 2 lines
Regards,
Vladimir
#10 lore raw

v3 cover increase memzone name size and fix rib/fib prefix

In reply to Stephen Hemminger

This series increases memzone name size and also incorporates the patch to check FIB and RIB namesizes.

Memzone names are limited to 31 characters, and ring, mempool and stack names lose the length of their prefixes on top of that.

Patches:
1. fixes hardcoded 32 size in crypto-perf app.
2. increases RTE_MEMZONE_NAMESIZE to 64 and reorders slightly.
3. Anurag Mandal's "fib, rib: fix name prefixes" v2, rebased.

v3 - rebase to 26.11-rc1

Anurag Mandal (1):
fib, rib: fix name prefixes

Stephen Hemminger (2):
app/crypto-perf: fix asymmetric op pool name size
eal: increase memzone name size to 64

 app/test-crypto-perf/cperf_test_common.c |  4 +--
 doc/guides/rel_notes/release_26_11.rst   | 36 ++++++++++++++++++++++++
 lib/eal/include/rte_memzone.h            |  2 +-
 lib/fib/rte_fib.c                        | 16 +++++++++--
 lib/fib/rte_fib6.c                       | 16 +++++++++--
 lib/mempool/rte_mempool.h                | 30 +++++++++++---------
 lib/rib/rte_rib.c                        | 14 +++++++--
 lib/rib/rte_rib6.c                       | 14 +++++++--
 lib/ring/rte_ring_core.h                 |  9 +++---
 9 files changed, 109 insertions(+), 32 deletions(-)
Signature · 1 line
2.53.0
#11 lore raw

PATCH v3 1/3 app/crypto-perf: fix asymmetric op pool name size

The asymmetric op pool name buffer is 32 bytes but snprintf is given RTE_MEMPOOL_NAMESIZE as the size. This is harmless only as long as RTE_MEMPOOL_NAMESIZE is not larger than 32.

Size the buffer with RTE_MEMPOOL_NAMESIZE and use sizeof() for the snprintf limit, as the symmetric path already does.

Fixes ba588ce3f933 ("test/crypto-perf: test asymmetric crypto throughput")
---
 app/test-crypto-perf/cperf_test_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/test-crypto-perf/cperf_test_common.c +2 -2
index 0bcaa6dfd8..b2eabf470e 100644
@@ -145,7 +145,7 @@ cperf_alloc_common_memory(const struct cperf_options *options,
 			struct rte_mempool **pool)
 {
 	const char *mp_ops_name;
-	char pool_name[32] = "";
+	char pool_name[RTE_MEMPOOL_NAMESIZE] = "";
 	int ret;
 
 	/* Calculate the object size */
@@ -154,7 +154,7 @@ cperf_alloc_common_memory(const struct cperf_options *options,
 
 	if (cperf_is_asym_test(options)) {
 		crypto_op_size += sizeof(struct rte_crypto_asym_op);
-		snprintf(pool_name, RTE_MEMPOOL_NAMESIZE, "perf_asym_op_pool%u",
+		snprintf(pool_name, sizeof(pool_name), "perf_asym_op_pool%u",
 			 rte_socket_id());
 		*pool = rte_crypto_op_pool_create(
 			pool_name, RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
Signature · 1 line
2.53.0
Acked-by on v3 1/3
#12 lore raw

RE: [PATCH v3 1/3] app/crypto-perf: fix asymmetric op pool name size

app/test-crypto-perf/cperf_test_common.c cperf_alloc_common_memory(const struct cperf_options *options, · line 160

Quoted 12 lines
(quoted diff) +1 -1
@@ -154,7 +154,7 @@ cperf_alloc_common_memory(const struct
 cperf_options *options,
 
 	if (cperf_is_asym_test(options)) {
 		crypto_op_size += sizeof(struct rte_crypto_asym_op);
-		snprintf(pool_name, RTE_MEMPOOL_NAMESIZE,
 "perf_asym_op_pool%u",
+		snprintf(pool_name, sizeof(pool_name),
 "perf_asym_op_pool%u",
app/test-crypto-perf/cperf_test_common.c +0 -0
 			 rte_socket_id());
 		*pool = rte_crypto_op_pool_create(
 			pool_name, RTE_CRYPTO_OP_TYPE_ASYMMETRIC,

snprintf() doesn't ensure zero-terminated string. Not new, and don't know if it matters; just mentioning it.

#13 lore raw

Re: [PATCH v3 1/3] app/crypto-perf: fix asymmetric op pool name size

Quoted 14 lines · Morten Brørup

app/test-crypto-perf/cperf_test_common.c cperf_alloc_common_memory(const struct cperf_options *options, · line 160

Quoted 12 lines
(quoted diff) +1 -1
@@ -154,7 +154,7 @@ cperf_alloc_common_memory(const struct
 cperf_options *options,
 
 	if (cperf_is_asym_test(options)) {
 		crypto_op_size += sizeof(struct rte_crypto_asym_op);
-		snprintf(pool_name, RTE_MEMPOOL_NAMESIZE,
 "perf_asym_op_pool%u",
+		snprintf(pool_name, sizeof(pool_name),
 "perf_asym_op_pool%u",
app/test-crypto-perf/cperf_test_common.c +0 -0
 			 rte_socket_id());
 		*pool = rte_crypto_op_pool_create(
 			pool_name, RTE_CRYPTO_OP_TYPE_ASYMMETRIC,

snprintf() doesn't ensure zero-terminated string.

Actually it does. If return value is size of more, then truncation has occurred, and only size-1 bytes plus null have been written.

Quoted 4 lines

Not new, and don't know if it matters; just mentioning it.

#14 lore raw

RE: [PATCH v3 1/3] app/crypto-perf: fix asymmetric op pool name size

Quoted 8 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 19 October 2026 09.48

Quoted 1 line · Morten Brørup

snprintf() doesn't ensure zero-terminated string.

Actually it does. If return value is size of more, then truncation has occurred, and only size-1 bytes plus null have been written.

Sorry, you're right!
Got it mixed up with strncpy().

-Morten

#15 lore raw

PATCH v3 2/3 eal: increase memzone name size to 64

In reply to Stephen Hemminger

Memzone names are limited to 31 characters, and ring, mempool and stack names lose the length of their prefixes on top of that. A mempool name is limited to 25 characters, which leaves little room for libraries such as rib and fib that derive names from the name given by the application.

Increase RTE_MEMZONE_NAMESIZE to 64. The derived ring, mempool, stack and RCU defer queue sizes follow.

Reorder struct rte_ring and struct rte_mempool so the larger name does not push datapath fields into another cache line.

For rte_ring, flags and the size fields come first, followed by the memzone pointer and the name. The cache alignment moves from the first field to the structure itself. struct rte_ring grows by one cache line.

For rte_mempool the fields used in the datapath are gathered at the
start: pool_data/pool_id, local_cache, ops_index and cache_size. The remaining fields, along with pool_config, mz and name, follow. Previously local_cache and ops_index were in the second cache line. struct rte_mempool stays 192 bytes.

---
 doc/guides/rel_notes/release_26_11.rst | 21 ++++++++++++++++++
 lib/eal/include/rte_memzone.h          |  2 +-
 lib/mempool/rte_mempool.h              | 30 ++++++++++++++------------
 lib/ring/rte_ring_core.h               |  9 ++++----
 4 files changed, 42 insertions(+), 20 deletions(-)
doc/guides/rel_notes/release_26_11.rst +21 -0
index be758a0c02..0d9465c9e2 100644
@@ -567,6 +567,27 @@ ABI Changes
 * cryptodev: The struct ``rte_crypto_rsa_op_param``
   was updated to include ``pss_salt``.
 
+* **Increased memzone maximum name size.**
+
+  ``RTE_MEMZONE_NAMESIZE`` was increased from 32 to 64,
+  and the derived ``RTE_RING_NAMESIZE``, ``RTE_MEMPOOL_NAMESIZE``,
+  ``RTE_STACK_NAMESIZE`` and ``RTE_RCU_QSBR_DQ_NAMESIZE`` grew accordingly.
+  This impacts the following structures:
+
+  * ``struct rte_memzone`` grew by 32 bytes.
+
+  * ``struct rte_ring`` grew by one cache line,
+    and ``memzone`` and ``name`` were moved after the size fields
+    to keep the datapath fields in the first cache line.
+
+  * ``struct rte_mempool`` is unchanged in size,
+    but the fields were reordered so the datapath fields
+    (``pool_data``/``pool_id``, ``local_cache``, ``ops_index``
+    and ``cache_size``) come first,
+    and ``name``, ``pool_config`` and ``mz`` were moved after them.
+
+  * ``struct rte_stack`` grew by one cache line.
+
 
 Known Issues
 ------------
lib/eal/include/rte_memzone.h +1 -1
index 5a0e1b8a15..d5c92fe0ec 100644
@@ -47,7 +47,7 @@ extern "C" {
  */
 struct __rte_packed_begin rte_memzone {
 
-#define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
+#define RTE_MEMZONE_NAMESIZE 64       /**< Maximum length of memory zone name.*/
 	char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
 
 	rte_iova_t iova;                  /**< Start IO address. */
lib/mempool/rte_mempool.h +16 -14
index b34cd893b1..1df8dbebf4 100644
@@ -237,34 +237,36 @@ struct __rte_cache_aligned rte_mempool_info {
  * The RTE mempool structure.
  */
 struct __rte_cache_aligned rte_mempool {
-	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 	union {
 		void *pool_data;         /**< Ring or pool to store objects. */
 		uint64_t pool_id;        /**< External mempool identifier. */
 	};
-	void *pool_config;               /**< optional args for ops alloc. */
-	const struct rte_memzone *mz;    /**< Memzone where pool is alloc'd. */
+	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache */
+	uint32_t sizeof_cache_per_lcore; /**< Multiplier for indexing into the local cache. */
+	/**
+	 * Index into rte_mempool_ops_table array of mempool ops
+	 * structs, which contain callback function pointers.
+	 * We're using an index here rather than pointers to the callbacks
+	 * to facilitate any secondary processes that may want to use
+	 * this mempool.
+	 */
+	int32_t ops_index;
+	uint32_t cache_size;
+	/**< Size of per-lcore default local cache. */
+
 	unsigned int flags;              /**< Flags of the mempool. */
 	int socket_id;                   /**< Socket id passed at create. */
 	uint32_t size;                   /**< Max size of the mempool. */
-	uint32_t cache_size;             /**< Size of per-lcore default local cache. */
 
 	uint32_t elt_size;               /**< Size of an element. */
 	uint32_t header_size;            /**< Size of header (before elt). */
 	uint32_t trailer_size;           /**< Size of trailer (after elt). */
 
 	unsigned private_data_size;      /**< Size of private data. */
-	/**
-	 * Index into rte_mempool_ops_table array of mempool ops
-	 * structs, which contain callback function pointers.
-	 * We're using an index here rather than pointers to the callbacks
-	 * to facilitate any secondary processes that may want to use
-	 * this mempool.
-	 */
-	int32_t ops_index;
 
-	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache */
-	uint32_t sizeof_cache_per_lcore; /**< Multiplier for indexing into the local cache. */
+	void *pool_config;               /**< optional args for ops alloc. */
+	const struct rte_memzone *mz;    /**< Memzone where pool is alloc'd. */
+	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 
 	uint32_t populated_size;         /**< Number of populated objects. */
 	struct rte_mempool_objhdr_list elt_list; /**< List of objects in pool */
lib/ring/rte_ring_core.h +4 -5
index 6cd6ce9884..5425cdcef2 100644
@@ -113,15 +113,14 @@ struct rte_ring_hts_headtail {
  * values in a modulo-32bit base: that's why the overflow of the indexes is not
  * a problem.
  */
-struct rte_ring {
-	alignas(RTE_CACHE_LINE_SIZE) char name[RTE_RING_NAMESIZE];
-	/**< Name of the ring. */
+struct __rte_cache_aligned rte_ring {
 	int flags;               /**< Flags supplied at creation. */
-	const struct rte_memzone *memzone;
-			/**< Memzone, if any, containing the rte_ring */
 	uint32_t size;           /**< Size of ring. */
 	uint32_t mask;           /**< Mask (size-1) of ring. */
 	uint32_t capacity;       /**< Usable size of ring */
+	const struct rte_memzone *memzone;
+			/**< Memzone, if any, containing the rte_ring */
+	char name[RTE_RING_NAMESIZE]; /**< Name of the ring. */
 
 	RTE_CACHE_GUARD;
 
Signature · 1 line
2.53.0
Acked-by on v3 2/3
#16 lore raw

A few minor comments inline below.

With our without suggested changes:

Quoted 15 lines

From: Stephen Hemminger [mailto:[email protected]]
Sent: Friday, 16 October 2026 17.39

Memzone names are limited to 31 characters, and ring, mempool and stack names lose the length of their prefixes on top of that. A mempool name is limited to 25 characters, which leaves little room for libraries such as rib and fib that derive names from the name given by the application.

Increase RTE_MEMZONE_NAMESIZE to 64. The derived ring, mempool, stack and RCU defer queue sizes follow.

Reorder struct rte_ring and struct rte_mempool so the larger name does not push datapath fields into another cache line.

Quoted 7 lines

For rte_ring, flags and the size fields come first, followed by the memzone pointer and the name. The cache alignment moves from the first field to the structure itself. struct rte_ring grows by one cache line.

For rte_mempool the fields used in the datapath are gathered at the
start: pool_data/pool_id, local_cache, ops_index and cache_size.

Add sizeof_cache_per_lcore after local_cache.

Quoted 28 lines

The remaining fields, along with pool_config, mz and name, follow. Previously local_cache and ops_index were in the second cache line. struct rte_mempool stays 192 bytes.

---
 doc/guides/rel_notes/release_26_11.rst | 21 ++++++++++++++++++
 lib/eal/include/rte_memzone.h          |  2 +-
 lib/mempool/rte_mempool.h              | 30 ++++++++++++++------------
 lib/ring/rte_ring_core.h               |  9 ++++----
 4 files changed, 42 insertions(+), 20 deletions(-)
doc/guides/rel_notes/release_26_11.rst +5 -0
index be758a0c02..0d9465c9e2 100644
@@ -567,6 +567,27 @@ ABI Changes
 * cryptodev: The struct ``rte_crypto_rsa_op_param``
   was updated to include ``pss_salt``.
 
+* **Increased memzone maximum name size.**
+
+  ``RTE_MEMZONE_NAMESIZE`` was increased from 32 to 64,
+  and the derived ``RTE_RING_NAMESIZE``, ``RTE_MEMPOOL_NAMESIZE``,
+  ``RTE_STACK_NAMESIZE`` and ``RTE_RCU_QSBR_DQ_NAMESIZE`` grew

accordingly.

doc/guides/rel_notes/release_26_11.rst +1 -0
+  This impacts the following structures:

doc/guides/rel_notes/release_26_11.rst ABI Changes · line 585

Quoted 10 lines
doc/guides/rel_notes/release_26_11.rst +10 -0
+
+  * ``struct rte_memzone`` grew by 32 bytes.
+
+  * ``struct rte_ring`` grew by one cache line,
+    and ``memzone`` and ``name`` were moved after the size fields
+    to keep the datapath fields in the first cache line.
+
+  * ``struct rte_mempool`` is unchanged in size,
+    but the fields were reordered so the datapath fields
+    (``pool_data``/``pool_id``, ``local_cache``, ``ops_index``

Add ``sizeof_cache_per_lcore`` after ``local_cache``.

Quoted 53 lines
doc/guides/rel_notes/release_26_11.rst +5 -0
+    and ``cache_size``) come first,
+    and ``name``, ``pool_config`` and ``mz`` were moved after them.
+
+  * ``struct rte_stack`` grew by one cache line.
+
 
 Known Issues
 ------------
lib/eal/include/rte_memzone.h +0 -1
index 5a0e1b8a15..d5c92fe0ec 100644
@@ -47,7 +47,7 @@ extern "C" {
  */
 struct __rte_packed_begin rte_memzone {
 
-#define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory

zone name.*/
+#define RTE_MEMZONE_NAMESIZE 64 /**< Maximum length of memory
zone name.*/
char name[RTE_MEMZONE_NAMESIZE]; /**< Name of the memory zone.
*/

lib/eal/include/rte_memzone.h +0 -0
 	rte_iova_t iova;                  /**< Start IO address. */
lib/mempool/rte_mempool.h +0 -1
index b34cd893b1..1df8dbebf4 100644
@@ -237,34 +237,36 @@ struct __rte_cache_aligned rte_mempool_info {
  * The RTE mempool structure.
  */
 struct __rte_cache_aligned rte_mempool {
-	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 	union {
 		void *pool_data;         /**< Ring or pool to store

objects. */
uint64_t pool_id; /**< External mempool identifier.
*/

lib/mempool/rte_mempool.h +0 -1
 	};
-	void *pool_config;               /**< optional args for ops

alloc. */

lib/mempool/rte_mempool.h +0 -1
-	const struct rte_memzone *mz;    /**< Memzone where pool is

alloc'd. */

lib/mempool/rte_mempool.h +1 -0
+	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache

*/

lib/mempool/rte_mempool.h +1 -0
+	uint32_t sizeof_cache_per_lcore; /**< Multiplier for indexing

into the local cache. */

lib/mempool/rte_mempool.h +4 -0
+	/**
+	 * Index into rte_mempool_ops_table array of mempool ops
+	 * structs, which contain callback function pointers.
+	 * We're using an index here rather than pointers to the

callbacks

lib/mempool/rte_mempool.h struct __rte_cache_aligned rte_mempool_info { · line 255

Quoted 6 lines
lib/mempool/rte_mempool.h +6 -0
+	 * to facilitate any secondary processes that may want to use
+	 * this mempool.
+	 */
+	int32_t ops_index;
+	uint32_t cache_size;
+	/**< Size of per-lcore default local cache. */

No need to wrap before comment; it fits on the same line, like before moving it.

Quoted 66 lines
lib/mempool/rte_mempool.h +1 -0
+
 	unsigned int flags;              /**< Flags of the mempool. */
 	int socket_id;                   /**< Socket id passed at create.

*/

lib/mempool/rte_mempool.h +0 -1
 	uint32_t size;                   /**< Max size of the mempool. */
-	uint32_t cache_size;             /**< Size of per-lcore default

local cache. */

lib/mempool/rte_mempool.h +0 -0
 	uint32_t elt_size;               /**< Size of an element. */
 	uint32_t header_size;            /**< Size of header (before

elt). */
uint32_t trailer_size; /**< Size of trailer (after
elt). */

lib/mempool/rte_mempool.h +0 -4
 	unsigned private_data_size;      /**< Size of private data. */
-	/**
-	 * Index into rte_mempool_ops_table array of mempool ops
-	 * structs, which contain callback function pointers.
-	 * We're using an index here rather than pointers to the

callbacks

lib/mempool/rte_mempool.h +0 -5
-	 * to facilitate any secondary processes that may want to use
-	 * this mempool.
-	 */
-	int32_t ops_index;
 
-	struct rte_mempool_cache *local_cache; /**< Per-lcore local cache

*/

lib/mempool/rte_mempool.h +0 -1
-	uint32_t sizeof_cache_per_lcore; /**< Multiplier for indexing

into the local cache. */

lib/mempool/rte_mempool.h +1 -0
+	void *pool_config;               /**< optional args for ops

alloc. */

lib/mempool/rte_mempool.h +1 -0
+	const struct rte_memzone *mz;    /**< Memzone where pool is

alloc'd. */

lib/mempool/rte_mempool.h +1 -0
+	char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
 
 	uint32_t populated_size;         /**< Number of populated

objects. */
struct rte_mempool_objhdr_list elt_list; /**< List of objects in
pool */

lib/ring/rte_ring_core.h +0 -0
index 6cd6ce9884..5425cdcef2 100644
@@ -113,15 +113,14 @@ struct rte_ring_hts_headtail {
  * values in a modulo-32bit base: that's why the overflow of the

indexes is not
* a problem.
*/

lib/ring/rte_ring_core.h +4 -6
-struct rte_ring {
-	alignas(RTE_CACHE_LINE_SIZE) char name[RTE_RING_NAMESIZE];
-	/**< Name of the ring. */
+struct __rte_cache_aligned rte_ring {
 	int flags;               /**< Flags supplied at creation. */
-	const struct rte_memzone *memzone;
-			/**< Memzone, if any, containing the rte_ring */
 	uint32_t size;           /**< Size of ring. */
 	uint32_t mask;           /**< Mask (size-1) of ring. */
 	uint32_t capacity;       /**< Usable size of ring */
+	const struct rte_memzone *memzone;
+			/**< Memzone, if any, containing the rte_ring */
+	char name[RTE_RING_NAMESIZE]; /**< Name of the ring. */
 
 	RTE_CACHE_GUARD;
 
--

2.53.0

#17 lore raw

PATCH v3 3/3 fib, rib: fix name prefixes

In reply to Stephen Hemminger

From: Anurag Mandal <[email protected]>

The RIB library named the mempool holding its nodes "MP_<name>". That prefix is the one the mempool library itself prepends to the backing memzone, so the memzone ended up named "MP_MP_<name>" which is improper.

The FIB library passed its own name unchanged to the underlying RIB and did not add a prefix to the RIB name.

This patch names each object after its owner.
The node mempool of a RIB is now "RIB_<name>" or "RIB6_<name>", and the RIB owned by a FIB is now "FIB_<name>" or "FIB6_<name>".

A mempool name is limited to RTE_MEMPOOL_NAMESIZE, which is shorter than RTE_RIB_NAMESIZE.
The name was passed down silently and an oversized one surfaced as an opaque rte_mempool_create() failure, so check the derived name up front and return ENAMETOOLONG instead.
As the prefixes above are added on top of the name, the maximum length of a name is limited to the following:
RIB : 53 characters
RIB6: 52 characters
FIB : 49 characters
FIB6: 47 characters

Bugzilla ID: 1981 1982

Fixes 5a5793a5ffa2 ("rib: add RIB library")
Fixes f7e861e21c46 ("rib: support IPv6")
Fixes 39e927248416 ("fib: add FIB library")
Fixes 40d41a8a7b34 ("fib: support IPv6")
---
 doc/guides/rel_notes/release_26_11.rst | 15 +++++++++++++++
 lib/fib/rte_fib.c                      | 16 +++++++++++++---
 lib/fib/rte_fib6.c                     | 16 +++++++++++++---
 lib/rib/rte_rib.c                      | 14 ++++++++++++--
 lib/rib/rte_rib6.c                     | 14 ++++++++++++--
 5 files changed, 65 insertions(+), 10 deletions(-)
doc/guides/rel_notes/release_26_11.rst +15 -0
index 0d9465c9e2..e67eb8770f 100644
@@ -545,6 +545,21 @@ API Changes
   * ``rte_tel_data_add_dict_uint_hex``
   * ``rte_telemetry_register_cmd_arg``
 
+* rib: The node mempool created by ``rte_rib_create()`` and ``rte_rib6_create()``
+  is now named ``RIB_<name>`` and ``RIB6_<name>`` instead of ``MP_<name>``.
+
+* fib: The RIB created by ``rte_fib_create()`` and ``rte_fib6_create()``
+  is now named ``FIB_<name>`` and ``FIB6_<name>``.
+
+* rib, fib: The name of a RIB, RIB6, FIB or FIB6 is used to derive the name of
+  its node mempool, which is bounded by ``RTE_MEMPOOL_NAMESIZE``.
+  As the prefixes above are added on top of the name,
+  the maximum length of a name is the following:
+
+  * RIB  - 53 characters.
+  * RIB6 - 52 characters.
+  * FIB  - 49 characters.
+  * FIB6 - 47 characters.
 
 ABI Changes
 -----------
lib/fib/rte_fib.c +13 -3
index 184210f380..7a587820ad 100644
@@ -37,6 +37,9 @@ EAL_REGISTER_TAILQ(rte_fib_tailq)
 #define FIB_RETURN_IF_TRUE(cond, retval)
 #endif
 
+/* Prefix used for the memory objects owned by a FIB. */
+#define FIB_MEM_PREFIX		"FIB_"
+
 struct rte_fib {
 	char			name[RTE_FIB_NAMESIZE];
 	enum rte_fib_type	type;	/**< Type of FIB struct */
@@ -173,14 +176,21 @@ rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf)
 	rib_conf.ext_sz = conf->rib_ext_sz;
 	rib_conf.max_nodes = conf->max_routes * 2;
 
-	rib = rte_rib_create(name, socket_id, &rib_conf);
+	/* Add FIB Prefix to its mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), FIB_MEM_PREFIX "%s", name);
+	if (ret < 0 || ret >= (int)sizeof(mem_name)) {
+		FIB_LOG(ERR, "FIB name %s is too long", name);
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
+	rib = rte_rib_create(mem_name, socket_id, &rib_conf);
 	if (rib == NULL) {
 		FIB_LOG(ERR,
-			"Can not allocate RIB %s", name);
+			"Can not allocate RIB for FIB: %s", mem_name);
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "FIB_%s", name);
 	fib_list = RTE_TAILQ_CAST(rte_fib_tailq.head, rte_fib_list);
 
 	rte_mcfg_tailq_write_lock();
lib/fib/rte_fib6.c +13 -3
index 770becdb61..1a31ab09aa 100644
@@ -37,6 +37,9 @@ EAL_REGISTER_TAILQ(rte_fib6_tailq)
 #define FIB6_RETURN_IF_TRUE(cond, retval)
 #endif
 
+/* Prefix used for the memory objects owned by a FIB6. */
+#define FIB6_MEM_PREFIX		"FIB6_"
+
 struct rte_fib6 {
 	char			name[RTE_FIB6_NAMESIZE];
 	enum rte_fib6_type	type;	/**< Type of FIB struct */
@@ -172,14 +175,21 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf)
 	rib_conf.ext_sz = conf->rib_ext_sz;
 	rib_conf.max_nodes = conf->max_routes * 2;
 
-	rib = rte_rib6_create(name, socket_id, &rib_conf);
+	/* Add FIB6 Prefix to its mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), FIB6_MEM_PREFIX "%s", name);
+	if (ret < 0 || ret >= (int)sizeof(mem_name)) {
+		FIB_LOG(ERR, "FIB6 name %s is too long", name);
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
+	rib = rte_rib6_create(mem_name, socket_id, &rib_conf);
 	if (rib == NULL) {
 		FIB_LOG(ERR,
-			"Can not allocate RIB %s", name);
+			"Can not allocate RIB6 for FIB6 %s", mem_name);
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "FIB6_%s", name);
 	fib_list = RTE_TAILQ_CAST(rte_fib6_tailq.head, rte_fib6_list);
 
 	rte_mcfg_tailq_write_lock();
lib/rib/rte_rib.c +12 -2
index 046db131ca..55802f0060 100644
@@ -32,6 +32,8 @@ EAL_REGISTER_TAILQ(rte_rib_tailq)
 #define RIB_MAXDEPTH		32
 /* Maximum length of a RIB name. */
 #define RTE_RIB_NAMESIZE	64
+/* Prefix used for the memory objects owned by a RIB. */
+#define RIB_MEM_PREFIX		"RIB_"
 
 struct rte_rib_node {
 	struct rte_rib_node	*left;
@@ -417,6 +419,7 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
 	struct rte_tailq_entry *te;
 	struct rte_rib_list *rib_list;
 	struct rte_mempool *node_pool;
+	int ret;
 
 	/* Check user arguments. */
 	if (unlikely(name == NULL || conf == NULL || conf->max_nodes <= 0)) {
@@ -424,7 +427,15 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "MP_%s", name);
+	/* Add RIB Prefix to its node mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), RIB_MEM_PREFIX "%s", name);
+	if (unlikely(ret < 0 || ret >= (int)RTE_MEMPOOL_NAMESIZE)) {
+		RIB_LOG(ERR, "RIB name %s is too long, limit is %zu characters",
+			name, RTE_MEMPOOL_NAMESIZE - sizeof(RIB_MEM_PREFIX));
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
 	node_pool = rte_mempool_create(mem_name, conf->max_nodes,
 		sizeof(struct rte_rib_node) + conf->ext_sz, 0, 0,
 		NULL, NULL, NULL, NULL, socket_id, 0);
@@ -435,7 +446,6 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf)
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "RIB_%s", name);
 	rib_list = RTE_TAILQ_CAST(rte_rib_tailq.head, rte_rib_list);
 
 	rte_mcfg_tailq_write_lock();
lib/rib/rte_rib6.c +12 -2
index 918ddbdfd3..7d9a0ba36f 100644
@@ -24,6 +24,8 @@
 #define RTE_RIB_VALID_NODE	1
 /* Maximum length of a RIB6 name. */
 #define RTE_RIB6_NAMESIZE	64
+/* Prefix used for the memory objects owned by a RIB6. */
+#define RIB6_MEM_PREFIX		"RIB6_"
 
 TAILQ_HEAD(rte_rib6_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_rib6_tailq = {
@@ -480,6 +482,7 @@ rte_rib6_create(const char *name, int socket_id,
 	struct rte_tailq_entry *te;
 	struct rte_rib6_list *rib6_list;
 	struct rte_mempool *node_pool;
+	int ret;
 
 	/* Check user arguments. */
 	if (unlikely(name == NULL || conf == NULL || conf->max_nodes <= 0)) {
@@ -487,7 +490,15 @@ rte_rib6_create(const char *name, int socket_id,
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "MP_%s", name);
+	/* Add RIB6 Prefix to its node mempool name */
+	ret = snprintf(mem_name, sizeof(mem_name), RIB6_MEM_PREFIX "%s", name);
+	if (unlikely(ret < 0 || ret >= (int)RTE_MEMPOOL_NAMESIZE)) {
+		RIB_LOG(ERR, "RIB6 name %s is too long, limit is %zu characters",
+			name, RTE_MEMPOOL_NAMESIZE - sizeof(RIB6_MEM_PREFIX));
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
+
 	node_pool = rte_mempool_create(mem_name, conf->max_nodes,
 		sizeof(struct rte_rib6_node) + conf->ext_sz, 0, 0,
 		NULL, NULL, NULL, NULL, socket_id, 0);
@@ -498,7 +509,6 @@ rte_rib6_create(const char *name, int socket_id,
 		return NULL;
 	}
 
-	snprintf(mem_name, sizeof(mem_name), "RIB6_%s", name);
 	rib6_list = RTE_TAILQ_CAST(rte_rib6_tailq.head, rte_rib6_list);
 
 	rte_mcfg_tailq_write_lock();
Signature · 1 line
2.53.0