aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-02-04 23:50:07 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-02-04 07:50:07 -0500
commita48bd8f67003c342e147309a331f656a5e75a5e4 (patch)
tree30ab7e3b1763a526dbc1610960bcb5aa9c88dec5 /drivers
parente70f2f1bb8c8cf08ba0d836466f77eea27dd3474 (diff)
virtio: flush buffers on open
Fix bug found by Christian Borntraeger: if the other side fills all the registered network buffers before we enable NAPI, we will never get an interrupt. The simplest fix is to process the input queue once on open. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/virtio_net.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index be5688f5e931..bd4d26a36ead 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -283,6 +283,13 @@ static int virtnet_open(struct net_device *dev)
283 struct virtnet_info *vi = netdev_priv(dev); 283 struct virtnet_info *vi = netdev_priv(dev);
284 284
285 napi_enable(&vi->napi); 285 napi_enable(&vi->napi);
286
287 /* If all buffers were filled by other side before we napi_enabled, we
288 * won't get another interrupt, so process any outstanding packets
289 * now. virtnet_poll wants re-enable the queue, so we disable here. */
290 vi->rvq->vq_ops->disable_cb(vi->rvq);
291 netif_rx_schedule(vi->dev, &vi->napi);
292
286 return 0; 293 return 0;
287} 294}
288 295