[dpdk-dev,v3,3/5] vhost: add desc prefetch
Commit Message
This patch adds descriptor prefetch to hide cache access latency.
Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
---
lib/librte_vhost/vhost_rxtx.c | 5 +++++
1 file changed, 5 insertions(+)
@@ -131,6 +131,11 @@ loop_check(struct vhost_virtqueue *vq, uint16_t avail_idx, uint32_t pkt_left)
if (pkt_left == 0 || avail_idx == vq->last_used_idx)
return 1;
+ /* prefetch the next desc */
+ if (pkt_left > 1 && avail_idx != vq->last_used_idx + 1)
+ rte_prefetch0(&vq->desc[vq->avail->ring[
+ (vq->last_used_idx + 1) & (vq->size - 1)]]);
+
return 0;
}