netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: rmk+kernel@armlinux.org.uk
Cc: f.fainelli@gmail.com, andrew@lunn.ch, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] net: phy: improve phylib correctness for non-autoneg settings
Date: Mon, 17 Apr 2017 13:25:29 -0400 (EDT)	[thread overview]
Message-ID: <20170417.132529.470418098748897329.davem@davemloft.net> (raw)
In-Reply-To: <E1cygzj-0002rx-PW@rmk-PC.armlinux.org.uk>

From: Russell King <rmk+kernel@armlinux.org.uk>
Date: Thu, 13 Apr 2017 16:49:15 +0100

> phylib has some undesirable behaviour when forcing a link mode through
> ethtool.  phylib uses this code:
> 
> 	idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex),
> 			features);
> 
> to find an index in the settings table.  phy_find_setting() starts at
> index 0, and scans upwards looking for an exact speed and duplex match.
> When it doesn't find it, it returns MAX_NUM_SETTINGS - 1, which is
> 10baseT-Half duplex.
> 
> phy_find_valid() then scans from the point (and effectively only checks
> one entry) before bailing out, returning MAX_NUM_SETTINGS - 1.
> 
> phy_sanitize_settings() then sets ->speed to SPEED_10 and ->duplex to
> DUPLEX_HALF whether or not 10baseT-Half is supported or not.  This goes
> against all the comments against these functions, and 10baseT-Half may
> not even be supported by the hardware.
> 
> Rework these functions, introducing a new method of scanning the table.
> There are two modes of lookup that phylib wants: exact, and inexact.
> 
> - in exact mode, we return either an exact match or failure
> - in inexact mode, we return an exact match if it exists, a match at
>   the highest speed that is not greater than the requested speed
>   (ignoring duplex), or failing that, the lowest supported speed, or
>   failure.
> 
> The biggest difference is that we always check whether the entry is
> supported before further consideration, so all unsupported entries are
> not considered as candidates.
> 
> This results in arguably saner behaviour, better matches the comments,
> and is probably what users would expect.
> 
> This becomes important as ethernet speeds increase, PHYs exist which do
> not support the 10Mbit speeds, and half-duplex is likely to become
> obsolete - it's already not even an option on 10Gbit and faster links.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Applied to net-next

  reply	other threads:[~2017-04-17 17:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 10:00 [PATCH RFC v2 0/2] phylib non-autoneg speed setting Russell King - ARM Linux
2017-04-06 10:01 ` [PATCH RFC v2 1/2] net: phy: improve phylib correctness for non-autoneg settings Russell King
2017-04-06 10:01 ` [PATCH RFC v2 2/2] net: phy: simplify phy_supported_speeds() Russell King
2017-04-07 20:51 ` [PATCH RFC v2 0/2] phylib non-autoneg speed setting Florian Fainelli
2017-04-13 15:49 ` [PATCH 1/2] net: phy: improve phylib correctness for non-autoneg settings Russell King
2017-04-17 17:25   ` David Miller [this message]
2017-04-13 15:49 ` [PATCH 2/2] net: phy: simplify phy_supported_speeds() Russell King
2017-04-17 17:25   ` David Miller

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=20170417.132529.470418098748897329.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /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).