From: Tetsuya Mukawa <mukawa@igel.co.jp>
To: dev@dpdk.org
Cc: nakajima.yoshihiro@lab.ntt.co.jp, masutani.hitoshi@lab.ntt.co.jp
Subject: [dpdk-dev] [RFC PATCH 6/7] lib/librte_vhost: Add vhost-cuse/user specific initialization
Date: Thu, 6 Nov 2014 20:14:30 +0900 [thread overview]
Message-ID: <1415272471-3299-7-git-send-email-mukawa@igel.co.jp> (raw)
In-Reply-To: <1415272471-3299-1-git-send-email-mukawa@igel.co.jp>
Initialization of vhost-cuse and vhost-user are different.
To call each initialization, the patch is needed.
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
lib/librte_vhost/virtio-net-cdev.c | 12 +++++++++++-
lib/librte_vhost/virtio-net.c | 13 ++++++++++---
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/lib/librte_vhost/virtio-net-cdev.c b/lib/librte_vhost/virtio-net-cdev.c
index ac97551..a1ba1f9 100644
--- a/lib/librte_vhost/virtio-net-cdev.c
+++ b/lib/librte_vhost/virtio-net-cdev.c
@@ -42,7 +42,7 @@
#include "eventfd_link/eventfd_link.h"
/* Functions defined in virtio_net.c */
-static void init_device(struct virtio_net *dev);
+static void init_device(struct vhost_device_ctx ctx, struct virtio_net *dev);
static void cleanup_device(struct virtio_net *dev);
static void free_device(struct virtio_net_config_ll *ll_dev);
static int new_device(struct vhost_device_ctx ctx);
@@ -186,6 +186,16 @@ cdev_get_config_ll_root(void)
return cdev_ll_root;
}
+
+/**
+ * CUSE specific device initialization.
+ */
+static void
+cdev_init_device(struct vhost_device_ctx ctx __rte_unused,
+ struct virtio_net *dev __rte_unused)
+{
+}
+
/*
* Locate the file containing QEMU's memory space and map it to our address space.
*/
diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 603bb09..13fbb6f 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -212,7 +212,7 @@ get_config_ll_root(struct vhost_device_ctx ctx)
* Initialise all variables in device structure.
*/
static void
-init_device(struct virtio_net *dev)
+init_device(struct vhost_device_ctx ctx, struct virtio_net *dev)
{
uint64_t vq_offset;
@@ -228,6 +228,13 @@ init_device(struct virtio_net *dev)
/* Backends are set to -1 indicating an inactive device. */
dev->virtqueue[VIRTIO_RXQ]->backend = VIRTIO_DEV_STOPPED;
dev->virtqueue[VIRTIO_TXQ]->backend = VIRTIO_DEV_STOPPED;
+
+ switch (ctx.type) {
+ case VHOST_DRV_CUSE:
+ return cdev_init_device(ctx, dev);
+ default:
+ break;
+ }
}
/*
@@ -273,7 +280,7 @@ new_device(struct vhost_device_ctx ctx)
new_ll_dev->dev.virtqueue[VIRTIO_TXQ] = virtqueue_tx;
/* Initialise device and virtqueues. */
- init_device(&new_ll_dev->dev);
+ init_device(ctx, &new_ll_dev->dev);
new_ll_dev->next = NULL;
@@ -339,7 +346,7 @@ reset_owner(struct vhost_device_ctx ctx)
ll_dev = get_config_ll_entry(ctx);
cleanup_device(&ll_dev->dev);
- init_device(&ll_dev->dev);
+ init_device(ctx, &ll_dev->dev);
return 0;
}
--
1.9.1
next prev parent reply other threads:[~2014-11-06 11:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 11:14 [dpdk-dev] [RFC PATCH 0/7] lib/librte_vhost: Add vhost-user extension Tetsuya Mukawa
2014-11-06 11:14 ` [dpdk-dev] [RFC PATCH 1/7] lib/librte_vhost: Fix host_memory_map() to handle various memory regions Tetsuya Mukawa
2014-11-06 11:14 ` [dpdk-dev] [RFC PATCH 2/7] lib/librte_vhost: Add an abstraction layer for vhost backends Tetsuya Mukawa
2014-11-06 11:14 ` [dpdk-dev] [RFC PATCH 3/7] lib/librte_vhost: Add an abstraction layer tointerpret messages Tetsuya Mukawa
2014-11-07 20:43 ` Xie, Huawei
2014-11-10 5:12 ` Tetsuya Mukawa
2014-11-10 8:07 ` Xie, Huawei
2014-11-10 8:44 ` Tetsuya Mukawa
2014-11-06 11:14 ` [dpdk-dev] [RFC PATCH 4/7] lib/librte_vhost: Move vhost vhost-cuse device list and accessor functions Tetsuya Mukawa
2014-11-06 11:14 ` [dpdk-dev] [RFC PATCH 5/7] lib/librte_vhost: Add a vhost session abstraction Tetsuya Mukawa
2014-11-06 11:14 ` Tetsuya Mukawa [this message]
2014-11-06 11:14 ` [dpdk-dev] [RFC PATCH 7/7] lib/librte_vhost: Add vhost-user implementation Tetsuya Mukawa
2014-11-07 21:25 ` Xie, Huawei
2014-11-10 5:11 ` Tetsuya Mukawa
2014-11-10 8:18 ` Xie, Huawei
2014-11-10 8:55 ` Tetsuya Mukawa
2014-11-14 0:07 ` Xie, Huawei
2014-11-14 4:41 ` Tetsuya Mukawa
2014-11-07 3:33 ` [dpdk-dev] [RFC PATCH 0/7] lib/librte_vhost: Add vhost-user extension Xie, Huawei
2014-11-07 5:09 ` Tetsuya Mukawa
[not found] ` <C37D651A908B024F974696C65296B57B0F2E3C93@SHSMSX101.ccr.corp.intel.com>
2014-11-07 6:16 ` Tetsuya Mukawa
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=1415272471-3299-7-git-send-email-mukawa@igel.co.jp \
--to=mukawa@igel.co.jp \
--cc=dev@dpdk.org \
--cc=masutani.hitoshi@lab.ntt.co.jp \
--cc=nakajima.yoshihiro@lab.ntt.co.jp \
/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).