Move common functions in EAL
v8 cover Move common functions in EAL
Changes in v8 includes
Re-ordering source file compilation to fix ABI warning. Ran validate-abi against x86_64-native-linuxapp-gcc, x86_64-native-linuxapp-clang and x86_64-ivshmem-linuxapp-gcc environments.
Testing:
Linux - Ubuntu x86_64 14.04
Compilation successful (x86_64-native-linuxapp-gcc and x86_64-native-linuxapp-clang).
"make test" results match baseline code. testpmd utility on I217/I218 Intel chipset.
FreeBSD 10.0 x86_64
Compilation successful (x86_64-native-bsdapp-gcc and x86_64-native-bsdapp-clang).
Tested with helloworld, timer and cmdline examples.
Ravi Kerur (6):
Move common functions in eal_thread.c
Move common functions in eal.c
Move common functions in eal_lcore.c
Move common functions in eal_timer.c
Move common functions in eal_memory.c
Move common functions in eal_pci.c
lib/librte_eal/bsdapp/eal/Makefile | 9 +- lib/librte_eal/bsdapp/eal/eal.c | 271 +++--------------------- lib/librte_eal/bsdapp/eal/eal_lcore.c | 72 ++----- lib/librte_eal/bsdapp/eal/eal_memory.c | 47 ++--- lib/librte_eal/bsdapp/eal/eal_pci.c | 72 +------ lib/librte_eal/bsdapp/eal/eal_thread.c | 152 -------------- lib/librte_eal/bsdapp/eal/eal_timer.c | 52 +---- lib/librte_eal/common/eal_common_app_usage.c | 63 ++++++ lib/librte_eal/common/eal_common_lcore.c | 107 ++++++++++ lib/librte_eal/common/eal_common_mem_cfg.c | 224 ++++++++++++++++++++ lib/librte_eal/common/eal_common_memory.c | 38 +++- lib/librte_eal/common/eal_common_pci.c | 72 +++++++ lib/librte_eal/common/eal_common_proc_type.c | 58 ++++++ lib/librte_eal/common/eal_common_sysfs.c | 148 ++++++++++++++ lib/librte_eal/common/eal_common_thread.c | 147 ++++++++++++- lib/librte_eal/common/eal_common_timer.c | 102 +++++++++ lib/librte_eal/common/eal_hugepages.h | 1 + lib/librte_eal/common/eal_private.h | 171 +++++++++++++++- lib/librte_eal/common/include/rte_eal.h | 4 + lib/librte_eal/linuxapp/eal/Makefile | 10 +- lib/librte_eal/linuxapp/eal/eal.c | 296 ++++----------------------- lib/librte_eal/linuxapp/eal/eal_lcore.c | 66 +----- lib/librte_eal/linuxapp/eal/eal_memory.c | 36 +--- lib/librte_eal/linuxapp/eal/eal_pci.c | 75 +------ lib/librte_eal/linuxapp/eal/eal_thread.c | 152 +------------- lib/librte_eal/linuxapp/eal/eal_timer.c | 55 +---- 26 files changed, 1277 insertions(+), 1223 deletions(-) create mode 100644 lib/librte_eal/common/eal_common_app_usage.c create mode 100644 lib/librte_eal/common/eal_common_lcore.c create mode 100644 lib/librte_eal/common/eal_common_mem_cfg.c create mode 100644 lib/librte_eal/common/eal_common_proc_type.c create mode 100644 lib/librte_eal/common/eal_common_sysfs.c create mode 100644 lib/librte_eal/common/eal_common_timer.c
Signature · 1 line
1.9.1
PATCH v8 1/6 Move common functions in eal_thread.c
In reply to a message not in the archiveChanges in v8
Fixed ABI warnings by reordering compilation ofeal_common_thread.c.
Changes in v7
Remove _setname_ pthread calls.
Use rte_gettid() API in RTE_LOG to print thread_id.
Changes in v6
Remove RTE_EXEC_ENV_BSDAPP from eal_common_thread.c file. Add pthread_setname_np/pthread_set_name_np for Linux/FreeBSD respectively. Plan to use _getname_ in RTE_LOG when available. Use existing rte_get_systid() in RTE_LOG to print thread_id.
Changes in v5
Rebase to latest code.
Changes in v4
None
Changes in v3
Changed subject to be more explicit on file name inclusion.
Changes in v2
None
Changes in v1eal_thread.c has minor differences between Linux and BSD, move entire file into common directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate on minor differences. Rename eal_thread.c to eal_common_thread.cMakefile changes to reflect file move and name change. Fix checkpatch warnings.
--- lib/librte_eal/bsdapp/eal/Makefile | 3 +- lib/librte_eal/bsdapp/eal/eal_thread.c | 152 ------------------------------ lib/librte_eal/common/eal_common_thread.c | 147 ++++++++++++++++++++++++++++- lib/librte_eal/linuxapp/eal/Makefile | 3 +- lib/librte_eal/linuxapp/eal/eal_thread.c | 152 +----------------------------- 5 files changed, 151 insertions(+), 306 deletions(-)
lib/librte_eal/bsdapp/eal/Makefile +2 -1
@@ -55,6 +55,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) := eal.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_memory.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c
@@ -77,7 +78,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c -SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c CFLAGS_eal.o := -D_GNU_SOURCE #CFLAGS_eal_thread.o := -D_GNU_SOURCE
@@ -88,6 +88,7 @@ CFLAGS_eal_common_log.o := -D_GNU_SOURCE # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_eal_thread.o += -Wno-return-type +CFLAGS_eal_common_thread.o += -Wno-return-type CFLAGS_eal_hpet.o += -Wno-return-type endif
lib/librte_eal/bsdapp/eal/eal_thread.c +0 -152
163 lines not on this page · raw message
lib/librte_eal/common/eal_common_thread.c +146 -1
170 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/Makefile +2 -1
@@ -61,6 +61,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y) SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_xen_memory.c endif SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_thread.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_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
@@ -89,7 +90,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_hexdump.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c -SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_thread.c CFLAGS_eal.o := -D_GNU_SOURCE CFLAGS_eal_interrupts.o := -D_GNU_SOURCE
@@ -109,6 +109,7 @@ CFLAGS_eal_common_thread.o := -D_GNU_SOURCE # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_eal_thread.o += -Wno-return-type +CFLAGS_eal_common_thread.o += -Wno-return-type endif INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h
lib/librte_eal/linuxapp/eal/eal_thread.c +1 -151
164 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 2/6 Move common functions in eal.c
In reply to a message not in the archiveChanges in v8
Fix ABI warnings by reordering compilation ofeal_common_sysfs.ceal_common_mem_cfg.ceal_common_proc_type.ceal_common_app_usage.c
Changes in v7
Fix compilation errors in clang.
Changes in v6
Split eal_common_system.c and eal_common_runtime.c into eal_common_sysfs.ceal_common_mem_cfg.ceal_common_proc_type.ceal_common_app_usage.c
based on functionality.
Changes in v5
Rebase to latest code.
Changes in v4
Remove eal_externs.h file, instead use _get_ and _set_ APIS to access those variables.
Split eal_common.c into eal_common_system.c and
and eal_common_runtime.crte_eal prefix functions are moved to _runtime_ and eal prefix functions are moved to _system_ files respectively.
Changes in v3
Changed subject to be more explicit on file name inclusion.
Changes in v2
In function rte_eal_config_create remove #ifdef _BSDAPP_ and initialize mem_cfg_addr unconditionally.
Changes in v1
Move common functions in eal.c to librte_eal/common/eal_common.c.
Following functions are moved to eal_common.c file.
struct rte_config *rte_eal_get_configuration(void);
int eal_parse_sysfs_value(const char *filename, unsigned long *val); static void rte_eal_config_create(void);
enum rte_proc_type_t eal_proc_type_detect(void);
void rte_eal_config_init(void);rte_usage_hook_t rte_set_application_usage_hook(rte_usage_hook_t usage_func);
inline size_t eal_get_hugepage_mem_size(void);
void eal_check_mem_on_local_socket(void);
int sync_func(__attribute__((unused)) void *arg);
inline void rte_eal_mcfg_complete(void);
int rte_eal_has_hugepages(void);
enum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id); enum rte_proc_type_t rte_eal_process_type(void);
Makefile changes to reflect new files added.
Fix checkpatch warnings and errors.
--- lib/librte_eal/bsdapp/eal/Makefile | 4 + lib/librte_eal/bsdapp/eal/eal.c | 271 +++--------------------- lib/librte_eal/common/eal_common_app_usage.c | 63 ++++++ lib/librte_eal/common/eal_common_mem_cfg.c | 224 ++++++++++++++++++++ lib/librte_eal/common/eal_common_proc_type.c | 58 ++++++ lib/librte_eal/common/eal_common_sysfs.c | 148 ++++++++++++++ lib/librte_eal/common/eal_hugepages.h | 1 + lib/librte_eal/common/eal_private.h | 78 +++++++ lib/librte_eal/common/include/rte_eal.h | 4 + lib/librte_eal/linuxapp/eal/Makefile | 4 + lib/librte_eal/linuxapp/eal/eal.c | 296 ++++----------------------- 11 files changed, 660 insertions(+), 491 deletions(-) create mode 100644 lib/librte_eal/common/eal_common_app_usage.c create mode 100644 lib/librte_eal/common/eal_common_mem_cfg.c create mode 100644 lib/librte_eal/common/eal_common_proc_type.c create mode 100644 lib/librte_eal/common/eal_common_sysfs.c
lib/librte_eal/bsdapp/eal/Makefile +4 -0
@@ -52,6 +52,10 @@ LIBABIVER := 1 # specific to linuxapp exec-env SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) := eal.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_sysfs.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_mem_cfg.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_proc_type.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_app_usage.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_memory.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
lib/librte_eal/bsdapp/eal/eal.c +33 -238
341 lines not on this page · raw message
lib/librte_eal/common/eal_common_app_usage.c new file +63 -0
63 lines not on this page · raw message
lib/librte_eal/common/eal_common_mem_cfg.c new file +224 -0
224 lines not on this page · raw message
lib/librte_eal/common/eal_common_proc_type.c new file +58 -0
58 lines not on this page · raw message
lib/librte_eal/common/eal_common_sysfs.c new file +148 -0
148 lines not on this page · raw message
lib/librte_eal/common/eal_hugepages.h +1 -0
@@ -63,5 +63,6 @@ struct hugepage_file {* for the EAL to use */ int eal_hugepage_info_init (void ); +size_t eal_get_hugepage_mem_size (void );#endif /* EAL_HUGEPAGES_H */
lib/librte_eal/common/eal_private.h +78 -0
88 lines not on this page · raw message
lib/librte_eal/common/include/rte_eal.h +4 -0
@@ -51,6 +51,10 @@ extern "C" {#define RTE_MAGIC 19820526/**< Magic number written by the main partition when ready. */ +#define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL) + +#define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10) +/** * The lcore role (used in RTE or not). */
lib/librte_eal/linuxapp/eal/Makefile +4 -0
@@ -55,6 +55,10 @@ CFLAGS += $(WERROR_FLAGS) -O3 # specific to linuxapp exec-env SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) := eal.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_sysfs.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_mem_cfg.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_proc_type.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_app_usage.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_hugepage_info.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_memory.c ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y)
lib/librte_eal/linuxapp/eal/eal.c +43 -253
407 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 3/6 Move common functions in eal_lcore.c
In reply to a message not in the archiveChanges in v8
Reorder eal_common_lcore.c compilation.
Changes in v7
None
Changes in v6
None
Changes in v5
Rebase to latest code.
Changes in v4
Implement cpu_detected() for BSD.
Have common RTE_LOG for Linux and BSD in rte_eal_cpu_init(). Remove RTE_EXEC_ENV_BSDAPP in common file.
Changes in v3
Changed subject to be more explicit on file name inclusion.
Changes in v2
None
Changes in v1
Move common function in eal_lcore.c to librte_eal/common/ eal_common_lcore.c file.
Following function is moved to eal_common_lcore.c file
int rte_eal_cpu_init(void);
Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in common function.Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.
--- lib/librte_eal/bsdapp/eal/Makefile | 1 + lib/librte_eal/bsdapp/eal/eal_lcore.c | 72 +++++---------------- lib/librte_eal/common/eal_common_lcore.c | 107 +++++++++++++++++++++++++++++++ lib/librte_eal/common/eal_private.h | 14 ++++ lib/librte_eal/linuxapp/eal/Makefile | 2 + lib/librte_eal/linuxapp/eal/eal_lcore.c | 66 ++----------------- 6 files changed, 143 insertions(+), 119 deletions(-) create mode 100644 lib/librte_eal/common/eal_common_lcore.c
lib/librte_eal/bsdapp/eal/Makefile +1 -0
@@ -64,6 +64,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_timer.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_alarm.c
lib/librte_eal/bsdapp/eal/eal_lcore.c +15 -57
89 lines not on this page · raw message
lib/librte_eal/common/eal_common_lcore.c new file +107 -0
107 lines not on this page · raw message
lib/librte_eal/common/eal_private.h +14 -0
@@ -310,4 +310,18 @@ void rte_eal_config_attach(void);*/ void rte_eal_config_reattach (void ); +/** +* This function gets cpu core_id +* +* This function is private to the EAL. +*/ +unsigned eal_cpu_core_id (unsigned lcore_id); + +/** +* This function check if cpu is present +* +* This function is private to the EAL. +*/ +int eal_cpu_detected (unsigned lcore_id); +#endif /* _EAL_PRIVATE_H_ */
lib/librte_eal/linuxapp/eal/Makefile +2 -0
@@ -73,6 +73,7 @@ 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_LIBRTE_EAL_LINUXAPP) += eal_debug.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_lcore.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_lcore.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_timer.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_interrupts.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_alarm.c
@@ -108,6 +109,7 @@ CFLAGS_eal_pci_vfio.o := -D_GNU_SOURCE CFLAGS_eal_common_whitelist.o := -D_GNU_SOURCE CFLAGS_eal_common_options.o := -D_GNU_SOURCE CFLAGS_eal_common_thread.o := -D_GNU_SOURCE +CFLAGS_eal_common_lcore.o := -D_GNU_SOURCE # workaround for a gcc bug with noreturn attribute # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
lib/librte_eal/linuxapp/eal/eal_lcore.c +4 -62
81 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 4/6 Move common functions in eal_timer.c
In reply to a message not in the archiveChanges in v8
Reorder eal_common_timer.c compilation.
Changes in v7
None
Changes in v6
Added new line between Copyright and header file inclusion in eal_common_timer.c.
Changes in v5
Rebase to latest code.
Changes in v4
Removed extern declaration of eal_tsc_resolution_hz, instead provided _set_ API.
Make set_tsc_freq_from_clock as wrapper function for BSD.
Changes in v3
Changed subject to be more explicit on file name inclusion.
Changes in v2
Use common function name set_tsc_freq_from_sysctl for BSD and Linux. Update comments about its actuality in function declaration.
Changes in v1
Move common functions in eal_timer.c to librte_eal/common/ eal_common_timer.c file.
Following functions are moved to eal_common_timer.c file
void rte_delay_us(unsigned us);uint64_t rte_get_tsc_hz(void);
static void set_tsc_freq_fallback(void);
void set_tsc_freq(void);
Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.
--- lib/librte_eal/bsdapp/eal/Makefile | 1 + lib/librte_eal/bsdapp/eal/eal_timer.c | 52 +++------------- lib/librte_eal/common/eal_common_timer.c | 102 +++++++++++++++++++++++++++++++ lib/librte_eal/common/eal_private.h | 24 ++++++++ lib/librte_eal/linuxapp/eal/Makefile | 1 + lib/librte_eal/linuxapp/eal/eal_timer.c | 55 ++--------------- 6 files changed, 140 insertions(+), 95 deletions(-) create mode 100644 lib/librte_eal/common/eal_common_timer.c
lib/librte_eal/bsdapp/eal/Makefile +1 -0
@@ -66,6 +66,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_timer.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_timer.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_alarm.c
lib/librte_eal/bsdapp/eal/eal_timer.c +8 -44
79 lines not on this page · raw message
lib/librte_eal/common/eal_common_timer.c new file +102 -0
102 lines not on this page · raw message
lib/librte_eal/common/eal_private.h +24 -0
@@ -324,4 +324,28 @@ unsigned eal_cpu_core_id(unsigned lcore_id);*/ int eal_cpu_detected (unsigned lcore_id); +/** +* This function measures TSC frequency +* +* This function is private to the EAL. +*/ +void set_tsc_freq (void ); + +/** +* This function sets TSC frequency from sysctl +* for BSD and from clock for Linux. +* Is a wrapper function for BSD which will +* internally call set_tsc_freq_from_sysctl. +* +* This function is private to the EAL. +*/ +int set_tsc_freq_from_clock (void ); + +/** +* This function sets TSC frequency +* +* This function is private to the EAL. +*/ +void rte_set_tsc_hz (uint64_t tsc_hz); +#endif /* _EAL_PRIVATE_H_ */
lib/librte_eal/linuxapp/eal/Makefile +1 -0
@@ -75,6 +75,7 @@ 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_common_lcore.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_timer.c +SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_timer.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_interrupts.c SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_alarm.c ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
lib/librte_eal/linuxapp/eal/eal_timer.c +4 -51
91 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 5/6 Move common functions in eal_memory.c
In reply to a message not in the archiveChanges in v8
None
Changes in v7
None
Changes in v6
Removed unnecessary comments in function declaration.
Changes in v5
Rebase to latest code.
Changes in v4
Make rte_eal_hugepage_init and rte_eal_hugepage_attach as wrapper functions for BSD.
Changes in v3
Changed subject to be more explicit on file name inclusion.
Changes in v2
Use common function names rte_eal_hugepage_init and rte_eal_hugepage_attach for BSD and Linux. Update comments about its actuality in function declaration.
Changes in v1
Move common functions in eal_memory.c to librte_eal/common/ eal_common_memory.c file.
Following functions are moved to eal_common_memory.c file
static int rte_eal_memdevice_init(void); int rte_eal_memory_init(void);
Fix checkpatch warnings and errors.
--- lib/librte_eal/bsdapp/eal/eal_memory.c | 47 +++++++++++-------------------- lib/librte_eal/common/eal_common_memory.c | 38 +++++++++++++++++++++++-- lib/librte_eal/common/eal_private.h | 20 +++++++++++-- lib/librte_eal/linuxapp/eal/eal_memory.c | 36 ++--------------------- 4 files changed, 72 insertions(+), 69 deletions(-)
lib/librte_eal/bsdapp/eal/eal_memory.c +16 -31
@@ -59,7 +59,7 @@ rte_mem_virt2phy(const void *virtaddr)return RTE_BAD_PHYS_ADDR ; } -static int +static inline int rte_eal_contigmem_init (void ) {struct rte_mem_config *mcfg;
@@ -131,7 +131,16 @@ rte_eal_contigmem_init(void)return 0 ; } -static int +/* +* Wrapper function to initialize contigmem. +*/ +int +rte_eal_hugepage_init (void ) +{ +return rte_eal_contigmem_init (); +} + +static inline int rte_eal_contigmem_attach (void ) {const struct hugepage_info *hpi;
@@ -192,35 +201,11 @@ error:return -1 ; } - -static int -rte_eal_memdevice_init (void ) -{ -struct rte_config *config; - -if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) -return 0 ; - - config =rte_eal_get_configuration (); - config->mem_config->nchannel = internal_config.force_nchannel; - config->mem_config->nrank = internal_config.force_nrank; - -return 0 ; -} - -/* init memory subsystem */ +/* +* Wrapper function to attach contigmem. +*/ int -rte_eal_memory_init (void ) +rte_eal_hugepage_attach (void ) { -RTE_LOG (INFO ,EAL ,"Setting up physically contiguous memory...\n" ); -const int retval =rte_eal_process_type () ==RTE_PROC_PRIMARY ? -rte_eal_contigmem_init () : -rte_eal_contigmem_attach (); -if (retval <0 ) -return -1 ; - -if (internal_config.no_shconf ==0 &&rte_eal_memdevice_init () <0 ) -return -1 ; - -return 0 ; +return rte_eal_contigmem_attach (); }
lib/librte_eal/common/eal_common_memory.c +36 -2
@@ -45,6 +45,7 @@#include <rte_log.h> #include "eal_private.h" +#include "eal_internal_cfg.h" /* * Return a pointer to a read-only table of struct rte_physmem_desc
@@ -69,7 +70,7 @@ rte_eal_get_physmem_size(void)/* get pointer to global configuration */ mcfg =rte_eal_get_configuration ()->mem_config; -for (i=0 ; i<RTE_MAX_MEMSEG ; i++) { +for (i =0 ; i <RTE_MAX_MEMSEG ; i++) {if (mcfg->memseg[i].addr ==NULL )break ;
@@ -89,7 +90,7 @@ rte_dump_physmem_layout(FILE *f)/* get pointer to global configuration */ mcfg =rte_eal_get_configuration ()->mem_config; -for (i=0 ; i<RTE_MAX_MEMSEG ; i++) { +for (i =0 ; i <RTE_MAX_MEMSEG ; i++) {if (mcfg->memseg[i].addr ==NULL )break ;
@@ -118,3 +119,36 @@ unsigned rte_memory_get_nrank(void) {return rte_eal_get_configuration ()->mem_config->nrank; } + +static int +rte_eal_memdevice_init (void ) +{ +struct rte_config *config; + +if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) +return 0 ; + + config =rte_eal_get_configuration (); + config->mem_config->nchannel = internal_config.force_nchannel; + config->mem_config->nrank = internal_config.force_nrank; + +return 0 ; +} + +/* init memory subsystem */ +int +rte_eal_memory_init (void ) +{ +RTE_LOG (INFO ,EAL ,"Setting up physically contiguous memory...\n" ); +const int retval =rte_eal_process_type () ==RTE_PROC_PRIMARY ? +rte_eal_hugepage_init () : +rte_eal_hugepage_attach (); + +if (retval <0 ) +return -1 ; + +if (internal_config.no_shconf ==0 &&rte_eal_memdevice_init () <0 ) +return -1 ; + +return 0 ; +}
lib/librte_eal/common/eal_private.h +18 -2
@@ -334,8 +334,6 @@ void set_tsc_freq(void);/** * This function sets TSC frequency from sysctl * for BSD and from clock for Linux. -* Is a wrapper function for BSD which will -* internally call set_tsc_freq_from_sysctl. * * This function is private to the EAL. */
@@ -348,4 +346,22 @@ int set_tsc_freq_from_clock(void);*/ void rte_set_tsc_hz (uint64_t tsc_hz); +/** +* This function prepares physical memory mapping +* i.e. hugepages on Linux and +* contigmem on BSD. +* +* This function is private to the EAL. +*/ +int rte_eal_hugepage_init (void ); + +/** +* This function creates memory mapping in secondary +* i.e. hugepages on Linux and +* contigmem on BSD. +* +* This function is private to the EAL. +*/ +int rte_eal_hugepage_attach (void ); +#endif /* _EAL_PRIVATE_H_ */
lib/librte_eal/linuxapp/eal/eal_memory.c +2 -34
@@ -1030,7 +1030,7 @@ calc_num_pages_per_socket(uint64_t * memory,* 6. unmap the first mapping * 7. fill memsegs in configuration with contiguous zones */ -static int +int rte_eal_hugepage_init (void ) {struct rte_mem_config *mcfg;
@@ -1368,7 +1368,7 @@ getFileSize(int fd)* configuration and finds the hugepages which form that segment, mapping them * in order to form a contiguous block in the virtual memory space */ -static int +int rte_eal_hugepage_attach (void ) {const struct rte_mem_config *mcfg =rte_eal_get_configuration ()->mem_config;
@@ -1529,35 +1529,3 @@ error:return -1 ; } -static int -rte_eal_memdevice_init (void ) -{ -struct rte_config *config; - -if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) -return 0 ; - - config =rte_eal_get_configuration (); - config->mem_config->nchannel = internal_config.force_nchannel; - config->mem_config->nrank = internal_config.force_nrank; - -return 0 ; -} - - -/* init memory subsystem */ -int -rte_eal_memory_init (void ) -{ -RTE_LOG (INFO ,EAL ,"Setting up memory...\n" ); -const int retval =rte_eal_process_type () ==RTE_PROC_PRIMARY ? -rte_eal_hugepage_init () : -rte_eal_hugepage_attach (); -if (retval <0 ) -return -1 ; - -if (internal_config.no_shconf ==0 &&rte_eal_memdevice_init () <0 ) -return -1 ; - -return 0 ; -}
Signature · 1 line
1.9.1
PATCH v8 6/6 Move common functions in eal_pci.c
In reply to a message not in the archiveChanges in v8
None
Changes in v7
Rebase to latest code.
Changes in v6
Split changes due to complexity. v6 includes moving rte_eal_pci_probe_one_driver function and its associated utility functions only.
Changes in v5
Rebase to latest code.
Removed RTE_EXEC_ENV_BSDAPP from earlier changes.
Changes in v4
Move common functions in eal_pci.c to librte_eal/common/ eal_common_pci.c file.
Following functions are moved to eal_common_pci.c file.
void *pci_map_resource(void *requested_addr, const int vfio_fd,
const char *devname, off_t offset, size_t size);
int pci_addr_comparison(struct rte_pci_addr *addr,
struct rte_pci_addr *addr2);
int rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr,
struct rte_pci_device *dev);Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in common function.
Fix checkpatch warnings and errors.
Changes in v3
N/A
Changes in v2
N/A
Changes in v1
N/A
--- lib/librte_eal/bsdapp/eal/eal_pci.c | 72 +++++--------------------------- lib/librte_eal/common/eal_common_pci.c | 72 ++++++++++++++++++++++++++++++++ lib/librte_eal/common/eal_private.h | 39 +++++++++++++----- lib/librte_eal/linuxapp/eal/eal_pci.c | 75 +--------------------------------- 4 files changed, 113 insertions(+), 145 deletions(-)
lib/librte_eal/bsdapp/eal/eal_pci.c +11 -61
@@ -111,7 +111,7 @@ static struct rte_tailq_elem rte_uio_tailq = {EAL_REGISTER_TAILQ (rte_uio_tailq)/* unbind kernel driver for this device */ -static int +int pci_unbind_kernel_driver(struct rte_pci_device *dev __rte_unused) { RTE_LOG(ERR, EAL, "RTE_PCI_DRV_FORCE_UNBIND flag is not implemented "
@@ -274,6 +274,13 @@ pci_uio_map_resource(struct rte_pci_device *dev)return (0 ); } +/* map the PCI resource of a PCI device in virtual memory */ +int +pci_map_device (struct rte_pci_device *dev) +{ +return pci_uio_map_resource (dev); +} +/* Scan one pci sysfs entry, and fill the devices list from it. */ static int pci_scan_one (int dev_pci_fd,struct pci_conf *conf)
@@ -426,68 +433,11 @@ error: }/* -* If vendor/device ID match, call the devinit() function of the -* driver. +* This function is a no-op in BSD. */ -int -rte_eal_pci_probe_one_driver (struct rte_pci_driver *dr,struct rte_pci_device *dev) +void +pci_config_space_set(struct rte_pci_device *dev __rte_unused) { -struct rte_pci_id *id_table; -int ret; - -for (id_table = dr->id_table ; id_table->vendor_id !=0 ; id_table++) { - -/* check if device's identifiers match the driver's ones */ -if (id_table->vendor_id != dev->id.vendor_id && - id_table->vendor_id !=PCI_ANY_ID ) -continue ; -if (id_table->device_id != dev->id.device_id && - id_table->device_id !=PCI_ANY_ID ) -continue ; -if (id_table->subsystem_vendor_id != dev->id.subsystem_vendor_id && - id_table->subsystem_vendor_id !=PCI_ANY_ID ) -continue ; -if (id_table->subsystem_device_id != dev->id.subsystem_device_id && - id_table->subsystem_device_id !=PCI_ANY_ID ) -continue ; - -struct rte_pci_addr *loc = &dev->addr; - -RTE_LOG (DEBUG ,EAL ,"PCI device " PCI_PRI_FMT " on NUMA socket %i\n" , - loc->domain, loc->bus, loc->devid, loc->function, - dev->numa_node); - -RTE_LOG (DEBUG ,EAL ," probe driver: %x:%x %s\n" , dev->id.vendor_id, - dev->id.device_id, dr->name); - -/* no initialization when blacklisted, return without error */ -if (dev->devargs !=NULL && - dev->devargs->type ==RTE_DEVTYPE_BLACKLISTED_PCI ) { - -RTE_LOG (DEBUG ,EAL ," Device is blacklisted, not initializing\n" ); -return 0 ; - } - -if (dr->drv_flags &RTE_PCI_DRV_NEED_MAPPING ) { -/* map resources for devices that use igb_uio */ - ret =pci_uio_map_resource (dev); -if (ret !=0 ) -return ret; - }else if (dr->drv_flags &RTE_PCI_DRV_FORCE_UNBIND && -rte_eal_process_type () ==RTE_PROC_PRIMARY ) { -/* unbind current driver */ -if (pci_unbind_kernel_driver (dev) <0 ) -return -1 ; - } - -/* reference driver structure */ - dev->driver = dr; - -/* call the driver devinit() function */ -return dr->devinit (dr, dev); - } -/* return positive value if driver is not found */ -return 1 ; }/* Init the PCI EAL subsystem */
lib/librte_eal/common/eal_common_pci.c +72 -0
78 lines not on this page · raw message
lib/librte_eal/common/eal_private.h +28 -11
@@ -156,17 +156,6 @@ struct rte_pci_driver;struct rte_pci_device ;/** -* Mmap memory for single PCI device -* -* This function is private to EAL. -* -* @return -* 0 on success, negative on error -*/ -int rte_eal_pci_probe_one_driver (struct rte_pci_driver *dr, -struct rte_pci_device *dev); - -/** * Munmap memory for single PCI device * * This function is private to EAL.
@@ -364,4 +353,32 @@ int rte_eal_hugepage_init(void);*/ int rte_eal_hugepage_attach (void ); +/** +* This function unbinds kernel driver for this device +* +* This function is private to the EAL. +*/ +int +pci_unbind_kernel_driver (struct rte_pci_device *dev); + +/** +* This function maps resources for devices +* that use igb_uio on Linux and it's a +* wrapper for pci_uio_map_resource on BSD. +* +* This function is private to the EAL. +*/ +int +pci_map_device (struct rte_pci_device *dev); + +/** +* This function sets PCIe config space for +* high performance. +* It's a NO-OP on BSD. +* +* This function is private to the EAL. +*/ +void +pci_config_space_set (struct rte_pci_device *dev); +#endif /* _EAL_PRIVATE_H_ */
lib/librte_eal/linuxapp/eal/eal_pci.c +2 -73
93 lines not on this page · raw message
Signature · 1 line
1.9.1
Neil Horman
Acked-byQuoted 51 lines · Ravi Kerur
Changes in v8 includes
Re-ordering source file compilation to fix ABI warning. Ran validate-abi against x86_64-native-linuxapp-gcc, x86_64-native-linuxapp-clang and x86_64-ivshmem-linuxapp-gcc environments.Testing:
Linux - Ubuntux86_6414.04
Compilation successful (x86_64-native-linuxapp-gcc and x86_64-native-linuxapp-clang).
"make test" results match baseline code. testpmd utility on I217/I218 Intel chipset.FreeBSD 10.0
x86_64
Compilation successful (x86_64-native-bsdapp-gcc and x86_64-native-bsdapp-clang).
Tested with helloworld, timer and cmdline examples.Ravi Kerur (6):
Move common functions ineal_thread.c
Move common functions ineal.c
Move common functions ineal_lcore.c
Move common functions ineal_timer.c
Move common functions ineal_memory.c
Move common functions ineal_pci.clib/librte_eal/bsdapp/eal/Makefile | 9 +- lib/librte_eal/bsdapp/eal/eal.c | 271 +++--------------------- lib/librte_eal/bsdapp/eal/eal_lcore.c | 72 ++----- lib/librte_eal/bsdapp/eal/eal_memory.c | 47 ++--- lib/librte_eal/bsdapp/eal/eal_pci.c | 72 +------ lib/librte_eal/bsdapp/eal/eal_thread.c | 152 -------------- lib/librte_eal/bsdapp/eal/eal_timer.c | 52 +---- lib/librte_eal/common/eal_common_app_usage.c | 63 ++++++ lib/librte_eal/common/eal_common_lcore.c | 107 ++++++++++ lib/librte_eal/common/eal_common_mem_cfg.c | 224 ++++++++++++++++++++ lib/librte_eal/common/eal_common_memory.c | 38 +++- lib/librte_eal/common/eal_common_pci.c | 72 +++++++ lib/librte_eal/common/eal_common_proc_type.c | 58 ++++++ lib/librte_eal/common/eal_common_sysfs.c | 148 ++++++++++++++ lib/librte_eal/common/eal_common_thread.c | 147 ++++++++++++- lib/librte_eal/common/eal_common_timer.c | 102 +++++++++ lib/librte_eal/common/eal_hugepages.h | 1 + lib/librte_eal/common/eal_private.h | 171 +++++++++++++++- lib/librte_eal/common/include/rte_eal.h | 4 + lib/librte_eal/linuxapp/eal/Makefile | 10 +- lib/librte_eal/linuxapp/eal/eal.c | 296 ++++----------------------- lib/librte_eal/linuxapp/eal/eal_lcore.c | 66 +----- lib/librte_eal/linuxapp/eal/eal_memory.c | 36 +--- lib/librte_eal/linuxapp/eal/eal_pci.c | 75 +------ lib/librte_eal/linuxapp/eal/eal_thread.c | 152 +-------------
Quoted 13 lines
lib/librte_eal/linuxapp/eal/eal_timer.c | 55 +---- 26 files changed, 1277 insertions(+), 1223 deletions(-) create mode 100644 lib/librte_eal/common/eal_common_app_usage.c create mode 100644 lib/librte_eal/common/eal_common_lcore.c create mode 100644 lib/librte_eal/common/eal_common_mem_cfg.c create mode 100644 lib/librte_eal/common/eal_common_proc_type.c create mode 100644 lib/librte_eal/common/eal_common_sysfs.c create mode 100644 lib/librte_eal/common/eal_common_timer.cSignature · 1 line
1.9.1
Series
Re: [PATCH v8 2/6] Move common functions in eal.c
In reply to Ravi KerurQuoted 56 lines · rkerur at gmail.com (Ravi Kerur)
Changes in v8
Fix ABI warnings by reordering compilation ofeal_common_sysfs.ceal_common_mem_cfg.ceal_common_proc_type.ceal_common_app_usage.cChanges in v7
Fix compilation errors in clang.Changes in v6
Spliteal_common_system.candeal_common_runtime.cintoeal_common_sysfs.ceal_common_mem_cfg.ceal_common_proc_type.ceal_common_app_usage.c
based on functionality.Changes in v5
Rebase to latest code.Changes in v4
Removeeal_externs.hfile, instead use _get_ and _set_ APIS to access those variables.
Spliteal_common.cintoeal_common_system.cand
andeal_common_runtime.crte_ealprefix functions are moved to _runtime_ and eal prefix functions are moved to _system_ files respectively.Changes in v3
Changed subject to be more explicit on file name inclusion.Changes in v2
In functionrte_eal_config_createremove #ifdef _BSDAPP_ and initializemem_cfg_addrunconditionally.Changes in v1
Move common functions ineal.ctolibrte_eal/common/eal_common.c.Following functions are moved to
eal_common.cfile.struct
rte_config*rte_eal_get_configuration(void);
inteal_parse_sysfs_value(const char *filename, unsigned long *val); static voidrte_eal_config_create(void);
enumrte_proc_type_teal_proc_type_detect(void);
voidrte_eal_config_init(void);rte_usage_hook_trte_set_application_usage_hook(rte_usage_hook_t usage_func);
inlinesize_teal_get_hugepage_mem_size(void);
voideal_check_mem_on_local_socket(void);
intsync_func(__attribute__((unused)) void *arg);
inline voidrte_eal_mcfg_complete(void);
intrte_eal_has_hugepages(void);
enumrte_lcore_role_trte_eal_lcore_role(unsigned lcore_id); enumrte_proc_type_trte_eal_process_type(void);
Quoted 4 lines
Makefilechanges to reflect new files added.
Fix checkpatch warnings and errors.Signed-off-by Ravi Kerur <rkerur at gmail.com>
Hi Ravi,
This patch is sitting on patchwork since 2015, I am updating it as rejected, if it is still relevant please let us know.
Sorry for any inconvenience caused.
Re: [PATCH v8 2/6] Move common functions in eal.c
Quoted 60 lines · Ferruh Yigit
Quoted 59 lines · rkerur at gmail.com (Ravi Kerur)
Changes in v8
Fix ABI warnings by reordering compilation ofeal_common_sysfs.ceal_common_mem_cfg.ceal_common_proc_type.ceal_common_app_usage.cChanges in v7
Fix compilation errors in clang.Changes in v6
Spliteal_common_system.candeal_common_runtime.cintoeal_common_sysfs.ceal_common_mem_cfg.ceal_common_proc_type.ceal_common_app_usage.c
based on functionality.Changes in v5
Rebase to latest code.Changes in v4
Removeeal_externs.hfile, instead use _get_ and _set_ APIS to access those variables.
Spliteal_common.cintoeal_common_system.cand
andeal_common_runtime.crte_ealprefix functions are moved to _runtime_ and eal prefix functions are moved to _system_ files respectively.Changes in v3
Changed subject to be more explicit on file name inclusion.Changes in v2
In functionrte_eal_config_createremove #ifdef _BSDAPP_ and initializemem_cfg_addrunconditionally.Changes in v1
Move common functions ineal.ctolibrte_eal/common/eal_common.c.Following functions are moved to
eal_common.cfile.struct
rte_config*rte_eal_get_configuration(void);
inteal_parse_sysfs_value(const char *filename, unsigned long *val); static voidrte_eal_config_create(void);
enumrte_proc_type_teal_proc_type_detect(void);
voidrte_eal_config_init(void);rte_usage_hook_trte_set_application_usage_hook(rte_usage_hook_t usage_func);
inlinesize_teal_get_hugepage_mem_size(void);
voideal_check_mem_on_local_socket(void);
intsync_func(__attribute__((unused)) void *arg);
inline voidrte_eal_mcfg_complete(void);
intrte_eal_has_hugepages(void);
enumrte_lcore_role_trte_eal_lcore_role(unsigned lcore_id); enumrte_proc_type_trte_eal_process_type(void);
Makefilechanges to reflect new files added.
Fix checkpatch warnings and errors.
Quoted 9 lines
Quoted 1 line
Signed-off-by Ravi Kerur <rkerur at gmail.com>Hi Ravi,
This patch is sitting on patchwork since 2015, I am updating it as rejected, if it is still relevant please let us know.
Sorry for any inconvenience caused.
for record, it is: https://patches.dpdk.org/patch/4487/
Re: [PATCH v8 6/6] Move common functions in eal_pci.c
In reply to Ravi KerurQuoted 35 lines · rkerur at gmail.com (Ravi Kerur)
Changes in v8
NoneChanges in v7
Rebase to latest code.Changes in v6
Split changes due to complexity. v6 includes movingrte_eal_pci_probe_one_driverfunction and its associated utility functions only.Changes in v5
Rebase to latest code.
RemovedRTE_EXEC_ENV_BSDAPPfrom earlier changes.Changes in v4
Move common functions ineal_pci.cto librte_eal/common/eal_common_pci.cfile.Following functions are moved to
eal_common_pci.cfile.void *pci_map_resource(void
*requested_addr, const intvfio_fd,const char *devname, off_t offset, size_t size); int pci_addr_comparison(struct rte_pci_addr *addr, struct rte_pci_addr *addr2); int rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *dev);Use
RTE_EXEC_ENV_BSDAPPto differentiate minor differences in common function.
Fix checkpatch warnings and errors.Changes in v3
N/A
Quoted 7 lines
Changes in v2
N/AChanges in v1
N/ASigned-off-by Ravi Kerur <rkerur at gmail.com>
Same for this one, updated as rejected because of timeout, like other if it is still relevant please let us know.
Sorry for any inconvenience caused.
Mentioned patch: https://patches.dpdk.org/patch/4491/