mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Moon Yeounsu <yyyynoom@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v6] net: dlink: add support for reporting stats via `ethtool -S` and `ip -s -s link show`
Date: Tue, 8 Apr 2025 14:31:04 +0200	[thread overview]
Message-ID: <66d0e7c7-c881-4d70-affc-4f97d485b249@lunn.ch> (raw)
In-Reply-To: <Z_RNtOY5PPS5A9v4@mythos-cloud>

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

  reply	other threads:[~2025-04-08 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 13:49 Moon Yeounsu
2025-04-07 20:43 ` Andrew Lunn
2025-04-07 22:12   ` Moon Yeounsu
2025-04-08 12:31     ` Andrew Lunn [this message]
2025-04-07 20:48 ` Andrew Lunn
2025-04-07 22:57   ` Moon Yeounsu
2025-04-08 12:37     ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66d0e7c7-c881-4d70-affc-4f97d485b249@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yyyynoom@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®