mirror of
https://github.com/adulau/aha.git
synced 2024-12-30 20:56:23 +00:00
virtio: force callback on empty.
virtio allows drivers to suppress callbacks (ie. interrupts) for efficiency (no locking, it's just an optimization). There's a similar mechanism for the host to suppress notifications coming from the guest: in that case, we ignore the suppression if the ring is completely full. It turns out that life is simpler if the host similarly ignores callback suppression when the ring is completely empty: the network driver wants to free up old packets in a timely manner, and otherwise has to use a timer to poll. We have to remove the code which ignores interrupts when the driver has disabled them (again, it had no locking and hence was unreliable anyway). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
7757f09c70
commit
b4f68be6c5
2 changed files with 4 additions and 7 deletions
|
@ -253,13 +253,6 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
|
||||||
if (unlikely(vq->broken))
|
if (unlikely(vq->broken))
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
|
|
||||||
/* Other side may have missed us turning off the interrupt,
|
|
||||||
* but we should preserve disable semantic for virtio users. */
|
|
||||||
if (unlikely(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) {
|
|
||||||
pr_debug("virtqueue interrupt after disable for %p\n", vq);
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
|
pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
|
||||||
if (vq->vq.callback)
|
if (vq->vq.callback)
|
||||||
vq->vq.callback(&vq->vq);
|
vq->vq.callback(&vq->vq);
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
/* We've given up on this device. */
|
/* We've given up on this device. */
|
||||||
#define VIRTIO_CONFIG_S_FAILED 0x80
|
#define VIRTIO_CONFIG_S_FAILED 0x80
|
||||||
|
|
||||||
|
/* Do we get callbacks when the ring is completely used, even if we've
|
||||||
|
* suppressed them? */
|
||||||
|
#define VIRTIO_F_NOTIFY_ON_EMPTY 24
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
#include <linux/virtio.h>
|
#include <linux/virtio.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue