From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 74E4E379B; Thu, 23 Feb 2017 09:46:55 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2017 00:46:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,197,1484035200"; d="scan'208";a="937170011" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga003.jf.intel.com with ESMTP; 23 Feb 2017 00:46:53 -0800 From: Yuanhan Liu To: dev@dpdk.org Cc: Maxime Coquelin , Yuanhan Liu , stable@dpdk.org Date: Thu, 23 Feb 2017 16:45:50 +0800 Message-Id: <1487839550-21800-1-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 Subject: [dpdk-stable] [PATCH] vhost: fix multiple queue not being enabled for older kernels X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2017 08:46:56 -0000 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 --- lib/librte_vhost/vhost.c | 2 +- lib/librte_vhost/vhost.h | 11 ++++------- lib/librte_vhost/vhost_user.c | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index e415093..3c3f6a4 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -56,7 +56,7 @@ (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) | \ diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 22564f1..34af209 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -122,12 +122,9 @@ struct vhost_virtqueue { * introduced since kernel v3.8. This makes our * 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) -#else - #define VHOST_MAX_QUEUE_PAIRS 1 - #define VHOST_SUPPORTS_MQ 0 +#ifndef VIRTIO_NET_F_MQ + #define VIRTIO_NET_F_MQ 22 + #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 #endif /* @@ -159,7 +156,7 @@ struct virtio_net { rte_atomic16_t broadcast_rarp; uint32_t virt_qp_nb; int dequeue_zero_copy; - struct vhost_virtqueue *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2]; + struct vhost_virtqueue *virtqueue[VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX * 2]; #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ) char ifname[IF_NAME_SZ]; uint64_t log_size; diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index cb2156a..9825e01 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1015,7 +1015,7 @@ break; case VHOST_USER_GET_QUEUE_NUM: - msg.payload.u64 = VHOST_MAX_QUEUE_PAIRS; + msg.payload.u64 = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX; msg.size = sizeof(msg.payload.u64); send_vhost_message(fd, &msg); break; -- 1.9.0