Re: [PATCH net-next 1/2] net: lan743x: Add support for get_pauseparam and set_pauseparam

From: Andrew Lunn
Date: Fri Oct 21 2022 - 10:26:24 EST


> +static int lan743x_set_pauseparam(struct net_device *dev,
> + struct ethtool_pauseparam *pause)
> +{
> + struct lan743x_adapter *adapter = netdev_priv(dev);
> + struct phy_device *phydev = dev->phydev;
> + struct lan743x_phy *phy = &adapter->phy;
> +
> + if (!phydev)
> + return -ENODEV;
> +
> + if (!phy_validate_pause(phydev, pause))
> + return -EINVAL;
> +
> + phy->fc_request_control = 0;
> + if (pause->rx_pause)
> + phy->fc_request_control |= FLOW_CTRL_RX;
> +
> + if (pause->tx_pause)
> + phy->fc_request_control |= FLOW_CTRL_TX;
> +
> + phy->fc_autoneg = pause->autoneg;
> +
> + phy_set_asym_pause(phydev, pause->rx_pause, pause->tx_pause);
> +
> + if (pause->autoneg == AUTONEG_DISABLE)
> + lan743x_mac_flow_ctrl_set_enables(adapter, pause->tx_pause,
> + pause->rx_pause);

pause is not too well defined. But i think phy_set_asym_pause() should
be in an else clause. If pause autoneg is off, you directly set it in
the MAC and ignore what is negotiated. If it is enabled, you
negotiate. As far as i understand, you don't modify your negotiation
when pause autoneg is off.

Andrew