Message ID | ca1ed820-8da4-fad0-7335-ab92501e95a0@intel.com |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | [ftgmac100:] Return link speed and duplex settings for the NCSI channel | expand |
From: Johnathan Mantey <johnathanx.mantey@intel.com> Date: Mon, 27 Jan 2020 11:17:50 -0800 > @@ -1218,10 +1218,30 @@ static int ftgmac100_set_pauseparam(struct > net_device *netdev, Please fix your email client so that the patch is not mangled like this. > return 0; > } > > +int ftgmac100_ethtool_get_link_ksettings(struct net_device *netdev, > + struct ethtool_link_ksettings *cmd) > +{ > + struct phy_device *phydev = netdev->phydev; > + struct ftgmac100 *priv = netdev_priv(netdev); > + int retval = 0; > + > + if (phydev) { > + phy_ethtool_ksettings_get(phydev, cmd); This should be retval = phy_ethtool_ksettings_get() otherwise error indications will not propagate.
On 1/29/20 2:44 AM, David Miller wrote: > From: Johnathan Mantey <johnathanx.mantey@intel.com> > Date: Mon, 27 Jan 2020 11:17:50 -0800 > >> @@ -1218,10 +1218,30 @@ static int ftgmac100_set_pauseparam(struct >> net_device *netdev, > > Please fix your email client so that the patch is not mangled like this. > >> return 0; >> } >> >> +int ftgmac100_ethtool_get_link_ksettings(struct net_device *netdev, >> + struct ethtool_link_ksettings *cmd) >> +{ >> + struct phy_device *phydev = netdev->phydev; >> + struct ftgmac100 *priv = netdev_priv(netdev); >> + int retval = 0; >> + >> + if (phydev) { >> + phy_ethtool_ksettings_get(phydev, cmd); > > This should be retval = phy_ethtool_ksettings_get() otherwise error indications > will not propagate. > This can't be done. The phy_ethtool_ksettings_get() is a void returning function. Trying to capture retval results in a compile error.
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 8ed85037f021..a53878eecfc8 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1218,10 +1218,30 @@ static int ftgmac100_set_pauseparam(struct net_device *netdev, return 0; } +int ftgmac100_ethtool_get_link_ksettings(struct net_device *netdev, + struct ethtool_link_ksettings *cmd) +{ + struct phy_device *phydev = netdev->phydev; + struct ftgmac100 *priv = netdev_priv(netdev); + int retval = 0; + + if (phydev) { + phy_ethtool_ksettings_get(phydev, cmd); + } else if (priv->use_ncsi) { + cmd->base.speed = priv->cur_speed; + cmd->base.duplex = priv->cur_duplex; + cmd->base.autoneg = 0; + } else { + retval = -ENODEV; + } + + return retval; +} + static const struct ethtool_ops ftgmac100_ethtool_ops = { .get_drvinfo = ftgmac100_get_drvinfo, .get_link = ethtool_op_get_link, - .get_link_ksettings = phy_ethtool_get_link_ksettings, + .get_link_ksettings = ftgmac100_ethtool_get_link_ksettings, .set_link_ksettings = phy_ethtool_set_link_ksettings, .nway_reset = phy_ethtool_nway_reset,