From 9ecc306d7eeeb3bb612b968250f203093a721781 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Mon, 18 Jul 2016 15:30:53 -0300 Subject: Imported Upstream version 16.07-rc3 Change-Id: I321148bfa234858ba1986d109470b7aa280cd429 Signed-off-by: Ricardo Salveti Signed-off-by: Christian Ehrhardt --- lib/librte_eal/bsdapp/eal/Makefile | 1 + lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + lib/librte_eal/common/arch/x86/rte_spinlock.c | 45 ++++++++++++++++++++++ .../common/include/arch/x86/rte_spinlock.h | 13 ++----- lib/librte_eal/common/include/rte_version.h | 2 +- lib/librte_eal/linuxapp/eal/Makefile | 1 + lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 6 ++- lib/librte_eal/linuxapp/eal/eal_vfio.c | 6 ++- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + 9 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 lib/librte_eal/common/arch/x86/rte_spinlock.c (limited to 'lib/librte_eal') diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile index 698fa0a1..988cbbce 100644 --- a/lib/librte_eal/bsdapp/eal/Makefile +++ b/lib/librte_eal/bsdapp/eal/Makefile @@ -89,6 +89,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_keepalive.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_cpuflags.c +SRCS-$(CONFIG_RTE_ARCH_X86) += rte_spinlock.c CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 1852c4a4..a335e04b 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -158,6 +158,7 @@ DPDK_16.07 { pci_get_sysfs_path; rte_keepalive_mark_sleep; rte_keepalive_register_relay_callback; + rte_rtm_supported; rte_thread_setname; } DPDK_16.04; diff --git a/lib/librte_eal/common/arch/x86/rte_spinlock.c b/lib/librte_eal/common/arch/x86/rte_spinlock.c new file mode 100644 index 00000000..c383e9f0 --- /dev/null +++ b/lib/librte_eal/common/arch/x86/rte_spinlock.c @@ -0,0 +1,45 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "rte_cpuflags.h" + +uint8_t rte_rtm_supported; /* cache the flag to avoid the overhead + of the rte_cpu_get_flag_enabled function */ + +static void __attribute__((constructor)) +rte_rtm_init(void) +{ + rte_rtm_supported = rte_cpu_get_flag_enabled(RTE_CPUFLAG_RTM); +} diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h index 02f95cbb..8e630c21 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h +++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h @@ -94,24 +94,17 @@ rte_spinlock_trylock (rte_spinlock_t *sl) } #endif -static uint8_t rtm_supported; /* cache the flag to avoid the overhead - of the rte_cpu_get_flag_enabled function */ - -static inline void __attribute__((constructor)) -rte_rtm_init(void) -{ - rtm_supported = rte_cpu_get_flag_enabled(RTE_CPUFLAG_RTM); -} +extern uint8_t rte_rtm_supported; static inline int rte_tm_supported(void) { - return rtm_supported; + return rte_rtm_supported; } static inline int rte_try_tm(volatile int *lock) { - if (!rtm_supported) + if (!rte_rtm_supported) return 0; int retries = RTE_RTM_MAX_RETRIES; diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h index 37102227..eacc86c1 100644 --- a/lib/librte_eal/common/include/rte_version.h +++ b/lib/librte_eal/common/include/rte_version.h @@ -77,7 +77,7 @@ extern "C" { * 0-15 = release candidates * 16 = release */ -#define RTE_VER_RELEASE 2 +#define RTE_VER_RELEASE 3 /** * Macro to compute a version number usable for comparisons diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 1a976931..182729c0 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -106,6 +106,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_keepalive.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_cpuflags.c +SRCS-$(CONFIG_RTE_ARCH_X86) += rte_spinlock.c CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 46cd6831..5f478c59 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -431,7 +431,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) } else { memreg[0].offset = reg.offset; memreg[0].size = table_start; - memreg[1].offset = table_end; + memreg[1].offset = reg.offset + table_end; memreg[1].size = reg.size - table_end; RTE_LOG(DEBUG, EAL, @@ -474,7 +474,9 @@ pci_vfio_map_resource(struct rte_pci_device *dev) /* if there's a second part, try to map it */ if (map_addr != MAP_FAILED && memreg[1].offset && memreg[1].size) { - void *second_addr = RTE_PTR_ADD(bar_addr, memreg[1].offset); + void *second_addr = RTE_PTR_ADD(bar_addr, + memreg[1].offset - + (uintptr_t)reg.offset); map_addr = pci_map_resource(second_addr, vfio_dev_fd, memreg[1].offset, memreg[1].size, diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index fcb0ab38..702f7a2e 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -344,7 +344,8 @@ vfio_is_enabled(const char *modname) } const struct vfio_iommu_type * -vfio_set_iommu_type(int vfio_container_fd) { +vfio_set_iommu_type(int vfio_container_fd) +{ unsigned idx; for (idx = 0; idx < RTE_DIM(iommu_types); idx++) { const struct vfio_iommu_type *t = &iommu_types[idx]; @@ -366,7 +367,8 @@ vfio_set_iommu_type(int vfio_container_fd) { } int -vfio_has_supported_extensions(int vfio_container_fd) { +vfio_has_supported_extensions(int vfio_container_fd) +{ int ret; unsigned idx, n_extensions = 0; for (idx = 0; idx < RTE_DIM(iommu_types); idx++) { diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index a617b9e4..db8c9845 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -162,6 +162,7 @@ DPDK_16.07 { pci_get_sysfs_path; rte_keepalive_mark_sleep; rte_keepalive_register_relay_callback; + rte_rtm_supported; rte_thread_setname; } DPDK_16.04; -- cgit 1.2.3-korg