vhost: fix features definition location
authorMatan Azrad <matan@mellanox.com>
Thu, 18 Jun 2020 19:08:20 +0000 (19:08 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 30 Jun 2020 12:52:31 +0000 (14:52 +0200)
The vhost library provide an infrastructure in order to help the DPDK
users to manage vhost devices.

One of the infrastructure parts is the features enablement APIs.

Some features bits may be defined only in the internal file vhost.h in
case the kernel version doesn't include them.

Hence, user running on old kernel may not be able to manage thus
features.

Move all the feature bits definitions to the API file rte_vhost.h.

Fixes: db69be54b6ff ("vhost: hide internal code")
Fixes: 8d286dbeb8d7 ("vhost: fix multiple queue not enabled for old kernels")
Fixes: 3d3c6590b58c ("vhost: enable virtio MTU feature")
Fixes: 704098fc478c ("vhost: fix build with old kernels")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/rte_vhost.h
lib/librte_vhost/vhost.h

index 2fbc364..8a5c332 100644 (file)
@@ -36,6 +36,23 @@ extern "C" {
 /* support only linear buffers (no chained mbufs) */
 #define RTE_VHOST_USER_LINEARBUF_SUPPORT       (1ULL << 6)
 
+/* Features. */
+#ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
+ #define VIRTIO_NET_F_GUEST_ANNOUNCE 21
+#endif
+
+#ifndef VIRTIO_NET_F_MQ
+ #define VIRTIO_NET_F_MQ               22
+#endif
+
+#ifndef VIRTIO_NET_F_MTU
+ #define VIRTIO_NET_F_MTU 3
+#endif
+
+#ifndef VIRTIO_F_ANY_LAYOUT
+ #define VIRTIO_F_ANY_LAYOUT           27
+#endif
+
 /** Protocol features. */
 #ifndef VHOST_USER_PROTOCOL_F_MQ
 #define VHOST_USER_PROTOCOL_F_MQ       0
index a0fe703..0344636 100644 (file)
@@ -204,26 +204,9 @@ struct vhost_virtqueue {
        TAILQ_HEAD(, vhost_iotlb_entry) iotlb_pending_list;
 } __rte_cache_aligned;
 
-/* Old kernels have no such macros defined */
-#ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
- #define VIRTIO_NET_F_GUEST_ANNOUNCE 21
-#endif
-
-#ifndef VIRTIO_NET_F_MQ
- #define VIRTIO_NET_F_MQ               22
-#endif
-
 #define VHOST_MAX_VRING                        0x100
 #define VHOST_MAX_QUEUE_PAIRS          0x80
 
-#ifndef VIRTIO_NET_F_MTU
- #define VIRTIO_NET_F_MTU 3
-#endif
-
-#ifndef VIRTIO_F_ANY_LAYOUT
- #define VIRTIO_F_ANY_LAYOUT           27
-#endif
-
 /* Declare IOMMU related bits for older kernels */
 #ifndef VIRTIO_F_IOMMU_PLATFORM