Skip to content

Commit

Permalink
vhost: enable packed virtqueues
Browse files Browse the repository at this point in the history
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 <jfreimann@redhat.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
  • Loading branch information
Yuanhan Liu authored and jensfr committed Jan 29, 2018
1 parent 8b5aef9 commit 86eff8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/librte_vhost/vhost.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ struct vhost_msg {
(1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) | \
(1ULL << VIRTIO_NET_F_MQ) | \
(1ULL << VIRTIO_F_VERSION_1) | \
(1ULL << VIRTIO_F_PACKED) | \
(1ULL << VHOST_F_LOG_ALL) | \
(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
(1ULL << VIRTIO_NET_F_GSO) | \
Expand Down
7 changes: 6 additions & 1 deletion lib/librte_vhost/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,9 @@ rte_vhost_enqueue_burst(int vid, uint16_t queue_id,
if (!dev)
return 0;

if (dev->features & (1 << VIRTIO_NET_F_MRG_RXBUF))
if (dev->features & (1ULL << VIRTIO_F_PACKED))
return vhost_enqueue_burst_1_1(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);
Expand Down Expand Up @@ -1456,6 +1458,9 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
if (unlikely(vq->enabled == 0))
goto out_access_unlock;

if (dev->features & (1ULL << VIRTIO_F_PACKED))
return vhost_dequeue_burst_1_1(dev, vq, mbuf_pool, pkts, count);

vq->batch_copy_nb_elems = 0;

if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
Expand Down

0 comments on commit 86eff8c

Please sign in to comment.