git: 0312449c67a8 - stable/14 - mlx5: Fix HCA cap 2 query

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 06 Dec 2023 00:28:24 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=0312449c67a841ca73f0b54307112724ce5b9875

commit 0312449c67a841ca73f0b54307112724ce5b9875
Author:     Patrisious Haddad <phaddad@nvidia.com>
AuthorDate: 2023-05-11 09:48:26 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-12-06 00:27:14 +0000

    mlx5: Fix HCA cap 2 query
    
    (cherry picked from commit 0cd90ee598cef68cef72db8b912241868d1067d0)
---
 sys/dev/mlx5/mlx5_core/mlx5_main.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c
index efaf726e19e5..f6dc1158f085 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_main.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c
@@ -561,39 +561,15 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
 
 static int handle_hca_cap_2(struct mlx5_core_dev *dev)
 {
-	void *set_ctx;
-	void *set_hca_cap;
-	int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
 	int err;
 
 	if (MLX5_CAP_GEN_MAX(dev, hca_cap_2)) {
 		err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL_2);
 		if (err)
 			return err;
-	} else {
-		return 0;
 	}
 
-	/* To be added if sw_vhca support was added */
-	/*if (!MLX5_CAP_GEN_2_MAX(dev, sw_vhca_id_valid) ||
-	    !(dev->priv.sw_vhca_id > 0))
-		return 0;*/
-
-	set_ctx = kzalloc(set_sz, GFP_KERNEL);
-	if (!set_ctx)
-		return -ENOMEM;
-
-	MLX5_SET(set_hca_cap_in, set_ctx, op_mod,
-		 MLX5_CAP_GENERAL_2 << 1);
-	set_hca_cap = MLX5_ADDR_OF(set_hca_cap_in, set_ctx, capability);
-	memcpy(set_hca_cap, dev->hca_caps_cur[MLX5_CAP_GENERAL_2],
-	       MLX5_ST_SZ_BYTES(cmd_hca_cap_2));
-	//MLX5_SET(cmd_hca_cap_2, set_hca_cap, sw_vhca_id_valid, 1);
-
-	err = set_caps(dev, set_ctx, set_sz);
-
-	kfree(set_ctx);
-	return err;
+	return 0;
 }
 
 static int set_hca_ctrl(struct mlx5_core_dev *dev)