Re: [PATCH net 1/6] net: stmmac: selftests: Check multiple MMC counters

From: Maxime Chevallier

Date: Wed Aug 26 2026 - 16:27:47 EST


Hi,

On 8/26/26 19:14, Andrew Lunn wrote:
> On Wed, Aug 26, 2026 at 04:04:53PM +0200, Maxime Chevallier wrote:
>> The MMC counters report MAC statistics. Multiple counters can be
>> enabled when the IP is integrated, however there's no way to know
>> exactly which ones. Un-implemented counters seem to report 0.
>>
>> It was found that on StarFive JH7110 and Amlogic SM1, the counter that's
>> used by the selftest (mmc_tx_framecount_g) isn't implemented, triggering
>> an MMC selftest failure.
>>
>> Both the above SoCs seem to implement mmc_rx_framecount_gb, let's use
>> this counter as well for MMC counter validation.
>>
>> Note that this doesn't guarantee that we won't encounter the same issue
>> again if another IP implements yet another set of counters that don't
>> include that new one.
>>
>> If the game of whack-a-mole with implemented counters becomes too hard to
>> maintain, we may simply consider removing the MMC selftest entirely.
>>
>> Fixes: 091810dbded9 ("net: stmmac: Introduce selftests support")
>> Signed-off-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
>
> Seems sensible.
>
> If more moles need whacking, we could consider the value of 0 as
> success.

We'd need to see what the values are on platforms that don't implement MMC
counters at all, what the registers read in that case.

Another approach is to bruteforce the selftest and look at all the MMC counters,
passing if any of them changes during the test.

>
> Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
>
> Andrew

Thank you :)

Maxime