crypto: iaa - Remove dst_null support
Subsystems (6)
Herbert Xu
maintainerPATCH v4 3/13 crypto: iaa - Remove dst_null support
In reply to a message not in the archiveRemove the unused dst_null support.
--- drivers/crypto/intel/iaa/iaa_crypto_main.c | 136 +-------------------- 1 file changed, 6 insertions(+), 130 deletions(-)
drivers/crypto/intel/iaa/iaa_crypto_main.c +6 -130
@@ -1136,8 +1136,7 @@ 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, - u32 *compression_crc, - bool disable_async) + u32 *compression_crc) { struct iaa_device_compression_mode *active_compression_mode;struct iaa_compression_ctx *ctx =crypto_tfm_ctx (tfm);
@@ -1180,7 +1179,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req, desc->src2_size =sizeof (struct aecs_comp_table_record ); desc->completion_addr = idxd_desc->compl_dma; -if (ctx->use_irq && !disable_async) { +if (ctx->use_irq) { desc->flags |=IDXD_OP_FLAG_RCI ; idxd_desc->crypto.req = req;
@@ -1193,7 +1192,7 @@ 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 && !disable_async) + }else if (ctx->async_mode) req->base.data = idxd_desc; dev_dbg(dev, "%s: compression mode %s,"
@@ -1214,7 +1213,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req,update_total_comp_calls ();update_wq_comp_calls (wq); -if (ctx->async_mode && !disable_async) { +if (ctx->async_mode) { ret = -EINPROGRESS ;dev_dbg (dev,"%s: returning -EINPROGRESS\n" , __func__); goto out;
@@ -1234,7 +1233,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req, *compression_crc = idxd_desc->iax_completion->crc; -if (!ctx->async_mode || disable_async) +if (!ctx->async_mode)idxd_free_desc (wq, idxd_desc); out:return ret;
@@ -1500,13 +1499,11 @@ static int iaa_comp_acompress(struct acomp_req *req)struct iaa_compression_ctx *compression_ctx;struct crypto_tfm *tfm = req->base.tfm;dma_addr_t src_addr, dst_addr; -bool disable_async = false;int nr_sgs, cpu, ret =0 ;struct iaa_wq *iaa_wq;u32 compression_crc;struct idxd_wq *wq;struct device *dev; -int order =-1 ; compression_ctx =crypto_tfm_ctx (tfm);
@@ -1536,21 +1533,6 @@ static int iaa_comp_acompress(struct acomp_req *req) iaa_wq =idxd_wq_get_private (wq); -if (!req->dst) { -gfp_t flags = req->base.flags &CRYPTO_TFM_REQ_MAY_SLEEP ?GFP_KERNEL :GFP_ATOMIC ; - -/* incompressible data will always be < 2 * slen */ - req->dlen =2 * req->slen; - order =order_base_2 (round_up (req->dlen,PAGE_SIZE ) /PAGE_SIZE ); - req->dst =sgl_alloc_order (req->dlen, order, false, flags,NULL ); -if (!req->dst) { - ret = -ENOMEM ; - order =-1 ; - goto out; - } - disable_async = true; - } - dev = &wq->idxd->pdev->dev; nr_sgs =dma_map_sg (dev, req->src,sg_nents (req->src),DMA_TO_DEVICE );
@@ -1580,7 +1562,7 @@ static int iaa_comp_acompress(struct acomp_req *req) req->dst, req->dlen, sg_dma_len(req->dst)); ret =iaa_compress (tfm, req, wq, src_addr, req->slen, dst_addr, - &req->dlen, &compression_crc, disable_async); + &req->dlen, &compression_crc);if (ret == -EINPROGRESS )return ret;
@@ -1611,100 +1593,6 @@ static int iaa_comp_acompress(struct acomp_req *req) out:iaa_wq_put (wq); -if (order >=0 ) -sgl_free_order (req->dst, order); - -return ret; -} - -static int iaa_comp_adecompress_alloc_dest (struct acomp_req *req) -{ -gfp_t flags = req->base.flags &CRYPTO_TFM_REQ_MAY_SLEEP ? -GFP_KERNEL :GFP_ATOMIC ; -struct crypto_tfm *tfm = req->base.tfm; -dma_addr_t src_addr, dst_addr; -int nr_sgs, cpu, ret =0 ; -struct iaa_wq *iaa_wq; -struct device *dev; -struct idxd_wq *wq; -int order =-1 ; - - cpu =get_cpu (); - wq =wq_table_next_wq (cpu); -put_cpu (); -if (!wq) { -pr_debug ("no wq configured for cpu=%d\n" , cpu); -return -ENODEV ; - } - - ret =iaa_wq_get (wq); -if (ret) { -pr_debug ("no wq available for cpu=%d\n" , cpu); -return -ENODEV ; - } - - iaa_wq =idxd_wq_get_private (wq); - - dev = &wq->idxd->pdev->dev; - - nr_sgs =dma_map_sg (dev, req->src,sg_nents (req->src),DMA_TO_DEVICE ); -if (nr_sgs <=0 || nr_sgs >1 ) { -dev_dbg (dev,"couldn't map src sg for iaa device %d," -" wq %d: ret=%d\n" , iaa_wq->iaa_device->idxd->id, - iaa_wq->wq->id, ret); - ret = -EIO ; - goto out; - } - src_addr =sg_dma_address (req->src); -dev_dbg (dev,"dma_map_sg, src_addr %llx, nr_sgs %d, req->src %p," -" req->slen %d, sg_dma_len(sg) %d\n" , src_addr, nr_sgs, - req->src, req->slen,sg_dma_len (req->src)); - - req->dlen =4 * req->slen;/* start with ~avg comp rato */ -alloc_dest: - order =order_base_2 (round_up (req->dlen,PAGE_SIZE ) /PAGE_SIZE ); - req->dst =sgl_alloc_order (req->dlen, order, false, flags,NULL ); -if (!req->dst) { - ret = -ENOMEM ; - order =-1 ; - goto out; - } - - nr_sgs =dma_map_sg (dev, req->dst,sg_nents (req->dst),DMA_FROM_DEVICE ); -if (nr_sgs <=0 || nr_sgs >1 ) { -dev_dbg (dev,"couldn't map dst sg for iaa device %d," -" wq %d: ret=%d\n" , iaa_wq->iaa_device->idxd->id, - iaa_wq->wq->id, ret); - ret = -EIO ; - goto err_map_dst; - } - - dst_addr =sg_dma_address (req->dst); -dev_dbg (dev,"dma_map_sg, dst_addr %llx, nr_sgs %d, req->dst %p," -" req->dlen %d, sg_dma_len(sg) %d\n" , dst_addr, nr_sgs, - req->dst, req->dlen,sg_dma_len (req->dst)); - ret =iaa_decompress (tfm, req, wq, src_addr, req->slen, - dst_addr, &req->dlen, true); -if (ret == -EOVERFLOW ) { -dma_unmap_sg (dev, req->dst,sg_nents (req->dst),DMA_FROM_DEVICE ); - req->dlen *=2 ; -if (req->dlen >CRYPTO_ACOMP_DST_MAX ) - goto err_map_dst; - goto alloc_dest; - } - -if (ret !=0 ) -dev_dbg (dev,"asynchronous decompress failed ret=%d\n" , ret); - -dma_unmap_sg (dev, req->dst,sg_nents (req->dst),DMA_FROM_DEVICE ); -err_map_dst: -dma_unmap_sg (dev, req->src,sg_nents (req->src),DMA_TO_DEVICE ); -out: -iaa_wq_put (wq); - -if (order >=0 ) -sgl_free_order (req->dst, order); -return ret; }
@@ -1727,9 +1615,6 @@ static int iaa_comp_adecompress(struct acomp_req *req)return -EINVAL ; } -if (!req->dst) -return iaa_comp_adecompress_alloc_dest (req); - cpu =get_cpu (); wq =wq_table_next_wq (cpu);put_cpu ();
@@ -1810,19 +1695,10 @@ static int iaa_comp_init_fixed(struct crypto_acomp *acomp_tfm)return 0 ; } -static void dst_free (struct scatterlist *sgl) -{ -/* -* Called for req->dst = NULL cases but we free elsewhere -* using sgl_free_order(). -*/ -} -static struct acomp_alg iaa_acomp_fixed_deflate = { .init = iaa_comp_init_fixed, .compress = iaa_comp_acompress, .decompress = iaa_comp_adecompress, - .dst_free = dst_free, .base = { .cra_name ="deflate" , .cra_driver_name ="deflate-iaa" ,
Signature · 6 lines
2.39.5 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Herbert Xu
maintainerPATCH v4 1/13 crypto: scomp - Remove support for some non-trivial SG lists
In reply to a message not in the archiveAs the only user of acomp/scomp uses a trivial single-page SG list, remove support for everything else in preprataion for the addition of virtual address support.
However, keep support for non-trivial source SG lists as that user is currently jumping through hoops in order to linearise the source data.
Limit the source SG linearisation buffer to a single page as that user never goes over that. The only other potential user is also unlikely to exceed that (IPComp) and it can easily do its own linearisation if necessary.
Also keep the destination SG linearisation for IPComp.
--- crypto/acompress.c | 1 - crypto/scompress.c | 127 ++++++++++++++++------------ include/crypto/acompress.h | 17 +--- include/crypto/internal/scompress.h | 2 - 4 files changed, 76 insertions(+), 71 deletions(-)
crypto/acompress.c +0 -1
@@ -73,7 +73,6 @@ static int crypto_acomp_init_tfm(struct crypto_tfm *tfm) acomp->compress = alg->compress; acomp->decompress = alg->decompress; - acomp->dst_free = alg->dst_free; acomp->reqsize = alg->reqsize;if (alg->exit)
crypto/scompress.c +73 -54
194 lines not on this page · raw message
include/crypto/acompress.h +3 -14
@@ -18,8 +18,6 @@#include <linux/spinlock_types.h> #include <linux/types.h> -#define CRYPTO_ACOMP_ALLOC_OUTPUT 0x00000001 -/* Set this bit if source is virtual address instead of SG list. */ #define CRYPTO_ACOMP_REQ_SRC_VIRT 0x00000002
@@ -84,15 +82,12 @@ struct acomp_req {* * @compress: Function performs a compress operation * @decompress: Function performs a de-compress operation -* @dst_free: Frees destination buffer if allocated inside the -* algorithm * @reqsize: Context size for (de)compression requests * @base: Common crypto API algorithm data structure */ struct crypto_acomp {int (*compress)(struct acomp_req *req);int (*decompress)(struct acomp_req *req); -void (*dst_free)(struct scatterlist *dst);unsigned int reqsize;struct crypto_tfm base; };
@@ -261,9 +256,8 @@ static inline void acomp_request_set_callback(struct acomp_req *req,crypto_completion_t cmpl, void *data) { - u32 keep = CRYPTO_ACOMP_ALLOC_OUTPUT | CRYPTO_ACOMP_REQ_SRC_VIRT | -CRYPTO_ACOMP_REQ_SRC_NONDMA |CRYPTO_ACOMP_REQ_DST_VIRT | -CRYPTO_ACOMP_REQ_DST_NONDMA ; + u32 keep = CRYPTO_ACOMP_REQ_SRC_VIRT | CRYPTO_ACOMP_REQ_SRC_NONDMA | +CRYPTO_ACOMP_REQ_DST_VIRT |CRYPTO_ACOMP_REQ_DST_NONDMA ; req->base.complete = cmpl; req->base.data = data;
@@ -297,13 +291,10 @@ static inline void acomp_request_set_params(struct acomp_req *req, req->slen = slen; req->dlen = dlen; - req->base.flags &= ~(CRYPTO_ACOMP_ALLOC_OUTPUT | -CRYPTO_ACOMP_REQ_SRC_VIRT | + req->base.flags &= ~(CRYPTO_ACOMP_REQ_SRC_VIRT |CRYPTO_ACOMP_REQ_SRC_NONDMA |CRYPTO_ACOMP_REQ_DST_VIRT |CRYPTO_ACOMP_REQ_DST_NONDMA ); -if (!req->dst) - req->base.flags |=CRYPTO_ACOMP_ALLOC_OUTPUT ; }/**
@@ -403,7 +394,6 @@ static inline void acomp_request_set_dst_dma(struct acomp_req *req, req->dvirt = dst; req->dlen = dlen; - req->base.flags &= ~CRYPTO_ACOMP_ALLOC_OUTPUT ; req->base.flags &= ~CRYPTO_ACOMP_REQ_DST_NONDMA ; req->base.flags |=CRYPTO_ACOMP_REQ_DST_VIRT ; }
@@ -424,7 +414,6 @@ static inline void acomp_request_set_dst_nondma(struct acomp_req *req, req->dvirt = dst; req->dlen = dlen; - req->base.flags &= ~CRYPTO_ACOMP_ALLOC_OUTPUT ; req->base.flags |=CRYPTO_ACOMP_REQ_DST_NONDMA ; req->base.flags |=CRYPTO_ACOMP_REQ_DST_VIRT ; }
include/crypto/internal/scompress.h +0 -2
@@ -12,8 +12,6 @@#include <crypto/acompress.h> #include <crypto/algapi.h> -#define SCOMP_SCRATCH_SIZE 131072 -struct acomp_req ;struct crypto_scomp {
Signature · 6 lines
2.39.5 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Herbert Xu
maintainerPATCH v4 2/13 crypto: qat - Remove dst_null support
In reply to a message not in the archiveRemove the unused dst_null support.
--- .../intel/qat/qat_common/qat_comp_algs.c | 83 ------------------- 1 file changed, 83 deletions(-)
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c +0 -83
@@ -29,11 +29,6 @@ struct qat_compression_ctx {int (*qat_comp_callback)(struct qat_compression_req *qat_req,void *resp); }; -struct qat_dst { -bool is_null; -int resubmitted; -}; -struct qat_compression_req {u8 req[QAT_COMP_REQ_SIZE ];struct qat_compression_ctx *qat_compression_ctx;
@@ -42,8 +37,6 @@ struct qat_compression_req {enum direction dir;int actual_dlen;struct qat_alg_req alg_req; -struct work_struct resubmit; -struct qat_dst dst; }; static int qat_alg_send_dc_message(struct qat_compression_req *qat_req,
@@ -60,46 +53,6 @@ static int qat_alg_send_dc_message(struct qat_compression_req *qat_req,return qat_alg_send_message (alg_req); } -static void qat_comp_resubmit (struct work_struct *work) -{ -struct qat_compression_req *qat_req = - container_of(work, struct qat_compression_req, resubmit); -struct qat_compression_ctx *ctx = qat_req->qat_compression_ctx; -struct adf_accel_dev *accel_dev = ctx->inst->accel_dev; -struct qat_request_buffs *qat_bufs = &qat_req->buf; -struct qat_compression_instance *inst = ctx->inst; -struct acomp_req *areq = qat_req->acompress_req; -struct crypto_acomp *tfm =crypto_acomp_reqtfm (areq); -unsigned int dlen =CRYPTO_ACOMP_DST_MAX ; -u8 *req = qat_req->req; -dma_addr_t dfbuf; -int ret; - - areq->dlen = dlen; - -dev_dbg (&GET_DEV (accel_dev),"[%s][%s] retry NULL dst request - dlen = %d\n" , -crypto_tfm_alg_driver_name (crypto_acomp_tfm (tfm)), - qat_req->dir ==COMPRESSION ?"comp" :"decomp" , dlen); - - ret =qat_bl_realloc_map_new_dst (accel_dev, &areq->dst, dlen, qat_bufs, -qat_algs_alloc_flags (&areq->base)); -if (ret) - goto err; - - qat_req->dst.resubmitted = true; - - dfbuf = qat_req->buf.bloutp; -qat_comp_override_dst (req, dfbuf, dlen); - - ret =qat_alg_send_dc_message (qat_req, inst, &areq->base); -if (ret != -ENOSPC ) -return ; - -err: -qat_bl_free_bufl (accel_dev, qat_bufs); -acomp_request_complete (areq, ret); -} -static void qat_comp_generic_callback (struct qat_compression_req *qat_req,void *resp) {
@@ -131,21 +84,6 @@ static void qat_comp_generic_callback(struct qat_compression_req *qat_req, areq->dlen =0 ; -if (qat_req->dir ==DECOMPRESSION && qat_req->dst.is_null) { -if (cmp_err ==ERR_CODE_OVERFLOW_ERROR ) { -if (qat_req->dst.resubmitted) { -dev_dbg (&GET_DEV (accel_dev), -"Output does not fit destination buffer\n" ); - res = -EOVERFLOW ; - goto end; - } - -INIT_WORK (&qat_req->resubmit, qat_comp_resubmit); -adf_misc_wq_queue_work (&qat_req->resubmit); -return ; - } - } -if (unlikely (status !=ICP_QAT_FW_COMN_STATUS_FLAG_OK )) goto end;
@@ -248,26 +186,6 @@ static int qat_comp_alg_compress_decompress(struct acomp_req *areq, enum directiif (areq->dst && !dlen)return -EINVAL ; - qat_req->dst.is_null = false; - -/* Handle acomp requests that require the allocation of a destination -* buffer. The size of the destination buffer is double the source -* buffer (rounded up to the size of a page) to fit the decompressed -* output or an expansion on the data for compression. -*/ -if (!areq->dst) { - qat_req->dst.is_null = true; - - dlen =round_up (2 * slen,PAGE_SIZE ); - areq->dst =sgl_alloc (dlen, f,NULL ); -if (!areq->dst) -return -ENOMEM ; - - dlen -= dhdr + dftr; - areq->dlen = dlen; - qat_req->dst.resubmitted = false; - } -if (dir ==COMPRESSION ) { params.extra_dst_buff = inst->dc_data->ovf_buff_p; ovf_buff_sz = inst->dc_data->ovf_buff_sz;
@@ -329,7 +247,6 @@ static struct acomp_alg qat_acomp[] = { { .exit = qat_comp_alg_exit_tfm, .compress = qat_comp_alg_compress, .decompress = qat_comp_alg_decompress, - .dst_free = sgl_free, .reqsize = sizeof(struct qat_compression_req), }};
Signature · 6 lines
2.39.5 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Cabiddu, Giovanni
maintainerHi Herbert,
Quoted 3 lines · Herbert Xu
Remove the unused
dst_nullsupport.Signed-off-by Herbert Xu <[email protected]>
This patch is replicated in the set and does not apply. See [v4, 02/13]
https://patchwork.kernel.org/project/linux-crypto/patch/11cc12d83023ca382492fc2b2ebf45c84e37acf9.1741954523.git.herbert@gondor.apana.org.au/
It seems, instead, that the correct patch 3, crypto: scomp - Remove support for some non-trivial SG lists, is missing from the submission.
Something weird happened when you submit the set :-).
Signature · 1 line
Giovanni
Cabiddu, Giovanni
maintainerRe: [v4 PATCH 02/13] crypto: qat - Remove dst_null support
In reply to Herbert XuQuoted 12 lines · Herbert Xu
Remove the unused
dst_nullsupport.Signed-off-by Herbert Xu <[email protected]>--- .../intel/qat/qat_common/qat_comp_algs.c | 83 ------------------- 1 file changed, 83 deletions(-)drivers/crypto/intel/qat/qat_common/qat_comp_algs.c +0
-0@@ -29,11 +29,6 @@ struct qat_compression_ctx {
...
Quoted 15 lines
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c +0
-15-static void qat_comp_resubmit (struct work_struct *work) -{ -struct qat_compression_req *qat_req = - container_of(work, struct qat_compression_req, resubmit); -struct qat_compression_ctx *ctx = qat_req->qat_compression_ctx; -struct adf_accel_dev *accel_dev = ctx->inst->accel_dev; -struct qat_request_buffs *qat_bufs = &qat_req->buf; -struct qat_compression_instance *inst = ctx->inst; -struct acomp_req *areq = qat_req->acompress_req; -struct crypto_acomp *tfm =crypto_acomp_reqtfm (areq); -unsigned int dlen =CRYPTO_ACOMP_DST_MAX ; -u8 *req = qat_req->req; -dma_addr_t dfbuf; -int ret; -
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c static int qat_alg_send_dc_message(struct qat_compression_req *qat_req, · line 87
Quoted 10 lines
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c +0
-10- areq->dlen = dlen; - -dev_dbg (&GET_DEV (accel_dev),"[%s][%s] retry NULL dst request - dlen = %d\n" , -crypto_tfm_alg_driver_name (crypto_acomp_tfm (tfm)), - qat_req->dir ==COMPRESSION ?"comp" :"decomp" , dlen); - - ret =qat_bl_realloc_map_new_dst (accel_dev, &areq->dst, dlen, qat_bufs, -qat_algs_alloc_flags (&areq->base)); -if (ret) - goto err;
The implementation of this function in qat/qat_common/qat_bl.c should be removed as well as. After this change, it is not getting called.
Thanks,
Signature · 1 line
Giovanni
Herbert Xu
maintainerQuoted 2 lines · Giovanni
Something weird happened when you submit the set :-).
Sorry, I changed the order of the first three patches but forgot to delete the original patch-set before sending.
This orphaned thread is part of the original and should be ignored.
Cheers,
Signature · 7 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Herbert Xu
maintainerPATCH 1/1 crypto: qat - Remove dead code related to null dst
In reply to Cabiddu, GiovanniQuoted 4 lines · Giovanni
The implementation of this function in
qat/qat_common/qat_bl.cshould be removed as well as. After this change, it is not getting called.
Thanks. I'll fold this patch in if a rebase is needed.
---8<---
Remove dead code left behind after the dropping of null dst support.
Fix the areq->dst test so that a null dst is explicitly forbidden.
--- drivers/crypto/intel/qat/qat_common/qat_bl.c | 159 ------------------ drivers/crypto/intel/qat/qat_common/qat_bl.h | 6 - .../intel/qat/qat_common/qat_comp_algs.c | 2 +- .../intel/qat/qat_common/qat_comp_req.h | 10 -- 4 files changed, 1 insertion(+), 176 deletions(-)
drivers/crypto/intel/qat/qat_common/qat_bl.c +0 -159
@@ -251,162 +251,3 @@ int qat_bl_sgl_to_bufl(struct adf_accel_dev *accel_dev, extra_dst_buff, sz_extra_dst_buff, sskip, dskip, flags); } - -static void qat_bl_sgl_unmap (struct adf_accel_dev *accel_dev, -struct qat_alg_buf_list *bl) -{ -struct device *dev = &GET_DEV (accel_dev); -int n = bl->num_bufs; -int i; - -for (i =0 ; i < n; i++) -if (!dma_mapping_error (dev, bl->buffers[i].addr)) -dma_unmap_single (dev, bl->buffers[i].addr, - bl->buffers[i].len,DMA_FROM_DEVICE ); -} - -static int qat_bl_sgl_map (struct adf_accel_dev *accel_dev, -struct scatterlist *sgl, -struct qat_alg_buf_list **bl) -{ -struct device *dev = &GET_DEV (accel_dev); -struct qat_alg_buf_list *bufl; -int node =dev_to_node (dev); -struct scatterlist *sg; -int n, i, sg_nctr; -size_t sz; - - n =sg_nents (sgl); - sz =struct_size (bufl, buffers, n); - bufl =kzalloc_node (sz,GFP_KERNEL , node); -if (unlikely (!bufl)) -return -ENOMEM ; - -for (i =0 ; i < n; i++) - bufl->buffers[i].addr =DMA_MAPPING_ERROR ; - - sg_nctr =0 ; -for_each_sg (sgl, sg, n, i) { -int y = sg_nctr; - -if (!sg->length) -continue ; - - bufl->buffers[y].addr =dma_map_single (dev,sg_virt (sg), - sg->length, -DMA_FROM_DEVICE ); - bufl->buffers[y].len = sg->length; -if (unlikely (dma_mapping_error (dev, bufl->buffers[y].addr))) - goto err_map; - sg_nctr++; - } - bufl->num_bufs = sg_nctr; - bufl->num_mapped_bufs = sg_nctr; - - *bl = bufl; - -return 0 ; - -err_map: -for (i =0 ; i < n; i++) -if (!dma_mapping_error (dev, bufl->buffers[i].addr)) -dma_unmap_single (dev, bufl->buffers[i].addr, - bufl->buffers[i].len, -DMA_FROM_DEVICE ); -kfree (bufl); - *bl =NULL ; - -return -ENOMEM ; -} - -static void qat_bl_sgl_free_unmap (struct adf_accel_dev *accel_dev, -struct scatterlist *sgl, -struct qat_alg_buf_list *bl, -bool free_bl) -{ -if (bl) { -qat_bl_sgl_unmap (accel_dev, bl); - -if (free_bl) -kfree (bl); - } -if (sgl) -sgl_free (sgl); -} - -static int qat_bl_sgl_alloc_map (struct adf_accel_dev *accel_dev, -struct scatterlist **sgl, -struct qat_alg_buf_list **bl, -unsigned int dlen, -gfp_t gfp) -{ -struct scatterlist *dst; -int ret; - - dst =sgl_alloc (dlen, gfp,NULL ); -if (!dst) { -dev_err (&GET_DEV (accel_dev),"sg_alloc failed\n" ); -return -ENOMEM ; - } - - ret =qat_bl_sgl_map (accel_dev, dst, bl); -if (ret) - goto err; - - *sgl = dst; - -return 0 ; - -err: -sgl_free (dst); - *sgl =NULL ; -return ret; -} - -int qat_bl_realloc_map_new_dst (struct adf_accel_dev *accel_dev, -struct scatterlist **sg, -unsigned int dlen, -struct qat_request_buffs *qat_bufs, -gfp_t gfp) -{ -struct device *dev = &GET_DEV (accel_dev); -dma_addr_t new_blp =DMA_MAPPING_ERROR ; -struct qat_alg_buf_list *new_bl; -struct scatterlist *new_sg; -size_t new_bl_size; -int ret; - - ret =qat_bl_sgl_alloc_map (accel_dev, &new_sg, &new_bl, dlen, gfp); -if (ret) -return ret; - - new_bl_size =struct_size (new_bl, buffers, new_bl->num_bufs); - -/* Map new firmware SGL descriptor */ - new_blp =dma_map_single (dev, new_bl, new_bl_size,DMA_TO_DEVICE ); -if (unlikely (dma_mapping_error (dev, new_blp))) - goto err; - -/* Unmap old firmware SGL descriptor */ -dma_unmap_single (dev, qat_bufs->bloutp, qat_bufs->sz_out,DMA_TO_DEVICE ); - -/* Free and unmap old scatterlist */ -qat_bl_sgl_free_unmap (accel_dev, *sg, qat_bufs->blout, - !qat_bufs->sgl_dst_valid); - - qat_bufs->sgl_dst_valid = false; - qat_bufs->blout = new_bl; - qat_bufs->bloutp = new_blp; - qat_bufs->sz_out = new_bl_size; - - *sg = new_sg; - -return 0 ; -err: -qat_bl_sgl_free_unmap (accel_dev, new_sg, new_bl, true); - -if (!dma_mapping_error (dev, new_blp)) -dma_unmap_single (dev, new_blp, new_bl_size,DMA_TO_DEVICE ); - -return -ENOMEM ; -}
drivers/crypto/intel/qat/qat_common/qat_bl.h +0 -6
@@ -65,10 +65,4 @@ static inline gfp_t qat_algs_alloc_flags(struct crypto_async_request *req) return req->flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC; } -int qat_bl_realloc_map_new_dst (struct adf_accel_dev *accel_dev, -struct scatterlist **newd, -unsigned int dlen, -struct qat_request_buffs *qat_bufs, -gfp_t gfp); -#endif
drivers/crypto/intel/qat/qat_common/qat_comp_algs.c +1 -1
@@ -183,7 +183,7 @@ static int qat_comp_alg_compress_decompress(struct acomp_req *areq, enum directiif (!areq->src || !slen)return -EINVAL ; -if (areq->dst && !dlen) +if (!areq->dst || !dlen)return -EINVAL ;if (dir ==COMPRESSION ) {
drivers/crypto/intel/qat/qat_common/qat_comp_req.h +0 -10
@@ -25,16 +25,6 @@ static inline void qat_comp_create_req(void *ctx, void *req, u64 src, u32 slen, req_pars->out_buffer_sz = dlen; } -static inline void qat_comp_override_dst (void *req,u64 dst,u32 dlen) -{ -struct icp_qat_fw_comp_req *fw_req = req; -struct icp_qat_fw_comp_req_params *req_pars = &fw_req->comp_pars; - - fw_req->comn_mid.dest_data_addr = dst; - fw_req->comn_mid.dst_length = dlen; - req_pars->out_buffer_sz = dlen; -} - static inline void qat_comp_create_compression_req(void *ctx, void *req, u64 src, u32 slen, u64 dst, u32 dlen,
Signature · 6 lines
2.39.5 -- Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt