virtio: use one way barrier for split vring used index
authorJoyce Kong <joyce.kong@arm.com>
Thu, 30 Apr 2020 09:14:36 +0000 (17:14 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 5 May 2020 13:54:26 +0000 (15:54 +0200)
commitea5207c158edb00d7e5da17369ea45a462a40dcc
treeb61048b1dc965247a9b0354f4cf0da9047b1d6bb
parent68ca93e31cff53d7726d5f7e2b71c5c1cb1743e6
virtio: use one way barrier for split vring used index

In case VIRTIO_F_ORDER_PLATFORM(36) is not negotiated, then the frontend
and backend are assumed to be implemented in software, that is they can
run on identical CPUs in an SMP configuration.
Thus a weak form of memory barriers like rte_smp_r/wmb, other than
rte_cio_r/wmb, is sufficient for this case(vq->hw->weak_barriers == 1)
and yields better performance.
For the above case, this patch helps yielding even better performance
by replacing the two-way barriers with C11 one-way barriers for used
index in split ring.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtio_ring.h
drivers/net/virtio/virtio_rxtx.c
drivers/net/virtio/virtio_rxtx_simple_altivec.c
drivers/net/virtio/virtio_rxtx_simple_neon.c
drivers/net/virtio/virtio_rxtx_simple_sse.c
drivers/net/virtio/virtio_user/virtio_user_dev.c
drivers/net/virtio/virtqueue.c
drivers/net/virtio/virtqueue.h
lib/librte_vhost/virtio_net.c