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

net: ibm: ehea: 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 1e911632
...@@ -31,9 +31,11 @@ ...@@ -31,9 +31,11 @@
#include "ehea.h" #include "ehea.h"
#include "ehea_phyp.h" #include "ehea_phyp.h"
static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int ehea_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *cmd)
{ {
struct ehea_port *port = netdev_priv(dev); struct ehea_port *port = netdev_priv(dev);
u32 supported, advertising;
u32 speed; u32 speed;
int ret; int ret;
...@@ -60,68 +62,75 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -60,68 +62,75 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
speed = -1; speed = -1;
break; /* BUG */ break; /* BUG */
} }
cmd->duplex = port->full_duplex == 1 ? cmd->base.duplex = port->full_duplex == 1 ?
DUPLEX_FULL : DUPLEX_HALF; DUPLEX_FULL : DUPLEX_HALF;
} else { } else {
speed = SPEED_UNKNOWN; speed = SPEED_UNKNOWN;
cmd->duplex = DUPLEX_UNKNOWN; cmd->base.duplex = DUPLEX_UNKNOWN;
} }
ethtool_cmd_speed_set(cmd, speed); cmd->base.speed = speed;
if (cmd->speed == SPEED_10000) { if (cmd->base.speed == SPEED_10000) {
cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE); supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE); advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
cmd->port = PORT_FIBRE; cmd->base.port = PORT_FIBRE;
} else { } else {
cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full supported = (SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full
| SUPPORTED_100baseT_Half | SUPPORTED_10baseT_Full | SUPPORTED_100baseT_Half | SUPPORTED_10baseT_Full
| SUPPORTED_10baseT_Half | SUPPORTED_Autoneg | SUPPORTED_10baseT_Half | SUPPORTED_Autoneg
| SUPPORTED_TP); | SUPPORTED_TP);
cmd->advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg advertising = (ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg
| ADVERTISED_TP); | ADVERTISED_TP);
cmd->port = PORT_TP; cmd->base.port = PORT_TP;
} }
cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE; cmd->base.autoneg = port->autoneg == 1 ?
AUTONEG_ENABLE : AUTONEG_DISABLE;
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
supported);
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
advertising);
return 0; return 0;
} }
static int ehea_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int ehea_set_link_ksettings(struct net_device *dev,
const struct ethtool_link_ksettings *cmd)
{ {
struct ehea_port *port = netdev_priv(dev); struct ehea_port *port = netdev_priv(dev);
int ret = 0; int ret = 0;
u32 sp; u32 sp;
if (cmd->autoneg == AUTONEG_ENABLE) { if (cmd->base.autoneg == AUTONEG_ENABLE) {
sp = EHEA_SPEED_AUTONEG; sp = EHEA_SPEED_AUTONEG;
goto doit; goto doit;
} }
switch (cmd->speed) { switch (cmd->base.speed) {
case SPEED_10: case SPEED_10:
if (cmd->duplex == DUPLEX_FULL) if (cmd->base.duplex == DUPLEX_FULL)
sp = H_SPEED_10M_F; sp = H_SPEED_10M_F;
else else
sp = H_SPEED_10M_H; sp = H_SPEED_10M_H;
break; break;
case SPEED_100: case SPEED_100:
if (cmd->duplex == DUPLEX_FULL) if (cmd->base.duplex == DUPLEX_FULL)
sp = H_SPEED_100M_F; sp = H_SPEED_100M_F;
else else
sp = H_SPEED_100M_H; sp = H_SPEED_100M_H;
break; break;
case SPEED_1000: case SPEED_1000:
if (cmd->duplex == DUPLEX_FULL) if (cmd->base.duplex == DUPLEX_FULL)
sp = H_SPEED_1G_F; sp = H_SPEED_1G_F;
else else
ret = -EINVAL; ret = -EINVAL;
break; break;
case SPEED_10000: case SPEED_10000:
if (cmd->duplex == DUPLEX_FULL) if (cmd->base.duplex == DUPLEX_FULL)
sp = H_SPEED_10G_F; sp = H_SPEED_10G_F;
else else
ret = -EINVAL; ret = -EINVAL;
...@@ -264,7 +273,6 @@ static void ehea_get_ethtool_stats(struct net_device *dev, ...@@ -264,7 +273,6 @@ static void ehea_get_ethtool_stats(struct net_device *dev,
} }
static const struct ethtool_ops ehea_ethtool_ops = { static const struct ethtool_ops ehea_ethtool_ops = {
.get_settings = ehea_get_settings,
.get_drvinfo = ehea_get_drvinfo, .get_drvinfo = ehea_get_drvinfo,
.get_msglevel = ehea_get_msglevel, .get_msglevel = ehea_get_msglevel,
.set_msglevel = ehea_set_msglevel, .set_msglevel = ehea_set_msglevel,
...@@ -272,8 +280,9 @@ static const struct ethtool_ops ehea_ethtool_ops = { ...@@ -272,8 +280,9 @@ static const struct ethtool_ops ehea_ethtool_ops = {
.get_strings = ehea_get_strings, .get_strings = ehea_get_strings,
.get_sset_count = ehea_get_sset_count, .get_sset_count = ehea_get_sset_count,
.get_ethtool_stats = ehea_get_ethtool_stats, .get_ethtool_stats = ehea_get_ethtool_stats,
.set_settings = ehea_set_settings,
.nway_reset = ehea_nway_reset, /* Restart autonegotiation */ .nway_reset = ehea_nway_reset, /* Restart autonegotiation */
.get_link_ksettings = ehea_get_link_ksettings,
.set_link_ksettings = ehea_set_link_ksettings,
}; };
void ehea_set_ethtool_ops(struct net_device *netdev) void ehea_set_ethtool_ops(struct net_device *netdev)
......
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