lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66d0e7c7-c881-4d70-affc-4f97d485b249@lunn.ch>
Date: Tue, 8 Apr 2025 14:31:04 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Moon Yeounsu <yyyynoom@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v6] net: dlink: add support for reporting stats
 via `ethtool -S` and `ip -s -s link show`

On Tue, Apr 08, 2025 at 07:12:04AM +0900, Moon Yeounsu wrote:
> On Mon, Apr 07, 2025 at 10:43:41PM +0200, Andrew Lunn wrote:
> 
> > That is an odd way of doing it. It would be better to repeat the
> > static const struct dlink_stats.
> 
> Oh, I see — sorry about that. I wasn’t aware it might be considered an odd approach.
> If you don’t mind, could you please explain a bit more about why it seems problematic to you?

How many other drivers do you see doing this?

> Let me briefly share my reasoning behind the current design:
> Each ethtool stats function (e.g., get_ethtool_XXX) gathers a specific group of related statistics.
> You can see this grouping in action in my patch.
> So, I thought managing each stat group in that way would make the code more intuitive,
> and help simplify the logic for developers who use or extend it.

Just to be clear. Using tables is fine. It is just the way you have
declared the tables. You have basically done

unsigned int x, y, z.

If everything is on one line, the , syntax is fine. But you have x, y
and z spread over multiple pages. In such a situation, you would
repeat the unsigned int for each of x and y and z.

> I'm still new to kernel development, so there are many things I don't fully understand yet.
> I'd appreciate it if you could feel free to point out anything.

Take a look at other merged drivers. If you are doing something which
other drivers don't do, maybe ask yourself, is what you are doing a
good idea. In order to keep maintenance simpler, we ideally want all
drivers to look similar. So rather than inventing new code, just find
a driver which is roughly doing what you want and copy/paste it as a
starting point.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ