Subject: [PATCH net-next v2 2/5] ionic: Get "link_down_count" ext link stat from firmware

From: Eric Joyner <[email-masked]>
Date: Tue, 5 May 2026 21:35:22 -0700

The number of times that link has gone down at the port level is tracked
by the firmware and sent to the driver via regular DMA writes to an
instance of struct ionic_port_status in the driver's memory.

This statistic was never reported in favor of a driver-derived stat, but
doing it in the driver was never necessary since firmware had been
reporting it the whole time. Since it would be more accurate and true to
the description of the statistic to get this count at the PHY level,
replace the driver-calculated statistic with the firmware one and remove
the driver-calculated one entirely.

Signed-off-by: Eric Joyner <[email-masked]>
---
 drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 3 ++-
 drivers/net/ethernet/pensando/ionic/ionic_lif.c     | 1 -
 drivers/net/ethernet/pensando/ionic/ionic_lif.h     | 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
index 78a802eb159f..af0c4cc8ad8e 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
@@ -117,7 +117,8 @@ static void ionic_get_link_ext_stats(struct net_device *netdev,
 	struct ionic_lif *lif = netdev_priv(netdev);
 
 	if (lif->ionic->pdev->is_physfn)
-		stats->link_down_events = lif->link_down_count;
+		stats->link_down_events =
+			    lif->ionic->idev.port_info->status.link_down_count;
 }
 
 static int ionic_get_link_ksettings(struct net_device *netdev,
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 637e635bbf03..eb7e552bc12e 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -179,7 +179,6 @@ static void ionic_link_status_check(struct ionic_lif *lif)
 		}
 	} else {
 		if (netif_carrier_ok(netdev)) {
-			lif->link_down_count++;
 			netdev_info(netdev, "Link down\n");
 			netif_carrier_off(netdev);
 		}
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h
index 8e10f66dc50e..d34692462036 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h
@@ -214,7 +214,6 @@ struct ionic_lif {
 	bool registered;
 	bool doorbell_wa;
 	u16 lif_type;
-	unsigned int link_down_count;
 	unsigned int nmcast;
 	unsigned int nucast;
 	unsigned int nvlans;
-- 
2.17.1