[PATCH 203/227] examples/l3fwd: use NUMA node terminology

Chengwen Feng chengwen.feng at linux.dev
Tue Nov 3 15:52:41 CET 2026


From: Chengwen Feng <fengchengwen at huawei.com>

Rename socket_id parameters, local variables and comments to the
NUMA node terminology, and switch calls to the NUMA-named APIs.

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
 examples/l3fwd/l3fwd_acl.c | 22 +++++++++++-----------
 examples/l3fwd/l3fwd_em.c  |  4 ++--
 examples/l3fwd/main.c      |  8 ++++----
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/examples/l3fwd/l3fwd_acl.c b/examples/l3fwd/l3fwd_acl.c
index 4ee3411d2a..54aa3dc9ba 100644
--- a/examples/l3fwd/l3fwd_acl.c
+++ b/examples/l3fwd/l3fwd_acl.c
@@ -692,7 +692,7 @@ app_acl_init(struct rte_acl_rule *route_base,
 			socketid);
 
 	acl_param.name = name;
-	acl_param.socket_id = socketid;
+	acl_param.numa_id = socketid;
 	acl_param.rule_size = RTE_ACL_RULE_SZ(dim);
 	acl_param.max_rule_num = MAX_ACL_RULE_NUM;
 
@@ -935,7 +935,7 @@ dump_ipv6_rules(struct acl6_rule *rule, int num, int extra)
 
 /* Function to setup acl. */
 void
-setup_acl(const int socket_id)
+setup_acl(const int numa_id)
 {
 	if (check_acl_config() != 0)
 		rte_exit(EXIT_FAILURE, "Failed to get valid ACL options\n");
@@ -955,24 +955,24 @@ setup_acl(const int socket_id)
 	dump_ipv6_rules((struct acl6_rule *)acl_base_ipv6, acl_num_ipv6, 1);
 
 	/* Check sockets a context should be created on */
-	if (socket_id >= NB_SOCKETS) {
+	if (numa_id >= NB_SOCKETS) {
 		acl_log("Socket %d is out "
 			"of range %d\n",
-			socket_id, NB_SOCKETS);
+			numa_id, NB_SOCKETS);
 		acl_free_routes();
 		return;
 	}
 
-	rte_acl_free(acl_config.acx_ipv4[socket_id]);
-	rte_acl_free(acl_config.acx_ipv6[socket_id]);
+	rte_acl_free(acl_config.acx_ipv4[numa_id]);
+	rte_acl_free(acl_config.acx_ipv6[numa_id]);
 
-	acl_config.acx_ipv4[socket_id] = app_acl_init(route_base_ipv4,
+	acl_config.acx_ipv4[numa_id] = app_acl_init(route_base_ipv4,
 		acl_base_ipv4, route_num_ipv4, acl_num_ipv4,
-		0, socket_id);
+		0, numa_id);
 
-	acl_config.acx_ipv6[socket_id] = app_acl_init(route_base_ipv6,
+	acl_config.acx_ipv6[numa_id] = app_acl_init(route_base_ipv6,
 		acl_base_ipv6, route_num_ipv6, acl_num_ipv6,
-		1, socket_id);
+		1, numa_id);
 
 #ifdef L3FWDACL_DEBUG
 	acl_config.rule_ipv4 = (struct acl4_rule *)acl_base_ipv4;
@@ -1091,7 +1091,7 @@ acl_main_loop(__rte_unused void *dummy)
 	prev_tsc = 0;
 	lcore_id = rte_lcore_id();
 	qconf = &lcore_conf[lcore_id];
-	socketid = rte_lcore_to_socket_id(lcore_id);
+	socketid = rte_lcore_to_numa_id(lcore_id);
 
 	if (qconf->n_rx_queue == 0) {
 		RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", lcore_id);
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index d8748a0edd..730ea29d96 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -991,7 +991,7 @@ setup_hash(const int socketid)
 	/* create ipv4 hash */
 	snprintf(s, sizeof(s), "ipv4_l3fwd_hash_%d", socketid);
 	ipv4_l3fwd_hash_params.name = s;
-	ipv4_l3fwd_hash_params.socket_id = socketid;
+	ipv4_l3fwd_hash_params.numa_id = socketid;
 	ipv4_l3fwd_em_lookup_struct[socketid] =
 		rte_hash_create(&ipv4_l3fwd_hash_params);
 	if (ipv4_l3fwd_em_lookup_struct[socketid] == NULL)
@@ -1002,7 +1002,7 @@ setup_hash(const int socketid)
 	/* create ipv6 hash */
 	snprintf(s, sizeof(s), "ipv6_l3fwd_hash_%d", socketid);
 	ipv6_l3fwd_hash_params.name = s;
-	ipv6_l3fwd_hash_params.socket_id = socketid;
+	ipv6_l3fwd_hash_params.numa_id = socketid;
 	ipv6_l3fwd_em_lookup_struct[socketid] =
 		rte_hash_create(&ipv6_l3fwd_hash_params);
 	if (ipv6_l3fwd_em_lookup_struct[socketid] == NULL)
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 9532150a47..1731aa51e2 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -311,7 +311,7 @@ check_lcore_params(void)
 			return -1;
 		}
 
-		socketid = rte_lcore_to_socket_id(lcore);
+		socketid = rte_lcore_to_numa_id(lcore);
 		if (socketid != 0 && numa_on == 0) {
 			printf("warning: lcore %u is on socket %d with numa off\n",
 				lcore, socketid);
@@ -1133,7 +1133,7 @@ init_mem(uint16_t portid, unsigned int nb_mbuf)
 			continue;
 
 		if (numa_on)
-			socketid = rte_lcore_to_socket_id(lcore_id);
+			socketid = rte_lcore_to_numa_id(lcore_id);
 		else
 			socketid = 0;
 
@@ -1474,7 +1474,7 @@ l3fwd_poll_resource_setup(void)
 
 			if (numa_on)
 				socketid =
-				(uint8_t)rte_lcore_to_socket_id(lcore_id);
+				(uint8_t)rte_lcore_to_numa_id(lcore_id);
 			else
 				socketid = 0;
 
@@ -1516,7 +1516,7 @@ l3fwd_poll_resource_setup(void)
 
 			if (numa_on)
 				socketid =
-				(uint8_t)rte_lcore_to_socket_id(lcore_id);
+				(uint8_t)rte_lcore_to_numa_id(lcore_id);
 			else
 				socketid = 0;
 
-- 
2.55.0



More information about the dev mailing list