[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170802200742.065bb833@xeon-e3>
Date: Wed, 2 Aug 2017 20:07:42 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: John Allen <jallen@...ux.vnet.ibm.com>
Cc: netdev@...r.kernel.org,
Thomas Falcon <tlfalcon@...ux.vnet.ibm.com>,
Nathan Fontenot <nfont@...ux.vnet.ibm.com>
Subject: Re: [PATCH net-next 4/4] ibmvnic: Implement .get_channels
On Wed, 2 Aug 2017 16:47:17 -0500
John Allen <jallen@...ux.vnet.ibm.com> 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);
Powered by blists - more mailing lists