diff options
author | Philippe Reynes <tremyfr@gmail.com> | 2017-03-16 23:18:47 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-03-21 16:03:58 -0700 |
commit | 8bae3551e93de4e8a5b959c495b06de9264be0d5 (patch) | |
tree | b94d888d8ca103962b336f0a0fcaa1557b2d8c91 /drivers | |
parent | 37a30b435b92a6b577795c642b6326fd0ea96e3f (diff) | |
download | linux-8bae3551e93de4e8a5b959c495b06de9264be0d5.tar.bz2 |
net: usb: usbnet: add new api ethtool_{get|set}_link_ksettings
The ethtool api {get|set}_settings is deprecated.
We add the new api {get|set}_link_ksettings to this driver.
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>
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/usb/usbnet.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3de65ea6531a..1b40b189435a 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -980,6 +980,40 @@ int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd) } EXPORT_SYMBOL_GPL(usbnet_set_settings); +int usbnet_get_link_ksettings(struct net_device *net, + struct ethtool_link_ksettings *cmd) +{ + struct usbnet *dev = netdev_priv(net); + + if (!dev->mii.mdio_read) + return -EOPNOTSUPP; + + return mii_ethtool_get_link_ksettings(&dev->mii, cmd); +} +EXPORT_SYMBOL_GPL(usbnet_get_link_ksettings); + +int usbnet_set_link_ksettings(struct net_device *net, + const struct ethtool_link_ksettings *cmd) +{ + struct usbnet *dev = netdev_priv(net); + int retval; + + if (!dev->mii.mdio_write) + return -EOPNOTSUPP; + + retval = mii_ethtool_set_link_ksettings(&dev->mii, cmd); + + /* link speed/duplex might have changed */ + if (dev->driver_info->link_reset) + dev->driver_info->link_reset(dev); + + /* hard_mtu or rx_urb_size may change in link_reset() */ + usbnet_update_max_qlen(dev); + + return retval; +} +EXPORT_SYMBOL_GPL(usbnet_set_link_ksettings); + u32 usbnet_get_link (struct net_device *net) { struct usbnet *dev = netdev_priv(net); @@ -1046,6 +1080,8 @@ static const struct ethtool_ops usbnet_ethtool_ops = { .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel, .get_ts_info = ethtool_op_get_ts_info, + .get_link_ksettings = usbnet_get_link_ksettings, + .set_link_ksettings = usbnet_set_link_ksettings, }; /*-------------------------------------------------------------------------*/ |