Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp52953ybk; Tue, 19 May 2020 15:18:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhhExG4L08KeYTTA/yRgKZWJZGG5Yu39K0hSlm0VEbSF/E6WdUc/vf9ZDnqOJU8S2CTf1P X-Received: by 2002:a50:8dc2:: with SMTP id s2mr862932edh.318.1589926689509; Tue, 19 May 2020 15:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589926689; cv=none; d=google.com; s=arc-20160816; b=cqS5uW1E9B1Ww5J28h67nSjHYzuGxZYNnd+5uWksMWlDp+m3I+lIIprYxsKW5VCo7q M6Vg2g5DxCJD7WHsiRmeFhzQiTaC935cqHfeC8g6EzvLHDraNKawFtxVm84HPlkzWsaU PkbtTwYMcM/44an9d4Xl13Yc0JK2hdsNsjKxDHt7cPSCShk8idiYNm9xBYaExJpmKYR+ IBwQdsnugZDQR/8n2njrYKSwLERQ3hJCCfvrMrCcEEt7nhjdgvC1EhXYfXybbbwfDoEW ZXDrszApbZjfomCIYDe8WJC37j25ESI5Rf/CYvveU9FApkMvHTQots44jPUgT24tSaMi UQmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=SULp0ncMa85YgT6roituOW+9BD0SZhjagqTbljj7kQU=; b=X/pZB3Zaqt6FwXEbG+ifV41qUbKKa6dG9IBrA7otAtOAfz+OIQR8fQYZNIFi3ZGVkW 7SGyQVE2D/VvUPWf8r4iwFuHUA65tAgR1y5uIQOnKLAswpCgvZa8AFFzvj6WuOx3wZWf KPYYjo21itxYLeJTRUHmAOYOlztQLX1zdy4DfOI3dJsj0KXNSipfbbmbjQVVHlat3MCv ZCkJFSGhLTE4vPp2tnzc2XS2PiOECSUps3YrVz8MXKTifXf5WyGxgHbWnwhlp7oC/mvG 9WRVHmMzukzUuaU4/E6AXlfC/J+ykvDiqHCRwbv+wHGfAyJ2gRkJrMoSKJ0zGnJ46vrC O0OA== 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 g4si525086edn.285.2020.05.19.15.17.40; Tue, 19 May 2020 15:18:09 -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 S1726318AbgESWRh (ORCPT + 99 others); Tue, 19 May 2020 18:17:37 -0400 Received: from inva020.nxp.com ([92.121.34.13]:51048 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725998AbgESWRg (ORCPT ); Tue, 19 May 2020 18:17:36 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8BC8E1A011F; Wed, 20 May 2020 00:17:34 +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 7CCC11A021B; Wed, 20 May 2020 00:17:34 +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 C76B320564; Wed, 20 May 2020 00:17:33 +0200 (CEST) From: Iuliana Prodan To: Herbert Xu , Baolin Wang , Ard Biesheuvel , Horia Geanta Cc: Aymen Sghaier , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx , Iuliana Prodan Subject: [PATCH] crypto: engine - do not requeue in case of fatal error Date: Wed, 20 May 2020 01:17:25 +0300 Message-Id: <1589926645-32686-1-git-send-email-iuliana.prodan@nxp.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Now, in crypto-engine, if hardware queue is full (-ENOSPC), requeue request regardless of MAY_BACKLOG flag. If hardware throws any other error code (like -EIO, -EINVAL, -ENOMEM, etc.) only MAY_BACKLOG requests are enqueued back into crypto-engine's queue, since the others can be dropped. The latter case can be fatal error, so those cannot be recovered from. For example, in CAAM driver, -EIO is returned in case the job descriptor is broken, so there is no possibility to fix the job descriptor. Therefore, these errors might be fatal error, so we shouldn’t requeue the request. This will just be pass back and forth between crypto-engine and hardware. Fixes: 6a89f492f8e5 ("crypto: engine - support for parallel requests based on retry mechanism") Signed-off-by: Iuliana Prodan --- crypto/crypto_engine.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c index 412149e..3655d9d 100644 --- a/crypto/crypto_engine.c +++ b/crypto/crypto_engine.c @@ -169,13 +169,10 @@ static void crypto_pump_requests(struct crypto_engine *engine, /* * If hardware queue is full (-ENOSPC), requeue request * regardless of backlog flag. - * If hardware throws any other error code, - * requeue only backlog requests. * Otherwise, unprepare and complete the request. */ if (!engine->retry_support || - ((ret != -ENOSPC) && - !(async_req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG))) { + (ret != -ENOSPC)) { dev_err(engine->dev, "Failed to do one request from queue: %d\n", ret); -- 2.1.0