mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
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: Philippe Reynes <tremyfr@gmail.com> Tested-by: Geoff Levand <geoff@infradead.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e016cc6442
commit
60f2851299
@ -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,
|
|||||||
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,
|
|||||||
|
|
||||||
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,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user