]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit39a71dc7c4dfd66c43f084c5fd27109030436e36
tree91c56474249160912b4db782f265cd2a14be3370
parent51450914d8a604dc024d7ca8604fa2fce77fd48d
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