diff mbox series

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

Message ID 1550307813-151285-2-git-send-email-oulijun@huawei.com (mailing list archive)
State Superseded
Headers show
Series Misc updates for libhns | expand

Commit Message

Lijun Ou Feb. 16, 2019, 9:03 a.m. UTC
From: chenglang <chenglang@huawei.com>

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@huawei.com>
---
 providers/hns/hns_roce_u_verbs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

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;
 }