Message ID | E1j3ij8-0006Ee-Lk@rmk-PC.armlinux.org.uk |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | phylib: add hardware resolved pause mode support for marvell PHYs | expand |
On Mon, Feb 17, 2020 at 03:54:30PM +0000, Russell King wrote: > Allow phylib drivers to pass the hardware-resolved pause state to MAC > drivers, rather than using the software-based pause resolution code. Hi Russell What i find missing here is an explanation of why hardware resolved pause is better than software. We know what the software based method is, and it will be consistent across all hardware. Can we say that about the hardware? Thanks Andrew
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 2a973265de80..6e1b50defd62 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2414,6 +2414,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 80f8b2158271..fda23d95e640 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -422,6 +422,15 @@ struct phy_device { int pause; int asym_pause; + /* + * 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);
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> --- drivers/net/phy/phy_device.c | 6 ++++++ include/linux/phy.h | 9 +++++++++ 2 files changed, 15 insertions(+)