Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 87418
b: refs/heads/master
c: 4265f16
h: refs/heads/master
v: v3
  • Loading branch information
Christian Borntraeger authored and Rusty Russell committed Mar 17, 2008
1 parent 1487acc commit c36407b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da74e89d40995600b3b07ac500084920247687ce
refs/heads/master: 4265f161b6bb7b31163671329b1142b9023bf4e3
10 changes: 7 additions & 3 deletions trunk/drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,11 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
if (received < budget) {
netif_rx_complete(vi->dev, napi);
if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq))
&& netif_rx_reschedule(vi->dev, napi))
&& napi_schedule_prep(napi)) {
vi->rvq->vq_ops->disable_cb(vi->rvq);
__netif_rx_schedule(vi->dev, napi);
goto again;
}
}

return received;
Expand Down Expand Up @@ -278,10 +281,11 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
pr_debug("%s: virtio not prepared to send\n", dev->name);
netif_stop_queue(dev);

/* Activate callback for using skbs: if this fails it
/* Activate callback for using skbs: if this returns false it
* means some were used in the meantime. */
if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) {
printk("Unlikely: restart svq failed\n");
printk("Unlikely: restart svq race\n");
vi->svq->vq_ops->disable_cb(vi->svq);
netif_start_queue(dev);
goto again;
}
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/virtio/virtio_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ static bool vring_enable_cb(struct virtqueue *_vq)
vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
mb();
if (unlikely(more_used(vq))) {
vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
END_USE(vq);
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions trunk/include/linux/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ struct virtqueue
* vq: the struct virtqueue we're talking about.
* @enable_cb: restart callbacks after disable_cb.
* vq: the struct virtqueue we're talking about.
* This returns "false" (and doesn't re-enable) if there are pending
* buffers in the queue, to avoid a race.
* This re-enables callbacks; it returns "false" if there are pending
* buffers in the queue, to detect a possible race between the driver
* checking for more work, and enabling callbacks.
*
* Locking rules are straightforward: the driver is responsible for
* locking. No two operations may be invoked simultaneously.
Expand Down

0 comments on commit c36407b

Please sign in to comment.