From patchwork Thu Jul 13 11:29:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 129523 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 01F1042E5F; Thu, 13 Jul 2023 13:29:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E77041156; Thu, 13 Jul 2023 13:29:15 +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 9FBE14114A for ; Thu, 13 Jul 2023 13:29:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689247753; 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=sLbw/bhLRKFLcrfie1PEQp4YUUCdrX7384C7LjFrq2s=; b=Bqadt1t2Q8Do0SG6DFuJgadoKNoo9Ot9rOqrw7JbpiWFMc59xFLHqwm+c1ZU/pz+cl6IUr C1C7NK7Jdc4zkAaxpvIIwb7RgSeMCH/AcnD9HJ4RhGXkh31wKtgiKR+yAJvF0KrysxiH+z jUHFmnIgU/JXZixlz8fXR+vwAB4LDyc= 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-226-bzly5XR9P9aJ1dyZUZPasA-1; Thu, 13 Jul 2023 07:29:11 -0400 X-MC-Unique: bzly5XR9P9aJ1dyZUZPasA-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 70C61185A78F; Thu, 13 Jul 2023 11:29:11 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id E430E492C13; Thu, 13 Jul 2023 11:29:09 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, thomas@monjalon.net, chenbo.xia@intel.com, aconole@redhat.com, ktraynor@redhat.com Cc: Maxime Coquelin Subject: [PATCH v2 1/2] vhost: fix net offload compliance Date: Thu, 13 Jul 2023 13:29:04 +0200 Message-ID: <20230713112905.233306-2-maxime.coquelin@redhat.com> In-Reply-To: <20230713112905.233306-1-maxime.coquelin@redhat.com> References: <20230713112905.233306-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 | 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; } From patchwork Thu Jul 13 11:29:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 129524 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 4DE0C42E5F; Thu, 13 Jul 2023 13:29:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3BFD442B8E; Thu, 13 Jul 2023 13:29:20 +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 5C87C42B8E for ; Thu, 13 Jul 2023 13:29:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689247757; 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=c5scHs/qH6lfmddQg7YCD4cmEgs7kaQGBuqCJuPCu1GkgLvKFqjIbsNo7brA3/f0n8jDod tVcLLo0WG9iNJzP0Hj9ikWhercUiWGYitXSZ/j7AAPLenOuvOIZSsziXkr5rZEsbDuYmDp jCOcTu2hgpi1iTC+L8TPaQddxoCeL+Q= 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-463-ez2BdJimP_aIAr_ojVOA6A-1; Thu, 13 Jul 2023 07:29:13 -0400 X-MC-Unique: ez2BdJimP_aIAr_ojVOA6A-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 3E0C1104458D; Thu, 13 Jul 2023 11:29:13 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id B74A2492C13; Thu, 13 Jul 2023 11:29:11 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, thomas@monjalon.net, chenbo.xia@intel.com, aconole@redhat.com, ktraynor@redhat.com Cc: Maxime Coquelin Subject: [PATCH v2 2/2] vhost: force vIOMMU enablement with VDUSE Date: Thu, 13 Jul 2023 13:29:05 +0200 Message-ID: <20230713112905.233306-3-maxime.coquelin@redhat.com> In-Reply-To: <20230713112905.233306-1-maxime.coquelin@redhat.com> References: <20230713112905.233306-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); }