Subject: Re: [PATCH net 1/1] ice: move devlink port creation/deletion

From: Leon Romanovsky <[email-masked]>
Date: Tue, 24 Jan 2023 08:59:29 +0200

On Mon, Jan 23, 2023 at 04:57:14PM -0800, Tony Nguyen wrote:
> From: Paul M Stillwell Jr <[email-masked]>
> 
> Commit a286ba738714 ("ice: reorder PF/representor devlink
> port register/unregister flows") moved the code to create
> and destroy the devlink PF port. This was fine, but created
> a corner case issue in the case of ice_register_netdev()
> failing. In that case, the driver would end up calling
> ice_devlink_destroy_pf_port() twice.
> 
> Additionally, it makes no sense to tie creation of the devlink
> PF port to the creation of the netdev so separate out the
> code to create/destroy the devlink PF port from the netdev
> code. This makes it a cleaner interface.
> 
> Fixes: a286ba738714 ("ice: reorder PF/representor devlink port register/unregister flows")
> Signed-off-by: Paul M Stillwell Jr <[email-masked]>
> Tested-by: Gurucharan G <[email-masked]> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <[email-masked]>
> ---
> There will be a merge conflict when rebasing with next-next.
> 
> Resolution:
> static void ice_remove(struct pci_dev *
>   		ice_remove_arfs(pf);
>   	ice_setup_mc_magic_wake(pf);
>   	ice_vsi_release_all(pf);
>  -	mutex_destroy(&(&pf->hw)->fdir_fltr_lock);
>  +	mutex_destroy(&hw->fdir_fltr_lock);
> + 	ice_devlink_destroy_pf_port(pf);
>   	ice_set_wake(pf);
>   	ice_free_irq_msix_misc(pf);
>   	ice_for_each_vsi(pf, i) {
> 
>  drivers/net/ethernet/intel/ice/ice_lib.c  |  3 ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 25 +++++++++++++++--------
>  2 files changed, 17 insertions(+), 11 deletions(-)

If you seek cleaner interface, you will be better separate
ice_vsi_release_all() to many small building blocks, so unwind will be
symmetrical to probe.

Thanks,
Reviewed-by: Leon Romanovsky <[email-masked]>