From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: alexandre.torgue@st.com, davem@davemloft.net,
herbert@gondor.apana.org.au, mcoquelin.stm32@gmail.com,
mripard@kernel.org, wens@csie.org, iuliana.prodan@nxp.com,
horia.geanta@nxp.com, aymen.sghaier@nxp.com
Cc: linux-arm-kernel@lists.infradead.org,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-sunxi@googlegroups.com,
Corentin Labbe <clabbe.montjoie@gmail.com>
Subject: [PATCH RFC 08/10] crypto: engine: add slot parameter
Date: Tue, 14 Jan 2020 14:59:34 +0100 [thread overview]
Message-ID: <20200114135936.32422-9-clabbe.montjoie@gmail.com> (raw)
In-Reply-To: <20200114135936.32422-1-clabbe.montjoie@gmail.com>
prepare/unprepare functions should be able to know which slot in a batch
should be used for preparing a request.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
crypto/crypto_engine.c | 4 ++--
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 6 ++----
drivers/crypto/omap-aes-gcm.c | 2 +-
drivers/crypto/omap-aes.c | 4 ++--
drivers/crypto/omap-des.c | 4 ++--
drivers/crypto/stm32/stm32-cryp.c | 8 ++++----
drivers/crypto/stm32/stm32-hash.c | 4 ++--
include/crypto/engine.h | 4 ++--
8 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c
index 591dea5ddeec..e23a398ba330 100644
--- a/crypto/crypto_engine.c
+++ b/crypto/crypto_engine.c
@@ -40,7 +40,7 @@ static void crypto_finalize_request(struct crypto_engine *engine,
enginectx = crypto_tfm_ctx(engine->cur_reqs[i].req->tfm);
if (engine->cur_reqs[i].prepared &&
enginectx->op.unprepare_request) {
- ret = enginectx->op.unprepare_request(engine, engine->cur_reqs[i].req);
+ ret = enginectx->op.unprepare_request(engine, engine->cur_reqs[i].req, i);
if (ret)
dev_err(engine->dev, "failed to unprepare request\n");
}
@@ -143,7 +143,7 @@ static void crypto_pump_requests(struct crypto_engine *engine,
enginectx = crypto_tfm_ctx(async_req->tfm);
if (enginectx->op.prepare_request) {
- ret = enginectx->op.prepare_request(engine, async_req);
+ ret = enginectx->op.prepare_request(engine, async_req, engine->ct);
if (ret) {
dev_err(engine->dev, "failed to prepare request: %d\n",
ret);
diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
index d56c992fbf93..41d18c18d1d1 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
@@ -78,7 +78,7 @@ static int sun8i_ce_cipher_fallback(struct skcipher_request *areq)
return err;
}
-static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req)
+static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req, int slot)
{
struct skcipher_request *areq = container_of(async_req, struct skcipher_request, base);
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq);
@@ -96,7 +96,6 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req
int flow, i;
int nr_sgs = 0;
int nr_sgd = 0;
- int slot = 0;
int err = 0;
if (slot < 0 || slot >= MAXTASK)
@@ -296,7 +295,7 @@ int sun8i_ce_cipher_run(struct crypto_engine *engine, void *areq)
return 0;
}
-static int sun8i_ce_cipher_unprepare(struct crypto_engine *engine, void *async_req)
+static int sun8i_ce_cipher_unprepare(struct crypto_engine *engine, void *async_req, int slot)
{
struct skcipher_request *areq = container_of(async_req, struct skcipher_request, base);
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq);
@@ -308,7 +307,6 @@ static int sun8i_ce_cipher_unprepare(struct crypto_engine *engine, void *async_r
unsigned int ivsize, offset;
int nr_sgs = rctx->nr_sgs;
int nr_sgd = rctx->nr_sgd;
- int slot = 0;
int flow;
flow = rctx->flow;
diff --git a/drivers/crypto/omap-aes-gcm.c b/drivers/crypto/omap-aes-gcm.c
index 32dc00dc570b..0fea3dd40378 100644
--- a/drivers/crypto/omap-aes-gcm.c
+++ b/drivers/crypto/omap-aes-gcm.c
@@ -213,7 +213,7 @@ static int omap_aes_gcm_handle_queue(struct omap_aes_dev *dd,
return 0;
}
-static int omap_aes_gcm_prepare_req(struct crypto_engine *engine, void *areq)
+static int omap_aes_gcm_prepare_req(struct crypto_engine *engine, void *areq, int slot)
{
struct aead_request *req = container_of(areq, struct aead_request,
base);
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index 824ddf2a66ff..4d9caa7ce8da 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -427,7 +427,7 @@ static int omap_aes_handle_queue(struct omap_aes_dev *dd,
}
static int omap_aes_prepare_req(struct crypto_engine *engine,
- void *areq)
+ void *areq, int slot)
{
struct skcipher_request *req = container_of(areq, struct skcipher_request, base);
struct omap_aes_ctx *ctx = crypto_skcipher_ctx(
@@ -632,7 +632,7 @@ static int omap_aes_ctr_decrypt(struct skcipher_request *req)
}
static int omap_aes_prepare_req(struct crypto_engine *engine,
- void *req);
+ void *req, int slot);
static int omap_aes_crypt_req(struct crypto_engine *engine,
void *req);
diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index 8eda43319204..92c5fb1d4b83 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -524,7 +524,7 @@ static int omap_des_handle_queue(struct omap_des_dev *dd,
}
static int omap_des_prepare_req(struct crypto_engine *engine,
- void *areq)
+ void *areq, int slot)
{
struct skcipher_request *req = container_of(areq, struct skcipher_request, base);
struct omap_des_ctx *ctx = crypto_skcipher_ctx(
@@ -711,7 +711,7 @@ static int omap_des_cbc_decrypt(struct skcipher_request *req)
}
static int omap_des_prepare_req(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
static int omap_des_crypt_req(struct crypto_engine *engine,
void *areq);
diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c
index d347a1d6e351..7c65b526d20e 100644
--- a/drivers/crypto/stm32/stm32-cryp.c
+++ b/drivers/crypto/stm32/stm32-cryp.c
@@ -684,7 +684,7 @@ static int stm32_cryp_cpu_start(struct stm32_cryp *cryp)
static int stm32_cryp_cipher_one_req(struct crypto_engine *engine, void *areq);
static int stm32_cryp_prepare_cipher_req(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
static int stm32_cryp_init_tfm(struct crypto_skcipher *tfm)
{
@@ -700,7 +700,7 @@ static int stm32_cryp_init_tfm(struct crypto_skcipher *tfm)
static int stm32_cryp_aead_one_req(struct crypto_engine *engine, void *areq);
static int stm32_cryp_prepare_aead_req(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
static int stm32_cryp_aes_aead_init(struct crypto_aead *tfm)
{
@@ -1015,7 +1015,7 @@ static int stm32_cryp_prepare_req(struct skcipher_request *req,
}
static int stm32_cryp_prepare_cipher_req(struct crypto_engine *engine,
- void *areq)
+ void *areq, int slot)
{
struct skcipher_request *req = container_of(areq,
struct skcipher_request,
@@ -1039,7 +1039,7 @@ static int stm32_cryp_cipher_one_req(struct crypto_engine *engine, void *areq)
return stm32_cryp_cpu_start(cryp);
}
-static int stm32_cryp_prepare_aead_req(struct crypto_engine *engine, void *areq)
+static int stm32_cryp_prepare_aead_req(struct crypto_engine *engine, void *areq, int slot)
{
struct aead_request *req = container_of(areq, struct aead_request,
base);
diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
index 167b80eec437..4a696c48126c 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -824,7 +824,7 @@ static int stm32_hash_hw_init(struct stm32_hash_dev *hdev,
}
static int stm32_hash_one_request(struct crypto_engine *engine, void *areq);
-static int stm32_hash_prepare_req(struct crypto_engine *engine, void *areq);
+static int stm32_hash_prepare_req(struct crypto_engine *engine, void *areq, int slot);
static int stm32_hash_handle_queue(struct stm32_hash_dev *hdev,
struct ahash_request *req)
@@ -832,7 +832,7 @@ static int stm32_hash_handle_queue(struct stm32_hash_dev *hdev,
return crypto_transfer_hash_request_to_engine(hdev->engine, req);
}
-static int stm32_hash_prepare_req(struct crypto_engine *engine, void *areq)
+static int stm32_hash_prepare_req(struct crypto_engine *engine, void *areq, int slot)
{
struct ahash_request *req = container_of(areq, struct ahash_request,
base);
diff --git a/include/crypto/engine.h b/include/crypto/engine.h
index 021136a47b93..55d3dbc2498c 100644
--- a/include/crypto/engine.h
+++ b/include/crypto/engine.h
@@ -85,9 +85,9 @@ struct crypto_engine {
*/
struct crypto_engine_op {
int (*prepare_request)(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
int (*unprepare_request)(struct crypto_engine *engine,
- void *areq);
+ void *areq, int slot);
int (*do_one_request)(struct crypto_engine *engine,
void *areq);
};
--
2.24.1
next prev parent reply other threads:[~2020-01-14 14:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 13:59 [PATCH RFC 00/10] crypto: engine: permit to batch requests Corentin Labbe
2020-01-14 13:59 ` [PATCH RFC 01/10] crypto: sun8i-ce: move iv data to request context Corentin Labbe
2020-01-14 13:59 ` [PATCH RFC 02/10] crypto: sun8i-ce: increase task list size Corentin Labbe
2020-01-14 13:59 ` [PATCH RFC 03/10] crypto: sun8i-ce: split into prepare/run/unprepare Corentin Labbe
2020-01-14 13:59 ` [PATCH RFC 04/10] crypto: sun8i-ce: introduce the slot number Corentin Labbe
2020-01-14 13:59 ` [PATCH RFC 05/10] crypto: engine: transform cur_req in an array Corentin Labbe
2020-01-16 11:34 ` Iuliana Prodan
2020-01-14 13:59 ` [PATCH RFC 06/10] crypto: engine: introduce ct Corentin Labbe
2020-01-16 11:34 ` Iuliana Prodan
2020-01-16 13:21 ` Corentin Labbe
2020-01-14 13:59 ` [PATCH RFC 07/10] crypto: sun8i-ce: handle slot > 0 Corentin Labbe
2020-01-14 13:59 ` Corentin Labbe [this message]
2020-01-14 13:59 ` [PATCH RFC 09/10] crypto: engine: permit to batch requests Corentin Labbe
2020-01-16 11:34 ` Iuliana Prodan
2020-01-17 16:13 ` Iuliana Prodan
2020-01-14 13:59 ` [PATCH RFC 10/10] crypto: sun8i-ce: use the new batch mechanism Corentin Labbe
2020-01-16 11:33 ` [PATCH RFC 00/10] crypto: engine: permit to batch requests Iuliana Prodan
2020-01-16 13:16 ` Corentin Labbe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200114135936.32422-9-clabbe.montjoie@gmail.com \
--to=clabbe.montjoie@gmail.com \
--cc=alexandre.torgue@st.com \
--cc=aymen.sghaier@nxp.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=iuliana.prodan@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@googlegroups.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mripard@kernel.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).