linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ethtool v1] netlink: add LINKSTATE SQI support
@ 2020-05-26  8:29 Oleksij Rempel
  2020-05-26 17:13 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2020-05-26  8:29 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Florian Fainelli, Heiner Kallweit,
	Jakub Kicinski, Jonathan Corbet, Michal Kubecek,
	John W. Linville
  Cc: Oleksij Rempel, David Jander, kernel, linux-kernel, netdev,
	Russell King, mkl, Marek Vasut, Christian Herber, Amit Cohen,
	Petr Machata

Some PHYs provide Signal Quality Index (SQI) if the link is in active
state. This information can help to diagnose cable and system design
related issues.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 netlink/desc-ethtool.c       |  2 ++
 netlink/settings.c           | 16 ++++++++++++++++
 uapi/linux/ethtool_netlink.h |  2 ++
 3 files changed, 20 insertions(+)

diff --git a/netlink/desc-ethtool.c b/netlink/desc-ethtool.c
index 76c6f13..f4559ea 100644
--- a/netlink/desc-ethtool.c
+++ b/netlink/desc-ethtool.c
@@ -91,6 +91,8 @@ static const struct pretty_nla_desc __linkstate_desc[] = {
 	NLATTR_DESC_INVALID(ETHTOOL_A_LINKSTATE_UNSPEC),
 	NLATTR_DESC_NESTED(ETHTOOL_A_LINKSTATE_HEADER, header),
 	NLATTR_DESC_BOOL(ETHTOOL_A_LINKSTATE_LINK),
+	NLATTR_DESC_U32(ETHTOOL_A_LINKSTATE_SQI),
+	NLATTR_DESC_U32(ETHTOOL_A_LINKSTATE_SQI_MAX),
 };
 
 static const struct pretty_nla_desc __debug_desc[] = {
diff --git a/netlink/settings.c b/netlink/settings.c
index 8be5a22..a6b2fba 100644
--- a/netlink/settings.c
+++ b/netlink/settings.c
@@ -604,6 +604,22 @@ int linkstate_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 		printf("\tLink detected: %s\n", val ? "yes" : "no");
 	}
 
+	if (tb[ETHTOOL_A_LINKSTATE_SQI]) {
+		uint32_t val = mnl_attr_get_u32(tb[ETHTOOL_A_LINKSTATE_SQI]);
+
+		print_banner(nlctx);
+		printf("\tSQI: %u", val);
+
+		if (tb[ETHTOOL_A_LINKSTATE_SQI_MAX]) {
+			uint32_t max;
+
+			max = mnl_attr_get_u32(tb[ETHTOOL_A_LINKSTATE_SQI_MAX]);
+			printf("/%u\n", max);
+		} else {
+			printf("\n");
+		}
+	}
+
 	return MNL_CB_OK;
 }
 
diff --git a/uapi/linux/ethtool_netlink.h b/uapi/linux/ethtool_netlink.h
index ad6d3a0..98e236c 100644
--- a/uapi/linux/ethtool_netlink.h
+++ b/uapi/linux/ethtool_netlink.h
@@ -197,6 +197,8 @@ enum {
 	ETHTOOL_A_LINKSTATE_UNSPEC,
 	ETHTOOL_A_LINKSTATE_HEADER,		/* nest - _A_HEADER_* */
 	ETHTOOL_A_LINKSTATE_LINK,		/* u8 */
+	ETHTOOL_A_LINKSTATE_SQI,		/* u32 */
+	ETHTOOL_A_LINKSTATE_SQI_MAX,		/* u32 */
 
 	/* add new constants above here */
 	__ETHTOOL_A_LINKSTATE_CNT,
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH ethtool v1] netlink: add LINKSTATE SQI support
  2020-05-26  8:29 [PATCH ethtool v1] netlink: add LINKSTATE SQI support Oleksij Rempel
@ 2020-05-26 17:13 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2020-05-26 17:13 UTC (permalink / raw)
  To: Oleksij Rempel, Andrew Lunn, David S. Miller, Heiner Kallweit,
	Jakub Kicinski, Jonathan Corbet, Michal Kubecek,
	John W. Linville
  Cc: David Jander, kernel, linux-kernel, netdev, Russell King, mkl,
	Marek Vasut, Christian Herber, Amit Cohen, Petr Machata



On 5/26/2020 1:29 AM, Oleksij Rempel wrote:
> Some PHYs provide Signal Quality Index (SQI) if the link is in active
> state. This information can help to diagnose cable and system design
> related issues.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>


The uapi updates should be separate commits as pointed out by Michal,
with that:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-26 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26  8:29 [PATCH ethtool v1] netlink: add LINKSTATE SQI support Oleksij Rempel
2020-05-26 17:13 ` Florian Fainelli

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).