DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: "Morten Brørup" <mb@smartsharesystems.com>,
	"Stephen Hemminger" <stephen@networkplumber.org>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@amd.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [PATCH v2] ethdev: add Linux ethtool link mode conversion
Date: Fri, 01 Mar 2024 11:27:05 +0100	[thread overview]
Message-ID: <1911014.eGJsNajkDb@thomas> (raw)
In-Reply-To: <20240229093818.642e6f48@hermes.local>

29/02/2024 18:38, Stephen Hemminger:
> On Thu, 29 Feb 2024 17:58:13 +0100
> Morten Brørup <mb@smartsharesystems.com> wrote:
> 
> > > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > Sent: Thursday, 29 February 2024 17.45
> > > 
> > > On Thu, 29 Feb 2024 16:42:56 +0100
> > > Thomas Monjalon <thomas@monjalon.net> wrote:
> > >   
> > > > +/* Link modes sorted with index as defined in ethtool.
> > > > + * Values are speed in Mbps with LSB indicating duplex.
> > > > + *
> > > > + * The ethtool bits definition should not change as it is a kernel  
> > > API.  
> > > > + * Using raw numbers directly avoids checking API availability
> > > > + * and allows to compile with new bits included even on an old  
> > > kernel.  
> > > > + *
> > > > + * The array below is built from bit definitions with this shell  
> > > command:  
> > > > + *   sed -rn 's;.*(ETHTOOL_LINK_MODE_)([0-9]+)([0-9a-zA-Z_]*).*=  
> > > *([0-9]*).*;'\  
> > > > + *           '[\4] = \2, /\* \1\2\3 *\/;p'  
> > > /usr/include/linux/ethtool.h |  
> > > > + *   awk '/_Half_/{$3=$3+1","}1'
> > > > + */
> > > > +static uint32_t link_modes[] = {  
> > > 
> > > Make it const please.

Yes


> > > You could add meson rule to generate it and then use non-numeric tags.  
> > 
> > However you do it, make sure it cross builds. The kernel/ethtool on the target system may differ from the one on the build system.
> > 
> 
> If the build system is older, the speed table will be smaller. And the code should just print "Unknown"
> If the build system is newer, then the table will be larger than kernel ever returns which is Ok.

There is no benefit in having a smaller table.
That's why I prefer using numeric indices with the best coverage possible.



  reply	other threads:[~2024-03-01 10:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 12:34 [PATCH v1] " Thomas Monjalon
2024-02-29 15:42 ` [PATCH v2] " Thomas Monjalon
2024-02-29 16:45   ` Stephen Hemminger
2024-02-29 16:58     ` Morten Brørup
2024-02-29 17:38       ` Stephen Hemminger
2024-03-01 10:27         ` Thomas Monjalon [this message]
2024-03-01 13:12   ` Ferruh Yigit
2024-03-01 13:37     ` Thomas Monjalon
2024-03-01 15:08       ` Ferruh Yigit
2024-03-01 15:20         ` Thomas Monjalon
2024-03-01 17:16           ` Ferruh Yigit
2024-03-01 18:00           ` Stephen Hemminger
2024-03-03  9:36             ` Thomas Monjalon
2024-03-03  9:56 ` [PATCH v3] " Thomas Monjalon
2024-03-04 15:58   ` Ferruh Yigit

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=1911014.eGJsNajkDb@thomas \
    --to=thomas@monjalon.net \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=mb@smartsharesystems.com \
    --cc=stephen@networkplumber.org \
    /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;
as well as URLs for NNTP newsgroup(s).