Re: [PATCH net-next 1/2] net: lan743x: Add support for get_pauseparam and set_pauseparam
From: Raju Lakkaraju <hidden>
Date: 2022-10-24 07:17:14
Also in:
lkml
Hi Andrew, Thank you for review comments. The 10/21/2022 15:46, Andrew Lunn wrote:
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safequoted
+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.
O.K. I will change.
Andrew-------- Thanks, Raju