aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 19fd4cb0ddf8..b58472cf76f8 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -203,8 +203,11 @@ again:
203 if (received < budget) { 203 if (received < budget) {
204 netif_rx_complete(vi->dev, napi); 204 netif_rx_complete(vi->dev, napi);
205 if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) 205 if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq))
206 && netif_rx_reschedule(vi->dev, napi)) 206 && napi_schedule_prep(napi)) {
207 vi->rvq->vq_ops->disable_cb(vi->rvq);
208 __netif_rx_schedule(vi->dev, napi);
207 goto again; 209 goto again;
210 }
208 } 211 }
209 212
210 return received; 213 return received;
@@ -278,10 +281,11 @@ again:
278 pr_debug("%s: virtio not prepared to send\n", dev->name); 281 pr_debug("%s: virtio not prepared to send\n", dev->name);
279 netif_stop_queue(dev); 282 netif_stop_queue(dev);
280 283
281 /* Activate callback for using skbs: if this fails it 284 /* Activate callback for using skbs: if this returns false it
282 * means some were used in the meantime. */ 285 * means some were used in the meantime. */
283 if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) { 286 if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) {
284 printk("Unlikely: restart svq failed\n"); 287 printk("Unlikely: restart svq race\n");
288 vi->svq->vq_ops->disable_cb(vi->svq);
285 netif_start_queue(dev); 289 netif_start_queue(dev);
286 goto again; 290 goto again;
287 } 291 }
@@ -294,6 +298,15 @@ again:
294 return 0; 298 return 0;
295} 299}
296 300
301#ifdef CONFIG_NET_POLL_CONTROLLER
302static void virtnet_netpoll(struct net_device *dev)
303{
304 struct virtnet_info *vi = netdev_priv(dev);
305
306 napi_schedule(&vi->napi);
307}
308#endif
309
297static int virtnet_open(struct net_device *dev) 310static int virtnet_open(struct net_device *dev)
298{ 311{
299 struct virtnet_info *vi = netdev_priv(dev); 312 struct virtnet_info *vi = netdev_priv(dev);
@@ -336,6 +349,9 @@ static int virtnet_probe(struct virtio_device *vdev)
336 dev->stop = virtnet_close; 349 dev->stop = virtnet_close;
337 dev->hard_start_xmit = start_xmit; 350 dev->hard_start_xmit = start_xmit;
338 dev->features = NETIF_F_HIGHDMA; 351 dev->features = NETIF_F_HIGHDMA;
352#ifdef CONFIG_NET_POLL_CONTROLLER
353 dev->poll_controller = virtnet_netpoll;
354#endif
339 SET_NETDEV_DEV(dev, &vdev->dev); 355 SET_NETDEV_DEV(dev, &vdev->dev);
340 356
341 /* Do we support "hardware" checksums? */ 357 /* Do we support "hardware" checksums? */