vhost: fix vector filling for packed ring

Message ID 20181023060749.25194-1-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vhost: fix vector filling for packed ring |

Checks

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

Commit Message

Tiwei Bie Oct. 23, 2018, 6:07 a.m. UTC
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")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 lib/librte_vhost/virtio_net.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Maxime Coquelin Oct. 23, 2018, 8:19 a.m. UTC | #1
Hi Tiwei,

On 10/23/2018 08:07 AM, Tiwei Bie wrote:
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   lib/librte_vhost/virtio_net.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 48228f16b..4e6c35d56 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -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).

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

Thanks!
Maxime
  
Maxime Coquelin Oct. 23, 2018, 9:41 a.m. UTC | #2
On 10/23/2018 08:07 AM, Tiwei Bie wrote:
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   lib/librte_vhost/virtio_net.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 48228f16b..4e6c35d56 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -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
  

Patch

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 48228f16b..4e6c35d56 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -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))