Re: [PATCH net-next 2/3] ionic: clean dbpage in de-init
From: Joe Damato
Date: Thu Jun 12 2025 - 09:45:11 EST
On Mon, Jun 09, 2025 at 02:46:43PM -0700, Shannon Nelson wrote:
> Since the kern_dbpage gets set up in ionic_lif_init() and that
> function's error path will clean it if needed, the kern_dbpage
> on teardown should be cleaned in ionic_lif_deinit(), not in
> ionic_lif_free(). As it is currently we get a double call
> to iounmap() on kern_dbpage if the PCI ionic fails setting up
> the lif. One example of this is when firmware isn't responding
> to AdminQ requests and ionic's first AdminQ call fails to
> setup the NotifyQ.
>
> Signed-off-by: Shannon Nelson <shannon.nelson@xxxxxxx>
> ---
> drivers/net/ethernet/pensando/ionic/ionic_lif.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 7707a9e53c43..48cb5d30b5f6 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -3526,10 +3526,6 @@ void ionic_lif_free(struct ionic_lif *lif)
> lif->info = NULL;
> lif->info_pa = 0;
>
> - /* unmap doorbell page */
> - ionic_bus_unmap_dbpage(lif->ionic, lif->kern_dbpage);
> - lif->kern_dbpage = NULL;
> -
> mutex_destroy(&lif->config_lock);
> mutex_destroy(&lif->queue_lock);
>
> @@ -3555,6 +3551,9 @@ void ionic_lif_deinit(struct ionic_lif *lif)
> ionic_lif_qcq_deinit(lif, lif->notifyqcq);
> ionic_lif_qcq_deinit(lif, lif->adminqcq);
>
> + ionic_bus_unmap_dbpage(lif->ionic, lif->kern_dbpage);
> + lif->kern_dbpage = NULL;
> +
Seems fine to me; my only minor nit that you can probably ignore is that the
code to unmap the page and set kern_dbpage to NULL is repeated, as you
mentioned, in ionic_lif_init's error path. Not sure if it's worth adding a
wrapper to avoid the repetition.
In either case:
Reviewed-by: Joe Damato <joe@xxxxxxx>