Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Dave Seddon
Mon, 02 Nov 2026 02:39
[PATCH ethtool] netlink: require a value for hds-thresh and the TDR parameters
Author: Dave Seddon
Date: Mon, 02 Nov 2026 02:39
Date: Mon, 02 Nov 2026 02:39
84 lines
13271 bytes
13271 bytes
hds-thresh (-G) and first, last, step and pair (--cable-test-tdr) take
a value, but their parser entries leave min_argc at 0. Given as the
last word on the line, the value handler reads the NULL that ends argv
and the error message prints it:
# ethtool -G eth0 hds-thresh
ethtool (-G): invalid value '(null)' for parameter 'hds-thresh'
# ethtool --cable-test-tdr eth0 first 1 last
ethtool (--cable-test-tdr): invalid value '(null)' for parameter 'last'
Set min_argc to 1, as every other value-taking parameter does, so the
parser reports the missing value itself:
# ethtool -G eth0 hds-thresh
ethtool (-G): no value for parameter 'hds-thresh'
Only the message changes: the exit status was already 1 and no request
was sent.
Fixes: 66e5dcf295c0 ("ethtool: Add support for configuring hds-thresh")
Fixes: 9561db9b76f4 ("Add cable test TDR support")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
Checked by hand on a build of bae2dbd: all five parameters print the
"(null)" message before and "no value for parameter" after. make check
passes.
Claude found the issue while porting the code from C to Go, and drafted
the patch; I reviewed it and take responsibility for it.
netlink/cable_test.c | 4 ++++
netlink/rings.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/netlink/cable_test.c b/netlink/cable_test.c
index fdb046e..648bf74 100644
--- a/netlink/cable_test.c
+++ b/netlink/cable_test.c
@@ -544,24 +544,28 @@ static const struct param_parser tdr_params[] = {
.type = ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST,
.group = ETHTOOL_A_CABLE_TEST_TDR_CFG,
.handler = nl_parse_direct_m2cm,
+ .min_argc = 1,
},
{
.arg = "last",
.type = ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST,
.group = ETHTOOL_A_CABLE_TEST_TDR_CFG,
.handler = nl_parse_direct_m2cm,
+ .min_argc = 1,
},
{
.arg = "step",
.type = ETHTOOL_A_CABLE_TEST_TDR_CFG_STEP,
.group = ETHTOOL_A_CABLE_TEST_TDR_CFG,
.handler = nl_parse_direct_m2cm,
+ .min_argc = 1,
},
{
.arg = "pair",
.type = ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR,
.group = ETHTOOL_A_CABLE_TEST_TDR_CFG,
.handler = nl_parse_direct_u8,
+ .min_argc = 1,
},
{}
};
diff --git a/netlink/rings.c b/netlink/rings.c
index 5c695ab..22552df 100644
--- a/netlink/rings.c
+++ b/netlink/rings.c
@@ -202,7 +202,7 @@ static const struct param_parser sring_params[] = {
.arg = "hds-thresh",
.type = ETHTOOL_A_RINGS_HDS_THRESH,
.handler = nl_parse_direct_u32,
- .min_argc = 0,
+ .min_argc = 1,
},
{}
};
--
2.56.0
Re: [PATCH ethtool] netlink: require a value for hds-thresh and the TDR parameters
Author: Andrew Lunn
Date: Mon, 02 Nov 2026 13:36
Date: Mon, 02 Nov 2026 13:36
30 lines
9165 bytes
9165 bytes
On Sun, Nov 01, 2026 at 06:39:19PM -0800, Dave Seddon wrote:
> hds-thresh (-G) and first, last, step and pair (--cable-test-tdr) take
> a value, but their parser entries leave min_argc at 0. Given as the
> last word on the line, the value handler reads the NULL that ends argv
> and the error message prints it:
>
> # ethtool -G eth0 hds-thresh
> ethtool (-G): invalid value '(null)' for parameter 'hds-thresh'
> # ethtool --cable-test-tdr eth0 first 1 last
> ethtool (--cable-test-tdr): invalid value '(null)' for parameter 'last'
>
> Set min_argc to 1, as every other value-taking parameter does, so the
> parser reports the missing value itself:
>
> # ethtool -G eth0 hds-thresh
> ethtool (-G): no value for parameter 'hds-thresh'
>
> Only the message changes: the exit status was already 1 and no request
> was sent.
>
> Fixes: 66e5dcf295c0 ("ethtool: Add support for configuring hds-thresh")
> Fixes: 9561db9b76f4 ("Add cable test TDR support")
It would be better to have two patches, rather than one patch with two
Fixes.
The changes themselves look O.K.
Andrew
Re: [PATCH ethtool] netlink: require a value for hds-thresh and the TDR parameters
Author: dave seddon
Date: Mon, 02 Nov 2026 18:59
Date: Mon, 02 Nov 2026 18:59
47 lines
13460 bytes
13460 bytes
Thanks Andrew. v2 splits it into two patches:
https://lore.kernel.org/netdev/20261102185122.1357927-1-dave.seddon.ca@gmail.com/
Dave
On Mon, Nov 2, 2026 at 5:36 AM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Sun, Nov 01, 2026 at 06:39:19PM -0800, Dave Seddon wrote:
> > hds-thresh (-G) and first, last, step and pair (--cable-test-tdr) take
> > a value, but their parser entries leave min_argc at 0. Given as the
> > last word on the line, the value handler reads the NULL that ends argv
> > and the error message prints it:
> >
> > # ethtool -G eth0 hds-thresh
> > ethtool (-G): invalid value '(null)' for parameter 'hds-thresh'
> > # ethtool --cable-test-tdr eth0 first 1 last
> > ethtool (--cable-test-tdr): invalid value '(null)' for parameter 'last'
> >
> > Set min_argc to 1, as every other value-taking parameter does, so the
> > parser reports the missing value itself:
> >
> > # ethtool -G eth0 hds-thresh
> > ethtool (-G): no value for parameter 'hds-thresh'
> >
> > Only the message changes: the exit status was already 1 and no request
> > was sent.
> >
> > Fixes: 66e5dcf295c0 ("ethtool: Add support for configuring hds-thresh")
> > Fixes: 9561db9b76f4 ("Add cable test TDR support")
>
> It would be better to have two patches, rather than one patch with two
> Fixes.
>
> The changes themselves look O.K.
>
> Andrew
--
Regards,
Dave Seddon
+1 415 857 5102
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads