virtio: flush buffers on open
[powerpc.git] / drivers / net / virtio_net.c
index ec43284..bd4d26a 100644 (file)
@@ -283,6 +283,13 @@ static int virtnet_open(struct net_device *dev)
        struct virtnet_info *vi = netdev_priv(dev);
 
        napi_enable(&vi->napi);
+
+       /* If all buffers were filled by other side before we napi_enabled, we
+        * won't get another interrupt, so process any outstanding packets
+        * now.  virtnet_poll wants re-enable the queue, so we disable here. */
+       vi->rvq->vq_ops->disable_cb(vi->rvq);
+       netif_rx_schedule(vi->dev, &vi->napi);
+
        return 0;
 }
 
@@ -307,7 +314,6 @@ static int virtnet_probe(struct virtio_device *vdev)
                return -ENOMEM;
 
        /* Set up network device as normal. */
-       ether_setup(dev);
        dev->open = virtnet_open;
        dev->stop = virtnet_close;
        dev->hard_start_xmit = start_xmit;
@@ -390,13 +396,14 @@ static void virtnet_remove(struct virtio_device *vdev)
        struct virtnet_info *vi = vdev->priv;
        struct sk_buff *skb;
 
+       /* Stop all the virtqueues. */
+       vdev->config->reset(vdev);
+
        /* Free our skbs in send and recv queues, if any. */
-       vi->rvq->vq_ops->shutdown(vi->rvq);
        while ((skb = __skb_dequeue(&vi->recv)) != NULL) {
                kfree_skb(skb);
                vi->num--;
        }
-       vi->svq->vq_ops->shutdown(vi->svq);
        while ((skb = __skb_dequeue(&vi->send)) != NULL)
                kfree_skb(skb);