From: Andrew Lunn <andrew@lunn.ch>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: Michal Kubecek <mkubecek@suse.cz>,
netdev@vger.kernel.org, Jamie Gloudon <jamie.gloudon@gmx.fr>
Subject: Re: [ethtool] ethtool: fix netlink bitmasks when sent as NOMASK
Date: Tue, 28 Jul 2020 00:11:04 +0200 [thread overview]
Message-ID: <20200727221104.GD1705504@lunn.ch> (raw)
In-Reply-To: <20200727214700.5915-1-jacob.e.keller@intel.com>
On Mon, Jul 27, 2020 at 02:47:00PM -0700, Jacob Keller wrote:
> The ethtool netlink API can send bitsets without an associated bitmask.
> These do not get displayed properly, because the dump_link_modes, and
> bitset_get_bit to not check whether the provided bitset is a NOMASK
> bitset. This results in the inability to display peer advertised link
> modes.
>
> The dump_link_modes and bitset_get_bit functions are designed so they
> can print either the values or the mask. For a nomask bitmap, this
> doesn't make sense. There is no mask.
>
> Modify dump_link_modes to check ETHTOOL_A_BITSET_NOMASK. For compact
> bitmaps, always check and print the ETHTOOL_A_BITSET_VALUE bits,
> regardless of the request to display the mask or the value. For full
> size bitmaps, the set of provided bits indicates the valid values,
> without using ETHTOOL_A_BITSET_VALUE fields. Thus, do not skip printing
> bits without this attribute if nomask is set. This essentially means
> that dump_link_modes will treat a NOMASK bitset as having a mask
> equivalent to all of its set bits.
>
> For bitset_get_bit, also check for ETHTOOL_A_BITSET_NOMASK. For compact
> bitmaps, always use ETHTOOL_A_BITSET_BIT_VALUE as in dump_link_modes.
> For full bitmaps, if nomask is set, then always return true of the bit
> is in the set, rather than only if it provides an
> ETHTOOL_A_BITSET_BIT_VALUE. This will then correctly report the set
> bits.
>
> This fixes display of link partner advertised fields when using the
> netlink API.
Hi Jacob
This is close
Netlink
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: No
IOCTL
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: Not reported
So just the FEC modes differ.
However, i don't think this was part of the original issue, so:
Tested-by: Andrew Lunn <andrew@lunn.ch>
It would be nice to get the FEC modes fixed.
Andrew
next prev parent reply other threads:[~2020-07-27 22:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 21:47 [ethtool] ethtool: fix netlink bitmasks when sent as NOMASK Jacob Keller
2020-07-27 21:51 ` Jacob Keller
2020-07-27 22:02 ` Jamie Gloudon
2020-07-27 22:11 ` Andrew Lunn [this message]
2020-07-27 22:22 ` Jacob Keller
2020-07-27 22:26 ` Michal Kubecek
2020-07-27 22:32 ` Keller, Jacob E
2020-07-27 22:40 ` Michal Kubecek
2020-07-27 22:21 ` Michal Kubecek
2020-07-27 22:32 ` Jacob Keller
2020-07-27 22:53 ` Michal Kubecek
2020-07-27 23:18 ` Jacob Keller
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=20200727221104.GD1705504@lunn.ch \
--to=andrew@lunn.ch \
--cc=jacob.e.keller@intel.com \
--cc=jamie.gloudon@gmx.fr \
--cc=mkubecek@suse.cz \
--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).