From: Jason Wang <jasowang@redhat.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>, qemu-devel@nongnu.org
Cc: mst@redhat.com, changchun.ouyang@intel.com
Subject: Re: [Qemu-devel] [PATCH 5/7] vhost_net: move vhost_net_set_vq_index ahead at vhost_net_init
Date: Thu, 10 Sep 2015 11:14:27 +0800 [thread overview]
Message-ID: <55F0F593.9030408@redhat.com> (raw)
In-Reply-To: <1441697927-16456-6-git-send-email-yuanhan.liu@linux.intel.com>
On 09/08/2015 03:38 PM, Yuanhan Liu wrote:
> So that we could use the `vq_index' as well in the vhost_net_init
> stage, which is required when adding vhost-user multiple-queue support,
> where we need the vq_index to indicate which queue pair we are gonna
> initiate.
>
> vhost-user has no multiple queue support yet, hence no queue_index set
> before. Here is a quick set to 0 at net_vhost_user_init() stage, and it
> will be set properly soon in the next patch.
>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
> hw/net/vhost_net.c | 16 +++++++---------
> net/vhost-user.c | 1 +
> 2 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index f9441e9..141b557 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -138,6 +138,11 @@ static int vhost_net_get_fd(NetClientState *backend)
> }
> }
>
> +static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
> +{
> + net->dev.vq_index = vq_index;
> +}
> +
> struct vhost_net *vhost_net_init(VhostNetOptions *options)
> {
> int r;
> @@ -167,6 +172,8 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
> }
> net->nc = options->net_backend;
>
> + vhost_net_set_vq_index(net, net->nc->queue_index * 2);
> +
This breaks vhost kernel multiqueue since queue_index was not
initialized at this time. We do this in set_netdev() instead of setting
it in each kind of netdev.
> net->dev.nvqs = 2;
> net->dev.vqs = net->vqs;
>
> @@ -196,11 +203,6 @@ fail:
> return NULL;
> }
>
> -static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
> -{
> - net->dev.vq_index = vq_index;
> -}
> -
> static int vhost_net_set_vnet_endian(VirtIODevice *dev, NetClientState *peer,
> bool set)
> {
> @@ -325,10 +327,6 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
> goto err;
> }
>
> - for (i = 0; i < total_queues; i++) {
> - vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2);
> - }
> -
> r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true);
> if (r < 0) {
> error_report("Error binding guest notifier: %d", -r);
> diff --git a/net/vhost-user.c b/net/vhost-user.c
> index 93dcecd..2d6bbe5 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -146,6 +146,7 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
> /* We don't provide a receive callback */
> s->nc.receive_disabled = 1;
> s->chr = chr;
> + nc->queue_index = 0;
>
Fail to understand why this is needed. It will be set to correct value
in set_netdev().
> qemu_chr_add_handlers(s->chr, NULL, NULL, net_vhost_user_event, s);
>
next prev parent reply other threads:[~2015-09-10 3:14 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-08 7:38 [Qemu-devel] [PATCH 0/7 v7] vhost-user multiple queue support Yuanhan Liu
2015-09-08 7:38 ` [Qemu-devel] [PATCH 1/7] vhost-user: use VHOST_USER_XXX macro for switch statement Yuanhan Liu
2015-09-08 7:38 ` [Qemu-devel] [PATCH 2/7] vhost-user: add protocol feature negotiation Yuanhan Liu
2015-09-08 7:38 ` [Qemu-devel] [PATCH 3/7] vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE Yuanhan Liu
2015-09-08 7:38 ` [Qemu-devel] [PATCH 4/7] vhost-user: add VHOST_USER_GET_QUEUE_NUM message Yuanhan Liu
2015-09-08 7:38 ` [Qemu-devel] [PATCH 5/7] vhost_net: move vhost_net_set_vq_index ahead at vhost_net_init Yuanhan Liu
2015-09-10 3:14 ` Jason Wang [this message]
2015-09-10 3:57 ` Yuanhan Liu
2015-09-10 4:46 ` Jason Wang
2015-09-10 5:17 ` Yuanhan Liu
2015-09-10 5:52 ` Jason Wang
2015-09-10 6:18 ` Yuanhan Liu
2015-09-10 6:54 ` Jason Wang
2015-09-10 7:06 ` Yuanhan Liu
2015-09-14 5:49 ` Yuanhan Liu
2015-09-08 7:38 ` [Qemu-devel] [PATCH 6/7] vhost-user: add multiple queue support Yuanhan Liu
2015-09-08 21:22 ` Eric Blake
2015-09-09 1:47 ` Yuanhan Liu
2015-09-09 8:05 ` Ouyang, Changchun
2015-09-09 8:11 ` Yuanhan Liu
2015-09-09 12:18 ` Michael S. Tsirkin
2015-09-09 13:19 ` Yuanhan Liu
2015-09-09 20:55 ` Michael S. Tsirkin
2015-09-14 10:00 ` Jason Wang
2015-09-15 2:15 ` Yuanhan Liu
2015-09-08 7:38 ` [Qemu-devel] [PATCH 7/7] vhost-user: add a new message to disable/enable a specific virt queue Yuanhan Liu
2015-09-09 10:45 ` Michael S. Tsirkin
2015-09-09 13:38 ` Yuanhan Liu
2015-09-09 14:18 ` Michael S. Tsirkin
2015-09-09 20:55 ` Michael S. Tsirkin
2015-09-14 7:36 ` Yuanhan Liu
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=55F0F593.9030408@redhat.com \
--to=jasowang@redhat.com \
--cc=changchun.ouyang@intel.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yuanhan.liu@linux.intel.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.