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

net: sun: niu: 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>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 15883a43
...@@ -6813,7 +6813,8 @@ static void niu_get_drvinfo(struct net_device *dev, ...@@ -6813,7 +6813,8 @@ static void niu_get_drvinfo(struct net_device *dev,
sizeof(info->bus_info)); sizeof(info->bus_info));
} }
static int niu_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int niu_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *cmd)
{ {
struct niu *np = netdev_priv(dev); struct niu *np = netdev_priv(dev);
struct niu_link_config *lp; struct niu_link_config *lp;
...@@ -6821,28 +6822,30 @@ static int niu_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -6821,28 +6822,30 @@ static int niu_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
lp = &np->link_config; lp = &np->link_config;
memset(cmd, 0, sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd));
cmd->phy_address = np->phy_addr; cmd->base.phy_address = np->phy_addr;
cmd->supported = lp->supported; ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
cmd->advertising = lp->active_advertising; lp->supported);
cmd->autoneg = lp->active_autoneg; ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
ethtool_cmd_speed_set(cmd, lp->active_speed); lp->active_advertising);
cmd->duplex = lp->active_duplex; cmd->base.autoneg = lp->active_autoneg;
cmd->port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP; cmd->base.speed = lp->active_speed;
cmd->transceiver = (np->flags & NIU_FLAGS_XCVR_SERDES) ? cmd->base.duplex = lp->active_duplex;
XCVR_EXTERNAL : XCVR_INTERNAL; cmd->base.port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP;
return 0; return 0;
} }
static int niu_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int niu_set_link_ksettings(struct net_device *dev,
const struct ethtool_link_ksettings *cmd)
{ {
struct niu *np = netdev_priv(dev); struct niu *np = netdev_priv(dev);
struct niu_link_config *lp = &np->link_config; struct niu_link_config *lp = &np->link_config;
lp->advertising = cmd->advertising; ethtool_convert_link_mode_to_legacy_u32(&lp->advertising,
lp->speed = ethtool_cmd_speed(cmd); cmd->link_modes.advertising);
lp->duplex = cmd->duplex; lp->speed = cmd->base.speed;
lp->autoneg = cmd->autoneg; lp->duplex = cmd->base.duplex;
lp->autoneg = cmd->base.autoneg;
return niu_init_link(np); return niu_init_link(np);
} }
...@@ -7902,14 +7905,14 @@ static const struct ethtool_ops niu_ethtool_ops = { ...@@ -7902,14 +7905,14 @@ static const struct ethtool_ops niu_ethtool_ops = {
.nway_reset = niu_nway_reset, .nway_reset = niu_nway_reset,
.get_eeprom_len = niu_get_eeprom_len, .get_eeprom_len = niu_get_eeprom_len,
.get_eeprom = niu_get_eeprom, .get_eeprom = niu_get_eeprom,
.get_settings = niu_get_settings,
.set_settings = niu_set_settings,
.get_strings = niu_get_strings, .get_strings = niu_get_strings,
.get_sset_count = niu_get_sset_count, .get_sset_count = niu_get_sset_count,
.get_ethtool_stats = niu_get_ethtool_stats, .get_ethtool_stats = niu_get_ethtool_stats,
.set_phys_id = niu_set_phys_id, .set_phys_id = niu_set_phys_id,
.get_rxnfc = niu_get_nfc, .get_rxnfc = niu_get_nfc,
.set_rxnfc = niu_set_nfc, .set_rxnfc = niu_set_nfc,
.get_link_ksettings = niu_get_link_ksettings,
.set_link_ksettings = niu_set_link_ksettings,
}; };
static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent, static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent,
......
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