public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Andy Roulin <aroulin@nvidia.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	jiri@nvidia.com, andrew@lunn.ch, f.fainelli@gmail.com,
	mkubecek@suse.cz, mlxsw@nvidia.com,
	Danielle Ratson <danieller@nvidia.com>
Subject: Re: [PATCH net v2] ethtool: reset #lanes when lanes is omitted
Date: Tue, 4 Apr 2023 09:01:13 +0300	[thread overview]
Message-ID: <ZCu9Kf1eokdh0w/7@shredder> (raw)
In-Reply-To: <ac238d6b-8726-8156-3810-6471291dbc7f@nvidia.com>

On Mon, Apr 03, 2023 at 02:20:53PM -0700, Andy Roulin wrote:
> If the number of lanes was forced and then subsequently the user
> omits this parameter, the ksettings->lanes is reset. The driver
> should then reset the number of lanes to the device's default
> for the specified speed.
> 
> However, although the ksettings->lanes is set to 0, the mod variable
> is not set to true to indicate the driver and userspace should be
> notified of the changes.
> 
> The consequence is that the same ethtool operation will produce
> different results based on the initial state.
> 
> If the initial state is:
> $ ethtool swp1 | grep -A 3 'Speed: '
>         Speed: 500000Mb/s
>         Lanes: 2
>         Duplex: Full
>         Auto-negotiation: on
> 
> then executing 'ethtool -s swp1 speed 50000 autoneg off' will yield:
> $ ethtool swp1 | grep -A 3 'Speed: '
>         Speed: 500000Mb/s
>         Lanes: 2
>         Duplex: Full
>         Auto-negotiation: off
> 
> While if the initial state is:
> $ ethtool swp1 | grep -A 3 'Speed: '
>         Speed: 500000Mb/s
>         Lanes: 1
>         Duplex: Full
>         Auto-negotiation: off
> 
> executing the same 'ethtool -s swp1 speed 50000 autoneg off' results in:
> $ ethtool swp1 | grep -A 3 'Speed: '
>         Speed: 500000Mb/s
>         Lanes: 1
>         Duplex: Full
>         Auto-negotiation: off
> 
> This patch fixes this behavior. Omitting lanes will always results in
> the driver choosing the default lane width for the chosen speed. In this
> scenario, regardless of the initial state, the end state will be, e.g.,
> 
> $ ethtool swp1 | grep -A 3 'Speed: '
>         Speed: 500000Mb/s
>         Lanes: 2
>         Duplex: Full
>         Auto-negotiation: off
> 
> Fixes: 012ce4dd3102 ("ethtool: Extend link modes settings uAPI with lanes")
> Signed-off-by: Andy Roulin <aroulin@nvidia.com>
> Reviewed-by: Danielle Ratson <danieller@nvidia.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

  reply	other threads:[~2023-04-04  6:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 21:20 [PATCH net v2] ethtool: reset #lanes when lanes is omitted Andy Roulin
2023-04-04  6:01 ` Ido Schimmel [this message]
2023-04-05  2:00 ` patchwork-bot+netdevbpf

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=ZCu9Kf1eokdh0w/7@shredder \
    --to=idosch@nvidia.com \
    --cc=andrew@lunn.ch \
    --cc=aroulin@nvidia.com \
    --cc=danieller@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=jiri@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