Skip to contentSkip to conversation

Documentation: networking: Add a test plan for ethtool pause validation

PATCH In review Maxime Chevallier (Netdev Foundation) 5 participants 32 messages May 22 – Jun 29

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: networking: Add a test plan for ethtool pause validation

Flow control configuration through Ethernet Pause frames is not straightforward to get right when implementing a MAC or a PHY driver.

This is often a feature that's poorly tested during development, and getting it right requires correct configuration both in MAC drivers, that implement the flow-control, and the PHY drivers, which deal with the negotiation of the pause parameters.

As part of the Netdev Foundation effort to improve driver testing, and to ease the development and review effort, The netdev mailing list has been surveyed to identify the common pitfalls. This testing plan has been written to try and catch most of the common problems.

This document is aimed as being a human readable basis we can adjust and discuss before diving into the actual tests implementation, it may not necessarily have to live in the kernel doc forever, especially once tests are implemented.

Note that Oleksij Rempel made some attempts at documenting Ethernet Flow-control before [1], this current work isn't meant to superseed it but rather complement it with a testing protocol.

[1] : https://lore.kernel.org/netdev/[email protected]/

---

Temptative approach to send that as part of the kdoc, this may not be the best path, as this could simply be some email thread.

 Documentation/networking/index.rst           |   1 +
 Documentation/networking/pause_test_plan.rst | 556 +++++++++++++++++++
 2 files changed, 557 insertions(+)
 create mode 100644 Documentation/networking/pause_test_plan.rst
Documentation/networking/index.rst +1 -0
index 44a422ad3b05..fef54999267d 100644
@@ -91,6 +91,7 @@ Contents:
    openvswitch
    operstates
    packet_mmap
+   pause_test_plan
    phonet
    phy-link-topology
    phy-port
Documentation/networking/pause_test_plan.rst new file +556 -0

556 lines not on this page · raw message

Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 1 line · On Fri, 22 May 2026 19:51:06 +0200 Maxime Chevallier (Netdev Foundation) wrote:
 Documentation/networking/pause_test_plan.rst | 556 +++++++++++++++++++

It'd be great to hear from others but IMHO in the current form this is not suitable for Documentation/networking/ We can commit the "knowledge" part but enumerating the test cases seems odd for Documentation/.

#2 lore raw
Quoted 7 lines · Jakub Kicinski
Quoted 1 line · On Fri, 22 May 2026 19:51:06 +0200 Maxime Chevallier (Netdev Foundation) wrote:
 Documentation/networking/pause_test_plan.rst | 556 +++++++++++++++++++

It'd be great to hear from others but IMHO in the current form this is not suitable for Documentation/networking/ We can commit the "knowledge" part but enumerating the test cases seems odd for Documentation/.

Sorry, not looked too deeply at the actual content yet.

What i was thinking was a python file, which sphinx can ingest to produce documentation, and place holders were code would be added to implement the actual test during the next phase.

This is how i've done testing in the past. I would be the evil one who thought up the tests and described them in detail using sphinx markup in a python test template file. After some review they got passed off to a python developer for implementation. And when they got run and failed, sometimes the feature developer, the test developer and myself got together to figure who made the error.

I'm not sure we even need sphinx. What i find important is that the test is documented. What kAPI calls should be made with what parameters. What results we are expected and why? So that when a test fails, a developer has the information they need to fix their code. The Why? is important, and often missing from the kernel tests.

Andrew

#3 lore raw
Quoted 22 lines · Andrew Lunn
Quoted 7 lines · Jakub Kicinski
Quoted 1 line · On Fri, 22 May 2026 19:51:06 +0200 Maxime Chevallier (Netdev Foundation) wrote:
  Documentation/networking/pause_test_plan.rst | 556 +++++++++++++++++++

It'd be great to hear from others but IMHO in the current form this is not suitable for Documentation/networking/ We can commit the "knowledge" part but enumerating the test cases seems odd for Documentation/.

Sorry, not looked too deeply at the actual content yet.

What i was thinking was a python file, which sphinx can ingest to produce documentation, and place holders were code would be added to implement the actual test during the next phase.

This is how i've done testing in the past. I would be the evil one who thought up the tests and described them in detail using sphinx markup in a python test template file. After some review they got passed off to a python developer for implementation. And when they got run and failed, sometimes the feature developer, the test developer and myself got together to figure who made the error.

Quoted 5 lines

I'm not sure we even need sphinx. What i find important is that the test is documented. What kAPI calls should be made with what parameters. What results we are expected and why? So that when a test fails, a developer has the information they need to fix their code. The Why? is important, and often missing from the kernel tests.

I see, so we'd get an actual test plan as code (likely python), with for now placeholder tests, that would work :)

As for the kAPI testing, I agree that the end goal is to get driver authors to get their flow control implementation right running this suite.

But I don't really see how we can validate kAPI itself, as we're down at the ethnl level.

This is made more complex by the fact that there are 2 drivers involved here, the MAC and the PHY one. On top of that, either the MAC driver uses phylink, or it doesn't. The common issues are different depending on the case.

Raw phylib usage is by far the trickiest, but even phylink-based MAC
drivers can get it wrong, by ignoring the pause params in their mac_link_up() phylink callback, or getting their capabilities wrong.

The problem is we get an aggregated view of that in userspace. The pauseparams come from the MAC driver, but the supported and advertised modes are an aggregation of PHY + MAC stuff, which makes it very hard to pinpoint where people are getting it wrong. Maybe people are writing a MAC driver, but their tests fail because the PHY on their board has a mis-behaving PHY driver, etc.

We're missing some information about what the MAC alone does, and what the PHY driver alone also does, so that we can look at it from the userspace perspective, and says for example "OK your MAC says that it can only do Sym Pause, but I see that the interface reports supporting Asym as well, and you're not using phylink, so you are not calling phy_set_asymp_pause() correctly".

One possible path for that could be debugfs ? to let MAC/PHY expose precise info, so we know who is wrong ?

Or, we go lower level and use the .self_test ethtool callback. We're no longer validating the user-visible behaviour, but we have more control on kAPI testing. We can poke into net_device, net_device->phydev, we may even instrument phylib to validate what the MAC is doing ? But that means we're drifting away from the netlink-level testing.

Maxime

Quoted 2 lines

Andrew

#4 lore raw
Quoted 6 lines

As for the kAPI testing, I agree that the end goal is to get driver authors to get their flow control implementation right running this suite.

But I don't really see how we can validate kAPI itself, as we're down at the ethnl level.

All we can do is invoke the kAPI in different ways, and test we get the expected results. When it fails, it is down to the developer to figure out why, which layer. But they have a description of what the test is doing, and why? In most reviews, all i need to explain is the expected behaviour, and the second version is correct. So a test with explanation text should sort cut that process. I don't think we need any more.

To some extent, we have an iterative process here. We have never done testing of this, we don't know exactly what we need. If we get feedback that a test is failing, but they cannot figure out why, we might need to help out, and then extend either the text, or add finer grain testing to narrow down the problem space. If we get a submission which passes all the tests but review turns up problems, we might want to ask the developers to extend the tests to catch the failure.

Andrew

#5 lore raw
Quoted 15 lines · Andrew Lunn
Quoted 6 lines

As for the kAPI testing, I agree that the end goal is to get driver authors to get their flow control implementation right running this suite.

But I don't really see how we can validate kAPI itself, as we're down at the ethnl level.

All we can do is invoke the kAPI in different ways, and test we get the expected results. When it fails, it is down to the developer to figure out why, which layer. But they have a description of what the test is doing, and why? In most reviews, all i need to explain is the expected behaviour, and the second version is correct. So a test with explanation text should sort cut that process. I don't think we need any more.

Quoted 8 lines

To some extent, we have an iterative process here. We have never done testing of this, we don't know exactly what we need. If we get feedback that a test is failing, but they cannot figure out why, we might need to help out, and then extend either the text, or add finer grain testing to narrow down the problem space. If we get a submission which passes all the tests but review turns up problems, we might want to ask the developers to extend the tests to catch the failure.

So I've been thinking lately: should we let AI generate and maintain these tests, including kselftest? This would give us a much richer and more comprehensive set of tests. Plus, each test could come with a complete explanation of its purpose and methodology. In short, much of the work we used to do manually can be offloaded to AI. This way, we can build a massive test suite and achieve much broader coverage.

I'm actually trying this out right now.

Thanks.

Quoted 2 lines

Andrew

#6 lore raw
Quoted 6 lines

So I've been thinking lately: should we let AI generate and maintain these tests, including kselftest? This would give us a much richer and more comprehensive set of tests. Plus, each test could come with a complete explanation of its purpose and methodology. In short, much of the work we used to do manually can be offloaded to AI. This way, we can build a massive test suite and achieve much broader coverage.

A test suite only has value if it is correct. It actually has negative value if it is wrong, because you are forcing developers to make their implementations wrong in order to pass the tests.

Do you have the knowledge to validate whatever you generate via IA? Can you argue it is correct? Do you have a range of hardware to test it on?

It could be an interesting experiment, but i'm sceptical, until proven otherwise.

Andrew

maintainer
#7 lore raw
In reply to Andrew Lunn
Quoted 17 lines · On Wed, 27 May 2026 04:47:47 +0200 Andrew Lunn wrote:
Quoted 3 lines

It'd be great to hear from others but IMHO in the current form this is not suitable for Documentation/networking/ We can commit the "knowledge" part but enumerating the test cases seems odd for Documentation/.

Sorry, not looked too deeply at the actual content yet.

What i was thinking was a python file, which sphinx can ingest to produce documentation, and place holders were code would be added to implement the actual test during the next phase.

This is how i've done testing in the past. I would be the evil one who thought up the tests and described them in detail using sphinx markup in a python test template file. After some review they got passed off to a python developer for implementation. And when they got run and failed, sometimes the feature developer, the test developer and myself got together to figure who made the error.

Quoted 5 lines

I'm not sure we even need sphinx. What i find important is that the test is documented. What kAPI calls should be made with what parameters. What results we are expected and why? So that when a test fails, a developer has the information they need to fix their code. The Why? is important, and often missing from the kernel tests.

All makes sense. The question is primarily how we fit that into the existing project layout we have in the kernel :(

The python tests can be hacked up to print the test case docstring before the failure.

But I think for human and AI reviewer consumption it may be nice to keep the condensed knowledge / common mistakes in Documentation/ If we had the ability to exercise the submissions it'd be a different story test output would be a sufficient signal and/or could be fed into the review. But for AI making a guess at whether the submitted driver is correct purely from the driver source - knowledge is useful.

#8 lore raw

Hi,

Quoted 30 lines · Jakub Kicinski
Quoted 17 lines · On Wed, 27 May 2026 04:47:47 +0200 Andrew Lunn wrote:
Quoted 3 lines

It'd be great to hear from others but IMHO in the current form this is not suitable for Documentation/networking/ We can commit the "knowledge" part but enumerating the test cases seems odd for Documentation/.

Sorry, not looked too deeply at the actual content yet.

What i was thinking was a python file, which sphinx can ingest to produce documentation, and place holders were code would be added to implement the actual test during the next phase.

This is how i've done testing in the past. I would be the evil one who thought up the tests and described them in detail using sphinx markup in a python test template file. After some review they got passed off to a python developer for implementation. And when they got run and failed, sometimes the feature developer, the test developer and myself got together to figure who made the error.

Quoted 5 lines

I'm not sure we even need sphinx. What i find important is that the test is documented. What kAPI calls should be made with what parameters. What results we are expected and why? So that when a test fails, a developer has the information they need to fix their code. The Why? is important, and often missing from the kernel tests.

All makes sense. The question is primarily how we fit that into the existing project layout we have in the kernel :(

The python tests can be hacked up to print the test case docstring before the failure.

Quoted 6 lines

But I think for human and AI reviewer consumption it may be nice to keep the condensed knowledge / common mistakes in Documentation/ If we had the ability to exercise the submissions it'd be a different story test output would be a sufficient signal and/or could be fed into the review. But for AI making a guess at whether the submitted driver is correct purely from the driver source - knowledge is useful.

Ok so let's split this then, on one hand the knowledge part, and on the other hand the test definitions.

From what I get from Andrew and you, the test definitions is lacking in details w.r.t the start conditions, the return code handling as well.

Having that in the doc is going to be too verbose, but in some python test that could really be great.

I'll use that as a basis for V2

Maxime

#9 lore raw
Quoted 5 lines

From what I get from Andrew and you, the test definitions is lacking in details w.r.t the start conditions, the return code handling as well.

Having that in the doc is going to be too verbose, but in some python test that could really be great.

My experience with such documents is that they are verbose, very much cut/paste repeated text, with just one parameter changed between test variants, and a slight different expected result. And i personally tend to make a lot of cut/paste errors :-(

Return code handling is also important, so i think it should be stated. It is also potentially the most complex part of it. It happens in all the corner cases which are going to get the least testing when implementing the tests. They only really get exercised when the tests are thrown at oddball hardware by developers trying to validate their hardware.

There are also cases where the hardware reports it can do something, and then returns EOPNOTSUPP when asked to do it, which is a bug. So the tests becomes a sort of decision tree. The hardware reports it can only do symmetric pause. We go down the branch that makes sure symmetric pause passes, but asymmetric reports EOPNOTSUPP, etc.

There are a lot of combinations/permutations, and limited resources, so it could be we cannot actually test everything. We might need to accept EOPNOTSUPP at any stage as a pass, simply because we don't have the resources to test all the corner cases.

I would normally actually concentrate on the corner cases, because developers should have tested the happy path cases themselves. However, for pause, we often see the happy path being very wrong, so we should spend more time testing the happy path, and less on the corner cases.

And that is probably true for all the testing we are doing at the moment, because we are concentrating on subjects where developers often get the basics wrong.

Andrew

#10 lore raw
In reply to Jakub Kicinski

Hi

Quoted 30 lines · Jakub Kicinski
Quoted 17 lines · On Wed, 27 May 2026 04:47:47 +0200 Andrew Lunn wrote:
Quoted 3 lines

It'd be great to hear from others but IMHO in the current form this is not suitable for Documentation/networking/ We can commit the "knowledge" part but enumerating the test cases seems odd for Documentation/.

Sorry, not looked too deeply at the actual content yet.

What i was thinking was a python file, which sphinx can ingest to produce documentation, and place holders were code would be added to implement the actual test during the next phase.

This is how i've done testing in the past. I would be the evil one who thought up the tests and described them in detail using sphinx markup in a python test template file. After some review they got passed off to a python developer for implementation. And when they got run and failed, sometimes the feature developer, the test developer and myself got together to figure who made the error.

Quoted 5 lines

I'm not sure we even need sphinx. What i find important is that the test is documented. What kAPI calls should be made with what parameters. What results we are expected and why? So that when a test fails, a developer has the information they need to fix their code. The Why? is important, and often missing from the kernel tests.

All makes sense. The question is primarily how we fit that into the existing project layout we have in the kernel :(

The python tests can be hacked up to print the test case docstring before the failure.

Quoted 6 lines

But I think for human and AI reviewer consumption it may be nice to keep the condensed knowledge / common mistakes in Documentation/ If we had the ability to exercise the submissions it'd be a different story test output would be a sufficient signal and/or could be fed into the review. But for AI making a guess at whether the submitted driver is correct purely from the driver source - knowledge is useful.

Also for the knowledge part, we had Oleksij's series that documented more aspects of flow control (not just the pause part) :

https://lore.kernel.org/netdev/[email protected]/

Oleksij, maybe we can merge some of the information here with your doc for the Docuentation/networking part ?

Maxime

#11 lore raw

Hi,

Quoted 40 lines · Maxime Chevallier

Hi

Quoted 30 lines · Jakub Kicinski
Quoted 17 lines · On Wed, 27 May 2026 04:47:47 +0200 Andrew Lunn wrote:
Quoted 3 lines

It'd be great to hear from others but IMHO in the current form this is not suitable for Documentation/networking/ We can commit the "knowledge" part but enumerating the test cases seems odd for Documentation/.

Sorry, not looked too deeply at the actual content yet.

What i was thinking was a python file, which sphinx can ingest to produce documentation, and place holders were code would be added to implement the actual test during the next phase.

This is how i've done testing in the past. I would be the evil one who thought up the tests and described them in detail using sphinx markup in a python test template file. After some review they got passed off to a python developer for implementation. And when they got run and failed, sometimes the feature developer, the test developer and myself got together to figure who made the error.

Quoted 5 lines

I'm not sure we even need sphinx. What i find important is that the test is documented. What kAPI calls should be made with what parameters. What results we are expected and why? So that when a test fails, a developer has the information they need to fix their code. The Why? is important, and often missing from the kernel tests.

All makes sense. The question is primarily how we fit that into the existing project layout we have in the kernel :(

The python tests can be hacked up to print the test case docstring before the failure.

Quoted 6 lines

But I think for human and AI reviewer consumption it may be nice to keep the condensed knowledge / common mistakes in Documentation/ If we had the ability to exercise the submissions it'd be a different story test output would be a sufficient signal and/or could be fed into the review. But for AI making a guess at whether the submitted driver is correct purely from the driver source - knowledge is useful.

Quoted 7 lines

Also for the knowledge part, we had Oleksij's series that documented more aspects of flow control (not just the pause part) :

https://lore.kernel.org/netdev/[email protected]/

Oleksij, maybe we can merge some of the information here with your doc for the Docuentation/networking part ?

I have nothing against it. We need a documentation for proper testing and implementations too :)

Best Regards,
Oleksij

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#12 lore raw
In reply to Andrew Lunn

Hi Andrew,

Quoted 22 lines · Andrew Lunn
Quoted 7 lines · Jakub Kicinski
Quoted 1 line · On Fri, 22 May 2026 19:51:06 +0200 Maxime Chevallier (Netdev Foundation) wrote:
 Documentation/networking/pause_test_plan.rst | 556 +++++++++++++++++++

It'd be great to hear from others but IMHO in the current form this is not suitable for Documentation/networking/ We can commit the "knowledge" part but enumerating the test cases seems odd for Documentation/.

Sorry, not looked too deeply at the actual content yet.

What i was thinking was a python file, which sphinx can ingest to produce documentation, and place holders were code would be added to implement the actual test during the next phase.

This is how i've done testing in the past. I would be the evil one who thought up the tests and described them in detail using sphinx markup in a python test template file. After some review they got passed off to a python developer for implementation. And when they got run and failed, sometimes the feature developer, the test developer and myself got together to figure who made the error.

Quoted 5 lines

I'm not sure we even need sphinx. What i find important is that the test is documented. What kAPI calls should be made with what parameters. What results we are expected and why? So that when a test fails, a developer has the information they need to fix their code. The Why? is important, and often missing from the kernel tests.

This isn't sphynx, but I've come-up with something like this for a test definition :

@ksft_ethtool_needs_supported_anyof([Pause, Asym_Pause]) def test_ethtool_pause_advertising(cfg, peer) -> None:
"""Pause advertisement

Validate that changing pause params through the ETHTOOL_MSG_PAUSE command translates to a change in the advertised pause params, and that these parameters are correct w.r.t the supported pause params and requested pause params.

This exercises the .set_pauseparams() ethtool ops for MAC configuration, as well as the reconfiguration of the PHY's advertising and negociation.

On non-phylink MACs, the MAC should call phy_set_sym_pause() to update the PHY's advertising, and restart a negotiation with phy_start_aneg() if need be. Failure to do so will result on the wrong advertising parameters.

Pn phylink-enabled MACs, phylink deals with the PHY reconfiguration provided the MAC driver calls phylink_ethtool_set_pauseparam().

Failing this test likely means that the PHY driver is not correctly advertising pause settings, either due to the MAC not triggering a PHY reconfiguration, a misconficonfiguration of the advertising registers by the PHY, or by mis-handling the phydev->advertising bitfield in the PHY driver directly.

The validation is made by looking at the advertised modes locally, as well as what the peer's 'lp_advertising' values report.

cfg -- local device's interface configuration
peer -- peer device handle
"""

# Initial conditions :
# - Local interface is admin UP, and reports lowlayer link UP # - Remote interface is adming UP, and reports lowlayer link UP #
# Test 1
# - SKIP if supported doesn't contain "Pause"
# - run 'ethtool -A ethX rx on tx on autoneg on'
# - FAIL if the return isn't 0
# - FAIL if ETHTOOL_A_LINKMODES_OURS's advertised values does not contain
# "Pause" or contains "Asym_Pause"
# - FAIL if peer's lp_advertising doesn't contain "Pause" or contains
# "Asym_Pause"
# - Succeed otherwise
#
# Test 2
# - SKIP uif supported doesn't contain both "Pause" and "Asym_Pause" # - run 'ethtool -A ethX rx on tx on autoneg on'
# - FAIL if the return isn't 0
# - FAIL if ETHTOOL_A_LINKMODES_OURS's advertised values does not contain
# "Pause" or contains "Asym_Pause"
# - FAIL if peer's lp_advertising doesn't contain "Pause" or contains
# "Asym_Pause"
#
# ...

The annotation defines the pre-requisites in terms of locally supported linkmodes, we have a docstring containing information for developpers to debug their drivers, what I'm unsure about is the commented-out part below, so either one big function testing multiple adjacent scenarios or indivitual functions.

We could also use annotations to enumerate the various combinations of modes to test.

That's just an extract of the full test suite for Pause, but before writing the whole thing down i figure it's better to iterate on a single test's design.

What do you think ?

Maxime

#13 lore raw
Quoted 13 lines

This isn't sphynx, but I've come-up with something like this for a test definition :

@ksft_ethtool_needs_supported_anyof([Pause, Asym_Pause]) def test_ethtool_pause_advertising(cfg, peer) -> None:
"""Pause advertisement

Validate that changing pause params through the ETHTOOL_MSG_PAUSE command translates to a change in the advertised pause params, and that these parameters are correct w.r.t the supported pause params and requested pause params.

Quoted 8 lines

This exercises the .set_pauseparams() ethtool ops for MAC configuration, as well as the reconfiguration of the PHY's advertising and negociation.

On non-phylink MACs, the MAC should call phy_set_sym_pause() to update the PHY's advertising, and restart a negotiation with phy_start_aneg() if need be. Failure to do so will result on the wrong advertising parameters.

Pn phylink-enabled MACs, phylink deals with the PHY reconfiguration provided

On

Quoted 7 lines

the MAC driver calls phylink_ethtool_set_pauseparam().

Failing this test likely means that the PHY driver is not correctly advertising pause settings, either due to the MAC not triggering a PHY reconfiguration, a misconficonfiguration of the advertising registers by the PHY, or by mis-handling the phydev->advertising bitfield in the PHY driver directly.

Quoted 5 lines

The validation is made by looking at the advertised modes locally, as well as what the peer's 'lp_advertising' values report.

cfg -- local device's interface configuration
peer -- peer device handle

Plain Sphinx can be made to pick up this method documentation and include it the generated documentation. You would use something like

.. automethod:: test_ethtool_pause_advertising

in the .rst file.

I've no idea if the kernel configuration of sphinx allows this. At the moment, i would not spend too much time on getting sphinx to generate documentation. I would say that is nice to have. The description itself is more important.

Quoted 27 lines

"""

# Initial conditions :
# - Local interface is admin UP, and reports lowlayer link UP # - Remote interface is adming UP, and reports lowlayer link UP #
# Test 1
# - SKIP if supported doesn't contain "Pause"
# - run 'ethtool -A ethX rx on tx on autoneg on'
# - FAIL if the return isn't 0
# - FAIL if ETHTOOL_A_LINKMODES_OURS's advertised values does not contain
# "Pause" or contains "Asym_Pause"
# - FAIL if peer's lp_advertising doesn't contain "Pause" or contains
# "Asym_Pause"
# - Succeed otherwise
#
# Test 2
# - SKIP uif supported doesn't contain both "Pause" and "Asym_Pause" # - run 'ethtool -A ethX rx on tx on autoneg on'
# - FAIL if the return isn't 0
# - FAIL if ETHTOOL_A_LINKMODES_OURS's advertised values does not contain
# "Pause" or contains "Asym_Pause"
# - FAIL if peer's lp_advertising doesn't contain "Pause" or contains
# "Asym_Pause"
#
# ...

Quoted 5 lines

The annotation defines the pre-requisites in terms of locally supported linkmodes, we have a docstring containing information for developpers to debug their drivers, what I'm unsure about is the commented-out part below, so either one big function testing multiple adjacent scenarios or indivitual functions.

Sphinx follows pythons object orientate structure. So you could have a class test_ethtool_pause_advertising, with class documentation. And then methods within the class which are individual tests. The commented out section would then be method documentation.

However, i've no idea if the selftest code allows for classes of test methods? It looks like ksft_run() takes a list of methods. So you can probably instantiate the class, and then pass it methods from the class?

I would say you are right about picking one of the simple test case, and playing with it, define and implement it, and see what comes out at the end.

Andrew

#14 lore raw
Quoted 5 lines

Sphinx follows pythons object orientate structure. So you could have a class test_ethtool_pause_advertising, with class documentation. And then methods within the class which are individual tests. The commented out section would then be method documentation.

Good point, so maybe something along these lines :

- A class for the test
- methods for indivitual tests
- For readability, I've written what the internal test helper would look like (_adv_test), and how a test would look like without the helper in adv_rx_on_tx_on().

I'm already diving into coding, but it helps me a bit in the definition of the "description" format :)

this is what the class would look like :

class test_ethtool_pause_advertising:
"""Pause advertisement

Validate that changing pause params through the ETHTOOL_MSG_PAUSE command translates to a change in the advertised pause params, and that these parameters are correct w.r.t the supported pause params and requested pause params.

This exercises the .set_pauseparams() ethtool ops for MAC configuration, as well as the reconfiguration of the PHY's advertising and negociation.

On non-phylink MACs, the MAC should call phy_set_sym_pause() to update the PHY's advertising, and restart a negotiation with phy_start_aneg() if need be. Failure to do so will result on the wrong advertising parameters.

Pn phylink-enabled MACs, phylink deals with the PHY reconfiguration provided the MAC driver calls phylink_ethtool_set_pauseparam().

Failing this test likely means that the PHY driver is not correctly advertising pause settings, either due to the MAC triggering a PHY reconfiguration, a misconficonfiguration of the advertising registers by the PHY, or by mis-handling the phydev->advertising bitfield in the PHY driver directly.

The validation is made by looking at the advertised modes locally, as well as what the peer's 'lp_advertising' values report.

cfg -- local device's interface configuration
peer -- peer device handle
"""

def _adv_test(cfg, peer, rx, tx, adv, not_adv):
ret = cfg.run(f"ethtool -A ethX rx {rx} tx {tx} autoneg on") ksft_eq(ret, 0)

linkmodes = cfg.get_advertising()
if adv:
ksft_in(adv, linkmodes, f"rx {rx} tx {tx} must advertise {adv}")

if not_adv:
ksft_not_in(not_adv, linkmodes, f"rx {rx} tx {tx} must not advertise {not_adv}")

remote_linkmodes = peer.get_lp_advertising()

if adv:
ksft_in(adv, linkmodes, f"PHY does not advertise {adv}")

if not_adv:
ksft_not_in(not_adv, linkmodes, f"PHY incorrectly advertises {not_adv}")

@ksft_ethtool_needs_supported_allof([Pause])
def adv_rx_on_tx_on(cfg, peer) -> None:
"""Advertising test with rx on tx on

- run 'ethtool -A ethX rx on tx on autoneg on'
- FAIL if the return isn't 0
- FAIL if ETHTOOL_A_LINKMODES_OURS's advertised values does not contain "Pause" or contains "Asym_Pause"
- FAIL if peer's lp_advertising doesn't contain "Pause" or contains "Asym_Pause"
- Succeed otherwise
"""
ret = cfg.run('ethtool -A ethX rx on tx on autoneg on') ksft_eq(ret, 0)

linkmodes = cfg.get_advertising()
ksft_in('Pause', linkmodes, "rx on tx on must advertise Pause") ksft_not_in('Asym_Pause', linkmodes, "rx on tx on must not advertise Asym_Pause")

remote_linkmodes = peer.get_lp_advertising()
ksft_in('Pause', linkmodes, "PHY does not advertise Pause") ksft_not_in('Asym_Pause', linkmodes, "PHY incorrectly advertises Asym_Pause")

@ksft_ethtool_needs_supported_allof([Pause, Asym_Pause]) def adv_rx_on_tx_off(cfg, peer) -> None:
"""Advertising test with rx on tx off

- run 'ethtool -A ethX rx on tx off autoneg on'
- FAIL if the return isn't 0
- FAIL if ETHTOOL_A_LINKMODES_OURS's advertised values does not contain "Pause" and "Asym_Pause"
- FAIL if peer's lp_advertising doesn't contain "Pause" and "Asym_Pause"
- Succeed otherwise
"""

_adv_test(cfg, peer, 'on', 'off', ["Pause", "Asym_Pause"], [])

@ksft_ethtool_needs_supported_allof([Asym_Pause]) def adv_rx_off_tx_on(cfg, peer) -> None:
"""Advertising test with rx off tx on

- run 'ethtool -A ethX rx off tx on autoneg on'
- FAIL if the return isn't 0
- FAIL if ETHTOOL_A_LINKMODES_OURS's advertised values does not contain "Asym_Pause" or contains "Pause"
- FAIL if peer's lp_advertising doesn't contain "Pause" and "Asym_Pause"
- Succeed otherwise
"""

_adv_test(cfg, peer, 'off', 'on', ["Asym_Pause"], ["Pause"])

Maxime

#15 lore raw
Quoted 14 lines · Maxime Chevallier
Quoted 5 lines

Sphinx follows pythons object orientate structure. So you could have a class test_ethtool_pause_advertising, with class documentation. And then methods within the class which are individual tests. The commented out section would then be method documentation.

Good point, so maybe something along these lines :

- A class for the test
- methods for indivitual tests
- For readability, I've written what the internal test helper would look like (_adv_test), and how a test would look like without the helper in adv_rx_on_tx_on().

Quoted 4 lines

I'm already diving into coding, but it helps me a bit in the definition of the "description" format :)

this is what the class would look like :

I like this :-)

Quoted 4 lines

    @ksft_ethtool_needs_supported_allof([Pause])
    def adv_rx_on_tx_on(cfg, peer) -> None:

Using decorators is a nice idea. Since it is not a C concept, please give the decorator a good comment explaining what it does. We should not assume driver developers know python.

Quoted 13 lines

"""Advertising test with rx on tx on

- run 'ethtool -A ethX rx on tx on autoneg on'
- FAIL if the return isn't 0
- FAIL if ETHTOOL_A_LINKMODES_OURS's advertised values does not contain "Pause" or contains "Asym_Pause"
- FAIL if peer's lp_advertising doesn't contain "Pause" or contains "Asym_Pause"
- Succeed otherwise
"""
ret = cfg.run('ethtool -A ethX rx on tx on autoneg on') ksft_eq(ret, 0)

Quoted 7 lines

linkmodes = cfg.get_advertising()
ksft_in('Pause', linkmodes, "rx on tx on must advertise Pause") ksft_not_in('Asym_Pause', linkmodes, "rx on tx on must not advertise Asym_Pause")

remote_linkmodes = peer.get_lp_advertising()
ksft_in('Pause', linkmodes, "PHY does not advertise Pause") ksft_not_in('Asym_Pause', linkmodes, "PHY incorrectly advertises Asym_Pause")

There should be a sleep in here somewhere, to allow the autoneg to complete.

Andrew

#16 lore raw

Hi,

Quoted 15 lines · Andrew Lunn
Quoted 14 lines · Maxime Chevallier
Quoted 5 lines

Sphinx follows pythons object orientate structure. So you could have a class test_ethtool_pause_advertising, with class documentation. And then methods within the class which are individual tests. The commented out section would then be method documentation.

Good point, so maybe something along these lines :

- A class for the test
- methods for indivitual tests
- For readability, I've written what the internal test helper would look like (_adv_test), and how a test would look like without the helper in adv_rx_on_tx_on().

Quoted 6 lines
Quoted 4 lines

I'm already diving into coding, but it helps me a bit in the definition of the "description" format :)

this is what the class would look like :

I like this :-)

Great :)

Quoted 9 lines
Quoted 5 lines


    @ksft_ethtool_needs_supported_allof([Pause])
    def adv_rx_on_tx_on(cfg, peer) -> None:

Using decorators is a nice idea. Since it is not a C concept, please give the decorator a good comment explaining what it does. We should not assume driver developers know python.

No problem, I'll add that

Quoted 18 lines
Quoted 18 lines

"""Advertising test with rx on tx on

- run 'ethtool -A ethX rx on tx on autoneg on'
- FAIL if the return isn't 0
- FAIL if ETHTOOL_A_LINKMODES_OURS's advertised values does not contain "Pause" or contains "Asym_Pause"
- FAIL if peer's lp_advertising doesn't contain "Pause" or contains "Asym_Pause"
- Succeed otherwise
"""
ret = cfg.run('ethtool -A ethX rx on tx on autoneg on') ksft_eq(ret, 0)

linkmodes = cfg.get_advertising()
ksft_in('Pause', linkmodes, "rx on tx on must advertise Pause") ksft_not_in('Asym_Pause', linkmodes, "rx on tx on must not advertise Asym_Pause")

Quoted 6 lines
Quoted 3 lines

remote_linkmodes = peer.get_lp_advertising()
ksft_in('Pause', linkmodes, "PHY does not advertise Pause") ksft_not_in('Asym_Pause', linkmodes, "PHY incorrectly advertises Asym_Pause")

There should be a sleep in here somewhere, to allow the autoneg to complete.

Indeed, I think in the end this will be wrapped by some ksft_ethtool_* helper we'll add, that will also deal with the case where autoneg doesn't succeed and the link stays down.

That's both for error detections, but I also expect there might be cases we'll want to test that autoneg does not actually succeed.

Good to see we're closing in on a definition, I'll spin V2 based on that format :)

Maxime

maintainer
#17 lore raw
In reply to Andrew Lunn
Quoted 15 lines · On Fri, 26 Jun 2026 14:39:57 +0200 Andrew Lunn wrote:
Quoted 14 lines · Maxime Chevallier
Quoted 5 lines

Sphinx follows pythons object orientate structure. So you could have a class test_ethtool_pause_advertising, with class documentation. And then methods within the class which are individual tests. The commented out section would then be method documentation.

Good point, so maybe something along these lines :

- A class for the test
- methods for indivitual tests
- For readability, I've written what the internal test helper would look like (_adv_test), and how a test would look like without the helper in adv_rx_on_tx_on().

Quoted 6 lines
Quoted 4 lines

I'm already diving into coding, but it helps me a bit in the definition of the "description" format :)

this is what the class would look like :

I like this :-)

This is very far from what existing python tests do in netdev.

I would prefer to stick to the "bash on steroids" use of Python.

Are you both familiar with the existing tests?

#18 lore raw

Hi Jakub,

Quoted 16 lines · Jakub Kicinski
Quoted 15 lines · On Fri, 26 Jun 2026 14:39:57 +0200 Andrew Lunn wrote:
Quoted 14 lines · Maxime Chevallier
Quoted 5 lines

Sphinx follows pythons object orientate structure. So you could have a class test_ethtool_pause_advertising, with class documentation. And then methods within the class which are individual tests. The commented out section would then be method documentation.

Good point, so maybe something along these lines :

- A class for the test
- methods for indivitual tests
- For readability, I've written what the internal test helper would look like (_adv_test), and how a test would look like without the helper in adv_rx_on_tx_on().

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I'm already diving into coding, but it helps me a bit in the definition of the "description" format :)

this is what the class would look like :

I like this :-)

This is very far from what existing python tests do in netdev.

We can probably drop the class, as it is with this discussion, it's merely a way to regroup doc common to similar tests. The rest really is the usual set of ksft funcs you can feed to the run function, with a set of ksft_ethtool_* annotators for generic checks.

Quoted 2 lines

I would prefer to stick to the "bash on steroids" use of Python.

Maxime

maintainer
#19 lore raw
Quoted 6 lines · On Sat, 27 Jun 2026 07:34:31 +0200 Maxime Chevallier wrote:
Quoted 1 line

This is very far from what existing python tests do in netdev.

We can probably drop the class, as it is with this discussion, it's merely a way to regroup doc common to similar tests. The rest really is the usual set of ksft funcs you can feed to the run function, with a set of ksft_ethtool_* annotators for generic checks.

The common way of checking prereqs in the tests is to call a function called require_xyz() which then raises a skip. At a quick glance - the rss_api and xdp_metadata are good tests to get a sense of the usual format.

#20 lore raw
Quoted 11 lines · Jakub Kicinski
Quoted 6 lines · On Sat, 27 Jun 2026 07:34:31 +0200 Maxime Chevallier wrote:
Quoted 1 line

This is very far from what existing python tests do in netdev.

We can probably drop the class, as it is with this discussion, it's merely a way to regroup doc common to similar tests. The rest really is the usual set of ksft funcs you can feed to the run function, with a set of ksft_ethtool_* annotators for generic checks.

The common way of checking prereqs in the tests is to call a function called require_xyz() which then raises a skip. At a quick glance - the rss_api and xdp_metadata are good tests to get a sense of the usual format.

The counter example is the ksft_disruptive() decorator.

Pythons own unittest framework makes use of decorators to skip tests. Its the Pythonic way.

Andrew

#21 lore raw

Hi Jakub, Andrew,

Quoted 9 lines · Andrew Lunn
Quoted 8 lines · Jakub Kicinski
Quoted 6 lines · On Sat, 27 Jun 2026 07:34:31 +0200 Maxime Chevallier wrote:
Quoted 1 line

This is very far from what existing python tests do in netdev.

We can probably drop the class, as it is with this discussion, it's merely a way to regroup doc common to similar tests. The rest really is the usual set of ksft funcs you can feed to the run function, with a set of ksft_ethtool_* annotators for generic checks.

Quoted 8 lines
Quoted 3 lines

The common way of checking prereqs in the tests is to call a function called require_xyz() which then raises a skip. At a quick glance - the rss_api and xdp_metadata are good tests to get a sense of the usual format.

The counter example is the ksft_disruptive() decorator.

Pythons own unittest framework makes use of decorators to skip tests. Its the Pythonic way.

So maybe in the end, we can try to have something a bit less python-y, while still using extensive documentation using sphynx doc format ?

Let me send a V2 with the full test list, we'll see how much scaffolding we can build for ethtool testing, and how. I suspect that running/skipping based on the device's capabilities is going to be used throughout lots of tests beyond pause.

For now the important part is to get that test list right, and iterate on the test implementation once we agree on what to test, why and how.

Maxime

maintainer
#22 lore raw
Quoted 10 lines · On Mon, 29 Jun 2026 17:24:51 +0200 Maxime Chevallier wrote:
Quoted 9 lines · Andrew Lunn
Quoted 3 lines · Jakub Kicinski

The common way of checking prereqs in the tests is to call a function called require_xyz() which then raises a skip. At a quick glance - the rss_api and xdp_metadata are good tests to get a sense of the usual format.

The counter example is the ksft_disruptive() decorator.

Pythons own unittest framework makes use of decorators to skip tests. Its the Pythonic way.

Problem is vast majority of our developers do not know "Pythonic" ways. And bash tests for HW are an absolute pile of impossible to debug dookie. Half of the time bash doesn't print anything when test fails, so good luck figuring out what happened on someone else's setup 10% of the time :|

I'm hoping to strike a balance with keeping Python relatively dumb, and pulling as many people as possible away form bash.

Quoted 10 lines

So maybe in the end, we can try to have something a bit less python-y, while still using extensive documentation using sphynx doc format ?

Let me send a V2 with the full test list, we'll see how much scaffolding we can build for ethtool testing, and how. I suspect that running/skipping based on the device's capabilities is going to be used throughout lots of tests beyond pause.

For now the important part is to get that test list right, and iterate on the test implementation once we agree on what to test, why and how.

Maybe we should step back and figure out the full story for the self-documentation thing. The good tests under tools...drivers/net already have module and test-case level doc. So we can come up with a way of extracting that and weaving that into NIPA? That way we are all on the same page?

How should the test info be presented? I think it'd fit best in here:
https://netdev.bots.linux.dev/devices.html ? Or do you have something else in mind?

#23 lore raw
In reply to Jakub Kicinski
Quoted 7 lines · Jakub Kicinski
Quoted 1 line · On Fri, 22 May 2026 19:51:06 +0200 Maxime Chevallier (Netdev Foundation) wrote:
  Documentation/networking/pause_test_plan.rst | 556 +++++++++++++++++++

It'd be great to hear from others but IMHO in the current form this is not suitable for Documentation/networking/ We can commit the "knowledge" part but enumerating the test cases seems odd for Documentation/.

I think the same, I wasn't sure exactly how/where to send that to, so at least in this form you can generate that as a nicer to read html form, but this will likely change given Andrew's feedback

Maxime

#24 lore raw
In reply to Maxime Chevallier (Netdev Foundation)
Quoted 1 line

+ These are used to allow the PHY do know what Pause settings the MAC supports, in

s/do/to/

Quoted 67 lines
Documentation/networking/pause_test_plan.rst new file +66 -0
+Similarly, the link partner can advertise its capabilities through the same
+bits. These parameters are exchanged through the negotiation process, but can
+also be enforced locally by disabling **pause autoneg**, thus ignoring the
+link partner's capabilities.
+
+The local resolution of the pause configuration after receiving the link-partner
+abilities is done according to the following table, from 802.3 Annex 28B.3 :
+
++-------------+--------------+--------------------------+
+|Local device | Link partner | Pause settings resolution|
++------+------+-------+------+-----------+--------------+
+|Pause | Asym | Pause | Asym | RX        | TX           |
++======+======+=======+======+===========+==============+
+| 0    | 0    | Any   | Any  | No        | No           |
++------+------+-------+------+-----------+--------------+
+| 0    | 1    | 0     | Any  | No        | No           |
++------+------+-------+------+-----------+--------------+
+| 0    | 1    | 1     | 0    | No        | No           |
++------+------+-------+------+-----------+--------------+
+| 0    | 1    | 1     | 1    | No        | Yes          |
++------+------+-------+------+-----------+--------------+
+| 1    | 0    | 0     | Any  | No        | No           |
++------+------+-------+------+-----------+--------------+
+| 1    | Any  | 1     | Any  | Yes       | Yes          |
++------+------+-------+------+-----------+--------------+
+| 1    | 1    | 0     | 0    | No        | No           |
++------+------+-------+------+-----------+--------------+
+| 1    | 1    | 0     | 1    | Yes       | No           |
++------+------+-------+------+-----------+--------------+
+
+The currently configured and advertised settings can be queried with ::
+
+  ethtool <iface>
+
+  Settings for eth0:
+        ...
+	Supported pause frame use: Symmetric Receive-only
+        ...
+	Advertised pause frame use: Symmetric Receive-only
+        ...
+	Link partner advertised pause frame use: Symmetric Receive-only
 
+A : Standalone driver testing
+=============================
+
+Requirements : The interface under test must be connected to a link-partner whose
+interface is admin-up. We don't require the link-partner to be configured in any
+other specific manner for these tests.
+
+A.1 : Sanity Checks
+~~~~~~~~~~~~~~~~~~~
+
+Pause autoneg is set to off::
+
+  ethtool -A <iface> autoneg off
+
+The 'supported' fields retrieved using the ETHTOOL_MSG_LINKMODES_GET includes
+a "Pause" bit and an "Asym" bit.
+
+The ETHTOOL_MSG_PAUSE_GET command returns the currently configured pause modes
+in the "tx" and "rx" attributes.
+
+These parameters must validate against the following truth table :
+
+   +--------------+-----------------+
+   | linkmodes    | pauseparam      |
+   +-------+------+--------+--------+

Documentation/networking/pause_test_plan.rst line 169

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+   | Pause | Asym | rx     | tx     |
+   +=======+======+========+========+
+   | 0     | 0    | 0      | 0      |
+   +-------+------+--------+--------+
+   | 0     | 1    | 0      | 0 or 1 |
+   +-------+------+--------+--------+
+   | 1     | 0    |     rx == tx    |
+   +-------+------+--------+--------+
+   | 1     | 1    | 0 or 1 | 0 or 1 |
+   +-------+------+--------+--------+

I think we need more sanity checks here, in order to know if the tests that follow can be run.

If ETHTOOL_MSG_PAUSE_GET returns -EOPNOTSUPP, it is not a test error, but all the following tests using forced pause should be skipped, since it indicates forced pause is not supported.

When pause autoneg is on, and LP values are not reported, we probably want a warning. I don't think we can say it is an error to report local values but not LP values. There is probably firmware implementations which don't make it available to user space. But we should discourage such behaviour with a warning. And some of the tests which follow will need to be skipped.

I would suggest looking through the tests and making a list of things which must be implemented in order to actually perform the test. If something is missing and returns -EOPNOTSUPP, we need to skip the test.

Quoted 6 lines
Documentation/networking/pause_test_plan.rst new file +6 -0
+
+Test scenario
+-------------
+
+Following the reported value from::
+

Documentation/networking/pause_test_plan.rst line 185

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+        ethtool <iface>
+        Settings for <iface>:
+                ...
+	        Supported pause frame use: <value>
+
+Iterate over all the 4 combinations of rx and tx pause parameters::
+
+        ethtool -A <iface> autoneg off rx <rx_val> tx <tx_val>
+
+The settings must be accepted or rejected, according to the above truth table.

-EOPNOTSUPP should also be consider a pass. Other codes should be a fail.

Sorry, out of time now, i will continue later.

Andrew

#25 lore raw
In reply to Maxime Chevallier (Netdev Foundation)

Documentation/networking/pause_test_plan.rst line 153

Quoted 12 lines
Documentation/networking/pause_test_plan.rst new file +12 -0
+A.1 : Sanity Checks
+~~~~~~~~~~~~~~~~~~~
+
+Pause autoneg is set to off::
+
+  ethtool -A <iface> autoneg off
+
+The 'supported' fields retrieved using the ETHTOOL_MSG_LINKMODES_GET includes
+a "Pause" bit and an "Asym" bit.
+
+The ETHTOOL_MSG_PAUSE_GET command returns the currently configured pause modes
+in the "tx" and "rx" attributes.

What you have left unspecified here is the state a link autoneg,

ethtool -s <iface> autoneg on|off

At minimum, it should be specified. I've not read the other tests yet, but we may also want to run this basic test with both possible setting.

One possible bug which we are trying to detect is that pause autoneg is off, the values are forced, but -s autoneg is on, it completes, and overwrites the forces values with negotiated values.

Quoted 7 lines
Documentation/networking/pause_test_plan.rst new file +7 -0
+A.2 : Half-duplex operation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Pause settings as exposed with the ethtool API only concern full-duplex modes.
+
+Test scenario:
+--------------

Documentation/networking/pause_test_plan.rst line 207

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+
+Set the interface under test in half-duplex mode with::
+
+  ethtool -s <iface> duplex half
+
+Expected behaviour::
+
+ - ethtool <iface>
+
+shows no Pause settings advertised.

Since we are talking about advertisement of pause, i think you actually want

ethtool -A <iface> autoneg on
ethtool -s <iface> duplex half autoneg on

If -s autoneg is off, nothing should be advertised. So we need that turned on. And if -A autoneg is off, no pause values should be advertised, so you need that turned on as well.

Also, since we expect this to trigger an autoneg, we probably want a sleep(2) in there before looking at the results, to ensure autoneg has completed.

There is also the possibility that the link does not come up, because the link peer does not support half duplex. This is quite common for 1G interfaces. It could also be the local interface does not support 1G half. So maybe

ethtool -s <iface> duplex half speed 100 autoneg on

Or let it first autoneg unrestricted, look at both the local and LP values, and pick a half duplex link mode both support and set it to do that?

The tests defined so far also don't cover all the possible settings of -A autoneg and -s autoneg. There are combinations:

Link autoneg with pause autoneg
Link autoneg with forced pause
Force link, with forced pause

It would be good to consider what can be tested for these three. Maybe nothing can be tested with forced link, because that it likely to result in no link, when only the local side can be configured.

Documentation/networking/pause_test_plan.rst line 218

Quoted 7 lines
Documentation/networking/pause_test_plan.rst new file +7 -0
+B : Combined devices testing
+============================
+
+Requirements : The interface under test must be connected to a link-partner that
+can be actively configured during the tests. It must at least support full-duplex
+modes, and optionally (but ideally) symmetric and asymmetric flow-control, as
+well as autonegotiation of the Pause parameters.

and forced link parameters.

Documentation/networking/pause_test_plan.rst line 224

Quoted 6 lines
Documentation/networking/pause_test_plan.rst new file +6 -0
+
+B.1 : Autoneg advertising
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Goal: Validate that the *advertised* Pause and AsymDir bits match the configured
+pausemarams.

typo.

Quoted 30 lines
Documentation/networking/pause_test_plan.rst new file +30 -0
+
+The link-level autonegotiation must be enabled::
+
+  ethtool <iface> autoneg on
+
+Pause parameters are set with::
+
+  ethtool -A <iface> rx <val> tx <val> autoneg on
+
+Pause advertising is retrieved with::
+
+  ethtool <iface>
+
+Case 1
+------
+
+Pause parameters : rx **off** tx **off**
+
+Expected advertisement : **None** (Pause = 0, AsymDir = 0)
+
+Case 2
+------
+
+Pause parameters : rx **off** tx **on**
+
+Expected advertisement : **Transmit-only** (Pause = 0, AsymDir = 1)
+
+Case 3
+------
+

Documentation/networking/pause_test_plan.rst line 264

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+Pause parameters : rx **on** tx **off**
+
+Expected advertisement : **Symmetric receive-only** (Pause = 1, Asymdir = 1)
+
+Case 4
+------
+
+Pause parameters : rx **on** tx **on**
+
+Expected advertisement : **Symmetric** (Pause = 1, Asymdir = 0)

We should consider here what happens when the local side only supports symmetric pause. We would expect EOPNOTSUPP, or maybe EINVAL. If ethtool report:

Supported pause frame use: Symmetric Receive-only

not getting an error for the asymmetric settings would be a bug.

Quoted 4 lines
Documentation/networking/pause_test_plan.rst new file +4 -0
+
+B.2 : Autoneg resolution
+~~~~~~~~~~~~~~~~~~~~~~~~
+

Documentation/networking/pause_test_plan.rst line 278

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+Goal: Validate that the Pause and AsymDir negotiation translates to the right
+TX and RX pause parameters.
+
+The following table, from the 802.3 standard, exposes the autoneg resolution
+result for the advertised pause parameters by each link partner.
+
++-------------+--------------+--------------------------+
+|Local device | Link partner | Pause settings resolution|
++------+------+-------+------+-----------+--------------+
+|Pause | Asym | Pause | Asym | RX        | TX	        |

There is a tab vs space issue here.

Quoted 25 lines

++======+======+=======+======+===========+==============+
+| 0 | 0 | Any | Any | No | No |
++------+------+-------+------+-----------+--------------+
+| 0 | 1 | 0 | Any | No | No |
++------+------+-------+------+-----------+--------------+
+| 0 | 1 | 1 | 0 | No | No |
++------+------+-------+------+-----------+--------------+
+| 0 | 1 | 1 | 1 | No | Yes |
++------+------+-------+------+-----------+--------------+
+| 1 | 0 | 0 | Any | No | No |
++------+------+-------+------+-----------+--------------+
+| 1 | Any | 1 | Any | Yes | Yes |
++------+------+-------+------+-----------+--------------+
+| 1 | 1 | 0 | 0 | No | No |
++------+------+-------+------+-----------+--------------+
+| 1 | 1 | 0 | 1 | Yes | No |
++------+------+-------+------+-----------+--------------+

Documentation/networking/pause_test_plan.rst new file +8 -0
+
+The mapping between the configured pause parameters and advertised modes follow
+the following truth table :
+
++----+----+-------+---------+
+| tx | rx | Pause | AsymDir |
++====+====+=======+=========+
+| 0  | 0  | 0     | 0       |

Documentation/networking/pause_test_plan.rst line 313

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
++----+----+-------+---------+
+| 0  | 1  | 1     | 1       |
++----+----+-------+---------+
+| 1  | 0  | 0     | 1       |
++----+----+-------+---------+
+| 1  | 1  | 1     | 0       |
++----+----+-------+---------+
+
+We can boil that down to the following cases to test, keeping the number small
+to avoid dealing with the whole combinatory::

Why not do the whole set of combination? There are 16 combinations, autoneg takes a little over 1 second, so we are probably talking 32 seconds in total. That is a reasonable runtime for a test.

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+Case 1
+------
+
+Local device : rx **off**, tx **off**
+Remote device : rx **on** tx **on**
+
+Expected result on local device after autonegotiation completes :
+        rx negotiated **off**
+        tx negotiated **off**
+

...

Quoted 9 lines
Documentation/networking/pause_test_plan.rst new file +9 -0
+Case 7
+------
+
+Local device : rx **on** tx **on**
+Remote device : rx **off** tx **off**
+
+Expected result on local device after autonegotiation completes :
+        rx negotiated **off**
+        tx negotiated **off**

Documentation/networking/pause_test_plan.rst line 407

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+
+Case 8
+------
+
+Local device : rx **on** tx **on**
+Remote device : rx **off** tx **on**
+
+Expected result on local device after autonegotiation completes :
+        rx negotiated **on**
+        tx negotiated **off**

what also needs to be considered here is:

What if the local side only supports symmetric pause? What if the LP only supports symmetric pause?

The expect results should take this into account, that the configuration fails, but that is not a test failure, just a hardware limitation.

Quoted 21 lines
Documentation/networking/pause_test_plan.rst new file +21 -0
+
+B.3 : Pause Autoneg
+~~~~~~~~~~~~~~~~~~~
+
+Goal: Validate that the Pause autonegotiation flag correctly toggles the
+advertised Pause and AsymDir link parameters.
+
+Test scenario:
+--------------
+
+ - Enable pause autoneg and at least rx or tx pause::
+
+        ethtool -A <iface> rx on tx on autoneg on
+
+ - Check the Advertised pause frame use::
+
+        ethtool <iface>
+
+        ...
+        Advertised pause frame use: Symmetric Receive-only
+

Documentation/networking/pause_test_plan.rst line 438

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+ - Disable pause autoneg::
+
+        ethtool -A <iface> autoneg off
+
+ - Check the Advertised pause frame use, which must be 'No'::
+
+        ethtool <iface>
+
+        ...
+        Advertised pause frame use: No

Please describe configuration for both sides. This is needed for all the tests when there are two devices involved.

Also, when local pause advertisement is turned off, check what the link partner is reporting it received from its link partner.

Andrew

#26 lore raw
Quoted 15 lines · Andrew Lunn

Documentation/networking/pause_test_plan.rst line 153

Quoted 12 lines
Documentation/networking/pause_test_plan.rst new file +12 -0
+A.1 : Sanity Checks
+~~~~~~~~~~~~~~~~~~~
+
+Pause autoneg is set to off::
+
+  ethtool -A <iface> autoneg off
+
+The 'supported' fields retrieved using the ETHTOOL_MSG_LINKMODES_GET includes
+a "Pause" bit and an "Asym" bit.
+
+The ETHTOOL_MSG_PAUSE_GET command returns the currently configured pause modes
+in the "tx" and "rx" attributes.

What you have left unspecified here is the state a link autoneg,

Quoted 5 lines

ethtool -s <iface> autoneg on|off

At minimum, it should be specified. I've not read the other tests yet, but we may also want to run this basic test with both possible setting.

True ! With a more formalized test description, it should be easier to get non-ambiguous starting conditions here.

Quoted 4 lines

One possible bug which we are trying to detect is that pause autoneg is off, the values are forced, but -s autoneg is on, it completes, and overwrites the forces values with negotiated values.

I'm trying to cover that on the latter tests indeed

Quoted 33 lines
Quoted 9 lines
Documentation/networking/pause_test_plan.rst new file +7 -0
+A.2 : Half-duplex operation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Pause settings as exposed with the ethtool API only concern full-duplex modes.
+
+Test scenario:
+--------------

Documentation/networking/pause_test_plan.rst line 207

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+
+Set the interface under test in half-duplex mode with::
+
+  ethtool -s <iface> duplex half
+
+Expected behaviour::
+
+ - ethtool <iface>
+
+shows no Pause settings advertised.

Since we are talking about advertisement of pause, i think you actually want

ethtool -A <iface> autoneg on
ethtool -s <iface> duplex half autoneg on

If -s autoneg is off, nothing should be advertised. So we need that turned on. And if -A autoneg is off, no pause values should be advertised, so you need that turned on as well.

Also, since we expect this to trigger an autoneg, we probably want a sleep(2) in there before looking at the results, to ensure autoneg has completed.

Quoted 6 lines

There is also the possibility that the link does not come up, because the link peer does not support half duplex. This is quite common for 1G interfaces. It could also be the local interface does not support 1G half. So maybe

ethtool -s <iface> duplex half speed 100 autoneg on

I think that

ethtool -s <iface> duplex half autoneg on

should be enough, the link should still establish at 100M, I've tested that on a 1G/FULL 100MHalf+Full interface and this is the result we get :)

That said I've tested the following on mcbin, and it seems that acually
nothing in the code currently deals with Half duplex / Pause interaction, and we don't get any EOPNOTSUPP.

So the broader question is, should we reflect the current behaviour or an ideal one ?

And if we reflect the current one, the canonical behaviour is probably the phylink one ?

Quoted 80 lines

Or let it first autoneg unrestricted, look at both the local and LP values, and pick a half duplex link mode both support and set it to do that?

The tests defined so far also don't cover all the possible settings of -A autoneg and -s autoneg. There are combinations:

Link autoneg with pause autoneg
Link autoneg with forced pause
Force link, with forced pause

It would be good to consider what can be tested for these three. Maybe nothing can be tested with forced link, because that it likely to result in no link, when only the local side can be configured.

Documentation/networking/pause_test_plan.rst line 218

Quoted 7 lines
Documentation/networking/pause_test_plan.rst new file +7 -0
+B : Combined devices testing
+============================
+
+Requirements : The interface under test must be connected to a link-partner that
+can be actively configured during the tests. It must at least support full-duplex
+modes, and optionally (but ideally) symmetric and asymmetric flow-control, as
+well as autonegotiation of the Pause parameters.

and forced link parameters.

Documentation/networking/pause_test_plan.rst line 224

Quoted 6 lines
Documentation/networking/pause_test_plan.rst new file +6 -0
+
+B.1 : Autoneg advertising
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Goal: Validate that the *advertised* Pause and AsymDir bits match the configured
+pausemarams.

typo.

Quoted 30 lines
Documentation/networking/pause_test_plan.rst new file +30 -0
+
+The link-level autonegotiation must be enabled::
+
+  ethtool <iface> autoneg on
+
+Pause parameters are set with::
+
+  ethtool -A <iface> rx <val> tx <val> autoneg on
+
+Pause advertising is retrieved with::
+
+  ethtool <iface>
+
+Case 1
+------
+
+Pause parameters : rx **off** tx **off**
+
+Expected advertisement : **None** (Pause = 0, AsymDir = 0)
+
+Case 2
+------
+
+Pause parameters : rx **off** tx **on**
+
+Expected advertisement : **Transmit-only** (Pause = 0, AsymDir = 1)
+
+Case 3
+------
+

Documentation/networking/pause_test_plan.rst line 264

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+Pause parameters : rx **on** tx **off**
+
+Expected advertisement : **Symmetric receive-only** (Pause = 1, Asymdir = 1)
+
+Case 4
+------
+
+Pause parameters : rx **on** tx **on**
+
+Expected advertisement : **Symmetric** (Pause = 1, Asymdir = 0)

We should consider here what happens when the local side only supports symmetric pause. We would expect EOPNOTSUPP, or maybe EINVAL. If ethtool report:

Quoted 3 lines

Supported pause frame use: Symmetric Receive-only

not getting an error for the asymmetric settings would be a bug.

Ack, I think all test cases will need to account for the local device support

Quoted 50 lines
Quoted 5 lines
Documentation/networking/pause_test_plan.rst new file +4 -0
+
+B.2 : Autoneg resolution
+~~~~~~~~~~~~~~~~~~~~~~~~
+

Documentation/networking/pause_test_plan.rst line 278

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+Goal: Validate that the Pause and AsymDir negotiation translates to the right
+TX and RX pause parameters.
+
+The following table, from the 802.3 standard, exposes the autoneg resolution
+result for the advertised pause parameters by each link partner.
+
++-------------+--------------+--------------------------+
+|Local device | Link partner | Pause settings resolution|
++------+------+-------+------+-----------+--------------+
+|Pause | Asym | Pause | Asym | RX        | TX	        |

There is a tab vs space issue here.

Quoted 31 lines

++======+======+=======+======+===========+==============+
+| 0 | 0 | Any | Any | No | No |
++------+------+-------+------+-----------+--------------+
+| 0 | 1 | 0 | Any | No | No |
++------+------+-------+------+-----------+--------------+
+| 0 | 1 | 1 | 0 | No | No |
++------+------+-------+------+-----------+--------------+
+| 0 | 1 | 1 | 1 | No | Yes |
++------+------+-------+------+-----------+--------------+
+| 1 | 0 | 0 | Any | No | No |
++------+------+-------+------+-----------+--------------+
+| 1 | Any | 1 | Any | Yes | Yes |
++------+------+-------+------+-----------+--------------+
+| 1 | 1 | 0 | 0 | No | No |
++------+------+-------+------+-----------+--------------+
+| 1 | 1 | 0 | 1 | Yes | No |
++------+------+-------+------+-----------+--------------+

Documentation/networking/pause_test_plan.rst new file +14 -0
+
+The mapping between the configured pause parameters and advertised modes follow
+the following truth table :
+
++----+----+-------+---------+
+| tx | rx | Pause | AsymDir |
++====+====+=======+=========+
+| 0  | 0  | 0     | 0       |
++----+----+-------+---------+
+| 0  | 1  | 1     | 1       |
++----+----+-------+---------+
+| 1  | 0  | 0     | 1       |
++----+----+-------+---------+
+| 1  | 1  | 1     | 0       |
Quoted 8 lines

Documentation/networking/pause_test_plan.rst line 313

Quoted 4 lines

++----+----+-------+---------+

Documentation/networking/pause_test_plan.rst new file +3 -0
+
+We can boil that down to the following cases to test, keeping the number small
+to avoid dealing with the whole combinatory::

Why not do the whole set of combination? There are 16 combinations, autoneg takes a little over 1 second, so we are probably talking 32 seconds in total. That is a reasonable runtime for a test.

True, I'll describe the whole set then :)

Quoted 78 lines
Quoted 11 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+Case 1
+------
+
+Local device : rx **off**, tx **off**
+Remote device : rx **on** tx **on**
+
+Expected result on local device after autonegotiation completes :
+        rx negotiated **off**
+        tx negotiated **off**
+

...

Quoted 9 lines
Documentation/networking/pause_test_plan.rst new file +9 -0
+Case 7
+------
+
+Local device : rx **on** tx **on**
+Remote device : rx **off** tx **off**
+
+Expected result on local device after autonegotiation completes :
+        rx negotiated **off**
+        tx negotiated **off**

Documentation/networking/pause_test_plan.rst line 407

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+
+Case 8
+------
+
+Local device : rx **on** tx **on**
+Remote device : rx **off** tx **on**
+
+Expected result on local device after autonegotiation completes :
+        rx negotiated **on**
+        tx negotiated **off**

what also needs to be considered here is:

What if the local side only supports symmetric pause? What if the LP only supports symmetric pause?

The expect results should take this into account, that the configuration fails, but that is not a test failure, just a hardware limitation.

Quoted 21 lines
Documentation/networking/pause_test_plan.rst new file +21 -0
+
+B.3 : Pause Autoneg
+~~~~~~~~~~~~~~~~~~~
+
+Goal: Validate that the Pause autonegotiation flag correctly toggles the
+advertised Pause and AsymDir link parameters.
+
+Test scenario:
+--------------
+
+ - Enable pause autoneg and at least rx or tx pause::
+
+        ethtool -A <iface> rx on tx on autoneg on
+
+ - Check the Advertised pause frame use::
+
+        ethtool <iface>
+
+        ...
+        Advertised pause frame use: Symmetric Receive-only
+

Documentation/networking/pause_test_plan.rst line 438

Quoted 10 lines
Documentation/networking/pause_test_plan.rst new file +10 -0
+ - Disable pause autoneg::
+
+        ethtool -A <iface> autoneg off
+
+ - Check the Advertised pause frame use, which must be 'No'::
+
+        ethtool <iface>
+
+        ...
+        Advertised pause frame use: No

Please describe configuration for both sides. This is needed for all the tests when there are two devices involved.

Quoted 2 lines

Also, when local pause advertisement is turned off, check what the link partner is reporting it received from its link partner.

Very well, I'll add this.

Thanks for the extensive feedback Andrew,

Maxime

#27 lore raw
Quoted 7 lines

I think that

ethtool -s <iface> duplex half autoneg on

should be enough, the link should still establish at 100M, I've tested that on a 1G/FULL 100MHalf+Full interface and this is the result we get :)

Nice.

But i still think the test should check the autoneg result and do something sensible if the link does not come up. This probably applies to all cases where we trigger auto neg.

Quoted 6 lines

That said I've tested the following on mcbin, and it seems that acually nothing in the code currently deals with Half duplex / Pause interaction, and we don't get any EOPNOTSUPP.

So the broader question is, should we reflect the current behaviour or an ideal one ?

What 802.3 says. If we come across cases where phylib/phylink is broken, let me know, and i will fix it. But we will leave driver bugs to individual driver developers.

But we also need to consider that for some APIs, we have decided that a configuration can be set now, which does not actually apply in our current conditions, but it will be stored away for when conditions change and it is applicable. The half duplex case could fit that. When the link is currently half duplex, you can configure pause, but you don't expect it to actually change the current behaviour. It only kicks in when the link renegotiates to full duplex sometime in the future. We have to also consider this the other way around. The link is full duplex and pause is configured by the user. Something happens with the LP and the link renegotiates to half duplex. The local end should not throw away the configuration, it simply cannot apply it given the current situation.

Andrew

#28 lore raw
Quoted 8 lines · Andrew Lunn
Quoted 7 lines

I think that

ethtool -s <iface> duplex half autoneg on

should be enough, the link should still establish at 100M, I've tested that on a 1G/FULL 100MHalf+Full interface and this is the result we get :)

Quoted 5 lines

Nice.

But i still think the test should check the autoneg result and do something sensible if the link does not come up. This probably applies to all cases where we trigger auto neg.

Yes indeed, we need some sets of helpers to deal with link management, especially for this kind of ethtool tests, with ways to recover a known working configuration.

Quoted 9 lines
Quoted 7 lines

That said I've tested the following on mcbin, and it seems that acually nothing in the code currently deals with Half duplex / Pause interaction, and we don't get any EOPNOTSUPP.

So the broader question is, should we reflect the current behaviour or an ideal one ?

What 802.3 says.

Ok, this is what I've been using to define the documented cases so far:)

Quoted 4 lines

If we come across cases where phylib/phylink is
broken, let me know, and i will fix it. But we will leave driver bugs to individual driver developers.

Quoted 13 lines

But we also need to consider that for some APIs, we have decided that a configuration can be set now, which does not actually apply in our current conditions, but it will be stored away for when conditions change and it is applicable. The half duplex case could fit that. When the link is currently half duplex, you can configure pause, but you don't expect it to actually change the current behaviour. It only kicks in when the link renegotiates to full duplex sometime in the future. We have to also consider this the other way around. The link is full duplex and pause is configured by the user. Something happens with the LP and the link renegotiates to half duplex. The local end should not throw away the configuration, it simply cannot apply it given the current situation.

True, so the end result is that we must not error out when changing the pause params while the link is in half duplex, but store the user intent.

Maybe an exception is if we only advertise HD modes ? i.e. HW can't do FD, or user forced HD modes ? even then, ethtool will show that we aren't advertising any Pause modes, so maybe that's enough.

OK maybe in the end the best course of action is to leave this discussion here and I followup with :

- Well defined test cases in a machine-readable (or human readable but with much more details) format, including start conditions, a decision tree based on the "supported" fields

- A list of identified corner cases that may be ill-defined (such as this HD topic) that we can openly discuss and potentially followup with code fixes

- Human readable doc for developpers and AI to ingest

Maxime

#29 lore raw
In reply to Andrew Lunn

Hi Andrew,

On 5/29/26 14:59, Andrew Lunn wrote:

(This discussion was a while ago, but this bit of context should be enough)

Quoted 4 lines

But we also need to consider that for some APIs, we have decided that a configuration can be set now, which does not actually apply in our current conditions, but it will be stored away for when conditions change and it is applicable. The half duplex case could fit that. When

Quoted 8 lines

the link is currently half duplex, you can configure pause, but you don't expect it to actually change the current behaviour. It only kicks in when the link renegotiates to full duplex sometime in the future. We have to also consider this the other way around. The link is full duplex and pause is configured by the user. Something happens with the LP and the link renegotiates to half duplex. The local end should not throw away the configuration, it simply cannot apply it given the current situation.

I'm writing the test description for HD with a better formatting, so the HD test wouldn't be about "are we using pause stuff while in HD" as it doesn't make sense, but rather "do we correctly store the pause settings aside for later".

I'm realising that we don't really have an API to report the *true* in-use pause settings. Taking HD as an example :

# ethtool -s eth2 duplex half
[588209.379363] mvpp2 f4000000.ethernet eth2: Link is Up - 100Mbps/Half - flow control off
# ethtool eth2
	[...]
	Supported pause frame use: Symmetric Receive-only
	Advertised pause frame use: Symmetric Receive-only
	Link partner advertised pause frame use: Symmetric Receive-only
# ethtool -a eth2
Autonegotiate:	on
RX:		off
TX:		off
RX negotiated: on
TX negotiated: on

Sure, pause and HD don't make sense, however what I find confusing to some extent is that the only place we have information about the *actual* pause settings is the "link is Up" log in dmesg.

Maybe the problem in the above situation is that whoever advertises half-duplex only modes should also not advertise pause ?

Still, I'm wondering if we should even care about all that actually, HD and Pause are incompatible, and that's it. If you have any thought on this, let me know.

Maxime

#30 lore raw
Quoted 19 lines · Maxime Chevallier

Hi Andrew,

On 5/29/26 14:59, Andrew Lunn wrote:

(This discussion was a while ago, but this bit of context should be enough)

Quoted 4 lines

But we also need to consider that for some APIs, we have decided that a configuration can be set now, which does not actually apply in our current conditions, but it will be stored away for when conditions change and it is applicable. The half duplex case could fit that. When

Quoted 8 lines

the link is currently half duplex, you can configure pause, but you don't expect it to actually change the current behaviour. It only kicks in when the link renegotiates to full duplex sometime in the future. We have to also consider this the other way around. The link is full duplex and pause is configured by the user. Something happens with the LP and the link renegotiates to half duplex. The local end should not throw away the configuration, it simply cannot apply it given the current situation.

Quoted 4 lines

I'm writing the test description for HD with a better formatting, so the HD test wouldn't be about "are we using pause stuff while in HD" as it doesn't make sense, but rather "do we correctly store the pause settings aside for later".

O.K.

Quoted 5 lines

I'm realising that we don't really have an API to report the *true* in-use pause settings. Taking HD as an example :

# ethtool -s eth2 duplex half
Quoted 7 lines
[588209.379363] mvpp2 f4000000.ethernet eth2: Link is Up - 100Mbps/Half - flow control off
# ethtool eth2
	[...]
	Supported pause frame use: Symmetric Receive-only
	Advertised pause frame use: Symmetric Receive-only
	Link partner advertised pause frame use: Symmetric Receive-only

Does it even make sense to advertise this when in HD? But i don't think we need to consider this now. I consider HD low priority, i doubt it is actually used very often. We should concentrate on FD testing.

Quoted 11 lines
# ethtool -a eth2
Autonegotiate:	on
RX:		off
TX:		off
RX negotiated: on
TX negotiated: on

Sure, pause and HD don't make sense, however what I find confusing to some extent is that the only place we have information about the *actual* pause settings is the "link is Up" log in dmesg.

Maybe we should extend ksetting get to return the resolved pause parameters? But i'm not sure how much that actually gives us. Anything using phylink will just ask phylink to fill in the ksettings information, and it seems unlikely phylink gets it wrong. What we are really trying to test is drivers which don't user phylink, those are the ones which are generally broken, and they are not going to implement anything new in ksettings. So i think the test has to look at:

Quoted 2 lines

Advertised pause frame use: Symmetric Receive-only Link partner advertised pause frame use: Symmetric Receive-only

and check these match what we expect.

Andrew

#31 lore raw
Quoted 6 lines

Does it even make sense to advertise this when in HD? But i don't think we need to consider this now. I consider HD low priority, i doubt it is actually used very often. We should concentrate on FD testing.

That's fine by me as well, let's keep it simple, we may revisit that if we really need to.

Quoted 13 lines
Quoted 9 lines
# ethtool -a eth2
Autonegotiate:	on
RX:		off
TX:		off
RX negotiated: on
TX negotiated: on
Quoted 3 lines

Sure, pause and HD don't make sense, however what I find confusing to some extent is that the only place we have information about the *actual* pause settings is the "link is Up" log in dmesg.

Quoted 7 lines

Maybe we should extend ksetting get to return the resolved pause parameters? But i'm not sure how much that actually gives us. Anything using phylink will just ask phylink to fill in the ksettings information, and it seems unlikely phylink gets it wrong. What we are really trying to test is drivers which don't user phylink, those are the ones which are generally broken, and they are not going to implement anything new in ksettings.

Correct yes. If the MAC driver uses phylink and a test fails, it very likely means that the PHY driver is doing shady stuff (and some are/were for pause)

Quoted 7 lines

So i think the test has to look
at:

Quoted 2 lines

Advertised pause frame use: Symmetric Receive-only Link partner advertised pause frame use: Symmetric Receive-only

and check these match what we expect.

All good for me :) thanks for you feedback,

Maxime