This patch adds descriptor prefetch to hide cache access latency. Signed-off-by: Zhihong Wang <zhihong.wang at intel.com> --- lib/librte_vhost/vhost_rxtx.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index 939957d..7db83d0 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -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; } -- 2.7.4