From patchwork Tue Feb 19 09:06:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Ou X-Patchwork-Id: 10819511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4DB8139A for ; Tue, 19 Feb 2019 09:06:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B8122B506 for ; Tue, 19 Feb 2019 09:06:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F30B2B50F; Tue, 19 Feb 2019 09:06:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C1962B505 for ; Tue, 19 Feb 2019 09:06:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725805AbfBSJG1 (ORCPT ); Tue, 19 Feb 2019 04:06:27 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:4221 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727250AbfBSJG0 (ORCPT ); Tue, 19 Feb 2019 04:06:26 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 814E8104065FDF5C0141; Tue, 19 Feb 2019 17:06:24 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.408.0; Tue, 19 Feb 2019 17:06:16 +0800 From: Lijun Ou To: , CC: , , Subject: [PATCH V2 rdma-core 1/5] libhns: CQ depth does not support 0 Date: Tue, 19 Feb 2019 17:06:37 +0800 Message-ID: <1550567201-226345-2-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1550567201-226345-1-git-send-email-oulijun@huawei.com> References: <1550567201-226345-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: chenglang 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 --- 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; }