From: Ido Schimmel <idosch@idosch.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, mkubecek@suse.cz,
f.fainelli@gmail.com, andrew@lunn.ch, David.Laight@aculab.com,
mlxsw@nvidia.com, Ido Schimmel <idosch@nvidia.com>
Subject: [RFC PATCH ethtool 0/2] Improve compatibility between netlink and ioctl interfaces
Date: Tue, 27 Oct 2020 16:51:45 +0200 [thread overview]
Message-ID: <20201027145147.227053-1-idosch@idosch.org> (raw)
From: Ido Schimmel <idosch@nvidia.com>
This patch set teaches ethtool to set the 'ETHTOOL_FLAG_LEGACY' flag in
the ethtool netlink request header of the various commands mapped to
'ethtool set' in order to improve compatibility with the legacy ioctl
interface.
The current use case is to ensure that the kernel will advertise all the
supported link modes when autoneg is enabled, but without specifying
other parameters.
To prevent the kernel from complaining about unknown flags, the flag is
only set in the request header in case the kernel supports it. This is
achieved by using the recently introduced per-operation policy dump
infrastructure.
Example #1 - ethtool and kernel are both aware of the flag
==========================================================
# ethtool -s eth0 advertise 0xC autoneg on
# ethtool -s eth0 autoneg on
# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
MDI-X: on (auto)
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
Example #2 - only ethtool is aware of the flag
==============================================
# ethtool -s eth0 advertise 0xC autoneg on
# ethtool -s eth0 autoneg on
# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 100baseT/Half 100baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
MDI-X: off (auto)
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
In example #2 the kernel does not advertise all the supported link
modes, but it does not complain about unknown flags either, thus
preventing breakage with old kernels.
Ido Schimmel (2):
update UAPI header copies
netlink: Set 'ETHTOOL_FLAG_LEGACY' for compatibility with legacy ioctl
interface
netlink/netlink.c | 13 +++++++++++++
netlink/netlink.h | 2 ++
netlink/parser.c | 5 ++++-
uapi/linux/ethtool_netlink.h | 5 ++++-
4 files changed, 23 insertions(+), 2 deletions(-)
--
2.26.2
next reply other threads:[~2020-10-27 17:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 14:51 Ido Schimmel [this message]
2020-10-27 14:51 ` [RFC PATCH ethtool 1/2] update UAPI header copies Ido Schimmel
2020-10-27 14:51 ` [RFC PATCH ethtool 2/2] netlink: Set 'ETHTOOL_FLAG_LEGACY' for compatibility with legacy ioctl interface Ido Schimmel
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=20201027145147.227053-1-idosch@idosch.org \
--to=idosch@idosch.org \
--cc=David.Laight@aculab.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=mkubecek@suse.cz \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.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).