Skip to contentSkip to conversation

app/testpmd: add option ring-bind-lcpu to bind Q with CPU

PATCH Superseded [email protected] 1 participant 1 message Jan 10, 2018

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 app/testpmd: add option ring-bind-lcpu to bind Q with CPU

From: Simon Guo <[email protected]>

Currently the rx/tx queue is allocated from the buffer pool on socket of:
- port's socket if --port-numa-config specified
- or ring-numa-config setting per port

All the above will "bind" queue to single socket per port configuration. But it can actually archieve better performance if one port's queue can be spread across multiple NUMA nodes, and the rx/tx queue is allocated per lcpu socket.

This patch adds a new option "--ring-bind-lcpu"(no parameter). With this, testpmd can utilize the PCI-e bus bandwidth on another NUMA nodes.

When --port-numa-config or --ring-numa-config option is specified, this --ring-bind-lcpu option will be suppressed.

Test result:
64bytes package, running in PowerPC with Mellanox CX-4 card, single port(100G), with 8 cores, fw mode:
- Without this patch: 52.5Mpps throughput
- With this patch: 66Mpps throughput
~25% improvement

---
 app/test-pmd/parameters.c |  14 +++++-
 app/test-pmd/testpmd.c    | 111 +++++++++++++++++++++++++++++++++-------------
 app/test-pmd/testpmd.h    |   7 +++
 3 files changed, 100 insertions(+), 32 deletions(-)
app/test-pmd/parameters.c +13 -1
index 304b98d..1dba92e 100644
@@ -104,6 +104,10 @@
 	       "(flag: 1 for RX; 2 for TX; 3 for RX and TX).\n");
 	printf("  --socket-num=N: set socket from which all memory is allocated "
 	       "in NUMA mode.\n");
+	printf("  --ring-bind-lcpu: "
+		"specify TX/RX rings will be allocated on local socket of lcpu."
+		"It will be ignored if ring-numa-config or port-numa-config is used. "
+		"As a result, it allows one port binds to multiple NUMA nodes.\n");
 	printf("  --mbuf-size=N: set the data size of mbuf to N bytes.\n");
 	printf("  --total-num-mbufs=N: set the number of mbufs to be allocated "
 	       "in mbuf pools.\n");
@@ -544,6 +548,7 @@
 		{ "interactive",		0, 0, 0 },
 		{ "cmdline-file",		1, 0, 0 },
 		{ "auto-start",			0, 0, 0 },
+		{ "ring-bind-lcpu",		0, 0, 0 },
 		{ "eth-peers-configfile",	1, 0, 0 },
 		{ "eth-peer",			1, 0, 0 },
 #endif
@@ -676,6 +681,10 @@
 				stats_period = n;
 				break;
 			}
+			if (!strcmp(lgopts[opt_idx].name, "ring-bind-lcpu")) {
+				ring_bind_lcpu |= RBL_BIND_LOCAL_MASK;
+				break;
+			}
 			if (!strcmp(lgopts[opt_idx].name,
 				    "eth-peers-configfile")) {
 				if (init_peer_eth_addrs(optarg) != 0)
@@ -739,11 +748,14 @@
 				if (parse_portnuma_config(optarg))
 					rte_exit(EXIT_FAILURE,
 					   "invalid port-numa configuration\n");
+				ring_bind_lcpu |= RBL_PORT_NUMA_MASK;
 			}
-			if (!strcmp(lgopts[opt_idx].name, "ring-numa-config"))
+			if (!strcmp(lgopts[opt_idx].name, "ring-numa-config")) {
 				if (parse_ringnuma_config(optarg))
 					rte_exit(EXIT_FAILURE,
 					   "invalid ring-numa configuration\n");
+				ring_bind_lcpu |= RBL_RING_NUMA_MASK;
+			}
 			if (!strcmp(lgopts[opt_idx].name, "socket-num")) {
 				n = atoi(optarg);
 				if (!new_socket_id((uint8_t)n)) {
app/test-pmd/testpmd.c +80 -31

147 lines not on this page · raw message

app/test-pmd/testpmd.h +7 -0
index 2a266fd..99e55b2 100644
@@ -328,6 +328,13 @@ struct queue_stats_mappings {
 extern uint8_t  interactive;
 extern uint8_t  auto_start;
 extern uint8_t  tx_first;
+
+/* for --ring-bind-lcpu option checking, RBL means Ring Bind Lcpu related */
+#define RBL_BIND_LOCAL_MASK (1 << 0)
+#define RBL_RING_NUMA_MASK  (1 << 1)
+#define RBL_PORT_NUMA_MASK  (1 << 2)
+extern uint8_t  ring_bind_lcpu;
+
 extern char cmdline_filename[PATH_MAX]; /**< offline commands file */
 extern uint8_t  numa_support; /**< set by "--numa" parameter */
 extern uint16_t port_topology; /**< set by "--port-topology" parameter */
Signature · 1 line
1.8.3.1