Subject: Re: [PATCH] net: dsa: mv88e6xxx: Allow MAC configuration for ports with internal PHY

From: Russell King - ARM Linux admin <[email-masked]>
Date: Mon, 22 Jun 2020 19:52:41 +0100

On Mon, Jun 22, 2020 at 08:34:43PM +0200, Daniel Mack wrote:
> Ports with internal PHYs that are not in 'fixed-link' mode are currently
> only set up once at startup with a static config. Attempts to change the
> link speed or duplex settings are currently prevented by an early bail
> in mv88e6xxx_mac_config(). As the default config forces the speed to
> 1000M, setups with reduced link speed on such ports are unsupported.
> 
> Change that, and allow the configuration of all ports with the passed
> settings.
> 
> Signed-off-by: Daniel Mack <[email-masked]>
> ---
> Russell,
> 
> This changes the behaviour implemented in c9a2356f35409a ("net:
> dsa: mv88e6xxx: add PHYLINK support"). Do you recall why your code
> didn't touch the MLO_AN_PHY mode links in the first place?

The reason is that's how it was before - each port with a PHY has
PHY polling enabled, which means that the PPU (phy polling unit)
reads the PHY state and updates the port with that.  The port
follows whatever the state of the PHY, and that does not require
phylink to program the port.

I believe it to be incorrect to force ports where the PPU is
enabled, and since Marvell DSA switches have always had the PPU
enabled, it is incorrect to force these ports.

Note that there was no change in behaviour - the code was originally
doing this prior to phylink:

static void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port,
                                  struct phy_device *phydev)
{
        struct mv88e6xxx_chip *chip = ds->priv;
        int err;

        if (!phy_is_pseudo_fixed_link(phydev))
                return;

        mutex_lock(&chip->reg_lock);
        err = mv88e6xxx_port_setup_mac(chip, port, phydev->link, phydev->speed,
                                       phydev->duplex, phydev->interface);
        mutex_unlock(&chip->reg_lock);

        if (err && err != -EOPNOTSUPP)
                dev_err(ds->dev, "p%d: failed to configure MAC\n", port);
}

So the internal PHYs (phys which are not a pseudo fixed-link) were
being ignored before my code.

As is normal for me, when ever I convert something from one thing to
another, I try to preserve as much of the original behaviour as
possible, and with regard to the issue that you raise, I preserved
the behaviour for the internal PHYs.

Hence, I believe your patch to be incorrect.

What problem are you seeing, and with which switch?

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!