[dpdk-dev,13/17] vhost: do not include net specific headers
Checks
Commit Message
Include it internally, at vhost.h.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
examples/vhost/main.h | 2 ++
lib/librte_vhost/rte_virtio_net.h | 4 ----
lib/librte_vhost/vhost.h | 4 ++++
3 files changed, 6 insertions(+), 4 deletions(-)
Comments
On 03/03/2017 10:51 AM, Yuanhan Liu wrote:
> Include it internally, at vhost.h.
>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
> examples/vhost/main.h | 2 ++
> lib/librte_vhost/rte_virtio_net.h | 4 ----
> lib/librte_vhost/vhost.h | 4 ++++
> 3 files changed, 6 insertions(+), 4 deletions(-)
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> Sent: Friday, March 3, 2017 5:51 PM
> To: dev@dpdk.org
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; Harris, James R
> <james.r.harris@intel.com>; Liu, Changpeng <changpeng.liu@intel.com>; Yuanhan
> Liu <yuanhan.liu@linux.intel.com>
> Subject: [PATCH 13/17] vhost: do not include net specific headers
>
> Include it internally, at vhost.h.
>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
> examples/vhost/main.h | 2 ++
> lib/librte_vhost/rte_virtio_net.h | 4 ----
> lib/librte_vhost/vhost.h | 4 ++++
> 3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/examples/vhost/main.h b/examples/vhost/main.h
> index 7a3d251..ddcd858 100644
> --- a/examples/vhost/main.h
> +++ b/examples/vhost/main.h
> @@ -36,6 +36,8 @@
>
> #include <sys/queue.h>
>
> +#include <rte_ether.h>
> +
> /* Macros for printing using RTE_LOG */
> #define RTE_LOGTYPE_VHOST_CONFIG RTE_LOGTYPE_USER1
> #define RTE_LOGTYPE_VHOST_DATA RTE_LOGTYPE_USER2
> diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h
> index fa98d29..e19ebad 100644
> --- a/lib/librte_vhost/rte_virtio_net.h
> +++ b/lib/librte_vhost/rte_virtio_net.h
> @@ -42,14 +42,10 @@
> #include <stdint.h>
> #include <linux/vhost.h>
> #include <linux/virtio_ring.h>
> -#include <linux/virtio_net.h>
> #include <sys/eventfd.h>
> -#include <sys/socket.h>
> -#include <linux/if.h>
>
> #include <rte_memory.h>
> #include <rte_mempool.h>
> -#include <rte_ether.h>
One small nits here, remove net specific headers is good idea, since API rte_vhost_dequeue_burst/rte_vhost_enqueue_burst
has "struct rte_mbuf" declared parameter, user must include <rte_mbuf.h> in their own applications.
Can we add extra line "struct rte_mbuf;" before the rte_vhost_dequeue_burst/rte_vhost_enqueue_burst
APIs to avoid such extra includes?
>
> #define RTE_VHOST_USER_CLIENT (1ULL << 0)
> #define RTE_VHOST_USER_NO_RECONNECT (1ULL << 1)
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index 829a45b..5bc0ebe 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -39,8 +39,12 @@
> #include <sys/queue.h>
> #include <unistd.h>
> #include <linux/vhost.h>
> +#include <linux/virtio_net.h>
> +#include <sys/socket.h>
> +#include <linux/if.h>
>
> #include <rte_log.h>
> +#include <rte_ether.h>
>
> #include "rte_virtio_net.h"
>
> --
> 1.9.0
On Mon, Mar 20, 2017 at 07:32:45AM +0000, Liu, Changpeng wrote:
> > diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h
> > index fa98d29..e19ebad 100644
> > --- a/lib/librte_vhost/rte_virtio_net.h
> > +++ b/lib/librte_vhost/rte_virtio_net.h
> > @@ -42,14 +42,10 @@
> > #include <stdint.h>
> > #include <linux/vhost.h>
> > #include <linux/virtio_ring.h>
> > -#include <linux/virtio_net.h>
> > #include <sys/eventfd.h>
> > -#include <sys/socket.h>
> > -#include <linux/if.h>
> >
> > #include <rte_memory.h>
> > #include <rte_mempool.h>
> > -#include <rte_ether.h>
>
> One small nits here, remove net specific headers is good idea, since API rte_vhost_dequeue_burst/rte_vhost_enqueue_burst
> has "struct rte_mbuf" declared parameter, user must include <rte_mbuf.h> in their own applications.
> Can we add extra line "struct rte_mbuf;" before the rte_vhost_dequeue_burst/rte_vhost_enqueue_burst
> APIs to avoid such extra includes?
Good suggestion, and sure, we can do that.
And I had a plan to add a config option to not build the net driver
when it's given. Thus, it could give us a vhost with minimum dependences,
say no dependence on mbuf, on rte_malloc and etc.
I was thinking to name it to "CONFIG_RTE_VHOST_MINIMUM", or something
like that. It's likely something I will do in the next release.
--yliu
@@ -36,6 +36,8 @@
#include <sys/queue.h>
+#include <rte_ether.h>
+
/* Macros for printing using RTE_LOG */
#define RTE_LOGTYPE_VHOST_CONFIG RTE_LOGTYPE_USER1
#define RTE_LOGTYPE_VHOST_DATA RTE_LOGTYPE_USER2
@@ -42,14 +42,10 @@
#include <stdint.h>
#include <linux/vhost.h>
#include <linux/virtio_ring.h>
-#include <linux/virtio_net.h>
#include <sys/eventfd.h>
-#include <sys/socket.h>
-#include <linux/if.h>
#include <rte_memory.h>
#include <rte_mempool.h>
-#include <rte_ether.h>
#define RTE_VHOST_USER_CLIENT (1ULL << 0)
#define RTE_VHOST_USER_NO_RECONNECT (1ULL << 1)
@@ -39,8 +39,12 @@
#include <sys/queue.h>
#include <unistd.h>
#include <linux/vhost.h>
+#include <linux/virtio_net.h>
+#include <sys/socket.h>
+#include <linux/if.h>
#include <rte_log.h>
+#include <rte_ether.h>
#include "rte_virtio_net.h"