[PATCH 019/227] lpm: use NUMA node terminology
Chengwen Feng
chengwen.feng at linux.dev
Tue Nov 3 15:49:37 CET 2026
From: Chengwen Feng <fengchengwen at huawei.com>
Rename socket_id parameters, internal variables and comments to
the NUMA node terminology, and switch internal calls to
rte_zmalloc_numa(), rte_numa_id() and RTE_NUMA_ID_ANY.
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
lib/lpm/rte_lpm.c | 16 ++++++++--------
lib/lpm/rte_lpm.h | 6 +++---
lib/lpm/rte_lpm6.c | 10 +++++-----
lib/lpm/rte_lpm6.h | 6 +++---
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
index 0d1afe0ca1..8bee4be101 100644
--- a/lib/lpm/rte_lpm.c
+++ b/lib/lpm/rte_lpm.c
@@ -149,7 +149,7 @@ rte_lpm_find_existing(const char *name)
*/
RTE_EXPORT_SYMBOL(rte_lpm_create)
struct rte_lpm *
-rte_lpm_create(const char *name, int socket_id,
+rte_lpm_create(const char *name, int numa_id,
const struct rte_lpm_config *config)
{
char mem_name[RTE_LPM_NAMESIZE + sizeof("LPM_")];
@@ -164,7 +164,7 @@ rte_lpm_create(const char *name, int socket_id,
RTE_BUILD_BUG_ON(sizeof(struct rte_lpm_tbl_entry) != 4);
/* Check user arguments. */
- if ((name == NULL) || (socket_id < -1) || (config->max_rules == 0)
+ if ((name == NULL) || (numa_id < -1) || (config->max_rules == 0)
|| config->number_tbl8s > RTE_LPM_MAX_TBL8_NUM_GROUPS) {
rte_errno = EINVAL;
return NULL;
@@ -206,8 +206,8 @@ rte_lpm_create(const char *name, int socket_id,
}
/* Allocate memory to store the LPM data structures. */
- i_lpm = rte_zmalloc_socket(mem_name, mem_size,
- RTE_CACHE_LINE_SIZE, socket_id);
+ i_lpm = rte_zmalloc_numa(mem_name, mem_size,
+ RTE_CACHE_LINE_SIZE, numa_id);
if (i_lpm == NULL) {
LPM_LOG(ERR, "LPM memory allocation failed");
rte_free(te);
@@ -215,8 +215,8 @@ rte_lpm_create(const char *name, int socket_id,
goto exit;
}
- i_lpm->rules_tbl = rte_zmalloc_socket(NULL,
- (size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id);
+ i_lpm->rules_tbl = rte_zmalloc_numa(NULL,
+ (size_t)rules_size, RTE_CACHE_LINE_SIZE, numa_id);
if (i_lpm->rules_tbl == NULL) {
LPM_LOG(ERR, "LPM rules_tbl memory allocation failed");
@@ -227,8 +227,8 @@ rte_lpm_create(const char *name, int socket_id,
goto exit;
}
- i_lpm->lpm.tbl8 = rte_zmalloc_socket(NULL,
- (size_t)tbl8s_size, RTE_CACHE_LINE_SIZE, socket_id);
+ i_lpm->lpm.tbl8 = rte_zmalloc_numa(NULL,
+ (size_t)tbl8s_size, RTE_CACHE_LINE_SIZE, numa_id);
if (i_lpm->lpm.tbl8 == NULL) {
LPM_LOG(ERR, "LPM tbl8 memory allocation failed");
diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h
index bcd3da9706..720e944d77 100644
--- a/lib/lpm/rte_lpm.h
+++ b/lib/lpm/rte_lpm.h
@@ -167,8 +167,8 @@ rte_lpm_free(struct rte_lpm *lpm);
*
* @param name
* LPM object name
- * @param socket_id
- * NUMA socket ID for LPM table memory allocation
+ * @param numa_id
+ * NUMA node ID for LPM table memory allocation
* @param config
* Structure containing the configuration
* @return
@@ -183,7 +183,7 @@ rte_lpm_free(struct rte_lpm *lpm);
* - ENAMETOOLONG - LPM object name greater than RTE_LPM_NAMESIZE
*/
struct rte_lpm *
-rte_lpm_create(const char *name, int socket_id,
+rte_lpm_create(const char *name, int numa_id,
const struct rte_lpm_config *config)
__rte_malloc __rte_dealloc(rte_lpm_free, 1);
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 5eb2f3761d..413ac4d464 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -210,7 +210,7 @@ rebuild_lpm(struct rte_lpm6 *lpm)
*/
RTE_EXPORT_SYMBOL(rte_lpm6_create)
struct rte_lpm6 *
-rte_lpm6_create(const char *name, int socket_id,
+rte_lpm6_create(const char *name, int numa_id,
const struct rte_lpm6_config *config)
{
char mem_name[RTE_LPM6_NAMESIZE];
@@ -229,7 +229,7 @@ rte_lpm6_create(const char *name, int socket_id,
sizeof(uint32_t) != 0);
/* Check user arguments. */
- if ((name == NULL) || (socket_id < -1) || (config == NULL) ||
+ if ((name == NULL) || (numa_id < -1) || (config == NULL) ||
(config->max_rules == 0) ||
config->number_tbl8s > RTE_LPM6_TBL8_MAX_NUM_GROUPS) {
rte_errno = EINVAL;
@@ -246,7 +246,7 @@ rte_lpm6_create(const char *name, int socket_id,
.hash_func_init_val = 0,
.name = mem_name,
.reserved = 0,
- .numa_id = socket_id,
+ .numa_id = numa_id,
.extra_flag = 0
};
@@ -308,8 +308,8 @@ rte_lpm6_create(const char *name, int socket_id,
}
/* Allocate memory to store the LPM data structures. */
- lpm = rte_zmalloc_socket(mem_name, (size_t)mem_size,
- RTE_CACHE_LINE_SIZE, socket_id);
+ lpm = rte_zmalloc_numa(mem_name, (size_t)mem_size,
+ RTE_CACHE_LINE_SIZE, numa_id);
if (lpm == NULL) {
LPM_LOG(ERR, "LPM memory allocation failed");
diff --git a/lib/lpm/rte_lpm6.h b/lib/lpm/rte_lpm6.h
index c5928b9d88..91a385b7c1 100644
--- a/lib/lpm/rte_lpm6.h
+++ b/lib/lpm/rte_lpm6.h
@@ -45,8 +45,8 @@ rte_lpm6_free(struct rte_lpm6 *lpm);
*
* @param name
* LPM object name
- * @param socket_id
- * NUMA socket ID for LPM table memory allocation
+ * @param numa_id
+ * NUMA node ID for LPM table memory allocation
* @param config
* Structure containing the configuration
* @return
@@ -60,7 +60,7 @@ rte_lpm6_free(struct rte_lpm6 *lpm);
* - ENOMEM - no appropriate memory area found in which to create memzone
*/
struct rte_lpm6 *
-rte_lpm6_create(const char *name, int socket_id,
+rte_lpm6_create(const char *name, int numa_id,
const struct rte_lpm6_config *config)
__rte_malloc __rte_dealloc(rte_lpm6_free, 1);
--
2.55.0
More information about the dev
mailing list