Skip to contentSkip to conversation

net/virtio-user: reset used index counter in dev reset

PATCH Applied Kommula Shiva Shankar 2 participants 5 messages Aug 5, 2024 – Sep 19, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/virtio-user: reset used index counter in dev reset

When the virtio device is reinitialized during ethdev reconfiguration, all the virtio rings are recreated and repopulated on the device. Accordingly, reset the used index counter value back to zero.

---
 drivers/net/virtio/virtio_user_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/virtio/virtio_user_ethdev.c +1 -0
index ae6593ba0b..d60c7e188c 100644
@@ -204,6 +204,7 @@ virtio_user_setup_queue_packed(struct virtqueue *vq,
 	vring->device = (void *)(uintptr_t)used_addr;
 	dev->packed_queues[queue_idx].avail_wrap_counter = true;
 	dev->packed_queues[queue_idx].used_wrap_counter = true;
+	dev->packed_queues[queue_idx].used_idx = 0;
 
 	for (i = 0; i < vring->num; i++)
 		vring->desc[i].flags = 0;
Signature · 1 line
2.43.0
#1 lore raw

Hello Maxime,
could you please review the following change ?

Thanks

Quoted 32 lines

Subject: [EXTERNAL] [PATCH] net/virtio-user: reset used index counter in dev reset

When the virtio device is reinitialized during ethdev reconfiguration, all the virtio rings are recreated and repopulated on the device. Accordingly, reset the used index counter value back to zero. Signed-off-by: Kommula Shiva Shankar <kshankar@ marvell. com>
When the virtio device is reinitialized during ethdev reconfiguration, all the virtio rings are recreated and repopulated on the device. Accordingly, reset the used index counter value back to zero.

---
 drivers/net/virtio/virtio_user_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/virtio/virtio_user_ethdev.c +1 -0
index ae6593ba0b..d60c7e188c 100644
@@ -204,6 +204,7 @@ virtio_user_setup_queue_packed(struct virtqueue
 *vq,
 	vring->device = (void *)(uintptr_t)used_addr;
 	dev->packed_queues[queue_idx].avail_wrap_counter = true;
 	dev->packed_queues[queue_idx].used_wrap_counter = true;
+	dev->packed_queues[queue_idx].used_idx = 0;
 
 	for (i = 0; i < vring->num; i++)

vring->desc[i].flags = 0;
--
2.43.0

#2 lore raw

Hi,

Quoted 15 lines · Shiva Shankar Kommula

Hello Maxime,
could you please review the following change ?

Thanks

Quoted 10 lines

Subject: [EXTERNAL] [PATCH] net/virtio-user: reset used index counter in dev reset

When the virtio device is reinitialized during ethdev reconfiguration, all the virtio rings are recreated and repopulated on the device. Accordingly, reset the used index counter value back to zero. Signed-off-by: Kommula Shiva Shankar <kshankar@ marvell. com>
When the virtio device is reinitialized during ethdev reconfiguration, all the virtio rings are recreated and repopulated on the device. Accordingly, reset the used index counter value back to zero.

I think it needs to be backported to stable releases. What about this?

Fixes 48a4464029a7 ("net/virtio-user: support control VQ for packed")
Quoted 23 lines
Quoted 22 lines
---
  drivers/net/virtio/virtio_user_ethdev.c | 1 +
  1 file changed, 1 insertion(+)
drivers/net/virtio/virtio_user_ethdev.c +1 -0
index ae6593ba0b..d60c7e188c 100644
@@ -204,6 +204,7 @@ virtio_user_setup_queue_packed(struct virtqueue
 *vq,
  	vring->device = (void *)(uintptr_t)used_addr;
  	dev->packed_queues[queue_idx].avail_wrap_counter = true;
  	dev->packed_queues[queue_idx].used_wrap_counter = true;
+	dev->packed_queues[queue_idx].used_idx = 0;
 
  	for (i = 0; i < vring->num; i++)

vring->desc[i].flags = 0;
--
2.43.0

Reviewed-by
#3 lore raw
Quoted 19 lines · Maxime Coquelin

Hi,

Quoted 15 lines · Shiva Shankar Kommula

Hello Maxime,
could you please review the following change ?

Thanks

Quoted 10 lines

Subject: [EXTERNAL] [PATCH] net/virtio-user: reset used index counter in dev reset

When the virtio device is reinitialized during ethdev reconfiguration, all the virtio rings are recreated and repopulated on the device. Accordingly, reset the used index counter value back to zero. Signed-off-by: Kommula Shiva Shankar <kshankar@ marvell. com>
When the virtio device is reinitialized during ethdev reconfiguration, all the virtio rings are recreated and repopulated on the device. Accordingly, reset the used index counter value back to zero.

Quoted 29 lines

I think it needs to be backported to stable releases. What about this?

Fixes 48a4464029a7 ("net/virtio-user: support control VQ for packed")
Quoted 23 lines
Quoted 22 lines

---
  drivers/net/virtio/virtio_user_ethdev.c | 1 +

  1 file changed, 1 insertion(+)
drivers/net/virtio/virtio_user_ethdev.c +1 -0
index ae6593ba0b..d60c7e188c 100644
@@ -204,6 +204,7 @@ virtio_user_setup_queue_packed(struct virtqueue
 *vq,
       vring->device = (void *)(uintptr_t)used_addr;
       dev->packed_queues[queue_idx].avail_wrap_counter = true;
       dev->packed_queues[queue_idx].used_wrap_counter = true;
+    dev->packed_queues[queue_idx].used_idx = 0;
 
       for (i = 0; i < vring->num; i++)

          vring->desc[i].flags = 0;

Signature · 1 line
2.43.0

With added Fixes tag:

Thanks,
Maxime

#4 lore raw
In reply to Kommula Shiva Shankar
Quoted 9 lines · Kommula Shiva Shankar

When the virtio device is reinitialized during ethdev reconfiguration, all the virtio rings are recreated and repopulated on the device. Accordingly, reset the used index counter value back to zero.

---
  drivers/net/virtio/virtio_user_ethdev.c | 1 +
  1 file changed, 1 insertion(+)

Applied to next-virtio/for-next-net with suggested change.

Thanks,
Maxime