netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Danielle Ratson <danieller@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>,
	<eric.dumazet@gmail.com>, <andrew@lunn.ch>, <mkubecek@suse.cz>,
	<f.fainelli@gmail.com>, <acardace@redhat.com>,
	<irusskikh@marvell.com>, <gustavo@embeddedor.com>,
	<magnus.karlsson@intel.com>, <ecree@solarflare.com>,
	<idosch@nvidia.com>, <jiri@nvidia.com>, <mlxsw@nvidia.com>,
	Danielle Ratson <danieller@nvidia.com>
Subject: [PATCH net v2 0/2] Fix link_mode derived params functionality
Date: Sun, 4 Apr 2021 11:14:31 +0300	[thread overview]
Message-ID: <20210404081433.1260889-1-danieller@nvidia.com> (raw)

Currently, link_mode parameter derives 3 other link parameters, speed,
lanes and duplex, and the derived information is sent to user space.

Two bugs were found in that functionality.
First, some drivers clear the 'ethtool_link_ksettings' struct in their
get_link_ksettings() callback and cause receiving wrong link mode
information in user space. And also, some drivers can report random
values in the 'link_mode' field and cause general protection fault.

Second, the link parameters are only derived in netlink path so in ioctl
path, we don't any reasonable values.

Patch #1 solves the first problem by introducing a new capability bit for
supporting link_mode in driver.
Patch #2 solves the second one, by deriving the parameters in ioctl path
as well.

v2:
	* Add patch #2.
	* Introduce 'cap_link_mode_supported' instead of adding a
	  validity field to 'ethtool_link_ksettings' struct in patch #1.

Danielle Ratson (2):
  ethtool: Add link_mode parameter capability bit to ethtool_ops
  ethtool: Derive parameters from link_mode in ioctl path

 .../mellanox/mlxsw/spectrum_ethtool.c         |  1 +
 include/linux/ethtool.h                       |  5 ++-
 net/ethtool/ioctl.c                           | 34 ++++++++++++++-----
 3 files changed, 31 insertions(+), 9 deletions(-)

-- 
2.26.2


             reply	other threads:[~2021-04-04  8:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04  8:14 Danielle Ratson [this message]
2021-04-04  8:14 ` [PATCH net v2 1/2] ethtool: Add link_mode parameter capability bit to ethtool_ops Danielle Ratson
2021-04-04 14:18   ` Andrew Lunn
2021-04-04 15:04     ` Danielle Ratson
2021-04-04 16:07       ` Andrew Lunn
2021-04-04 16:32   ` Andrew Lunn
2021-04-05 17:01     ` Danielle Ratson
2021-04-04  8:14 ` [PATCH net v2 2/2] ethtool: Derive parameters from link_mode in ioctl path Danielle Ratson

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=20210404081433.1260889-1-danieller@nvidia.com \
    --to=danieller@nvidia.com \
    --cc=acardace@redhat.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=ecree@solarflare.com \
    --cc=eric.dumazet@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=gustavo@embeddedor.com \
    --cc=idosch@nvidia.com \
    --cc=irusskikh@marvell.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=magnus.karlsson@intel.com \
    --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).