DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v2 0/2] vduse: TSO & vIOMMU fixes
@ 2023-07-13 11:29 Maxime Coquelin
  2023-07-13 11:29 ` [PATCH v2 1/2] vhost: fix net offload compliance Maxime Coquelin
  2023-07-13 11:29 ` [PATCH v2 2/2] vhost: force vIOMMU enablement with VDUSE Maxime Coquelin
  0 siblings, 2 replies; 5+ messages in thread
From: Maxime Coquelin @ 2023-07-13 11:29 UTC (permalink / raw)
  To: dev, david.marchand, thomas, chenbo.xia, aconole, ktraynor
  Cc: Maxime Coquelin

This series contains two patches to fix TSO support
and enable vIOMMU by default as it is required by
VDUSE.

Changes in v2:
==============
- Fix typo in commit message
- Fix build when VDUSE is not supported by the Kernel (0-day robot)

Maxime Coquelin (2):
  vhost: fix net offload compliance
  vhost: force vIOMMU enablement with VDUSE

 lib/vhost/socket.c | 9 ++++++---
 lib/vhost/vduse.c  | 4 ++--
 lib/vhost/vduse.h  | 6 ++++--
 3 files changed, 12 insertions(+), 7 deletions(-)

-- 
2.41.0


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

* [PATCH v2 1/2] vhost: fix net offload compliance
  2023-07-13 11:29 [PATCH v2 0/2] vduse: TSO & vIOMMU fixes Maxime Coquelin
@ 2023-07-13 11:29 ` Maxime Coquelin
  2023-07-13 11:29 ` [PATCH v2 2/2] vhost: force vIOMMU enablement with VDUSE Maxime Coquelin
  1 sibling, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2023-07-13 11:29 UTC (permalink / raw)
  To: dev, david.marchand, thomas, chenbo.xia, aconole, ktraynor
  Cc: Maxime Coquelin

Initial VDUSE support assumed the application always used
the net offload compliant mode, which is not the case for
OVS.

This patch propagates the value set by the application.

Fixes: 0adb8eccc6a6 ("vhost: add VDUSE device creation and destruction")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/socket.c | 2 +-
 lib/vhost/vduse.c  | 4 ++--
 lib/vhost/vduse.h  | 6 ++++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index f55fb299fd..57dfe3d2fe 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -1233,7 +1233,7 @@ rte_vhost_driver_start(const char *path)
 		return -1;
 
 	if (vsocket->is_vduse)
-		return vduse_device_create(path);
+		return vduse_device_create(path, vsocket->net_compliant_ol_flags);
 
 	if (fdset_tid == 0) {
 		/**
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index 5c595e3f94..73ed424232 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -412,7 +412,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)
 }
 
 int
-vduse_device_create(const char *path)
+vduse_device_create(const char *path, bool compliant_ol_flags)
 {
 	int control_fd, dev_fd, vid, ret;
 	pthread_t fdset_tid;
@@ -538,7 +538,7 @@ vduse_device_create(const char *path)
 	strncpy(dev->ifname, path, IF_NAME_SZ - 1);
 	dev->vduse_ctrl_fd = control_fd;
 	dev->vduse_dev_fd = dev_fd;
-	vhost_setup_virtio_net(dev->vid, true, true, true, true);
+	vhost_setup_virtio_net(dev->vid, true, compliant_ol_flags, true, true);
 
 	for (i = 0; i < total_queues; i++) {
 		struct vduse_vq_config vq_cfg = { 0 };
diff --git a/lib/vhost/vduse.h b/lib/vhost/vduse.h
index d0142694a7..4879b1f900 100644
--- a/lib/vhost/vduse.h
+++ b/lib/vhost/vduse.h
@@ -11,14 +11,16 @@
 
 #ifdef VHOST_HAS_VDUSE
 
-int vduse_device_create(const char *path);
+int vduse_device_create(const char *path, bool compliant_ol_flags);
 int vduse_device_destroy(const char *path);
 
 #else
 
 static inline int
-vduse_device_create(const char *path)
+vduse_device_create(const char *path, bool compliant_ol_flags)
 {
+	RTE_SET_USED(compliant_ol_flags);
+
 	VHOST_LOG_CONFIG(path, ERR, "VDUSE support disabled at build time\n");
 	return -1;
 }
-- 
2.41.0


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

* [PATCH v2 2/2] vhost: force vIOMMU enablement with VDUSE
  2023-07-13 11:29 [PATCH v2 0/2] vduse: TSO & vIOMMU fixes Maxime Coquelin
  2023-07-13 11:29 ` [PATCH v2 1/2] vhost: fix net offload compliance Maxime Coquelin
@ 2023-07-13 11:29 ` Maxime Coquelin
  2023-07-13 12:47   ` Kevin Traynor
  1 sibling, 1 reply; 5+ messages in thread
From: Maxime Coquelin @ 2023-07-13 11:29 UTC (permalink / raw)
  To: dev, david.marchand, thomas, chenbo.xia, aconole, ktraynor
  Cc: Maxime Coquelin

Unlike Vhost-user, VDUSE requires vIOMMU support.
This patch ignores whether RTE_VHOST_USER_IOMMU_SUPPORT
flag is passed at register time to avoid having application
to pass it for having working VDUSE device creation.

Fixes: 0adb8eccc6a6 ("vhost: add VDUSE device creation and destruction")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/socket.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 57dfe3d2fe..79f2138f60 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -932,7 +932,10 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
 	vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
 	vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
 	vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
-	vsocket->iommu_support = flags & RTE_VHOST_USER_IOMMU_SUPPORT;
+	if (vsocket->is_vduse)
+		vsocket->iommu_support = true;
+	else
+		vsocket->iommu_support = flags & RTE_VHOST_USER_IOMMU_SUPPORT;
 
 	if (vsocket->async_copy &&
 		(flags & (RTE_VHOST_USER_IOMMU_SUPPORT |
@@ -986,7 +989,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
 		vsocket->features &= ~seg_offload_features;
 	}
 
-	if (!(flags & RTE_VHOST_USER_IOMMU_SUPPORT)) {
+	if (!vsocket->iommu_support) {
 		vsocket->supported_features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
 		vsocket->features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
 	}
-- 
2.41.0


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

* Re: [PATCH v2 2/2] vhost: force vIOMMU enablement with VDUSE
  2023-07-13 11:29 ` [PATCH v2 2/2] vhost: force vIOMMU enablement with VDUSE Maxime Coquelin
@ 2023-07-13 12:47   ` Kevin Traynor
  2023-07-13 13:42     ` Maxime Coquelin
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Traynor @ 2023-07-13 12:47 UTC (permalink / raw)
  To: Maxime Coquelin, dev, david.marchand, thomas, chenbo.xia, aconole

On 13/07/2023 12:29, Maxime Coquelin wrote:
> Unlike Vhost-user, VDUSE requires vIOMMU support.
> This patch ignores whether RTE_VHOST_USER_IOMMU_SUPPORT
> flag is passed at register time to avoid having application
> to pass it for having working VDUSE device creation.
> 
> Fixes: 0adb8eccc6a6 ("vhost: add VDUSE device creation and destruction")
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>   lib/vhost/socket.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
> index 57dfe3d2fe..79f2138f60 100644
> --- a/lib/vhost/socket.c
> +++ b/lib/vhost/socket.c
> @@ -932,7 +932,10 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
>   	vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
>   	vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
>   	vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
> -	vsocket->iommu_support = flags & RTE_VHOST_USER_IOMMU_SUPPORT;
> +	if (vsocket->is_vduse)
> +		vsocket->iommu_support = true;
> +	else
> +		vsocket->iommu_support = flags & RTE_VHOST_USER_IOMMU_SUPPORT;
>   
>   	if (vsocket->async_copy &&
>   		(flags & (RTE_VHOST_USER_IOMMU_SUPPORT |
                  ^^^ do you need to update this check ?

> @@ -986,7 +989,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
>   		vsocket->features &= ~seg_offload_features;
>   	}
>   
> -	if (!(flags & RTE_VHOST_USER_IOMMU_SUPPORT)) {
> +	if (!vsocket->iommu_support) {
>   		vsocket->supported_features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
>   		vsocket->features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
>   	}


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

* Re: [PATCH v2 2/2] vhost: force vIOMMU enablement with VDUSE
  2023-07-13 12:47   ` Kevin Traynor
@ 2023-07-13 13:42     ` Maxime Coquelin
  0 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2023-07-13 13:42 UTC (permalink / raw)
  To: Kevin Traynor, dev, david.marchand, thomas, chenbo.xia, aconole



On 7/13/23 14:47, Kevin Traynor wrote:
> On 13/07/2023 12:29, Maxime Coquelin wrote:
>> Unlike Vhost-user, VDUSE requires vIOMMU support.
>> This patch ignores whether RTE_VHOST_USER_IOMMU_SUPPORT
>> flag is passed at register time to avoid having application
>> to pass it for having working VDUSE device creation.
>>
>> Fixes: 0adb8eccc6a6 ("vhost: add VDUSE device creation and destruction")
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>>   lib/vhost/socket.c | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
>> index 57dfe3d2fe..79f2138f60 100644
>> --- a/lib/vhost/socket.c
>> +++ b/lib/vhost/socket.c
>> @@ -932,7 +932,10 @@ rte_vhost_driver_register(const char *path, 
>> uint64_t flags)
>>       vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
>>       vsocket->net_compliant_ol_flags = flags & 
>> RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
>>       vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
>> -    vsocket->iommu_support = flags & RTE_VHOST_USER_IOMMU_SUPPORT;
>> +    if (vsocket->is_vduse)
>> +        vsocket->iommu_support = true;
>> +    else
>> +        vsocket->iommu_support = flags & RTE_VHOST_USER_IOMMU_SUPPORT;
>>       if (vsocket->async_copy &&
>>           (flags & (RTE_VHOST_USER_IOMMU_SUPPORT |
>                   ^^^ do you need to update this check ?

Good catch.
Yes, it would be better to replace with vsocket->iommu_support.

V3 on its way.

Thanks!
Maxime

>> @@ -986,7 +989,7 @@ rte_vhost_driver_register(const char *path, 
>> uint64_t flags)
>>           vsocket->features &= ~seg_offload_features;
>>       }
>> -    if (!(flags & RTE_VHOST_USER_IOMMU_SUPPORT)) {
>> +    if (!vsocket->iommu_support) {
>>           vsocket->supported_features &= ~(1ULL << 
>> VIRTIO_F_IOMMU_PLATFORM);
>>           vsocket->features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
>>       }
> 


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

end of thread, other threads:[~2023-07-13 13:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-13 11:29 [PATCH v2 0/2] vduse: TSO & vIOMMU fixes Maxime Coquelin
2023-07-13 11:29 ` [PATCH v2 1/2] vhost: fix net offload compliance Maxime Coquelin
2023-07-13 11:29 ` [PATCH v2 2/2] vhost: force vIOMMU enablement with VDUSE Maxime Coquelin
2023-07-13 12:47   ` Kevin Traynor
2023-07-13 13:42     ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).