Skip to contentSkip to conversation

ionic: three little changes

PATCH Applied Shannon Nelson 4 participants 11 messages Jun 9, 2025 – Jun 13, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ionic: three little changes

These are three little changes for the code from inspection and testing.

Shannon Nelson (3):
ionic: print firmware heartbeat as unsigned
ionic: clean dbpage in de-init
ionic: cancel delayed work earlier in remove

 drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 1 +
 drivers/net/ethernet/pensando/ionic/ionic_dev.c     | 4 ++--
 drivers/net/ethernet/pensando/ionic/ionic_lif.c     | 7 +++----
 3 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 ionic: print firmware heartbeat as unsigned

The firmware heartbeat value is an unsigned number, and seeing a negative number when it gets big is a little disconcerting. Example:

    ionic 0000:24:00.0: FW heartbeat stalled at -1342169688

Print using the unsigned flag.

---
 drivers/net/ethernet/pensando/ionic/ionic_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_dev.c +2 -2
index 57edcde9e6f8..532faf6d15ee 100644
@@ -424,9 +424,9 @@ int ionic_heartbeat_check(struct ionic *ionic)
 	if (fw_hb_ready != idev->fw_hb_ready) {
 		idev->fw_hb_ready = fw_hb_ready;
 		if (!fw_hb_ready)
-			dev_info(ionic->dev, "FW heartbeat stalled at %d\n", fw_hb);
+			dev_info(ionic->dev, "FW heartbeat stalled at %u\n", fw_hb);
 		else
-			dev_info(ionic->dev, "FW heartbeat restored at %d\n", fw_hb);
+			dev_info(ionic->dev, "FW heartbeat restored at %u\n", fw_hb);
 	}
 
 	if (!fw_hb_ready)
Signature · 1 line
2.17.1
reviewer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH net-next 1/3] ionic: print firmware heartbeat as unsigned

Quoted 8 lines · Shannon Nelson

The firmware heartbeat value is an unsigned number, and seeing a negative number when it gets big is a little disconcerting. Example:

    ionic 0000:24:00.0: FW heartbeat stalled at -1342169688

Print using the unsigned flag.

Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH net-next 1/3] ionic: print firmware heartbeat as unsigned

In reply to Shannon Nelson
Quoted 11 lines · Shannon Nelson

The firmware heartbeat value is an unsigned number, and seeing a negative number when it gets big is a little disconcerting. Example:

    ionic 0000:24:00.0: FW heartbeat stalled at -1342169688

Print using the unsigned flag.

---
 drivers/net/ethernet/pensando/ionic/ionic_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#4 lore raw

PATCH 2/3 ionic: clean dbpage in de-init

In reply to Shannon Nelson

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.

---
 drivers/net/ethernet/pensando/ionic/ionic_lif.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +3 -4
index 7707a9e53c43..48cb5d30b5f6 100644
@@ -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;
+
 	ionic_lif_reset(lif);
 }
 
Signature · 1 line
2.17.1
reviewer Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH net-next 2/3] ionic: clean dbpage in de-init

Quoted 10 lines · Shannon Nelson

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.

Reviewed-by on v1 2/3
#6 lore raw

Re: [PATCH net-next 2/3] ionic: clean dbpage in de-init

In reply to Shannon Nelson
Quoted 30 lines · Shannon Nelson

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.

---
 drivers/net/ethernet/pensando/ionic/ionic_lif.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +0 -4
index 7707a9e53c43..48cb5d30b5f6 100644
@@ -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);
 

drivers/net/ethernet/pensando/ionic/ionic_lif.c void ionic_lif_deinit(struct ionic_lif *lif) · line 3556

Quoted 6 lines
drivers/net/ethernet/pensando/ionic/ionic_lif.c +3 -0
@@ -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:

#7 lore raw

PATCH 3/3 ionic: cancel delayed work earlier in remove

In reply to Shannon Nelson

Cancel any entries on the delayed work queue before starting to tear down the lif to be sure there is no race with any other events.

---
 drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +1 -0
index 4c377bdc62c8..136bfa3516d0 100644
@@ -409,6 +409,7 @@ static void ionic_remove(struct pci_dev *pdev)
 	timer_shutdown_sync(&ionic->watchdog_timer);
 
 	if (ionic->lif) {
+		cancel_work_sync(&ionic->lif->deferred.work);
 		/* prevent adminq cmds if already known as down */
 		if (test_and_clear_bit(IONIC_LIF_F_FW_RESET, ionic->lif->state))
 			set_bit(IONIC_LIF_F_FW_STOPPING, ionic->lif->state);
Signature · 1 line
2.17.1
Reviewed-by on v1 3/3
#9 lore raw

Re: [PATCH net-next 3/3] ionic: cancel delayed work earlier in remove

In reply to Shannon Nelson
Quoted 14 lines · Shannon Nelson

Cancel any entries on the delayed work queue before starting to tear down the lif to be sure there is no race with any other events.

---
 drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +0 -0
index 4c377bdc62c8..136bfa3516d0 100644

drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c static void ionic_remove(struct pci_dev *pdev) · line 415

Quoted 7 lines
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +1 -0
@@ -409,6 +409,7 @@ static void ionic_remove(struct pci_dev *pdev)
 	timer_shutdown_sync(&ionic->watchdog_timer);
 
 	if (ionic->lif) {
+		cancel_work_sync(&ionic->lif->deferred.work);
 		/* prevent adminq cmds if already known as down */
 		if (test_and_clear_bit(IONIC_LIF_F_FW_RESET, ionic->lif->state))
 			set_bit(IONIC_LIF_F_FW_STOPPING, ionic->lif->state);

Wanted to note that it seems this could be called twice in this path?

Once above and then a second time in ionic_lif_deinit, although ionic_lif_deinit seems to be called from other paths (like fw down?), so that's probably OK.

#10 lore raw
In reply to Shannon Nelson
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 9 lines · On Mon, 9 Jun 2025 14:46:41 -0700 you wrote:

These are three little changes for the code from inspection and testing.

Shannon Nelson (3):
ionic: print firmware heartbeat as unsigned
ionic: clean dbpage in de-init
ionic: cancel delayed work earlier in remove

[...]

Here is the summary with links:
- [net-next,1/3] ionic: print firmware heartbeat as unsigned

    https://git.kernel.org/netdev/net-next/c/696158ff4dcd
  - [net-next,2/3] ionic: clean dbpage in de-init
    https://git.kernel.org/netdev/net-next/c/c9080abea1e6
  - [net-next,3/3] ionic: cancel delayed work earlier in remove
    https://git.kernel.org/netdev/net-next/c/52fdba899e6f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html