06/11/2026 10:58, David Marchand:
> On Tue, 3 Nov 2026 at 18:07, Thomas Monjalon <[email protected]> wrote:
> >
> > Derive the hotplug devargs buffer size from the IPC parameter capacity.
> > This increases the maximum devargs length in multi-process mode
> > from 127 to 247 bytes, excluding the terminating null byte.
> >
> > Signed-off-by: Thomas Monjalon <[email protected]>
> > ---
> >  lib/eal/common/eal_common_dev.c | 2 +-
> >  lib/eal/common/hotplug_mp.h     | 8 +++++++-
> >  2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/eal/common/eal_common_dev.c 
> > b/lib/eal/common/eal_common_dev.c
> > index f42a8d2349..febb584313 100644
> > --- a/lib/eal/common/eal_common_dev.c
> > +++ b/lib/eal/common/eal_common_dev.c
> > @@ -276,7 +276,7 @@ rte_dev_probe(const char *devargs)
> >                 goto skip_mp_req;
> >
> >         if (strlen(devargs) >= EAL_DEV_MP_DEV_ARGS_MAX_LEN) {
> > -               EAL_LOG(ERR, "devargs truncated (len %zu, max %d)",
> > +               EAL_LOG(ERR, "devargs truncated (len %zu, max %zu)",
> >                         strlen(devargs), EAL_DEV_MP_DEV_ARGS_MAX_LEN);
> >                 return -E2BIG;
> >         }
> > diff --git a/lib/eal/common/hotplug_mp.h b/lib/eal/common/hotplug_mp.h
> > index 7221284286..bd2f0f296a 100644
> > --- a/lib/eal/common/hotplug_mp.h
> > +++ b/lib/eal/common/hotplug_mp.h
> > @@ -5,6 +5,7 @@
> >  #ifndef _HOTPLUG_MP_H_
> >  #define _HOTPLUG_MP_H_
> >
> > +#include "rte_eal.h"
> >  #include "rte_dev.h"
> >
> >  #define EAL_DEV_MP_ACTION_REQUEST      "eal_dev_mp_request"
> > @@ -12,7 +13,9 @@
> >
> >  #define EAL_DEV_MP_DEV_NAME_MAX_LEN RTE_DEV_NAME_MAX_LEN
> >  #define EAL_DEV_MP_BUS_NAME_MAX_LEN 32
> > -#define EAL_DEV_MP_DEV_ARGS_MAX_LEN 128
> > +#define EAL_DEV_MP_DEV_ARGS_MAX_LEN (RTE_MP_MAX_PARAM_LEN \
> > +       - sizeof(enum eal_dev_req_type) - sizeof(int))
> > +       /* minus t and result from struct eal_dev_mp_req */
> >
> >  enum eal_dev_req_type {
> >         EAL_DEV_REQ_TYPE_ATTACH,
> > @@ -27,6 +30,9 @@ struct eal_dev_mp_req {
> >         int result;
> >  };
> >
> > +static_assert(sizeof(struct eal_dev_mp_req) <= RTE_MP_MAX_PARAM_LEN,
> > +       "Hotplug message struct exceeds IPC parameter capacity");
> > +
> 
> A bit ugly to list those fields, even with the assert.
> 
> No strong opinion, just listing an alternative.
> 
> The idea is to switch to a flexible array for devargs.
> 
>  struct eal_dev_mp_req {
>      enum eal_dev_req_type t;
> -    char devargs[EAL_DEV_MP_DEV_ARGS_MAX_LEN];
>      int result;
> +    char devargs[];
>  };
> 
> +#define EAL_DEV_MP_DEV_ARGS_MAX_LEN \
> +    (RTE_MP_MAX_PARAM_LEN - sizeof(struct eal_dev_mp_req))
> 
> 
> This requires an update of
> eal_dev_hotplug_request_to_primary/eal_dev_hotplug_request_to_secondary
> so they manipulate a rte_mp_msg object.
> A bonus side effect is that it avoids copies on stack for the message,
> as the caller already provides the message buffer.

Yes it looks better.


Reply via email to