From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEZji-0004ih-9l for qemu-devel@nongnu.org; Mon, 13 Jul 2015 05:09:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEZjf-0007N1-CL for qemu-devel@nongnu.org; Mon, 13 Jul 2015 05:09:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEZjf-0007Mm-5x for qemu-devel@nongnu.org; Mon, 13 Jul 2015 05:09:15 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id E8F728F032 for ; Mon, 13 Jul 2015 09:09:14 +0000 (UTC) Message-ID: <55A38037.6030801@redhat.com> Date: Mon, 13 Jul 2015 17:09:11 +0800 From: Jason Wang MIME-Version: 1.0 References: <1436767460-2679-1-git-send-email-jasowang@redhat.com> <1436767460-2679-2-git-send-email-jasowang@redhat.com> <20150713085252.GC15471@ad.nay.redhat.com> In-Reply-To: <20150713085252.GC15471@ad.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2 2/2] tests: test rx recovery from cont List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, stefanha@redhat.com, mst@redhat.com On 07/13/2015 04:52 PM, Fam Zheng wrote: > On Mon, 07/13 14:04, Jason Wang wrote: >> > Rx should be recovered after cont. >> > >> > Signed-off-by: Jason Wang >> > --- >> > 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 > Sorry, an cut and paste error. Will fix this in next version.