From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.171.202.116 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793789885; b=XrUxITQZha6PfHKXmrfwAIhlGGQL/weagYownRaWrnZJxb8kdYKiE5Ma84Kb1aafk/Lz 7k90WwTSoGNGInVplT/QctSxGwmT0vC73QbTNVb8I8gEWqDS83u1tpwr9fvF0ZMdnwAs/ bXE068BLrpmRgTIYC1wZaT6/TdKt/bbvGDylsEQZGCV70gfeay9ml0Ym2/a+WzbpFi6qg JzJeSGio561CRCxuzE2gfFyKIdeTb5NZxhAMvWiTfvfpzlR6AqL9rbgGjZ/rGQaMOWA/x eg3wUvN/sh9+SxEvqgzCnGS4k7xLXAmdsjl3nEi2Bz7ZJNt6c7lTx20If3NHLhzjo4w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793789885; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=tlh7smLTj2XLazLcq0xResbpXj4b1ZAUzr/0lOmTKLk=; b=F5lqZB/86Bw9B7OVjG3X1kkseG8HV9jPKXND8aIcQD0CIvUre+WCoqjk5iwO/RNBsJjJ 7lEooaCn5zKW5ZMKUwD9Kubd9vXi3jWif6lLFl8TUgVwjNxc54RcJ4+t6KOpSA9b03QoB 5s7Ez3jVMYsAGHhRRYYThfAllyFMjUrA2b4hBJ10Sc16erXSSEUd9NKMRAKZ6+92z46VE M9lbmBrvFxz6sW/T2Ys8IJnZf89o0xZRTZq9cJlCuM0jrlyVA8i2lM/XkZ47gg2utX5BO XoLH8IgQMunciPesjesfNRiBa2F44neJCqmoqx5gtm4XePDINsOJbzAohWebxieXZ2w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=aDkra9DG; arc=none smtp.remote-ip=185.171.202.116 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 467DA606A31B for ; Wed, 4 Nov 2026 10:58:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 467DA606A31B Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=aDkra9DG Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 5623DC8F46C; Wed, 4 Nov 2026 10:59:06 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 6316460770; Wed, 4 Nov 2026 10:58:01 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A13CE103291D2; Wed, 4 Nov 2026 11:57:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1793789880; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=tlh7smLTj2XLazLcq0xResbpXj4b1ZAUzr/0lOmTKLk=; b=aDkra9DGoFBO7g3eEfaFzJrcP1KCVRRWmvm+qHRR0gxjUaLwJc9hntUxHL3YmMBh1Wmoil i3Q7gzfbWJpr3cXdD9OKHAW/17OnE8LsODNWJZJ/shPobzDDCGwgU8iWgUTTOQoV5XErkT yQpub/sKDYiaQkhn+r+K9BF+vg7YJkFcDye4cQGeERu3ayRTNXLLTt3qZ5ml1Ph4GfpAbi /vro7GFFzspmlfQkfeKTVvDY3k5HQRJYmnaRfYsWXLtGVRrSVDIxvZYnj19AH3uQsJouk7 06aZXObrtpBh/pSCazPouXeiMoY2TOdQuUU1dnEH5rcv4ZyF0JoHYwpkAzxFSQ== Message-ID: <4f90c4b1-98d3-4e98-bcfc-d9f2d17b4391@bootlin.com> Date: Wed, 4 Nov 2026 11:57:54 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v2] selftests: drv-net: pause: Avoid cleanup failures for unsupported link settings To: Mohsin Bashir , netdev@vger.kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org References: <20261103190622.3981970-1-mohsin.bashr@gmail.com> Content-Language: en-US From: Maxime Chevallier In-Reply-To: <20261103190622.3981970-1-mohsin.bashr@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 Hi, On 11/3/26 20:06, Mohsin Bashir wrote: > From: Mohsin Bashir > > pause_setup() saves the initial link settings and queues a deferred > restore. For devices that report forced link settings but do not support > changing link settings, this can queue a restore even when setup never > changes the link. On fbnic, the deferred restore returns EOPNOTSUPP and > turns pause tests that use pause_setup() into cleanup failures. > > Fix this by queuing the forced-link restore only after setup successfully > enables link autonegotiation. Keep pause_test_support coverage for devices > that cannot change link settings by falling back to forced MAC pause on the > current link. Run the extra link autoneg on/off checks only when those link > setting requests are accepted. > > Results on fbnic: > > Before: # Totals: pass:0 fail:4 xfail:0 xpass:0 skip:24 error:0 > After: # Totals: pass:4 fail:0 xfail:0 xpass:0 skip:24 error:0 > > Fixes: cbd8a536cd6d ("selftests: drv-net: Introduce a selftest for ethtool flow control") > Signed-off-by: Mohsin Bashir That looks better, this patch ran on the netdev CI and no regressions on stmmac, Reviewed-by: Maxime Chevallier Maxime > --- > v2: > - Drop the require_link_autoneg() approach from v1. > - Move the cleanup fix into pause_setup() so all pause tests avoid > restoring unchanged forced-link settings. > - Keep pause_test_support() coverage on devices without link setting > support by falling back to forced MAC pause on the current link. > > v1: https://lore.kernel.org/netdev/20261030173516.1002250-1-mohsin.bashr@gmail.com > --- > .../testing/selftests/drivers/net/hw/pause.py | 40 +++++++++++-------- > 1 file changed, 23 insertions(+), 17 deletions(-) > > diff --git a/tools/testing/selftests/drivers/net/hw/pause.py b/tools/testing/selftests/drivers/net/hw/pause.py > index ca4a55e59c30..99ce6a59dfcd 100755 > --- a/tools/testing/selftests/drivers/net/hw/pause.py > +++ b/tools/testing/selftests/drivers/net/hw/pause.py > @@ -404,14 +404,14 @@ def pause_setup(cfg): > > 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()}") > > # Get remote pause params > ret, params = ethtool_ret(f"-a {cfg.remote_ifname}", host=cfg.remote) > @@ -429,15 +429,15 @@ def pause_setup(cfg): > if link["auto-negotiation"]: > defer(cmd, f"ethtool -s {cfg.remote_ifname} autoneg on", > host=cfg.remote) > - elif "speed" in link and "duplex" in link: > - defer(cmd, f"ethtool -s {cfg.remote_ifname} autoneg off " > - f"speed {link['speed']} duplex {link['duplex'].lower()}", > - host=cfg.remote) > > # Remote interface admin up, link aneg on > ip(f"link set {cfg.remote_ifname} up", host=cfg.remote) > if link["supports-auto-negotiation"] and not link["auto-negotiation"]: > ethtool(f"-s {cfg.remote_ifname} autoneg on", host=cfg.remote) > + if "speed" in link and "duplex" in link: > + defer(cmd, f"ethtool -s {cfg.remote_ifname} autoneg off " > + f"speed {link['speed']} duplex {link['duplex'].lower()}", > + host=cfg.remote) > > wait_for_link(cfg) > > @@ -470,9 +470,12 @@ def pause_test_support(cfg, pauseparams): > > forced = forced_link_settings(cfg) > _, supported = get_local_pause_supported(cfg) > + 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 +484,21 @@ def pause_test_support(cfg, pauseparams): > "link autoneg on") > expect_pauseparams_set(cfg, pauseparams, True, supported, > "link autoneg on") > + 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: > + expect_pauseparams_set(cfg, pauseparams, False, supported, "link autoneg off") > + expect_pauseparams_set(cfg, pauseparams, True, supported, "link autoneg off") > + tested = True > + > + if not tested: > + expect_pauseparams_set(cfg, pauseparams, False, supported, "current link") > > @ksft_variants(pauseparams_variants) > @ksft_disruptive