From patchwork Thu Jul 13 10:26:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 129519 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71BFC42DA6; Thu, 13 Jul 2023 12:27:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C2FE442BAC; Thu, 13 Jul 2023 12:27:14 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id EEE214114B for ; Thu, 13 Jul 2023 12:27:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689244032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LRMHP7z2uDS60iSggRfx9fxMj4oyzocWdkaUYGH4R2c=; b=GoMDmdZtQUpe5XBeMjCdquQT9778L99DtXBch7Ur6CM26lrRkM2K99MLAv+TyAgzU8+wL5 euTQ/HasgqMKoOpAIpeU0Hd1s+atLhX/gQzQxI3hZry2Vb3TX62H9cCww9yoIrhiMVnX8a bcFVqiNjetJV7ND7sSs7Krk2Gc0wiTk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-Bc4A_b4-N8aRn5iCqxNhgg-1; Thu, 13 Jul 2023 06:27:07 -0400 X-MC-Unique: Bc4A_b4-N8aRn5iCqxNhgg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 17DAE858290; Thu, 13 Jul 2023 10:27:07 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1A5F492C13; Thu, 13 Jul 2023 10:27:05 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, thomas@monjalon.net, chenbo.xia@intel.com Cc: Maxime Coquelin Subject: [PATCH 1/2] vhost: fix net offload compliancy Date: Thu, 13 Jul 2023 12:26:58 +0200 Message-ID: <20230713102659.230606-2-maxime.coquelin@redhat.com> In-Reply-To: <20230713102659.230606-1-maxime.coquelin@redhat.com> References: <20230713102659.230606-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- lib/vhost/socket.c | 2 +- lib/vhost/vduse.c | 4 ++-- lib/vhost/vduse.h | 2 +- 3 files changed, 4 insertions(+), 4 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..9d63da664d 100644 --- a/lib/vhost/vduse.h +++ b/lib/vhost/vduse.h @@ -11,7 +11,7 @@ #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 From patchwork Thu Jul 13 10:26:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 129518 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DCF7542DA6; Thu, 13 Jul 2023 12:27:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98A5141156; Thu, 13 Jul 2023 12:27:13 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id C1F9141156 for ; Thu, 13 Jul 2023 12:27:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689244032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Tur4zVJZTfR2trWISKC8yWy9AgpA4dz1YtlnKSlVAM=; b=CUGHlGuy29zHUeprmj9t1IcBpXaBakwb05pSeRR3Prv4L2SUfBsAYAUN4uPwJgt9H8Jfqj MvHBDRr9wXXL7blEhViIFMemJoAnYYWIAigABR/2wdD4TbuR2XiB6Gw7fk/tXbZ38fWVfB pd63g1wpaY2OH/0x8/2Ii/d+ib04oAY= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-547-Wjaw3mK8NkCQxoP4Xygl8g-1; Thu, 13 Jul 2023 06:27:09 -0400 X-MC-Unique: Wjaw3mK8NkCQxoP4Xygl8g-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8887E1C05EB2; Thu, 13 Jul 2023 10:27:08 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 611224CD0C6; Thu, 13 Jul 2023 10:27:07 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, thomas@monjalon.net, chenbo.xia@intel.com Cc: Maxime Coquelin Subject: [PATCH 2/2] vhost: force vIOMMU enablement with VDUSE Date: Thu, 13 Jul 2023 12:26:59 +0200 Message-ID: <20230713102659.230606-3-maxime.coquelin@redhat.com> In-Reply-To: <20230713102659.230606-1-maxime.coquelin@redhat.com> References: <20230713102659.230606-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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); }