Re: [PATCH net-next v5 6/8] ethtool: add helper to prevent invalid statistics exposure to userspace
From: Jakub Kicinski
Date: Tue Jan 07 2025 - 21:05:12 EST
On Mon, 6 Jan 2025 09:32:59 +0100 Oleksij Rempel wrote:
> Introduce a new helper function, `ethtool_stat_add`, to update 64-bit
> statistics with proper handling of the reserved value
> `ETHTOOL_STAT_NOT_SET`. This ensures that statistics remain valid and
> are always reported to userspace, even if the driver accidentally sets
> `ETHTOOL_STAT_NOT_SET` during an update.
u64 can't wrap. If it could we should be using a wider type
to count packets/bytes. I don't see the need for this, sorry
for missing the discussion.