Re: [PATCH net-next v3 2/4] amd-xgbe: add ethtool phy selftest
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: 2025-10-21 09:32:19
On 20/10/2025 21:07, Andrew Lunn wrote:
On Mon, Oct 20, 2025 at 06:19:55PM +0200, Maxime Chevallier wrote:quoted
Hi Raju, On 20/10/2025 17:22, Raju Rangoju wrote:quoted
Adds support for ethtool PHY loopback selftest. It uses genphy_loopback function, which use BMCR loopback bit to enable or disable loopback. Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>This all looks a lot like the stmmac selftests, hopefully one day we can extract that logic into a more generic selftest framework for all drivers to use.https://elixir.bootlin.com/linux/v6.17.3/source/net/core/selftests.c#L441 Sorry, not looked at the patch to see if this is relevant for this driver. But we do have a generic selftest framework... Andrew
Ah ! And this also looks like this driver code. It seems to me that the main diffence that the amd-xgbe selftest brings is the ability to fallback to MAC-side loopback should PHY loopback fails, so they don't 1:1 map to these, but we could consider extending the existing selftests. Besides that it seems that the generic selftest are more efficient wrt how they deal with PHY loopback, as they don't re-configure it for each selftest. I don't necessarly think this series should be reworked but this is starting to be a lot of code duplication. Raju, maybe you can re-use at least the generic packet generation functions (i.e net_tst_get_skb() ) ? Maxime