diff options
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index dda9d7b9a840..d4362befe7e2 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -2382,8 +2382,11 @@ EXPORT_SYMBOL(netdev_set_num_tc); | |||
| 2382 | */ | 2382 | */ |
| 2383 | int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq) | 2383 | int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq) |
| 2384 | { | 2384 | { |
| 2385 | bool disabling; | ||
| 2385 | int rc; | 2386 | int rc; |
| 2386 | 2387 | ||
| 2388 | disabling = txq < dev->real_num_tx_queues; | ||
| 2389 | |||
| 2387 | if (txq < 1 || txq > dev->num_tx_queues) | 2390 | if (txq < 1 || txq > dev->num_tx_queues) |
| 2388 | return -EINVAL; | 2391 | return -EINVAL; |
| 2389 | 2392 | ||
| @@ -2399,15 +2402,19 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq) | |||
| 2399 | if (dev->num_tc) | 2402 | if (dev->num_tc) |
| 2400 | netif_setup_tc(dev, txq); | 2403 | netif_setup_tc(dev, txq); |
| 2401 | 2404 | ||
| 2402 | if (txq < dev->real_num_tx_queues) { | 2405 | dev->real_num_tx_queues = txq; |
| 2406 | |||
| 2407 | if (disabling) { | ||
| 2408 | synchronize_net(); | ||
| 2403 | qdisc_reset_all_tx_gt(dev, txq); | 2409 | qdisc_reset_all_tx_gt(dev, txq); |
| 2404 | #ifdef CONFIG_XPS | 2410 | #ifdef CONFIG_XPS |
| 2405 | netif_reset_xps_queues_gt(dev, txq); | 2411 | netif_reset_xps_queues_gt(dev, txq); |
| 2406 | #endif | 2412 | #endif |
| 2407 | } | 2413 | } |
| 2414 | } else { | ||
| 2415 | dev->real_num_tx_queues = txq; | ||
| 2408 | } | 2416 | } |
| 2409 | 2417 | ||
| 2410 | dev->real_num_tx_queues = txq; | ||
| 2411 | return 0; | 2418 | return 0; |
| 2412 | } | 2419 | } |
| 2413 | EXPORT_SYMBOL(netif_set_real_num_tx_queues); | 2420 | EXPORT_SYMBOL(netif_set_real_num_tx_queues); |
