From: Radu Nicolau <radu.nicolau@intel.com>
To: dev@dpdk.org
Cc: maxime.coquelin@redhat.com, david.marchand@redhat.com,
Radu Nicolau <radu.nicolau@intel.com>,
jianjay.zhou@huawei.com, Yu Jiang <yux.jiang@intel.com>,
Fan Zhang <fanzhang.oss@gmail.com>
Subject: [PATCH v2] crypto/virtio: cookies are allocated from mempool
Date: Mon, 6 Jul 2026 09:57:46 +0000 [thread overview]
Message-ID: <20260706095746.2586714-2-radu.nicolau@intel.com> (raw)
In-Reply-To: <20260703144931.2541180-1-radu.nicolau@intel.com>
The Rx/Tx functions allocate cookies as needed, no need to
allocate and free from heap.
Fixes: 6f0175ff53e0 ("crypto/virtio: support basic PMD ops")
Cc: jianjay.zhou@huawei.com
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Tested-by: Yu Jiang <yux.jiang@intel.com>
---
v2: removed redundant mempool free
drivers/crypto/virtio/virtio_cryptodev.c | 23 -----------------------
1 file changed, 23 deletions(-)
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index 6f079f15f6..d70651646e 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -68,7 +68,6 @@ void
virtio_crypto_queue_release(struct virtqueue *vq)
{
struct virtio_crypto_hw *hw;
- uint16_t i;
PMD_INIT_FUNC_TRACE();
@@ -80,9 +79,6 @@ virtio_crypto_queue_release(struct virtqueue *vq)
hw->vqs[vq->vq_queue_index] = NULL;
rte_memzone_free(vq->mz);
rte_mempool_free(vq->mpool);
- for (i = 0; i < vq->vq_nentries; i++)
- rte_free(vq->vq_descx[i].cookie);
-
rte_free(vq);
}
}
@@ -102,8 +98,6 @@ virtio_crypto_queue_setup(struct rte_cryptodev *dev,
unsigned int vq_size;
struct virtio_crypto_hw *hw = dev->data->dev_private;
struct virtqueue *vq = NULL;
- uint32_t i = 0;
- uint32_t j;
PMD_INIT_FUNC_TRACE();
@@ -175,29 +169,12 @@ virtio_crypto_queue_setup(struct rte_cryptodev *dev,
"Cannot create mempool");
goto mpool_create_err;
}
- for (i = 0; i < nb_desc; i++) {
- vq->vq_descx[i].cookie =
- rte_zmalloc("crypto PMD op cookie pointer",
- sizeof(struct virtio_crypto_op_cookie),
- RTE_CACHE_LINE_SIZE);
- if (vq->vq_descx[i].cookie == NULL) {
- VIRTIO_CRYPTO_DRV_LOG_ERR("Failed to "
- "alloc mem for cookie");
- goto cookie_alloc_err;
- }
- }
}
*pvq = vq;
return 0;
-cookie_alloc_err:
- rte_mempool_free(vq->mpool);
- if (i != 0) {
- for (j = 0; j < i; j++)
- rte_free(vq->vq_descx[j].cookie);
- }
mpool_create_err:
rte_free(vq);
return -ENOMEM;
--
2.52.0
next prev parent reply other threads:[~2026-07-06 9:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 14:49 [PATCH] crypto/virtio: cookies are allocated from mempool Radu Nicolau
2026-07-06 3:00 ` Jiang, YuX
2026-07-06 9:18 ` David Marchand
2026-07-06 9:57 ` Radu Nicolau [this message]
2026-07-06 11:03 ` [PATCH v2] " David Marchand
2026-07-15 10:29 ` Ji, Kai
2026-07-16 18:34 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260706095746.2586714-2-radu.nicolau@intel.com \
--to=radu.nicolau@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=jianjay.zhou@huawei.com \
--cc=maxime.coquelin@redhat.com \
--cc=yux.jiang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox