> -----Original Message-----
> From: Andrew Schwartzmeyer [mailto:and...@schwartzmeyer.com]
> Sent: Thursday, February 26, 2015 1:43 AM
> To: Haiyang Zhang
> Cc: KY Srinivasan; de...@linuxdriverproject.org; hall5...@vandals.uidaho.edu;
> kei...@vandals.uidaho.edu; doma8...@vandals.uidaho.edu
> Subject: [PATCH] Implement Hyper-V netvsc_get_channels() ethool op
> 
> This adds support for reporting the combined channels count of the hv_netvsc
> driver via 'ethtool --show-channels'.
> 
> Signed-off-by: Andrew Schwartzmeyer <and...@schwartzmeyer.com>
> ---
>  drivers/net/hyperv/netvsc_drv.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 15d82eda0baf..7106e3f88bde 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -687,6 +687,27 @@ static void netvsc_get_drvinfo(struct net_device *net,
>       strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));  }
> 
> +static int netvsc_get_channels_combined_count(struct net_device *net) {
> +     struct net_device_context *net_device_ctx = netdev_priv(net);
> +     struct hv_device *dev = net_device_ctx->device_ctx;
> +     struct netvsc_device *nvdev = hv_get_drvdata(dev);
> +
> +     if (!nvdev)
> +             return 0;
> +     return nvdev->num_chn;
> +}
> +
> +static void netvsc_get_channels(struct net_device *net,
> +                             struct ethtool_channels *channel)
> +{
> +     int ret;
> +
> +     ret = netvsc_get_channels_combined_count(net);
> +     if (ret > 0)
> +             channel->combined_count = ret;
> +}
> +
>  static int netvsc_change_mtu(struct net_device *ndev, int mtu)  {
>       struct net_device_context *ndevctx = netdev_priv(ndev); @@ -760,6
> +781,7 @@ static void netvsc_poll_controller(struct net_device *net)  static
> const struct ethtool_ops ethtool_ops = {
>       .get_drvinfo    = netvsc_get_drvinfo,
>       .get_link       = ethtool_op_get_link,
> +     .get_channels   = netvsc_get_channels,
>  };
> 
>  static const struct net_device_ops device_ops = {
> --
> 2.3.0

The netvsc_get_channels_combined_count() only gets the variable, please merge 
it 
into the netvsc_get_channels(). 

max_combined should also be assigned. In rndis_filter_device_add()
rsscap.num_recv_que contains the max. You should add another field to struct 
netvsc_device, so its value can be accessed later.

Thanks,
- Haiyang

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to