From 8c6bd59704e6d46845b6751f1ce98d08532b33f9 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Sat, 16 Jun 2018 17:45:27 +0200 Subject: [PATCH] virtio: remove unnecessary if This `if` came from the original DPDK virtio PMD. Generally, we do not want to trigger cache coherency updates if we don't have to, but in this particular case we know we always do. If there were no changes to the avail index, there would be no requests started and the function would return much earlier. Change-Id: Ic1231cf82288c1cb95dc89346f54d51849b8bae9 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/415589 Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris Tested-by: SPDK Automated Test System --- lib/virtio/virtio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/virtio/virtio.c b/lib/virtio/virtio.c index 15d9f057b..987045b72 100644 --- a/lib/virtio/virtio.c +++ b/lib/virtio/virtio.c @@ -460,9 +460,7 @@ virtqueue_req_flush(struct virtqueue *vq) * descriptor. */ avail_idx = (uint16_t)(vq->vq_avail_idx & (vq->vq_nentries - 1)); - if (spdk_unlikely(vq->vq_ring.avail->ring[avail_idx] != vq->req_start)) { - vq->vq_ring.avail->ring[avail_idx] = vq->req_start; - } + vq->vq_ring.avail->ring[avail_idx] = vq->req_start; vq->vq_avail_idx++; vq->req_start = VQ_RING_DESC_CHAIN_END;