[4/8] net/mlx5: check DevX to support more Verb ports

Message ID 20210927083256.337450-5-xuemingl@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: support more than 255 representors |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Xueming Li Sept. 27, 2021, 8:32 a.m. UTC
  Verbs API doesn't support device port number larger than 255 by design.

To support more VF or SubFunction port representors, forces DevX api
check when max ports larger than 255.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_os.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 79ab789df43..e9256ad5245 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1344,9 +1344,16 @@  mlx5_dev_spawn(struct rte_device *dpdk_dev,
 #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;
+#ifdef HAVE_MLX5DV_DEVX_UAR_OFFSET
+		if (!config->dv_flow_en || !config->dv_esw_en) {
+			DRV_LOG(INFO, "must enable DV and ESW when IB ports > 255");
+#else
+		{
+			DRV_LOG(ERR, "DevX does not provide UAR offset, can't support IB ports > UINT8_MAX");
+#endif
+			err = EINVAL;
+			goto error;
+		}
 	}
 	config->ind_table_max_size =
 		sh->device_attr.max_rwq_indirection_table_size;