Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4924020ybl; Tue, 4 Feb 2020 04:35:05 -0800 (PST) X-Google-Smtp-Source: APXvYqyxPxg233fAK/c/bjhMF7ae0FoEyUcvMj3oARDNSZ/hEAltmcFt5UPjrOdgS48b6tK2ev5V X-Received: by 2002:aca:e084:: with SMTP id x126mr3156301oig.97.1580819705303; Tue, 04 Feb 2020 04:35:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580819705; cv=none; d=google.com; s=arc-20160816; b=laC4sMtINRcjwjxLDhvv1LME6QvT9f3Jhmu1DN5KMhJMtI6TSH/mt/mtvowarO6QRO DJ/aGgc6d3k5nHtj53FH1WagTa1Ck/HdC6XbgNS59NzTiN9ll8OfWvawXOOz4Pysgkxo ogusuetcgwed3jG8XFZeJlocXg36MtvJZr4foacBkrHgK5iXzGPchcNOfoO80ar8YYfp sdIQw2PLJPyXYm5qfP0fMZc83WbQHwRMVTgGjCxf64dd6sNEXH+VJHrEXPOFxG/8ufps 1eved84w3c3mGBnodvveQk3jtDKAqbe1fMFIDrYUtyxnjzVr2xXH2ZHP3NX8iLECz7fg TSVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=BR0JgSmhFvAXjWF/NKcG43m4JDnQBhrVdEtmySfLwKk=; b=VrVqBeCtvi5ChjsaSIdGELdv7rBw3oBTb8ssO1PnBW2kUEo+XIxa6Ze9YeycJA/M9U Ywp7aXVXrlrkgmtIdNL9opwgWnqlFlQS0dZONesssQAkccrzFpzuC+LM0WH3QeIHW301 bywIt32jHEM0FmXk86FSFGva+Lds/Vk+o0bfhAf7boXaATmFwpyXtPH9XN43K7o5bFok BdTc8HhfPTuRtpybqWNYm/+xXiPjxdL8wpKfh5LpZNJwEbgvTMFcAFkpeQtkaonJ9ffh /AVG9iROYokRpQV2NRvzmtRF7JJYtMn5YH7SWhabwOAZILH9cE79ATLgzoNeWyklAS+K XTNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 12si10043028oiz.131.2020.02.04.04.34.49; Tue, 04 Feb 2020 04:35:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 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 S1727154AbgBDMet (ORCPT + 99 others); Tue, 4 Feb 2020 07:34:49 -0500 Received: from inva020.nxp.com ([92.121.34.13]:58614 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbgBDMes (ORCPT ); Tue, 4 Feb 2020 07:34:48 -0500 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 670E41CB9C9; Tue, 4 Feb 2020 13:34:46 +0100 (CET) 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 587201CB9C3; Tue, 4 Feb 2020 13:34:46 +0100 (CET) Received: from lorenz.ea.freescale.net (lorenz.ea.freescale.net [10.171.71.5]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 8B77E20569; Tue, 4 Feb 2020 13:34:45 +0100 (CET) From: Iuliana Prodan To: Herbert Xu , Baolin Wang , Ard Biesheuvel , Corentin Labbe , Horia Geanta , Maxime Coquelin , Alexandre Torgue , Maxime Ripard Cc: Aymen Sghaier , "David S. Miller" , Silvano Di Ninno , Franck Lenormand , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx , Iuliana Prodan Subject: [PATCH v2 0/2] crypto: engine - support for parallel and batch requests Date: Tue, 4 Feb 2020 14:34:18 +0200 Message-Id: <1580819660-30211-1-git-send-email-iuliana.prodan@nxp.com> X-Mailer: git-send-email 2.1.0 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 Added support for executing multiple, independent or not, requests for crypto engine. This is based on a callback, can_enqueue_more, which asks the driver if the hardware has free space, to enqueue a new request. If hardware supports batch requests, crypto-engine can handle this use-case through do_batch_requests callback. Since, these new features, cannot be supported by all hardware, the crypto-engine framework is backward compatible: - by using the crypto_engine_alloc_init function, to initialize crypto-engine, the new callbacks are NULL and the engine will work as before these changes; - to support only multiple requests, in parallel, the can_enqueue_more callback must be implemented in driver. On crypto_pump_requests, if can_enqueue_more callback returns true, a new request is send to hardware, until there is no space and the callback returns false. - to support batch requests, do_batch_requests callback must be implemented in driver, to execute a batch of requests. The link between the requests, is expected to be done in driver, in do_one_request(). Signed-off-by: Iuliana Prodan --- Changes since V1: - changed the name of can_enqueue_hardware callback to can_enqueue_more, and the argument of this callback to crypto_engine structure (for cases when more than ore crypto-engine is used). - added a new patch with support for batch requests. Changes since V0 (RFC): - removed max_no_req and no_req, as the number of request that can be processed in parallel; - added a new callback, can_enqueue_more, to check whether the hardware can process a new request. Iuliana Prodan (2): crypto: engine - support for parallel requests crypto: engine - support for batch requests crypto/crypto_engine.c | 121 ++++++++++++++++++++++++++++++++---------------- include/crypto/engine.h | 13 ++++-- 2 files changed, 90 insertions(+), 44 deletions(-) -- 2.1.0