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

Message ID 20240805100841.276796-1-kshankar@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series net/virtio-user: reset used index counter in dev reset |

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/intel-Testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Kommula Shiva Shankar Aug. 5, 2024, 10:08 a.m. UTC
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>
---
 drivers/net/virtio/virtio_user_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Kommula Shiva Shankar Sept. 6, 2024, 10:14 a.m. UTC | #1
Unaddressed
Hello Maxime, 
could you please review the following change ? 

Thanks

> 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.
> 
> Signed-off-by: Kommula Shiva Shankar <kshankar@marvell.com>
> ---
>  drivers/net/virtio/virtio_user_ethdev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/virtio/virtio_user_ethdev.c
> b/drivers/net/virtio/virtio_user_ethdev.c
> index ae6593ba0b..d60c7e188c 100644
> --- a/drivers/net/virtio/virtio_user_ethdev.c
> +++ b/drivers/net/virtio/virtio_user_ethdev.c
> @@ -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
  
Maxime Coquelin Sept. 19, 2024, 10:54 a.m. UTC | #2
Hi,

On 9/6/24 12:14, Shiva Shankar Kommula wrote:
> Hello Maxime,
> could you please review the following change ?
> 
> Thanks
> 
>> 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")
Cc: stable@dpdk.org

>>
>> Signed-off-by: Kommula Shiva Shankar <kshankar@marvell.com>
>> ---
>>   drivers/net/virtio/virtio_user_ethdev.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/virtio/virtio_user_ethdev.c
>> b/drivers/net/virtio/virtio_user_ethdev.c
>> index ae6593ba0b..d60c7e188c 100644
>> --- a/drivers/net/virtio/virtio_user_ethdev.c
>> +++ b/drivers/net/virtio/virtio_user_ethdev.c
>> @@ -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
>
  
Maxime Coquelin Sept. 19, 2024, 11:17 a.m. UTC | #3
On 9/19/24 12:54, Maxime Coquelin wrote:
> Hi,
> 
> On 9/6/24 12:14, Shiva Shankar Kommula wrote:
>> Hello Maxime,
>> could you please review the following change ?
>>
>> Thanks
>>
>>> 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")
> Cc: stable@dpdk.org
> 
>>>
>>> Signed-off-by: Kommula Shiva Shankar <kshankar@marvell.com>
>>> ---
>>>   drivers/net/virtio/virtio_user_ethdev.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/net/virtio/virtio_user_ethdev.c
>>> b/drivers/net/virtio/virtio_user_ethdev.c
>>> index ae6593ba0b..d60c7e188c 100644
>>> --- a/drivers/net/virtio/virtio_user_ethdev.c
>>> +++ b/drivers/net/virtio/virtio_user_ethdev.c
>>> @@ -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
>>

With added Fixes tag:
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Maxime Coquelin Sept. 19, 2024, 12:06 p.m. UTC | #4
On 8/5/24 12:08, Kommula Shiva Shankar wrote:
> 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>
> ---
>   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
  

Patch

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index ae6593ba0b..d60c7e188c 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -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;