From: Gal Pressman <hidden> Date: 2017-06-21 13:05:20
Hi All,
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/failure.
This series provides an infrastructure to ethtool that allows
netdevice drivers to hint the user with the reason why the link is down,
in order to ease the debug process.
In addition two more mlx5 patches to demonstrate the usage.
Reasons are separated to two types, generic and vendor specific.
Drivers can reply with a generic reason using the predefined enums
(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, 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)
Thanks,
Gal.
Gal Pressman (3):
ethtool: Add link down reason callback
net/mlx5: Add PDDR register infrastructure
net/mlx5e: Expose link down reason to ethtool
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 107 +++++++++++++++++++++
.../net/ethernet/mellanox/mlx5/core/mlx5_core.h | 33 +++++++
drivers/net/ethernet/mellanox/mlx5/core/port.c | 39 ++++++++
include/linux/ethtool.h | 2 +
include/linux/mlx5/device.h | 3 +
include/linux/mlx5/driver.h | 1 +
include/linux/mlx5/mlx5_ifc.h | 51 ++++++++++
include/uapi/linux/ethtool.h | 33 +++++++
net/core/ethtool.c | 24 +++++
9 files changed, 293 insertions(+)
--
2.7.4
From: Gal Pressman <hidden> Date: 2017-06-21 13:05:21
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 <redacted>
Signed-off-by: Saeed Mahameed <redacted>
---
include/linux/ethtool.h | 2 ++
include/uapi/linux/ethtool.h | 33 +++++++++++++++++++++++++++++++++
net/core/ethtool.c | 24 ++++++++++++++++++++++++
3 files changed, 59 insertions(+)
@@ -1331,6 +1338,8 @@ struct ethtool_per_queue_op {#define ETHTOOL_PHY_GTUNABLE 0x0000004e /* Get PHY tunable configuration */#define ETHTOOL_PHY_STUNABLE 0x0000004f /* Set PHY tunable configuration */+#define ETHTOOL_GLINK_DOWN_RSN 0x00000050 /* Get link down reason */+/* compatibility with older code */#define SPARC_ETH_GSET ETHTOOL_GSET#define SPARC_ETH_SSET ETHTOOL_SSET
@@ -1766,4 +1775,28 @@ struct ethtool_link_settings {*__u32map_lp_advertising[link_mode_masks_nwords];*/};++enum{+ETHTOOL_LINK_VENDOR_SPECIFIC=-1,/* Vendor specific issue provided in vendor_reason */+ETHTOOL_LINK_NO_ISSUE,/* No issue observed with link */+ETHTOOL_LINK_REASON_UNKNOWN,/* Unknown reason */+ETHTOOL_LINK_NETDEV_CARRIER_DOWN,/* Netdev carrier is down */+ETHTOOL_LINK_ADMIN_DOWN,/* Admin down */+ETHTOOL_LINK_AN_FAILED,/* Auto negotiation failed */+ETHTOOL_LINK_TRAINING_FAILED,/* Link training failed */+ETHTOOL_LINK_RMT_FAULT,/* Remote fault indication */+ETHTOOL_LINK_BAD_SIGNAL_INTEGRITY,/* Bad signal integrity */+ETHTOOL_LINK_CABLE_MISMATCH,/* Cable protocol mismatch */+ETHTOOL_LINK_INTERNAL_ERR,/* Internal error */+ETHTOOL_LINK_CABLE_UNPLUGGED,/* Cable unplugged */+ETHTOOL_LINK_UNSUPP_MODULE,/* Unsupported module */+ETHTOOL_LINK_I2C_BUS_ERR,/* I2C bus error */+ETHTOOL_LINK_UNSUPP_EEPROM,/* Unsupported EEPROM */+ETHTOOL_LINK_OVERTEMP,/* Over temperature */+ETHTOOL_LINK_PWR_BUDGET_EXC,/* Power budget exceeded */+ETHTOOL_LINK_MODULE_ADMIN_DOWN,/* Module admin down */++ETHTOOL_LINK_REASONS_COUNT+};+#endif /* _UAPI_LINUX_ETHTOOL_H */
@@ -2523,6 +2523,26 @@ static int set_phy_tunable(struct net_device *dev, void __user *useraddr)returnret;}+staticintget_link_down_reason(structnet_device*dev,void__user*useraddr)+{+structethtool_link_down_reasonldr;+intret;++if(!dev->ethtool_ops->get_link_down_reason)+return-EOPNOTSUPP;++memset(&ldr,0,sizeof(ldr));+ldr.cmd=ETHTOOL_GLINK_DOWN_RSN;+ret=dev->ethtool_ops->get_link_down_reason(dev,&ldr);+if(ret)+returnret;++if(copy_to_user(useraddr,&ldr,sizeof(ldr)))+return-EFAULT;++return0;+}+/* The main entry point in this file. Called from net/core/dev_ioctl.c */intdev_ethtool(structnet*net,structifreq*ifr)
@@ -2582,6 +2602,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)caseETHTOOL_GTUNABLE:caseETHTOOL_PHY_GTUNABLE:caseETHTOOL_GLINKSETTINGS:+caseETHTOOL_GLINK_DOWN_RSN:break;default:if(!ns_capable(net->user_ns,CAP_NET_ADMIN))
@@ -2793,6 +2814,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)caseETHTOOL_PHY_STUNABLE:rc=set_phy_tunable(dev,useraddr);break;+caseETHTOOL_GLINK_DOWN_RSN:+rc=get_link_down_reason(dev,useraddr);+break;default:rc=-EOPNOTSUPP;}
From: Gal Pressman <hidden> Date: 2017-06-21 13:05:24
PDDR (Port Diagnostics Database Register) is used to read the physical
layer debug database, which contains helpful troubleshooting information
regarding the state of the link.
PDDR register can only be queried when PCAM register reports it as
supported in its register mask. A new helper macro was added to
the MLX5_CAP_* infrastructure in order to access this mask.
Expose query functions for PDDR register which will be used in the
following patch.
Signed-off-by: Gal Pressman <redacted>
Signed-off-by: Saeed Mahameed <redacted>
---
.../net/ethernet/mellanox/mlx5/core/mlx5_core.h | 29 ++++++++++++
drivers/net/ethernet/mellanox/mlx5/core/port.c | 14 ++++++
include/linux/mlx5/device.h | 3 ++
include/linux/mlx5/driver.h | 1 +
include/linux/mlx5/mlx5_ifc.h | 51 ++++++++++++++++++++++
5 files changed, 98 insertions(+)
From: Gal Pressman <hidden> Date: 2017-06-21 13:05:34
Use the new ethtool link down reason api, and expose troubleshooting
info regarding the link status.
Signed-off-by: Gal Pressman <redacted>
Signed-off-by: Saeed Mahameed <redacted>
---
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 107 +++++++++++++++++++++
.../net/ethernet/mellanox/mlx5/core/mlx5_core.h | 4 +
drivers/net/ethernet/mellanox/mlx5/core/port.c | 25 +++++
3 files changed, 136 insertions(+)
+ ETHTOOL_LINK_OVERTEMP, /* Over temperature */+ ETHTOOL_LINK_PWR_BUDGET_EXC, /* Power budget exceeded */+ ETHTOOL_LINK_MODULE_ADMIN_DOWN, /* Module admin down */
It seems like these last 6 are all SFP issues? How about putting SFP
into the name?
Andrew
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-06-21 14:03:21
quoted hunk
+static int mlx5e_get_link_down_reason(struct net_device *netdev,+ struct ethtool_link_down_reason *ldr)+{+ struct mlx5e_priv *priv = netdev_priv(netdev);+ u16 monitor_opcode;+ int err;++ if (!netif_running(netdev)) {+ ldr->reason = ETHTOOL_LINK_NETDEV_CARRIER_DOWN;+ return 0;+ }
This is generic, will work for any interface. The same is true for
ADMIN_DOWN. Either it is not required at all, since the information is
available via other means, or it should be in the core.
Andrew
From: Stephen Hemminger <stephen@networkplumber.org> Date: 2017-06-21 16:47:24
On Wed, 21 Jun 2017 16:04:43 +0300
Gal Pressman [off-list ref] wrote:
Hi All,
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/failure.
This series provides an infrastructure to ethtool that allows
netdevice drivers to hint the user with the reason why the link is down,
in order to ease the debug process.
In addition two more mlx5 patches to demonstrate the usage.
Reasons are separated to two types, generic and vendor specific.
Drivers can reply with a generic reason using the predefined enums
(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, 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)
Thanks,
Gal.
Ethtool doesn't work well as a monitoring/event interface.
Maybe this would be better as extended information with the netlink UP/DOW event.
From: Jakub Kicinski <hidden> Date: 2017-06-22 04:14:52
On Wed, 21 Jun 2017 16:04:43 +0300, Gal Pressman wrote:
Hi All,
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/failure.
This series provides an infrastructure to ethtool that allows
netdevice drivers to hint the user with the reason why the link is down,
in order to ease the debug process.
In addition two more mlx5 patches to demonstrate the usage.
Reasons are separated to two types, generic and vendor specific.
Drivers can reply with a generic reason using the predefined enums
(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, 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)
Any particular reason for implementing this ABI in ethtool rather than
via some netlink-based interface? Devlink naturally comes to mind,
given that cabling problems are not really related to the L2 and netdev
shouldn't be required for diagnostics..
From: Jakub Kicinski <hidden> Date: 2017-06-22 04:34:01
On Wed, 21 Jun 2017 16:04:46 +0300, Gal Pressman wrote:
Use the new ethtool link down reason api, and expose troubleshooting
info regarding the link status.
Signed-off-by: Gal Pressman <redacted>
Signed-off-by: Saeed Mahameed <redacted>
Is my reading correct that in case the reason is not in the
pddr2ethtool_table opaque binary data will be passed from the firmware
to user space? Is there any particular reason to allow for this? If
it's just for the rare scenario where a new error code needs to be
added perhaps it would be enough to dump the FW-provided message to the
logs?
From: Gal Pressman <hidden> Date: 2017-06-22 08:09:14
quoted
+enum {+ ETHTOOL_LINK_VENDOR_SPECIFIC = -1, /* Vendor specific issue provided in vendor_reason */+ ETHTOOL_LINK_NO_ISSUE, /* No issue observed with link */+ ETHTOOL_LINK_REASON_UNKNOWN, /* Unknown reason */
I think OTHER would be better that UNKNOWN.
Fine with me.
quoted
+ ETHTOOL_LINK_NETDEV_CARRIER_DOWN, /* Netdev carrier is down */
+ ETHTOOL_LINK_ADMIN_DOWN, /* Admin down */
These two are interesting. We have that information already. Why do we
want it again?
My goal is to gather all link issue reasons in one place.
I don't want the user to gather pieces of other reports just to get a sense of what's wrong.
quoted
+ ETHTOOL_LINK_AN_FAILED, /* Auto negotiation failed */+ ETHTOOL_LINK_TRAINING_FAILED, /* Link training failed */+ ETHTOOL_LINK_RMT_FAULT, /* Remote fault indication */+ ETHTOOL_LINK_BAD_SIGNAL_INTEGRITY, /* Bad signal integrity */+ ETHTOOL_LINK_CABLE_MISMATCH, /* Cable protocol mismatch */+ ETHTOOL_LINK_INTERNAL_ERR, /* Internal error */
How does an internet error differ from an UNKNOWN?
Internal error means I know what happened but I can't tell you, your vendor support might be
able to provide a better analysis.
Unknown means that the driver doesn't have any useful information that can help in this case.
+ ETHTOOL_LINK_OVERTEMP, /* Over temperature */+ ETHTOOL_LINK_PWR_BUDGET_EXC, /* Power budget exceeded */+ ETHTOOL_LINK_MODULE_ADMIN_DOWN, /* Module admin down */
It seems like these last 6 are all SFP issues? How about putting SFP
into the name?
Might be a QSFP issue for example, we can put module in the name though.
From: Gal Pressman <hidden> Date: 2017-06-22 08:17:16
quoted
+ if (!netif_running(netdev)) {+ ldr->reason = ETHTOOL_LINK_NETDEV_CARRIER_DOWN;+ return 0;+ }
This is generic, will work for any interface. The same is true for
ADMIN_DOWN. Either it is not required at all, since the information is
available via other means, or it should be in the core.
From: Gal Pressman <hidden> Date: 2017-06-22 08:33:43
Is my reading correct that in case the reason is not in the
pddr2ethtool_table opaque binary data will be passed from the firmware
to user space? Is there any particular reason to allow for this? If
it's just for the rare scenario where a new error code needs to be
added perhaps it would be enough to dump the FW-provided message to the
logs?
No binary data is passed in this patch, the monitor_opcode is simply a vendor specific
16 bit id that is used when the reason is not generic enough to have it's own enum.
From: Gal Pressman <hidden> Date: 2017-06-22 10:33:30
quoted
+ ETHTOOL_LINK_PWR_BUDGET_EXC, /* Power budget exceeded */+ ETHTOOL_LINK_MODULE_ADMIN_DOWN, /* Module admin down */++ ETHTOOL_LINK_REASONS_COUNT+};
Any enumerated list is going to get changed too often.
Could the API just return a string?
The motivation for the enumerated list is to make this API as generic as possible and compatible
with all ethernet drivers.
Returning a string is a good idea, maybe change the vendor specific opcode to a string?
From: Gal Pressman <hidden> Date: 2017-06-22 11:13:50
Ethtool doesn't work well as a monitoring/event interface.
Maybe this would be better as extended information with the netlink UP/DOW event.
This API is not meant for monitoring events.
The main use case here is a new interface that's down and won't go up for some reason.
Nothing will magically change until someone fixes the issue, logging the reason as an event on
netdev creation seems less convenient to me.
From: Gal Pressman <hidden> Date: 2017-06-22 11:37:37
Any particular reason for implementing this ABI in ethtool rather than
via some netlink-based interface? Devlink naturally comes to mind,
given that cabling problems are not really related to the L2 and netdev
shouldn't be required for diagnostics..
ethtool is already used for reporting and handling of link related stuff through get/set_link_ksettings.
How is reporting the link modes/port type/speed/etc different from this?
This feature is only an extension of the already existent "link detected" field.
Implementing this ABI in devlink is a good idea, but it shouldn't be instead of ethtool but in addition to ethtool.
Many users already use ethtool for this kind of info, we can tell them to use devlink to check why their link is down,
but I think it's nicer to have it all in one place.
Which module? This is all very vague. Some of the Marvell 10G PHYs
have an EEPROM to boot from, for example. Would that count? Or are you
talking about the SFP 'EEPROM', which is not actually an EEPROM, in
that it is not Electrically Erasable, not is it a ROM, since things
like temperature changes with time.
quoted
quoted
+ ETHTOOL_LINK_OVERTEMP, /* Over temperature */+ ETHTOOL_LINK_PWR_BUDGET_EXC, /* Power budget exceeded */+ ETHTOOL_LINK_MODULE_ADMIN_DOWN, /* Module admin down */
It seems like these last 6 are all SFP issues? How about putting SFP
into the name?
Might be a QSFP issue for example, we can put module in the name though.
What is the generic name of SFP, SFP+ QSFP, SFF?
Andrew
From: Jakub Kicinski <hidden> Date: 2017-06-22 21:53:57
On Thu, 22 Jun 2017 14:37:26 +0300, Gal Pressman wrote:
quoted
Any particular reason for implementing this ABI in ethtool rather than
via some netlink-based interface? Devlink naturally comes to mind,
given that cabling problems are not really related to the L2 and netdev
shouldn't be required for diagnostics..
ethtool is already used for reporting and handling of link related stuff through get/set_link_ksettings.
How is reporting the link modes/port type/speed/etc different from this?
This feature is only an extension of the already existent "link detected" field.
Implementing this ABI in devlink is a good idea, but it shouldn't be instead of ethtool but in addition to ethtool.
Many users already use ethtool for this kind of info, we can tell them to use devlink to check why their link is down,
but I think it's nicer to have it all in one place.
I understand where you're coming from, but it's a matter of user space
tooling. If ethtool has to invoke devlink or know a little of netlink
to get this info, so be it. Ethtool implements a lot of features, I'm
worried that if we select where things are added based on where the
similar features already live, we will be stuck adding ioctls for
ever :(
But I'm happy to let this go if others don't feel the same way ;)
In general thanks for working on this feature, it's very useful!
From: Jakub Kicinski <hidden> Date: 2017-06-22 22:38:09
On Thu, 22 Jun 2017 11:33:39 +0300, Gal Pressman wrote:
quoted
Is my reading correct that in case the reason is not in the
pddr2ethtool_table opaque binary data will be passed from the firmware
to user space? Is there any particular reason to allow for this? If
it's just for the rare scenario where a new error code needs to be
added perhaps it would be enough to dump the FW-provided message to the
logs?
No binary data is passed in this patch, the monitor_opcode is simply a vendor specific
16 bit id that is used when the reason is not generic enough to have it's own enum.
Sorry if I'm wrong, I thought this would potentially copy
ETH_GSTRING_LEN bytes to userspace:
+ if (status_message)
+ memcpy(status_message,
+ MLX5_ADDR_OF(pddr_reg, out, page_data.troubleshooting_info_page.status_message),
+ ETH_GSTRING_LEN);
I'm also still not sure why a reason would not be generic enough for
the enum, if it fits in the 16bit vendor enum...
Which module? This is all very vague. Some of the Marvell 10G PHYs
have an EEPROM to boot from, for example. Would that count? Or are you
talking about the SFP 'EEPROM', which is not actually an EEPROM, in
that it is not Electrically Erasable, not is it a ROM, since things
like temperature changes with time.
I am referring to the optical/electrical module EEPROM which is exposed through standard
interface such as SFF 8472. Might not be an actual EEPROM but that's how the SFF committee decided
to refer to it :).
quoted
quoted
quoted
+ ETHTOOL_LINK_OVERTEMP, /* Over temperature */+ ETHTOOL_LINK_PWR_BUDGET_EXC, /* Power budget exceeded */+ ETHTOOL_LINK_MODULE_ADMIN_DOWN, /* Module admin down */
It seems like these last 6 are all SFP issues? How about putting SFP
into the name?
Might be a QSFP issue for example, we can put module in the name though.
From: Gal Pressman <hidden> Date: 2017-06-23 08:52:57
On Thu, 22 Jun 2017 11:33:39 +0300, Gal Pressman wrote:
quoted
quoted
Is my reading correct that in case the reason is not in the
pddr2ethtool_table opaque binary data will be passed from the firmware
to user space? Is there any particular reason to allow for this? If
it's just for the rare scenario where a new error code needs to be
added perhaps it would be enough to dump the FW-provided message to the
logs?
No binary data is passed in this patch, the monitor_opcode is simply a vendor specific
16 bit id that is used when the reason is not generic enough to have it's own enum.
Sorry if I'm wrong, I thought this would potentially copy
ETH_GSTRING_LEN bytes to userspace:
+ if (status_message)
+ memcpy(status_message,
+ MLX5_ADDR_OF(pddr_reg, out, page_data.troubleshooting_info_page.status_message),
+ ETH_GSTRING_LEN);
I'm also still not sure why a reason would not be generic enough for
the enum, if it fits in the 16bit vendor enum...
Some reasons might be very specific, and only relevant to my hardware for example.
In that case I'd like to avoid an enum entry that is not wide enough to be used by anyone else but me,
and still have a way to pass it to the user.
The userspace patches will allow for a vendor parser (similar to ethtool regdump parsers) that can
convert this 16bit id to a string.
Which module? This is all very vague. Some of the Marvell 10G PHYs
have an EEPROM to boot from, for example. Would that count? Or are you
talking about the SFP 'EEPROM', which is not actually an EEPROM, in
that it is not Electrically Erasable, not is it a ROM, since things
like temperature changes with time.
I am referring to the optical/electrical module EEPROM which is
exposed through standard interface such as SFF 8472. Might not be an
actual EEPROM but that's how the SFF committee decided to refer to
it :).
Right, so at a minimum, put a comment: The following properties
referring to the optical/electrical module EEPROM which is exposed
through standard interface such as SFF 8472.
That makes it a lot less ambiguous.
quoted
quoted
quoted
quoted
+ ETHTOOL_LINK_OVERTEMP, /* Over temperature */+ ETHTOOL_LINK_PWR_BUDGET_EXC, /* Power budget exceeded */+ ETHTOOL_LINK_MODULE_ADMIN_DOWN, /* Module admin down */
It seems like these last 6 are all SFP issues? How about putting SFP
into the name?
Might be a QSFP issue for example, we can put module in the name though.
What is the generic name of SFP, SFP+ QSFP, SFF?
AFAIK, the name is module.
And as a term, module is overloaded. If the standard is called SFF
8472, then i would suggest putting SFF in these macros.
This is all assuming we actually decide to expose this information
this way....
Andrew
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-06-24 19:04:41
On Thu, Jun 22, 2017 at 11:09:04AM +0300, Gal Pressman wrote:
quoted
quoted
+enum {+ ETHTOOL_LINK_VENDOR_SPECIFIC = -1, /* Vendor specific issue provided in vendor_reason */+ ETHTOOL_LINK_NO_ISSUE, /* No issue observed with link */+ ETHTOOL_LINK_REASON_UNKNOWN, /* Unknown reason */
I think OTHER would be better that UNKNOWN.
Fine with me.
quoted
quoted
+ ETHTOOL_LINK_NETDEV_CARRIER_DOWN, /* Netdev carrier is down */
+ ETHTOOL_LINK_ADMIN_DOWN, /* Admin down */
These two are interesting. We have that information already. Why do we
want it again?
My goal is to gather all link issue reasons in one place.
I'm actually wondering if this is a user space problem. Nearly
everything you list is already available. Some you get from ip link,
others from ethtool or ethtool --module-info, including I2C bus
error, since you would expect EIO or ETIMEOUT.
If you were to write a user space tool using the information what is
currently available, what would be missing?
Andrew
From: Gal Pressman <hidden> Date: 2017-06-25 11:59:34
On Thu, Jun 22, 2017 at 11:09:04AM +0300, Gal Pressman wrote:
quoted
quoted
quoted
+enum {+ ETHTOOL_LINK_VENDOR_SPECIFIC = -1, /* Vendor specific issue provided in vendor_reason */+ ETHTOOL_LINK_NO_ISSUE, /* No issue observed with link */+ ETHTOOL_LINK_REASON_UNKNOWN, /* Unknown reason */
I think OTHER would be better that UNKNOWN.
Fine with me.
quoted
quoted
+ ETHTOOL_LINK_NETDEV_CARRIER_DOWN, /* Netdev carrier is down */
+ ETHTOOL_LINK_ADMIN_DOWN, /* Admin down */
These two are interesting. We have that information already. Why do we
want it again?
My goal is to gather all link issue reasons in one place.
I'm actually wondering if this is a user space problem. Nearly
everything you list is already available. Some you get from ip link,
others from ethtool or ethtool --module-info, including I2C bus
error, since you would expect EIO or ETIMEOUT.
If you were to write a user space tool using the information what is
currently available, what would be missing?
Andrew
I think most of the reasons in this list would be missing.
Auto negotiation failure, link training failure, remote fault indication, bad signal integrity, cable protocol mismatch, cable unplugged,
over temperature, power budget exceeded..
Keep in mind that this is just an initial list, not to mention the vendor reasons which are not part of any existing API.
I don't see how a user space tool that expects ETIMEOUT/EIO is better than this suggestion.
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-06-25 15:19:59
On Sun, Jun 25, 2017 at 02:59:24PM +0300, Gal Pressman wrote:
quoted
On Thu, Jun 22, 2017 at 11:09:04AM +0300, Gal Pressman wrote:
quoted
quoted
quoted
+enum {+ ETHTOOL_LINK_VENDOR_SPECIFIC = -1, /* Vendor specific issue provided in vendor_reason */+ ETHTOOL_LINK_NO_ISSUE, /* No issue observed with link */+ ETHTOOL_LINK_REASON_UNKNOWN, /* Unknown reason */
I think OTHER would be better that UNKNOWN.
Fine with me.
quoted
quoted
+ ETHTOOL_LINK_NETDEV_CARRIER_DOWN, /* Netdev carrier is down */
+ ETHTOOL_LINK_ADMIN_DOWN, /* Admin down */
These two are interesting. We have that information already. Why do we
want it again?
My goal is to gather all link issue reasons in one place.
I'm actually wondering if this is a user space problem. Nearly
everything you list is already available. Some you get from ip link,
others from ethtool or ethtool --module-info, including I2C bus
error, since you would expect EIO or ETIMEOUT.
If you were to write a user space tool using the information what is
currently available, what would be missing?
Andrew
I think most of the reasons in this list would be missing.
Auto negotiation failure,
You can probably get that from the PHY layer. You get both the local
and remote AN capabilities.
unplugged, over temperature, power budget exceeded..
Don't you get over temperature from the SFF data? Also power budget?
And what does cable unplugged actually mean? Do you have a micro
switch inside the socket? So that is maybe a gpio-key?
Another thing to remember is that your device is the exception to the
rule. You have some firmware doing a lot of the work bringing this all
together. But nearly every other Ethernet interface has a discrete MAC
and PHY, I2C bus driver, EEPROM driver, generic SFF decoder, HWMON
temperature sensor, etc. How does your call work in this normal
situation? How do you make calls into all these subsystems to get the
information? You want a generic solution which can be made to work for
everybody.
Andrew
Keep in mind that this is just an initial list, not to mention the vendor reasons which are not part of any existing API.
I don't see how a user space tool that expects ETIMEOUT/EIO is better than this suggestion.
From: Gal Pressman <hidden> Date: 2017-06-26 11:52:48
On Sun, Jun 25, 2017 at 02:59:24PM +0300, Gal Pressman wrote:
quoted
quoted
On Thu, Jun 22, 2017 at 11:09:04AM +0300, Gal Pressman wrote:
quoted
quoted
quoted
+enum {+ ETHTOOL_LINK_VENDOR_SPECIFIC = -1, /* Vendor specific issue provided in vendor_reason */+ ETHTOOL_LINK_NO_ISSUE, /* No issue observed with link */+ ETHTOOL_LINK_REASON_UNKNOWN, /* Unknown reason */
I think OTHER would be better that UNKNOWN.
Fine with me.
quoted
quoted
+ ETHTOOL_LINK_NETDEV_CARRIER_DOWN, /* Netdev carrier is down */
+ ETHTOOL_LINK_ADMIN_DOWN, /* Admin down */
These two are interesting. We have that information already. Why do we
want it again?
My goal is to gather all link issue reasons in one place.
I'm actually wondering if this is a user space problem. Nearly
everything you list is already available. Some you get from ip link,
others from ethtool or ethtool --module-info, including I2C bus
error, since you would expect EIO or ETIMEOUT.
If you were to write a user space tool using the information what is
currently available, what would be missing?
Andrew
I think most of the reasons in this list would be missing.
Auto negotiation failure,
You can probably get that from the PHY layer. You get both the local
and remote AN capabilities.
quoted
unplugged, over temperature, power budget exceeded..
Don't you get over temperature from the SFF data? Also power budget?
You are right, but it depends on other resources that might fail such as BUS failure, invalid EEPROM, etc..
And what does cable unplugged actually mean? Do you have a micro
switch inside the socket? So that is maybe a gpio-key?
No, some hardware devices can sense this state.
We would like to expose this information when it's available.
Another thing to remember is that your device is the exception to the
rule. You have some firmware doing a lot of the work bringing this all
together. But nearly every other Ethernet interface has a discrete MAC
and PHY, I2C bus driver, EEPROM driver, generic SFF decoder, HWMON
temperature sensor, etc. How does your call work in this normal
situation? How do you make calls into all these subsystems to get the
information? You want a generic solution which can be made to work for
everybody.
The driver has a good intimate information of his device implementation, and hence an analysis done by the device vendor is favorable.
The driver provider can perform the analysis inside the device (firmware) or in the driver according to his preferences.
We believe that since devices are becoming smarter, more analysis will be done by the device itself, which has more
information and faster access.
Smart NICs/SoCs are very popular this days and this API takes into account the different architectures.
Since this callback is optional, a user space analysis tool can be added in the future providing more generic analysis approach for
unsupported devices.
Andrew
quoted
Keep in mind that this is just an initial list, not to mention the vendor reasons which are not part of any existing API.
I don't see how a user space tool that expects ETIMEOUT/EIO is better than this suggestion.
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-06-26 13:28:18
On Wed, Jun 21, 2017 at 04:04:44PM +0300, Gal Pressman wrote:
quoted hunk
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 <redacted>
Signed-off-by: Saeed Mahameed <redacted>
---
include/linux/ethtool.h | 2 ++
include/uapi/linux/ethtool.h | 33 +++++++++++++++++++++++++++++++++
net/core/ethtool.c | 24 ++++++++++++++++++++++++
3 files changed, 59 insertions(+)
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
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-06-26 13:34:57
The driver has a good intimate information of his device
implementation, and hence an analysis done by the device vendor is
favorable.
For a firmware based NIC, maybe. For a discrete NIC, making use of all
the Linux subsystems, this is going to be hard from within the kernel.
The driver provider can perform the analysis inside the device (firmware) or in the driver according to his preferences.
We believe that since devices are becoming smarter, more analysis will be done by the device itself, which has more
information and faster access.
Smart NICs/SoCs are very popular this days and this API takes into account the different architectures.
Since this callback is optional, a user space analysis tool can be added in the future providing more generic analysis approach for
unsupported devices.
I still fear this is going to be an ethtool call with only one user.
Andrew
From: Gal Pressman <hidden> Date: 2017-06-26 15:48:51
On Wed, Jun 21, 2017 at 04:04:44PM +0300, Gal Pressman wrote:
quoted
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 <redacted>
Signed-off-by: Saeed Mahameed <redacted>
---
include/linux/ethtool.h | 2 ++
include/uapi/linux/ethtool.h | 33 +++++++++++++++++++++++++++++++++
net/core/ethtool.c | 24 ++++++++++++++++++++++++
3 files changed, 59 insertions(+)
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.
Current implementation will report one issue at a time, fix it to reveal the next one :).
Reporting more than one issue is possible, for example:
Add another callback to return the number of issues and allocate a buffer accordingly, sounds like an overkill to me.
Alternatively, use a bitmap instead of the enum, which will probably get too big very quickly.
I don't think it's worth it in this particular case since in most cases one reason should suffice.
From: David Miller <davem@davemloft.net> Date: 2017-06-27 19:40:49
From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 26 Jun 2017 15:34:39 +0200
I still fear this is going to be an ethtool call with only one user.
That is my fear as well.
We are also in a sort-of moratorium for adding new major ethtool
features until the conversion of ethtool over to netlink occurs.