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"); + /** * Register all mp action callbacks for hotplug. * -- 2.55.0

