Currently, when a DPIO device is closed, or when a failed DPIO probe
tears down the devices already on the list, we release the device but
never unmap its QBMan software portal regions. This leaks two mappings
per device.

Fix it by unmapping the portal regions in both places.

Fixes: e55d0494ab98 ("bus/fslmc: support secondary process")
Fixes: 274fd921ff7f ("bus/fslmc: support close operation")
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Signed-off-by: Anatoly Burakov <[email protected]>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c 
b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 67740601e6b..e7d72eac368 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -489,6 +489,7 @@ dpaa2_close_dpio_device(int object_id)
                        rte_free(dpio_dev->dpio);
                }
                TAILQ_REMOVE(&dpio_dev_list, dpio_dev, next);
+               dpaa2_unmap_dpio_portal(dpio_dev);
                rte_intr_fd_close(dpio_dev->intr_handle);
                /* dev_fd is closed by caller, clear reference here. */
                rte_intr_dev_fd_set(dpio_dev->intr_handle, -1);
@@ -710,6 +711,7 @@ dpaa2_create_dpio_device(int vdev_fd,
                                dpio_dev->token);
                        rte_free(dpio_dev->dpio);
                }
+               dpaa2_unmap_dpio_portal(dpio_dev);
                rte_intr_fd_close(dpio_dev->intr_handle);
                /* dev_fd is closed by caller, clear reference here. */
                rte_intr_dev_fd_set(dpio_dev->intr_handle, -1);
-- 
2.52.0

Reply via email to