From patchwork Thu Jul 13 13:52:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 129526 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 CA91442E5F; Thu, 13 Jul 2023 15:52:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F8B341156; Thu, 13 Jul 2023 15:52:51 +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 A167F40DDA for ; Thu, 13 Jul 2023 15:52:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689256369; 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=VAk/lMUJ+tFIeqKBA5Sz1nqSYp8qfTXCjWHzGS9QTVHS5Pr5W0FpgVkS/xLlWBcGMfoLaz Evv14JikwB+vzD/OPvrCG+LOx3wXkgSLUBZPQfYMcl+OmvolUr1aVbSea4wNcCWvnKVmE/ CuNVaS4RoFP+zWF7Vl7kLr5Fv7KLoDE= 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-586-jlWvtodzP5W2uuqQuC1HTw-1; Thu, 13 Jul 2023 09:52:46 -0400 X-MC-Unique: jlWvtodzP5W2uuqQuC1HTw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 396E1293248B; Thu, 13 Jul 2023 13:52:46 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id B27911454142; Thu, 13 Jul 2023 13:52:44 +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 v3 1/2] vhost: fix net offload compliance Date: Thu, 13 Jul 2023 15:52:39 +0200 Message-ID: <20230713135240.240453-2-maxime.coquelin@redhat.com> In-Reply-To: <20230713135240.240453-1-maxime.coquelin@redhat.com> References: <20230713135240.240453-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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 Acked-by: Kevin Traynor --- 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 13:52:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 129527 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 E3DD842E5F; Thu, 13 Jul 2023 15:54:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D22A740DDB; Thu, 13 Jul 2023 15:54:37 +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 0CA2F40DDA for ; Thu, 13 Jul 2023 15:54:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689256471; 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=/yarT6zcK4pDRaQvXSKgNIJwXooleWjcrYV9coPfC5o=; b=Y+NrK7ZBDPmZ6vVM1OhGWhPkD4x/fwAi+jNtICwIWx3VG+VqrtJIhKTN0VUFTtIdw111LN ox1qNpn1iph3tx8IFi04n5IIQSgiE44yVZB8G+y0zXa+sPVO98J1MX9WQgNhge5nQSWNQr TyMjqgZBoZwLB1jWk/95ayUztHcN5LA= 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-484-btOoo1jeN3ayobzMTrgulQ-1; Thu, 13 Jul 2023 09:53:56 -0400 X-MC-Unique: btOoo1jeN3ayobzMTrgulQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 06837381D1E3; Thu, 13 Jul 2023 13:52:48 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EE1A1454142; Thu, 13 Jul 2023 13:52:46 +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 v3 2/2] vhost: force vIOMMU enablement with VDUSE Date: Thu, 13 Jul 2023 15:52:40 +0200 Message-ID: <20230713135240.240453-3-maxime.coquelin@redhat.com> In-Reply-To: <20230713135240.240453-1-maxime.coquelin@redhat.com> References: <20230713135240.240453-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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 Acked-by: Kevin Traynor --- lib/vhost/socket.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index 57dfe3d2fe..033f4b3b75 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -932,11 +932,13 @@ 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 | - RTE_VHOST_USER_POSTCOPY_SUPPORT))) { + if (vsocket->async_copy && (vsocket->iommu_support || + (flags & RTE_VHOST_USER_POSTCOPY_SUPPORT))) { VHOST_LOG_CONFIG(path, ERR, "async copy with IOMMU or post-copy not supported\n"); goto out_mutex; } @@ -986,7 +988,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); }