vhost: fix multiple queue not enabled for old kernels
authorYuanhan Liu <yuanhan.liu@linux.intel.com>
Wed, 1 Mar 2017 10:41:58 +0000 (18:41 +0800)
committerYuanhan Liu <yuanhan.liu@linux.intel.com>
Sat, 1 Apr 2017 06:58:54 +0000 (08:58 +0200)
Some macros (say VIRTIO_NET_F_MQ) are needed for enabling multiple queue,
however they are introduced since kernel v3.8, meaning build error happens
if we build DPDK vhost on those platforms.

71dfdbe66a66 ("vhost: fix build with kernel < 3.8") meant to fix it, but
in a wrong way: it completely disables the MQ features for those kernels.
However, the MQ feature doesn't depend on the kernel at all (except the
macros dependency stated above), that we could still enable the MQ feature
even the host kernel has no such support.

The right fix is to define the macro if it's not defined.

Fixes: 71dfdbe66a66 ("vhost: fix build with kernel < 3.8")
Cc: stable@dpdk.org
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost.c
lib/librte_vhost/vhost.h

index e415093..3c3f6a4 100644 (file)
@@ -56,7 +56,7 @@
                                (1ULL << VIRTIO_NET_F_CTRL_VQ) | \
                                (1ULL << VIRTIO_NET_F_CTRL_RX) | \
                                (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) | \
                                (1ULL << VIRTIO_NET_F_CTRL_VQ) | \
                                (1ULL << VIRTIO_NET_F_CTRL_RX) | \
                                (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) | \
-                               (VHOST_SUPPORTS_MQ)            | \
+                               (1ULL << VIRTIO_NET_F_MQ)      | \
                                (1ULL << VIRTIO_F_VERSION_1)   | \
                                (1ULL << VHOST_F_LOG_ALL)      | \
                                (1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
                                (1ULL << VIRTIO_F_VERSION_1)   | \
                                (1ULL << VHOST_F_LOG_ALL)      | \
                                (1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
index 22564f1..4391e62 100644 (file)
@@ -123,11 +123,10 @@ struct vhost_virtqueue {
  * code buildable for older kernel.
  */
 #ifdef VIRTIO_NET_F_MQ
  * code buildable for older kernel.
  */
 #ifdef VIRTIO_NET_F_MQ
- #define VHOST_MAX_QUEUE_PAIRS VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX
- #define VHOST_SUPPORTS_MQ     (1ULL << VIRTIO_NET_F_MQ)
+ #define VHOST_MAX_QUEUE_PAIRS         VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX
 #else
 #else
- #define VHOST_MAX_QUEUE_PAIRS 1
- #define VHOST_SUPPORTS_MQ     0
+ #define VIRTIO_NET_F_MQ               22
+ #define VHOST_MAX_QUEUE_PAIRS         0x8000
 #endif
 
 /*
 #endif
 
 /*