diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/realtek/r8169.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index d039d39963a..859554a03a0 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -5559,7 +5559,18 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
5559 | mmiowb(); | 5559 | mmiowb(); |
5560 | 5560 | ||
5561 | if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) { | 5561 | if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) { |
5562 | /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must | ||
5563 | * not miss a ring update when it notices a stopped queue. | ||
5564 | */ | ||
5565 | smp_wmb(); | ||
5562 | netif_stop_queue(dev); | 5566 | netif_stop_queue(dev); |
5567 | /* Sync with rtl_tx: | ||
5568 | * - publish queue status and cur_tx ring index (write barrier) | ||
5569 | * - refresh dirty_tx ring index (read barrier). | ||
5570 | * May the current thread have a pessimistic view of the ring | ||
5571 | * status and forget to wake up queue, a racing rtl_tx thread | ||
5572 | * can't. | ||
5573 | */ | ||
5563 | smp_mb(); | 5574 | smp_mb(); |
5564 | if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS) | 5575 | if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS) |
5565 | netif_wake_queue(dev); | 5576 | netif_wake_queue(dev); |
@@ -5659,6 +5670,13 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) | |||
5659 | 5670 | ||
5660 | if (tp->dirty_tx != dirty_tx) { | 5671 | if (tp->dirty_tx != dirty_tx) { |
5661 | tp->dirty_tx = dirty_tx; | 5672 | tp->dirty_tx = dirty_tx; |
5673 | /* Sync with rtl8169_start_xmit: | ||
5674 | * - publish dirty_tx ring index (write barrier) | ||
5675 | * - refresh cur_tx ring index and queue status (read barrier) | ||
5676 | * May the current thread miss the stopped queue condition, | ||
5677 | * a racing xmit thread can only have a right view of the | ||
5678 | * ring status. | ||
5679 | */ | ||
5662 | smp_mb(); | 5680 | smp_mb(); |
5663 | if (netif_queue_stopped(dev) && | 5681 | if (netif_queue_stopped(dev) && |
5664 | (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) { | 5682 | (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) { |