From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by dpdk.org (Postfix) with ESMTP id 2D9475A8A for ; Mon, 20 Apr 2015 20:33:03 +0200 (CEST) Received: by pdbqd1 with SMTP id qd1so215788883pdb.2 for ; Mon, 20 Apr 2015 11:33:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NuIDU2j5+3aF3MY/tzLNzvQPs+w0pqkIuPi7WndyfzE=; b=h8Qxbmt4MIovcgA3YiyviIxVV8UvBywQF0J9xBhsOz7Fh4cJFBMwHlRNlmNEYNZPnG 5tb+S27gROVKAahMcZ8A2CcfOq24nAmHAqC1kD1I+/QUrIh9L+d6FyYhS3FoTBKsb5P2 BJKscupH0rk3cun3kmRYMXo5FC6AlU0uuEsZ/C1RS8UCwllupVdwG36nrl8Kp9HQOmSZ BX8jXumHz0e7Ah7U7nLbTLucYdpSF69vih2gdVGeyvR2C/OOKCtsdsy8LK4W3exnSDPZ Td9cptqv2ckDUJw3v4F4E/0iajkBcyDw4F/xdj5UCaq9Cojo32wK/eUVzQu78bvfGipV sXJw== X-Gm-Message-State: ALoCoQnv0ztqJVdrYg4jOwTliCyKYvfvfCY2DRnwX2Bpv6TWqlxYLGKcARgCzmA+UmlQlX5Hjn6W X-Received: by 10.68.239.199 with SMTP id vu7mr29920756pbc.113.1429554782616; Mon, 20 Apr 2015 11:33:02 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id qc9sm19013922pab.19.2015.04.20.11.33.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Apr 2015 11:33:01 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Date: Mon, 20 Apr 2015 11:32:51 -0700 Message-Id: <1429554771-32365-1-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] vfio: don't silently drop VFIO support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2015 18:33:03 -0000 The VFIO_PRESENT #define was a landmine and we hit it. The DPDK has a config system and it should be used rather than silently dropping a feature during build only to have it fail at run time. If VFIO is configured, and the kernel headers are not present the build should fail. Rather than leaving developers puzzling why the build system (with old kernel headers) produced non functioning DPDK and their system (with new kernel headers) produced correctly working DPDK. As a matter of policy, really no code should be looking at except for kernel drivers with compat files. Signed-off-by: Stephen Hemminger --- lib/librte_eal/linuxapp/eal/Makefile | 4 ++-- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 10 +++++----- lib/librte_eal/linuxapp/eal/eal_pci.c | 4 ++-- lib/librte_eal/linuxapp/eal/eal_pci_init.h | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 3 --- lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c | 3 --- lib/librte_eal/linuxapp/eal/eal_vfio.h | 1 - 7 files changed, 10 insertions(+), 17 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 01f7b70..abaf0da 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -64,8 +64,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_thread.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_log.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_uio.c -SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio.c -SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio_mp_sync.c +SRCS-$(CONFIG_RTE_EAL_VFIO) += eal_pci_vfio.c +SRCS-$(CONFIG_RTE_EAL_VFIO) += eal_pci_vfio_mp_sync.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_debug.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_lcore.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_timer.c diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index 66deda2..55f41d2 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -87,7 +87,7 @@ union intr_pipefds{ */ union rte_intr_read_buffer { int uio_intr_count; /* for uio device */ -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO uint64_t vfio_intr_count; /* for vfio device */ #endif uint64_t timerfd_num; /* for timerfd */ @@ -123,7 +123,7 @@ static struct rte_intr_source_list intr_sources; static pthread_t intr_thread; /* VFIO interrupts */ -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO #define IRQ_SET_BUF_LEN (sizeof(struct vfio_irq_set) + sizeof(int)) @@ -559,7 +559,7 @@ rte_intr_enable(struct rte_intr_handle *intr_handle) /* not used at this moment */ case RTE_INTR_HANDLE_ALARM: return -1; -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO case RTE_INTR_HANDLE_VFIO_MSIX: if (vfio_enable_msix(intr_handle)) return -1; @@ -599,7 +599,7 @@ rte_intr_disable(struct rte_intr_handle *intr_handle) /* not used at this moment */ case RTE_INTR_HANDLE_ALARM: return -1; -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO case RTE_INTR_HANDLE_VFIO_MSIX: if (vfio_disable_msix(intr_handle)) return -1; @@ -667,7 +667,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds) case RTE_INTR_HANDLE_ALARM: bytes_read = sizeof(buf.timerfd_num); break; -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO case RTE_INTR_HANDLE_VFIO_MSIX: case RTE_INTR_HANDLE_VFIO_MSI: case RTE_INTR_HANDLE_VFIO_LEGACY: diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index 9cb0ffd..5bc0254 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -571,7 +571,7 @@ pci_map_device(struct rte_pci_device *dev) /* try mapping the NIC resources using VFIO if it exists */ switch (dev->kdrv) { case RTE_KDRV_VFIO: -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO if (pci_vfio_is_enabled()) ret = pci_vfio_map_resource(dev); #endif @@ -771,7 +771,7 @@ rte_eal_pci_init(void) RTE_LOG(ERR, EAL, "%s(): Cannot scan PCI bus\n", __func__); return -1; } -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO pci_vfio_enable(); if (pci_vfio_is_enabled()) { diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_init.h b/lib/librte_eal/linuxapp/eal/eal_pci_init.h index aa7b755..e285204 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_init.h +++ b/lib/librte_eal/linuxapp/eal/eal_pci_init.h @@ -78,7 +78,7 @@ void pci_unmap_resource(void *requested_addr, size_t size); void pci_uio_unmap_resource(struct rte_pci_device *dev); #endif /* RTE_LIBRTE_EAL_HOTPLUG */ -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO #define VFIO_MAX_GROUPS 64 diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index aea1fb1..6a0fd08 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -59,8 +59,6 @@ * This file is only compiled if CONFIG_RTE_EAL_VFIO is set to "y". */ -#ifdef VFIO_PRESENT - #define PAGE_SIZE (sysconf(_SC_PAGESIZE)) #define PAGE_MASK (~(PAGE_SIZE - 1)) @@ -909,4 +907,3 @@ pci_vfio_is_enabled(void) { return vfio_cfg.vfio_enabled; } -#endif diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c index fec7080..657fc2c 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c @@ -62,8 +62,6 @@ * This file is only compiled if CONFIG_RTE_EAL_VFIO is set to "y". */ -#ifdef VFIO_PRESENT - #define SOCKET_PATH_FMT "%s/.%s_mp_socket" #define CMSGLEN (CMSG_LEN(sizeof(int))) #define FD_TO_CMSGHDR(fd, chdr) \ @@ -391,4 +389,3 @@ pci_vfio_mp_sync_setup(void) return 0; } -#endif diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxapp/eal/eal_vfio.h index 72ec3f6..0b4e362 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h @@ -52,7 +52,6 @@ #define RTE_PCI_MSIX_FLAGS_QSIZE PCI_MSIX_FLAGS_QSIZE #endif -#define VFIO_PRESENT #endif /* kernel version */ #endif /* RTE_EAL_VFIO */ -- 2.1.4