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

net: toshiba: ps3_genic_net: 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.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.
Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
Tested-by: default avatarGeoff Levand <geoff@infradead.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e016cc64
...@@ -1206,61 +1206,68 @@ void gelic_net_get_drvinfo(struct net_device *netdev, ...@@ -1206,61 +1206,68 @@ void gelic_net_get_drvinfo(struct net_device *netdev,
strlcpy(info->version, DRV_VERSION, sizeof(info->version)); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
} }
static int gelic_ether_get_settings(struct net_device *netdev, static int gelic_ether_get_link_ksettings(struct net_device *netdev,
struct ethtool_cmd *cmd) struct ethtool_link_ksettings *cmd)
{ {
struct gelic_card *card = netdev_card(netdev); struct gelic_card *card = netdev_card(netdev);
u32 supported, advertising;
gelic_card_get_ether_port_status(card, 0); gelic_card_get_ether_port_status(card, 0);
if (card->ether_port_status & GELIC_LV1_ETHER_FULL_DUPLEX) if (card->ether_port_status & GELIC_LV1_ETHER_FULL_DUPLEX)
cmd->duplex = DUPLEX_FULL; cmd->base.duplex = DUPLEX_FULL;
else else
cmd->duplex = DUPLEX_HALF; cmd->base.duplex = DUPLEX_HALF;
switch (card->ether_port_status & GELIC_LV1_ETHER_SPEED_MASK) { switch (card->ether_port_status & GELIC_LV1_ETHER_SPEED_MASK) {
case GELIC_LV1_ETHER_SPEED_10: case GELIC_LV1_ETHER_SPEED_10:
ethtool_cmd_speed_set(cmd, SPEED_10); cmd->base.speed = SPEED_10;
break; break;
case GELIC_LV1_ETHER_SPEED_100: case GELIC_LV1_ETHER_SPEED_100:
ethtool_cmd_speed_set(cmd, SPEED_100); cmd->base.speed = SPEED_100;
break; break;
case GELIC_LV1_ETHER_SPEED_1000: case GELIC_LV1_ETHER_SPEED_1000:
ethtool_cmd_speed_set(cmd, SPEED_1000); cmd->base.speed = SPEED_1000;
break; break;
default: default:
pr_info("%s: speed unknown\n", __func__); pr_info("%s: speed unknown\n", __func__);
ethtool_cmd_speed_set(cmd, SPEED_10); cmd->base.speed = SPEED_10;
break; break;
} }
cmd->supported = SUPPORTED_TP | SUPPORTED_Autoneg | supported = SUPPORTED_TP | SUPPORTED_Autoneg |
SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
SUPPORTED_1000baseT_Full; SUPPORTED_1000baseT_Full;
cmd->advertising = cmd->supported; advertising = supported;
if (card->link_mode & GELIC_LV1_ETHER_AUTO_NEG) { if (card->link_mode & GELIC_LV1_ETHER_AUTO_NEG) {
cmd->autoneg = AUTONEG_ENABLE; cmd->base.autoneg = AUTONEG_ENABLE;
} else { } else {
cmd->autoneg = AUTONEG_DISABLE; cmd->base.autoneg = AUTONEG_DISABLE;
cmd->advertising &= ~ADVERTISED_Autoneg; advertising &= ~ADVERTISED_Autoneg;
} }
cmd->port = PORT_TP; cmd->base.port = PORT_TP;
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 gelic_ether_set_settings(struct net_device *netdev, static int
struct ethtool_cmd *cmd) gelic_ether_set_link_ksettings(struct net_device *netdev,
const struct ethtool_link_ksettings *cmd)
{ {
struct gelic_card *card = netdev_card(netdev); struct gelic_card *card = netdev_card(netdev);
u64 mode; u64 mode;
int ret; int ret;
if (cmd->autoneg == AUTONEG_ENABLE) { if (cmd->base.autoneg == AUTONEG_ENABLE) {
mode = GELIC_LV1_ETHER_AUTO_NEG; mode = GELIC_LV1_ETHER_AUTO_NEG;
} else { } else {
switch (cmd->speed) { switch (cmd->base.speed) {
case SPEED_10: case SPEED_10:
mode = GELIC_LV1_ETHER_SPEED_10; mode = GELIC_LV1_ETHER_SPEED_10;
break; break;
...@@ -1273,9 +1280,9 @@ static int gelic_ether_set_settings(struct net_device *netdev, ...@@ -1273,9 +1280,9 @@ static int gelic_ether_set_settings(struct net_device *netdev,
default: default:
return -EINVAL; return -EINVAL;
} }
if (cmd->duplex == DUPLEX_FULL) if (cmd->base.duplex == DUPLEX_FULL) {
mode |= GELIC_LV1_ETHER_FULL_DUPLEX; mode |= GELIC_LV1_ETHER_FULL_DUPLEX;
else if (cmd->speed == SPEED_1000) { } else if (cmd->base.speed == SPEED_1000) {
pr_info("1000 half duplex is not supported.\n"); pr_info("1000 half duplex is not supported.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1370,11 +1377,11 @@ static int gelic_net_set_wol(struct net_device *netdev, ...@@ -1370,11 +1377,11 @@ static int gelic_net_set_wol(struct net_device *netdev,
static const struct ethtool_ops gelic_ether_ethtool_ops = { static const struct ethtool_ops gelic_ether_ethtool_ops = {
.get_drvinfo = gelic_net_get_drvinfo, .get_drvinfo = gelic_net_get_drvinfo,
.get_settings = gelic_ether_get_settings,
.set_settings = gelic_ether_set_settings,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
.get_wol = gelic_net_get_wol, .get_wol = gelic_net_get_wol,
.set_wol = gelic_net_set_wol, .set_wol = gelic_net_set_wol,
.get_link_ksettings = gelic_ether_get_link_ksettings,
.set_link_ksettings = gelic_ether_set_link_ksettings,
}; };
/** /**
......
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