net: add netif_set_real_num_queues() for device reconfig
authorJakub Kicinski <kuba@kernel.org>
Tue, 3 Aug 2021 13:05:26 +0000 (06:05 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Aug 2021 09:05:13 +0000 (10:05 +0100)
commit271e5b7d00aeff7c61fb6c5415d14dbedb783b68
tree91c56474249160912b4db782f265cd2a14be3370
parent8679c31e0284aa3aaba038035e443180b5bacb99
net: add netif_set_real_num_queues() for device reconfig

netif_set_real_num_rx_queues() and netif_set_real_num_tx_queues()
can fail which breaks drivers trying to implement reconfiguration
in a way that can't leave the device half-broken. In other words
those functions are incompatible with prepare/commit approach.

Luckily setting real number of queues can fail only if the number
is increased, meaning that if we order operations correctly we
can guarantee ending up with either new config (success), or
the old one (on error).

Provide a helper implementing such logic so that drivers don't
have to duplicate it.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dev.c