From: Shunsuke Mie <mie@igel.co.jp>
To: "Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Rusty Russell <rusty@rustcorp.com.au>
Cc: netdev@vger.kernel.org, Shunsuke Mie <mie@igel.co.jp>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: [RFC PATCH v2 4/7] tools/virtio: convert to new vringh user APIs
Date: Thu, 2 Feb 2023 18:09:31 +0900 [thread overview]
Message-ID: <20230202090934.549556-5-mie@igel.co.jp> (raw)
In-Reply-To: <20230202090934.549556-1-mie@igel.co.jp>
struct vringh_iov is being remove, so convert vringh_test to use the
vringh user APIs. This has it change to use struct vringh_kiov instead of
the struct vringh_iov.
Signed-off-by: Shunsuke Mie <mie@igel.co.jp>
---
tools/virtio/vringh_test.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c
index 98ff808d6f0c..6c9533b8a2ca 100644
--- a/tools/virtio/vringh_test.c
+++ b/tools/virtio/vringh_test.c
@@ -193,8 +193,8 @@ static int parallel_test(u64 features,
errx(1, "Could not set affinity to cpu %u", first_cpu);
while (xfers < NUM_XFERS) {
- struct iovec host_riov[2], host_wiov[2];
- struct vringh_iov riov, wiov;
+ struct kvec host_riov[2], host_wiov[2];
+ struct vringh_kiov riov, wiov;
u16 head, written;
if (fast_vringh) {
@@ -216,10 +216,10 @@ static int parallel_test(u64 features,
written = 0;
goto complete;
} else {
- vringh_iov_init(&riov,
+ vringh_kiov_init(&riov,
host_riov,
ARRAY_SIZE(host_riov));
- vringh_iov_init(&wiov,
+ vringh_kiov_init(&wiov,
host_wiov,
ARRAY_SIZE(host_wiov));
@@ -442,8 +442,8 @@ int main(int argc, char *argv[])
struct virtqueue *vq;
struct vringh vrh;
struct scatterlist guest_sg[RINGSIZE], *sgs[2];
- struct iovec host_riov[2], host_wiov[2];
- struct vringh_iov riov, wiov;
+ struct kvec host_riov[2], host_wiov[2];
+ struct vringh_kiov riov, wiov;
struct vring_used_elem used[RINGSIZE];
char buf[28];
u16 head;
@@ -517,8 +517,8 @@ int main(int argc, char *argv[])
__kmalloc_fake = NULL;
/* Host retreives it. */
- vringh_iov_init(&riov, host_riov, ARRAY_SIZE(host_riov));
- vringh_iov_init(&wiov, host_wiov, ARRAY_SIZE(host_wiov));
+ vringh_kiov_init(&riov, host_riov, ARRAY_SIZE(host_riov));
+ vringh_kiov_init(&wiov, host_wiov, ARRAY_SIZE(host_wiov));
err = vringh_getdesc_user(&vrh, &riov, &wiov, getrange, &head);
if (err != 1)
@@ -586,8 +586,8 @@ int main(int argc, char *argv[])
__kmalloc_fake = NULL;
/* Host picks it up (allocates new iov). */
- vringh_iov_init(&riov, host_riov, ARRAY_SIZE(host_riov));
- vringh_iov_init(&wiov, host_wiov, ARRAY_SIZE(host_wiov));
+ vringh_kiov_init(&riov, host_riov, ARRAY_SIZE(host_riov));
+ vringh_kiov_init(&wiov, host_wiov, ARRAY_SIZE(host_wiov));
err = vringh_getdesc_user(&vrh, &riov, &wiov, getrange, &head);
if (err != 1)
@@ -613,8 +613,8 @@ int main(int argc, char *argv[])
assert(err < 3 || buf[2] == (char)(i + 2));
}
assert(riov.i == riov.used);
- vringh_iov_cleanup(&riov);
- vringh_iov_cleanup(&wiov);
+ vringh_kiov_cleanup(&riov);
+ vringh_kiov_cleanup(&wiov);
/* Complete using multi interface, just because we can. */
used[0].id = head;
@@ -638,8 +638,8 @@ int main(int argc, char *argv[])
}
/* Now get many, and consume them all at once. */
- vringh_iov_init(&riov, host_riov, ARRAY_SIZE(host_riov));
- vringh_iov_init(&wiov, host_wiov, ARRAY_SIZE(host_wiov));
+ vringh_kiov_init(&riov, host_riov, ARRAY_SIZE(host_riov));
+ vringh_kiov_init(&wiov, host_wiov, ARRAY_SIZE(host_wiov));
for (i = 0; i < RINGSIZE; i++) {
err = vringh_getdesc_user(&vrh, &riov, &wiov, getrange, &head);
@@ -723,8 +723,8 @@ int main(int argc, char *argv[])
d[5].flags = 0;
/* Host picks it up (allocates new iov). */
- vringh_iov_init(&riov, host_riov, ARRAY_SIZE(host_riov));
- vringh_iov_init(&wiov, host_wiov, ARRAY_SIZE(host_wiov));
+ vringh_kiov_init(&riov, host_riov, ARRAY_SIZE(host_riov));
+ vringh_kiov_init(&wiov, host_wiov, ARRAY_SIZE(host_wiov));
err = vringh_getdesc_user(&vrh, &riov, &wiov, getrange, &head);
if (err != 1)
@@ -744,7 +744,7 @@ int main(int argc, char *argv[])
/* Data should be linear. */
for (i = 0; i < err; i++)
assert(buf[i] == i);
- vringh_iov_cleanup(&riov);
+ vringh_kiov_cleanup(&riov);
}
/* Don't leak memory... */
--
2.25.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2023-02-02 9:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 9:09 [RFC PATCH v2 0/7] Introduce a vringh accessor for IO memory Shunsuke Mie
2023-02-02 9:09 ` [RFC PATCH v2 1/7] vringh: fix a typo in comments for vringh_kiov Shunsuke Mie
2023-02-02 10:32 ` Michael S. Tsirkin
2023-02-02 9:09 ` [RFC PATCH v2 2/7] tools/virtio: enable to build with retpoline Shunsuke Mie
2023-02-02 10:33 ` Michael S. Tsirkin
2023-02-02 9:09 ` [RFC PATCH v2 3/7] vringh: remove vringh_iov and unite to vringh_kiov Shunsuke Mie
2023-02-02 9:09 ` Shunsuke Mie [this message]
2023-02-02 9:09 ` [RFC PATCH v2 5/7] vringh: unify the APIs for all accessors Shunsuke Mie
2023-02-02 9:09 ` [RFC PATCH v2 6/7] tools/virtio: convert to use new unified vringh APIs Shunsuke Mie
2023-02-02 9:09 ` [RFC PATCH v2 7/7] vringh: IOMEM support Shunsuke Mie
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=20230202090934.549556-5-mie@igel.co.jp \
--to=mie@igel.co.jp \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=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 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).