netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philippe Reynes <tremyfr@gmail.com>
To: oliver@neukum.org, jacmet@sunsite.dk,
	steve.glendinning@shawell.net, UNGLinuxDriver@microchip.com,
	gregkh@linuxfoundation.org, davem@davemloft.net,
	robert.foss@collabora.com, allan@asix.com.tw,
	grundler@google.com, jarod@redhat.com, peter.chen@nxp.com,
	stefan.bruens@rwth-aachen.de, akpm@linux-foundation.org,
	adobriyan@gmail.com
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Philippe Reynes <tremyfr@gmail.com>
Subject: [PATCH 01/11] net: usb: usbnet: add new api ethtool_{get|set}_link_ksettings
Date: Thu, 16 Mar 2017 23:18:47 +0100	[thread overview]
Message-ID: <1489702737-2401-2-git-send-email-tremyfr@gmail.com> (raw)
In-Reply-To: <1489702737-2401-1-git-send-email-tremyfr@gmail.com>

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>
---
 drivers/net/usb/usbnet.c   |   36 ++++++++++++++++++++++++++++++++++++
 include/linux/usb/usbnet.h |    4 ++++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3de65ea..1b40b18 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 @@ void usbnet_set_msglevel (struct net_device *net, u32 level)
 	.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,
 };
 
 /*-------------------------------------------------------------------------*/
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 6e0ce8c..5bd8007 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -265,6 +265,10 @@ extern int usbnet_get_settings(struct net_device *net,
 			       struct ethtool_cmd *cmd);
 extern int usbnet_set_settings(struct net_device *net,
 			       struct ethtool_cmd *cmd);
+extern int usbnet_get_link_ksettings(struct net_device *net,
+				     struct ethtool_link_ksettings *cmd);
+extern int usbnet_set_link_ksettings(struct net_device *net,
+				     const struct ethtool_link_ksettings *cmd);
 extern u32 usbnet_get_link(struct net_device *net);
 extern u32 usbnet_get_msglevel(struct net_device *);
 extern void usbnet_set_msglevel(struct net_device *, u32);
-- 
1.7.4.4

  reply	other threads:[~2017-03-16 22:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 22:18 [PATCH 00/11] net: usbnet: move to new api ethtool_{get|set}_link_ksettings Philippe Reynes
2017-03-16 22:18 ` Philippe Reynes [this message]
2017-03-20  6:39   ` [PATCH 01/11] net: usb: usbnet: add " Oliver Neukum
2017-03-21 11:33   ` Oliver Neukum
2017-03-21 23:03     ` David Miller
2017-03-16 22:18 ` [PATCH 02/11] net: usb: smsc95xx: use " Philippe Reynes
2017-03-16 22:18 ` [PATCH 03/11] net: usb: sr9800: " Philippe Reynes
     [not found] ` <1489702737-2401-1-git-send-email-tremyfr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-16 22:18   ` [PATCH 04/11] net: usb: cdc_ncm: " Philippe Reynes
2017-03-16 22:18 ` [PATCH 05/11] net: usb: dm9601: " Philippe Reynes
2017-03-16 22:18 ` [PATCH 06/11] net: usb: mcs7830: " Philippe Reynes
2017-03-21 14:36   ` poma
2017-03-16 22:18 ` [PATCH 07/11] net: usb: sierra_net: " Philippe Reynes
2017-03-16 22:18 ` [PATCH 08/11] net: usb: smsc75xx: " Philippe Reynes
2017-03-16 22:18 ` [PATCH 09/11] net: usb: sr9700: " Philippe Reynes
2017-03-16 22:18 ` [PATCH 10/11] net: usb: asix: " Philippe Reynes
2017-03-16 22:18 ` [PATCH 11/11] net: usb: usb: remove old api ethtool_{get|set}_settings Philippe Reynes
     [not found]   ` <1489702737-2401-12-git-send-email-tremyfr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-20  6:40     ` Oliver Neukum
2017-03-21 23:04 ` [PATCH 00/11] net: usbnet: move to new api ethtool_{get|set}_link_ksettings David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1489702737-2401-2-git-send-email-tremyfr@gmail.com \
    --to=tremyfr@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=allan@asix.com.tw \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=grundler@google.com \
    --cc=jacmet@sunsite.dk \
    --cc=jarod@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oliver@neukum.org \
    --cc=peter.chen@nxp.com \
    --cc=robert.foss@collabora.com \
    --cc=stefan.bruens@rwth-aachen.de \
    --cc=steve.glendinning@shawell.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).