Hi Jakub,

On Fri, 11 Jul 2025 16:58:13 -0700
Jakub Kicinski <[email protected]> wrote:

> On Thu, 10 Jul 2025 08:22:47 +0200 Maxime Chevallier wrote:
> > +set -o pipefail
> > +
> > +# Check simple PHY addition and listing
> > +
> > +# Parent == 0 means that the PHY's parent is the netdev
> > +PHY_DFS=$(make_phydev_on_netdev "$NSIM_ID" 0)
> > +
> > +# First PHY gets index 1
> > +index=$(ethtool --show-phys "$NSIM_NETDEV" | grep "PHY index" | cut -d ' ' 
> > -f 3)
> > +check $? "$index" "1"
> > +
> > +# Insert a second PHY, same parent. It gets index 2.
> > +PHY2_DFS=$(make_phydev_on_netdev "$NSIM_ID" 0)
> > +
> > +# Create another netdev
> > +NSIM_ID2=$((RANDOM % 1024))
> > +NSIM_NETDEV_2=$(make_netdev_from_id "$NSIM_ID2")
> > +
> > +PHY3_DFS=$(make_phydev_on_netdev "$NSIM_ID2" 0);
> > +
> > +# Check unfiltered PHY Dump
> > +n_phy=$(ethtool --show-phys '*' | grep -c "PHY index")
> > +check $? "$n_phy" "3"
> > +
> > +# Check filtered Dump
> > +n_phy=$(ethtool --show-phys "$NSIM_NETDEV" | grep -c "PHY index")
> > +check $? "$n_phy" "2"  
> 
> Not a very strong preference, but I wonder if we should wire up the
> paths to the Python lib for drivers/net/netdevsim and switch to Python?
> It does the setup and cleanup and it gives us direct YNL access.
> More convenient for testing new stuff than jugging ethtool builds..
> But I guess you could argue that testing the CLI is good in itself.

That's totally OK for me, looking at selftests/drivers/net/netdevsim/
it was unclear to me what was the proper way forward.

My python skills are not the best, I'm basically writing C using python
syntax, but I can certainly give that a shot.

Thanks,

Maxime

Reply via email to