qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com, mlureau@redhat.com, zhengxiang9@huawei.com,
	lersek@redhat.com, pbonzini@redhat.com,
	Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [Qemu-devel] [PATCH 3/4] vhost-net: add vhost_net_set_queue_num helper
Date: Fri, 12 Jan 2018 15:56:57 +0100	[thread overview]
Message-ID: <20180112145658.17121-4-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20180112145658.17121-1-maxime.coquelin@redhat.com>

This patch adds a new help to notify the backend with
the number of queue pairs setup by the guest driver.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 hw/net/vhost_net.c      | 17 +++++++++++++++++
 include/net/vhost_net.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index e037db63a3..d60e237a34 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -124,6 +124,18 @@ uint64_t vhost_net_get_max_queues(VHostNetState *net)
     return net->dev.max_queues;
 }
 
+int vhost_net_set_queue_num(NetClientState *nc, uint64_t queues)
+{
+    VHostNetState *net = get_vhost_net(nc);
+    const VhostOps *vhost_ops = net->dev.vhost_ops;
+
+    if (vhost_ops->vhost_set_queue_num) {
+        return vhost_ops->vhost_set_queue_num(&net->dev, queues);
+    }
+
+    return 0;
+}
+
 uint64_t vhost_net_get_acked_features(VHostNetState *net)
 {
     return net->dev.acked_features;
@@ -456,6 +468,11 @@ uint64_t vhost_net_get_max_queues(VHostNetState *net)
     return 1;
 }
 
+int vhost_net_set_queue_num(NetClientState *nc, uint64_t queues)
+{
+    return 0;
+}
+
 struct vhost_net *vhost_net_init(VhostNetOptions *options)
 {
     error_report("vhost-net support is not compiled in");
diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
index afc1499eb9..39e639d014 100644
--- a/include/net/vhost_net.h
+++ b/include/net/vhost_net.h
@@ -15,6 +15,7 @@ typedef struct VhostNetOptions {
 } VhostNetOptions;
 
 uint64_t vhost_net_get_max_queues(VHostNetState *net);
+int vhost_net_set_queue_num(NetClientState *nc, uint64_t queues);
 struct vhost_net *vhost_net_init(VhostNetOptions *options);
 
 int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, int total_queues);
-- 
2.14.3

  parent reply	other threads:[~2018-01-12 14:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 14:56 [Qemu-devel] [PATCH 0/4] vhost-user: notify backend with number of queues setup Maxime Coquelin
2018-01-12 14:56 ` [Qemu-devel] [PATCH 1/4] vhost-user: fix multiple queue specification Maxime Coquelin
2018-01-16  3:00   ` Michael S. Tsirkin
2018-01-16 12:35     ` Maxime Coquelin
2018-01-12 14:56 ` [Qemu-devel] [PATCH 2/4] vhost-user: specify and implement VHOST_USER_SET_QUEUE_NUM request Maxime Coquelin
2018-01-16  3:05   ` Michael S. Tsirkin
2018-01-16 14:56     ` Maxime Coquelin
2018-01-12 14:56 ` Maxime Coquelin [this message]
2018-01-12 14:56 ` [Qemu-devel] [PATCH 4/4] virtio-net: notify backend with number of queue pairs setup Maxime Coquelin
2018-01-16  3:07   ` Michael S. Tsirkin
2018-01-16 14:16     ` Maxime Coquelin

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=20180112145658.17121-4-maxime.coquelin@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mlureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhengxiang9@huawei.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 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).