On Tue, Oct 27, 2026 at 10:51:32AM +0000, Anurag Mandal wrote:
> 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")
Cc: [email protected]
> 
> 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);
> -- 

AI review flagged a potential improvement:

“net/ice: fix memory leaks on port close”: some close-time resources remain
unreleased. This is a pre-existing gap, not introduced by these commits:
ice_dev_close() calls ice_sched_cleanup_all(), which does not free the
scheduler aggregation lists; the canonical ice_deinit_hw() also calls
ice_sched_clear_agg(). It likewise frees fd_ctr_base at ice_deinit_hw(),
while ice_init_hw() allocates that resource. Thus, close/reset can still
leave aggregation-list memory and the FD counter resource behind.
Confidence: 9/10.

Can you check if more work is needed here?

/Bruce

Reply via email to