[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1K_xI-0d3JINvlg@shell.armlinux.org.uk>
Date: Fri, 6 Dec 2024 09:11:32 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Jakub Kicinski <kuba@...nel.org>
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, Dec 05, 2024 at 05:19:09PM -0800, Jakub Kicinski wrote:
> 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..
Maybe:
* The input structure is pre-initialised with ETHTOOL_STAT_NOT_SET and
* the implementation must only change implemented statistics.
?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists