DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jianfeng Tan <jianfeng.tan@intel.com>
To: dev@dpdk.org
Cc: Jianfeng Tan <jianfeng.tan@intel.com>,
	yuanhan.liu@linux.intel.com, nakajima.yoshihiro@lab.ntt.co.jp,
	nhorman@tuxdriver.com
Subject: [dpdk-dev] [PATCH 1/3] virtio-user: add mq in vhost user adapter
Date: Thu,  5 May 2016 08:59:39 +0000	[thread overview]
Message-ID: <1462438781-139674-2-git-send-email-jianfeng.tan@intel.com> (raw)
In-Reply-To: <1462438781-139674-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.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 drivers/net/virtio/virtio_user/vhost.h      |  4 ++++
 drivers/net/virtio/virtio_user/vhost_user.c | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/virtio_user/vhost.h
index 5cd3543..fe236a7 100644
--- a/drivers/net/virtio/virtio_user/vhost.h
+++ b/drivers/net/virtio/virtio_user/vhost.h
@@ -209,8 +209,12 @@ enum {
 #define VHOST_KERNEL	0
 #define VHOST_USER	1
 
+#define VHOST_USER_F_PROTOCOL_FEATURES 30
+#define VHOST_USER_MQ (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)
+
 int vhost_user_sock(int vhostfd, unsigned long int req, void *arg);
 int vhost_user_setup(const char *path);
+int vhost_user_enable_queue_pair(int vhostfd, unsigned pair_idx, int enable);
 
 int vhost_kernel_ioctl(int vhostfd, unsigned long int req, void *arg);
 int vhost_kernel_setup(const char *path, const char *ifname, int *p_tapfd);
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 6fd648c..d8f7996 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -263,6 +263,7 @@ vhost_user_sock(int vhostfd, unsigned long int 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;
@@ -373,3 +374,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

  reply	other threads:[~2016-05-05  8:59 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 ` Jianfeng Tan [this message]
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   ` [dpdk-dev] [PATCH v3 1/3] virtio-user: add mq in vhost user adapter Jianfeng Tan
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=1462438781-139674-2-git-send-email-jianfeng.tan@intel.com \
    --to=jianfeng.tan@intel.com \
    --cc=dev@dpdk.org \
    --cc=nakajima.yoshihiro@lab.ntt.co.jp \
    --cc=nhorman@tuxdriver.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).