Thread (30 messages) 30 messages, 8 authors, 2024-12-10

Re: [PATCH net-next v1 1/7] net: ethtool: plumb PHY stats to PHY drivers

flat view

From: Jakub Kicinski <kuba@kernel.org>
Date: 2024-12-06 01:19:11
Also in: linux-doc, lkml

On Thu, 5 Dec 2024 11:57:33 +0000 Russell King (Oracle) wrote:
quoted
+	 * 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..
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help