Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp344685pxa; Tue, 4 Aug 2020 07:04:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrhMbRt3S6b08rwSWVdyYnQ7nNvnFSWQWV5zDzYOTmbrOVg0CwoiAJjoh/P9zq4QWS6cay X-Received: by 2002:a17:906:3ac4:: with SMTP id z4mr20453948ejd.65.1596549884309; Tue, 04 Aug 2020 07:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596549884; cv=none; d=google.com; s=arc-20160816; b=KgQjdZSs20pimncYGp/Ym3JGNuTKhy70+gOebW2+zScv8f/60v9RFgIOtxjTFgdL1U 2T3Zcm69N4+WdPDXLCxzK2P9zqn3Ya3sPr6tFnE087CQJ05BR613Ve9hu1J1PJNX5yjs vk4SP3H1OJwbXWo0q7QQOrNqwhiY7IB0oyS0hXfDSu5rdKoZHWWPGlVc6/JlAhTyo1x8 dmwJQfWFdDxA0WlVf4K59OklCAq8ke1djvHiU9JuMVgL4ghG3yAwSvpW0dKfRj77WUO1 JE1wp3krH/DcoUf7KMKxeXLbsrq6UMEXGwBiOnRyqUuR367uz8X/r7aG4bkO3iToGFp3 5irA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=tS++On5n6dPT0wGkfJ70X6NQV6p3IKFxCFm44bfRQtM=; b=Em7pBYYt4Dt57i09vcOSfcEQy0SuTI0Us/qivQO2qvDQ0gLzktSKxvQZvCb263H+BU BNHWHO9jVq5fCzQr4pSMGcdyDjN18lMyqzoC4hA8X4Bfw0EAW82W9wcMoXjf6/tFjwFD wtFMAdBh3ZjvwNQ4gxAEc1G05a7oPUIYTPdkc1CElNBYM68mqZFWl89u7jtoIHkxhvON 7AubRX1cu78Pn+dppB4w2Ea3a/smWtqcjkh+sxp84LcduKjxxNfFV0CXm99M6QPbIH34 oaS4mfklg3CekaDlH/IHwrHazg/lJUOqgSqv1D7rUAi1MCkRTgyr/ZBfbIlissaqbcxM 0+xQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si5435089edr.58.2020.08.04.07.04.07; Tue, 04 Aug 2020 07:04:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728634AbgHDODu (ORCPT + 99 others); Tue, 4 Aug 2020 10:03:50 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:60700 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728740AbgHDOAm (ORCPT ); Tue, 4 Aug 2020 10:00:42 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id A3CEA81ADB8BCB1E0240; Tue, 4 Aug 2020 22:00:38 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Tue, 4 Aug 2020 22:00:31 +0800 From: Yang Shen To: , CC: , , , Subject: [PATCH v4 04/10] crypto: hisilicon/qm - fix judgement of queue is full Date: Tue, 4 Aug 2020 21:58:24 +0800 Message-ID: <1596549510-2373-5-git-send-email-shenyang39@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596549510-2373-1-git-send-email-shenyang39@huawei.com> References: <1596549510-2373-1-git-send-email-shenyang39@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hui Tang The queue depth is 1024, so the condition for judging the queue full should be 1023, otherwise the hardware cannot judge whether the queue is empty or full. Fixes: 263c9959c937("crypto: hisilicon - add queue management driver...") Signed-off-by: Hui Tang Signed-off-by: Yang Shen Reviewed-by: Zhou Wang --- drivers/crypto/hisilicon/qm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 406fca3..9a5a114 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -1646,7 +1646,7 @@ static void *qm_get_avail_sqe(struct hisi_qp *qp) struct hisi_qp_status *qp_status = &qp->qp_status; u16 sq_tail = qp_status->sq_tail; - if (unlikely(atomic_read(&qp->qp_status.used) == QM_Q_DEPTH)) + if (unlikely(atomic_read(&qp->qp_status.used) == QM_Q_DEPTH - 1)) return NULL; return qp->sqe + sq_tail * qp->qm->sqe_size; -- 2.7.4