Anurag raised an interesting question regarding Bug 1980 [1], which got me 
thinking...

Now that the max mempool name length has increased by three bytes, it is safe 
to reduce by one byte without breaking existing applications using long mempool 
names.

How about adding a modification of rte_mempool.h [2] like this (untested), to 
fix Bug 1980 (at least for stack drivers):

-/**< Maximum length of a memory pool's name. */
-#define RTE_MEMPOOL_NAMESIZE (RTE_RING_NAMESIZE - \
-                             sizeof(RTE_MEMPOOL_MZ_PREFIX) + 1)

+/**
+ * Maximum length of a memory pool's name.
+ *
+ * Needs room for memzone prefix indicating "mempool" type:
+ * "MP_<name>"
+ * Note:
+ * The mempool driver needs room for its own memzone prefix too, e.g.:
+ * "RG_MP_<name>" (ring driver) or "STK_MP_<name>" (stack driver)
+ * In order to fail early on too long names when creating the mempool,
+ * the length of the memzone name reserved by various mempool drivers are
+ * not considered; only the ring and stack drivers are considered here.
+ * If the name eventually turns out to be too long for the chosen mempool 
driver,
+ * populating the mempool will fail.
+ */
+#define RTE_MEMPOOL_OPS_REPRESENTATIVE_NAMESIZE \
+               RTE_MAX(RTE_RING_NAMESIZE, RTE_STACK_NAMESIZE)
+#define RTE_MEMPOOL_NAMESIZE \
+               (RTE_MEMPOOL_OPS_REPRESENTATIVE_NAMESIZE - \
+               (sizeof(RTE_MEMPOOL_MZ_PREFIX) - 1))

[1]: https://bugs.dpdk.org/show_bug.cgi?id=1980
[2]: 
https://elixir.bootlin.com/dpdk/v26.07/source/lib/mempool/rte_mempool.h#L130


Then, the release notes should be updated too:
-  * mempool: The maximum length of a mempool name ``RTE_MEMPOOL_NAMESIZE`` 
increased from 26 to 29.
-  * mempool: The maximum length of a mempool name ``RTE_MEMPOOL_NAMESIZE`` 
increased from 26 to 28.

Reply via email to