Skip to contentSkip to conversation

Some fixes for virtio and vhost

PATCH Applied Tiwei Bie 3 participants 6 messages Nov 6, 2018 – Nov 9, 2018 Network drivers

lore
Share & tools
lore

Tiwei Bie

author
#0 lore raw

cover Some fixes for virtio and vhost

Tiwei Bie (2):
vhost: fix IOVA access for packed ring
net/virtio-user: fix typo in error message

 drivers/net/virtio/virtio_user_ethdev.c | 2 +-
 lib/librte_vhost/virtio_net.c           | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.19.1
author
#1 lore raw

PATCH 1/2 vhost: fix IOVA access for packed ring

We should apply for RO access when receiving packets from the VM and apply for RW access when sending packets to the VM.

Fixes a922401f35cc ("vhost: add Rx support for packed ring")
Fixes ae999ce49dcb ("vhost: add Tx support for packed ring")
---
 lib/librte_vhost/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_vhost/virtio_net.c +2 -2
index 8ad30c94a..5e1a1a727 100644
@@ -598,7 +598,7 @@ reserve_avail_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
 						avail_idx, &desc_count,
 						buf_vec, &vec_idx,
 						&buf_id, &len,
-						VHOST_ACCESS_RO) < 0))
+						VHOST_ACCESS_RW) < 0))
 			return -1;
 
 		len = RTE_MIN(len, size);
@@ -1503,7 +1503,7 @@ virtio_dev_tx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
 						vq->last_avail_idx, &desc_count,
 						buf_vec, &nr_vec,
 						&buf_id, &dummy_len,
-						VHOST_ACCESS_RW) < 0))
+						VHOST_ACCESS_RO) < 0))
 			break;
 
 		if (likely(dev->dequeue_zero_copy == 0))
Signature · 1 line
2.19.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] vhost: fix IOVA access for packed ring

Quoted 27 lines · Tiwei Bie

We should apply for RO access when receiving packets from the VM and apply for RW access when sending packets to the VM.

Fixes a922401f35cc ("vhost: add Rx support for packed ring")
Fixes ae999ce49dcb ("vhost: add Tx support for packed ring")
---
  lib/librte_vhost/virtio_net.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_vhost/virtio_net.c +1 -1
index 8ad30c94a..5e1a1a727 100644
@@ -598,7 +598,7 @@ reserve_avail_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
  						avail_idx, &desc_count,
  						buf_vec, &vec_idx,
  						&buf_id, &len,
-						VHOST_ACCESS_RO) < 0))
+						VHOST_ACCESS_RW) < 0))
  			return -1;
 
  		len = RTE_MIN(len, size);

lib/librte_vhost/virtio_net.c virtio_dev_tx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, · line 1509

Quoted 8 lines
lib/librte_vhost/virtio_net.c +1 -1
@@ -1503,7 +1503,7 @@ virtio_dev_tx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
  						vq->last_avail_idx, &desc_count,
  						buf_vec, &nr_vec,
  						&buf_id, &dummy_len,
-						VHOST_ACCESS_RW) < 0))
+						VHOST_ACCESS_RO) < 0))
  			break;
 
  		if (likely(dev->dequeue_zero_copy == 0))

Ouch, good catch!

Thanks,
Maxime

author
#3 lore raw

PATCH 2/2 net/virtio-user: fix typo in error message

In reply to Tiwei Bie

The param we are checking is VIRTIO_USER_ARG_PATH, instead of VIRTIO_USER_ARG_QUEUE_SIZE.

Fixes ce2eabdd43ec ("net/virtio-user: add virtual device")
---
 drivers/net/virtio/virtio_user_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_user_ethdev.c +1 -1
index 61b7c0a38..f8791391a 100644
@@ -484,7 +484,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
 		}
 	} else {
 		PMD_INIT_LOG(ERR, "arg %s is mandatory for virtio_user",
-			  VIRTIO_USER_ARG_QUEUE_SIZE);
+			     VIRTIO_USER_ARG_PATH);
 		goto end;
 	}
 
Signature · 1 line
2.19.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] net/virtio-user: fix typo in error message

Quoted 11 lines · Tiwei Bie

The param we are checking is VIRTIO_USER_ARG_PATH, instead of VIRTIO_USER_ARG_QUEUE_SIZE.

Fixes ce2eabdd43ec ("net/virtio-user: add virtual device")

---
drivers/net/virtio/virtio_user_ethdev.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
#5 lore raw
In reply to Tiwei Bie
Quoted 8 lines · Tiwei Bie

Tiwei Bie (2):
vhost: fix IOVA access for packed ring
net/virtio-user: fix typo in error message

  drivers/net/virtio/virtio_user_ethdev.c | 2 +-
  lib/librte_vhost/virtio_net.c           | 4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)

Applied to dpdk-next-virtio/master

Thanks,
Maxime