All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: kan.liang@intel.com, netdev@vger.kernel.org, davem@davemloft.net,
	bwh@kernel.org
Cc: jesse.brandeburg@intel.com, andi@firstfloor.org,
	f.fainelli@gmail.com, alexander.duyck@gmail.com,
	jeffrey.t.kirsher@intel.com, shannon.nelson@intel.com,
	carolyn.wyborny@intel.com, donald.c.skidmore@intel.com,
	mitch.a.williams@intel.com, ogerlitz@mellanox.com,
	edumazet@google.com, jiri@mellanox.com, sfeldma@gmail.com,
	gospo@cumulusnetworks.com, sasha.levin@oracle.com,
	dsahern@gmail.com, tj@kernel.org, cascardo@redhat.com,
	corbet@lwn.net
Subject: Re: [RFC 2/5] net/ethtool: support get coalesce per queue
Date: Sat, 19 Dec 2015 03:35:43 +0000	[thread overview]
Message-ID: <1450496143.30687.10.camel@decadent.org.uk> (raw)
In-Reply-To: <1450335081-3012-2-git-send-email-kan.liang@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2889 bytes --]

On Thu, 2015-12-17 at 06:51 +0000, kan.liang@intel.com wrote:
> From: Kan Liang <kan.liang@intel.com>
> 
> Device driver has to provide an interface to get per queue coalesce.
> The interrupt coalescing parameters of each masked queue will be
> copied back to user space one by one.
> 
> Signed-off-by: Kan Liang <kan.liang@intel.com>
> ---
>  include/linux/ethtool.h |  5 ++++-
>  net/core/ethtool.c      | 33 ++++++++++++++++++++++++++++++++-
>  2 files changed, 36 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 653dc9c..107f75f 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -201,6 +201,8 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
>   * @get_module_eeprom: Get the eeprom information from the plug-in module
>   * @get_eee: Get Energy-Efficient (EEE) supported and status.
>   * @set_eee: Set EEE status (enable/disable) as well as LPI timers.
> + * @get_per_queue_coalesce: Get interrupt coalescing parameters per queue.
> + * 	Returns a negative error code or zero.

Is the ethtool core or the driver responsible for range-checking the
queue number?

What is reported if the queue number is in range for RX queues but not
for TX queues (or vice versa)?

>   *
>   * All operations are optional (i.e. the function pointer may be set
>   * to %NULL) and callers must take this into account.  Callers must
> @@ -279,7 +281,8 @@ struct ethtool_ops {
>  			       const struct ethtool_tunable *, void *);
>  	int	(*set_tunable)(struct net_device *,
>  			       const struct ethtool_tunable *, const void *);
> -
> +	int	(*get_per_queue_coalesce)(struct net_device *, int,
> +					  struct ethtool_coalesce *);
>  
>  };
>  #endif /* _LINUX_ETHTOOL_H */
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 125fb32..22ff69a 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -1748,6 +1748,36 @@ out:
>  	return ret;
>  }
>  
> +static int ethtool_get_per_queue_coalesce(struct net_device *dev,
> +					  void __user *useraddr,
> +					  struct ethtool_per_queue_op *per_queue_opt)
> +{
> +	u64 queue_mask;
> +	int bit, i, ret;
> +
> +	if (!dev->ethtool_ops->get_per_queue_coalesce)
> +		return -EOPNOTSUPP;
> +
> +	useraddr += sizeof(*per_queue_opt);
> +	for (i = 0; i < MAX_QUEUE_MASK; i++) {
> +		queue_mask = per_queue_opt->queue_mask[i];
> +		if (queue_mask > 0) {
> +			for_each_set_bit(bit, (unsigned long *)&queue_mask, 64) {
[...]

This assumes a little-endian system.

You should probably build on top of David Decotigny's recent patch
series that adds conversion of u32-based bitmaps to kernel bitmaps.

Ben.

-- 
Ben Hutchings
Always try to do things in chronological order;
it's less confusing that way.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  reply	other threads:[~2015-12-19  3:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17  6:51 [RFC 1/5] net/ethtool: introduce a new ioctl for per queue setting kan.liang
2015-12-17  6:51 ` [RFC 2/5] net/ethtool: support get coalesce per queue kan.liang
2015-12-19  3:35   ` Ben Hutchings [this message]
2015-12-21 20:12     ` Liang, Kan
2015-12-17  6:51 ` [RFC 3/5] net/ethtool: support set " kan.liang
2015-12-19  3:38   ` Ben Hutchings
2015-12-21 20:33     ` Liang, Kan
2015-12-17  6:51 ` [RFC 4/5] i40e/ethtool: support coalesce getting by queue kan.liang
2015-12-17 22:43   ` Nelson, Shannon
2015-12-17  6:51 ` [RFC 5/5] i40e/ethtool: support coalesce setting " kan.liang
2015-12-17 22:47   ` Nelson, Shannon
2015-12-18 21:05     ` Liang, Kan
2015-12-21 16:49       ` Nelson, Shannon
2015-12-19  3:27 ` [RFC 1/5] net/ethtool: introduce a new ioctl for per queue setting Ben Hutchings
2015-12-19  3:37   ` Ben Hutchings
2015-12-21 20:03   ` Liang, Kan

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=1450496143.30687.10.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=alexander.duyck@gmail.com \
    --cc=andi@firstfloor.org \
    --cc=bwh@kernel.org \
    --cc=carolyn.wyborny@intel.com \
    --cc=cascardo@redhat.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=donald.c.skidmore@intel.com \
    --cc=dsahern@gmail.com \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=gospo@cumulusnetworks.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jiri@mellanox.com \
    --cc=kan.liang@intel.com \
    --cc=mitch.a.williams@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=sasha.levin@oracle.com \
    --cc=sfeldma@gmail.com \
    --cc=shannon.nelson@intel.com \
    --cc=tj@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.