Re: [PATCH net-next v2 7/9] net: phy: introduce ethtool_phy_ops to get and set phy configuration

From: Andrew Lunn
Date: Fri Oct 04 2024 - 16:23:25 EST


> +int phy_set_config(struct phy_device *phydev,
> + const struct phy_device_config *phy_cfg,
> + struct netlink_ext_ack *extack)
> +{
> + bool isolate_change;
> + int ret;
> +
> + mutex_lock(&phydev->lock);
> + isolate_change = (phy_cfg->isolate != phydev->isolated);
> + mutex_unlock(&phydev->lock);
> +
> + if (!isolate_change)
> + return 0;
> +
> + ret = phy_isolate(phydev, phy_cfg->isolate);
> + if (ret)
> + NL_SET_ERR_MSG(extack, "Error while configuring PHY isolation");

This seems overly simplistic to me. Don't you need to iterate over all
the other PHYs attached to this MAC and ensure they are isolated? Only
one can be unisolated at once.

It is also not clear to me how this is going to work from a MAC
perspective. Does the MAC call phy_connect() multiple times? How does
ndev->phydev work? Who is responsible for the initial configuration,
such that all but one PHY is isolated?

I assume you have a real board that needs this. So i think we need to
see a bit more of the complete solution, including the MAC changes and
the device tree for the board, so we can see the big picture.

Andrew