aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netback/interface.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2014-10-22 09:08:55 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-25 14:15:20 -0400
commitecf08d2dbb96d5a4b4bcc53a39e8d29cc8fef02e (patch)
tree081341a32e4d7954ea805b145c18176876905ca7 /drivers/net/xen-netback/interface.c
parentf48da8b14d04ca87ffcffe68829afd45f926ec6a (diff)
xen-netback: reintroduce guest Rx stall detection
If a frontend not receiving packets it is useful to detect this and turn off the carrier so packets are dropped early instead of being queued and drained when they expire. A to-guest queue is stalled if it doesn't have enough free slots for a an extended period of time (default 60 s). If at least one queue is stalled, the carrier is turned off (in the expectation that the other queues will soon stall as well). The carrier is only turned on once all queues are ready. When the frontend connects, all the queues start in the stalled state and only become ready once the frontend queues enough Rx requests. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netback/interface.c')
-rw-r--r--drivers/net/xen-netback/interface.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index a134d52f55b4..895fe84011e7 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -419,6 +419,8 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
419 vif->queues = NULL; 419 vif->queues = NULL;
420 vif->num_queues = 0; 420 vif->num_queues = 0;
421 421
422 spin_lock_init(&vif->lock);
423
422 dev->netdev_ops = &xenvif_netdev_ops; 424 dev->netdev_ops = &xenvif_netdev_ops;
423 dev->hw_features = NETIF_F_SG | 425 dev->hw_features = NETIF_F_SG |
424 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 426 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
@@ -505,7 +507,6 @@ void xenvif_carrier_on(struct xenvif *vif)
505 dev_set_mtu(vif->dev, ETH_DATA_LEN); 507 dev_set_mtu(vif->dev, ETH_DATA_LEN);
506 netdev_update_features(vif->dev); 508 netdev_update_features(vif->dev);
507 set_bit(VIF_STATUS_CONNECTED, &vif->status); 509 set_bit(VIF_STATUS_CONNECTED, &vif->status);
508 netif_carrier_on(vif->dev);
509 if (netif_running(vif->dev)) 510 if (netif_running(vif->dev))
510 xenvif_up(vif); 511 xenvif_up(vif);
511 rtnl_unlock(); 512 rtnl_unlock();
@@ -565,6 +566,8 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
565 disable_irq(queue->rx_irq); 566 disable_irq(queue->rx_irq);
566 } 567 }
567 568
569 queue->stalled = true;
570
568 task = kthread_create(xenvif_kthread_guest_rx, 571 task = kthread_create(xenvif_kthread_guest_rx,
569 (void *)queue, "%s-guest-rx", queue->name); 572 (void *)queue, "%s-guest-rx", queue->name);
570 if (IS_ERR(task)) { 573 if (IS_ERR(task)) {