Skip to content

RFC Improve compatibility between netlink and ioctl interfaces

Ido Schimmel netdev 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2update UAPI header copiesuapi/linux/ethtool_netlink.h+4 -10 replies
2/2netlink: Set 'ETHTOOL_FLAG_LEGACY' for compatibility with legacy ioctl interfacenetlink/netlink.c netlink/netlink.h netlink/parser.c+19 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH ethtool 0/2] Improve compatibility between netlink and ioctl interfaces

From: Ido Schimmel <[email protected]>

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(-)
Signature · 1 line
2.26.2