diff mbox series

[v9,07/19] crypto: iaa - Define and use req->data instead of req->base.data.

Message ID 20250430205305.22844-8-kanchana.p.sridhar@intel.com
State Superseded
Headers show
Series zswap compression batching | expand

Commit Message

Sridhar, Kanchana P April 30, 2025, 8:52 p.m. UTC
Since req->base.data is for the user and not for the driver, we define a
"void *data" in struct acomp_req for use by driver code.

At present, iaa_crypto saves the "struct idxd_desc *idxd_desc" that is
allocated in iaa_[de]compress(), in req->data. When batching is
introduced in subsequent patches, we will need to support an async
"submit-poll" mechanism to achieve parallelism using IAA hardware. To
accomplish this, we will submit the descriptors for each request in the
batch in iaa_[de]compress(), and return -EINPROGRESS. The polling
function will retrieve the descriptor from req->data to check the
request's completion status.

Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
---
 drivers/crypto/intel/iaa/iaa_crypto_main.c | 12 +++++++-----
 include/crypto/acompress.h                 |  2 ++
 2 files changed, 9 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c b/drivers/crypto/intel/iaa/iaa_crypto_main.c
index 2f2dc6987cc6..0b821b8b4264 100644
--- a/drivers/crypto/intel/iaa/iaa_crypto_main.c
+++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c
@@ -1718,7 +1718,7 @@  static void iaa_desc_complete(struct idxd_desc *idxd_desc,
 	iaa_wq_put(idxd_desc->wq);
 }
 
-static int iaa_compress(struct crypto_tfm *tfm,	struct acomp_req *req,
+static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req,
 			struct idxd_wq *wq,
 			dma_addr_t src_addr, unsigned int slen,
 			dma_addr_t dst_addr, unsigned int *dlen,
@@ -1778,8 +1778,9 @@  static int iaa_compress(struct crypto_tfm *tfm,	struct acomp_req *req,
 			" src_addr %llx, dst_addr %llx\n", __func__,
 			active_compression_mode->name,
 			src_addr, dst_addr);
-	} else if (ctx->async_mode)
-		req->base.data = idxd_desc;
+	} else if (ctx->async_mode) {
+		req->data = idxd_desc;
+	}
 
 	dev_dbg(dev, "%s: compression mode %s,"
 		" desc->src1_addr %llx, desc->src1_size %d,"
@@ -1889,8 +1890,9 @@  static int iaa_decompress(struct crypto_tfm *tfm, struct acomp_req *req,
 			" src_addr %llx, dst_addr %llx\n", __func__,
 			active_compression_mode->name,
 			src_addr, dst_addr);
-	} else if (ctx->async_mode && !disable_async)
-		req->base.data = idxd_desc;
+	} else if (ctx->async_mode && !disable_async) {
+		req->data = idxd_desc;
+	}
 
 	dev_dbg(dev, "%s: decompression mode %s,"
 		" desc->src1_addr %llx, desc->src1_size %d,"
diff --git a/include/crypto/acompress.h b/include/crypto/acompress.h
index 267d557daeb1..01389fd7055f 100644
--- a/include/crypto/acompress.h
+++ b/include/crypto/acompress.h
@@ -81,6 +81,7 @@  struct acomp_req_chain {
  * @doff:	Destination folio offset
  * @slen:	Size of the input buffer
  * @dlen:	Size of the output buffer and number of bytes produced
+ * @data:	Private API code data, do not use
  * @chain:	Private API code data, do not use
  * @__ctx:	Start of private context data
  */
@@ -101,6 +102,7 @@  struct acomp_req {
 	unsigned int slen;
 	unsigned int dlen;
 
+	void *data;
 	struct acomp_req_chain chain;
 
 	void *__ctx[] CRYPTO_MINALIGN_ATTR;