DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@amd.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [PATCH] ethdev: sync ethtool link modes with Linux 6.15
Date: Wed, 25 Jun 2025 15:42:02 +0200	[thread overview]
Message-ID: <20250625134202.3193570-1-thomas@monjalon.net> (raw)

Update ethtool link modes with new ones added in Linux 6.15.
These values won't change as they are part of the Linux uAPI.
Note: extracting them avoids to depend on a kernel version.

The parsing command is updated to generate padding
accordingly to the alignments in the DPDK source file.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/ethdev/ethdev_linux_ethtool.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/lib/ethdev/ethdev_linux_ethtool.c b/lib/ethdev/ethdev_linux_ethtool.c
index ec42d3054a..f508cdba6c 100644
--- a/lib/ethdev/ethdev_linux_ethtool.c
+++ b/lib/ethdev/ethdev_linux_ethtool.c
@@ -17,8 +17,9 @@
  *
  * 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'
+ *           '[\4] \2 \1\2\3;p' /usr/include/linux/ethtool.h |
+ *   awk '/_Half_/{$2=$2+1}1' |
+ *   awk '{printf "\t%5s = %7s, /\* %s *\/\n", $1, $2, $3}'
  */
 static const uint32_t link_modes[] = {
 	  [0] =      11, /* ETHTOOL_LINK_MODE_10baseT_Half_BIT */
@@ -110,6 +111,25 @@ static const uint32_t link_modes[] = {
 	 [99] =      10, /* ETHTOOL_LINK_MODE_10baseT1S_Full_BIT */
 	[100] =      11, /* ETHTOOL_LINK_MODE_10baseT1S_Half_BIT */
 	[101] =      11, /* ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT */
+	[102] =      10, /* ETHTOOL_LINK_MODE_10baseT1BRR_Full_BIT */
+	[103] =  200000, /* ETHTOOL_LINK_MODE_200000baseCR_Full_BIT */
+	[104] =  200000, /* ETHTOOL_LINK_MODE_200000baseKR_Full_BIT */
+	[105] =  200000, /* ETHTOOL_LINK_MODE_200000baseDR_Full_BIT */
+	[106] =  200000, /* ETHTOOL_LINK_MODE_200000baseDR_2_Full_BIT */
+	[107] =  200000, /* ETHTOOL_LINK_MODE_200000baseSR_Full_BIT */
+	[108] =  200000, /* ETHTOOL_LINK_MODE_200000baseVR_Full_BIT */
+	[109] =  400000, /* ETHTOOL_LINK_MODE_400000baseCR2_Full_BIT */
+	[110] =  400000, /* ETHTOOL_LINK_MODE_400000baseKR2_Full_BIT */
+	[111] =  400000, /* ETHTOOL_LINK_MODE_400000baseDR2_Full_BIT */
+	[112] =  400000, /* ETHTOOL_LINK_MODE_400000baseDR2_2_Full_BIT */
+	[113] =  400000, /* ETHTOOL_LINK_MODE_400000baseSR2_Full_BIT */
+	[114] =  400000, /* ETHTOOL_LINK_MODE_400000baseVR2_Full_BIT */
+	[115] =  800000, /* ETHTOOL_LINK_MODE_800000baseCR4_Full_BIT */
+	[116] =  800000, /* ETHTOOL_LINK_MODE_800000baseKR4_Full_BIT */
+	[117] =  800000, /* ETHTOOL_LINK_MODE_800000baseDR4_Full_BIT */
+	[118] =  800000, /* ETHTOOL_LINK_MODE_800000baseDR4_2_Full_BIT */
+	[119] =  800000, /* ETHTOOL_LINK_MODE_800000baseSR4_Full_BIT */
+	[120] =  800000, /* ETHTOOL_LINK_MODE_800000baseVR4_Full_BIT */
 };
 
 RTE_EXPORT_INTERNAL_SYMBOL(rte_eth_link_speed_ethtool)
-- 
2.47.1


                 reply	other threads:[~2025-06-25 13:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250625134202.3193570-1-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.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;
as well as URLs for NNTP newsgroup(s).