From: Fam Zheng <famz@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH V2 2/2] tests: test rx recovery from cont
Date: Mon, 13 Jul 2015 16:52:52 +0800 [thread overview]
Message-ID: <20150713085252.GC15471@ad.nay.redhat.com> (raw)
In-Reply-To: <1436767460-2679-2-git-send-email-jasowang@redhat.com>
On Mon, 07/13 14:04, Jason Wang wrote:
> Rx should be recovered after cont.
>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> Changes from V1:
> - query status before sending cont, this makes sure that the packet
> were queued.
> ---
> tests/virtio-net-test.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 52 insertions(+)
>
> diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c
> index b7d6f0b..3c412e2 100644
> --- a/tests/virtio-net-test.c
> +++ b/tests/virtio-net-test.c
> @@ -140,6 +140,49 @@ static void tx_test(const QVirtioBus *bus, QVirtioDevice *dev,
> g_assert_cmpstr(buffer, ==, "TEST");
> }
>
> +static void rx_stop_cont_test(const QVirtioBus *bus, QVirtioDevice *dev,
> + QGuestAllocator *alloc, QVirtQueue *vq,
> + int socket)
> +{
> + uint64_t req_addr;
> + uint32_t free_head;
> + char test[] = "TEST";
> + char buffer[64];
> + int len = htonl(sizeof(test));
> + struct iovec iov[] = {
> + {
> + .iov_base = &len,
> + .iov_len = sizeof(len),
> + }, {
> + .iov_base = test,
> + .iov_len = sizeof(test),
> + },
> + };
> + int ret;
> +
> + req_addr = guest_alloc(alloc, 64);
> +
> + free_head = qvirtqueue_add(vq, req_addr, 64, true, false);
> + qvirtqueue_kick(bus, dev, vq, free_head);
> +
> + /* We could check the status, but this command is more importantly to
> + * ensure the packet data gets queued in QEMU, before we do 'cont'.
> + */
> + qmp("{ 'execute' : 'query-status'}");
> + qmp("{ 'execute' : 'stop'}");
> +
> + ret = iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test));
> + g_assert_cmpint(ret, ==, sizeof(test) + sizeof(len));
I meant QMP 'query-status' should be here, between the iov_send and 'cont'.
Fam
> +
> + qmp("{ 'execute' : 'cont'}");
> +
> + qvirtio_wait_queue_isr(bus, dev, vq, QVIRTIO_NET_TIMEOUT_US);
> + memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test));
> + g_assert_cmpstr(buffer, ==, "TEST");
> +
> + guest_free(alloc, req_addr);
> +}
> +
> static void send_recv_test(const QVirtioBus *bus, QVirtioDevice *dev,
> QGuestAllocator *alloc, QVirtQueue *rvq,
> QVirtQueue *tvq, int socket)
> @@ -148,6 +191,13 @@ static void send_recv_test(const QVirtioBus *bus, QVirtioDevice *dev,
> tx_test(bus, dev, alloc, tvq, socket);
> }
>
> +static void stop_cont_test(const QVirtioBus *bus, QVirtioDevice *dev,
> + QGuestAllocator *alloc, QVirtQueue *rvq,
> + QVirtQueue *tvq, int socket)
> +{
> + rx_stop_cont_test(bus, dev, alloc, rvq, socket);
> +}
> +
> static void pci_basic(gconstpointer data)
> {
> QVirtioPCIDevice *dev;
> @@ -206,6 +256,8 @@ int main(int argc, char **argv)
> g_test_init(&argc, &argv, NULL);
> #ifndef _WIN32
> qtest_add_data_func("/virtio/net/pci/basic", send_recv_test, pci_basic);
> + qtest_add_data_func("/virtio/net/pci/rx_stop_cont",
> + stop_cont_test, pci_basic);
> #endif
> qtest_add_func("/virtio/net/pci/hotplug", hotplug);
>
> --
> 2.1.4
>
next prev parent reply other threads:[~2015-07-13 8:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-13 6:04 [Qemu-devel] [PATCH V2 1/2] tests: introduce basic pci test for virtio-net Jason Wang
2015-07-13 6:04 ` [Qemu-devel] [PATCH V2 2/2] tests: test rx recovery from cont Jason Wang
2015-07-13 8:52 ` Fam Zheng [this message]
2015-07-13 9:09 ` Jason Wang
2015-07-13 8:49 ` [Qemu-devel] [PATCH V2 1/2] tests: introduce basic pci test for virtio-net Fam Zheng
2015-07-13 9:08 ` Jason Wang
2015-07-16 10:41 ` Stefan Hajnoczi
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=20150713085252.GC15471@ad.nay.redhat.com \
--to=famz@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).