OSDN Git Service

ethtool: add infrastructure for centralized checking of coalescing parameters
authorJakub Kicinski <kuba@kernel.org>
Thu, 5 Mar 2020 05:15:31 +0000 (21:15 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Mar 2020 20:12:34 +0000 (12:12 -0800)
commit95cddcb5cc202d3f2499596b9af5b77536c5f86a
tree558330fa99180638accb6588e5172f351f14a914
parent56dc0a0eac999b77b1d37fe83a3c0409a6066319
ethtool: add infrastructure for centralized checking of coalescing parameters

Linux supports 22 different interrupt coalescing parameters.
No driver implements them all. Some drivers just ignore the
ones they don't support, while others have to carry a long
list of checks to reject unsupported settings.

To simplify the drivers add the ability to specify inside
ethtool_ops which parameters are supported and let the core
reject attempts to set any other one.

This commit makes the mechanism an opt-in, only drivers which
set ethtool_opts->coalesce_types to a non-zero value will have
the checks enforced.

The same mask is used for global and per queue settings.

v3: - move the (temporary) check if driver defines types
      earlier (Michal)
    - rename used_types -> nonzero_params, and
      coalesce_types -> supported_coalesce_params (Alex)
    - use EOPNOTSUPP instead of EINVAL (Andrew, Michal)

Leaving the long series of ifs for now, it seems nice to
be able to grep for the field and flag names. This will
probably have to be revisited once netlink support lands.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/ethtool.h
net/ethtool/ioctl.c