Thread (18 messages) flat view 18 messages, 6 authors, 2021-11-10

Re: [PATCH net v2] net: phy: phy_ethtool_ksettings_set: Don't discard phy_start_aneg's return

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: 2021-11-08 19:36:01

On 08.11.2021 20:02, Benedikt Spranger wrote:
On Mon, 8 Nov 2021 19:01:23 +0100
Heiner Kallweit [off-list ref] wrote:
quoted
If we would like to support PHY's that don't support all MDI modes
then supposedly this would require to add ETHTOOL_LINK_MODE bits for
the MDI modes. Then we could use the generic mechanism to check the
bits in the "supported" bitmap.
The things are even worse:
The chip supports only auto-MDIX at Gigabit and force MDI and
The Gigabit part seems to be normal. Gigabit supports neither
forced mode nor forced MDI settings.
auto-MDIX in 10/100 modes. No force MDIX at all.

A validation callback from phy_ethtool_ksettings_set() before
restarting the PHY seems reasonable for me. Something like:

	/* Verify the settings we care about. */
	if (autoneg != AUTONEG_ENABLE && autoneg != AUTONEG_DISABLE)
	        return -EINVAL;

        if (autoneg == AUTONEG_ENABLE && linkmode_empty(advertising))
	        return -EINVAL;

        if (autoneg == AUTONEG_DISABLE &&
	    ((speed != SPEED_1000 &&
	      speed != SPEED_100 &&
              speed != SPEED_10) ||
             (duplex != DUPLEX_HALF &&
              duplex != DUPLEX_FULL)))
                return -EINVAL;

	if (phydev->validate_cmd && phydev->validate_cmd(cmd))
		return -EINVAL;

Thanks
    Benedikt Spranger
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help