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);



    qmp("{ 'execute' : 'stop'}");



    ret = iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test));

    g_assert_cmpint(ret, ==, sizeof(test) + sizeof(len));



    /* 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' : '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 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);



    qmp("{ 'execute' : 'stop'}");



    ret = iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test));

    g_assert_cmpint(ret, ==, sizeof(test) + sizeof(len));



    





    qmp("{ 'execute' : 'query-status'}");

    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);

}

    qmp("{ 'execute' : 'stop'}");     qmp("{ 'execute' : 'query-status'}");     qmp("{ 'execute' : 'cont'}");
static void FUNC_0(const QVirtioBus *VAR_0, QVirtioDevice *VAR_1,

                              QGuestAllocator *VAR_2, QVirtQueue *VAR_3,

                              int VAR_4)

{

    uint64_t req_addr;

    uint32_t free_head;

    char VAR_5[] = "TEST";

    char VAR_6[64];

    int VAR_7 = htonl(sizeof(VAR_5));

    struct iovec VAR_8[] = {

        {

            .iov_base = &VAR_7,

            .iov_len = sizeof(VAR_7),

        }, {

            .iov_base = VAR_5,

            .iov_len = sizeof(VAR_5),

        },

    };

    int VAR_9;



    req_addr = guest_alloc(VAR_2, 64);



    free_head = qvirtqueue_add(VAR_3, req_addr, 64, true, false);

    qvirtqueue_kick(VAR_0, VAR_1, VAR_3, free_head);



    qmp("{ 'execute' : 'stop'}");



    VAR_9 = iov_send(VAR_4, VAR_8, 2, 0, sizeof(VAR_7) + sizeof(VAR_5));

    g_assert_cmpint(VAR_9, ==, sizeof(VAR_5) + sizeof(VAR_7));



    





    qmp("{ 'execute' : 'query-status'}");

    qmp("{ 'execute' : 'cont'}");



    qvirtio_wait_queue_isr(VAR_0, VAR_1, VAR_3, QVIRTIO_NET_TIMEOUT_US);

    memread(req_addr + VNET_HDR_SIZE, VAR_6, sizeof(VAR_5));

    g_assert_cmpstr(VAR_6, ==, "TEST");



    guest_free(VAR_2, req_addr);

}

static void FUNC_0(const QVirtioBus *VAR_0, QVirtioDevice *VAR_1,
QGuestAllocator *VAR_2, QVirtQueue *VAR_3,
int VAR_4)
{ uint64_t req_addr; uint32_t free_head; char VAR_5[] = "TEST"; char VAR_6[64]; int VAR_7 = htonl(sizeof(VAR_5)); struct iovec VAR_8[] = { { .iov_base = &VAR_7,
.iov_len = sizeof(VAR_7),
}, { .iov_base = VAR_5,
.iov_len = sizeof(VAR_5),
}, }; int VAR_9; req_addr = guest_alloc(VAR_2, 64); free_head = qvirtqueue_add(VAR_3, req_addr, 64, true, false); qvirtqueue_kick(VAR_0, VAR_1, VAR_3, free_head); qmp("{ 'execute' : 'stop'}"); VAR_9 = iov_send(VAR_4, VAR_8, 2, 0, sizeof(VAR_7) + sizeof(VAR_5)); g_assert_cmpint(VAR_9, ==, sizeof(VAR_5) + sizeof(VAR_7)); qmp("{ 'execute' : 'query-status'}"); qmp("{ 'execute' : 'cont'}"); qvirtio_wait_queue_isr(VAR_0, VAR_1, VAR_3, QVIRTIO_NET_TIMEOUT_US); memread(req_addr + VNET_HDR_SIZE, VAR_6, sizeof(VAR_5)); g_assert_cmpstr(VAR_6, ==, "TEST"); guest_free(VAR_2, req_addr); }