Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1598464 > unrolled thread

[PATCH v2] net: tun: use new api ethtool_{get|set}_link_ksettings

Started byPhilippe Reynes <tremyfr@gmail.com>
First post2017-03-11 22:10 +0100
Last post2017-03-13 23:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] net: tun: use new api ethtool_{get|set}_link_ksettings Philippe Reynes <tremyfr@gmail.com> - 2017-03-11 22:10 +0100
    Re: [PATCH v2] net: tun: use new api  ethtool_{get|set}_link_ksettings David Miller <davem@davemloft.net> - 2017-03-13 23:30 +0100

#1598464 — [PATCH v2] net: tun: use new api ethtool_{get|set}_link_ksettings

FromPhilippe Reynes <tremyfr@gmail.com>
Date2017-03-11 22:10 +0100
Subject[PATCH v2] net: tun: use new api ethtool_{get|set}_link_ksettings
Message-ID<tjWqZ-8sd-11@gated-at.bofh.it>
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>
---
Changelog:
v2:
- Finaly, I've found the hardware and do basic test ;)
  thanks Michael S. Tsirkin and Eric Dumazet for the feedback

 drivers/net/tun.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index dc1b1dd..c418f0a 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2430,18 +2430,16 @@ static void tun_chr_show_fdinfo(struct seq_file *m, struct file *f)
 
 /* ethtool interface */
 
-static int tun_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-	cmd->supported		= 0;
-	cmd->advertising	= 0;
-	ethtool_cmd_speed_set(cmd, SPEED_10);
-	cmd->duplex		= DUPLEX_FULL;
-	cmd->port		= PORT_TP;
-	cmd->phy_address	= 0;
-	cmd->transceiver	= XCVR_INTERNAL;
-	cmd->autoneg		= AUTONEG_DISABLE;
-	cmd->maxtxpkt		= 0;
-	cmd->maxrxpkt		= 0;
+static int tun_get_link_ksettings(struct net_device *dev,
+				  struct ethtool_link_ksettings *cmd)
+{
+	ethtool_link_ksettings_zero_link_mode(cmd, supported);
+	ethtool_link_ksettings_zero_link_mode(cmd, advertising);
+	cmd->base.speed		= SPEED_10;
+	cmd->base.duplex	= DUPLEX_FULL;
+	cmd->base.port		= PORT_TP;
+	cmd->base.phy_address	= 0;
+	cmd->base.autoneg	= AUTONEG_DISABLE;
 	return 0;
 }
 
@@ -2504,7 +2502,6 @@ static int tun_set_coalesce(struct net_device *dev,
 }
 
 static const struct ethtool_ops tun_ethtool_ops = {
-	.get_settings	= tun_get_settings,
 	.get_drvinfo	= tun_get_drvinfo,
 	.get_msglevel	= tun_get_msglevel,
 	.set_msglevel	= tun_set_msglevel,
@@ -2512,6 +2509,7 @@ static int tun_set_coalesce(struct net_device *dev,
 	.get_ts_info	= ethtool_op_get_ts_info,
 	.get_coalesce   = tun_get_coalesce,
 	.set_coalesce   = tun_set_coalesce,
+	.get_link_ksettings = tun_get_link_ksettings,
 };
 
 static int tun_queue_resize(struct tun_struct *tun)
-- 
1.7.4.4

[toc] | [next] | [standalone]


#1599891 — Re: [PATCH v2] net: tun: use new api ethtool_{get|set}_link_ksettings

FromDavid Miller <davem@davemloft.net>
Date2017-03-13 23:30 +0100
SubjectRe: [PATCH v2] net: tun: use new api ethtool_{get|set}_link_ksettings
Message-ID<tkGDw-7lk-13@gated-at.bofh.it>
In reply to#1598464
From: Philippe Reynes <tremyfr@gmail.com>
Date: Sat, 11 Mar 2017 22:03:50 +0100

> 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>
> ---
> Changelog:
> v2:
> - Finaly, I've found the hardware and do basic test ;)
>   thanks Michael S. Tsirkin and Eric Dumazet for the feedback

:-)  Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web