Message ID | 20240529-gemini-phylib-fixes-v4-3-16487ca4c2fe@linaro.org (mailing list archive) |
---|---|
State | Accepted |
Commit | dbdb0918da671bde4e9c4c3e974a5e15358dfa5c |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: ethernet: cortina: Use phylib for RX and TX pause | expand |
On Wed, May 29, 2024 at 04:00:02PM +0200, Linus Walleij wrote: > The Cortina Gemini ethernet can very well set up TX or RX > pausing, so add this functionality to the driver in a > .set_pauseparam() callback. Essentially just call down to > phylib and let phylib deal with this, .adjust_link() > will respect the setting from phylib. > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index b33f9798471e..318c521b135b 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -2111,6 +2111,19 @@ static void gmac_get_pauseparam(struct net_device *netdev, pparam->autoneg = true; } +static int gmac_set_pauseparam(struct net_device *netdev, + struct ethtool_pauseparam *pparam) +{ + struct phy_device *phydev = netdev->phydev; + + if (!pparam->autoneg) + return -EOPNOTSUPP; + + phy_set_asym_pause(phydev, pparam->rx_pause, pparam->tx_pause); + + return 0; +} + static void gmac_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *rp, struct kernel_ethtool_ringparam *kernel_rp, @@ -2231,6 +2244,7 @@ static const struct ethtool_ops gmac_351x_ethtool_ops = { .set_link_ksettings = gmac_set_ksettings, .nway_reset = gmac_nway_reset, .get_pauseparam = gmac_get_pauseparam, + .set_pauseparam = gmac_set_pauseparam, .get_ringparam = gmac_get_ringparam, .set_ringparam = gmac_set_ringparam, .get_coalesce = gmac_get_coalesce,
The Cortina Gemini ethernet can very well set up TX or RX pausing, so add this functionality to the driver in a .set_pauseparam() callback. Essentially just call down to phylib and let phylib deal with this, .adjust_link() will respect the setting from phylib. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/net/ethernet/cortina/gemini.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)