Skip to contentSkip to conversation

vhost: fix vector filling for packed ring

PATCH Applied Tiwei Bie 2 participants 3 messages Oct 23, 2018

lore
Share & tools
lore

Tiwei Bie

author
#0 lore raw

PATCH 1/1 vhost: fix vector filling for packed ring

We should return the length of the buffers described by the current descriptor chain after filling the buffer vector. So we need to zero the *len first.

Fixes 2f3225a7d69b ("vhost: add vector filling support for packed ring")
---
 lib/librte_vhost/virtio_net.c | 1 +
 1 file changed, 1 insertion(+)
lib/librte_vhost/virtio_net.c +1 -0
index 48228f16b..4e6c35d56 100644
@@ -521,6 +521,7 @@ fill_vec_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
 		return -1;
 
 	*desc_count = 0;
+	*len = 0;
 
 	while (1) {
 		if (unlikely(vec_id >= BUF_VECTOR_MAX))
Signature · 1 line
2.19.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Tiwei,

Quoted 18 lines · Tiwei Bie

We should return the length of the buffers described by the current descriptor chain after filling the buffer vector. So we need to zero the *len first.

Fixes 2f3225a7d69b ("vhost: add vector filling support for packed ring")
---
  lib/librte_vhost/virtio_net.c | 1 +
  1 file changed, 1 insertion(+)
lib/librte_vhost/virtio_net.c +0 -0
index 48228f16b..4e6c35d56 100644

lib/librte_vhost/virtio_net.c fill_vec_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, · line 527

Quoted 7 lines
lib/librte_vhost/virtio_net.c +1 -0
@@ -521,6 +521,7 @@ fill_vec_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
  		return -1;
 
  	*desc_count = 0;
+	*len = 0;
 
  	while (1) {
  		if (unlikely(vec_id >= BUF_VECTOR_MAX))

Good catch, I guess I didn't felt into that bug because my test-cases were too simple (single descriptor were enough).

Thanks!
Maxime

#2 lore raw
In reply to Tiwei Bie
Quoted 18 lines · Tiwei Bie

We should return the length of the buffers described by the current descriptor chain after filling the buffer vector. So we need to zero the *len first.

Fixes 2f3225a7d69b ("vhost: add vector filling support for packed ring")
---
  lib/librte_vhost/virtio_net.c | 1 +
  1 file changed, 1 insertion(+)
lib/librte_vhost/virtio_net.c +0 -0
index 48228f16b..4e6c35d56 100644

lib/librte_vhost/virtio_net.c fill_vec_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, · line 527

Quoted 7 lines
lib/librte_vhost/virtio_net.c +1 -0
@@ -521,6 +521,7 @@ fill_vec_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,
  		return -1;
 
  	*desc_count = 0;
+	*len = 0;
 
  	while (1) {
  		if (unlikely(vec_id >= BUF_VECTOR_MAX))

Applied to dpdk-next-virtio/master

Thanks,
Maxime