Thread (108 messages) 108 messages, 7 authors, 2021-07-22

[dpdk-dev] [PATCH v3 09/15] net/mlx5: check max Verbs port number

From: Xueming Li <hidden>
Date: 2021-07-19 02:55:56
Subsystem: networking drivers, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help