From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 94D4CAAA2 for ; Fri, 16 Mar 2018 16:22:15 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3AFE1406E8D7; Fri, 16 Mar 2018 15:22:15 +0000 (UTC) Received: from localhost (dhcp-192-241.str.redhat.com [10.33.192.241]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1A24215CDAF; Fri, 16 Mar 2018 15:22:14 +0000 (UTC) From: Jens Freimann To: dev@dpdk.org Cc: tiwei.bie@intel.com, yliu@fridaylinux.org, maxime.coquelin@redhat.com, mst@redhat.com Date: Fri, 16 Mar 2018 16:21:17 +0100 Message-Id: <20180316152120.13199-15-jfreimann@redhat.com> In-Reply-To: <20180316152120.13199-1-jfreimann@redhat.com> References: <20180316152120.13199-1-jfreimann@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 16 Mar 2018 15:22:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 16 Mar 2018 15:22:15 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jfreimann@redhat.com' RCPT:'' Subject: [dpdk-dev] [PATCH 14/17] vhost: enable packed virtqueues 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, 16 Mar 2018 15:22:16 -0000 From: Yuanhan Liu This patch enables the code do enqueue and dequeue packed to/from a packed virtqueue. Add feature bit for packed virtqueues as defined in Virtio 1.1 draft. Signed-off-by: Jens Freimann Signed-off-by: Yuanhan Liu --- lib/librte_vhost/vhost.h | 1 + lib/librte_vhost/virtio_net.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index f77fefe..561d640 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -188,6 +188,7 @@ struct vhost_msg { (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) | \ (1ULL << VIRTIO_NET_F_MQ) | \ (1ULL << VIRTIO_F_VERSION_1) | \ + (1ULL << VIRTIO_F_RING_PACKED) | \ (1ULL << VHOST_F_LOG_ALL) | \ (1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \ (1ULL << VIRTIO_NET_F_GSO) | \ diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index ec4908a..d96d717 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -840,7 +840,9 @@ static inline uint32_t __attribute__((always_inline)) return 0; } - if (dev->features & (1 << VIRTIO_NET_F_MRG_RXBUF)) + if (dev->features & (1ULL << VIRTIO_F_RING_PACKED)) + return vhost_enqueue_burst_packed(dev, queue_id, pkts, count); + else if (dev->features & (1 << VIRTIO_NET_F_MRG_RXBUF)) return virtio_dev_merge_rx(dev, queue_id, pkts, count); else return virtio_dev_rx(dev, queue_id, pkts, count); @@ -1513,6 +1515,9 @@ static inline uint32_t __attribute__((always_inline)) if (unlikely(vq->enabled == 0)) goto out_access_unlock; + if (dev->features & (1ULL << VIRTIO_F_RING_PACKED)) + return vhost_dequeue_burst_packed(dev, vq, mbuf_pool, pkts, count); + vq->batch_copy_nb_elems = 0; if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) -- 1.8.3.1