Commit 28a0a044 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'net-track-the-queue-count-at-unregistration'

Antoine Tenart says:

====================
net: track the queue count at unregistration

Those two patches allow to track the Rx and Tx queue count at
unregistration and help in detecting illegal addition of Tx queues after
unregister (a warning is added).

This follows discussions on the following thread,
https://lore.kernel.org/all/20211122162007.303623-1-atenart@kernel.org/T/

A patch fixing one issue linked to this was merged ealier,
https://lore.kernel.org/all/20211203101318.435618-1-atenart@kernel.org/T/
====================

Link: https://lore.kernel.org/r/20211207145725.352657-1-atenart@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 16daf3d9 5f1c802c
......@@ -1694,6 +1694,13 @@ netdev_queue_update_kobjects(struct net_device *dev, int old_num, int new_num)
int i;
int error = 0;
/* Tx queue kobjects are allowed to be updated when a device is being
* unregistered, but solely to remove queues from qdiscs. Any path
* adding queues should be fixed.
*/
WARN(dev->reg_state == NETREG_UNREGISTERING && new_num > old_num,
"New queues can't be registered after device unregistration.");
for (i = old_num; i < new_num; i++) {
error = netdev_queue_add_kobject(dev, i);
if (error) {
......@@ -1808,6 +1815,9 @@ static void remove_queue_kobjects(struct net_device *dev)
net_rx_queue_update_kobjects(dev, real_rx, 0);
netdev_queue_update_kobjects(dev, real_tx, 0);
dev->real_num_rx_queues = 0;
dev->real_num_tx_queues = 0;
#ifdef CONFIG_SYSFS
kset_unregister(dev->queues_kset);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment