Commit 639cfa9e authored by Philippe Reynes's avatar Philippe Reynes Committed by David S. Miller

net: ethernet: broadcom: bcm63xx: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.
Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 625eb866
...@@ -1442,39 +1442,40 @@ static int bcm_enet_nway_reset(struct net_device *dev) ...@@ -1442,39 +1442,40 @@ static int bcm_enet_nway_reset(struct net_device *dev)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static int bcm_enet_get_settings(struct net_device *dev, static int bcm_enet_get_link_ksettings(struct net_device *dev,
struct ethtool_cmd *cmd) struct ethtool_link_ksettings *cmd)
{ {
struct bcm_enet_priv *priv; struct bcm_enet_priv *priv;
u32 supported, advertising;
priv = netdev_priv(dev); priv = netdev_priv(dev);
cmd->maxrxpkt = 0;
cmd->maxtxpkt = 0;
if (priv->has_phy) { if (priv->has_phy) {
if (!dev->phydev) if (!dev->phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_gset(dev->phydev, cmd); return phy_ethtool_ksettings_get(dev->phydev, cmd);
} else { } else {
cmd->autoneg = 0; cmd->base.autoneg = 0;
ethtool_cmd_speed_set(cmd, ((priv->force_speed_100) cmd->base.speed = (priv->force_speed_100) ?
? SPEED_100 : SPEED_10)); SPEED_100 : SPEED_10;
cmd->duplex = (priv->force_duplex_full) ? cmd->base.duplex = (priv->force_duplex_full) ?
DUPLEX_FULL : DUPLEX_HALF; DUPLEX_FULL : DUPLEX_HALF;
cmd->supported = ADVERTISED_10baseT_Half | supported = ADVERTISED_10baseT_Half |
ADVERTISED_10baseT_Full | ADVERTISED_10baseT_Full |
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Half |
ADVERTISED_100baseT_Full; ADVERTISED_100baseT_Full;
cmd->advertising = 0; advertising = 0;
cmd->port = PORT_MII; ethtool_convert_legacy_u32_to_link_mode(
cmd->transceiver = XCVR_EXTERNAL; cmd->link_modes.supported, supported);
ethtool_convert_legacy_u32_to_link_mode(
cmd->link_modes.advertising, advertising);
cmd->base.port = PORT_MII;
} }
return 0; return 0;
} }
static int bcm_enet_set_settings(struct net_device *dev, static int bcm_enet_set_link_ksettings(struct net_device *dev,
struct ethtool_cmd *cmd) const struct ethtool_link_ksettings *cmd)
{ {
struct bcm_enet_priv *priv; struct bcm_enet_priv *priv;
...@@ -1482,16 +1483,19 @@ static int bcm_enet_set_settings(struct net_device *dev, ...@@ -1482,16 +1483,19 @@ static int bcm_enet_set_settings(struct net_device *dev,
if (priv->has_phy) { if (priv->has_phy) {
if (!dev->phydev) if (!dev->phydev)
return -ENODEV; return -ENODEV;
return phy_ethtool_sset(dev->phydev, cmd); return phy_ethtool_ksettings_set(dev->phydev, cmd);
} else { } else {
if (cmd->autoneg || if (cmd->base.autoneg ||
(cmd->speed != SPEED_100 && cmd->speed != SPEED_10) || (cmd->base.speed != SPEED_100 &&
cmd->port != PORT_MII) cmd->base.speed != SPEED_10) ||
cmd->base.port != PORT_MII)
return -EINVAL; return -EINVAL;
priv->force_speed_100 = (cmd->speed == SPEED_100) ? 1 : 0; priv->force_speed_100 =
priv->force_duplex_full = (cmd->duplex == DUPLEX_FULL) ? 1 : 0; (cmd->base.speed == SPEED_100) ? 1 : 0;
priv->force_duplex_full =
(cmd->base.duplex == DUPLEX_FULL) ? 1 : 0;
if (netif_running(dev)) if (netif_running(dev))
bcm_enet_adjust_link(dev); bcm_enet_adjust_link(dev);
...@@ -1585,14 +1589,14 @@ static const struct ethtool_ops bcm_enet_ethtool_ops = { ...@@ -1585,14 +1589,14 @@ static const struct ethtool_ops bcm_enet_ethtool_ops = {
.get_sset_count = bcm_enet_get_sset_count, .get_sset_count = bcm_enet_get_sset_count,
.get_ethtool_stats = bcm_enet_get_ethtool_stats, .get_ethtool_stats = bcm_enet_get_ethtool_stats,
.nway_reset = bcm_enet_nway_reset, .nway_reset = bcm_enet_nway_reset,
.get_settings = bcm_enet_get_settings,
.set_settings = bcm_enet_set_settings,
.get_drvinfo = bcm_enet_get_drvinfo, .get_drvinfo = bcm_enet_get_drvinfo,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
.get_ringparam = bcm_enet_get_ringparam, .get_ringparam = bcm_enet_get_ringparam,
.set_ringparam = bcm_enet_set_ringparam, .set_ringparam = bcm_enet_set_ringparam,
.get_pauseparam = bcm_enet_get_pauseparam, .get_pauseparam = bcm_enet_get_pauseparam,
.set_pauseparam = bcm_enet_set_pauseparam, .set_pauseparam = bcm_enet_set_pauseparam,
.get_link_ksettings = bcm_enet_get_link_ksettings,
.set_link_ksettings = bcm_enet_set_link_ksettings,
}; };
static int bcm_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int bcm_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment