Skip to contentSkip to conversation

vhost: fix return value on enqueue path

PATCH Applied Tiwei Bie 2 participants 3 messages Sep 6, 2018 – Sep 12, 2018

lore
Share & tools
lore

Tiwei Bie

author
#0 lore raw

PATCH 1/1 vhost: fix return value on enqueue path

Fixes 62250c1d0978 ("vhost: extract split ring handling from Rx and Tx functions")
Fixes a922401f35cc ("vhost: add Rx support for packed ring")
---
 lib/librte_vhost/virtio_net.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
lib/librte_vhost/virtio_net.c +4 -3
index 99c7afc88..4bfae76a6 100644
@@ -888,6 +888,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
 	struct rte_mbuf **pkts, uint32_t count)
 {
 	struct vhost_virtqueue *vq;
+	uint32_t nb_tx = 0;
 
 	VHOST_LOG_DEBUG(VHOST_DATA, "(%d) %s\n", dev->vid, __func__);
 	if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) {
@@ -915,9 +916,9 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
 		goto out;
 
 	if (vq_is_packed(dev))
-		count = virtio_dev_rx_packed(dev, vq, pkts, count);
+		nb_tx = virtio_dev_rx_packed(dev, vq, pkts, count);
 	else
-		count = virtio_dev_rx_split(dev, vq, pkts, count);
+		nb_tx = virtio_dev_rx_split(dev, vq, pkts, count);
 
 out:
 	if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
@@ -926,7 +927,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
 out_access_unlock:
 	rte_spinlock_unlock(&vq->access_lock);
 
-	return count;
+	return nb_tx;
 }
 
 uint16_t
Signature · 1 line
2.18.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Tiwei Bie
Fixes 62250c1d0978 ("vhost: extract split ring handling from Rx and Tx functions")
Fixes a922401f35cc ("vhost: add Rx support for packed ring")
---
  lib/librte_vhost/virtio_net.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

Good catch! Thanks for the fix.

Quoted 34 lines
lib/librte_vhost/virtio_net.c +4 -3
index 99c7afc88..4bfae76a6 100644
@@ -888,6 +888,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
  	struct rte_mbuf **pkts, uint32_t count)
  {
  	struct vhost_virtqueue *vq;
+	uint32_t nb_tx = 0;
 
  	VHOST_LOG_DEBUG(VHOST_DATA, "(%d) %s\n", dev->vid, __func__);
  	if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) {
@@ -915,9 +916,9 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
  		goto out;
 
  	if (vq_is_packed(dev))
-		count = virtio_dev_rx_packed(dev, vq, pkts, count);
+		nb_tx = virtio_dev_rx_packed(dev, vq, pkts, count);
  	else
-		count = virtio_dev_rx_split(dev, vq, pkts, count);
+		nb_tx = virtio_dev_rx_split(dev, vq, pkts, count);
 
  out:
  	if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
@@ -926,7 +927,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
  out_access_unlock:
  	rte_spinlock_unlock(&vq->access_lock);
 
-	return count;
+	return nb_tx;
  }
 
  uint16_t