From 65661351caa8f54740cdf4b67f3b7e888b8fca34 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 25 Oct 2019 15:56:00 +0200 Subject: [PATCH] eal: make lcore config private The internal structure of lcore_config does not need to be part of visible API/ABI. Make it private to EAL. Rearrange the structure so it takes less memory (and cache footprint). Since we change the ABI, bump the library version. Signed-off-by: Stephen Hemminger Signed-off-by: David Marchand Acked-by: Thomas Monjalon Acked-by: Anatoly Burakov --- doc/guides/rel_notes/deprecation.rst | 4 ---- doc/guides/rel_notes/release_19_11.rst | 4 +++- lib/librte_eal/common/eal_common_launch.c | 2 ++ lib/librte_eal/common/eal_private.h | 25 +++++++++++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 24 ---------------------- lib/librte_eal/common/rte_service.c | 2 ++ lib/librte_eal/freebsd/eal/Makefile | 2 +- lib/librte_eal/linux/eal/Makefile | 2 +- lib/librte_eal/meson.build | 2 +- lib/librte_eal/rte_eal_version.map | 1 - lib/librte_eal/windows/eal/eal_thread.c | 1 + 11 files changed, 36 insertions(+), 33 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 237813b647..e4a33e0a4a 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -23,10 +23,6 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. -* eal: The ``lcore_config`` struct and global symbol will be made private to - remove it from the externally visible ABI and allow it to be updated in the - future. - * eal: both declaring and identifying devices will be streamlined in v18.11. New functions will appear to query a specific port from buses, classes of device and device drivers. Device declaration will be made coherent with the diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index 2064ed7a2a..d9008661a3 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -283,6 +283,8 @@ API Changes Also, make sure to start the actual text at the margin. ========================================================= +* eal: made the ``lcore_config`` struct and global symbol private. + * The network structure ``esp_tail`` has been prefixed by ``rte_``. * The network definitions of PPPoE ethertypes have been prefixed by ``RTE_``. @@ -372,7 +374,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_compressdev.so.1 librte_cryptodev.so.8 librte_distributor.so.1 - librte_eal.so.11 + + librte_eal.so.12 librte_efd.so.1 + librte_ethdev.so.13 + librte_eventdev.so.8 diff --git a/lib/librte_eal/common/eal_common_launch.c b/lib/librte_eal/common/eal_common_launch.c index fe0ba3f0d6..cf52d717f6 100644 --- a/lib/librte_eal/common/eal_common_launch.c +++ b/lib/librte_eal/common/eal_common_launch.c @@ -15,6 +15,8 @@ #include #include +#include "eal_private.h" + /* * Wait until a lcore finished its job. */ diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 31eae22787..a8fac68aff 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -10,6 +10,31 @@ #include #include +#include + +/** + * Structure storing internal configuration (per-lcore) + */ +struct lcore_config { + 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 int socket_id; /**< physical socket id for this lcore */ + unsigned int core_id; /**< core number on socket for this lcore */ + int core_index; /**< relative index, starting from 0 */ + uint8_t core_role; /**< role of core eg: OFF, RTE, SERVICE */ + uint8_t detected; /**< true if lcore was detected */ + + rte_cpuset_t cpuset; /**< cpu set which the lcore affinity to */ +}; + +extern struct lcore_config lcore_config[RTE_MAX_LCORE]; /** * Initialize the memzone subsystem (private to eal). diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index 63ad4af139..b4ee2c3895 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -22,30 +22,6 @@ extern "C" { #define LCORE_ID_ANY UINT32_MAX /**< 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 */ - int core_index; /**< relative index, starting from 0 */ - rte_cpuset_t cpuset; /**< cpu set which the lcore affinity to */ - uint8_t core_role; /**< role of core eg: OFF, RTE, SERVICE */ -}; - -/** - * Internal configuration (per-lcore) - */ -extern struct lcore_config lcore_config[RTE_MAX_LCORE]; - RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */ RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */ diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index beb9691b23..79235c03f8 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -21,6 +21,8 @@ #include #include +#include "eal_private.h" + #define RTE_SERVICE_NUM_MAX 64 #define SERVICE_F_REGISTERED (1 << 0) diff --git a/lib/librte_eal/freebsd/eal/Makefile b/lib/librte_eal/freebsd/eal/Makefile index 89131ea892..f530f568b6 100644 --- a/lib/librte_eal/freebsd/eal/Makefile +++ b/lib/librte_eal/freebsd/eal/Makefile @@ -22,7 +22,7 @@ LDLIBS += -lrte_kvargs EXPORT_MAP := ../../rte_eal_version.map -LIBABIVER := 11 +LIBABIVER := 12 # specific to freebsd exec-env SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) := eal.c diff --git a/lib/librte_eal/linux/eal/Makefile b/lib/librte_eal/linux/eal/Makefile index 0f5725e64a..7628e57119 100644 --- a/lib/librte_eal/linux/eal/Makefile +++ b/lib/librte_eal/linux/eal/Makefile @@ -10,7 +10,7 @@ ARCH_DIR ?= $(RTE_ARCH) EXPORT_MAP := ../../rte_eal_version.map VPATH += $(RTE_SDK)/lib/librte_eal/common/arch/$(ARCH_DIR) -LIBABIVER := 11 +LIBABIVER := 12 VPATH += $(RTE_SDK)/lib/librte_eal/common diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build index 2751023a91..0b6e65d493 100644 --- a/lib/librte_eal/meson.build +++ b/lib/librte_eal/meson.build @@ -12,7 +12,7 @@ subdir('common') # defines common_sources, common_objs, etc. dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1) subdir(exec_env + '/eal') -version = 11 # the version of the EAL API +version = 12 # the version of the EAL API allow_experimental_apis = true deps += 'kvargs' if dpdk_conf.has('RTE_USE_LIBBSD') diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 7cbf82d37b..aeedf39776 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -4,7 +4,6 @@ DPDK_2.0 { __rte_panic; eal_parse_sysfs_value; eal_timer_source; - lcore_config; per_lcore__lcore_id; per_lcore__rte_errno; rte_calloc; diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c index 906502f909..0591d4c7fb 100644 --- a/lib/librte_eal/windows/eal/eal_thread.c +++ b/lib/librte_eal/windows/eal/eal_thread.c @@ -12,6 +12,7 @@ #include #include +#include "eal_private.h" RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY; -- 2.20.1