[PATCH] ethdev: sync ethtool link modes with Linux 6.15
Stephen Hemminger
stephen at networkplumber.org
Thu Jun 26 16:26:51 CEST 2025
On Wed, 25 Jun 2025 15:42:02 +0200
Thomas Monjalon <thomas at monjalon.net> wrote:
> 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}'
> */
The commands in the comment never worked verbatim.
$ 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_/{$2=$2+1}1' |
awk '{printf "\t%5s = %7s, /\* %s *\/\n", $1, $2, $3}'
> > > sed: -e expression #1, char 63: unterminated `s' command
awk: cmd. line:1: warning: escape sequence `\*' treated as plain `*'
awk: cmd. line:1: warning: escape sequence `\/' treated as plain `/'
Fixing the comment would be:
$ git diff
diff --git a/lib/ethdev/ethdev_linux_ethtool.c b/lib/ethdev/ethdev_linux_ethtool.c
index f508cdba6c..8a148ae0cd 100644
--- a/lib/ethdev/ethdev_linux_ethtool.c
+++ b/lib/ethdev/ethdev_linux_ethtool.c
@@ -16,10 +16,11 @@
* 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_/{$2=$2+1}1' |
- * awk '{printf "\t%5s = %7s, /\* %s *\/\n", $1, $2, $3}'
+ * 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_/{$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 */
More information about the dev
mailing list