From: Xueming Li Date: Wed, 21 Jul 2021 14:37:36 +0000 (+0800) Subject: net/mlx5: check maximum Verbs port number X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cdfdb82d0b361d9e0848917b0ed6e9cf30e46dd1;p=dpdk.git net/mlx5: check maximum Verbs port number Verbs API doesn't support device port number larger than 255 by design. Add check and fail probing with proper error log. Signed-off-by: Xueming Li Acked-by: Viacheslav Ovsiienko --- diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index f041f9054f..db44169b84 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1294,6 +1294,12 @@ err_secondary: config->dv_flow_en = 0; } #endif + if (spawn->max_port > UINT8_MAX) { + /* Verbs can't support ports larger than 255 by design. */ + DRV_LOG(ERR, "can't support IB ports > UINT8_MAX"); + err = EINVAL; + goto error; + } config->ind_table_max_size = sh->device_attr.max_rwq_indirection_table_size; /*