Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2132948pxf; Sat, 27 Mar 2021 03:31:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjCBYWdoD44LxPgI9c29sKTJXCYIq/Dj3caWV6TNo6eV0CyqSTI9Y2HsF1ElCvCQDk6NjH X-Received: by 2002:a05:6402:b41:: with SMTP id bx1mr19899613edb.69.1616841077009; Sat, 27 Mar 2021 03:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616841077; cv=none; d=google.com; s=arc-20160816; b=InQ/ojhLqFNjlWZIGbUjPUYbd54Xb0TF4JIMsqzUooqrZKgGOtEgYibjE3cQUdUH8P 3QvR8PAU12jdpIHpUO2wtKR79lpuVRI2Ntfu1MOc/qqVYfCeorwqMFZxmesPRdDVyAwf EipncJGYxWIj7UcZtmP1FcUl0HhfK1DupSD3e9GbcgHqTLFJ3pQZfodHp6CnjJfezAVh sJ8e+u6+UEtMVekHYLb5HNGCXTXOGy4XPl4Ijfdvup4+KeqHcvLos7STnQXsomuMg+H3 Hjg7TzP0DsLnKFXAi8zqvBDb32FkB0PQ5b7w/My5jcC1T0PLYlgMK/kSFvjEIi9EKHzc wWyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=RM0ZJs6hmq7wH/OgyETPfl59XM4cN44MCswdvx1CjAU=; b=DstaoUhBuHJKhmg3G44jPy5G1RMkSBDiozHrxhPZG3Lnez2gBLONaJC8K11UEkEmGQ TQ9KMHFZNMpIiyhHmSNTzmSxUvW2K2CR8c+CTJq0C1WuPI9T+pHfLLbbhMp39eL1lPTL /L6nDOZEcMsXxpmza9JeE1F4xaAKDpkmkLa+ztAoLgm81jQSyBXdNbacZoioaidohorj jsO3GZdSNQneQrPDzRB9bEbj01/tKFS2AiojbDsIPf/4NqHMQsd4cYhKu4zM4zWeQ1nL WtRnsmhRDxWoPdicETF5oYW46TDy1H+zY6fMzycJ2gkKUrLvHLw+u+hGW4SyYRloI7l0 Rk7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si8420514edq.273.2021.03.27.03.30.53; Sat, 27 Mar 2021 03:31:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbhC0Kau (ORCPT + 99 others); Sat, 27 Mar 2021 06:30:50 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:15360 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbhC0Kat (ORCPT ); Sat, 27 Mar 2021 06:30:49 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4F6w6g1tn9z8yLf; Sat, 27 Mar 2021 18:28:43 +0800 (CST) Received: from huawei.com (10.67.165.24) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Sat, 27 Mar 2021 18:30:37 +0800 From: Longfang Liu To: , CC: , , Subject: [PATCH] crypto: hisilicon/sec - Fix a module parameter error Date: Sat, 27 Mar 2021 18:28:10 +0800 Message-ID: <1616840890-12094-1-git-send-email-liulongfang@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org ctx_q_num is a module parameter set by the user to specify the number of qp queues required to create a ctx. When the number of qp queues allocated by PF or VF is less than the ctx_q_num, an error will be reported when ctx is initialized in kernel mode, which leads to the problem that the registered algorithms cannot be used. Therefore, when PF or VF is initialized, if the number of qp queues is not enough to create a ctx, the kernel mode cannot be used, and there is no need to register the kernel mode algorithms. Signed-off-by: Longfang Liu --- drivers/crypto/hisilicon/sec2/sec_main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c index b1818f7..c7b71b6 100644 --- a/drivers/crypto/hisilicon/sec2/sec_main.c +++ b/drivers/crypto/hisilicon/sec2/sec_main.c @@ -867,10 +867,15 @@ static int sec_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) pci_warn(pdev, "Failed to init debugfs!\n"); - ret = hisi_qm_alg_register(qm, &sec_devices); - if (ret < 0) { - pr_err("Failed to register driver to crypto.\n"); - goto err_qm_stop; + if (qm->qp_num >= ctx_q_num) { + ret = hisi_qm_alg_register(qm, &sec_devices); + if (ret < 0) { + pr_err("Failed to register driver to crypto.\n"); + goto err_qm_stop; + } + } else { + pci_warn(qm->pdev, + "Failed to use kernel mode, qp not enough!\n"); } if (qm->uacce) { -- 2.8.1