Subject: Re: [PATCH net-next 00/11] net: stmmac: Selftests

From: Andrew Lunn <[email-masked]>
Date: Wed, 8 May 2019 21:50:11 +0200

On Wed, May 08, 2019 at 09:51:00AM +0200, Jose Abreu wrote:
> [ Submitting with net-next closed for proper review and testing. ]
> 
> This introduces selftests support in stmmac driver. We add 4 basic sanity
> checks and MAC loopback support for all cores within the driver. This way
> more tests can easily be added in the future and can be run in virtually
> any MAC/GMAC/QoS/XGMAC platform.
> 
> Having this we can find regressions and missing features in the driver
> while at the same time we can check if the IP is correctly working.
> 
> We have been using this for some time now and I do have more tests to
> submit in the feature. My experience is that although writing the tests
> adds more development time, the gain results are obvious.
> 
> I let this feature optional within the driver under a Kconfig option.
> 
> For this series the output result will be something like this
> (e.g. for dwmac1000):
> ----
> # ethtool -t eth0
> The test result is PASS
> The test extra info:
> 1. MAC Loopback                 0
> 2. PHY Loopback                 -95
> 3. MMC Counters                 0
> 4. EEE                          -95
> 5. Hash Filter MC               0
> 6. Perfect Filter UC            0
> 7. Flow Control                 0

Hi Jose

The man page says:

       -t --test
              Executes adapter selftest on the specified network
              device. Possible test modes are:

           offline
                  Perform full set of tests, possibly interrupting
                  normal operation during the tests,

           online Perform limited set of tests, not interrupting
                  normal operation,

           external_lb
                  Perform full set of tests, as for offline, and
                  additionally an external-loopback test.

The normal operation is interrupted by the tests you carry out
here. But i don't see any code looking for ETH_TEST_FL_OFFLINE

> (Error code -95 means EOPNOTSUPP in current HW).

How deep do you have to go before you know about EOPNOTSUPP?  It would
be better to not return the string and result at all. Or patch ethtool
to call strerror(3).

   Andrew