From: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>, <dev@dpdk.org>
Cc: "Anurag Mandal" <anurag.mandal@intel.com>,
"Morten Brørup" <mb@smartsharesystems.com>
Subject: Re: [PATCH v2 3/3] fib, rib: fix name prefixes
Date: Tue, 22 Sep 2026 20:46:40 +0100 [thread overview]
Message-ID: <30a4f88e-72c3-48bc-91cc-2f9ff7dfa108@intel.com> (raw)
In-Reply-To: <20260922155249.3115271-4-stephen@networkplumber.org>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
On 9/22/2026 4:52 PM, Stephen Hemminger wrote:
> From: Anurag Mandal <anurag.mandal@intel.com>
>
> 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")
>
> Signed-off-by: Anurag Mandal <anurag.mandal@intel.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> [stephen: recomputed the name length limits for 64 byte memzone
> names, dropped the now unneeded test, example and node renames]
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> 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(-)
>
> diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
> index 99847e9745..31de764a9d 100644
> --- a/doc/guides/rel_notes/release_26_11.rst
> +++ b/doc/guides/rel_notes/release_26_11.rst
> @@ -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
> -----------
> diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c
> index 184210f380..7a587820ad 100644
> --- a/lib/fib/rte_fib.c
> +++ b/lib/fib/rte_fib.c
> @@ -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();
> diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
> index 770becdb61..1a31ab09aa 100644
> --- a/lib/fib/rte_fib6.c
> +++ b/lib/fib/rte_fib6.c
> @@ -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();
> diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c
> index 046db131ca..55802f0060 100644
> --- a/lib/rib/rte_rib.c
> +++ b/lib/rib/rte_rib.c
> @@ -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();
> diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c
> index 918ddbdfd3..7d9a0ba36f 100644
> --- a/lib/rib/rte_rib6.c
> +++ b/lib/rib/rte_rib6.c
> @@ -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();
--
Regards,
Vladimir
prev parent reply other threads:[~2026-09-22 19:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 21:57 [PATCH] eal: increase memzone name size to 64 Stephen Hemminger
2026-09-22 10:42 ` Morten Brørup
2026-09-22 15:52 ` [PATCH v2 0/3] increase memzone name size and fix rib/fib prefixes Stephen Hemminger
2026-09-22 15:52 ` [PATCH v2 1/3] app/crypto-perf: fix asymmetric op pool name size Stephen Hemminger
2026-09-22 18:25 ` [EXTERNAL] " Akhil Goyal
2026-09-22 15:52 ` [PATCH v2 2/3] eal: increase memzone name size to 64 Stephen Hemminger
2026-09-22 15:52 ` [PATCH v2 3/3] fib, rib: fix name prefixes Stephen Hemminger
2026-09-22 19:46 ` Medvedkin, Vladimir [this message]
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=30a4f88e-72c3-48bc-91cc-2f9ff7dfa108@intel.com \
--to=vladimir.medvedkin@intel.com \
--cc=anurag.mandal@intel.com \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=stephen@networkplumber.org \
/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