bdev/crypto: release qpairs on module finish
We setup the qpairs on module init but never released them. Some memory was leaked, although since it was allocated with rte_malloc() it couldn't be picked up by ASAN. rte_cryptodev API offers rte_cryptodev_queue_pair_setup() to setup a qpair, but there's no equivalent function to release it. We have to access the rte_cryptodev structure directly and call a qpair release function ptr that's stored inside. It seems very very hacky, but the entire rte_cryptodev structure is a part of the public API and the global array of all such devices is an exported symbol. Change-Id: I17ac73d1098ca9a92d2dfd52e0f905e2c2b5488f Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/443561 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
bdc96b4dd6
commit
40240f7e9d
@ -1288,6 +1288,7 @@ vbdev_crypto_finish(void)
|
||||
struct bdev_names *name;
|
||||
struct vbdev_dev *device;
|
||||
struct device_qp *dev_qp;
|
||||
unsigned i;
|
||||
|
||||
while ((name = TAILQ_FIRST(&g_bdev_names))) {
|
||||
TAILQ_REMOVE(&g_bdev_names, name, link);
|
||||
@ -1299,8 +1300,20 @@ vbdev_crypto_finish(void)
|
||||
}
|
||||
|
||||
while ((device = TAILQ_FIRST(&g_vbdev_devs))) {
|
||||
struct rte_cryptodev *rte_dev;
|
||||
|
||||
TAILQ_REMOVE(&g_vbdev_devs, device, link);
|
||||
rte_cryptodev_stop(device->cdev_id);
|
||||
|
||||
assert(device->cdev_id < RTE_CRYPTO_MAX_DEVS);
|
||||
rte_dev = &rte_cryptodevs[device->cdev_id];
|
||||
|
||||
if (rte_dev->dev_ops->queue_pair_release != NULL) {
|
||||
for (i = 0; i < device->cdev_info.max_nb_queue_pairs; i++) {
|
||||
rte_dev->dev_ops->queue_pair_release(rte_dev, i);
|
||||
}
|
||||
}
|
||||
|
||||
free(device);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user