Netdev List
 help / color / mirror / Atom feed
From: Eric Joyner <eric.joyner@amd.com>
To: <netdev@vger.kernel.org>
Cc: Brett Creeley <brett.creeley@amd.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Eric Joyner <eric.joyner@amd.com>
Subject: [PATCH net-next v4 4/5] ionic: Report "link_down_events_phy" in ethtool statistics
Date: Tue, 9 Jun 2026 23:18:29 -0700	[thread overview]
Message-ID: <20260610061830.51037-5-eric.joyner@amd.com> (raw)
In-Reply-To: <20260610061830.51037-1-eric.joyner@amd.com>

There already exists a link_down_events statistic that is calculated
by the firmware and is reported via the .get_link_ext_stats()
ethtool handler, but there is a value that is calculated by the
firmware, too, that could be useful.

Instead of replacing the driver calculated value, add the firmware value
to the ethtool general stats output. Unlike the driver value, the
firmware value doesn't get reset unless the actual card itself gets
reset and is limited 16 bits, making it harder to use to track link down
events e.g.  during the current boot and any excessive number of link
flaps. That said, it could still be useful to track link down events
while the driver is not loaded, such as checking if the link partner is
flapping while the local system is booting or otherwise does not have
the ionic driver loaded.

Signed-off-by: Eric Joyner <eric.joyner@amd.com>
---
 drivers/net/ethernet/pensando/ionic/ionic_stats.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_stats.c b/drivers/net/ethernet/pensando/ionic/ionic_stats.c
index e81190cc9d2f..d0ebba7aec22 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_stats.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_stats.c
@@ -237,7 +237,7 @@ static u32 ionic_extra_port_stats_get_count(struct ionic_lif *lif)
 {
 	struct ionic_dev *idev = &lif->ionic->idev;
 	struct ionic_port_extra_stats *pes_cache;
-	u32 count = 0;
+	u32 count = 1;
 
 	if (!(lif->ionic->ident.dev.capabilities &
 	      cpu_to_le64(IONIC_DEV_CAP_EXTRA_STATS)))
@@ -296,6 +296,8 @@ static void ionic_extra_port_stats_get_strings(struct ionic_lif *lif, u8 **buf)
 {
 	struct ionic_port_extra_stats *pes_cache;
 
+	ethtool_puts(buf, "link_down_events_phy");
+
 	if (!(lif->ionic->ident.dev.capabilities &
 	    cpu_to_le64(IONIC_DEV_CAP_EXTRA_STATS)))
 		return;
@@ -360,8 +362,12 @@ static void ionic_sw_stats_get_rxq_values(struct ionic_lif *lif, u64 **buf,
 
 static void ionic_extra_port_stats_get_values(struct ionic_lif *lif, u64 **buf)
 {
+	struct ionic_port_info *port_info = lif->ionic->idev.port_info;
 	struct ionic_port_extra_stats *pes_cache;
 
+	**buf = le16_to_cpu(port_info->status.link_down_count);
+	(*buf)++;
+
 	if (!(lif->ionic->ident.dev.capabilities &
 	      cpu_to_le64(IONIC_DEV_CAP_EXTRA_STATS)))
 		return;
-- 
2.17.1


  parent reply	other threads:[~2026-06-10  6:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10  6:18 [PATCH net-next v4 0/5] ionic: Expose more port stats to ethtool Eric Joyner
2026-06-10  6:18 ` [PATCH net-next v4 1/5] ionic: Fix check in ionic_get_link_ext_stats Eric Joyner
2026-06-10  6:18 ` [PATCH net-next v4 2/5] ionic: Update ionic_if.h with new extra port stats Eric Joyner
2026-06-10  6:18 ` [PATCH net-next v4 3/5] ionic: Report "rx_bits_phy" stat to ethtool Eric Joyner
2026-06-10  6:18 ` Eric Joyner [this message]
2026-06-10  6:18 ` [PATCH net-next v4 5/5] ionic: Add .get_fec_stats ethtool handler Eric Joyner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260610061830.51037-5-eric.joyner@amd.com \
    --to=eric.joyner@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox