All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Petr Machata <petrm@mellanox.com>
Cc: Roopa Prabhu <roopa@cumulusnetworks.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Jiri Pirko <jiri@mellanox.com>,
	Ido Schimmel <idosch@mellanox.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Tariq Toukan <tariqt@mellanox.com>,
	"jakub.kicinski@netronome.com" <jakub.kicinski@netronome.com>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>
Subject: Re: [RFC PATCH net-next 1/3] net: rtnetlink: Add link-down reason to RTNL messages
Date: Thu, 28 Mar 2019 20:51:34 +0100	[thread overview]
Message-ID: <20190328195134.GB5446@lunn.ch> (raw)
In-Reply-To: <87zhpeg9rg.fsf@mellanox.com>

On Thu, Mar 28, 2019 at 05:59:50PM +0000, Petr Machata wrote:

Hi Petr

> - PHY driver: dev->phydev->drv->get_link_down_reason
>   Certain PHY drivers might want to have a custom handling for some
>   PHY-specific insight. Something like:
> 
>     modified   include/linux/phy.h
>     @@ -636,4 +636,7 @@ struct phy_driver {
>                                 struct ethtool_tunable *tuna,
>                                 const void *data);
>             int (*set_loopback)(struct phy_device *dev, bool enable);
>     +       int (*get_link_down_reason)(struct phy_device *dev,
>     +                                   enum link_down_reason_major *major,
>     +                                   u32 *minor);
>     };
> 
>   Return -ENODATA to indicate there's nothing to report.
> 
> - Generic PHY
>   It would be possible to add a function that e.g. consults the PHY
>   state machine to figure out what went wrong. Phy as such may have to
>   be extended to keep track of e.g. why the state machine is PHY_HALTED,
>   or possibly other problems worthy of reporting.

I would suggest changing the order of these two. Put the generic PHY
first. If it sees the driver has a OP to get more specific detail, it
would make the call into the driver. You don't violate any layering
that way, and the locking is done correctly.

The PHY being in state HALTED probably means there is a hardware error
at the MDIO level. That does not happen very often at all.

What you are more interested is state PHY_NOLINK, which indicates
there is no link. Maybe because auto-neg didn't complete, if it was
turned on, or if auto-neg is off and the link is forced, the peer is
using something different, or is not there at all.

> - phylink
>   I'm not sure how to generically plug in the phylink library, because
>   it is a private property of a MAC driver. There are currently only
>   three drivers using phylink (mvvp2, mvneta, DSA), but it looks as if
>   the intention is that phylink is used much more widely. So maybe it
>   would make sense to have an NDO like get_phylink and use that to call
>   into the phylink library for some generic handling.

We need to consider adding a phylink pointer to the netdev structure
soon, in the same way there is a phylib structure.

> Speaking specifically, my patch set would only do the first step above,
> because neither mlxsw nor mlx5 use the PHY subsystem.

Shame. With just mlx, you will get a coverage of ~0. If you did the
generic phylib work, you might get coverage of > 50% of the MAC
drivers. It then becomes something useful and really used.

	 Andrew

  reply	other threads:[~2019-03-28 19:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 17:56 [RFC PATCH net-next 0/3] RTNL: Add link-down reason reporting Petr Machata
2019-03-15 17:56 ` [RFC PATCH net-next 1/3] net: rtnetlink: Add link-down reason to RTNL messages Petr Machata
2019-03-16  2:26   ` Jakub Kicinski
2019-03-17  0:24     ` Michal Kubecek
2019-03-18 12:34     ` Petr Machata
2019-03-18 12:43       ` Michal Kubecek
2019-03-18 13:12       ` Andrew Lunn
2019-03-16  2:26   ` Andrew Lunn
2019-03-18 13:15     ` Petr Machata
2019-03-18 13:33       ` Andrew Lunn
2019-03-18 13:47         ` Petr Machata
2019-03-18 14:02       ` Andrew Lunn
2019-03-18 15:52         ` Stephen Hemminger
2019-03-19 10:18           ` Petr Machata
2019-03-19 11:56             ` Michal Kubecek
2019-03-19 15:42             ` Stephen Hemminger
2019-03-19 15:57               ` Petr Machata
2019-03-17 22:38   ` Roopa Prabhu
2019-03-18  0:03     ` Andrew Lunn
2019-03-28 17:59       ` Petr Machata
2019-03-28 19:51         ` Andrew Lunn [this message]
2019-04-23 13:41           ` Jiri Pirko
2019-03-18 12:15     ` Petr Machata
2019-03-15 17:56 ` [RFC PATCH net-next 2/3] mlxsw: reg: Add Port Diagnostics Database Register Petr Machata
2019-03-15 17:56 ` [RFC PATCH net-next 3/3] mlxsw: spectrum: Add rtnl_link_ops Petr Machata
2019-03-16  2:06 ` [RFC PATCH net-next 0/3] RTNL: Add link-down reason reporting Andrew Lunn
2019-03-18 12:11   ` Petr Machata

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=20190328195134.GB5446@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@mellanox.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=stephen@networkplumber.org \
    --cc=tariqt@mellanox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.