aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio/virtio_ring.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/virtio/virtio_ring.c')
-rw-r--r--drivers/virtio/virtio_ring.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 1dc04b6684e6..342bb0363fbe 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -220,7 +220,17 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
220 return ret; 220 return ret;
221} 221}
222 222
223static bool vring_restart(struct virtqueue *_vq) 223static void vring_disable_cb(struct virtqueue *_vq)
224{
225 struct vring_virtqueue *vq = to_vvq(_vq);
226
227 START_USE(vq);
228 BUG_ON(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
229 vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
230 END_USE(vq);
231}
232
233static bool vring_enable_cb(struct virtqueue *_vq)
224{ 234{
225 struct vring_virtqueue *vq = to_vvq(_vq); 235 struct vring_virtqueue *vq = to_vvq(_vq);
226 236
@@ -254,8 +264,8 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
254 return IRQ_HANDLED; 264 return IRQ_HANDLED;
255 265
256 pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); 266 pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
257 if (vq->vq.callback && !vq->vq.callback(&vq->vq)) 267 if (vq->vq.callback)
258 vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; 268 vq->vq.callback(&vq->vq);
259 269
260 return IRQ_HANDLED; 270 return IRQ_HANDLED;
261} 271}
@@ -264,7 +274,8 @@ static struct virtqueue_ops vring_vq_ops = {
264 .add_buf = vring_add_buf, 274 .add_buf = vring_add_buf,
265 .get_buf = vring_get_buf, 275 .get_buf = vring_get_buf,
266 .kick = vring_kick, 276 .kick = vring_kick,
267 .restart = vring_restart, 277 .disable_cb = vring_disable_cb,
278 .enable_cb = vring_enable_cb,
268 .shutdown = vring_shutdown, 279 .shutdown = vring_shutdown,
269}; 280};
270 281
@@ -272,7 +283,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
272 struct virtio_device *vdev, 283 struct virtio_device *vdev,
273 void *pages, 284 void *pages,
274 void (*notify)(struct virtqueue *), 285 void (*notify)(struct virtqueue *),
275 bool (*callback)(struct virtqueue *)) 286 void (*callback)(struct virtqueue *))
276{ 287{
277 struct vring_virtqueue *vq; 288 struct vring_virtqueue *vq;
278 unsigned int i; 289 unsigned int i;