[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241018064101.336232-4-kanchana.p.sridhar@intel.com>
Date: Thu, 17 Oct 2024 23:40:51 -0700
From: Kanchana P Sridhar <kanchana.p.sridhar@...el.com>
To: linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
hannes@...xchg.org,
yosryahmed@...gle.com,
nphamcs@...il.com,
chengming.zhou@...ux.dev,
usamaarif642@...il.com,
ryan.roberts@....com,
ying.huang@...el.com,
21cnbao@...il.com,
akpm@...ux-foundation.org,
linux-crypto@...r.kernel.org,
herbert@...dor.apana.org.au,
davem@...emloft.net,
clabbe@...libre.com,
ardb@...nel.org,
ebiggers@...gle.com,
surenb@...gle.com,
kristen.c.accardi@...el.com,
zanussi@...nel.org,
viro@...iv.linux.org.uk,
brauner@...nel.org,
jack@...e.cz,
mcgrof@...nel.org,
kees@...nel.org,
joel.granados@...nel.org,
bfoster@...hat.com,
willy@...radead.org,
linux-fsdevel@...r.kernel.org
Cc: wajdi.k.feghali@...el.com,
vinodh.gopal@...el.com,
kanchana.p.sridhar@...el.com
Subject: [RFC PATCH v1 03/13] crypto: testmgr - Add crypto testmgr acomp poll support.
This patch enables the newly added acomp poll API to be exercised in the
crypto test_acomp() calls to compress/decompress, if the acomp registers
a poll method.
Signed-off-by: Glover, Andre <andre.glover@...el.com>
Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@...el.com>
---
crypto/testmgr.c | 70 ++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 65 insertions(+), 5 deletions(-)
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ee8da628e9da..54f6f59ae501 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -3482,7 +3482,19 @@ static int test_acomp(struct crypto_acomp *tfm,
acomp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
crypto_req_done, &wait);
- ret = crypto_wait_req(crypto_acomp_compress(req), &wait);
+ if (tfm->poll) {
+ ret = crypto_acomp_compress(req);
+ if (ret == -EINPROGRESS) {
+ do {
+ ret = crypto_acomp_poll(req);
+ if (ret && ret != -EAGAIN)
+ break;
+ } while (ret);
+ }
+ } else {
+ ret = crypto_wait_req(crypto_acomp_compress(req), &wait);
+ }
+
if (ret) {
pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n",
i + 1, algo, -ret);
@@ -3498,7 +3510,19 @@ static int test_acomp(struct crypto_acomp *tfm,
crypto_init_wait(&wait);
acomp_request_set_params(req, &src, &dst, ilen, dlen);
- ret = crypto_wait_req(crypto_acomp_decompress(req), &wait);
+ if (tfm->poll) {
+ ret = crypto_acomp_decompress(req);
+ if (ret == -EINPROGRESS) {
+ do {
+ ret = crypto_acomp_poll(req);
+ if (ret && ret != -EAGAIN)
+ break;
+ } while (ret);
+ }
+ } else {
+ ret = crypto_wait_req(crypto_acomp_decompress(req), &wait);
+ }
+
if (ret) {
pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n",
i + 1, algo, -ret);
@@ -3531,7 +3555,19 @@ static int test_acomp(struct crypto_acomp *tfm,
sg_init_one(&src, input_vec, ilen);
acomp_request_set_params(req, &src, NULL, ilen, 0);
- ret = crypto_wait_req(crypto_acomp_compress(req), &wait);
+ if (tfm->poll) {
+ ret = crypto_acomp_compress(req);
+ if (ret == -EINPROGRESS) {
+ do {
+ ret = crypto_acomp_poll(req);
+ if (ret && ret != -EAGAIN)
+ break;
+ } while (ret);
+ }
+ } else {
+ ret = crypto_wait_req(crypto_acomp_compress(req), &wait);
+ }
+
if (ret) {
pr_err("alg: acomp: compression failed on NULL dst buffer test %d for %s: ret=%d\n",
i + 1, algo, -ret);
@@ -3574,7 +3610,19 @@ static int test_acomp(struct crypto_acomp *tfm,
acomp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
crypto_req_done, &wait);
- ret = crypto_wait_req(crypto_acomp_decompress(req), &wait);
+ if (tfm->poll) {
+ ret = crypto_acomp_decompress(req);
+ if (ret == -EINPROGRESS) {
+ do {
+ ret = crypto_acomp_poll(req);
+ if (ret && ret != -EAGAIN)
+ break;
+ } while (ret);
+ }
+ } else {
+ ret = crypto_wait_req(crypto_acomp_decompress(req), &wait);
+ }
+
if (ret) {
pr_err("alg: acomp: decompression failed on test %d for %s: ret=%d\n",
i + 1, algo, -ret);
@@ -3606,7 +3654,19 @@ static int test_acomp(struct crypto_acomp *tfm,
crypto_init_wait(&wait);
acomp_request_set_params(req, &src, NULL, ilen, 0);
- ret = crypto_wait_req(crypto_acomp_decompress(req), &wait);
+ if (tfm->poll) {
+ ret = crypto_acomp_decompress(req);
+ if (ret == -EINPROGRESS) {
+ do {
+ ret = crypto_acomp_poll(req);
+ if (ret && ret != -EAGAIN)
+ break;
+ } while (ret);
+ }
+ } else {
+ ret = crypto_wait_req(crypto_acomp_decompress(req), &wait);
+ }
+
if (ret) {
pr_err("alg: acomp: decompression failed on NULL dst buffer test %d for %s: ret=%d\n",
i + 1, algo, -ret);
--
2.27.0
Powered by blists - more mailing lists