Message ID | 20231218135032.27209-1-quic_snehshah@quicinc.com |
---|---|
State | Superseded |
Headers | show |
Series | [net-next] net: stmmac: Fix ethool link settings ops for integrated PCS | expand |
> struct stmmac_priv *priv = netdev_priv(dev); > >- if (priv->hw->pcs & STMMAC_PCS_RGMII || >- priv->hw->pcs & STMMAC_PCS_SGMII) { >+ if (!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS) && [Suman] A personal preference here, I think the code will be more readable if we handle the !if condition @ the beginning. Something like, if (priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS || !(priv->hw->pcs & STMMAC_PCS_RGMII) || !(priv->hw->pcs & STMMAC_PCS_RGMII)) return phylink_ethtool_ksettings_get(priv->phylink, cmd); and keep the rest of the code without any check. But it is up-to you. >+ (priv->hw->pcs & STMMAC_PCS_RGMII || >+ priv->hw->pcs & STMMAC_PCS_SGMII)) { > struct rgmii_adv adv; > u32 supported, advertising, lp_advertising; > >@@ -397,8 +398,9 @@ stmmac_ethtool_set_link_ksettings(struct net_device >*dev, { > struct stmmac_priv *priv = netdev_priv(dev); > >- if (priv->hw->pcs & STMMAC_PCS_RGMII || >- priv->hw->pcs & STMMAC_PCS_SGMII) { >+ if (!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS) && >+ (priv->hw->pcs & STMMAC_PCS_RGMII || >+ priv->hw->pcs & STMMAC_PCS_SGMII)) { > /* Only support ANE */ > if (cmd->base.autoneg != AUTONEG_ENABLE) > return -EINVAL; >-- >2.17.1 >
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index f628411ae4ae..e3ba4cd47b8d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -311,8 +311,9 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev, { struct stmmac_priv *priv = netdev_priv(dev); - if (priv->hw->pcs & STMMAC_PCS_RGMII || - priv->hw->pcs & STMMAC_PCS_SGMII) { + if (!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS) && + (priv->hw->pcs & STMMAC_PCS_RGMII || + priv->hw->pcs & STMMAC_PCS_SGMII)) { struct rgmii_adv adv; u32 supported, advertising, lp_advertising; @@ -397,8 +398,9 @@ stmmac_ethtool_set_link_ksettings(struct net_device *dev, { struct stmmac_priv *priv = netdev_priv(dev); - if (priv->hw->pcs & STMMAC_PCS_RGMII || - priv->hw->pcs & STMMAC_PCS_SGMII) { + if (!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS) && + (priv->hw->pcs & STMMAC_PCS_RGMII || + priv->hw->pcs & STMMAC_PCS_SGMII)) { /* Only support ANE */ if (cmd->base.autoneg != AUTONEG_ENABLE) return -EINVAL;
Currently get/set_link_ksettings ethtool ops are dependent on PCS. When PCS is integrated in MAC, it will not have separate link config. Bypass cofiguring and checking PCS link config for integrated PCS. Signed-off-by: Sneh Shah <quic_snehshah@quicinc.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)