mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
virtio: make add_buf return capacity remaining
This API change means that virtio_net can tell how much capacity remains for buffers. It's necessarily fuzzy, since VIRTIO_RING_F_INDIRECT_DESC means we can fit any number of descriptors in one, *if* we can kmalloc. Signed-off-by: Rusty Russell <[email protected]> Cc: Dinesh Subhraveti <[email protected]>
This commit is contained in:
parent
f68d24082e
commit
3c1b27d504
8 changed files with 19 additions and 15 deletions
|
|
@ -84,7 +84,7 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq)
|
|||
init_completion(&vb->acked);
|
||||
|
||||
/* We should always be able to add one buffer to an empty queue. */
|
||||
if (vq->vq_ops->add_buf(vq, &sg, 1, 0, vb) != 0)
|
||||
if (vq->vq_ops->add_buf(vq, &sg, 1, 0, vb) < 0)
|
||||
BUG();
|
||||
vq->vq_ops->kick(vq);
|
||||
|
||||
|
|
|
|||
|
|
@ -208,7 +208,11 @@ add_head:
|
|||
|
||||
pr_debug("Added buffer head %i to %p\n", head, vq);
|
||||
END_USE(vq);
|
||||
return 0;
|
||||
|
||||
/* If we're indirect, we can fit many (assuming not OOM). */
|
||||
if (vq->indirect)
|
||||
return vq->num_free ? vq->vring.num : 0;
|
||||
return vq->num_free;
|
||||
}
|
||||
|
||||
static void vring_kick(struct virtqueue *_vq)
|
||||
|
|
|
|||
Loading…
Reference in a new issue