[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241205171909.274715c2@kernel.org>
Date: Thu, 5 Dec 2024 17:19:09 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Oleksij Rempel <o.rempel@...gutronix.de>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>, Heiner Kallweit
<hkallweit1@...il.com>, Jonathan Corbet <corbet@....net>,
kernel@...gutronix.de, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Simon Horman <horms@...nel.org>, Maxime Chevallier
<maxime.chevallier@...tlin.com>, linux-doc@...r.kernel.org
Subject: Re: [PATCH net-next v1 1/7] net: ethtool: plumb PHY stats to PHY
drivers
On Thu, 5 Dec 2024 11:57:33 +0000 Russell King (Oracle) wrote:
> > + * The input structure is not zero-initialized and the implementation
> > + * must only set statistics which are actually collected by the device.
>
> Eh what? This states to me that the structure is not initialised, but
> drivers should not write to all members unless they support the
> statistic.
>
> Doesn't this mean we end up returning uninitialised data to userspace?
> If the structure is not initialised, how does core code know which
> statistics the driver has set to avoid returning uninitialised data?
It's not zero-initialized. Meaning it's initialized to a special magic
value that the core then checks for to decide if the driver actually
reported something.
Maybe this:
* Drivers must not zero out statistics which they don't report.
* Core will initialize members to ETHTOOL_STAT_NOT_SET and check
* for this value to report to user space only the stats actually
* supported by the device.
IDK how to phrase this better..
Powered by blists - more mailing lists