[3/4] net/virtio: use virtio barrier in packed ring
diff mbox series

Message ID 20190122170143.5650-4-tiwei.bie@intel.com
State Accepted, archived
Delegated to: Maxime Coquelin
Headers show
Series
  • Virtio fixes
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tiwei Bie Jan. 22, 2019, 5:01 p.m. UTC
Always use the virtio variants which support the platform
memory ordering.

Fixes: 9230ab8d7913 ("net/virtio: support platform memory ordering")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtio_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ilya Maximets Jan. 23, 2019, 3:52 p.m. UTC | #1
On 22.01.2019 20:01, Tiwei Bie wrote:
> Always use the virtio variants which support the platform
> memory ordering.
> 
> Fixes: 9230ab8d7913 ("net/virtio: support platform memory ordering")
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---

Thanks.
For some reason rte_smp_* barriers used directly here instead of virtio_*.
So, I missed them while rebasing on top of packed rings.

Acked-by: Ilya Maximets <i.maximets@samsung.com>

>  drivers/net/virtio/virtio_rxtx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
> index ebb86ef70..cc476b898 100644
> --- a/drivers/net/virtio/virtio_rxtx.c
> +++ b/drivers/net/virtio/virtio_rxtx.c
> @@ -425,7 +425,7 @@ virtqueue_enqueue_recv_refill_packed(struct virtqueue *vq,
>  		vq->vq_desc_head_idx = dxp->next;
>  		if (vq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END)
>  			vq->vq_desc_tail_idx = vq->vq_desc_head_idx;
> -		rte_smp_wmb();
> +		virtio_wmb(hw->weak_barriers);
>  		start_dp[idx].flags = flags;
>  		if (++vq->vq_avail_idx >= vq->vq_nentries) {
>  			vq->vq_avail_idx -= vq->vq_nentries;
> @@ -687,7 +687,7 @@ virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
>  
>  	vq->vq_avail_idx = idx;
>  
> -	rte_smp_wmb();
> +	virtio_wmb(vq->hw->weak_barriers);
>  	head_dp->flags = head_flags;
>  }
>  
>
Maxime Coquelin Jan. 23, 2019, 10:09 p.m. UTC | #2
On 1/22/19 6:01 PM, Tiwei Bie wrote:
> Always use the virtio variants which support the platform
> memory ordering.
> 
> Fixes: 9230ab8d7913 ("net/virtio: support platform memory ordering")
> 
> Signed-off-by: Tiwei Bie<tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtio_rxtx.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

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

Thanks,
Maxime

Patch
diff mbox series

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index ebb86ef70..cc476b898 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -425,7 +425,7 @@  virtqueue_enqueue_recv_refill_packed(struct virtqueue *vq,
 		vq->vq_desc_head_idx = dxp->next;
 		if (vq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END)
 			vq->vq_desc_tail_idx = vq->vq_desc_head_idx;
-		rte_smp_wmb();
+		virtio_wmb(hw->weak_barriers);
 		start_dp[idx].flags = flags;
 		if (++vq->vq_avail_idx >= vq->vq_nentries) {
 			vq->vq_avail_idx -= vq->vq_nentries;
@@ -687,7 +687,7 @@  virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
 
 	vq->vq_avail_idx = idx;
 
-	rte_smp_wmb();
+	virtio_wmb(vq->hw->weak_barriers);
 	head_dp->flags = head_flags;
 }