From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id A3F7C7CD8 for ; Fri, 2 Feb 2018 12:33:46 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 03:33:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,448,1511856000"; d="scan'208";a="171132730" Received: from unknown (HELO dpdk98.sh.intel.com) ([10.67.111.140]) by orsmga004.jf.intel.com with ESMTP; 02 Feb 2018 03:33:43 -0800 From: Zhihong Wang To: dev@dpdk.org Cc: jianfeng.tan@intel.com, tiwei.bie@intel.com, maxime.coquelin@redhat.com, yliu@fridaylinux.org, cunming.liang@intel.com, xiao.w.wang@intel.com, dan.daly@intel.com, Zhihong Wang Date: Fri, 2 Feb 2018 18:28:52 -0500 Message-Id: <1517614137-62926-3-git-send-email-zhihong.wang@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1517614137-62926-1-git-send-email-zhihong.wang@intel.com> References: <1517614137-62926-1-git-send-email-zhihong.wang@intel.com> Subject: [dpdk-dev] [PATCH 2/7] vhost: export vhost feature definitions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 11:33:47 -0000 This patch exports vhost-user protocol features to support device driver development. Signed-off-by: Zhihong Wang --- lib/librte_vhost/rte_vhost.h | 8 ++++++++ lib/librte_vhost/vhost.h | 4 +--- lib/librte_vhost/vhost_user.c | 9 +++++---- lib/librte_vhost/vhost_user.h | 20 +++++++------------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h index 12cf48f..6c92580 100644 --- a/lib/librte_vhost/rte_vhost.h +++ b/lib/librte_vhost/rte_vhost.h @@ -29,6 +29,14 @@ extern "C" { #define RTE_VHOST_USER_DEQUEUE_ZERO_COPY (1ULL << 2) #define RTE_VHOST_USER_IOMMU_SUPPORT (1ULL << 3) +#define RTE_VHOST_USER_PROTOCOL_F_MQ 0 +#define RTE_VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 +#define RTE_VHOST_USER_PROTOCOL_F_RARP 2 +#define RTE_VHOST_USER_PROTOCOL_F_REPLY_ACK 3 +#define RTE_VHOST_USER_PROTOCOL_F_NET_MTU 4 +#define RTE_VHOST_USER_PROTOCOL_F_SLAVE_REQ 5 +#define RTE_VHOST_USER_F_PROTOCOL_FEATURES 30 + /** * Information relating to memory regions including offsets to * addresses in QEMUs memory file. diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 646aad3..09a745d 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -172,8 +172,6 @@ struct vhost_msg { #define VIRTIO_F_VERSION_1 32 #endif -#define VHOST_USER_F_PROTOCOL_FEATURES 30 - /* Features supported by this builtin vhost-user net driver. */ #define VIRTIO_NET_SUPPORTED_FEATURES ((1ULL << VIRTIO_NET_F_MRG_RXBUF) | \ (1ULL << VIRTIO_F_ANY_LAYOUT) | \ @@ -183,7 +181,7 @@ struct vhost_msg { (1ULL << VIRTIO_NET_F_MQ) | \ (1ULL << VIRTIO_F_VERSION_1) | \ (1ULL << VHOST_F_LOG_ALL) | \ - (1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \ + (1ULL << RTE_VHOST_USER_F_PROTOCOL_FEATURES) | \ (1ULL << VIRTIO_NET_F_GSO) | \ (1ULL << VIRTIO_NET_F_HOST_TSO4) | \ (1ULL << VIRTIO_NET_F_HOST_TSO6) | \ diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 87ba267..b1762e6 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -510,7 +510,7 @@ vhost_user_set_vring_addr(struct virtio_net **pdev, VhostUserMsg *msg) vring_invalidate(dev, vq); if (vq->enabled && (dev->features & - (1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) { + (1ULL << RTE_VHOST_USER_F_PROTOCOL_FEATURES))) { dev = translate_ring_addresses(dev, msg->payload.state.index); if (!dev) return -1; @@ -847,11 +847,11 @@ vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *pmsg) vq = dev->virtqueue[file.index]; /* - * When VHOST_USER_F_PROTOCOL_FEATURES is not negotiated, + * When RTE_VHOST_USER_F_PROTOCOL_FEATURES is not negotiated, * the ring starts already enabled. Otherwise, it is enabled via * the SET_VRING_ENABLE message. */ - if (!(dev->features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) + if (!(dev->features & (1ULL << RTE_VHOST_USER_F_PROTOCOL_FEATURES))) vq->enabled = 1; if (vq->kickfd >= 0) @@ -961,7 +961,8 @@ vhost_user_get_protocol_features(struct virtio_net *dev) * Qemu versions (from v2.7.0 to v2.9.0). */ if (!(features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) - protocol_features &= ~(1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK); + protocol_features &= + ~(1ULL << RTE_VHOST_USER_PROTOCOL_F_REPLY_ACK); return protocol_features; } diff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h index d4bd604..58e475d 100644 --- a/lib/librte_vhost/vhost_user.h +++ b/lib/librte_vhost/vhost_user.h @@ -14,19 +14,13 @@ #define VHOST_MEMORY_MAX_NREGIONS 8 -#define VHOST_USER_PROTOCOL_F_MQ 0 -#define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 -#define VHOST_USER_PROTOCOL_F_RARP 2 -#define VHOST_USER_PROTOCOL_F_REPLY_ACK 3 -#define VHOST_USER_PROTOCOL_F_NET_MTU 4 -#define VHOST_USER_PROTOCOL_F_SLAVE_REQ 5 - -#define VHOST_USER_PROTOCOL_FEATURES ((1ULL << VHOST_USER_PROTOCOL_F_MQ) | \ - (1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) |\ - (1ULL << VHOST_USER_PROTOCOL_F_RARP) | \ - (1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK) | \ - (1ULL << VHOST_USER_PROTOCOL_F_NET_MTU) | \ - (1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ)) +#define VHOST_USER_PROTOCOL_FEATURES \ + ((1ULL << RTE_VHOST_USER_PROTOCOL_F_MQ) | \ + (1ULL << RTE_VHOST_USER_PROTOCOL_F_LOG_SHMFD) |\ + (1ULL << RTE_VHOST_USER_PROTOCOL_F_RARP) | \ + (1ULL << RTE_VHOST_USER_PROTOCOL_F_REPLY_ACK) | \ + (1ULL << RTE_VHOST_USER_PROTOCOL_F_NET_MTU) | \ + (1ULL << RTE_VHOST_USER_PROTOCOL_F_SLAVE_REQ)) typedef enum VhostUserRequest { VHOST_USER_NONE = 0, -- 2.7.5