lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1455475677.2801.142.camel@decadent.org.uk>
Date:	Sun, 14 Feb 2016 18:47:57 +0000
From:	Ben Hutchings <ben@...adent.org.uk>
To:	Kan Liang <kan.liang@...el.com>, netdev@...r.kernel.org,
	davem@...emloft.net, bwh@...nel.org
Cc:	andi@...stfloor.org, jesse.brandeburg@...el.com,
	shannon.nelson@...el.com, f.fainelli@...il.com,
	alexander.duyck@...il.com, jeffrey.t.kirsher@...el.com,
	carolyn.wyborny@...el.com, donald.c.skidmore@...el.com,
	mitch.a.williams@...el.com, ogerlitz@...lanox.com,
	edumazet@...gle.com, jiri@...lanox.com, sfeldma@...il.com,
	gospo@...ulusnetworks.com, sasha.levin@...cle.com,
	dsahern@...il.com, tj@...nel.org, cascardo@...hat.com,
	corbet@....net, decot@...glers.com
Subject: Re: [PATCH V4 4/8] net/ethtool: support get coalesce per queue

On Mon, 2016-02-08 at 02:45 -0500, Kan Liang wrote:
> From: Kan Liang <kan.liang@...el.com>
> 
> This patch implements sub command ETHTOOL_GCOALESCE for ioctl
> ETHTOOL_PERQUEUE. It introduces an interface get_per_queue_coalesce to
> get coalesce of each masked queue from device driver. Then the interrupt
> coalescing parameters will be copied back to user space one by one.
> 
> Signed-off-by: Kan Liang <kan.liang@...el.com>
> ---
>  include/linux/ethtool.h | 10 +++++++++-
>  net/core/ethtool.c      | 34 +++++++++++++++++++++++++++++++++-
>  2 files changed, 42 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 653dc9c..a83566f 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -201,6 +201,13 @@ 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.
> + *	It needs to do range check for the input queue number. Only if
> + *	neither RX nor TX queue number is in the range, a negative error code
> + *	returns. For the case that only RX or only TX is not in the range,
> + *	zero should return. But related unavailable fields should be set to ~0,
> + *	which indicates RX or TX is not in the range.

This is poorly worded.  I suggest:

"It must check that the given queue number is valid. If neither a RX
nor a TX queue has this number, return -EINVAL. If only a RX queue or a
TX queue has this number, set the inapplicable fields to ~0 and return
0."

> + *	Returns a negative error code or zero.
>   *
>   * 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 +286,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 *);
[...]

Please change the queue number to be unsigned, so driver authors don't
need to consider whether they need to check for negative values.

Ben.

-- 
Ben Hutchings
Sturgeon's Law: Ninety percent of everything is crap.
Download attachment "signature.asc" of type "application/pgp-signature" (812 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ