From: Mark McLoughlin <markmc@redhat.com>
To: Alex Williamson <alex.williamson@hp.com>
Cc: qemu-devel <qemu-devel@nongnu.org>, kvm <kvm@vger.kernel.org>
Subject: [Qemu-devel] Re: [PATCH 2/5] virtio-net: Add a virtqueue for control commands from the guest
Date: Wed, 14 Jan 2009 10:15:15 +0000 [thread overview]
Message-ID: <1231928115.4944.293.camel@localhost.localdomain> (raw)
In-Reply-To: <1231881831.9095.192.camel@bling>
On Tue, 2009-01-13 at 14:23 -0700, Alex Williamson wrote:
> @@ -110,6 +111,36 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
> #endif
> }
>
> +static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
> +{
> + struct {
> + uint8_t class;
> + uint8_t cmd;
> + } *ctrl;
> + uint8_t *status;
> + VirtQueueElement elem;
> +
> + while (virtqueue_pop(vq, &elem)) {
> + if ((elem.in_num < 1) | (elem.out_num < 1)) {
> + fprintf(stderr, "virtio-net ctrl missing headers\n");
> + exit(1);
> + }
> +
> + if (elem.out_sg[0].iov_len < sizeof(*ctrl) ||
> + elem.out_sg[elem.in_num - 1].iov_len < sizeof(*status)) {
> + fprintf(stderr, "virtio-net ctrl header not in correct element\n");
> + exit(1);
> + }
> +
> + ctrl = (void *)elem.out_sg[0].iov_base;
> + status = (void *)elem.in_sg[elem.in_num - 1].iov_base;
These casts aren't needed - iov_base is a void pointer.
Cheers,
Mark.
next prev parent reply other threads:[~2009-01-14 10:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-13 21:23 [Qemu-devel] [PATCH 2/5] virtio-net: Add a virtqueue for control commands from the guest Alex Williamson
2009-01-14 10:15 ` Mark McLoughlin [this message]
2009-01-14 16:57 ` [Qemu-devel] " Alex Williamson
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=1231928115.4944.293.camel@localhost.localdomain \
--to=markmc@redhat.com \
--cc=alex.williamson@hp.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.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).