From: Petr Machata <petrm@mellanox.com>
To: Andrew Lunn <andrew@lunn.ch>
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 17:59:50 +0000 [thread overview]
Message-ID: <87zhpeg9rg.fsf@mellanox.com> (raw)
In-Reply-To: <20190318000312.GB30224@lunn.ch>
Andrew Lunn <andrew@lunn.ch> writes:
> I argued this is a PHY layer status information. We don't really want
> to have to modify every MAC driver to call into phylib/phylink. Yes,
> we can have a netdev_ops for those drivers which ignore the Linux PHY
> layer, but ideally we want to transparently call into the PHY layer to
> get this information, if the MAC is not doing odd things.
From what I see, there are four places where the information could be
collected:
- MAC driver: dev->ethtool_ops->get_link_down_reason
(At least mlxsw and mlx5 need this.)
modified include/linux/ethtool.h
@@ -395,4 +395,7 @@ struct ethtool_ops {
struct ethtool_fecparam *);
void (*get_ethtool_phy_stats)(struct net_device *,
struct ethtool_stats *, u64 *);
+ int (*get_link_down_reason)(const struct net_device *,
+ enum link_down_reason_major *,
+ u32 *minor);
};
Return -ENODATA to indicate there's nothing to report.
- 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.
- 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.
Speaking specifically, my patch set would only do the first step above,
because neither mlxsw nor mlx5 use the PHY subsystem. But it would be
easy enough to extend for the other cases above.
Thoughts?
Thanks,
Petr
next prev parent reply other threads:[~2019-03-28 17:59 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 [this message]
2019-03-28 19:51 ` Andrew Lunn
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=87zhpeg9rg.fsf@mellanox.com \
--to=petrm@mellanox.com \
--cc=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=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.