mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-04 09:34:12 +08:00
net: brocade: bna: 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: Philippe Reynes <tremyfr@gmail.com> Acked-by: Rasesh Mody <Rasesh.Mody@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
85de8576a0
commit
377fa64f19
@ -240,40 +240,46 @@ static const char *bnad_net_stats_strings[] = {
|
|||||||
#define BNAD_ETHTOOL_STATS_NUM ARRAY_SIZE(bnad_net_stats_strings)
|
#define BNAD_ETHTOOL_STATS_NUM ARRAY_SIZE(bnad_net_stats_strings)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
|
bnad_get_link_ksettings(struct net_device *netdev,
|
||||||
|
struct ethtool_link_ksettings *cmd)
|
||||||
{
|
{
|
||||||
cmd->supported = SUPPORTED_10000baseT_Full;
|
u32 supported, advertising;
|
||||||
cmd->advertising = ADVERTISED_10000baseT_Full;
|
|
||||||
cmd->autoneg = AUTONEG_DISABLE;
|
supported = SUPPORTED_10000baseT_Full;
|
||||||
cmd->supported |= SUPPORTED_FIBRE;
|
advertising = ADVERTISED_10000baseT_Full;
|
||||||
cmd->advertising |= ADVERTISED_FIBRE;
|
cmd->base.autoneg = AUTONEG_DISABLE;
|
||||||
cmd->port = PORT_FIBRE;
|
supported |= SUPPORTED_FIBRE;
|
||||||
cmd->phy_address = 0;
|
advertising |= ADVERTISED_FIBRE;
|
||||||
|
cmd->base.port = PORT_FIBRE;
|
||||||
|
cmd->base.phy_address = 0;
|
||||||
|
|
||||||
if (netif_carrier_ok(netdev)) {
|
if (netif_carrier_ok(netdev)) {
|
||||||
ethtool_cmd_speed_set(cmd, SPEED_10000);
|
cmd->base.speed = SPEED_10000;
|
||||||
cmd->duplex = DUPLEX_FULL;
|
cmd->base.duplex = DUPLEX_FULL;
|
||||||
} else {
|
} else {
|
||||||
ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
|
cmd->base.speed = SPEED_UNKNOWN;
|
||||||
cmd->duplex = DUPLEX_UNKNOWN;
|
cmd->base.duplex = DUPLEX_UNKNOWN;
|
||||||
}
|
}
|
||||||
cmd->transceiver = XCVR_EXTERNAL;
|
|
||||||
cmd->maxtxpkt = 0;
|
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
|
||||||
cmd->maxrxpkt = 0;
|
supported);
|
||||||
|
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
|
||||||
|
advertising);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bnad_set_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
|
bnad_set_link_ksettings(struct net_device *netdev,
|
||||||
|
const struct ethtool_link_ksettings *cmd)
|
||||||
{
|
{
|
||||||
/* 10G full duplex setting supported only */
|
/* 10G full duplex setting supported only */
|
||||||
if (cmd->autoneg == AUTONEG_ENABLE)
|
if (cmd->base.autoneg == AUTONEG_ENABLE)
|
||||||
return -EOPNOTSUPP; else {
|
return -EOPNOTSUPP;
|
||||||
if ((ethtool_cmd_speed(cmd) == SPEED_10000)
|
|
||||||
&& (cmd->duplex == DUPLEX_FULL))
|
if ((cmd->base.speed == SPEED_10000) &&
|
||||||
return 0;
|
(cmd->base.duplex == DUPLEX_FULL))
|
||||||
}
|
return 0;
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
@ -1118,8 +1124,6 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct ethtool_ops bnad_ethtool_ops = {
|
static const struct ethtool_ops bnad_ethtool_ops = {
|
||||||
.get_settings = bnad_get_settings,
|
|
||||||
.set_settings = bnad_set_settings,
|
|
||||||
.get_drvinfo = bnad_get_drvinfo,
|
.get_drvinfo = bnad_get_drvinfo,
|
||||||
.get_wol = bnad_get_wol,
|
.get_wol = bnad_get_wol,
|
||||||
.get_link = ethtool_op_get_link,
|
.get_link = ethtool_op_get_link,
|
||||||
@ -1137,6 +1141,8 @@ static const struct ethtool_ops bnad_ethtool_ops = {
|
|||||||
.set_eeprom = bnad_set_eeprom,
|
.set_eeprom = bnad_set_eeprom,
|
||||||
.flash_device = bnad_flash_device,
|
.flash_device = bnad_flash_device,
|
||||||
.get_ts_info = ethtool_op_get_ts_info,
|
.get_ts_info = ethtool_op_get_ts_info,
|
||||||
|
.get_link_ksettings = bnad_get_link_ksettings,
|
||||||
|
.set_link_ksettings = bnad_set_link_ksettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user