netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: tun: use new api ethtool_{get|set}_link_ksettings
@ 2017-03-10 21:18 Philippe Reynes
  2017-03-10 21:57 ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Reynes @ 2017-03-10 21:18 UTC (permalink / raw)
  To: davem, mst, edumazet, pabeni, fgao, elfring, jarno, rppt, jarod
  Cc: netdev, linux-kernel, Philippe Reynes

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: Philippe Reynes <tremyfr@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: tun: use new api ethtool_{get|set}_link_ksettings
  2017-03-10 21:18 [PATCH] net: tun: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
@ 2017-03-10 21:57 ` Michael S. Tsirkin
  2017-03-10 22:46   ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-03-10 21:57 UTC (permalink / raw)
  To: Philippe Reynes
  Cc: davem, edumazet, pabeni, fgao, elfring, jarno, rppt, jarod,
	netdev, linux-kernel

On Fri, Mar 10, 2017 at 10:18:07PM +0100, Philippe Reynes wrote:
> 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,

What kind of hardware?

> I'd be very pleased if
> someone may test this patch.
> 
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: tun: use new api ethtool_{get|set}_link_ksettings
  2017-03-10 21:57 ` Michael S. Tsirkin
@ 2017-03-10 22:46   ` Eric Dumazet
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2017-03-10 22:46 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Philippe Reynes, davem, edumazet, pabeni, fgao, elfring, jarno,
	rppt, jarod, netdev, linux-kernel

On Fri, 2017-03-10 at 23:57 +0200, Michael S. Tsirkin wrote:
> On Fri, Mar 10, 2017 at 10:18:07PM +0100, Philippe Reynes wrote:
> > 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,
> 
> What kind of hardware?

TGIF ;)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-10 22:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 21:18 [PATCH] net: tun: use new api ethtool_{get|set}_link_ksettings Philippe Reynes
2017-03-10 21:57 ` Michael S. Tsirkin
2017-03-10 22:46   ` Eric Dumazet

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).