From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] virito-net: remove layout assumption for multiqueue ctrl
Date: Wed, 6 Mar 2013 08:35:02 +0200 [thread overview]
Message-ID: <20130306063502.GA14769@redhat.com> (raw)
In-Reply-To: <1362549027-49386-1-git-send-email-jasowang@redhat.com>
On Wed, Mar 06, 2013 at 01:50:27PM +0800, Jason Wang wrote:
> Follow commit 921ac5d0f3a0df869db5ce4edf752f51d8b1596a (virtio-net: remove
> layout assumptions for ctrl vq), this patch makes multiqueue ctrl handling not
> reply on the layout of descriptors.
>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Applied, thanks.
> ---
> hw/virtio-net.c | 23 ++++++++++++-----------
> 1 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index bb2c26c..009f09e 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -578,13 +578,14 @@ static int virtio_net_handle_vlan_table(VirtIONet *n, uint8_t cmd,
> }
>
> static int virtio_net_handle_mq(VirtIONet *n, uint8_t cmd,
> - VirtQueueElement *elem)
> + struct iovec *iov, unsigned int iov_cnt)
> {
> - struct virtio_net_ctrl_mq s;
> + struct virtio_net_ctrl_mq mq;
> + size_t s;
> + uint16_t queues;
>
> - if (elem->out_num != 2 ||
> - elem->out_sg[1].iov_len != sizeof(struct virtio_net_ctrl_mq)) {
> - error_report("virtio-net ctrl invalid steering command");
> + s = iov_to_buf(iov, iov_cnt, 0, &mq, sizeof(mq));
> + if (s != sizeof(mq)) {
> return VIRTIO_NET_ERR;
> }
>
> @@ -592,16 +593,16 @@ static int virtio_net_handle_mq(VirtIONet *n, uint8_t cmd,
> return VIRTIO_NET_ERR;
> }
>
> - memcpy(&s, elem->out_sg[1].iov_base, sizeof(struct virtio_net_ctrl_mq));
> + queues = lduw_p(&mq.virtqueue_pairs);
>
> - if (s.virtqueue_pairs < VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN ||
> - s.virtqueue_pairs > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX ||
> - s.virtqueue_pairs > n->max_queues ||
> + if (queues < VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN ||
> + queues > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX ||
> + queues > n->max_queues ||
> !n->multiqueue) {
> return VIRTIO_NET_ERR;
> }
>
> - n->curr_queues = s.virtqueue_pairs;
> + n->curr_queues = queues;
> /* stop the backend before changing the number of queues to avoid handling a
> * disabled queue */
> virtio_net_set_status(&n->vdev, n->vdev.status);
> @@ -639,7 +640,7 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
> } else if (ctrl.class == VIRTIO_NET_CTRL_VLAN) {
> status = virtio_net_handle_vlan_table(n, ctrl.cmd, iov, iov_cnt);
> } else if (ctrl.class == VIRTIO_NET_CTRL_MQ) {
> - status = virtio_net_handle_mq(n, ctrl.cmd, &elem);
> + status = virtio_net_handle_mq(n, ctrl.cmd, iov, iov_cnt);
> }
>
> s = iov_from_buf(elem.in_sg, elem.in_num, 0, &status, sizeof(status));
> --
> 1.7.1
prev parent reply other threads:[~2013-03-06 6:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 5:50 [Qemu-devel] [PATCH] virito-net: remove layout assumption for multiqueue ctrl Jason Wang
2013-03-06 6:35 ` Michael S. Tsirkin [this message]
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=20130306063502.GA14769@redhat.com \
--to=mst@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=jasowang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.