Subject: Re: [PATCH net-next 4/4] ibmvnic: Implement .get_channels

From: Stephen Hemminger <[email-masked]>
Date: Wed, 2 Aug 2017 20:07:42 -0700

On Wed, 2 Aug 2017 16:47:17 -0500
John Allen <[email-masked]> wrote:

> +static void ibmvnic_get_channels(struct net_device *netdev,
> +				 struct ethtool_channels *channels)
> +{
> +	struct ibmvnic_adapter *adapter = netdev_priv(netdev);
> +
> +	channels->max_rx = adapter->max_rx_queues;
> +	channels->max_tx = adapter->max_tx_queues;
> +	channels->max_other = 0;
> +	channels->max_combined = 0;
> +	channels->rx_count = adapter->req_rx_queues;
> +	channels->tx_count = adapter->req_tx_queues;
> +	channels->other_count = 0;
> +	channels->combined_count = 0;
> +}

Minor nit, since the structure is already initialized to zero by caller,
you don't need to fill in the values that are zero.

static noinline_for_stack int ethtool_get_channels(struct net_device *dev,
						   void __user *useraddr)
{
	struct ethtool_channels channels = { .cmd = ETHTOOL_GCHANNELS };  << all unspecifed fields are zero'd

	if (!dev->ethtool_ops->get_channels)
		return -EOPNOTSUPP;

	dev->ethtool_ops->get_channels(dev, &channels);