Free ring memory on queue_pair release, else
releasing and setting up queue-pair of a different size fails.

Signed-off-by: Fiona Trahe <fiona.trahe at intel.com>
---
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c 
b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index d3c46ac..3d49e2a 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -311,8 +311,14 @@ aesni_mb_pmd_info_get(struct rte_cryptodev *dev,
 static int
 aesni_mb_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 {
-       if (dev->data->queue_pairs[qp_id] != NULL) {
-               rte_free(dev->data->queue_pairs[qp_id]);
+       struct aesni_mb_qp *qp = dev->data->queue_pairs[qp_id];
+       struct rte_ring *r = NULL;
+
+       if (qp != NULL) {
+               r = rte_ring_lookup(qp->name);
+               if (r)
+                       rte_ring_free(r);
+               rte_free(qp);
                dev->data->queue_pairs[qp_id] = NULL;
        }
        return 0;
-- 
2.5.0

Reply via email to