netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: John Allen <jallen@linux.vnet.ibm.com>
Cc: netdev@vger.kernel.org,
	Thomas Falcon <tlfalcon@linux.vnet.ibm.com>,
	Nathan Fontenot <nfont@linux.vnet.ibm.com>
Subject: Re: [PATCH net-next 4/4] ibmvnic: Implement .get_channels
Date: Wed, 2 Aug 2017 20:07:42 -0700	[thread overview]
Message-ID: <20170802200742.065bb833@xeon-e3> (raw)
In-Reply-To: <68feac4e-73d3-a689-6199-d42c72785c14@linux.vnet.ibm.com>

On Wed, 2 Aug 2017 16:47:17 -0500
John Allen <jallen@linux.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);

  reply	other threads:[~2017-08-03  3:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 21:42 [PATCH net-next 0/4] ibmvnic: Improve ethtool functionality John Allen
2017-08-02 21:44 ` [PATCH net-next 1/4] ibmvnic: Implement per-queue statistics reporting John Allen
2017-08-02 21:45 ` [PATCH net-next 2/4] ibmvnic: Convert vnic server reported statistics to cpu endian John Allen
2017-08-02 21:46 ` [PATCH net-next 3/4] ibmvnic: Implement .get_ringparam John Allen
2017-08-02 21:47 ` [PATCH net-next 4/4] ibmvnic: Implement .get_channels John Allen
2017-08-03  3:07   ` Stephen Hemminger [this message]
2017-08-03 16:33 ` [PATCH net-next 0/4] ibmvnic: Improve ethtool functionality David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170802200742.065bb833@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=jallen@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nfont@linux.vnet.ibm.com \
    --cc=tlfalcon@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).