Skip to content

Commit 75509ca

Browse files
committed
crypto: iaa - Move compression CRC into request object
JIRA: https://issues.redhat.com/browse/RHEL-87766 Upstream Status: merged into herbert/crypto-2.6.git Conflicts: missing 02c9742 ("crypto: iaa - Remove dst_null support") which is a part of a bigger patchset which was not backported. A result is small context differences. commit 184e56e Author: Herbert Xu <herbert@gondor.apana.org.au> Date: Mon Mar 24 11:57:32 2025 +0800 crypto: iaa - Move compression CRC into request object Rather than passing around a CRC between the functions, embed it into the acomp_request context. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Vladis Dronov <vdronov@redhat.com>
1 parent 8b0e753 commit 75509ca

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

drivers/crypto/intel/iaa/iaa_crypto_main.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,8 +1025,7 @@ static int iaa_remap_for_verify(struct device *dev, struct iaa_wq *iaa_wq,
10251025
static int iaa_compress_verify(struct crypto_tfm *tfm, struct acomp_req *req,
10261026
struct idxd_wq *wq,
10271027
dma_addr_t src_addr, unsigned int slen,
1028-
dma_addr_t dst_addr, unsigned int *dlen,
1029-
u32 compression_crc);
1028+
dma_addr_t dst_addr, unsigned int *dlen);
10301029

10311030
static void iaa_desc_complete(struct idxd_desc *idxd_desc,
10321031
enum idxd_complete_type comp_type,
@@ -1092,10 +1091,10 @@ static void iaa_desc_complete(struct idxd_desc *idxd_desc,
10921091
}
10931092

10941093
if (ctx->compress && compression_ctx->verify_compress) {
1094+
u32 *compression_crc = acomp_request_ctx(ctx->req);
10951095
dma_addr_t src_addr, dst_addr;
1096-
u32 compression_crc;
10971096

1098-
compression_crc = idxd_desc->iax_completion->crc;
1097+
*compression_crc = idxd_desc->iax_completion->crc;
10991098

11001099
ret = iaa_remap_for_verify(dev, iaa_wq, ctx->req, &src_addr, &dst_addr);
11011100
if (ret) {
@@ -1105,8 +1104,7 @@ static void iaa_desc_complete(struct idxd_desc *idxd_desc,
11051104
}
11061105

11071106
ret = iaa_compress_verify(ctx->tfm, ctx->req, iaa_wq->wq, src_addr,
1108-
ctx->req->slen, dst_addr, &ctx->req->dlen,
1109-
compression_crc);
1107+
ctx->req->slen, dst_addr, &ctx->req->dlen);
11101108
if (ret) {
11111109
dev_dbg(dev, "%s: compress verify failed ret=%d\n", __func__, ret);
11121110
err = -EIO;
@@ -1136,11 +1134,11 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req,
11361134
struct idxd_wq *wq,
11371135
dma_addr_t src_addr, unsigned int slen,
11381136
dma_addr_t dst_addr, unsigned int *dlen,
1139-
u32 *compression_crc,
11401137
bool disable_async)
11411138
{
11421139
struct iaa_device_compression_mode *active_compression_mode;
11431140
struct iaa_compression_ctx *ctx = crypto_tfm_ctx(tfm);
1141+
u32 *compression_crc = acomp_request_ctx(req);
11441142
struct iaa_device *iaa_device;
11451143
struct idxd_desc *idxd_desc;
11461144
struct iax_hw_desc *desc;
@@ -1288,11 +1286,11 @@ static int iaa_remap_for_verify(struct device *dev, struct iaa_wq *iaa_wq,
12881286
static int iaa_compress_verify(struct crypto_tfm *tfm, struct acomp_req *req,
12891287
struct idxd_wq *wq,
12901288
dma_addr_t src_addr, unsigned int slen,
1291-
dma_addr_t dst_addr, unsigned int *dlen,
1292-
u32 compression_crc)
1289+
dma_addr_t dst_addr, unsigned int *dlen)
12931290
{
12941291
struct iaa_device_compression_mode *active_compression_mode;
12951292
struct iaa_compression_ctx *ctx = crypto_tfm_ctx(tfm);
1293+
u32 *compression_crc = acomp_request_ctx(req);
12961294
struct iaa_device *iaa_device;
12971295
struct idxd_desc *idxd_desc;
12981296
struct iax_hw_desc *desc;
@@ -1352,10 +1350,10 @@ static int iaa_compress_verify(struct crypto_tfm *tfm, struct acomp_req *req,
13521350
goto err;
13531351
}
13541352

1355-
if (compression_crc != idxd_desc->iax_completion->crc) {
1353+
if (*compression_crc != idxd_desc->iax_completion->crc) {
13561354
ret = -EINVAL;
13571355
dev_dbg(dev, "(verify) iaa comp/decomp crc mismatch:"
1358-
" comp=0x%x, decomp=0x%x\n", compression_crc,
1356+
" comp=0x%x, decomp=0x%x\n", *compression_crc,
13591357
idxd_desc->iax_completion->crc);
13601358
print_hex_dump(KERN_INFO, "cmp-rec: ", DUMP_PREFIX_OFFSET,
13611359
8, 1, idxd_desc->iax_completion, 64, 0);
@@ -1503,7 +1501,6 @@ static int iaa_comp_acompress(struct acomp_req *req)
15031501
bool disable_async = false;
15041502
int nr_sgs, cpu, ret = 0;
15051503
struct iaa_wq *iaa_wq;
1506-
u32 compression_crc;
15071504
struct idxd_wq *wq;
15081505
struct device *dev;
15091506
int order = -1;
@@ -1580,7 +1577,7 @@ static int iaa_comp_acompress(struct acomp_req *req)
15801577
req->dst, req->dlen, sg_dma_len(req->dst));
15811578

15821579
ret = iaa_compress(tfm, req, wq, src_addr, req->slen, dst_addr,
1583-
&req->dlen, &compression_crc, disable_async);
1580+
&req->dlen, disable_async);
15841581
if (ret == -EINPROGRESS)
15851582
return ret;
15861583

@@ -1592,7 +1589,7 @@ static int iaa_comp_acompress(struct acomp_req *req)
15921589
}
15931590

15941591
ret = iaa_compress_verify(tfm, req, wq, src_addr, req->slen,
1595-
dst_addr, &req->dlen, compression_crc);
1592+
dst_addr, &req->dlen);
15961593
if (ret)
15971594
dev_dbg(dev, "asynchronous compress verification failed ret=%d\n", ret);
15981595

@@ -1823,6 +1820,7 @@ static struct acomp_alg iaa_acomp_fixed_deflate = {
18231820
.compress = iaa_comp_acompress,
18241821
.decompress = iaa_comp_adecompress,
18251822
.dst_free = dst_free,
1823+
.reqsize = sizeof(u32),
18261824
.base = {
18271825
.cra_name = "deflate",
18281826
.cra_driver_name = "deflate-iaa",

0 commit comments

Comments
 (0)