All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Gal Pressman <galp@mellanox.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	"John W. Linville" <linville@tuxdriver.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	Vidya Sagar Ravipati <vidya@cumulusnetworks.com>,
	Jiri Pirko <jiri@mellanox.com>,
	David Decotigny <decot@googlers.com>,
	kernel-team@fb.com
Subject: Re: [RFC PATCH net-next 1/3] ethtool: Add link down reason callback
Date: Mon, 26 Jun 2017 15:28:12 +0200	[thread overview]
Message-ID: <20170626132812.GA2623@lunn.ch> (raw)
In-Reply-To: <1498050286-17141-2-git-send-email-galp@mellanox.com>

On Wed, Jun 21, 2017 at 04:04:44PM +0300, Gal Pressman wrote:
> Currently, drivers can only tell whether the link is up/down through
> ETHTOOL_GLINK callback, but no additional information is given in case
> of link down.
> This patch provides an infrastructure that allows drivers to hint
> the user with the reason why the link is down, in order to ease the
> debug process.
> 
> Reasons are separated to two types, generic and vendor specific.
> Drivers can reply with a generic reason using the enums provided in this
> patch (and the ones that will be added in the future), which will be
> translated to strings by the userspace ethtool.
> In case of a vendor specific reason (not suitable for most vendors),
> drivers can reply with ETHTOOL_VENDOR_SPECIFIC reason, in this case the
> vendor_reason field should be filled with a vendor specific status code
> which will be parsed by the vendor specific userspace parser if one is
> available.
> 
> This kind of information can save system administrators precious time
> which will not be wasted trying to understand why the link won't go
> up.
> 
> For example, when the cable is unplugged:
> $ ethtool ethXX
> ...
> Link detected: no (Cable unplugged)
> 
> Signed-off-by: Gal Pressman <galp@mellanox.com>
> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
> ---
>  include/linux/ethtool.h      |  2 ++
>  include/uapi/linux/ethtool.h | 33 +++++++++++++++++++++++++++++++++
>  net/core/ethtool.c           | 24 ++++++++++++++++++++++++
>  3 files changed, 59 insertions(+)
> 
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 83cc986..d472047 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -374,5 +374,7 @@ struct ethtool_ops {
>  				      struct ethtool_link_ksettings *);
>  	int	(*set_link_ksettings)(struct net_device *,
>  				      const struct ethtool_link_ksettings *);
> +	int	(*get_link_down_reason)(struct net_device *,
> +					struct ethtool_link_down_reason *);
>  };
>  #endif /* _LINUX_ETHTOOL_H */
> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index 7d4a594..8cf9d2c 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -550,6 +550,13 @@ struct ethtool_pauseparam {
>  
>  #define ETH_GSTRING_LEN		32
>  
> +struct ethtool_link_down_reason {
> +	__u32	cmd;
> +	__u32	reason;
> +	__u32	vendor_reason;
> +	__u32	reserved[4];
> +};

Shouldn't this be a list? The device is over its power budget,
overheating and does not have a cable plugged in. There can be
multiple reasons it is down.

	 Andrew

  parent reply	other threads:[~2017-06-26 13:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 13:04 [RFC PATCH net-next 0/3] ethtool: Add link down reason reporting Gal Pressman
2017-06-21 13:04 ` [RFC PATCH net-next 1/3] ethtool: Add link down reason callback Gal Pressman
2017-06-21 13:58   ` Andrew Lunn
2017-06-22  8:09     ` Gal Pressman
2017-06-22 13:34       ` Andrew Lunn
2017-06-23  8:23         ` Gal Pressman
2017-06-23 13:52           ` Andrew Lunn
2017-06-24 19:04       ` Andrew Lunn
2017-06-25 11:59         ` Gal Pressman
2017-06-25 15:19           ` Andrew Lunn
2017-06-26 11:52             ` Gal Pressman
2017-06-26 13:34               ` Andrew Lunn
2017-06-27 19:40                 ` David Miller
2017-06-21 15:43   ` Stephen Hemminger
2017-06-22 10:33     ` Gal Pressman
2017-06-26 13:28   ` Andrew Lunn [this message]
2017-06-26 15:48     ` Gal Pressman
2017-06-21 13:04 ` [RFC PATCH net-next 2/3] net/mlx5: Add PDDR register infrastructure Gal Pressman
2017-06-21 13:04 ` [RFC PATCH net-next 3/3] net/mlx5e: Expose link down reason to ethtool Gal Pressman
2017-06-21 14:03   ` Andrew Lunn
2017-06-22  8:17     ` Gal Pressman
2017-06-22  4:33   ` Jakub Kicinski
2017-06-22  8:33     ` Gal Pressman
2017-06-22 22:38       ` Jakub Kicinski
2017-06-23  8:52         ` Gal Pressman
2017-06-21 15:44 ` [RFC PATCH net-next 0/3] ethtool: Add link down reason reporting Stephen Hemminger
2017-06-22 11:13   ` Gal Pressman
2017-06-22  4:14 ` Jakub Kicinski
2017-06-22 11:37   ` Gal Pressman
2017-06-22 21:53     ` Jakub Kicinski

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=20170626132812.GA2623@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=decot@googlers.com \
    --cc=galp@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=kernel-team@fb.com \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=vidya@cumulusnetworks.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.