diff mbox series

[v1,1/4] net/virtio: remove unnecessary rmb barrier

Message ID 20201221142321.51606-2-joyce.kong@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers show
Series replace smp barriers in virtio with C11 atomic | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Joyce Kong Dec. 21, 2020, 2:23 p.m. UTC
As desc_is_used has a load-acquire or rte_io_rmb inside
and wait for used desc in virtqueue, it is ok to remove
virtio_rmb behind it.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 drivers/net/virtio/virtio_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Maxime Coquelin Jan. 7, 2021, 2:12 p.m. UTC | #1
On 12/21/20 3:23 PM, Joyce Kong wrote:
> As desc_is_used has a load-acquire or rte_io_rmb inside
> and wait for used desc in virtqueue, it is ok to remove
> virtio_rmb behind it.
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 6c233b75b..0d91f7a50 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -209,12 +209,12 @@ virtio_send_command_packed(struct virtnet_ctl *cvq,
>  	virtio_wmb(vq->hw->weak_barriers);
>  	virtqueue_notify(vq);
>  
> -	/* wait for used descriptors in virtqueue */
> +	/* wait for used desc in virtqueue
> +	 * desc_is_used has a load-acquire or rte_io_rmb inside
> +	 */
>  	while (!desc_is_used(&desc[head], vq))
>  		usleep(100);
>  
> -	virtio_rmb(vq->hw->weak_barriers);
> -
>  	/* now get used descriptors */
>  	vq->vq_free_cnt += nb_descs;
>  	vq->vq_used_cons_idx += nb_descs;
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
diff mbox series

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 6c233b75b..0d91f7a50 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -209,12 +209,12 @@  virtio_send_command_packed(struct virtnet_ctl *cvq,
 	virtio_wmb(vq->hw->weak_barriers);
 	virtqueue_notify(vq);
 
-	/* wait for used descriptors in virtqueue */
+	/* wait for used desc in virtqueue
+	 * desc_is_used has a load-acquire or rte_io_rmb inside
+	 */
 	while (!desc_is_used(&desc[head], vq))
 		usleep(100);
 
-	virtio_rmb(vq->hw->weak_barriers);
-
 	/* now get used descriptors */
 	vq->vq_free_cnt += nb_descs;
 	vq->vq_used_cons_idx += nb_descs;