[for-next] RDMA/hns: Fix unnecessary err return when using invalid congest control algorithm

Message ID 20231028093242.670325-1-huangjunxian6@hisilicon.com
State New
Headers
Series [for-next] RDMA/hns: Fix unnecessary err return when using invalid congest control algorithm |

Commit Message

Junxian Huang Oct. 28, 2023, 9:32 a.m. UTC
  Add a default congest control algorithm so that driver won't return
an error when the configured algorithm is invalid.

Fixes: f91696f2f053 ("RDMA/hns: Support congestion control type selection according to the FW")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
  

Comments

Leon Romanovsky Nov. 13, 2023, 8:39 a.m. UTC | #1
On Sat, 28 Oct 2023 17:32:42 +0800, Junxian Huang wrote:
> Add a default congest control algorithm so that driver won't return
> an error when the configured algorithm is invalid.
> 
> 

Applied, thanks!

[1/1] RDMA/hns: Fix unnecessary err return when using invalid congest control algorithm
      https://git.kernel.org/rdma/rdma/c/efb9cbf6644048

Best regards,
  

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 0cd2612a4987..2bca9560f32d 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -4760,10 +4760,15 @@  static int check_cong_type(struct ib_qp *ibqp,
 		cong_alg->wnd_mode_sel = WND_LIMIT;
 		break;
 	default:
-		ibdev_err(&hr_dev->ib_dev,
-			  "error type(%u) for congestion selection.\n",
-			  hr_dev->caps.cong_type);
-		return -EINVAL;
+		ibdev_warn(&hr_dev->ib_dev,
+			   "invalid type(%u) for congestion selection.\n",
+			   hr_dev->caps.cong_type);
+		hr_dev->caps.cong_type = CONG_TYPE_DCQCN;
+		cong_alg->alg_sel = CONG_DCQCN;
+		cong_alg->alg_sub_sel = UNSUPPORT_CONG_LEVEL;
+		cong_alg->dip_vld = DIP_INVALID;
+		cong_alg->wnd_mode_sel = WND_LIMIT;
+		break;
 	}
 
 	return 0;