ethtool: set device channel counts with CHANNELS_SET request
authorMichal Kubecek <mkubecek@suse.cz>
Thu, 12 Mar 2020 20:08:43 +0000 (21:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 12 Mar 2020 22:32:33 +0000 (15:32 -0700)
commite19c591eafad4d723a2eed385e253eca0506cc25
tree1450733e460f65eb9eb6a0b88a1dd96bc061fcc2
parent0c84979c951a85fcb5c77ac2480fd476e283a07c
ethtool: set device channel counts with CHANNELS_SET request

Implement CHANNELS_SET netlink request to set channel counts of a network
device. These are traditionally set with ETHTOOL_SCHANNELS ioctl request.

Like the ioctl implementation, the generic ethtool code checks if supplied
values do not exceed driver defined limits; if they do, first offending
attribute is reported using extack. Checks preventing removing channels
used for RX indirection table or zerocopy AF_XDP socket are also
implemented.

Move ethtool_get_max_rxfh_channel() helper into common.c so that it can be
used by both ioctl and netlink code.

v2:
  - fix netdev reference leak in error path (found by Jakub Kicinsky)

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/ethtool-netlink.rst
include/uapi/linux/ethtool_netlink.h
net/ethtool/channels.c
net/ethtool/common.c
net/ethtool/common.h
net/ethtool/ioctl.c
net/ethtool/netlink.c
net/ethtool/netlink.h