From: Stephen Hemminger <stephen@networkplumber.org>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: "Thomas Monjalon" <thomas@monjalon.net>, <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: Thu, 29 Feb 2024 09:38:18 -0800 [thread overview]
Message-ID: <20240229093818.642e6f48@hermes.local> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F28A@smartserver.smartshare.dk>
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.
> >
> > 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.
next prev parent reply other threads:[~2024-02-29 17:38 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 [this message]
2024-03-01 10:27 ` Thomas Monjalon
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=20240229093818.642e6f48@hermes.local \
--to=stephen@networkplumber.org \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=mb@smartsharesystems.com \
--cc=thomas@monjalon.net \
/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).