From: Huawei Xie Date: Wed, 8 Oct 2014 18:54:51 +0000 (+0800) Subject: vhost: get available vring entries X-Git-Tag: spdx-start~10290 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7202b0a8240158b317665c20525f81d55f16f602;p=dpdk.git vhost: get available vring entries Signed-off-by: Huawei Xie Acked-by: Changchun Ouyang [Thomas: split patch] --- diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h index 0e9c4735a9..73423dde03 100644 --- a/lib/librte_vhost/rte_virtio_net.h +++ b/lib/librte_vhost/rte_virtio_net.h @@ -119,6 +119,12 @@ struct virtio_net_device_ops { void (* destroy_device) (volatile struct virtio_net *); /* Remove device. */ }; +static inline uint16_t __attribute__((always_inline)) +rte_vring_available_entries(struct virtio_net *dev, uint16_t queue_id) +{ + struct vhost_virtqueue *vq = dev->virtqueue[queue_id]; + return *(volatile uint16_t *)&vq->avail->idx - vq->last_used_idx_res; +} /** * Function to convert guest physical addresses to vhost virtual addresses.