mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 23:04:43 +00:00
net: decreasing real_num_tx_queues needs to flush qdisc
Reducing real_num_queues needs to flush the qdisc otherwise skbs with queue_mappings greater then real_num_tx_queues can be sent to the underlying driver. The flow for this is, dev_queue_xmit() dev_pick_tx() skb_tx_hash() => hash using real_num_tx_queues skb_set_queue_mapping() ... qdisc_enqueue_root() => enqueue skb on txq from hash ... dev->real_num_tx_queues -= n ... sch_direct_xmit() dev_hard_start_xmit() ndo_start_xmit(skb,dev) => skb queue set with old hash skbs are enqueued on the qdisc with skb->queue_mapping set 0 < queue_mappings < real_num_tx_queues. When the driver decreases real_num_tx_queues skb's may be dequeued from the qdisc with a queue_mapping greater then real_num_tx_queues. This fixes a case in ixgbe where this was occurring with DCB and FCoE. Because the driver is using queue_mapping to map skbs to tx descriptor rings we can potentially map skbs to rings that no longer exist. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4ef6acff83
commit
f0796d5c73
4 changed files with 30 additions and 5 deletions
|
@ -1553,6 +1553,24 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
|
|||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine to help set real_num_tx_queues. To avoid skbs mapped to queues
|
||||
* greater then real_num_tx_queues stale skbs on the qdisc must be flushed.
|
||||
*/
|
||||
void netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)
|
||||
{
|
||||
unsigned int real_num = dev->real_num_tx_queues;
|
||||
|
||||
if (unlikely(txq > dev->num_tx_queues))
|
||||
;
|
||||
else if (txq > real_num)
|
||||
dev->real_num_tx_queues = txq;
|
||||
else if (txq < real_num) {
|
||||
dev->real_num_tx_queues = txq;
|
||||
qdisc_reset_all_tx_gt(dev, txq);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(netif_set_real_num_tx_queues);
|
||||
|
||||
static inline void __netif_reschedule(struct Qdisc *q)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue