xen-netback: immediately wake tx queue when guest rx queue has space
authorDavid Vrabel <david.vrabel@citrix.com>
Tue, 4 Oct 2016 09:29:15 +0000 (10:29 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Oct 2016 00:37:35 +0000 (20:37 -0400)
When an skb is removed from the guest rx queue, immediately wake the
tx queue, instead of after processing them.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
[re-based]
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/xen-netback/rx.c

index b0ce4c6e9b21558762545aac790b22695dc758b6..95487091763c5336ad0d83e0ac82b7b4df6a8562 100644 (file)
@@ -92,25 +92,19 @@ static struct sk_buff *xenvif_rx_dequeue(struct xenvif_queue *queue)
        spin_lock_irq(&queue->rx_queue.lock);
 
        skb = __skb_dequeue(&queue->rx_queue);
-       if (skb)
+       if (skb) {
                queue->rx_queue_len -= skb->len;
+               if (queue->rx_queue_len < queue->rx_queue_max) {
+                       struct netdev_queue *txq;
 
-       spin_unlock_irq(&queue->rx_queue.lock);
-
-       return skb;
-}
-
-static void xenvif_rx_queue_maybe_wake(struct xenvif_queue *queue)
-{
-       spin_lock_irq(&queue->rx_queue.lock);
-
-       if (queue->rx_queue_len < queue->rx_queue_max) {
-               struct net_device *dev = queue->vif->dev;
-
-               netif_tx_wake_queue(netdev_get_tx_queue(dev, queue->id));
+                       txq = netdev_get_tx_queue(queue->vif->dev, queue->id);
+                       netif_tx_wake_queue(txq);
+               }
        }
 
        spin_unlock_irq(&queue->rx_queue.lock);
+
+       return skb;
 }
 
 static void xenvif_rx_queue_purge(struct xenvif_queue *queue)
@@ -585,8 +579,6 @@ int xenvif_kthread_guest_rx(void *data)
                 */
                xenvif_rx_queue_drop_expired(queue);
 
-               xenvif_rx_queue_maybe_wake(queue);
-
                cond_resched();
        }