netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Chris Healy <cphealy@gmail.com>,
	Michal Kubecek <mkubecek@suse.cz>, Andrew Lunn <andrew@lunn.ch>
Subject: [PATCH net-next v1 4/9] net: ethtool: Add attributes for cable test reports
Date: Sat, 25 Apr 2020 20:06:16 +0200	[thread overview]
Message-ID: <20200425180621.1140452-5-andrew@lunn.ch> (raw)
In-Reply-To: <20200425180621.1140452-1-andrew@lunn.ch>

Add the attributes needed to report cable test results to userspace.
The reports are expected to be per twisted pair. A nested property per
pair can report the result of the cable test. A nested property can
also report the length of the cable to any fault.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 Documentation/networking/ethtool-netlink.rst | 35 +++++++++++++++
 include/uapi/linux/ethtool_netlink.h         | 47 +++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst
index 0c354567e991..89fd321b0e29 100644
--- a/Documentation/networking/ethtool-netlink.rst
+++ b/Documentation/networking/ethtool-netlink.rst
@@ -967,6 +967,41 @@ Request contents:
   ``ETHTOOL_A_CABLE_TEST_HEADER``       nested  request header
   ====================================  ======  ==========================
 
+Notify contents:
+
+An Ethernet cable typically contains 1, 2 or 4 pairs. The length of
+the pair can only be measured when there is a fault in the pair and
+hence a reflection. Information about the fault may not be available,
+depends on the specific hardware. Hence the contents of the notify
+message is mostly optional. The attributes can be repeated an
+arbitrary number of times, in an arbitrary order, for an arbitrary
+number of pairs.
+
+The example shows a T2 cable, i.e. two pairs. One pair is O.K, and
+hence has no length information. The second pair has a fault and does
+have length information.
+
+ +-------------------------------------------+--------+-----------------------+
+ | ``ETHTOOL_A_CABLE_TEST_HEADER``           | nested | reply header          |
+ +-------------------------------------------+--------+-----------------------+
+ | ``ETHTOOL_A_CABLE_TEST_NTF_RESULT``       | nested | cable test result     |
+ +-+-----------------------------------------+--------+-----------------------+
+ | | ``ETHTOOL_A_CABLE_RESULTS_PAIR``        | u8     | pair number           |
+ +-+-----------------------------------------+--------+-----------------------+
+ | | ``ETHTOOL_A_CABLE_RESULTS_CODE``        | u8     | result code           |
+ +-+-----------------------------------------+--------+-----------------------+
+ | ``ETHTOOL_A_CABLE_TEST_NTF_RESULT``       | nested | cable test results    |
+ +-+-----------------------------------------+--------+-----------------------+
+ | | ``ETHTOOL_A_CABLE_RESULTS_PAIR``        | u8     | pair number           |
+ +-+-----------------------------------------+--------+-----------------------+
+ | | ``ETHTOOL_A_CABLE_RESULTS_CODE``        | u8     | result code           |
+ +-+-----------------------------------------+--------+-----------------------+
+ | ``ETHTOOL_A_CABLE_TEST_NTF_FAULT_LENGTH`` | nested | cable length          |
+ +-+-----------------------------------------+--------+-----------------------+
+ | | ``ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR``   | u8     | pair number           |
+ +-+-----------------------------------------+--------+-----------------------+
+ | | ``ETHTOOL_A_CABLE_FAULT_LENGTH_CM``     | u8     | length in cm          |
+ +-+-----------------------------------------+--------+-----------------------+
 
 Request translation
 ===================
diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h
index 598d0b502ebd..05ef5048e4fc 100644
--- a/include/uapi/linux/ethtool_netlink.h
+++ b/include/uapi/linux/ethtool_netlink.h
@@ -76,6 +76,7 @@ enum {
 	ETHTOOL_MSG_EEE_NTF,
 	ETHTOOL_MSG_TSINFO_GET_REPLY,
 	ETHTOOL_MSG_CABLE_TEST_ACT_REPLY,
+	ETHTOOL_MSG_CABLE_TEST_NTF,
 
 	/* add new constants above here */
 	__ETHTOOL_MSG_KERNEL_CNT,
@@ -403,7 +404,6 @@ enum {
 	/* add new constants above here */
 	__ETHTOOL_A_TSINFO_CNT,
 	ETHTOOL_A_TSINFO_MAX = (__ETHTOOL_A_TSINFO_CNT - 1)
-
 };
 
 /* CABLE TEST */
@@ -417,6 +417,51 @@ enum {
 	ETHTOOL_A_CABLE_TEST_MAX = __ETHTOOL_A_CABLE_TEST_CNT - 1
 };
 
+/* CABLE TEST NOTIFY */
+enum {
+	ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC,
+	ETHTOOL_A_CABLE_RESULT_CODE_OK,
+	ETHTOOL_A_CABLE_RESULT_CODE_OPEN,
+	ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT,
+	ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT,
+};
+
+enum {
+	ETHTOOL_A_CABLE_PAIR_0,
+	ETHTOOL_A_CABLE_PAIR_1,
+	ETHTOOL_A_CABLE_PAIR_2,
+	ETHTOOL_A_CABLE_PAIR_3,
+};
+
+enum {
+	ETHTOOL_A_CABLE_RESULT_UNSPEC,
+	ETHTOOL_A_CABLE_RESULT_PAIR,		/* u8 ETHTOOL_A_CABLE_PAIR_ */
+	ETHTOOL_A_CABLE_RESULT_CODE,		/* u8 ETHTOOL_A_CABLE_RESULT_CODE_ */
+
+	__ETHTOOL_A_CABLE_RESULT_CNT,
+	ETHTOOL_A_CABLE_RESULT_MAX = (__ETHTOOL_A_CABLE_RESULT_CNT - 1)
+};
+
+enum {
+	ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC,
+	ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR,	/* u8 ETHTOOL_A_CABLE_PAIR_ */
+	ETHTOOL_A_CABLE_FAULT_LENGTH_CM,	/* u16 */
+
+	__ETHTOOL_A_CABLE_FAULT_LENGTH_CNT,
+	ETHTOOL_A_CABLE_FAULT_LENGTH_MAX = (__ETHTOOL_A_CABLE_FAULT_LENGTH_CNT - 1)
+};
+
+enum {
+	ETHTOOL_A_CABLE_TEST_NTF_UNSPEC,
+	ETHTOOL_A_CABLE_TEST_NTF_DEV,		/* nest - ETHTOOL_A_DEV_* */
+	ETHTOOL_A_CABLE_TEST_NTF_NEST,		/* nest - of results: */
+	ETHTOOL_A_CABLE_TEST_NTF_RESULT,	/* nest - ETHTOOL_A_CABLE_RESULT_ */
+	ETHTOOL_A_CABLE_TEST_NTF_FAULT_LENGTH,	/* nest - ETHTOOL_A_CABLE_FAULT_LENGTH_ */
+
+	__ETHTOOL_A_CABLE_TEST_NTF_CNT,
+	ETHTOOL_A_CABLE_TEST_NTF_MAX = (__ETHTOOL_A_CABLE_TEST_NTF_CNT - 1)
+};
+
 /* generic netlink info */
 #define ETHTOOL_GENL_NAME "ethtool"
 #define ETHTOOL_GENL_VERSION 1
-- 
2.26.1


  parent reply	other threads:[~2020-04-25 18:06 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 18:06 [PATCH net-next v1 0/9] Ethernet Cable test support Andrew Lunn
2020-04-25 18:06 ` [PATCH net-next v1 1/9] net: phy: Add cable test support to state machine Andrew Lunn
2020-04-26 19:46   ` Michal Kubecek
2020-04-26 20:31     ` Andrew Lunn
2020-04-26 21:22   ` Florian Fainelli
2020-04-25 18:06 ` [PATCH net-next v1 2/9] net: phy: Add support for polling cable test Andrew Lunn
2020-04-25 19:49   ` Florian Fainelli
2020-04-25 20:10     ` Andrew Lunn
2020-04-26 21:19       ` Florian Fainelli
2020-04-26 22:07         ` Andrew Lunn
2020-04-25 18:06 ` [PATCH net-next v1 3/9] net: ethtool: netlink: Add support for triggering a " Andrew Lunn
2020-04-26 19:36   ` Michal Kubecek
2020-04-26 20:38     ` Andrew Lunn
2020-04-26 20:50       ` Michal Kubecek
2020-04-25 18:06 ` Andrew Lunn [this message]
2020-04-25 20:00   ` [PATCH net-next v1 4/9] net: ethtool: Add attributes for cable test reports Randy Dunlap
2020-04-26 20:25   ` Michal Kubecek
2020-04-26 21:12     ` Andrew Lunn
2020-04-27  7:13       ` Michal Kubecek
2020-04-29 16:16   ` Michael Walle
2020-04-29 18:57     ` Andrew Lunn
2020-04-29 18:58       ` Florian Fainelli
2020-04-29 19:32         ` Michael Walle
2020-04-25 18:06 ` [PATCH net-next v1 5/9] net: ethtool: Make helpers public Andrew Lunn
2020-04-25 18:06 ` [PATCH net-next v1 6/9] net: ethtool: Add infrastructure for reporting cable test results Andrew Lunn
2020-04-25 18:06 ` [PATCH net-next v1 7/9] net: ethtool: Add helpers for reporting " Andrew Lunn
2020-04-25 18:06 ` [PATCH net-next v1 8/9] net: phy: marvell: Add cable test support Andrew Lunn
2020-04-25 18:06 ` [PATCH net-next v1 9/9] net: phy: Put interface into oper testing during cable test Andrew Lunn
2020-04-29 16:02 ` [PATCH net-next v1 0/9] Ethernet Cable test support Michael Walle
2020-04-29 16:32   ` Andrew Lunn
2020-04-30 17:48     ` Michael Walle
2020-04-30 18:23       ` Andrew Lunn
2020-04-30 19:44         ` Michael Walle
2020-04-30 20:51           ` Andrew Lunn
2020-04-30 18:34       ` Florian Fainelli
2020-04-30 19:31         ` Michael Walle
2020-04-30 19:38           ` Florian Fainelli
2020-04-30 19:52             ` Michael Walle
2020-04-30 19:41           ` Andrew Lunn
2020-04-30 20:01             ` Michael Walle
2020-04-30 20:56               ` Andrew Lunn
2020-04-30 20:04             ` Florian Fainelli
2020-04-30 20:13               ` Michael Walle
2020-04-30 20:19                 ` Florian Fainelli
2020-04-30 21:16                   ` Michael Walle

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=20200425180621.1140452-5-andrew@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=cphealy@gmail.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    /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 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).