On Mon, 2016-02-08 at 02:45 -0500, Kan Liang wrote:
> From: Kan Liang <[email protected]>
> 
> 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 <[email protected]>
> ---
>  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.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to