[4/4] net/virtio-user: fix used ring update in cvq handling

Message ID 20190122170143.5650-5-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series Virtio fixes |

Checks

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

Commit Message

Tiwei Bie Jan. 22, 2019, 5:01 p.m. UTC
  When updating used ring, the id in used element should be the
index of the first desc in the desc chain.

Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Maxime Coquelin Jan. 23, 2019, 10:08 p.m. UTC | #1
On 1/22/19 6:01 PM, Tiwei Bie wrote:
> When updating used ring, the id in used element should be the
> index of the first desc in the desc chain.
> 
> Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation")
> Cc:stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie<tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

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

Thanks,
Maxime
  

Patch

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 89d287a74..d1157378d 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -722,7 +722,7 @@  virtio_user_handle_cq(struct virtio_user_dev *dev, uint16_t queue_idx)
 
 		/* Update used ring */
 		uep = &vring->used->ring[avail_idx];
-		uep->id = avail_idx;
+		uep->id = desc_idx;
 		uep->len = n_descs;
 
 		vring->used->idx++;