net/mlx5: fix query host adapter if no DevX enabled

Message ID 1555936697-1096-1-git-send-email-viacheslavo@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Shahaf Shuler
Headers
Series net/mlx5: fix query host adapter if no DevX enabled |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Slava Ovsiienko April 22, 2019, 12:38 p.m. UTC
  If there is the support of DevX is exposed by rdma-core but
DevX is not supported by or disabled for the specific interface
the mlx5_devx_cmd_query_hca_attr() routine returns an error
preventing the device from successful probing. The routine
should be invoked only in case of enabled DevX.

Fixes: e2b4925ef7c1 ("net/mlx5: support Direct Rules E-Switch")
Cc: Ori Kam <orika@mellanox.com>

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Comments

Shahaf Shuler April 22, 2019, 5:46 p.m. UTC | #1
Monday, April 22, 2019 3:38 PM, Viacheslav Ovsiienko:
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix query host adapter if no DevX
> enabled
> 
> If there is the support of DevX is exposed by rdma-core but DevX is not
> supported by or disabled for the specific interface the
> mlx5_devx_cmd_query_hca_attr() routine returns an error preventing the
> device from successful probing. The routine should be invoked only in case of
> enabled DevX.
> 
> Fixes: e2b4925ef7c1 ("net/mlx5: support Direct Rules E-Switch")
> Cc: Ori Kam <orika@mellanox.com>
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

Applied to next-net-mlx, thanks.
  

Patch

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 46ca08a..3f43022 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1517,10 +1517,12 @@  struct mlx5_dev_spawn_data {
 	 */
 	mlx5_link_update(eth_dev, 0);
 #ifdef HAVE_IBV_DEVX_OBJ
-	err = mlx5_devx_cmd_query_hca_attr(sh->ctx, &config.hca_attr);
-	if (err) {
-		err = -err;
-		goto error;
+	if (config.devx) {
+		err = mlx5_devx_cmd_query_hca_attr(sh->ctx, &config.hca_attr);
+		if (err) {
+			err = -err;
+			goto error;
+		}
 	}
 #endif
 #ifdef HAVE_MLX5DV_DR_ESWITCH