On 9/2/2018 10:06 AM, Andrew Lunn wrote:
ethtool can be used to enable/disable pause. Add a helper to configure the PHY when Pause is supported.
One comment, see below: [snip]
+/** + * phy_set_pause - Configure Pause + * @phydev: target phy_device struct + * @rx: Receiver Pause is supported + * @autoneg: Auto neg should be used + * + * Description: Configure advertised Pause support depending on if + * receiver pause and pause auto neg is supported. Generally called + * from the set_pauseparam .ndo. + */ +void phy_set_pause(struct phy_device *phydev, bool rx, bool autoneg) +{ + phydev->supported &= ~SUPPORTED_Pause; + + if (rx || autoneg) + phydev->supported |= SUPPORTED_Pause; + + phydev->advertising = phydev->supported;
This is the logic from FEC, but I think the one from bcm63xx_enet.c is actually the correct one, you can enable symmetric pause support if it is enabled for both the RX and TX paths here.
Similar comment to patch 9, I would name this phy_set_sym_pause() for clarity.
-- Florian