From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: Jianfeng Tan <jianfeng.tan@intel.com>,
rich.lane@bigswitch.com, yuanhan.liu@linux.intel.com,
mst@redhat.com, nakajima.yoshihiro@lab.ntt.co.jp,
p.fedin@samsung.com, ann.zhuangyanying@huawei.com,
mukawa@igel.co.jp, nhorman@tuxdriver.com
Subject: [dpdk-dev] [PATCH v3 1/3] virtio-user: add mq in vhost user adapter
Date: Wed, 15 Jun 2016 09:07:15 +0000 [thread overview]
Message-ID: <1465981637-38015-2-git-send-email-jianfeng.tan@intel.com> (raw)
In-Reply-To: <1465981637-38015-1-git-send-email-jianfeng.tan@intel.com>
This patch mainly adds method in vhost user adapter to communicate
enable/disable queues messages with vhost user backend, aka,
VHOST_USER_SET_VRING_ENABLE.
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
drivers/net/virtio/virtio_user/vhost.h | 5 +++++
drivers/net/virtio/virtio_user/vhost_user.c | 22 ++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/virtio_user/vhost.h
index 4e04ede..8d1e505 100644
--- a/drivers/net/virtio/virtio_user/vhost.h
+++ b/drivers/net/virtio/virtio_user/vhost.h
@@ -136,6 +136,11 @@ struct vhost_user_msg {
/* The version of the protocol we support */
#define VHOST_USER_VERSION 0x1
+#define VHOST_USER_F_PROTOCOL_FEATURES 30
+#define VHOST_USER_MQ (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)
+
int vhost_user_sock(int vhostfd, uint64_t req, void *arg);
int vhost_user_setup(const char *path);
+int vhost_user_enable_queue_pair(int vhostfd, unsigned pair_idx, int enable);
+
#endif
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 47bbf74..98d98b6 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -234,6 +234,7 @@ static const char * const vhost_msg_strings[] = {
[VHOST_USER_SET_VRING_ADDR] = "VHOST_USER_SET_VRING_ADDR",
[VHOST_USER_SET_VRING_KICK] = "VHOST_USER_SET_VRING_KICK",
[VHOST_USER_SET_MEM_TABLE] = "VHOST_USER_SET_MEM_TABLE",
+ [VHOST_USER_SET_VRING_ENABLE] = "VHOST_USER_SET_VRING_ENABLE",
NULL,
};
@@ -286,6 +287,7 @@ vhost_user_sock(int vhostfd, uint64_t req, void *arg)
case VHOST_USER_SET_VRING_NUM:
case VHOST_USER_SET_VRING_BASE:
+ case VHOST_USER_SET_VRING_ENABLE:
memcpy(&msg.payload.state, arg, sizeof(msg.payload.state));
msg.size = sizeof(m.payload.state);
break;
@@ -402,3 +404,23 @@ vhost_user_setup(const char *path)
return fd;
}
+
+int
+vhost_user_enable_queue_pair(int vhostfd, unsigned pair_idx, int enable)
+{
+ int i;
+
+ for (i = 0; i < 2; ++i) {
+ struct vhost_vring_state state = {
+ .index = pair_idx * 2 + i,
+ .num = enable,
+ };
+
+ if (vhost_user_sock(vhostfd,
+ VHOST_USER_SET_VRING_ENABLE, &state))
+ return -1;
+ }
+
+ return 0;
+
+}
--
2.1.4
next prev parent reply other threads:[~2016-06-15 9:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-05 8:59 [dpdk-dev] [PATCH 0/3] add multi queue support for virtio-user Jianfeng Tan
2016-05-05 8:59 ` [dpdk-dev] [PATCH 1/3] virtio-user: add mq in vhost user adapter Jianfeng Tan
2016-05-05 8:59 ` [dpdk-dev] [PATCH 2/3] virtio-user: add mq in device emulation Jianfeng Tan
2016-05-05 8:59 ` [dpdk-dev] [PATCH 3/3] virtio-user: add mq in virtual pci driver Jianfeng Tan
2016-06-13 6:43 ` [dpdk-dev] [PATCH v2 0/4] add multi queue support for virtio-user Jianfeng Tan
2016-06-13 6:43 ` [dpdk-dev] [PATCH v2 1/4] virtio-user: use virtual address in cq Jianfeng Tan
2016-06-13 10:19 ` Yuanhan Liu
2016-06-13 6:43 ` [dpdk-dev] [PATCH v2 2/4] virtio-user: add mq in vhost user adapter Jianfeng Tan
2016-06-13 6:43 ` [dpdk-dev] [PATCH v2 3/4] virtio-user: add ctrl-q and mq in device emulation Jianfeng Tan
2016-06-13 6:43 ` [dpdk-dev] [PATCH v2 4/4] virtio-user: handle ctrl-q in driver Jianfeng Tan
2016-06-13 10:14 ` Yuanhan Liu
2016-06-13 10:20 ` Tan, Jianfeng
2016-06-15 9:07 ` [dpdk-dev] [PATCH v3 0/3] add multi queue support for virtio-user Jianfeng Tan
2016-06-15 9:07 ` Jianfeng Tan [this message]
2016-06-15 9:07 ` [dpdk-dev] [PATCH v3 2/3] virtio-user: add ctrl-q and mq in device emulation Jianfeng Tan
2016-06-15 9:07 ` [dpdk-dev] [PATCH v3 0/3] virtio-user: handle ctrl-q in driver Jianfeng Tan
2016-06-15 9:54 ` [dpdk-dev] [PATCH v3 0/3] add multi queue support for virtio-user 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=1465981637-38015-2-git-send-email-jianfeng.tan@intel.com \
--to=jianfeng.tan@intel.com \
--cc=ann.zhuangyanying@huawei.com \
--cc=dev@dpdk.org \
--cc=mst@redhat.com \
--cc=mukawa@igel.co.jp \
--cc=nakajima.yoshihiro@lab.ntt.co.jp \
--cc=nhorman@tuxdriver.com \
--cc=p.fedin@samsung.com \
--cc=rich.lane@bigswitch.com \
--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 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).