All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: virtualization@lists.linux-foundation.org
Subject: [PATCH 21/22] tools/virtio: remove virtqueue_add_buf() from tests.
Date: Mon, 18 Mar 2013 20:04:52 +1030	[thread overview]
Message-ID: <1363599293-23065-22-git-send-email-rusty@rustcorp.com.au> (raw)
In-Reply-To: <1363599293-23065-1-git-send-email-rusty@rustcorp.com.au>

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 tools/virtio/linux/virtio.h |    7 -------
 tools/virtio/virtio_test.c  |    6 +++---
 tools/virtio/vringh_test.c  |   22 ++++++++++++----------
 3 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h
index 6df181a..cd80183 100644
--- a/tools/virtio/linux/virtio.h
+++ b/tools/virtio/linux/virtio.h
@@ -49,13 +49,6 @@ struct virtqueue {
 	const char *__MODULE_LICENSE_name = __MODULE_LICENSE_value
 
 /* Interfaces exported by virtio_ring. */
-int virtqueue_add_buf(struct virtqueue *vq,
-		      struct scatterlist sg[],
-		      unsigned int out_num,
-		      unsigned int in_num,
-		      void *data,
-		      gfp_t gfp);
-
 int virtqueue_add_sgs(struct virtqueue *vq,
 		      struct scatterlist *sgs[],
 		      unsigned int out_sgs,
diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c
index 814ae80..da7a195 100644
--- a/tools/virtio/virtio_test.c
+++ b/tools/virtio/virtio_test.c
@@ -166,9 +166,9 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq,
 		do {
 			if (started < bufs) {
 				sg_init_one(&sl, dev->buf, dev->buf_size);
-				r = virtqueue_add_buf(vq->vq, &sl, 1, 0,
-						      dev->buf + started,
-						      GFP_ATOMIC);
+				r = virtqueue_add_outbuf(vq->vq, &sl, 1,
+							 dev->buf + started,
+							 GFP_ATOMIC);
 				if (likely(r == 0)) {
 					++started;
 					virtqueue_kick(vq->vq);
diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c
index 88fe02a..760db1c 100644
--- a/tools/virtio/vringh_test.c
+++ b/tools/virtio/vringh_test.c
@@ -388,7 +388,7 @@ static int parallel_test(unsigned long features,
 			}
 
 			if (err)
-				errx(1, "virtqueue_add_buf: %i", err);
+				errx(1, "virtqueue_add_in/outbuf: %i", err);
 
 			xfers++;
 			virtqueue_kick(vq);
@@ -431,7 +431,7 @@ int main(int argc, char *argv[])
 	struct virtio_device vdev;
 	struct virtqueue *vq;
 	struct vringh vrh;
-	struct scatterlist guest_sg[RINGSIZE];
+	struct scatterlist guest_sg[RINGSIZE], *sgs[2];
 	struct iovec host_riov[2], host_wiov[2];
 	struct vringh_iov riov, wiov;
 	struct vring_used_elem used[RINGSIZE];
@@ -492,12 +492,14 @@ int main(int argc, char *argv[])
 	sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1);
 	sg_init_table(guest_sg+1, 1);
 	sg_set_buf(&guest_sg[1], __user_addr_max - 3, 2);
+	sgs[0] = &guest_sg[0];
+	sgs[1] = &guest_sg[1];
 
 	/* May allocate an indirect, so force it to allocate user addr */
 	__kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN);
-	err = virtqueue_add_buf(vq, guest_sg, 1, 1, &err, GFP_KERNEL);
+	err = virtqueue_add_sgs(vq, sgs, 1, 1, &err, GFP_KERNEL);
 	if (err)
-		errx(1, "virtqueue_add_buf: %i", err);
+		errx(1, "virtqueue_add_sgs: %i", err);
 	__kmalloc_fake = NULL;
 
 	/* Host retreives it. */
@@ -564,9 +566,9 @@ int main(int argc, char *argv[])
 
 	/* This will allocate an indirect, so force it to allocate user addr */
 	__kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN);
-	err = virtqueue_add_buf(vq, guest_sg, RINGSIZE, 0, &err, GFP_KERNEL);
+	err = virtqueue_add_outbuf(vq, guest_sg, RINGSIZE, &err, GFP_KERNEL);
 	if (err)
-		errx(1, "virtqueue_add_buf (large): %i", err);
+		errx(1, "virtqueue_add_outbuf (large): %i", err);
 	__kmalloc_fake = NULL;
 
 	/* Host picks it up (allocates new iov). */
@@ -616,9 +618,9 @@ int main(int argc, char *argv[])
 	sg_init_table(guest_sg, 1);
 	sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1);
 	for (i = 0; i < RINGSIZE; i++) {
-		err = virtqueue_add_buf(vq, guest_sg, 1, 0, &err, GFP_KERNEL);
+		err = virtqueue_add_outbuf(vq, guest_sg, 1, &err, GFP_KERNEL);
 		if (err)
-			errx(1, "virtqueue_add_buf (multiple): %i", err);
+			errx(1, "virtqueue_add_outbuf (multiple): %i", err);
 	}
 
 	/* Now get many, and consume them all at once. */
@@ -665,9 +667,9 @@ int main(int argc, char *argv[])
 		sg_set_buf(&guest_sg[2], data + 6, 4);
 		sg_set_buf(&guest_sg[3], d + 3, sizeof(*d)*3);
 
-		err = virtqueue_add_buf(vq, guest_sg, 4, 0, &err, GFP_KERNEL);
+		err = virtqueue_add_outbuf(vq, guest_sg, 4, &err, GFP_KERNEL);
 		if (err)
-			errx(1, "virtqueue_add_buf (indirect): %i", err);
+			errx(1, "virtqueue_add_outbuf (indirect): %i", err);
 
 		vring_init(&vring, RINGSIZE, __user_addr_min, ALIGN);
 
-- 
1.7.10.4

  parent reply	other threads:[~2013-03-18  9:34 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18  9:34 [PATCH 00/22] virtqueue_add_sgs, virtqueue_add_outbuf, virtqueue_add_inbuf Rusty Russell
2013-03-18  9:34 ` [PATCH 01/22] scatterlist: introduce sg_unmark_end Rusty Russell
2013-03-18  9:34 ` [PATCH 02/22] virtio_ring: virtqueue_add_sgs, to add multiple sgs Rusty Russell
2013-03-18  9:34 ` [PATCH 03/22] virtio_ring: don't count elements twice for add_buf path Rusty Russell
2013-03-18  9:34 ` [PATCH 04/22] virtio_ring: inline internal vring functions more aggressively Rusty Russell
2013-03-18  9:34 ` [PATCH 05/22] virtio_ring: virtqueue_add_outbuf / virtqueue_add_inbuf Rusty Russell
2013-03-18  9:34 ` [PATCH 06/22] tools/virtio: make vringh_test use inbuf/outbuf Rusty Russell
2013-03-18  9:34 ` [PATCH 07/22] virtio-blk: reorganize virtblk_add_req Rusty Russell
2013-03-18  9:34 ` [PATCH 08/22] virtio-blk: use virtqueue_add_sgs on bio path Rusty Russell
2013-03-18  9:34 ` [PATCH 09/22] virtio-blk: use virtqueue_add_sgs on req path Rusty Russell
2013-03-18  9:34 ` [PATCH 10/22] virtio_blk: remove nents member Rusty Russell
2013-03-18  9:34 ` [PATCH 11/22] virtio-scsi: use virtqueue_add_sgs for command buffers Rusty Russell
2013-03-19  6:51   ` Asias He
2013-03-19  9:48     ` [PATCH V2 " Wanlong Gao
2013-03-19 10:35       ` Paolo Bonzini
2013-03-20  0:35       ` Rusty Russell
2013-03-20  4:43       ` Asias He
2013-03-18  9:34 ` [PATCH 12/22] virtio_scsi: use virtqueue_add_inbuf() for virtscsi_kick_event Rusty Russell
2013-03-20  1:19   ` Asias He
2013-03-18  9:34 ` [PATCH 13/22] virtio_net: use virtqueue_add_sgs[] for command buffers Rusty Russell
2013-03-18 11:10   ` Michael S. Tsirkin
2013-03-18 23:47     ` Rusty Russell
2013-03-19  0:00     ` Wanlong Gao
2013-03-18  9:34 ` [PATCH 14/22] virtio_net: use simplified virtqueue accessors Rusty Russell
2013-03-20  1:20   ` Asias He
2013-03-18  9:34 ` [PATCH 15/22] virtio_rng: " Rusty Russell
2013-03-20  1:18   ` Asias He
2013-03-18  9:34 ` [PATCH 16/22] virtio_console: " Rusty Russell
2013-03-18 10:10   ` Amit Shah
2013-03-18  9:34 ` [PATCH 17/22] caif_virtio: " Rusty Russell
2013-03-18  9:34 ` [PATCH 18/22] virtio_rpmsg_bus: " Rusty Russell
2013-03-20 10:08   ` Ohad Ben-Cohen
2013-03-20 23:28     ` Rusty Russell
2013-03-18  9:34 ` [PATCH 19/22] virtio_balloon: " Rusty Russell
2013-03-18  9:34 ` [PATCH 20/22] 9p/trans_virtio.c: use virtio_add_sgs[] Rusty Russell
2013-03-20  4:53   ` Rusty Russell
2013-03-18  9:34 ` Rusty Russell [this message]
2013-03-18  9:34 ` [PATCH 22/22] virtio: remove virtqueue_add_buf() Rusty Russell
2013-03-20  5:20 ` [PATCH 00/22] virtqueue_add_sgs, virtqueue_add_outbuf, virtqueue_add_inbuf Rusty Russell
2013-03-20  6:01   ` Asias He

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=1363599293-23065-22-git-send-email-rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.