[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eajj4mhvqkwrl7lmsrmjy32sncanymqefhxkv4cpnjvxnf2v7o@o6vtfpu7pyym>
Date: Thu, 28 Nov 2024 18:36:27 +0100
From: Michal Kubecek <mkubecek@...e.cz>
To: Andrew Lunn <andrew@...n.ch>
Cc: Oleksij Rempel <o.rempel@...gutronix.de>, 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 05:58:09PM +0100, Andrew Lunn wrote:
> 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?
Looks like a forgotten edit of copy&pasted text as the
!tb[ETHTOOL_A_CABLE_RESULT_CODE] case is already handled by a bail out
few lines before. (And the same for ETHTOOL_A_CABLE_FAULT_LENGTH_CM in
nl_get_cable_test_fault_length().)
Michal
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists