Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5372097pxu; Wed, 21 Oct 2020 23:49:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd7jyC84KRWreXzQm6k/uQ+wPCpX+k7gCmHQP2Gy3irB/MGnVqjx3KOZcgDoff1zjDzW+j X-Received: by 2002:aa7:c7cf:: with SMTP id o15mr868906eds.15.1603349347363; Wed, 21 Oct 2020 23:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603349347; cv=none; d=google.com; s=arc-20160816; b=DcbsZwAaHeBxiTPX0bJqjdPqmwiejKC8w3+bUTbgTw5XW0mKUdpXeL7CMJg2ItqYVk qtcs8rCcG2ckesxB1A2qbM4QbbkPyfGqq44jJ5j4pZdxbS9x2/zuhdGBX4UKKivCMt6Y +/VnJ+DHu4FRlcjKQoNfPQG9PjcpMnAMHPAlUN3ilPBg3XNThAJN+qbxqNt6lZBCXzoJ 2mndFbuQuCJ2eiV+ZHpBB7tqThvYiqzsTDgnynSJalpxMCF+eX+4C1dBKOTARYmsjIbu +5tdkicJeMt2jQlbgOVJARDgBKQZuobdPtGsuIFBo2d0WE78cMLeMQOL/pSMfvTXISAy +M4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=aC6oPRyEIJrYm98u9NXLKQHdSPgATx+nD5TPP6pjauw=; b=QVLctc3Zm5fRjns/xo3JKcXRaOvvSRBblwU3ZNSJGIlW0EaYxpnjuP83bQXrmhRHfd uYB6L6ALx14xDsSXlwatn2xeNG412KdQUVUxeeJXxyGEu7ddFSOw2w8oDiNjEPYNMZuJ TMq4JcLu7E0ul6+S1JLfbV2mA0DR8oo2cTbaXLAZ+Q+fQn2KeZBnirA5WHg7NizVxlTh SV80jYpAfaeABAFxq98Y0AdBoH81882oZU8FsZ5Q+Za3MPTlD+hfl1VSvIu5q3qYTOMq F+npKtFumHOH8WGcX0DpGGeuhw1IFxoXkvWgNh4yW0kJKJuLKmgqdTS7YTlobE0T6yhU +JHg== 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si313803ejf.15.2020.10.21.23.48.42; Wed, 21 Oct 2020 23:49:07 -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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505080AbgJUUHI (ORCPT + 99 others); Wed, 21 Oct 2020 16:07:08 -0400 Received: from inva020.nxp.com ([92.121.34.13]:47712 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505078AbgJUUHI (ORCPT ); Wed, 21 Oct 2020 16:07:08 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 384CB1A0A84; Wed, 21 Oct 2020 22:07:06 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2BA461A0C34; Wed, 21 Oct 2020 22:07:06 +0200 (CEST) Received: from lorenz.ea.freescale.net (lorenz.ea.freescale.net [10.171.71.5]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id AB7E02033F; Wed, 21 Oct 2020 22:07:05 +0200 (CEST) From: Iuliana Prodan To: Herbert Xu , Horia Geanta , Aymen Sghaier Cc: "David S. Miller" , Silvano Di Ninno , Franck Lenormand , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx , Andrei Botila , Dragos Rosioru , Iuliana Prodan Subject: [PATCH] crypto: caam - enable crypto-engine retry mechanism Date: Wed, 21 Oct 2020 23:06:50 +0300 Message-Id: <1603310810-25307-1-git-send-email-iuliana.prodan@nxp.com> X-Mailer: git-send-email 2.1.0 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Use the new crypto_engine_alloc_init_and_set() function to initialize crypto-engine and enable retry mechanism. Set the maximum size for crypto-engine software queue based on Job Ring size (JOBR_DEPTH) and a threshold (reserved for the non-crypto-API requests that are not pass through crypto-engine). The callback for do_batch_requests is NULL, since CAAM doesn't support linked requests. Signed-off-by: Iuliana Prodan --- drivers/crypto/caam/intern.h | 3 +++ drivers/crypto/caam/jr.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h index 9112279..44fe6ee 100644 --- a/drivers/crypto/caam/intern.h +++ b/drivers/crypto/caam/intern.h @@ -16,6 +16,9 @@ /* Currently comes from Kconfig param as a ^2 (driver-required) */ #define JOBR_DEPTH (1 << CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE) +#define THRESHOLD 15 +#define CRYPTO_ENGINE_MAX_QLEN (2 * (JOBR_DEPTH - THRESHOLD)) + /* Kconfig params for interrupt coalescing if selected (else zero) */ #ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_INTC #define JOBR_INTC JRCFG_ICEN diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 6f66996..88540c9 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -550,7 +550,11 @@ static int caam_jr_probe(struct platform_device *pdev) } /* Initialize crypto engine */ - jrpriv->engine = crypto_engine_alloc_init(jrdev, false); + jrpriv->engine = crypto_engine_alloc_init_and_set(jrdev, + true, + NULL, + false, + CRYPTO_ENGINE_MAX_QLEN); if (!jrpriv->engine) { dev_err(jrdev, "Could not init crypto-engine\n"); return -ENOMEM; -- 2.1.0