From: netdev-bot+sashiko@kernel.org
To: mohsin.bashr@gmail.com
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
shuah@kernel.org, maxime.chevallier@bootlin.com,
linux-kselftest@vger.kernel.org, hmohsin@meta.com
Subject: Re: [PATCH net v3] selftests: drv-net: pause: Avoid cleanup failures for unsupported link settings
Date: Mon, 16 Nov 2026 02:29:16 +0000 [thread overview]
Message-ID: <179479615614.3136.17810537023382462405@kernel.org> (raw)
In-Reply-To: <20261113022717.1914724-1-mohsin.bashr@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch removes the unconditional restore of the pre-test
link state from pause_setup(), and pause_test_support() does not…
--
selftests: drv-net: pause: Avoid cleanup failures for unsupported link settings
This patch changes pause.py so that link-setting restores are queued only
after a link-setting request has succeeded. Devices that cannot change link
settings therefore no longer fail during cleanup. If no link configuration
change is accepted, pause_test_support() falls back to checking forced MAC
pause on the current link, and pause_autoneg_link_autoneg() now queues its
own autoneg-on restores.
> diff --git a/tools/testing/selftests/drivers/net/hw/pause.py b/tools/testing/selftests/drivers/net/hw/pause.py
> index ca4a55e59c30f..c3398c7452e01 100755
> --- a/tools/testing/selftests/drivers/net/hw/pause.py
> +++ b/tools/testing/selftests/drivers/net/hw/pause.py
> @@ -402,16 +402,13 @@ def pause_setup(cfg):
> if "auto-negotiation" not in link:
> raise KsftSkipEx(f"{cfg.ifname} doesn't report its link modes")
>
> - if link["auto-negotiation"]:
> - defer(cmd, f"ethtool -s {cfg.ifname} autoneg on")
> - elif "speed" in link and "duplex" in link:
> - defer(cmd, f"ethtool -s {cfg.ifname} autoneg off speed {link['speed']} "
> - f"duplex {link['duplex'].lower()}")
> -
> # Local interface admin up, link aneg on
> ip(f"link set {cfg.ifname} up")
> if link["supports-auto-negotiation"] and not link["auto-negotiation"]:
> ethtool(f"-s {cfg.ifname} autoneg on")
> + if "speed" in link and "duplex" in link:
> + defer(cmd, f"ethtool -s {cfg.ifname} autoneg off speed {link['speed']} "
> + f"duplex {link['duplex'].lower()}")
[ ... ]
> @@ -470,9 +463,12 @@ def pause_test_support(cfg, pauseparams):
>
> forced = forced_link_settings(cfg)
> _, supported = get_local_pause_supported(cfg)
> + link_config_tested = False
>
> # We check that what we can configure in the pause params matches what we
> - # support under various contditions : Link aneg on/off, pause aneg on/off
> + # support under various conditions: link aneg on/off, and pause aneg
> + # on/off. If no link configuration change is supported, fall back to
> + # checking forced MAC pause on the current link.
> ret, _ = ethtool_ret(f"-s {cfg.ifname} autoneg on", is_get = False)
> if ret != 0:
> ksft_pr("link autoneg on refused, not tested")
> @@ -481,18 +477,23 @@ def pause_test_support(cfg, pauseparams):
> "link autoneg on")
> expect_pauseparams_set(cfg, pauseparams, True, supported,
> "link autoneg on")
> + link_config_tested = True
>
> if not forced:
> ksft_pr("link speed unknown, the forced link is not tested")
> - return
> -
> - ret, _ = ethtool_ret(f"-s {cfg.ifname} autoneg off {forced}", is_get = False)
> - if ret != 0:
> - ksft_pr(f"link autoneg off {forced} refused, not tested")
> - return
> -
> - expect_pauseparams_set(cfg, pauseparams, False, supported, "link autoneg off")
> - expect_pauseparams_set(cfg, pauseparams, True, supported, "link autoneg off")
> + else:
> + ret, _ = ethtool_ret(f"-s {cfg.ifname} autoneg off {forced}", is_get = False)
> + if ret != 0:
> + ksft_pr(f"link autoneg off {forced} refused, not tested")
> + else:
> + if link_config_tested:
> + defer(cmd, f"ethtool -s {cfg.ifname} autoneg on")
[Severity: Medium]
Could this leave the local interface autonegotiating when it started with
a forced link?
pause_setup() now queues a restore only when it enables autoneg itself,
which happens when supports-auto-negotiation is true and auto-negotiation
is false. If the port starts forced and reports
supports-auto-negotiation: false, pause_setup() queues nothing.
pause_test_support() then sends:
ret, _ = ethtool_ret(f"-s {cfg.ifname} autoneg on", is_get = False)
If that succeeds, no restore is queued for it. The ethtool netlink core
does not check the Autoneg supported bit. In net/ethtool/linkmodes.c,
ethnl_update_linkmodes() only does:
ethnl_update_u8(&lsettings->autoneg, tb[ETHTOOL_A_LINKMODES_AUTONEG], mod);
The change is then passed to ->set_link_ksettings(), so the driver alone
decides whether to accept it.
If the driver accepts it and the later autoneg off {forced} request also
succeeds, the only restore queued is the hardcoded autoneg on above.
Cleanup then leaves the link in autoneg mode.
Before this patch, pause_setup() queued "autoneg off speed X duplex Y"
first. That restore ran last and put back the original forced settings.
The commit message says:
Fix this by queuing link-setting restores only after a link-setting
request has succeeded.
The first autoneg on request in pause_test_support() can succeed and
change the link, but no restore is queued for it. This only happens with a
driver that accepts enabling autoneg without advertising Autoneg support.
Should pause_test_support() restore the link state it saw before the test
instead of a fixed autoneg on?
> + expect_pauseparams_set(cfg, pauseparams, False, supported, "link autoneg off")
> + expect_pauseparams_set(cfg, pauseparams, True, supported, "link autoneg off")
> + link_config_tested = True
> +
> + if not link_config_tested:
> + expect_pauseparams_set(cfg, pauseparams, False, supported, "current link")
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113022717.1914724-1-mohsin.bashr%40gmail.com
prev parent reply other threads:[~2026-11-16 2:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 2:27 [PATCH net v3] selftests: drv-net: pause: Avoid cleanup failures for unsupported link settings Mohsin Bashir
2026-11-16 2:29 ` netdev-bot+sashiko [this message]
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=179479615614.3136.17810537023382462405@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=edumazet@kernel.org \
--cc=hmohsin@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=mohsin.bashr@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@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