[PATCH net-next 0/3] selftests: drv-net: Introduce flow-control selftest

From: Maxime Chevallier (Netdev Foundation)

Date: Sun Sep 20 2026 - 12:48:08 EST


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