[dpdk-dev] [PATCH v3 09/15] net/mlx5: check max Verbs port number
Xueming Li
xuemingl at nvidia.com
Mon Jul 19 04:54:04 CEST 2021
Verbs API doesn't support Device port number larger than 255 by design.
Adds check and fails probing with proper error log.
Signed-off-by: Xueming Li <xuemingl at nvidia.com>
---
drivers/net/mlx5/linux/mlx5_os.c | 6 ++++++
1 file changed, 6 insertions(+)
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 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
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;
/*
--
2.25.1
More information about the dev
mailing list