virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: "Michael S. Tsirkin" <mst@redhat.com>,
	virtualization@lists.linux-foundation.org
Subject: [PATCH 5/5] virtio: make virtqueue_add_buf() returning 0 on success, not capacity.
Date: Wed, 17 Oct 2012 00:00:52 +1030	[thread overview]
Message-ID: <1350394252-23934-5-git-send-email-rusty@rustcorp.com.au> (raw)
In-Reply-To: <1350394252-23934-1-git-send-email-rusty@rustcorp.com.au>

Now noone relies on this behavior, we simplify virtqueue_add_buf() so it
return 0 or -errno.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 drivers/virtio/virtio_ring.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 335dcec..5fde312 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -181,10 +181,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq,
  * Caller must ensure we don't call this with other virtqueue operations
  * at the same time (except where noted).
  *
- * Returns remaining capacity of queue or a negative error
- * (ie. ENOSPC).  Note that it only really makes sense to treat all
- * positive return values as "available": indirect buffers mean that
- * we can put an entire sg[] array inside a single queue entry.
+ * Returns zero or a negative error (ie. ENOSPC, ENOMEM).
  */
 int virtqueue_add_buf(struct virtqueue *_vq,
 		      struct scatterlist sg[],
@@ -284,7 +281,7 @@ add_head:
 	pr_debug("Added buffer head %i to %p\n", head, vq);
 	END_USE(vq);
 
-	return vq->vq.num_free;
+	return 0;
 }
 EXPORT_SYMBOL_GPL(virtqueue_add_buf);
 
-- 
1.7.9.5

  parent reply	other threads:[~2012-10-16 13:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-16 13:30 [PATCH 1/5] virtio: move queue_index and num_free fields into core struct virtqueue Rusty Russell
2012-10-16 13:30 ` [PATCH 2/5] virtio-net: remove unused skb_vnet_hdr->num_sg field Rusty Russell
2012-10-16 13:30 ` [PATCH 3/5] virtio-net: correct capacity math on ring full Rusty Russell
2012-10-16 13:30 ` [PATCH 4/5] virtio_net: don't rely on virtqueue_add_buf() returning capacity Rusty Russell
2012-10-16 13:47   ` Michael S. Tsirkin
2012-10-16 13:30 ` Rusty Russell [this message]
2012-10-16 13:49   ` [PATCH 5/5] virtio: make virtqueue_add_buf() returning 0 on success, not capacity Rusty Russell
2012-10-16 13:53 ` [PATCH 1/5] virtio: move queue_index and num_free fields into core struct virtqueue Michael S. Tsirkin
2012-10-16 14:19   ` Rusty Russell
2012-10-16 14:34 ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350394252-23934-5-git-send-email-rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).