From 47b2b44b9fcc3aee99a3a93e24614f1910225098 Mon Sep 17 00:00:00 2001 From: Viacheslav Ovsiienko Date: Wed, 21 Apr 2021 08:10:13 +0000 Subject: [PATCH] net/mlx5: fix probing device in legacy bonding mode [ upstream commit ecaee305b811036d297eda04ad7c91d8349de77e ] If the device was configured as legacy bond one (without involving E-Switch), the mlx5 PMD erroneously tried to deduce the vport index raising the fatal error and preventing device from being used. The patch checks whether there is E-Switch present and we should use vport index indeed. Fixes: 2eb4d0107acc ("net/mlx5: refactor PCI probing on Linux") Fixes: d5c06b1b10ae ("net/mlx5: query vport index match mode and parameters") Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_os.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index b907e6de160..8ba6f03de08 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -982,7 +982,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, } if (devx_port.comp_mask & MLX5DV_DEVX_PORT_VPORT) { priv->vport_id = devx_port.vport_num; - } else if (spawn->pf_bond >= 0) { + } else if (spawn->pf_bond >= 0 && + (switch_info->representor || switch_info->master)) { DRV_LOG(ERR, "can't deduce vport index for port %d" " on bonding device %s", spawn->phys_port,