[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <919a9842-f719-41ac-96fb-ae24d2f0798f@lunn.ch>
Date: Thu, 28 Nov 2024 17:58:09 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Michal Kubecek <mkubecek@...e.cz>, kernel@...gutronix.de,
netdev@...r.kernel.org
Subject: Re: [PATCH v2] ethtool: add support for
ETHTOOL_A_CABLE_FAULT_LENGTH_SRC and ETHTOOL_A_CABLE_RESULT_SRC
On Thu, Nov 28, 2024 at 10:01:11AM +0100, Oleksij Rempel wrote:
> Extend cable test output to include source information, supporting
> diagnostic technologies like TDR (Time Domain Reflectometry) and ALCD
> (Active Link Cable Diagnostic). The source is displayed optionally at
> the end of each result or fault length line.
>
> TDR requires interrupting the active link to measure parameters like
> fault location, while ALCD can operate on an active link to provide
> details like cable length without disruption.
>
> Example output:
> Pair B code Open Circuit, source: TDR
> Pair B, fault length: 8.00m, source: TDR
>
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> ---
> changes v2:
> - s/NLATTR_DESC_U8/NLATTR_DESC_U32
> ---
> netlink/cable_test.c | 39 +++++++++++++++++++++++++++++++++------
> netlink/desc-ethtool.c | 2 ++
> 2 files changed, 35 insertions(+), 6 deletions(-)
>
> diff --git a/netlink/cable_test.c b/netlink/cable_test.c
> index ba21c6cd31e4..0a1c42010114 100644
> --- a/netlink/cable_test.c
> +++ b/netlink/cable_test.c
> @@ -18,7 +18,7 @@ struct cable_test_context {
> };
>
> static int nl_get_cable_test_result(const struct nlattr *nest, uint8_t *pair,
> - uint16_t *code)
> + uint16_t *code, uint32_t *src)
> {
> const struct nlattr *tb[ETHTOOL_A_CABLE_RESULT_MAX+1] = {};
> DECLARE_ATTR_TB_INFO(tb);
> @@ -32,12 +32,15 @@ static int nl_get_cable_test_result(const struct nlattr *nest, uint8_t *pair,
>
> *pair = mnl_attr_get_u8(tb[ETHTOOL_A_CABLE_RESULT_PAIR]);
> *code = mnl_attr_get_u8(tb[ETHTOOL_A_CABLE_RESULT_CODE]);
> + if (tb[ETHTOOL_A_CABLE_RESULT_CODE])
> + *src = mnl_attr_get_u32(tb[ETHTOOL_A_CABLE_RESULT_SRC]);
ETHTOOL_A_CABLE_RESULT_SRC is a new property, so only newer kernels
will report it. I think you need an
if (tb[ETHTOOL_A_CABLE_RESULT_SRC]) here, and anywhere else you look for
this property?
Andrew
Powered by blists - more mailing lists