DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] increase name sizes and reorder structures
@ 2026-08-13 17:12 Stephen Hemminger
  0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2026-08-13 17:12 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Morten Brørup, Anatoly Burakov,
	Konstantin Ananyev, Wathsala Vithanage

This is a trial balloon to see what Morten's suggestion would
look like.

Increase memzone name size to 64 and reorder structure
to keep it cache friendly.  Move the zone name to the end of
struct rte_memzone and order the remaining members by size.
The structure is then naturally aligned
with no internal padding on both 64-bit and 32-bit targets, so the
__rte_packed_begin/end markers can be removed.

With memzone size of 64 but don't need all that for stack names.
Increase the size to 32 which adds some space without impacting
cache layout.

The memzone increase to 64 allows ring names to grow to 32 characters.
Don't need to go larger which could cause cache changes when ring is
embedded in structures.

Bugzilla ID: 1984

Reported-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 doc/guides/rel_notes/release_26_11.rst | 15 +++++++++++++++
 lib/eal/include/rte_memzone.h          | 15 ++++++---------
 lib/ring/rte_ring_core.h               |  7 +++++--
 lib/stack/rte_stack.h                  |  6 ++++--
 4 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
index c8cc86295d..4732e0ec72 100644
--- a/doc/guides/rel_notes/release_26_11.rst
+++ b/doc/guides/rel_notes/release_26_11.rst
@@ -93,6 +93,15 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* **Increased maximum name sizes.**
+
+  * memzone: The maximum length of a memory zone name ``RTE_MEMZONE_NAMESIZE``
+    was increased from 32 to 64.
+  * mempool: The maximum length of a mempool name ``RTE_MEMPOOL_NAMESIZE`` incre    from 26 to 29.
+  * ring: The maximum length of a ring name ``RTE_RING_NAMESIZE`` was increased from 29 to 32.
+  * stack: The maximum length of a stack name ``RTE_STACK_NAMESIZE`` was increased from 28 to 32.
+  * rcu: The maximum length of a defer queue name ``RTE_RCU_QSBR_DQ_NAMESIZE`` increased from 29 to 32.
+
 
 ABI Changes
 -----------
@@ -109,6 +118,12 @@ ABI Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* **Increased size of names in structures.**
+
+  * memzone: Moved the zone name to the end of ``rte_memzone``
+    and expanded to 64 bytes. Other names in``rte_ring``,
+    ``rte_stack``, ``rte_mempool`` and ``rcu_dq_name`` also increased.
+
 
 Known Issues
 ------------
diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h
index 5a0e1b8a15..5aef676e3b 100644
--- a/lib/eal/include/rte_memzone.h
+++ b/lib/eal/include/rte_memzone.h
@@ -45,24 +45,21 @@ extern "C" {
  * A structure describing a memzone, which is a contiguous portion of
  * physical memory identified by a name.
  */
-struct __rte_packed_begin rte_memzone {
-
-#define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
-	char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
-
+struct rte_memzone {
 	rte_iova_t iova;                  /**< Start IO address. */
 	union {
 		void *addr;                   /**< Start virtual address. */
 		uint64_t addr_64;             /**< Makes sure addr is always 64-bits */
 	};
-	size_t len;                       /**< Length of the memzone. */
-
 	uint64_t hugepage_sz;             /**< The page size of underlying memory */
+	size_t len;                       /**< Length of the memzone. */
 
 	int32_t socket_id;                /**< NUMA socket ID. */
-
 	uint32_t flags;                   /**< Characteristics of this memzone. */
-} __rte_packed_end;
+
+#define RTE_MEMZONE_NAMESIZE 64           /**< Maximum length of memory zone name.*/
+	char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
+};
 
 /**
  * Set the maximum number of memzones.
diff --git a/lib/ring/rte_ring_core.h b/lib/ring/rte_ring_core.h
index 6cd6ce9884..cdd0ec4428 100644
--- a/lib/ring/rte_ring_core.h
+++ b/lib/ring/rte_ring_core.h
@@ -19,6 +19,7 @@
  * instead.
  */
 
+#include <assert.h>
 #include <stdalign.h>
 #include <stdio.h>
 #include <stdint.h>
@@ -46,8 +47,10 @@ enum rte_ring_queue_behavior {
 
 #define RTE_RING_MZ_PREFIX "RG_"
 /** The maximum length of a ring name. */
-#define RTE_RING_NAMESIZE (RTE_MEMZONE_NAMESIZE - \
-			   sizeof(RTE_RING_MZ_PREFIX) + 1)
+#define RTE_RING_NAMESIZE 32
+
+static_assert(RTE_RING_NAMESIZE <= RTE_MEMZONE_NAMESIZE - sizeof(RTE_RING_MZ_PREFIX) + 1,
+	      "rte_ring name size needs to fit in memzone with 3 character prefix");
 
 /** prod/cons sync types */
 enum rte_ring_sync_type {
diff --git a/lib/stack/rte_stack.h b/lib/stack/rte_stack.h
index fd17ac791d..0a74efad6c 100644
--- a/lib/stack/rte_stack.h
+++ b/lib/stack/rte_stack.h
@@ -15,6 +15,7 @@
 #ifndef _RTE_STACK_H_
 #define _RTE_STACK_H_
 
+#include <assert.h>
 #include <stdalign.h>
 
 #include <rte_debug.h>
@@ -25,8 +26,9 @@
 #define RTE_TAILQ_STACK_NAME "RTE_STACK"
 #define RTE_STACK_MZ_PREFIX "STK_"
 /** The maximum length of a stack name. */
-#define RTE_STACK_NAMESIZE (RTE_MEMZONE_NAMESIZE - \
-			   sizeof(RTE_STACK_MZ_PREFIX) + 1)
+#define RTE_STACK_NAMESIZE 32
+static_assert(RTE_STACK_NAMESIZE <= RTE_MEMZONE_NAMESIZE - sizeof(RTE_STACK_MZ_PREFIX) + 1,
+	      "rte_stack name size needs to fit in memzone with 4 character prefix");
 
 struct rte_stack_lf_elem {
 	void *data;			/**< Data pointer */
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-13 17:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13 17:12 [RFC] increase name sizes and reorder structures Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox