[01/15] vhost: remove vhost kernel header inclusion

Message ID 20190829080000.20806-2-maxime.coquelin@redhat.com (mailing list archive)
State Rejected, archived
Delegated to: Maxime Coquelin
Headers
Series Introduce Virtio vDPA driver |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues
ci/iol-dpdk_compile_spdk fail Compilie Testing issues
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/iol-dpdk_compile success Compile Testing PASS
ci/intel-Performance success Performance Testing PASS
ci/mellanox-Performance success Performance Testing PASS

Commit Message

Maxime Coquelin Aug. 29, 2019, 7:59 a.m. UTC
  This is preliminary rework for virtio-vdpa driver, in
order to avoid conflicts with Virtio PMD headers.

Generally, I think it is better not to include kernel
headers in RTE headers, especially in the case of Vhost
and Virtio which just re-use the kernel definitions,
and has no runtime dependencies.

In order to not break IFC driver build, the vhost kernel
header is now included directly in the driver.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/ifc/ifcvf_vdpa.c | 1 +
 lib/librte_vhost/rte_vdpa.h  | 1 -
 lib/librte_vhost/rte_vhost.h | 9 ++++-----
 3 files changed, 5 insertions(+), 6 deletions(-)
  

Comments

Tiwei Bie Sept. 2, 2019, 6:03 a.m. UTC | #1
On Thu, Aug 29, 2019 at 09:59:46AM +0200, Maxime Coquelin wrote:
> This is preliminary rework for virtio-vdpa driver, in
> order to avoid conflicts with Virtio PMD headers.
> 
> Generally, I think it is better not to include kernel
> headers in RTE headers, especially in the case of Vhost
> and Virtio which just re-use the kernel definitions,
> and has no runtime dependencies.
> 
> In order to not break IFC driver build, the vhost kernel
> header is now included directly in the driver.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/ifc/ifcvf_vdpa.c | 1 +
>  lib/librte_vhost/rte_vdpa.h  | 1 -
>  lib/librte_vhost/rte_vhost.h | 9 ++++-----
>  3 files changed, 5 insertions(+), 6 deletions(-)

Vhost examples need to be updated as well.

Regards,
Tiwei

> 
> diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
> index 8de9ef199..40cb15ca8 100644
  
Maxime Coquelin Sept. 3, 2019, 7:24 a.m. UTC | #2
On 9/2/19 8:03 AM, Tiwei Bie wrote:
> On Thu, Aug 29, 2019 at 09:59:46AM +0200, Maxime Coquelin wrote:
>> This is preliminary rework for virtio-vdpa driver, in
>> order to avoid conflicts with Virtio PMD headers.
>>
>> Generally, I think it is better not to include kernel
>> headers in RTE headers, especially in the case of Vhost
>> and Virtio which just re-use the kernel definitions,
>> and has no runtime dependencies.
>>
>> In order to not break IFC driver build, the vhost kernel
>> header is now included directly in the driver.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>>  drivers/net/ifc/ifcvf_vdpa.c | 1 +
>>  lib/librte_vhost/rte_vdpa.h  | 1 -
>>  lib/librte_vhost/rte_vhost.h | 9 ++++-----
>>  3 files changed, 5 insertions(+), 6 deletions(-)
> 
> Vhost examples need to be updated as well.

Ha, yes, good catch.
It will be done in v2.

Thanks,
Maxime

> Regards,
> Tiwei
> 
>>
>> diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
>> index 8de9ef199..40cb15ca8 100644
  

Patch

diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
index 8de9ef199..40cb15ca8 100644
--- a/drivers/net/ifc/ifcvf_vdpa.c
+++ b/drivers/net/ifc/ifcvf_vdpa.c
@@ -7,6 +7,7 @@ 
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/epoll.h>
+#include <linux/vhost.h>
 #include <linux/virtio_net.h>
 #include <stdbool.h>
 
diff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h
index 9a3deb31d..69438210b 100644
--- a/lib/librte_vhost/rte_vdpa.h
+++ b/lib/librte_vhost/rte_vdpa.h
@@ -14,7 +14,6 @@ 
 #include <stdbool.h>
 
 #include <rte_pci.h>
-#include "rte_vhost.h"
 
 #define MAX_VDPA_NAME_LEN 128
 
diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h
index 7fb172912..62d3c3c36 100644
--- a/lib/librte_vhost/rte_vhost.h
+++ b/lib/librte_vhost/rte_vhost.h
@@ -20,11 +20,6 @@ 
 extern "C" {
 #endif
 
-/* These are not C++-aware. */
-#include <linux/vhost.h>
-#include <linux/virtio_ring.h>
-#include <linux/virtio_net.h>
-
 #define RTE_VHOST_USER_CLIENT		(1ULL << 0)
 #define RTE_VHOST_USER_NO_RECONNECT	(1ULL << 1)
 #define RTE_VHOST_USER_DEQUEUE_ZERO_COPY	(1ULL << 2)
@@ -72,6 +67,10 @@  extern "C" {
 #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER 11
 #endif
 
+#ifndef VHOST_F_LOG_ALL
+#define VHOST_F_LOG_ALL			26
+#endif
+
 /** Indicate whether protocol features negotiation is supported. */
 #ifndef VHOST_USER_F_PROTOCOL_FEATURES
 #define VHOST_USER_F_PROTOCOL_FEATURES	30