public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Joyner <eric.joyner@amd.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Brett Creeley <brett.creeley@amd.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next 2/5] ionic: Report "link_down_events_phy" in ethtool statistics
Date: Tue, 5 May 2026 20:41:17 -0700	[thread overview]
Message-ID: <4b8bea35-ccb9-44a7-a104-7f69afbd2599@amd.com> (raw)
In-Reply-To: <20260505162135.5fa39358@kernel.org>

On 5/5/2026 4:21 PM, Jakub Kicinski wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> On Tue, 5 May 2026 12:53:26 -0700 Eric Joyner wrote:
>>> We have a standard stat for this:
>>>
>>> struct ethtool_link_ext_stats {
>>>         /* Custom Linux statistic for PHY level link down events.
>>>          * In a simpler world it should be equal to netdev->carrier_down_count
>>>          * unfortunately netdev also counts local reconfigurations which don't
>>>          * actually take the physical link down, not to mention NC-SI which,
>>>          * if present, keeps the link up regardless of host state.
>>>          * This statistic counts when PHY _actually_ went down, or lost link.
>>>          *
>>>          * Note that we need u64 for ethtool_stats_init() and comparisons
>>>          * to ETHTOOL_STAT_NOT_SET, but only u32 is exposed to the user.
>>>          */
>>>         u64 link_down_events;
>>> };
>>>
>>>
>>> IOW the definition of this stat is - ignoring asymetric link faults
>>> this counter should match between link partners.
>>
>> So, this is a little awkward to talk about -- we are already filling out that
>> field with a stat that's calculated by the driver; there's a task that monitors
>> link transitions and increments it.
>>
>> But, I'm not sure if that method exists because of older firmwares or cards not
>> tracking the link_down_event count for us. So, I didn't want to just overwrite
>> this stat with the value from firmware because then we'd lose the count on cards
>> running firmware that doesn't do that counting for us.
>>
>> So that's one reason why I put the stat in the generic ethtool stats output, and
>> gave it the slightly different name "link_down_events_phy" to distinguish it
>> (this also matches Mellanox's name for consistency) from this stat in the struct
>> you posted. Though reading the doc comment you posted, this new stat really does
>> belong there.
> 
> If the stat is currently filled in with something that does not work as
> documented it should be fine to drop it. The counter is optional and
> relatively recent. I think it's unlikely that any monitoring will have
> a hard dependency on it.

We did some testing internally, and it's safe to replace the link_down_events
stat with the FW generated stat instead of the one the driver calculates. It
gets populated and updated properly by the firmware on all of the hardware we
test on; I'll have that replaced in the v2.

- Eric

  reply	other threads:[~2026-05-06  3:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01  3:15 [PATCH net-next 0/5] Expose more port stats to ethtool Eric Joyner
2026-05-01  3:15 ` [PATCH net-next 1/5] ionic: Small improvements in devcmd retry logic Eric Joyner
2026-05-01 23:37   ` Jakub Kicinski
2026-05-05 15:54     ` Eric Joyner
2026-05-01  3:15 ` [PATCH net-next 2/5] ionic: Report "link_down_events_phy" in ethtool statistics Eric Joyner
2026-05-01 23:39   ` Jakub Kicinski
2026-05-05 19:53     ` Eric Joyner
2026-05-05 23:21       ` Jakub Kicinski
2026-05-06  3:41         ` Eric Joyner [this message]
2026-05-01  3:15 ` [PATCH net-next 3/5] ionic: Update ionic_if.h with new extra port stats structure Eric Joyner
2026-05-01 23:40   ` Jakub Kicinski
2026-05-01  3:15 ` [PATCH net-next 4/5] ionic: Report rx_bits_phy stat to ethtool Eric Joyner
2026-05-01  3:15 ` [PATCH net-next 5/5] ionic: Add .get_fec_stats ethtool handler Eric Joyner
2026-05-01 23:41   ` Jakub Kicinski
2026-05-05 19:44     ` Eric Joyner
2026-05-05 13:54   ` Vadim Fedorenko
2026-05-05 19:43     ` 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=4b8bea35-ccb9-44a7-a104-7f69afbd2599@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=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