[dpdk-dev] [PATCH 02/10] eal: factorize common headers

Bruce Richardson bruce.richardson at intel.com
Tue Nov 25 11:23:29 CET 2014


On Sat, Nov 22, 2014 at 10:43:34PM +0100, Thomas Monjalon wrote:
> No need to have different headers for Linux and BSD.
> These files are identicals with exception of internal config which has
> uio and vfio fields only useful for Linux.
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>

Acked-by: Bruce Richardson <bruce.richardson at intel.com>

> ---
>  app/test/test_eal_fs.c                             |   2 +-
>  lib/librte_eal/bsdapp/eal/Makefile                 |   2 +-
>  lib/librte_eal/bsdapp/eal/include/eal_filesystem.h | 118 ---------------------
>  lib/librte_eal/bsdapp/eal/include/eal_hugepages.h  |  67 ------------
>  .../bsdapp/eal/include/eal_internal_cfg.h          |  87 ---------------
>  lib/librte_eal/bsdapp/eal/include/eal_thread.h     |  53 ---------
>  .../bsdapp/eal/include/exec-env/rte_lcore.h        |  67 ------------
>  .../bsdapp/eal/include/exec-env/rte_per_lcore.h    |  67 ------------
>  .../eal/include => common}/eal_filesystem.h        |   0
>  .../eal/include => common}/eal_hugepages.h         |   0
>  .../eal/include => common}/eal_internal_cfg.h      |   0
>  .../{linuxapp/eal/include => common}/eal_thread.h  |   0
>  lib/librte_eal/common/include/rte_lcore.h          |  26 ++++-
>  lib/librte_eal/common/include/rte_per_lcore.h      |  12 +--
>  lib/librte_eal/linuxapp/eal/Makefile               |   2 +-
>  .../linuxapp/eal/include/exec-env/rte_lcore.h      |  67 ------------
>  .../linuxapp/eal/include/exec-env/rte_per_lcore.h  |  67 ------------
>  17 files changed, 31 insertions(+), 606 deletions(-)
>  delete mode 100644 lib/librte_eal/bsdapp/eal/include/eal_filesystem.h
>  delete mode 100644 lib/librte_eal/bsdapp/eal/include/eal_hugepages.h
>  delete mode 100644 lib/librte_eal/bsdapp/eal/include/eal_internal_cfg.h
>  delete mode 100644 lib/librte_eal/bsdapp/eal/include/eal_thread.h
>  delete mode 100644 lib/librte_eal/bsdapp/eal/include/exec-env/rte_lcore.h
>  delete mode 100644 lib/librte_eal/bsdapp/eal/include/exec-env/rte_per_lcore.h
>  rename lib/librte_eal/{linuxapp/eal/include => common}/eal_filesystem.h (100%)
>  rename lib/librte_eal/{linuxapp/eal/include => common}/eal_hugepages.h (100%)
>  rename lib/librte_eal/{linuxapp/eal/include => common}/eal_internal_cfg.h (100%)
>  rename lib/librte_eal/{linuxapp/eal/include => common}/eal_thread.h (100%)
>  delete mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_lcore.h
>  delete mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_per_lcore.h
> 
> diff --git a/app/test/test_eal_fs.c b/app/test/test_eal_fs.c
> index cd41b3e..1cbcb9d 100644
> --- a/app/test/test_eal_fs.c
> +++ b/app/test/test_eal_fs.c
> @@ -38,7 +38,7 @@
>  #include <errno.h>
>  
>  /* eal_filesystem.h is not a public header file, so use relative path */
> -#include "../../lib/librte_eal/linuxapp/eal/include/eal_filesystem.h"
> +#include "../../lib/librte_eal/common/eal_filesystem.h"
>  
>  static int
>  test_parse_sysfs_value(void)
> diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
> index 4683fc3..d434882 100644
> --- a/lib/librte_eal/bsdapp/eal/Makefile
> +++ b/lib/librte_eal/bsdapp/eal/Makefile
> @@ -86,7 +86,7 @@ CFLAGS_eal_thread.o += -Wno-return-type
>  CFLAGS_eal_hpet.o += -Wno-return-type
>  endif
>  
> -INC := rte_per_lcore.h rte_lcore.h rte_interrupts.h
> +INC := rte_interrupts.h
>  
>  SYMLINK-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP)-include/exec-env := \
>  	$(addprefix include/exec-env/,$(INC))
> diff --git a/lib/librte_eal/bsdapp/eal/include/eal_filesystem.h b/lib/librte_eal/bsdapp/eal/include/eal_filesystem.h
> deleted file mode 100644
> index ce442c9..0000000
> --- a/lib/librte_eal/bsdapp/eal/include/eal_filesystem.h
> +++ /dev/null
> @@ -1,118 +0,0 @@
> -/*-
> - *   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.
> - */
> -
> -/**
> - * @file
> - * Stores functions and path defines for files and directories
> - * on the filesystem for Linux, that are used by the Linux EAL.
> - */
> -
> -#ifndef _EAL_LINUXAPP_FILESYSTEM_H
> -#define _EAL_LINUXAPP_FILESYSTEM_H
> -
> -/** Path of rte config file. */
> -#define RUNTIME_CONFIG_FMT "%s/.%s_config"
> -
> -#include <stdint.h>
> -#include <limits.h>
> -#include <unistd.h>
> -#include <stdlib.h>
> -
> -#include <rte_string_fns.h>
> -#include "eal_internal_cfg.h"
> -
> -static const char *default_config_dir = "/var/run";
> -
> -static inline const char *
> -eal_runtime_config_path(void)
> -{
> -	static char buffer[PATH_MAX]; /* static so auto-zeroed */
> -	const char *directory = default_config_dir;
> -	const char *home_dir = getenv("HOME");
> -
> -	if (getuid() != 0 && home_dir != NULL)
> -		directory = home_dir;
> -	snprintf(buffer, sizeof(buffer) - 1, RUNTIME_CONFIG_FMT, directory,
> -			internal_config.hugefile_prefix);
> -	return buffer;
> -}
> -
> -/** Path of hugepage info file. */
> -#define HUGEPAGE_INFO_FMT "%s/.%s_hugepage_info"
> -
> -static inline const char *
> -eal_hugepage_info_path(void)
> -{
> -	static char buffer[PATH_MAX]; /* static so auto-zeroed */
> -	const char *directory = default_config_dir;
> -	const char *home_dir = getenv("HOME");
> -
> -	if (getuid() != 0 && home_dir != NULL)
> -		directory = home_dir;
> -	snprintf(buffer, sizeof(buffer) - 1, HUGEPAGE_INFO_FMT, directory,
> -			internal_config.hugefile_prefix);
> -	return buffer;
> -}
> -
> -/** String format for hugepage map files. */
> -#define HUGEFILE_FMT "%s/%smap_%d"
> -#define TEMP_HUGEFILE_FMT "%s/%smap_temp_%d"
> -
> -static inline const char *
> -eal_get_hugefile_path(char *buffer, size_t buflen, const char *hugedir, int f_id)
> -{
> -	snprintf(buffer, buflen, HUGEFILE_FMT, hugedir,
> -			internal_config.hugefile_prefix, f_id);
> -	buffer[buflen - 1] = '\0';
> -	return buffer;
> -}
> -
> -#ifdef RTE_EAL_SINGLE_FILE_SEGMENTS
> -static inline const char *
> -eal_get_hugefile_temp_path(char *buffer, size_t buflen, const char *hugedir, int f_id)
> -{
> -	snprintf(buffer, buflen, TEMP_HUGEFILE_FMT, hugedir,
> -			internal_config.hugefile_prefix, f_id);
> -	buffer[buflen - 1] = '\0';
> -	return buffer;
> -}
> -#endif
> -
> -/** define the default filename prefix for the %s values above */
> -#define HUGEFILE_PREFIX_DEFAULT "rte"
> -
> -/** Function to read a single numeric value from a file on the filesystem.
> - * Used to read information from files on /sys */
> -int eal_parse_sysfs_value(const char *filename, unsigned long *val);
> -
> -#endif /* _EAL_LINUXAPP_FILESYSTEM_H */
> diff --git a/lib/librte_eal/bsdapp/eal/include/eal_hugepages.h b/lib/librte_eal/bsdapp/eal/include/eal_hugepages.h
> deleted file mode 100644
> index 51e090b..0000000
> --- a/lib/librte_eal/bsdapp/eal/include/eal_hugepages.h
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -/*-
> - *   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.
> - */
> -
> -#ifndef RTE_LINUXAPP_HUGEPAGES_H_
> -#define RTE_LINUXAPP_HUGEPAGES_H_
> -
> -#include <stddef.h>
> -#include <stdint.h>
> -#include <limits.h>
> -
> -#define MAX_HUGEPAGE_PATH PATH_MAX
> -
> -/**
> - * Structure used to store informations about hugepages that we mapped
> - * through the files in hugetlbfs.
> - */
> -struct hugepage_file {
> -	void *orig_va;      /**< virtual addr of first mmap() */
> -	void *final_va;     /**< virtual addr of 2nd mmap() */
> -	uint64_t physaddr;  /**< physical addr */
> -	size_t size;        /**< the page size */
> -	int socket_id;      /**< NUMA socket ID */
> -	int file_id;        /**< the '%d' in HUGEFILE_FMT */
> -	int memseg_id;      /**< the memory segment to which page belongs */
> -#ifdef RTE_EAL_SINGLE_FILE_SEGMENTS
> -	int repeated;		/**< number of times the page size is repeated */
> -#endif
> -	char filepath[MAX_HUGEPAGE_PATH]; /**< path to backing file on filesystem */
> -};
> -
> -/**
> - * Read the information from linux on what hugepages are available
> - * for the EAL to use
> - */
> -int eal_hugepage_info_init(void);
> -
> -#endif /* EAL_HUGEPAGES_H_ */
> diff --git a/lib/librte_eal/bsdapp/eal/include/eal_internal_cfg.h b/lib/librte_eal/bsdapp/eal/include/eal_internal_cfg.h
> deleted file mode 100644
> index 24cefc2..0000000
> --- a/lib/librte_eal/bsdapp/eal/include/eal_internal_cfg.h
> +++ /dev/null
> @@ -1,87 +0,0 @@
> -/*-
> - *   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.
> - */
> -
> -/**
> - * @file
> - * Holds the structures for the eal internal configuration
> - */
> -
> -#ifndef _EAL_LINUXAPP_INTERNAL_CFG
> -#define _EAL_LINUXAPP_INTERNAL_CFG
> -
> -#include <rte_eal.h>
> -
> -#define MAX_HUGEPAGE_SIZES 3  /**< support up to 3 page sizes */
> -
> -/*
> - * internal configuration structure for the number, size and
> - * mount points of hugepages
> - */
> -struct hugepage_info {
> -	size_t hugepage_sz;   /**< size of a huge page */
> -	const char *hugedir;    /**< dir where hugetlbfs is mounted */
> -	uint32_t num_pages[RTE_MAX_NUMA_NODES];
> -				/**< number of hugepages of that size on each socket */
> -	int lock_descriptor;    /**< file descriptor for hugepage dir */
> -};
> -
> -/**
> - * internal configuration
> - */
> -struct internal_config {
> -	volatile size_t memory;           /**< amount of asked memory */
> -	volatile unsigned force_nchannel; /**< force number of channels */
> -	volatile unsigned force_nrank;    /**< force number of ranks */
> -	volatile unsigned no_hugetlbfs;   /**< true to disable hugetlbfs */
> -	volatile unsigned xen_dom0_support; /**< support app running on Xen Dom0*/
> -	volatile unsigned no_pci;         /**< true to disable PCI */
> -	volatile unsigned no_hpet;        /**< true to disable HPET */
> -	volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping
> -										* instead of native TSC */
> -	volatile unsigned no_shconf;      /**< true if there is no shared config */
> -	volatile enum rte_proc_type_t process_type; /* multi-process proc type */
> -	/* true to try allocating memory on specific sockets */
> -	volatile unsigned force_sockets;
> -	volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */
> -	uintptr_t base_virtaddr;          /**< base address to try and reserve memory from */
> -	volatile int syslog_facility;	  /**< facility passed to openlog() */
> -	volatile uint32_t log_level;	  /**< default log level */
> -	const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
> -	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
> -
> -	unsigned num_hugepage_sizes;      /**< how many sizes on this system */
> -	struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
> -};
> -extern struct internal_config internal_config; /**< Global EAL configuration. */
> -
> -#endif
> diff --git a/lib/librte_eal/bsdapp/eal/include/eal_thread.h b/lib/librte_eal/bsdapp/eal/include/eal_thread.h
> deleted file mode 100644
> index d029ad3..0000000
> --- a/lib/librte_eal/bsdapp/eal/include/eal_thread.h
> +++ /dev/null
> @@ -1,53 +0,0 @@
> -/*-
> - *   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.
> - */
> -
> -#ifndef _EAL_LINUXAPP_THREAD_H_
> -#define _EAL_LINUXAPP_THREAD_H_
> -
> -/**
> - * basic loop of thread, called for each thread by eal_init().
> - *
> - * @param arg
> - *   opaque pointer
> - */
> -__attribute__((noreturn)) void *eal_thread_loop(void *arg);
> -
> -/**
> - * Init per-lcore info for master thread
> - *
> - * @param lcore_id
> - *   identifier of master lcore
> - */
> -void eal_thread_init_master(unsigned lcore_id);
> -
> -#endif /* _EAL_LINUXAPP_PRIVATE_H_ */
> diff --git a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_lcore.h b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_lcore.h
> deleted file mode 100644
> index e19ab54..0000000
> --- a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_lcore.h
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -/*-
> - *   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.
> - */
> -
> -#ifndef _RTE_LCORE_H_
> -#error "don't include this file directly, please include generic <rte_lcore.h>"
> -#endif
> -
> -#ifndef _RTE_LINUXAPP_LCORE_H_
> -#define _RTE_LINUXAPP_LCORE_H_
> -
> -/**
> - * @file
> - * API for lcore and socket manipulation in linuxapp environment
> - */
> -
> -/**
> - * structure storing internal configuration (per-lcore)
> - */
> -struct lcore_config {
> -	unsigned detected;         /**< true if lcore was detected */
> -	pthread_t thread_id;       /**< pthread identifier */
> -	int pipe_master2slave[2];  /**< communication pipe with master */
> -	int pipe_slave2master[2];  /**< communication pipe with master */
> -	lcore_function_t * volatile f;         /**< function to call */
> -	void * volatile arg;       /**< argument of function */
> -	volatile int ret;          /**< return value of function */
> -	volatile enum rte_lcore_state_t state; /**< lcore state */
> -	unsigned socket_id;        /**< physical socket id for this lcore */
> -	unsigned core_id;          /**< core number on socket for this lcore */
> -};
> -
> -/**
> - * internal configuration (per-lcore)
> - */
> -extern struct lcore_config lcore_config[RTE_MAX_LCORE];
> -
> -#endif /* _RTE_LINUXAPP_LCORE_H_ */
> diff --git a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_per_lcore.h b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_per_lcore.h
> deleted file mode 100644
> index db8f274..0000000
> --- a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_per_lcore.h
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -/*-
> - *   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.
> - */
> -
> -#ifndef _RTE_PER_LCORE_H_
> -#error "don't include this file directly, please include generic <rte_per_lcore.h>"
> -#endif
> -
> -#ifndef _RTE_LINUXAPP_PER_LCORE_H_
> -#define _RTE_LINUXAPP_PER_LCORE_H_
> -
> -/**
> - * @file
> - * Per-lcore variables in RTE on linuxapp environment
> - */
> -
> -#include <pthread.h>
> -
> -/**
> - * Macro to define a per lcore variable "var" of type "type", don't
> - * use keywords like "static" or "volatile" in type, just prefix the
> - * whole macro.
> - */
> -#define RTE_DEFINE_PER_LCORE(type, name)			\
> -	__thread __typeof__(type) per_lcore_##name
> -
> -/**
> - * Macro to declare an extern per lcore variable "var" of type "type"
> - */
> -#define RTE_DECLARE_PER_LCORE(type, name)			\
> -	extern __thread __typeof__(type) per_lcore_##name
> -
> -/**
> - * Read/write the per-lcore variable value
> - */
> -#define RTE_PER_LCORE(name) (per_lcore_##name)
> -
> -#endif /* _RTE_LINUXAPP_PER_LCORE_H_ */
> diff --git a/lib/librte_eal/linuxapp/eal/include/eal_filesystem.h b/lib/librte_eal/common/eal_filesystem.h
> similarity index 100%
> rename from lib/librte_eal/linuxapp/eal/include/eal_filesystem.h
> rename to lib/librte_eal/common/eal_filesystem.h
> diff --git a/lib/librte_eal/linuxapp/eal/include/eal_hugepages.h b/lib/librte_eal/common/eal_hugepages.h
> similarity index 100%
> rename from lib/librte_eal/linuxapp/eal/include/eal_hugepages.h
> rename to lib/librte_eal/common/eal_hugepages.h
> diff --git a/lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
> similarity index 100%
> rename from lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h
> rename to lib/librte_eal/common/eal_internal_cfg.h
> diff --git a/lib/librte_eal/linuxapp/eal/include/eal_thread.h b/lib/librte_eal/common/eal_thread.h
> similarity index 100%
> rename from lib/librte_eal/linuxapp/eal/include/eal_thread.h
> rename to lib/librte_eal/common/eal_thread.h
> diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
> index 3802a28..a0b4356 100644
> --- a/lib/librte_eal/common/include/rte_lcore.h
> +++ b/lib/librte_eal/common/include/rte_lcore.h
> @@ -37,8 +37,7 @@
>  /**
>   * @file
>   *
> - * API for lcore and Socket Manipulation. Parts of this are execution
> - * environment specific.
> + * API for lcore and socket manipulation
>   *
>   */
>  #include <rte_per_lcore.h>
> @@ -51,6 +50,27 @@ extern "C" {
>  
>  #define LCORE_ID_ANY -1    /**< Any lcore. */
>  
> +/**
> + * Structure storing internal configuration (per-lcore)
> + */
> +struct lcore_config {
> +	unsigned detected;         /**< true if lcore was detected */
> +	pthread_t thread_id;       /**< pthread identifier */
> +	int pipe_master2slave[2];  /**< communication pipe with master */
> +	int pipe_slave2master[2];  /**< communication pipe with master */
> +	lcore_function_t * volatile f;         /**< function to call */
> +	void * volatile arg;       /**< argument of function */
> +	volatile int ret;          /**< return value of function */
> +	volatile enum rte_lcore_state_t state; /**< lcore state */
> +	unsigned socket_id;        /**< physical socket id for this lcore */
> +	unsigned core_id;          /**< core number on socket for this lcore */
> +};
> +
> +/**
> + * Internal configuration (per-lcore)
> + */
> +extern struct lcore_config lcore_config[RTE_MAX_LCORE];
> +
>  RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per core "core id". */
>  
>  /**
> @@ -89,8 +109,6 @@ rte_lcore_count(void)
>  	return cfg->lcore_count;
>  }
>  
> -#include <exec-env/rte_lcore.h>
> -
>  /**
>   * Return the ID of the physical socket of the logical core we are
>   * running on.
> diff --git a/lib/librte_eal/common/include/rte_per_lcore.h b/lib/librte_eal/common/include/rte_per_lcore.h
> index 14d3521..5434729 100644
> --- a/lib/librte_eal/common/include/rte_per_lcore.h
> +++ b/lib/librte_eal/common/include/rte_per_lcore.h
> @@ -51,26 +51,26 @@
>  extern "C" {
>  #endif
>  
> -#include <exec-env/rte_per_lcore.h>
> +#include <pthread.h>
>  
> -#ifdef __DOXYGEN__
>  /**
>   * Macro to define a per lcore variable "var" of type "type", don't
>   * use keywords like "static" or "volatile" in type, just prefix the
>   * whole macro.
>   */
> -#define RTE_DEFINE_PER_LCORE(type, name)
> +#define RTE_DEFINE_PER_LCORE(type, name)			\
> +	__thread __typeof__(type) per_lcore_##name
>  
>  /**
>   * Macro to declare an extern per lcore variable "var" of type "type"
>   */
> -#define RTE_DECLARE_PER_LCORE(type, name)
> +#define RTE_DECLARE_PER_LCORE(type, name)			\
> +	extern __thread __typeof__(type) per_lcore_##name
>  
>  /**
>   * Read/write the per-lcore variable value
>   */
> -#define RTE_PER_LCORE(name)
> -#endif
> +#define RTE_PER_LCORE(name) (per_lcore_##name)
>  
>  #ifdef __cplusplus
>  }
> diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
> index 2480cb0..702273f 100644
> --- a/lib/librte_eal/linuxapp/eal/Makefile
> +++ b/lib/librte_eal/linuxapp/eal/Makefile
> @@ -100,7 +100,7 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
>  CFLAGS_eal_thread.o += -Wno-return-type
>  endif
>  
> -INC := rte_per_lcore.h rte_lcore.h rte_interrupts.h rte_kni_common.h rte_dom0_common.h
> +INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h
>  
>  SYMLINK-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP)-include/exec-env := \
>  	$(addprefix include/exec-env/,$(INC))
> diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_lcore.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_lcore.h
> deleted file mode 100644
> index e19ab54..0000000
> --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_lcore.h
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -/*-
> - *   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.
> - */
> -
> -#ifndef _RTE_LCORE_H_
> -#error "don't include this file directly, please include generic <rte_lcore.h>"
> -#endif
> -
> -#ifndef _RTE_LINUXAPP_LCORE_H_
> -#define _RTE_LINUXAPP_LCORE_H_
> -
> -/**
> - * @file
> - * API for lcore and socket manipulation in linuxapp environment
> - */
> -
> -/**
> - * structure storing internal configuration (per-lcore)
> - */
> -struct lcore_config {
> -	unsigned detected;         /**< true if lcore was detected */
> -	pthread_t thread_id;       /**< pthread identifier */
> -	int pipe_master2slave[2];  /**< communication pipe with master */
> -	int pipe_slave2master[2];  /**< communication pipe with master */
> -	lcore_function_t * volatile f;         /**< function to call */
> -	void * volatile arg;       /**< argument of function */
> -	volatile int ret;          /**< return value of function */
> -	volatile enum rte_lcore_state_t state; /**< lcore state */
> -	unsigned socket_id;        /**< physical socket id for this lcore */
> -	unsigned core_id;          /**< core number on socket for this lcore */
> -};
> -
> -/**
> - * internal configuration (per-lcore)
> - */
> -extern struct lcore_config lcore_config[RTE_MAX_LCORE];
> -
> -#endif /* _RTE_LINUXAPP_LCORE_H_ */
> diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_per_lcore.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_per_lcore.h
> deleted file mode 100644
> index db8f274..0000000
> --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_per_lcore.h
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -/*-
> - *   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.
> - */
> -
> -#ifndef _RTE_PER_LCORE_H_
> -#error "don't include this file directly, please include generic <rte_per_lcore.h>"
> -#endif
> -
> -#ifndef _RTE_LINUXAPP_PER_LCORE_H_
> -#define _RTE_LINUXAPP_PER_LCORE_H_
> -
> -/**
> - * @file
> - * Per-lcore variables in RTE on linuxapp environment
> - */
> -
> -#include <pthread.h>
> -
> -/**
> - * Macro to define a per lcore variable "var" of type "type", don't
> - * use keywords like "static" or "volatile" in type, just prefix the
> - * whole macro.
> - */
> -#define RTE_DEFINE_PER_LCORE(type, name)			\
> -	__thread __typeof__(type) per_lcore_##name
> -
> -/**
> - * Macro to declare an extern per lcore variable "var" of type "type"
> - */
> -#define RTE_DECLARE_PER_LCORE(type, name)			\
> -	extern __thread __typeof__(type) per_lcore_##name
> -
> -/**
> - * Read/write the per-lcore variable value
> - */
> -#define RTE_PER_LCORE(name) (per_lcore_##name)
> -
> -#endif /* _RTE_LINUXAPP_PER_LCORE_H_ */
> -- 
> 2.1.3
> 


More information about the dev mailing list