summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2020-01-03 23:13:28 +0000
committerRussell King <rmk+kernel@armlinux.org.uk>2021-02-15 13:22:09 +0000
commitd9f17bd829d7c2dc722b907ca13570dd3717d8e8 (patch)
tree85bfec110486a0f54fc38a42a8441d4de7f287c9
parent94d5b10cac49e61ed32de6a33ee40b95aeb516ce (diff)
net: phy: add resolved pause support
Allow phylib drivers to pass the hardware-resolved pause state to MAC drivers, rather than using the software-based pause resolution code. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/net/phy/phy_device.c6
-rw-r--r--include/linux/phy.h9
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 3f816d5e2668..c839a93ba6a2 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2718,6 +2718,12 @@ void phy_get_pause(struct phy_device *phydev, bool *tx_pause, bool *rx_pause)
return;
}
+ if (phydev->resolved_pause_valid) {
+ *tx_pause = phydev->resolved_tx_pause;
+ *rx_pause = phydev->resolved_rx_pause;
+ return;
+ }
+
return linkmode_resolve_pause(phydev->advertising,
phydev->lp_advertising,
tx_pause, rx_pause);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 130e633f9ae3..282e95336c35 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -583,6 +583,15 @@ struct phy_device {
u8 master_slave_set;
u8 master_slave_state;
+ /*
+ * private to phylib: the resolved pause state - only valid if
+ * resolved_pause_valid is true. only phy drivers and phylib
+ * should touch this.
+ */
+ bool resolved_pause_valid;
+ bool resolved_tx_pause;
+ bool resolved_rx_pause;
+
/* Union of PHY and Attached devices' supported link modes */
/* See ethtool.h for more info */
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);