summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPhilippe Reynes <tremyfr@gmail.com>2016-12-10 15:00:48 +0100
committerDavid S. Miller <davem@davemloft.net>2016-12-10 17:31:44 -0500
commitbfd8d977af2390e646d4a5df8e88c1d7a1ae63d9 (patch)
tree6999ff45ed4d3172ed5b2f0e719bcc7cd300beb7 /drivers/net
parent52986a2f926cc0de544e32005a3436bb6db39f10 (diff)
downloadlinux-bfd8d977af2390e646d4a5df8e88c1d7a1ae63d9.tar.bz2
net: nicvf: 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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
index b0482410052d..2e74bbaa38e1 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
@@ -116,33 +116,34 @@ static const unsigned int nicvf_n_hw_stats = ARRAY_SIZE(nicvf_hw_stats);
static const unsigned int nicvf_n_drv_stats = ARRAY_SIZE(nicvf_drv_stats);
static const unsigned int nicvf_n_queue_stats = ARRAY_SIZE(nicvf_queue_stats);
-static int nicvf_get_settings(struct net_device *netdev,
- struct ethtool_cmd *cmd)
+static int nicvf_get_link_ksettings(struct net_device *netdev,
+ struct ethtool_link_ksettings *cmd)
{
struct nicvf *nic = netdev_priv(netdev);
+ u32 supported, advertising;
- cmd->supported = 0;
- cmd->transceiver = XCVR_EXTERNAL;
+ supported = 0;
+ advertising = 0;
if (!nic->link_up) {
- cmd->duplex = DUPLEX_UNKNOWN;
- ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
+ cmd->base.duplex = DUPLEX_UNKNOWN;
+ cmd->base.speed = SPEED_UNKNOWN;
return 0;
}
switch (nic->speed) {
case SPEED_1000:
- cmd->port = PORT_MII | PORT_TP;
- cmd->autoneg = AUTONEG_ENABLE;
- cmd->supported |= SUPPORTED_MII | SUPPORTED_TP;
- cmd->supported |= SUPPORTED_1000baseT_Full |
+ cmd->base.port = PORT_MII | PORT_TP;
+ cmd->base.autoneg = AUTONEG_ENABLE;
+ supported |= SUPPORTED_MII | SUPPORTED_TP;
+ supported |= SUPPORTED_1000baseT_Full |
SUPPORTED_1000baseT_Half |
SUPPORTED_100baseT_Full |
SUPPORTED_100baseT_Half |
SUPPORTED_10baseT_Full |
SUPPORTED_10baseT_Half;
- cmd->supported |= SUPPORTED_Autoneg;
- cmd->advertising |= ADVERTISED_1000baseT_Full |
+ supported |= SUPPORTED_Autoneg;
+ advertising |= ADVERTISED_1000baseT_Full |
ADVERTISED_1000baseT_Half |
ADVERTISED_100baseT_Full |
ADVERTISED_100baseT_Half |
@@ -151,24 +152,29 @@ static int nicvf_get_settings(struct net_device *netdev,
break;
case SPEED_10000:
if (nic->mac_type == BGX_MODE_RXAUI) {
- cmd->port = PORT_TP;
- cmd->supported |= SUPPORTED_TP;
+ cmd->base.port = PORT_TP;
+ supported |= SUPPORTED_TP;
} else {
- cmd->port = PORT_FIBRE;
- cmd->supported |= SUPPORTED_FIBRE;
+ cmd->base.port = PORT_FIBRE;
+ supported |= SUPPORTED_FIBRE;
}
- cmd->autoneg = AUTONEG_DISABLE;
- cmd->supported |= SUPPORTED_10000baseT_Full;
+ cmd->base.autoneg = AUTONEG_DISABLE;
+ supported |= SUPPORTED_10000baseT_Full;
break;
case SPEED_40000:
- cmd->port = PORT_FIBRE;
- cmd->autoneg = AUTONEG_DISABLE;
- cmd->supported |= SUPPORTED_FIBRE;
- cmd->supported |= SUPPORTED_40000baseCR4_Full;
+ cmd->base.port = PORT_FIBRE;
+ cmd->base.autoneg = AUTONEG_DISABLE;
+ supported |= SUPPORTED_FIBRE;
+ supported |= SUPPORTED_40000baseCR4_Full;
break;
}
- cmd->duplex = nic->duplex;
- ethtool_cmd_speed_set(cmd, nic->speed);
+ cmd->base.duplex = nic->duplex;
+ cmd->base.speed = nic->speed;
+
+ 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;
}
@@ -770,7 +776,6 @@ static int nicvf_set_pauseparam(struct net_device *dev,
}
static const struct ethtool_ops nicvf_ethtool_ops = {
- .get_settings = nicvf_get_settings,
.get_link = nicvf_get_link,
.get_drvinfo = nicvf_get_drvinfo,
.get_msglevel = nicvf_get_msglevel,
@@ -793,6 +798,7 @@ static const struct ethtool_ops nicvf_ethtool_ops = {
.get_pauseparam = nicvf_get_pauseparam,
.set_pauseparam = nicvf_set_pauseparam,
.get_ts_info = ethtool_op_get_ts_info,
+ .get_link_ksettings = nicvf_get_link_ksettings,
};
void nicvf_set_ethtool_ops(struct net_device *netdev)