ethtool: don't call set_channels in drivers if config didn't change

Don't call drivers if nothing changed. Netlink code already
contains this logic.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
This commit is contained in:
Jakub Kicinski 2020-05-15 12:49:02 -07:00 committed by Jianping Liu
parent 9384eb9ed3
commit 9d985c9308
1 changed files with 6 additions and 0 deletions

View File

@ -1634,6 +1634,12 @@ static noinline_for_stack int ethtool_set_channels(struct net_device *dev,
dev->ethtool_ops->get_channels(dev, &curr); dev->ethtool_ops->get_channels(dev, &curr);
if (channels.rx_count == curr.rx_count &&
channels.tx_count == curr.tx_count &&
channels.combined_count == curr.combined_count &&
channels.other_count == curr.other_count)
return 0;
/* ensure new counts are within the maximums */ /* ensure new counts are within the maximums */
if (channels.rx_count > curr.max_rx || if (channels.rx_count > curr.max_rx ||
channels.tx_count > curr.max_tx || channels.tx_count > curr.max_tx ||