DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/virtio: fix vhost_kernel_set_owner for multi-queue devices
@ 2021-04-08 12:37 Thierry Herbelot
  2021-04-13  8:45 ` Maxime Coquelin
  0 siblings, 1 reply; 3+ messages in thread
From: Thierry Herbelot @ 2021-04-08 12:37 UTC (permalink / raw)
  To: dev; +Cc: Thierry Herbelot, Thomas Monjalon, Maxime Coquelin, Chenbo Xia

Restore the original code, where VHOST_SET_OWNER is applied to
all vhostfds of the device.

Fixes: 06856cabb89b0 ("net/virtio: add virtio-user ops to set owner")
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Chenbo Xia <chenbo.xia@intel.com>
Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
---
 drivers/net/virtio/virtio_user/vhost_kernel.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c
index 768db55a6c1f..58e66bb7b4ae 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
@@ -101,9 +101,20 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg)
 static int
 vhost_kernel_set_owner(struct virtio_user_dev *dev)
 {
+	int ret;
+	uint32_t i;
 	struct vhost_kernel_data *data = dev->backend_data;
 
-	return vhost_kernel_ioctl(data->vhostfds[0], VHOST_SET_OWNER, NULL);
+	for (i = 0; i < dev->max_queue_pairs; ++i) {
+		if (data->vhostfds[i] < 0)
+			continue;
+
+		ret = vhost_kernel_ioctl(data->vhostfds[i], VHOST_SET_OWNER, NULL);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
 }
 
 static int
-- 
2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/virtio: fix vhost_kernel_set_owner for multi-queue devices
  2021-04-08 12:37 [dpdk-dev] [PATCH] net/virtio: fix vhost_kernel_set_owner for multi-queue devices Thierry Herbelot
@ 2021-04-13  8:45 ` Maxime Coquelin
  2021-04-15 12:48   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Coquelin @ 2021-04-13  8:45 UTC (permalink / raw)
  To: Thierry Herbelot, dev; +Cc: Thomas Monjalon, Chenbo Xia

Hi Thierry,

On 4/8/21 2:37 PM, Thierry Herbelot wrote:
> Restore the original code, where VHOST_SET_OWNER is applied to
> all vhostfds of the device.
> 
> Fixes: 06856cabb89b0 ("net/virtio: add virtio-user ops to set owner")
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Cc: Chenbo Xia <chenbo.xia@intel.com>
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
> ---
>  drivers/net/virtio/virtio_user/vhost_kernel.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c
> index 768db55a6c1f..58e66bb7b4ae 100644
> --- a/drivers/net/virtio/virtio_user/vhost_kernel.c
> +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
> @@ -101,9 +101,20 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg)
>  static int
>  vhost_kernel_set_owner(struct virtio_user_dev *dev)
>  {
> +	int ret;
> +	uint32_t i;
>  	struct vhost_kernel_data *data = dev->backend_data;
>  
> -	return vhost_kernel_ioctl(data->vhostfds[0], VHOST_SET_OWNER, NULL);
> +	for (i = 0; i < dev->max_queue_pairs; ++i) {
> +		if (data->vhostfds[i] < 0)
> +			continue;
> +
> +		ret = vhost_kernel_ioctl(data->vhostfds[i], VHOST_SET_OWNER, NULL);
> +		if (ret < 0)
> +			return ret;
> +	}
> +
> +	return 0;
>  }
>  
>  static int
> 

Thanks for the fix, we indeed have to set owner for all the queue pairs.

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

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/virtio: fix vhost_kernel_set_owner for multi-queue devices
  2021-04-13  8:45 ` Maxime Coquelin
@ 2021-04-15 12:48   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2021-04-15 12:48 UTC (permalink / raw)
  To: Maxime Coquelin, Thierry Herbelot, dev; +Cc: Thomas Monjalon, Chenbo Xia

On 4/13/2021 9:45 AM, Maxime Coquelin wrote:
> Hi Thierry,
> 
> On 4/8/21 2:37 PM, Thierry Herbelot wrote:
>> Restore the original code, where VHOST_SET_OWNER is applied to
>> all vhostfds of the device.
>>
>> Fixes: 06856cabb89b0 ("net/virtio: add virtio-user ops to set owner")
>> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Cc: Chenbo Xia <chenbo.xia@intel.com>
>> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
>> ---
>>   drivers/net/virtio/virtio_user/vhost_kernel.c | 13 ++++++++++++-
>>   1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c
>> index 768db55a6c1f..58e66bb7b4ae 100644
>> --- a/drivers/net/virtio/virtio_user/vhost_kernel.c
>> +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
>> @@ -101,9 +101,20 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg)
>>   static int
>>   vhost_kernel_set_owner(struct virtio_user_dev *dev)
>>   {
>> +	int ret;
>> +	uint32_t i;
>>   	struct vhost_kernel_data *data = dev->backend_data;
>>   
>> -	return vhost_kernel_ioctl(data->vhostfds[0], VHOST_SET_OWNER, NULL);
>> +	for (i = 0; i < dev->max_queue_pairs; ++i) {
>> +		if (data->vhostfds[i] < 0)
>> +			continue;
>> +
>> +		ret = vhost_kernel_ioctl(data->vhostfds[i], VHOST_SET_OWNER, NULL);
>> +		if (ret < 0)
>> +			return ret;
>> +	}
>> +
>> +	return 0;
>>   }
>>   
>>   static int
>>
> 
> Thanks for the fix, we indeed have to set owner for all the queue pairs.
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-15 12:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 12:37 [dpdk-dev] [PATCH] net/virtio: fix vhost_kernel_set_owner for multi-queue devices Thierry Herbelot
2021-04-13  8:45 ` Maxime Coquelin
2021-04-15 12:48   ` Ferruh Yigit

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git