* Clarification: ethtool -S stats persistence across ifconfig down/up
@ 2025-07-14 7:16 Naveen Mamindlapalli
2025-07-14 13:21 ` Andrew Lunn
0 siblings, 1 reply; 3+ messages in thread
From: Naveen Mamindlapalli @ 2025-07-14 7:16 UTC (permalink / raw)
To: netdev, Jakub Kicinski, Andrew Lunn, David S. Miller,
Eric Dumazet
Hi All,
I am trying to better understand the expected behavior of Netdev
statistics reported via `ethtool -S`.
Specifically, I would like to clarify:
Are drivers expected to retain `ethtool -S` statistics across
interface down/up cycles (i.e., ifconfig ethX down followed by
ifconfig ethX up)?
From my reading of the kernel documentation:
- The file Documentation/networking/statistics.rst states that
standard netdev statistics (such as those shown via ip -s link) are
expected to persist across interface resets.
- However, Documentation/networking/ethtool-netlink.rst (as of Linux
v6.15) does not mention any such requirement for `ethtool -S`
statistics.
So my understanding is that `ethtool -S` statistics may reset across
down/up, depending on how the hardware and driver implement the stats.
If this is the intended and accepted behavior, would it make sense to:
- Document this explicitly in ethtool-netlink.rst or statistics.rst?
This clarification would be helpful for the developers and users.
Thanks,
Naveen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Clarification: ethtool -S stats persistence across ifconfig down/up
2025-07-14 7:16 Clarification: ethtool -S stats persistence across ifconfig down/up Naveen Mamindlapalli
@ 2025-07-14 13:21 ` Andrew Lunn
2025-07-15 12:48 ` Naveen Mamindlapalli
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2025-07-14 13:21 UTC (permalink / raw)
To: Naveen Mamindlapalli
Cc: netdev, Jakub Kicinski, David S. Miller, Eric Dumazet
On Mon, Jul 14, 2025 at 12:46:15PM +0530, Naveen Mamindlapalli wrote:
> Hi All,
>
> I am trying to better understand the expected behavior of Netdev
> statistics reported via `ethtool -S`.
>
> Specifically, I would like to clarify:
> Are drivers expected to retain `ethtool -S` statistics across
> interface down/up cycles (i.e., ifconfig ethX down followed by
> ifconfig ethX up)?
>
> >From my reading of the kernel documentation:
> - The file Documentation/networking/statistics.rst states that
> standard netdev statistics (such as those shown via ip -s link) are
> expected to persist across interface resets.
> - However, Documentation/networking/ethtool-netlink.rst (as of Linux
> v6.15) does not mention any such requirement for `ethtool -S`
> statistics.
>
> So my understanding is that `ethtool -S` statistics may reset across
> down/up, depending on how the hardware and driver implement the stats.
I'm not sure it is written down anywhere, but the general expectation
is that they survive a down/up.
Statistic counters going backwards is not so easy to deal with. These
statistics can be exported to third party systems, e.g. via an SNMP
agent. So it is better they only go backwards when they wrap around.
Having said that, this topic is not closely looked at when reviewing
drivers, so i expect there are a number of drivers which do reset to
zero on close/open.
Feel free to submit a patch extending the documentation, but please
make it clear that the reality is, some drivers will reset to zero,
even if the intended behaviour is they don't.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Clarification: ethtool -S stats persistence across ifconfig down/up
2025-07-14 13:21 ` Andrew Lunn
@ 2025-07-15 12:48 ` Naveen Mamindlapalli
0 siblings, 0 replies; 3+ messages in thread
From: Naveen Mamindlapalli @ 2025-07-15 12:48 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev, Jakub Kicinski, David S. Miller, Eric Dumazet
On Mon, Jul 14, 2025 at 6:51 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Mon, Jul 14, 2025 at 12:46:15PM +0530, Naveen Mamindlapalli wrote:
> > Hi All,
> >
> > I am trying to better understand the expected behavior of Netdev
> > statistics reported via `ethtool -S`.
> >
> > Specifically, I would like to clarify:
> > Are drivers expected to retain `ethtool -S` statistics across
> > interface down/up cycles (i.e., ifconfig ethX down followed by
> > ifconfig ethX up)?
> >
> > >From my reading of the kernel documentation:
> > - The file Documentation/networking/statistics.rst states that
> > standard netdev statistics (such as those shown via ip -s link) are
> > expected to persist across interface resets.
> > - However, Documentation/networking/ethtool-netlink.rst (as of Linux
> > v6.15) does not mention any such requirement for `ethtool -S`
> > statistics.
> >
> > So my understanding is that `ethtool -S` statistics may reset across
> > down/up, depending on how the hardware and driver implement the stats.
>
> I'm not sure it is written down anywhere, but the general expectation
> is that they survive a down/up.
>
> Statistic counters going backwards is not so easy to deal with. These
> statistics can be exported to third party systems, e.g. via an SNMP
> agent. So it is better they only go backwards when they wrap around.
>
> Having said that, this topic is not closely looked at when reviewing
> drivers, so i expect there are a number of drivers which do reset to
> zero on close/open.
>
> Feel free to submit a patch extending the documentation, but please
> make it clear that the reality is, some drivers will reset to zero,
> even if the intended behaviour is they don't.
>
> Andrew
Hi Andrew,
Thank you for the clarification. That makes sense, I can see why
counters going backwards would be problematic, and thanks for
clarifying the expected vs actual driver behavior.
I will plan to submit a patch to extend the documentation, explicitly
noting that while the intended behavior is for ethtool -S statistics
to persist across down/up cycles, some drivers may still reset them.
Thanks,
Naveen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-15 12:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 7:16 Clarification: ethtool -S stats persistence across ifconfig down/up Naveen Mamindlapalli
2025-07-14 13:21 ` Andrew Lunn
2025-07-15 12:48 ` Naveen Mamindlapalli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).