vhost: fix net control virtqueue used length

Message ID 20250605113534.917903-1-eperezma@redhat.com (mailing list archive)
State Awaiting Upstream
Delegated to: Maxime Coquelin
Headers
Series vhost: fix net control virtqueue used length |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing warning Testing issues
ci/iol-sample-apps-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Eugenio Perez Martin June 5, 2025, 11:35 a.m. UTC
By the standard this is the number of bytes written.

Fixes: 474f4d7840ad ("vhost: add control virtqueue")
Cc: stable@dpdk.org

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 lib/vhost/virtio_net_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Maxime Coquelin June 12, 2025, 3:44 p.m. UTC | #1
On 6/5/25 1:35 PM, Eugenio Pérez wrote:
> By the standard this is the number of bytes written.
> 
> Fixes: 474f4d7840ad ("vhost: add control virtqueue")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
>   lib/vhost/virtio_net_ctrl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vhost/virtio_net_ctrl.c b/lib/vhost/virtio_net_ctrl.c
> index 63c0a06b4f..603a8db728 100644
> --- a/lib/vhost/virtio_net_ctrl.c
> +++ b/lib/vhost/virtio_net_ctrl.c
> @@ -229,7 +229,7 @@ virtio_net_ctrl_push(struct virtio_net *dev, struct virtio_net_ctrl_elem *ctrl_e
>   
>   	used_elem = &cvq->used->ring[cvq->last_used_idx & (cvq->size - 1)];
>   	used_elem->id = ctrl_elem->head_idx;
> -	used_elem->len = ctrl_elem->n_descs;
> +	used_elem->len = sizeof(*ctrl_elem->desc_ack);
>   
>   	cvq->last_used_idx++;
>   

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

Thanks,
Maxime
  
Maxime Coquelin June 13, 2025, 8:07 a.m. UTC | #2
On 6/5/25 1:35 PM, Eugenio Pérez wrote:
> By the standard this is the number of bytes written.
> 
> Fixes: 474f4d7840ad ("vhost: add control virtqueue")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
>   lib/vhost/virtio_net_ctrl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vhost/virtio_net_ctrl.c b/lib/vhost/virtio_net_ctrl.c
> index 63c0a06b4f..603a8db728 100644
> --- a/lib/vhost/virtio_net_ctrl.c
> +++ b/lib/vhost/virtio_net_ctrl.c
> @@ -229,7 +229,7 @@ virtio_net_ctrl_push(struct virtio_net *dev, struct virtio_net_ctrl_elem *ctrl_e
>   
>   	used_elem = &cvq->used->ring[cvq->last_used_idx & (cvq->size - 1)];
>   	used_elem->id = ctrl_elem->head_idx;
> -	used_elem->len = ctrl_elem->n_descs;
> +	used_elem->len = sizeof(*ctrl_elem->desc_ack);
>   
>   	cvq->last_used_idx++;
>   

Applied to next-virtio/for-net-next.

Thanks,
Maxime
  

Patch

diff --git a/lib/vhost/virtio_net_ctrl.c b/lib/vhost/virtio_net_ctrl.c
index 63c0a06b4f..603a8db728 100644
--- a/lib/vhost/virtio_net_ctrl.c
+++ b/lib/vhost/virtio_net_ctrl.c
@@ -229,7 +229,7 @@  virtio_net_ctrl_push(struct virtio_net *dev, struct virtio_net_ctrl_elem *ctrl_e
 
 	used_elem = &cvq->used->ring[cvq->last_used_idx & (cvq->size - 1)];
 	used_elem->id = ctrl_elem->head_idx;
-	used_elem->len = ctrl_elem->n_descs;
+	used_elem->len = sizeof(*ctrl_elem->desc_ack);
 
 	cvq->last_used_idx++;