DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: dev@dpdk.org
Cc: Thomas Monjalon <thomas.monjalon@6wind.com>,
	huawei.xie@intel.com, Panu Matilainen <pmatilai@redhat.com>,
	Tetsuya Mukawa <mukawa@igel.co.jp>,
	Traynor Kevin <kevin.traynor@intel.com>,
	Rich Lane <rich.lane@bigswitch.com>,
	Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [dpdk-dev] [PATCH v2 07/19] vhost: move vhost device ctx to cuse
Date: Thu, 12 May 2016 22:24:59 -0700	[thread overview]
Message-ID: <1463117111-27050-8-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1463117111-27050-1-git-send-email-yuanhan.liu@linux.intel.com>

vhost cuse is now the last reference of the vhost_device_ctx struct;
move it there, and do a rename to "vhost_cuse_device_ctx", to make
it clear that it's "cuse only".

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 lib/librte_vhost/vhost-net.h                  |  8 --------
 lib/librte_vhost/vhost_cuse/vhost-net-cdev.c  | 13 +++++++------
 lib/librte_vhost/vhost_cuse/virtio-net-cdev.c |  6 ++++--
 lib/librte_vhost/vhost_cuse/virtio-net-cdev.h | 12 ++++++++++--
 4 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/lib/librte_vhost/vhost-net.h b/lib/librte_vhost/vhost-net.h
index 4de3aa0..4ed5816 100644
--- a/lib/librte_vhost/vhost-net.h
+++ b/lib/librte_vhost/vhost-net.h
@@ -75,14 +75,6 @@
 #endif
 
 
-/*
- * Structure used to identify device context.
- */
-struct vhost_device_ctx {
-	pid_t	pid;	/* PID of process calling the IOCTL. */
-	int	vid;	/* Virtio-net device ID */
-};
-
 int vhost_new_device(void);
 void vhost_destroy_device(int);
 
diff --git a/lib/librte_vhost/vhost_cuse/vhost-net-cdev.c b/lib/librte_vhost/vhost_cuse/vhost-net-cdev.c
index 45a9a91..cf6d191 100644
--- a/lib/librte_vhost/vhost_cuse/vhost-net-cdev.c
+++ b/lib/librte_vhost/vhost_cuse/vhost-net-cdev.c
@@ -60,13 +60,14 @@ static const char default_cdev[] = "vhost-net";
 static struct fuse_session *session;
 
 /*
- * Returns vhost_device_ctx from given fuse_req_t. The index is populated later
- * when the device is added to the device linked list.
+ * Returns vhost_cuse_device_ctx from given fuse_req_t. The
+ * index is populated later when the device is added to the
+ * device linked list.
  */
-static struct vhost_device_ctx
+static struct vhost_cuse_device_ctx
 fuse_req_to_vhost_ctx(fuse_req_t req, struct fuse_file_info *fi)
 {
-	struct vhost_device_ctx ctx;
+	struct vhost_cuse_device_ctx ctx;
 	struct fuse_ctx const *const req_ctx = fuse_req_ctx(req);
 
 	ctx.pid = req_ctx->pid;
@@ -104,7 +105,7 @@ static void
 vhost_net_release(fuse_req_t req, struct fuse_file_info *fi)
 {
 	int err = 0;
-	struct vhost_device_ctx ctx = fuse_req_to_vhost_ctx(req, fi);
+	struct vhost_cuse_device_ctx ctx = fuse_req_to_vhost_ctx(req, fi);
 
 	vhost_destroy_device(ctx.vid);
 	RTE_LOG(INFO, VHOST_CONFIG, "(%d) device released\n", ctx.vid);
@@ -182,7 +183,7 @@ vhost_net_ioctl(fuse_req_t req, int cmd, void *arg,
 		struct fuse_file_info *fi, __rte_unused unsigned flags,
 		const void *in_buf, size_t in_bufsz, size_t out_bufsz)
 {
-	struct vhost_device_ctx ctx = fuse_req_to_vhost_ctx(req, fi);
+	struct vhost_cuse_device_ctx ctx = fuse_req_to_vhost_ctx(req, fi);
 	struct vhost_vring_file file;
 	struct vhost_vring_state state;
 	struct vhost_vring_addr addr;
diff --git a/lib/librte_vhost/vhost_cuse/virtio-net-cdev.c b/lib/librte_vhost/vhost_cuse/virtio-net-cdev.c
index 34ee6c9..0723a7a 100644
--- a/lib/librte_vhost/vhost_cuse/virtio-net-cdev.c
+++ b/lib/librte_vhost/vhost_cuse/virtio-net-cdev.c
@@ -263,7 +263,7 @@ host_memory_map(pid_t pid, uint64_t addr,
 }
 
 int
-cuse_set_mem_table(struct vhost_device_ctx ctx,
+cuse_set_mem_table(struct vhost_cuse_device_ctx ctx,
 	const struct vhost_memory *mem_regions_addr, uint32_t nregions)
 {
 	uint64_t size = offsetof(struct vhost_memory, regions);
@@ -405,7 +405,9 @@ get_ifname(int vid, int tap_fd, int pid)
 	return 0;
 }
 
-int cuse_set_backend(struct vhost_device_ctx ctx, struct vhost_vring_file *file)
+int
+cuse_set_backend(struct vhost_cuse_device_ctx ctx,
+		 struct vhost_vring_file *file)
 {
 	struct virtio_net *dev;
 
diff --git a/lib/librte_vhost/vhost_cuse/virtio-net-cdev.h b/lib/librte_vhost/vhost_cuse/virtio-net-cdev.h
index eb6b0ba..3f67154 100644
--- a/lib/librte_vhost/vhost_cuse/virtio-net-cdev.h
+++ b/lib/librte_vhost/vhost_cuse/virtio-net-cdev.h
@@ -38,11 +38,19 @@
 
 #include "vhost-net.h"
 
+/*
+ * Structure used to identify device context.
+ */
+struct vhost_cuse_device_ctx {
+	pid_t	pid;	/* PID of process calling the IOCTL. */
+	int	vid;	/* Virtio-net device ID */
+};
+
 int
-cuse_set_mem_table(struct vhost_device_ctx ctx,
+cuse_set_mem_table(struct vhost_cuse_device_ctx ctx,
 	const struct vhost_memory *mem_regions_addr, uint32_t nregions);
 
 int
-cuse_set_backend(struct vhost_device_ctx ctx, struct vhost_vring_file *);
+cuse_set_backend(struct vhost_cuse_device_ctx ctx, struct vhost_vring_file *);
 
 #endif
-- 
1.9.0

  parent reply	other threads:[~2016-05-13  5:20 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-02 22:25 [dpdk-dev] [PATCH 00/16] vhost ABI/API refactoring Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 01/16] vhost: declare backend with int type Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 02/16] vhost: set/reset dev flags internally Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 03/16] vhost: declare device_fh as int Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 04/16] example/vhost: make a copy of virtio device id Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 05/16] vhost: rename device_fh to vid Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 06/16] vhost: get device by vid only Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 07/16] vhost: move vhost_device_ctx to cuse Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 08/16] vhost: query pmd internal by vid Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 09/16] vhost: add few more functions Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 10/16] vhost: export vid as the only interface to applications Yuanhan Liu
2016-05-10 16:17   ` Rich Lane
2016-05-10 16:39     ` Yuanhan Liu
2016-05-10 17:13       ` Rich Lane
2016-05-10 17:29         ` Yuanhan Liu
2016-05-10 19:22           ` Thomas Monjalon
2016-05-02 22:25 ` [dpdk-dev] [PATCH 11/16] vhost: hide internal structs/macros/functions Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 12/16] vhost: remove unnecessary fields Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 13/16] vhost: remove virtio-net.h Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 14/16] vhost: reserve few more space for future extension Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 15/16] vhost: per device vhost_hlen Yuanhan Liu
2016-05-02 22:25 ` [dpdk-dev] [PATCH 16/16] vhost: make buf vector for scatter Rx local Yuanhan Liu
2016-05-13  5:24 ` [dpdk-dev] [PATCH v2 00/19] vhost ABI/API refactoring Yuanhan Liu
2016-05-13  5:24   ` [dpdk-dev] [PATCH v2 01/19] vhost: declare backend with int type Yuanhan Liu
2016-05-13  5:24   ` [dpdk-dev] [PATCH v2 02/19] vhost: set/reset dev flags internally Yuanhan Liu
2016-05-13  5:24   ` [dpdk-dev] [PATCH v2 03/19] vhost: declare device fh as int Yuanhan Liu
2016-05-13  5:24   ` [dpdk-dev] [PATCH v2 04/19] examples/vhost: make a copy of virtio device id Yuanhan Liu
2016-05-13  5:24   ` [dpdk-dev] [PATCH v2 05/19] vhost: rename device fh to vid Yuanhan Liu
2016-05-13  5:24   ` [dpdk-dev] [PATCH v2 06/19] vhost: get device by vid only Yuanhan Liu
2016-05-13  5:24   ` Yuanhan Liu [this message]
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 08/19] vhost: introduce new API to export numa node Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 09/19] vhost: introduce new API to export number of queues Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 10/19] vhost: introduce new API to export ifname Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 11/19] vhost: introduce new API to export queue free entries Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 12/19] vhost: remove dependency on priv field Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 13/19] vhost: export vid as the only interface to applications Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 14/19] vhost: hide internal structs/macros/functions Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 15/19] vhost: remove unnecessary fields Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 16/19] vhost: remove virtio-net.h Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 17/19] vhost: reserve few more space for future extension Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 18/19] vhost: per device virtio net header len Yuanhan Liu
2016-05-13  5:25   ` [dpdk-dev] [PATCH v2 19/19] vhost: make buf vector for scatter Rx local Yuanhan Liu
2016-05-26 17:04   ` [dpdk-dev] [PATCH v2 00/19] vhost ABI/API refactoring Rich Lane
2016-05-27  1:36     ` Yuanhan Liu
2016-06-07  3:51   ` [dpdk-dev] [PATCH v3 00/20] " Yuanhan Liu
2016-06-07  3:51     ` [dpdk-dev] [PATCH v3 01/20] vhost: declare backend with int type Yuanhan Liu
2016-06-07  3:51     ` [dpdk-dev] [PATCH v3 02/20] vhost: set/reset dev flags internally Yuanhan Liu
2016-06-07  3:51     ` [dpdk-dev] [PATCH v3 03/20] vhost: declare device fh as int Yuanhan Liu
2016-06-07  3:51     ` [dpdk-dev] [PATCH v3 04/20] examples/vhost: make a copy of virtio device id Yuanhan Liu
2016-06-07  3:51     ` [dpdk-dev] [PATCH v3 05/20] vhost: rename device fh to vid Yuanhan Liu
2016-06-07  3:51     ` [dpdk-dev] [PATCH v3 06/20] vhost: get device by vid only Yuanhan Liu
2016-06-07  3:51     ` [dpdk-dev] [PATCH v3 07/20] vhost: move vhost device ctx to cuse Yuanhan Liu
2016-06-07  3:51     ` [dpdk-dev] [PATCH v3 08/20] vhost: introduce new API to export numa node Yuanhan Liu
2016-06-07 11:42       ` Panu Matilainen
2016-06-07 12:45         ` Yuanhan Liu
2016-06-08 21:51       ` Rich Lane
2016-06-09  4:45         ` Yuanhan Liu
2016-06-13 10:05           ` Yuanhan Liu
2016-06-07  3:51     ` [dpdk-dev] [PATCH v3 09/20] vhost: introduce new API to export number of queues Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 10/20] vhost: introduce new API to export ifname Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 11/20] vhost: introduce new API to export queue free entries Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 12/20] vhost: remove dependency on priv field Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 13/20] vhost: export vid as the only interface to applications Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 14/20] vhost: hide internal structs/macros/functions Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 15/20] vhost: remove unnecessary fields Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 16/20] vhost: remove virtio-net.h Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 17/20] vhost: reserve few more space for future extension Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 18/20] examples/tep_term: adapt to new vhost ABI/API changes Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 19/20] vhost: per device virtio net header len Yuanhan Liu
2016-06-07  3:52     ` [dpdk-dev] [PATCH v3 20/20] vhost: make buf vector for scatter Rx local Yuanhan Liu
2016-06-14 12:00     ` [dpdk-dev] [PATCH v3 00/20] vhost ABI/API refactoring Yuanhan Liu
2016-06-30  7:39     ` Panu Matilainen
2016-06-30  7:57       ` Yuanhan Liu
2016-06-30  9:05         ` Panu Matilainen
2016-06-30 11:15           ` Mcnamara, John
2016-06-30 11:40             ` Thomas Monjalon

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=1463117111-27050-8-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    --cc=kevin.traynor@intel.com \
    --cc=mukawa@igel.co.jp \
    --cc=pmatilai@redhat.com \
    --cc=rich.lane@bigswitch.com \
    --cc=thomas.monjalon@6wind.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).