[PATCH rdma-core 1/5] libhns: CQ depth does not support 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: chenglang <chenglang@xxxxxxxxxx>

When the user configures the CQ depth to be less than 64,
the driver would set the CQ depth to 64. The hip0x series
does not support user configuration 0. So we modify the
user mode driver to unify the parameter range.

Signed-off-by: chenglang <chenglang@xxxxxxxxxx>
---
 providers/hns/hns_roce_u_verbs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index 05c2a8e..e2e27a6 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -304,6 +304,9 @@ static int hns_roce_verify_cq(int *cqe, struct hns_roce_context *context)
 	struct hns_roce_device *hr_dev =
 		to_hr_dev(context->ibv_ctx.context.device);
 
+	if (*cqe < 1 || *cqe > context->max_cqe)
+		return -1;
+
 	if (hr_dev->hw_version == HNS_ROCE_HW_VER1)
 		if (*cqe < HNS_ROCE_MIN_CQE_NUM) {
 			fprintf(stderr,
@@ -312,9 +315,6 @@ static int hns_roce_verify_cq(int *cqe, struct hns_roce_context *context)
 			*cqe = HNS_ROCE_MIN_CQE_NUM;
 		}
 
-	if (*cqe > context->max_cqe)
-		return -1;
-
 	return 0;
 }
 
-- 
2.8.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux