diff mbox series

[rdma-next] RDMA/mlx5: Consider the query_vuid cap for data_direct

Message ID 274c4f6f1ac0b1078243dd296695a49dbe58e7d1.1725907637.git.leonro@nvidia.com (mailing list archive)
State Accepted
Headers show
Series [rdma-next] RDMA/mlx5: Consider the query_vuid cap for data_direct | expand

Commit Message

Leon Romanovsky Sept. 9, 2024, 6:47 p.m. UTC
From: Yishai Hadas <yishaih@nvidia.com>

Consider also the query_vuid cap before enabling the data_direct
functionality.

This may prevent a syndrome from the FW in case the query_vuid command
is not supported. (e.g. migratable VF)

Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Reviewed-by: Gal Shalom <galshalom@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/mlx5/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Leon Romanovsky Sept. 11, 2024, 12:27 p.m. UTC | #1
On Mon, 09 Sep 2024 21:47:33 +0300, Leon Romanovsky wrote:
> Consider also the query_vuid cap before enabling the data_direct
> functionality.
> 
> This may prevent a syndrome from the FW in case the query_vuid command
> is not supported. (e.g. migratable VF)
> 
> 
> [...]

Applied, thanks!

[1/1] RDMA/mlx5: Consider the query_vuid cap for data_direct
      https://git.kernel.org/rdma/rdma/c/07a316d64a1a53

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index b182248f2e79..b4476df96ed5 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -3571,7 +3571,8 @@  static int mlx5_ib_data_direct_init(struct mlx5_ib_dev *dev)
 	char vuid[MLX5_ST_SZ_BYTES(array1024_auto) + 1] = {};
 	int ret;
 
-	if (!MLX5_CAP_GEN(dev->mdev, data_direct))
+	if (!MLX5_CAP_GEN(dev->mdev, data_direct) ||
+	    !MLX5_CAP_GEN_2(dev->mdev, query_vuid))
 		return 0;
 
 	ret = mlx5_cmd_query_vuid(dev->mdev, true, vuid);
@@ -3592,7 +3593,8 @@  static int mlx5_ib_data_direct_init(struct mlx5_ib_dev *dev)
 
 static void mlx5_ib_data_direct_cleanup(struct mlx5_ib_dev *dev)
 {
-	if (!MLX5_CAP_GEN(dev->mdev, data_direct))
+	if (!MLX5_CAP_GEN(dev->mdev, data_direct) ||
+	    !MLX5_CAP_GEN_2(dev->mdev, query_vuid))
 		return;
 
 	mlx5_data_direct_ib_unreg(dev);