Re: ixgbe: How to do this without a module parameter?
From: Robert Schlabbach <hidden>
Date: 2021-10-27 19:12:16
"Andrew Lunn" [off-list ref] wrote:
On Wed, Oct 27, 2021 at 01:50:52AM +0200, Robert Schlabbach wrote:quoted
The parsing seems to be implemented in the kernelActually, it might not be. A kernel that old might not have netlink ethtool, just the old ioctl interface. It could be the command line parsing is dependent on which API is used to the kernel. ethtool --debug 255 eno3
I should have mentioned that I also searched the ethtool source code
for link mode name parsing and came up empty. While ethtool contains
link mode names, those are "private" to the dump_link_mode_caps()
function and unavailable for any other access/use.
The ethtool debug option you gave shows that ethtool indeed sends the
link mode name strings down to the kernel for parsing:
sending genetlink packet (100 bytes):
msg length 100 ethool ETHTOOL_MSG_LINKMODES_SET
ETHTOOL_MSG_LINKMODES_SET
ETHTOOL_A_LINKMODES_HEADER
ETHTOOL_A_HEADER_DEV_NAME = "eno3"
ETHTOOL_A_LINKMODES_OURS
ETHTOOL_A_BITSET_BITS
ETHTOOL_A_BITSET_BITS_BIT
ETHTOOL_A_BITSET_BIT_NAME = "2500baseT/Full"
ETHTOOL_A_BITSET_BIT_VALUE = true
ETHTOOL_A_BITSET_BITS_BIT
ETHTOOL_A_BITSET_BIT_NAME = "5000baseT/Full"
ETHTOOL_A_BITSET_BIT_VALUE = true
And trying nonsense names for link modes confirms that ethtool does not
parse them at all, but rather passes them unchecked:
$ ethtool --debug 255 -s eno3 advertise NonSenseModeName off EvenMoreNonSense on
sending genetlink packet (104 bytes):
msg length 104 ethool ETHTOOL_MSG_LINKMODES_SET
ETHTOOL_MSG_LINKMODES_SET
ETHTOOL_A_LINKMODES_HEADER
ETHTOOL_A_HEADER_DEV_NAME = "eno3"
ETHTOOL_A_LINKMODES_OURS
ETHTOOL_A_BITSET_BITS
ETHTOOL_A_BITSET_BITS_BIT
ETHTOOL_A_BITSET_BIT_NAME = "NonSenseModeName"
ETHTOOL_A_BITSET_BITS_BIT
ETHTOOL_A_BITSET_BIT_NAME = "EvenMoreNonSense"
ETHTOOL_A_BITSET_BIT_VALUE = true
Running these commands on an old 4.15 kernel fails very early, supposedly when
ethtool checks whether the kernel supports above messages:
sending genetlink packet (32 bytes):
msg length 32 genl-ctrl
CTRL_CMD_GETFAMILY
CTRL_ATTR_FAMILY_NAME = "ethtool"
offending message:
ETHTOOL_MSG_LINKINFO_SET
ETHTOOL_A_LINKINFO_PORT = 101
ethtool: bad command line argument(s)
For more information run ethtool -h
So a more user-friendly option to specify link modes to advertise is already
implemented, but only in more recent kernel versions.
Best regards,
-Robert Schlabbach