Timur Tabi wrote:
+static void emac_get_pauseparam(struct net_device *netdev,
+                               struct ethtool_pauseparam *pause)
+{
+       struct phy_device *phydev = netdev->phydev;
+
+       if (phydev) {
+               if (phydev->autoneg)
+                       pause->autoneg = 1;
+               if (phydev->pause)
+                       pause->rx_pause = 1;
+               if (phydev->pause != phydev->asym_pause)
+                       pause->tx_pause = 1;
+       }
+}

I finally figured out why this code was bothering me.

This function works, as long as I do NOT implement set_pauseparam. That's because the driver always matches the pause frame support in the MAC with whatever the PHY is doing. Since the MAC and PHY are always in sync, I can use the PHY settings for get_pauseparam.

However, technically this is not correct. get_pauseparam is supposed to return the setting of the MAC, not the PHY. If I also implement set_pauseparam, which can force the MAC to ignore the PHY and enable/disable pause frames arbitrarily, then the above function is wrong.

Do I finally understand this correctly?

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

Reply via email to