[RFC PATCH 21/44] eal: remove rte_config structure
Bruce Richardson
bruce.richardson at intel.com
Wed Apr 29 18:58:13 CEST 2026
The rte_config structure is no longer used, so remove it, and the
function returning a pointer to it.
In the process, as a general cleanup, remove references to rte_config in
error or info messages where it no longer makes sense to do so.
For example, messages around creating or attaching to the shared memory
config were referencing "rte_config", even though rte_config itself
hasn't been in shared memory.
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
lib/eal/common/eal_common_config.c | 10 ----------
lib/eal/common/eal_private.h | 15 ---------------
lib/eal/freebsd/eal.c | 18 +++++++++---------
lib/eal/include/rte_memzone.h | 10 +++++-----
lib/eal/include/rte_tailq.h | 2 +-
lib/eal/linux/eal.c | 18 +++++++++---------
6 files changed, 24 insertions(+), 49 deletions(-)
diff --git a/lib/eal/common/eal_common_config.c b/lib/eal/common/eal_common_config.c
index ebb7c222d9..35654cc71f 100644
--- a/lib/eal/common/eal_common_config.c
+++ b/lib/eal/common/eal_common_config.c
@@ -20,9 +20,6 @@ static struct rte_mem_config early_mem_config = {
.memory_hotplug_lock = RTE_RWLOCK_INITIALIZER,
};
-/* Address of global and public configuration */
-static struct rte_config rte_config;
-
/* platform-specific runtime dir */
static char runtime_dir[UNIX_PATH_MAX];
@@ -56,13 +53,6 @@ eal_set_runtime_dir(const char *run_dir)
return 0;
}
-/* Return a pointer to the configuration structure */
-struct rte_config *
-rte_eal_get_configuration(void)
-{
- return &rte_config;
-}
-
/* Return a pointer to the memory config structure */
struct rte_mem_config *
eal_get_mcfg(void)
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 2bb5c6c402..c5efdb070a 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -17,21 +17,6 @@
#include "eal_internal_cfg.h"
-/**
- * The global RTE configuration structure.
- */
-struct rte_config {
- int _unused; /**< dummy field to prevent empty struct */
-};
-
-/**
- * Get the global configuration structure.
- *
- * @return
- * A pointer to the global configuration structure.
- */
-struct rte_config *rte_eal_get_configuration(void);
-
/**
* Put the argument list into a structure.
*
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 98da77acc1..0fafb2c295 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -145,7 +145,7 @@ rte_eal_config_create(void)
rte_mem_cfg_addr = eal_get_virtual_area(rte_mem_cfg_addr,
&cfg_len_aligned, page_sz, 0, 0);
if (rte_mem_cfg_addr == NULL) {
- EAL_LOG(ERR, "Cannot mmap memory for rte_config");
+ EAL_LOG(ERR, "Cannot mmap shared memory config");
close(mem_cfg_fd);
mem_cfg_fd = -1;
return -1;
@@ -156,7 +156,7 @@ rte_eal_config_create(void)
cfg_len_aligned, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED, mem_cfg_fd, 0);
if (mapped_mem_cfg_addr == MAP_FAILED) {
- EAL_LOG(ERR, "Cannot remap memory for rte_config: %s", strerror(errno));
+ EAL_LOG(ERR, "Cannot remap shared memory config: %s", strerror(errno));
munmap(rte_mem_cfg_addr, cfg_len);
close(mem_cfg_fd);
mem_cfg_fd = -1;
@@ -201,7 +201,7 @@ rte_eal_config_attach(void)
if (rte_mem_cfg_addr == MAP_FAILED) {
close(mem_cfg_fd);
mem_cfg_fd = -1;
- EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
+ EAL_LOG(ERR, "Cannot mmap shared memory config! error %i (%s)",
errno, strerror(errno));
return -1;
}
@@ -239,12 +239,12 @@ rte_eal_config_reattach(void)
if (mem_config == MAP_FAILED || mem_config != rte_mem_cfg_addr) {
if (mem_config != MAP_FAILED) {
- EAL_LOG(ERR, "Cannot mmap memory for rte_config at [%p], got [%p] - please use '--base-virtaddr' option",
+ EAL_LOG(ERR, "Cannot mmap shared memory config at [%p], got [%p] - please use '--base-virtaddr' option",
rte_mem_cfg_addr, mem_config);
munmap(mem_config, sizeof(struct rte_mem_config));
return -1;
}
- EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
+ EAL_LOG(ERR, "Cannot mmap shared memory config! error %i (%s)",
errno, strerror(errno));
return -1;
}
@@ -280,9 +280,9 @@ eal_proc_type_detect(void)
return ptype;
}
-/* Sets up rte_config structure with the pointer to shared memory config.*/
+/* Attaches to or creates the shared memory config for this process. */
static int
-rte_config_init(void)
+eal_mem_config_init(void)
{
struct eal_runtime_state *runtime_state = eal_get_runtime_state();
const struct eal_user_cfg *user_cfg = eal_get_user_configuration();
@@ -485,7 +485,7 @@ rte_eal_init(int argc, char **argv)
goto err_out;
}
- if (rte_config_init() < 0) {
+ if (eal_mem_config_init() < 0) {
rte_eal_init_alert("Cannot init config");
goto err_out;
}
@@ -564,7 +564,7 @@ rte_eal_init(int argc, char **argv)
rte_eal_iova_mode() == RTE_IOVA_PA ? "PA" : "VA");
if (!user_cfg->no_hugetlbfs) {
- /* rte_config isn't initialized yet */
+ /* shared mem config not yet attached */
ret = user_cfg->process_type == RTE_PROC_PRIMARY ?
eal_hugepage_info_init() :
eal_hugepage_info_read();
diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h
index 5a0e1b8a15..7f94b6ff71 100644
--- a/lib/eal/include/rte_memzone.h
+++ b/lib/eal/include/rte_memzone.h
@@ -13,8 +13,8 @@
* portions of physical memory. These zones are identified by a name.
*
* The memzone descriptors are shared by all partitions and are
- * located in a known place of physical memory. This zone is accessed
- * using rte_eal_get_configuration(). The lookup (by name) of a
+ * located in a known place of physical memory accessible via the
+ * shared memory config. The lookup (by name) of a
* memory zone can be done in any partition and returns the same
* physical address.
*
@@ -137,7 +137,7 @@ size_t rte_memzone_max_get(void);
* A pointer to a correctly-filled read-only memzone descriptor, or NULL
* on error.
* On error case, rte_errno will be set appropriately:
- * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ * - E_RTE_NO_CONFIG - function could not get pointer to shared memory config
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
* - ENOMEM - no appropriate memory area found in which to create memzone
@@ -202,7 +202,7 @@ const struct rte_memzone *rte_memzone_reserve(const char *name,
* A pointer to a correctly-filled read-only memzone descriptor, or NULL
* on error.
* On error case, rte_errno will be set appropriately:
- * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ * - E_RTE_NO_CONFIG - function could not get pointer to shared memory config
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
* - ENOMEM - no appropriate memory area found in which to create memzone
@@ -273,7 +273,7 @@ const struct rte_memzone *rte_memzone_reserve_aligned(const char *name,
* A pointer to a correctly-filled read-only memzone descriptor, or NULL
* on error.
* On error case, rte_errno will be set appropriately:
- * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
+ * - E_RTE_NO_CONFIG - function could not get pointer to shared memory config
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
* - ENOMEM - no appropriate memory area found in which to create memzone
diff --git a/lib/eal/include/rte_tailq.h b/lib/eal/include/rte_tailq.h
index e7caed6812..dced107368 100644
--- a/lib/eal/include/rte_tailq.h
+++ b/lib/eal/include/rte_tailq.h
@@ -29,7 +29,7 @@ RTE_TAILQ_HEAD(rte_tailq_entry_head, rte_tailq_entry);
/**
* The structure defining a tailq header entry for storing
- * in the rte_config structure in shared memory. Each tailq
+ * in shared memory. Each tailq
* is identified by name.
* Any library storing a set of objects e.g. rings, mempools, hash-tables,
* is recommended to use an entry here, so as to make it easy for
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 04affc6a28..8d3559aa37 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -225,7 +225,7 @@ rte_eal_config_create(void)
rte_mem_cfg_addr = eal_get_virtual_area(rte_mem_cfg_addr,
&cfg_len_aligned, page_sz, 0, 0);
if (rte_mem_cfg_addr == NULL) {
- EAL_LOG(ERR, "Cannot mmap memory for rte_config");
+ EAL_LOG(ERR, "Cannot mmap shared memory config");
close(mem_cfg_fd);
mem_cfg_fd = -1;
return -1;
@@ -239,7 +239,7 @@ rte_eal_config_create(void)
munmap(rte_mem_cfg_addr, cfg_len);
close(mem_cfg_fd);
mem_cfg_fd = -1;
- EAL_LOG(ERR, "Cannot remap memory for rte_config");
+ EAL_LOG(ERR, "Cannot remap shared memory config");
return -1;
}
@@ -283,7 +283,7 @@ rte_eal_config_attach(void)
if (mem_config == MAP_FAILED) {
close(mem_cfg_fd);
mem_cfg_fd = -1;
- EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
+ EAL_LOG(ERR, "Cannot mmap shared memory config! error %i (%s)",
errno, strerror(errno));
return -1;
}
@@ -323,12 +323,12 @@ rte_eal_config_reattach(void)
if (mem_config == MAP_FAILED || mem_config != rte_mem_cfg_addr) {
if (mem_config != MAP_FAILED) {
/* errno is stale, don't use */
- EAL_LOG(ERR, "Cannot mmap memory for rte_config at [%p], got [%p] - please use '--base-virtaddr' option",
+ EAL_LOG(ERR, "Cannot mmap shared memory config at [%p], got [%p] - please use '--base-virtaddr' option",
rte_mem_cfg_addr, mem_config);
munmap(mem_config, sizeof(struct rte_mem_config));
return -1;
}
- EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
+ EAL_LOG(ERR, "Cannot mmap shared memory config! error %i (%s)",
errno, strerror(errno));
return -1;
}
@@ -364,9 +364,9 @@ eal_proc_type_detect(void)
return ptype;
}
-/* Sets up rte_config structure with the pointer to shared memory config.*/
+/* Attaches to or creates the shared memory config for this process. */
static int
-rte_config_init(void)
+eal_mem_config_init(void)
{
struct eal_runtime_state *runtime_state = eal_get_runtime_state();
const struct eal_user_cfg *user_cfg = eal_get_user_configuration();
@@ -640,7 +640,7 @@ rte_eal_init(int argc, char **argv)
goto err_out;
}
- if (rte_config_init() < 0) {
+ if (eal_mem_config_init() < 0) {
rte_eal_init_alert("Cannot init config");
goto err_out;
}
@@ -728,7 +728,7 @@ rte_eal_init(int argc, char **argv)
rte_eal_iova_mode() == RTE_IOVA_PA ? "PA" : "VA");
if (!user_cfg->no_hugetlbfs) {
- /* rte_config isn't initialized yet */
+ /* shared mem config not yet attached */
ret = user_cfg->process_type == RTE_PROC_PRIMARY ?
eal_hugepage_info_init() :
eal_hugepage_info_read();
--
2.51.0
More information about the dev
mailing list