Commit 5e8456fd authored by Philippe Reynes's avatar Philippe Reynes Committed by David S. Miller

net: hyperv: 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 avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 031e5144
...@@ -789,18 +789,19 @@ static int netvsc_set_channels(struct net_device *net, ...@@ -789,18 +789,19 @@ static int netvsc_set_channels(struct net_device *net,
return ret; return ret;
} }
static bool netvsc_validate_ethtool_ss_cmd(const struct ethtool_cmd *cmd) static bool
netvsc_validate_ethtool_ss_cmd(const struct ethtool_link_ksettings *cmd)
{ {
struct ethtool_cmd diff1 = *cmd; struct ethtool_link_ksettings diff1 = *cmd;
struct ethtool_cmd diff2 = {}; struct ethtool_link_ksettings diff2 = {};
ethtool_cmd_speed_set(&diff1, 0); diff1.base.speed = 0;
diff1.duplex = 0; diff1.base.duplex = 0;
/* advertising and cmd are usually set */ /* advertising and cmd are usually set */
diff1.advertising = 0; ethtool_link_ksettings_zero_link_mode(&diff1, advertising);
diff1.cmd = 0; diff1.base.cmd = 0;
/* We set port to PORT_OTHER */ /* We set port to PORT_OTHER */
diff2.port = PORT_OTHER; diff2.base.port = PORT_OTHER;
return !memcmp(&diff1, &diff2, sizeof(diff1)); return !memcmp(&diff1, &diff2, sizeof(diff1));
} }
...@@ -813,30 +814,32 @@ static void netvsc_init_settings(struct net_device *dev) ...@@ -813,30 +814,32 @@ static void netvsc_init_settings(struct net_device *dev)
ndc->duplex = DUPLEX_UNKNOWN; ndc->duplex = DUPLEX_UNKNOWN;
} }
static int netvsc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int netvsc_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *cmd)
{ {
struct net_device_context *ndc = netdev_priv(dev); struct net_device_context *ndc = netdev_priv(dev);
ethtool_cmd_speed_set(cmd, ndc->speed); cmd->base.speed = ndc->speed;
cmd->duplex = ndc->duplex; cmd->base.duplex = ndc->duplex;
cmd->port = PORT_OTHER; cmd->base.port = PORT_OTHER;
return 0; return 0;
} }
static int netvsc_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int netvsc_set_link_ksettings(struct net_device *dev,
const struct ethtool_link_ksettings *cmd)
{ {
struct net_device_context *ndc = netdev_priv(dev); struct net_device_context *ndc = netdev_priv(dev);
u32 speed; u32 speed;
speed = ethtool_cmd_speed(cmd); speed = cmd->base.speed;
if (!ethtool_validate_speed(speed) || if (!ethtool_validate_speed(speed) ||
!ethtool_validate_duplex(cmd->duplex) || !ethtool_validate_duplex(cmd->base.duplex) ||
!netvsc_validate_ethtool_ss_cmd(cmd)) !netvsc_validate_ethtool_ss_cmd(cmd))
return -EINVAL; return -EINVAL;
ndc->speed = speed; ndc->speed = speed;
ndc->duplex = cmd->duplex; ndc->duplex = cmd->base.duplex;
return 0; return 0;
} }
...@@ -1170,13 +1173,13 @@ static const struct ethtool_ops ethtool_ops = { ...@@ -1170,13 +1173,13 @@ static const struct ethtool_ops ethtool_ops = {
.get_channels = netvsc_get_channels, .get_channels = netvsc_get_channels,
.set_channels = netvsc_set_channels, .set_channels = netvsc_set_channels,
.get_ts_info = ethtool_op_get_ts_info, .get_ts_info = ethtool_op_get_ts_info,
.get_settings = netvsc_get_settings,
.set_settings = netvsc_set_settings,
.get_rxnfc = netvsc_get_rxnfc, .get_rxnfc = netvsc_get_rxnfc,
.get_rxfh_key_size = netvsc_get_rxfh_key_size, .get_rxfh_key_size = netvsc_get_rxfh_key_size,
.get_rxfh_indir_size = netvsc_rss_indir_size, .get_rxfh_indir_size = netvsc_rss_indir_size,
.get_rxfh = netvsc_get_rxfh, .get_rxfh = netvsc_get_rxfh,
.set_rxfh = netvsc_set_rxfh, .set_rxfh = netvsc_set_rxfh,
.get_link_ksettings = netvsc_get_link_ksettings,
.set_link_ksettings = netvsc_set_link_ksettings,
}; };
static const struct net_device_ops device_ops = { static const struct net_device_ops device_ops = {
......
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