]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
r8169: make use of xmit_more and __netdev_sent_queue
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 25 Nov 2018 13:31:54 +0000 (14:31 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 25 Nov 2018 18:18:13 +0000 (10:18 -0800)
Make use of xmit_more and add the functionality introduced with
3e59020abf0f ("net: bql: add __netdev_tx_sent_queue()").
I used the mlx4 driver as template.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169.c

index 12811f18c134d3ff0f6e9980ecce8813fd8b31c4..3624e67aef72c92ed6e908e2c99ac2d381210126 100644 (file)
@@ -6069,6 +6069,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
        struct device *d = tp_to_dev(tp);
        dma_addr_t mapping;
        u32 opts[2], len;
+       bool stop_queue;
        int frags;
 
        if (unlikely(!rtl_tx_slots_avail(tp, skb_shinfo(skb)->nr_frags))) {
@@ -6110,8 +6111,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
        txd->opts2 = cpu_to_le32(opts[1]);
 
-       netdev_sent_queue(dev, skb->len);
-
        skb_tx_timestamp(skb);
 
        /* Force memory writes to complete before releasing descriptor */
@@ -6124,16 +6123,16 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
        tp->cur_tx += frags + 1;
 
-       RTL_W8(tp, TxPoll, NPQ);
+       stop_queue = !rtl_tx_slots_avail(tp, MAX_SKB_FRAGS);
+       if (unlikely(stop_queue))
+               netif_stop_queue(dev);
 
-       mmiowb();
+       if (__netdev_sent_queue(dev, skb->len, skb->xmit_more)) {
+               RTL_W8(tp, TxPoll, NPQ);
+               mmiowb();
+       }
 
-       if (!rtl_tx_slots_avail(tp, MAX_SKB_FRAGS)) {
-               /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must
-                * not miss a ring update when it notices a stopped queue.
-                */
-               smp_wmb();
-               netif_stop_queue(dev);
+       if (unlikely(stop_queue)) {
                /* Sync with rtl_tx:
                 * - publish queue status and cur_tx ring index (write barrier)
                 * - refresh dirty_tx ring index (read barrier).