ice_dev_close() tears down the hardware state rather than with
ice_deinit_hw(), and never frees the switch filter management
structures, the DDP package copy or any remaining VSI contexts.
As ice_dev_reset() is a close followed by an init, they also
leak on every port reset.

Free them on close.

Fixes: f9cf4f864150 ("net/ice: support device initialization")
Fixes: 9c4f15901ada ("net/ice: free memory with matching allocator")

Signed-off-by: Anurag Mandal <[email protected]>
---
 drivers/net/intel/ice/ice_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/intel/ice/ice_ethdev.c 
b/drivers/net/intel/ice/ice_ethdev.c
index dd3a4976ab..27f992aefa 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -3109,8 +3109,12 @@ ice_dev_close(struct rte_eth_dev *dev)
 
        ice_res_pool_destroy(&pf->msix_pool);
        ice_release_vsi(pf->main_vsi);
+       ice_cleanup_fltr_mgmt_struct(hw);
+       hw->switch_info = NULL;
        ice_sched_cleanup_all(hw);
        ice_free_hw_tbls(hw);
+       ice_free_seg(hw);
+       ice_clear_all_vsi_ctx(hw);
        ice_free(hw, hw->port_info);
        hw->port_info = NULL;
        free((void *)(uintptr_t)ad->devargs.ddp_filename);
-- 
2.25.1

Reply via email to