Skip to content

Commit 8040ebb

Browse files
committed
net: cadence: macb: add ethtool EEE support
Implement ethtool get_eee and set_eee operations for the Cadence GEM MAC, delegating to phylink for PHY-level EEE negotiation state. The MAC-level LPI control (TXLPIEN) is not manipulated directly in the ethtool ops. Instead, phylink_ethtool_set_eee() updates the PHY's EEE advertisement, which triggers link renegotiation. The mac_link_up callback then checks the negotiated EEE state and enables LPI accordingly. Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
1 parent e66ae80 commit 8040ebb

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3595,6 +3595,32 @@ static int macb_set_ringparam(struct net_device *netdev,
35953595
return 0;
35963596
}
35973597

3598+
static int macb_get_eee(struct net_device *ndev, struct ethtool_keee *edata)
3599+
{
3600+
struct macb *bp = netdev_priv(ndev);
3601+
3602+
if (!(bp->caps & MACB_CAPS_EEE))
3603+
return -EOPNOTSUPP;
3604+
3605+
return phylink_ethtool_get_eee(bp->phylink, edata);
3606+
}
3607+
3608+
static int macb_set_eee(struct net_device *ndev, struct ethtool_keee *edata)
3609+
{
3610+
struct macb *bp = netdev_priv(ndev);
3611+
3612+
if (!(bp->caps & MACB_CAPS_EEE))
3613+
return -EOPNOTSUPP;
3614+
3615+
/*
3616+
* Don't directly control TXLPIEN here. phylink_ethtool_set_eee()
3617+
* updates the PHY, which will bounce the link if tx_lpi_enabled
3618+
* changes. That triggers mac_link_down/mac_link_up where we
3619+
* enable/disable TXLPIEN based on the negotiated state.
3620+
*/
3621+
return phylink_ethtool_set_eee(bp->phylink, edata);
3622+
}
3623+
35983624
#ifdef CONFIG_MACB_USE_HWSTAMP
35993625
static unsigned int gem_get_tsu_rate(struct macb *bp)
36003626
{
@@ -4010,6 +4036,8 @@ static const struct ethtool_ops gem_ethtool_ops = {
40104036
.set_ringparam = macb_set_ringparam,
40114037
.get_rxnfc = gem_get_rxnfc,
40124038
.set_rxnfc = gem_set_rxnfc,
4039+
.get_eee = macb_get_eee,
4040+
.set_eee = macb_set_eee,
40134041
.nway_reset = phy_ethtool_nway_reset,
40144042
};
40154043

0 commit comments

Comments
 (0)