From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF130A0C41; Thu, 16 Sep 2021 12:36:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB130410F0; Thu, 16 Sep 2021 12:36:43 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id EC1414003F for ; Thu, 16 Sep 2021 12:36:41 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10108"; a="209764356" X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="209764356" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2021 03:36:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="509258160" Received: from silpixa00401191.ir.intel.com ([10.55.128.95]) by fmsmga008.fm.intel.com with ESMTP; 16 Sep 2021 03:36:40 -0700 From: Anatoly Burakov To: dev@dpdk.org, Bruce Richardson Date: Thu, 16 Sep 2021 10:36:38 +0000 Message-Id: <67c4e47e511558e2442c73c57c1764df656720e3.1631788595.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <25dd76eca01ec57d64be9c0a78ac2752f602984f.1631788595.git.anatoly.burakov@intel.com> References: <25dd76eca01ec57d64be9c0a78ac2752f602984f.1631788595.git.anatoly.burakov@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1 2/2] vfio: add errno on unsupported platforms 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 Sender: "dev" Currently, when code is running on FreeBSD (or using fallback Linux implementation), there is no way to distinguish between a geniune error and a "VFIO is unsupported" error. Fix the dummy implemnetations to also set the rte_errno flag. Signed-off-by: Anatoly Burakov --- lib/eal/freebsd/eal.c | 12 ++++++++++++ lib/eal/linux/eal_vfio.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 6cee5ae369..6d249edb11 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -1000,6 +1000,7 @@ int rte_vfio_setup_device(__rte_unused const char *sysfs_base, __rte_unused int *vfio_dev_fd, __rte_unused struct vfio_device_info *device_info) { + rte_errno = ENOTSUP; return -1; } @@ -1007,11 +1008,13 @@ int rte_vfio_release_device(__rte_unused const char *sysfs_base, __rte_unused const char *dev_addr, __rte_unused int fd) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_enable(__rte_unused const char *modname) { + rte_errno = ENOTSUP; return -1; } @@ -1035,30 +1038,35 @@ rte_vfio_get_group_num(__rte_unused const char *sysfs_base, __rte_unused const char *dev_addr, __rte_unused int *iommu_group_num) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_get_container_fd(void) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_get_group_fd(__rte_unused int iommu_group_num) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_container_create(void) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_container_destroy(__rte_unused int container_fd) { + rte_errno = ENOTSUP; return -1; } @@ -1066,6 +1074,7 @@ int rte_vfio_container_group_bind(__rte_unused int container_fd, __rte_unused int iommu_group_num) { + rte_errno = ENOTSUP; return -1; } @@ -1073,6 +1082,7 @@ int rte_vfio_container_group_unbind(__rte_unused int container_fd, __rte_unused int iommu_group_num) { + rte_errno = ENOTSUP; return -1; } @@ -1082,6 +1092,7 @@ rte_vfio_container_dma_map(__rte_unused int container_fd, __rte_unused uint64_t iova, __rte_unused uint64_t len) { + rte_errno = ENOTSUP; return -1; } @@ -1091,5 +1102,6 @@ rte_vfio_container_dma_unmap(__rte_unused int container_fd, __rte_unused uint64_t iova, __rte_unused uint64_t len) { + rte_errno = ENOTSUP; return -1; } diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c index b9e4d3ad3c..bb4c225aed 100644 --- a/lib/eal/linux/eal_vfio.c +++ b/lib/eal/linux/eal_vfio.c @@ -2092,6 +2092,7 @@ rte_vfio_setup_device(__rte_unused const char *sysfs_base, __rte_unused int *vfio_dev_fd, __rte_unused struct vfio_device_info *device_info) { + rte_errno = ENOTSUP; return -1; } @@ -2099,12 +2100,14 @@ int rte_vfio_release_device(__rte_unused const char *sysfs_base, __rte_unused const char *dev_addr, __rte_unused int fd) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_enable(__rte_unused const char *modname) { + rte_errno = ENOTSUP; return -1; } @@ -2131,30 +2134,35 @@ rte_vfio_get_group_num(__rte_unused const char *sysfs_base, __rte_unused const char *dev_addr, __rte_unused int *iommu_group_num) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_get_container_fd(void) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_get_group_fd(__rte_unused int iommu_group_num) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_container_create(void) { + rte_errno = ENOTSUP; return -1; } int rte_vfio_container_destroy(__rte_unused int container_fd) { + rte_errno = ENOTSUP; return -1; } @@ -2162,6 +2170,7 @@ int rte_vfio_container_group_bind(__rte_unused int container_fd, __rte_unused int iommu_group_num) { + rte_errno = ENOTSUP; return -1; } @@ -2169,6 +2178,7 @@ int rte_vfio_container_group_unbind(__rte_unused int container_fd, __rte_unused int iommu_group_num) { + rte_errno = ENOTSUP; return -1; } @@ -2178,6 +2188,7 @@ rte_vfio_container_dma_map(__rte_unused int container_fd, __rte_unused uint64_t iova, __rte_unused uint64_t len) { + rte_errno = ENOTSUP; return -1; } @@ -2187,6 +2198,7 @@ rte_vfio_container_dma_unmap(__rte_unused int container_fd, __rte_unused uint64_t iova, __rte_unused uint64_t len) { + rte_errno = ENOTSUP; return -1; } -- 2.25.1