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

net: 3com: typhoon: 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>
Reviewed-by: default avatarDavid Dillow <dave@thedillows.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1913540a
...@@ -996,28 +996,30 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) ...@@ -996,28 +996,30 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
} }
static int static int
typhoon_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) typhoon_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *cmd)
{ {
struct typhoon *tp = netdev_priv(dev); struct typhoon *tp = netdev_priv(dev);
u32 supported, advertising;
cmd->supported = SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | supported = SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
SUPPORTED_Autoneg; SUPPORTED_Autoneg;
switch (tp->xcvr_select) { switch (tp->xcvr_select) {
case TYPHOON_XCVR_10HALF: case TYPHOON_XCVR_10HALF:
cmd->advertising = ADVERTISED_10baseT_Half; advertising = ADVERTISED_10baseT_Half;
break; break;
case TYPHOON_XCVR_10FULL: case TYPHOON_XCVR_10FULL:
cmd->advertising = ADVERTISED_10baseT_Full; advertising = ADVERTISED_10baseT_Full;
break; break;
case TYPHOON_XCVR_100HALF: case TYPHOON_XCVR_100HALF:
cmd->advertising = ADVERTISED_100baseT_Half; advertising = ADVERTISED_100baseT_Half;
break; break;
case TYPHOON_XCVR_100FULL: case TYPHOON_XCVR_100FULL:
cmd->advertising = ADVERTISED_100baseT_Full; advertising = ADVERTISED_100baseT_Full;
break; break;
case TYPHOON_XCVR_AUTONEG: case TYPHOON_XCVR_AUTONEG:
cmd->advertising = ADVERTISED_10baseT_Half | advertising = ADVERTISED_10baseT_Half |
ADVERTISED_10baseT_Full | ADVERTISED_10baseT_Full |
ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Half |
ADVERTISED_100baseT_Full | ADVERTISED_100baseT_Full |
...@@ -1026,54 +1028,52 @@ typhoon_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -1026,54 +1028,52 @@ typhoon_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
} }
if(tp->capabilities & TYPHOON_FIBER) { if(tp->capabilities & TYPHOON_FIBER) {
cmd->supported |= SUPPORTED_FIBRE; supported |= SUPPORTED_FIBRE;
cmd->advertising |= ADVERTISED_FIBRE; advertising |= ADVERTISED_FIBRE;
cmd->port = PORT_FIBRE; cmd->base.port = PORT_FIBRE;
} else { } else {
cmd->supported |= SUPPORTED_10baseT_Half | supported |= SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Full |
SUPPORTED_TP; SUPPORTED_TP;
cmd->advertising |= ADVERTISED_TP; advertising |= ADVERTISED_TP;
cmd->port = PORT_TP; cmd->base.port = PORT_TP;
} }
/* need to get stats to make these link speed/duplex valid */ /* need to get stats to make these link speed/duplex valid */
typhoon_do_get_stats(tp); typhoon_do_get_stats(tp);
ethtool_cmd_speed_set(cmd, tp->speed); cmd->base.speed = tp->speed;
cmd->duplex = tp->duplex; cmd->base.duplex = tp->duplex;
cmd->phy_address = 0; cmd->base.phy_address = 0;
cmd->transceiver = XCVR_INTERNAL;
if(tp->xcvr_select == TYPHOON_XCVR_AUTONEG) if(tp->xcvr_select == TYPHOON_XCVR_AUTONEG)
cmd->autoneg = AUTONEG_ENABLE; cmd->base.autoneg = AUTONEG_ENABLE;
else else
cmd->autoneg = AUTONEG_DISABLE; cmd->base.autoneg = AUTONEG_DISABLE;
cmd->maxtxpkt = 1;
cmd->maxrxpkt = 1;
return 0; return 0;
} }
static int static int
typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) typhoon_set_link_ksettings(struct net_device *dev,
const struct ethtool_link_ksettings *cmd)
{ {
struct typhoon *tp = netdev_priv(dev); struct typhoon *tp = netdev_priv(dev);
u32 speed = ethtool_cmd_speed(cmd); u32 speed = cmd->base.speed;
struct cmd_desc xp_cmd; struct cmd_desc xp_cmd;
__le16 xcvr; __le16 xcvr;
int err; int err;
err = -EINVAL; err = -EINVAL;
if (cmd->autoneg == AUTONEG_ENABLE) { if (cmd->base.autoneg == AUTONEG_ENABLE) {
xcvr = TYPHOON_XCVR_AUTONEG; xcvr = TYPHOON_XCVR_AUTONEG;
} else { } else {
if (cmd->duplex == DUPLEX_HALF) { if (cmd->base.duplex == DUPLEX_HALF) {
if (speed == SPEED_10) if (speed == SPEED_10)
xcvr = TYPHOON_XCVR_10HALF; xcvr = TYPHOON_XCVR_10HALF;
else if (speed == SPEED_100) else if (speed == SPEED_100)
xcvr = TYPHOON_XCVR_100HALF; xcvr = TYPHOON_XCVR_100HALF;
else else
goto out; goto out;
} else if (cmd->duplex == DUPLEX_FULL) { } else if (cmd->base.duplex == DUPLEX_FULL) {
if (speed == SPEED_10) if (speed == SPEED_10)
xcvr = TYPHOON_XCVR_10FULL; xcvr = TYPHOON_XCVR_10FULL;
else if (speed == SPEED_100) else if (speed == SPEED_100)
...@@ -1091,12 +1091,12 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -1091,12 +1091,12 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
goto out; goto out;
tp->xcvr_select = xcvr; tp->xcvr_select = xcvr;
if(cmd->autoneg == AUTONEG_ENABLE) { if (cmd->base.autoneg == AUTONEG_ENABLE) {
tp->speed = 0xff; /* invalid */ tp->speed = 0xff; /* invalid */
tp->duplex = 0xff; /* invalid */ tp->duplex = 0xff; /* invalid */
} else { } else {
tp->speed = speed; tp->speed = speed;
tp->duplex = cmd->duplex; tp->duplex = cmd->base.duplex;
} }
out: out:
...@@ -1145,13 +1145,13 @@ typhoon_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) ...@@ -1145,13 +1145,13 @@ typhoon_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
} }
static const struct ethtool_ops typhoon_ethtool_ops = { static const struct ethtool_ops typhoon_ethtool_ops = {
.get_settings = typhoon_get_settings,
.set_settings = typhoon_set_settings,
.get_drvinfo = typhoon_get_drvinfo, .get_drvinfo = typhoon_get_drvinfo,
.get_wol = typhoon_get_wol, .get_wol = typhoon_get_wol,
.set_wol = typhoon_set_wol, .set_wol = typhoon_set_wol,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
.get_ringparam = typhoon_get_ringparam, .get_ringparam = typhoon_get_ringparam,
.get_link_ksettings = typhoon_get_link_ksettings,
.set_link_ksettings = typhoon_set_link_ksettings,
}; };
static int static int
......
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