Skip to content

Commit 02c9742

Browse files
committed
crypto: iaa - Remove dst_null support
Remove the unused dst_null support. Signed-off-by: Herbert Xu <[email protected]>
1 parent 2d3553e commit 02c9742

File tree

1 file changed

+6
-130
lines changed

1 file changed

+6
-130
lines changed

drivers/crypto/intel/iaa/iaa_crypto_main.c

Lines changed: 6 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,8 +1136,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req,
11361136
struct idxd_wq *wq,
11371137
dma_addr_t src_addr, unsigned int slen,
11381138
dma_addr_t dst_addr, unsigned int *dlen,
1139-
u32 *compression_crc,
1140-
bool disable_async)
1139+
u32 *compression_crc)
11411140
{
11421141
struct iaa_device_compression_mode *active_compression_mode;
11431142
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,
11801179
desc->src2_size = sizeof(struct aecs_comp_table_record);
11811180
desc->completion_addr = idxd_desc->compl_dma;
11821181

1183-
if (ctx->use_irq && !disable_async) {
1182+
if (ctx->use_irq) {
11841183
desc->flags |= IDXD_OP_FLAG_RCI;
11851184

11861185
idxd_desc->crypto.req = req;
@@ -1193,7 +1192,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req,
11931192
" src_addr %llx, dst_addr %llx\n", __func__,
11941193
active_compression_mode->name,
11951194
src_addr, dst_addr);
1196-
} else if (ctx->async_mode && !disable_async)
1195+
} else if (ctx->async_mode)
11971196
req->base.data = idxd_desc;
11981197

11991198
dev_dbg(dev, "%s: compression mode %s,"
@@ -1214,7 +1213,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req,
12141213
update_total_comp_calls();
12151214
update_wq_comp_calls(wq);
12161215

1217-
if (ctx->async_mode && !disable_async) {
1216+
if (ctx->async_mode) {
12181217
ret = -EINPROGRESS;
12191218
dev_dbg(dev, "%s: returning -EINPROGRESS\n", __func__);
12201219
goto out;
@@ -1234,7 +1233,7 @@ static int iaa_compress(struct crypto_tfm *tfm, struct acomp_req *req,
12341233

12351234
*compression_crc = idxd_desc->iax_completion->crc;
12361235

1237-
if (!ctx->async_mode || disable_async)
1236+
if (!ctx->async_mode)
12381237
idxd_free_desc(wq, idxd_desc);
12391238
out:
12401239
return ret;
@@ -1500,13 +1499,11 @@ static int iaa_comp_acompress(struct acomp_req *req)
15001499
struct iaa_compression_ctx *compression_ctx;
15011500
struct crypto_tfm *tfm = req->base.tfm;
15021501
dma_addr_t src_addr, dst_addr;
1503-
bool disable_async = false;
15041502
int nr_sgs, cpu, ret = 0;
15051503
struct iaa_wq *iaa_wq;
15061504
u32 compression_crc;
15071505
struct idxd_wq *wq;
15081506
struct device *dev;
1509-
int order = -1;
15101507

15111508
compression_ctx = crypto_tfm_ctx(tfm);
15121509

@@ -1536,21 +1533,6 @@ static int iaa_comp_acompress(struct acomp_req *req)
15361533

15371534
iaa_wq = idxd_wq_get_private(wq);
15381535

1539-
if (!req->dst) {
1540-
gfp_t flags = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC;
1541-
1542-
/* incompressible data will always be < 2 * slen */
1543-
req->dlen = 2 * req->slen;
1544-
order = order_base_2(round_up(req->dlen, PAGE_SIZE) / PAGE_SIZE);
1545-
req->dst = sgl_alloc_order(req->dlen, order, false, flags, NULL);
1546-
if (!req->dst) {
1547-
ret = -ENOMEM;
1548-
order = -1;
1549-
goto out;
1550-
}
1551-
disable_async = true;
1552-
}
1553-
15541536
dev = &wq->idxd->pdev->dev;
15551537

15561538
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)
15801562
req->dst, req->dlen, sg_dma_len(req->dst));
15811563

15821564
ret = iaa_compress(tfm, req, wq, src_addr, req->slen, dst_addr,
1583-
&req->dlen, &compression_crc, disable_async);
1565+
&req->dlen, &compression_crc);
15841566
if (ret == -EINPROGRESS)
15851567
return ret;
15861568

@@ -1611,100 +1593,6 @@ static int iaa_comp_acompress(struct acomp_req *req)
16111593
out:
16121594
iaa_wq_put(wq);
16131595

1614-
if (order >= 0)
1615-
sgl_free_order(req->dst, order);
1616-
1617-
return ret;
1618-
}
1619-
1620-
static int iaa_comp_adecompress_alloc_dest(struct acomp_req *req)
1621-
{
1622-
gfp_t flags = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ?
1623-
GFP_KERNEL : GFP_ATOMIC;
1624-
struct crypto_tfm *tfm = req->base.tfm;
1625-
dma_addr_t src_addr, dst_addr;
1626-
int nr_sgs, cpu, ret = 0;
1627-
struct iaa_wq *iaa_wq;
1628-
struct device *dev;
1629-
struct idxd_wq *wq;
1630-
int order = -1;
1631-
1632-
cpu = get_cpu();
1633-
wq = wq_table_next_wq(cpu);
1634-
put_cpu();
1635-
if (!wq) {
1636-
pr_debug("no wq configured for cpu=%d\n", cpu);
1637-
return -ENODEV;
1638-
}
1639-
1640-
ret = iaa_wq_get(wq);
1641-
if (ret) {
1642-
pr_debug("no wq available for cpu=%d\n", cpu);
1643-
return -ENODEV;
1644-
}
1645-
1646-
iaa_wq = idxd_wq_get_private(wq);
1647-
1648-
dev = &wq->idxd->pdev->dev;
1649-
1650-
nr_sgs = dma_map_sg(dev, req->src, sg_nents(req->src), DMA_TO_DEVICE);
1651-
if (nr_sgs <= 0 || nr_sgs > 1) {
1652-
dev_dbg(dev, "couldn't map src sg for iaa device %d,"
1653-
" wq %d: ret=%d\n", iaa_wq->iaa_device->idxd->id,
1654-
iaa_wq->wq->id, ret);
1655-
ret = -EIO;
1656-
goto out;
1657-
}
1658-
src_addr = sg_dma_address(req->src);
1659-
dev_dbg(dev, "dma_map_sg, src_addr %llx, nr_sgs %d, req->src %p,"
1660-
" req->slen %d, sg_dma_len(sg) %d\n", src_addr, nr_sgs,
1661-
req->src, req->slen, sg_dma_len(req->src));
1662-
1663-
req->dlen = 4 * req->slen; /* start with ~avg comp rato */
1664-
alloc_dest:
1665-
order = order_base_2(round_up(req->dlen, PAGE_SIZE) / PAGE_SIZE);
1666-
req->dst = sgl_alloc_order(req->dlen, order, false, flags, NULL);
1667-
if (!req->dst) {
1668-
ret = -ENOMEM;
1669-
order = -1;
1670-
goto out;
1671-
}
1672-
1673-
nr_sgs = dma_map_sg(dev, req->dst, sg_nents(req->dst), DMA_FROM_DEVICE);
1674-
if (nr_sgs <= 0 || nr_sgs > 1) {
1675-
dev_dbg(dev, "couldn't map dst sg for iaa device %d,"
1676-
" wq %d: ret=%d\n", iaa_wq->iaa_device->idxd->id,
1677-
iaa_wq->wq->id, ret);
1678-
ret = -EIO;
1679-
goto err_map_dst;
1680-
}
1681-
1682-
dst_addr = sg_dma_address(req->dst);
1683-
dev_dbg(dev, "dma_map_sg, dst_addr %llx, nr_sgs %d, req->dst %p,"
1684-
" req->dlen %d, sg_dma_len(sg) %d\n", dst_addr, nr_sgs,
1685-
req->dst, req->dlen, sg_dma_len(req->dst));
1686-
ret = iaa_decompress(tfm, req, wq, src_addr, req->slen,
1687-
dst_addr, &req->dlen, true);
1688-
if (ret == -EOVERFLOW) {
1689-
dma_unmap_sg(dev, req->dst, sg_nents(req->dst), DMA_FROM_DEVICE);
1690-
req->dlen *= 2;
1691-
if (req->dlen > CRYPTO_ACOMP_DST_MAX)
1692-
goto err_map_dst;
1693-
goto alloc_dest;
1694-
}
1695-
1696-
if (ret != 0)
1697-
dev_dbg(dev, "asynchronous decompress failed ret=%d\n", ret);
1698-
1699-
dma_unmap_sg(dev, req->dst, sg_nents(req->dst), DMA_FROM_DEVICE);
1700-
err_map_dst:
1701-
dma_unmap_sg(dev, req->src, sg_nents(req->src), DMA_TO_DEVICE);
1702-
out:
1703-
iaa_wq_put(wq);
1704-
1705-
if (order >= 0)
1706-
sgl_free_order(req->dst, order);
1707-
17081596
return ret;
17091597
}
17101598

@@ -1727,9 +1615,6 @@ static int iaa_comp_adecompress(struct acomp_req *req)
17271615
return -EINVAL;
17281616
}
17291617

1730-
if (!req->dst)
1731-
return iaa_comp_adecompress_alloc_dest(req);
1732-
17331618
cpu = get_cpu();
17341619
wq = wq_table_next_wq(cpu);
17351620
put_cpu();
@@ -1810,19 +1695,10 @@ static int iaa_comp_init_fixed(struct crypto_acomp *acomp_tfm)
18101695
return 0;
18111696
}
18121697

1813-
static void dst_free(struct scatterlist *sgl)
1814-
{
1815-
/*
1816-
* Called for req->dst = NULL cases but we free elsewhere
1817-
* using sgl_free_order().
1818-
*/
1819-
}
1820-
18211698
static struct acomp_alg iaa_acomp_fixed_deflate = {
18221699
.init = iaa_comp_init_fixed,
18231700
.compress = iaa_comp_acompress,
18241701
.decompress = iaa_comp_adecompress,
1825-
.dst_free = dst_free,
18261702
.base = {
18271703
.cra_name = "deflate",
18281704
.cra_driver_name = "deflate-iaa",

0 commit comments

Comments
 (0)