mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Maxime Chevallier (Netdev Foundation)" <maxime.chevallier@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>,
	davem@davemloft.net, Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>
Cc: "Maxime Chevallier (Netdev Foundation)"
	<maxime.chevallier@bootlin.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	thomas.petazzoni@bootlin.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: [PATCH net-next 0/3] selftests: drv-net: Introduce flow-control selftest
Date: Sun, 20 Sep 2026 18:47:26 +0200	[thread overview]
Message-ID: <20260920164732.349744-1-maxime.chevallier@bootlin.com> (raw)

Hi,

This series introduces a test suite for Flow Control, to validate that
drivers behave correctly according to 802.3, but also in a homogenous
way.

Flow control is tricky to get right, for multiple reasons :
 - The negotiation process uses Pause + Asym, while the ethtool API to
   configure pause with TX and RX modes

 - It involves multiple drivers :

  - The MAC driver implements the actual Pause frame handling and
    generation by controlling and reporting these settings to/from the
    hardware. It's also in charge of reporting what the MAC can do.

  - The PHY driver does the actual Pause parameters negociation with the
    LP, and reports that to the MAC

  - Some PCS are also involved in pause to some extent.

phylink helps to some extent, as it implements a lot of the 802.3
translation between RX/TX and Pause/Asym, but not all drivers use
phylink.

Some PHY drivers also tweak the pause advertising, due to HW issues. For
example, KSZ9031 may fail to establish link when advertising Asym Pause.

On top of that, there are 2 toggles for pause autoneg :

 - Link-wide autoneg, dictating whether or not we negotiate ANY
   parameter with the partner
 - Pause autoneg, that only dictates the Pause advertising

To top it all off, the Pause autonegotiation isn't a strict "pick modes
that match exactly what users requested on both ends of the link", the
negotiated pause params may actually differ from what the user asked.

This set of tests is aimed at catching all these issues.

This was tested on a wide variety of HW, some that support Pause + Asym,
some that only support Pause, with a peer that can or can't do pause.

Some issues were found, e.g. even with phylink, setting pause tx off rx
off aneg on makes the local interface still advertise Pause + Asym.

Tested on Macchiatobin, Espressobin, Turris omnia, and around 10
different boards that run stmmac.

Thanks to the Netdev Foundation for funding that work,

Maxime

Maxime Chevallier (Netdev Foundation) (3):
  selftests: drv-net: Introduce a selftest for ethtool flow control
  selftests: drv-net: pause: Validate the pause autonegotiation with a
    partner
  selftests: drv-net: pause: Validate pause autoneg interactions with
    link autoneg

 .../testing/selftests/drivers/net/hw/Makefile |   1 +
 .../drivers/net/hw/lib/py/__init__.py         |   7 +-
 .../testing/selftests/drivers/net/hw/pause.py | 973 ++++++++++++++++++
 .../selftests/drivers/net/lib/py/__init__.py  |   7 +-
 .../selftests/drivers/net/lib/py/ethtool.py   | 205 ++++
 5 files changed, 1191 insertions(+), 2 deletions(-)
 create mode 100755 tools/testing/selftests/drivers/net/hw/pause.py
 create mode 100644 tools/testing/selftests/drivers/net/lib/py/ethtool.py

-- 
2.55.0


             reply	other threads:[~2026-09-20 16:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20 16:47 Maxime Chevallier (Netdev Foundation) [this message]
2026-09-20 16:47 ` [PATCH net-next 1/3] selftests: drv-net: Introduce a selftest for ethtool flow control Maxime Chevallier (Netdev Foundation)
2026-09-20 16:47 ` [PATCH net-next 2/3] selftests: drv-net: pause: tests against a controllable link partner Maxime Chevallier (Netdev Foundation)
2026-09-20 16:47 ` [PATCH net-next 2/3] selftests: drv-net: pause: Validate the pause autonegotiation with a partner Maxime Chevallier (Netdev Foundation)
2026-09-20 16:47 ` [PATCH net-next 3/3] selftests: drv-net: pause: pause autoneg tests Maxime Chevallier (Netdev Foundation)
2026-09-20 16:47 ` [PATCH net-next 3/3] selftests: drv-net: pause: Validate pause autoneg interactions with link autoneg Maxime Chevallier (Netdev Foundation)

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=20260920164732.349744-1-maxime.chevallier@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=skhan@linuxfoundation.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.oltean@nxp.com \
    /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

all inboxes | Powered by JetHome®