WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xennet_get_drvinfo()

To: Laszlo Ersek <lersek@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xennet_get_drvinfo()
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Thu, 11 Nov 2010 18:50:56 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 11 Nov 2010 10:52:17 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4CDC3003.5040306@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <4CDC3003.5040306@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2010-11-11 at 18:03 +0000, Laszlo Ersek wrote: 
> The following patch, written for xen/next-2.6.32, adds get_drvinfo() 
> ("ethtool -i") support to netfront. If there is no default get_drvinfo() in 
> effect [0], then the patch is intended to remedy the following situation:
> 
>   # ethtool -i eth0
>   Cannot get driver information: Operation not supported
> 
> like this:
> 
>   # ethtool -i eth0
>   driver: xen-netfront
>   version:
>   firmware-version:
>   bus-info: vif-0
> 
> If a default get_drvinfo() is in effect (see [0] again), then the fallback 
> works like this:
> 
>   # ethtool -i eth0
>   driver: vif
>   version:
>   firmware-version:
>   bus-info: vif-0
> 
> and it's more fortunate to return the module name ("driver: xen-netfront") 
> than "driver: vif".

This is pretty much the same as a patch which I clearly forgot to send a
pull request for ages ago[0] so:

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

My only quibble would be that Linux generally prefers "sizeof(x)" to
"sizeof x".

Ian.

[0]
http://xenbits.xen.org/gitweb?p=people/ianc/linux-2.6.git;a=commitdiff;h=9a0429ca56f56d415a8b34a92dfa4e8737baf348

> 
> Thanks for considering,
> Signed-off-by: Laszlo Ersek <lersek@xxxxxxxxxx>
> 
> [0] 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=01414802054c382072b6cb9a1bdc6e243c74b2d5#patch17
> 
> ---
>  drivers/net/xen-netfront.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index 3f71199..64ee838 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -1768,8 +1768,17 @@ static int xennet_set_coalesce(struct net_device 
> *netdev,
>       return 0;
>  }
>  
> +static void xennet_get_drvinfo(struct net_device *dev,
> +                            struct ethtool_drvinfo *info)
> +{
> +     strcpy(info->driver, "xen-netfront");
> +     strlcpy(info->bus_info, dev_name(dev->dev.parent),
> +             sizeof info->bus_info);
> +}
> +
>  static const struct ethtool_ops xennet_ethtool_ops =
>  {
> +     .get_drvinfo = xennet_get_drvinfo,
>       .set_tx_csum = ethtool_op_set_tx_csum,
>       .set_sg = xennet_set_sg,
>       .set_tso = xennet_set_tso,
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel