* [dpdk-dev] [PATCH] app/test-pmd: Detect NUMA socket count
@ 2015-08-21 2:25 Stephen Hurd
2015-09-02 11:09 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hurd @ 2015-08-21 2:25 UTC (permalink / raw)
To: dev
Currently, there is a MAX_SOCKET macro which artificially limits the
number of NUMA sockets testpmd can use. Anything on a higher socket
ends up using socket zero. This patch replaces this with a variable
set during set_default_fwd_lcores_config() and uses RTE_MAX_NUMA_NODES
where a hard-coded max number of sockets is required.
Signed-off-by: Stephen Hurd <shurd@broadcom.com>
---
app/test-pmd/parameters.c | 12 ++++++------
app/test-pmd/testpmd.c | 17 +++++++++++++----
app/test-pmd/testpmd.h | 3 +--
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index f1daa6e..fe78723 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -398,9 +398,9 @@ parse_portnuma_config(const char *q_arg)
return -1;
}
socket_id = (uint8_t)int_fld[FLD_SOCKET];
- if(socket_id >= MAX_SOCKET) {
+ if(socket_id >= max_socket) {
printf("Invalid socket id, range is [0, %d]\n",
- MAX_SOCKET - 1);
+ max_socket - 1);
return -1;
}
port_numa[port_id] = socket_id;
@@ -458,9 +458,9 @@ parse_ringnuma_config(const char *q_arg)
return -1;
}
socket_id = (uint8_t)int_fld[FLD_SOCKET];
- if (socket_id >= MAX_SOCKET) {
+ if (socket_id >= max_socket) {
printf("Invalid socket id, range is [0, %d]\n",
- MAX_SOCKET - 1);
+ max_socket - 1);
return -1;
}
ring_flag = (uint8_t)int_fld[FLD_FLAG];
@@ -667,12 +667,12 @@ launch_args_parse(int argc, char** argv)
"invalid ring-numa configuration\n");
if (!strcmp(lgopts[opt_idx].name, "socket-num")) {
n = atoi(optarg);
- if(n < MAX_SOCKET)
+ if((uint8_t)n < max_socket)
socket_num = (uint8_t)n;
else
rte_exit(EXIT_FAILURE,
"The socket number should be < %d\n",
- MAX_SOCKET);
+ max_socket);
}
if (!strcmp(lgopts[opt_idx].name, "mbuf-size")) {
n = atoi(optarg);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 386bf84..2578b6b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -313,6 +313,8 @@ struct queue_stats_mappings *rx_queue_stats_mappings = rx_queue_stats_mappings_a
uint16_t nb_tx_queue_stats_mappings = 0;
uint16_t nb_rx_queue_stats_mappings = 0;
+unsigned max_socket = 0;
+
/* Forward function declarations */
static void map_port_queue_stats_mapping_registers(uint8_t pi, struct rte_port *port);
static void check_all_ports_link_status(uint32_t port_mask);
@@ -345,6 +347,7 @@ set_default_fwd_lcores_config(void)
{
unsigned int i;
unsigned int nb_lc;
+ unsigned int sock_num;
nb_lc = 0;
for (i = 0; i < RTE_MAX_LCORE; i++) {
@@ -353,6 +356,12 @@ set_default_fwd_lcores_config(void)
if (i == rte_get_master_lcore())
continue;
fwd_lcores_cpuids[nb_lc++] = i;
+ sock_num = rte_lcore_to_socket_id(i) + 1;
+ if (sock_num > max_socket) {
+ if (sock_num > RTE_MAX_NUMA_NODES)
+ rte_exit(EXIT_FAILURE, "Total sockets greater than %u\n", RTE_MAX_NUMA_NODES);
+ max_socket = sock_num;
+ }
}
nb_lcores = (lcoreid_t) nb_lc;
nb_cfg_lcores = nb_lcores;
@@ -446,7 +455,7 @@ check_socket_id(const unsigned int socket_id)
{
static int warning_once = 0;
- if (socket_id >= MAX_SOCKET) {
+ if (socket_id >= max_socket) {
if (!warning_once && numa_support)
printf("Warning: NUMA should be configured manually by"
" using --port-numa-config and"
@@ -466,9 +475,9 @@ init_config(void)
struct rte_mempool *mbp;
unsigned int nb_mbuf_per_pool;
lcoreid_t lc_id;
- uint8_t port_per_socket[MAX_SOCKET];
+ uint8_t port_per_socket[RTE_MAX_NUMA_NODES];
- memset(port_per_socket,0,MAX_SOCKET);
+ memset(port_per_socket,0,RTE_MAX_NUMA_NODES);
/* Configuration of logical cores. */
fwd_lcores = rte_zmalloc("testpmd: fwd_lcores",
sizeof(struct fwd_lcore *) * nb_lcores,
@@ -545,7 +554,7 @@ init_config(void)
if (param_total_num_mbufs)
nb_mbuf_per_pool = nb_mbuf_per_pool/nb_ports;
- for (i = 0; i < MAX_SOCKET; i++) {
+ for (i = 0; i < max_socket; i++) {
nb_mbuf = (nb_mbuf_per_pool * RTE_MAX_ETHPORTS);
if (nb_mbuf)
mbuf_pool_create(mbuf_data_size,
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index d287274..f925df7 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -308,8 +308,6 @@ extern volatile int test_done; /* stop packet forwarding when set to 1. */
extern uint32_t bypass_timeout; /**< Store the NIC bypass watchdog timeout */
#endif
-#define MAX_SOCKET 2 /*MAX SOCKET:currently, it is 2 */
-
/*
* Store specified sockets on which memory pool to be used by ports
* is allocated.
@@ -338,6 +336,7 @@ extern lcoreid_t nb_lcores; /**< Number of logical cores probed at init time. */
extern lcoreid_t nb_cfg_lcores; /**< Number of configured logical cores. */
extern lcoreid_t nb_fwd_lcores; /**< Number of forwarding logical cores. */
extern unsigned int fwd_lcores_cpuids[RTE_MAX_LCORE];
+extern unsigned max_socket;
/*
* Configuration of Ethernet ports:
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] app/test-pmd: Detect NUMA socket count
2015-08-21 2:25 [dpdk-dev] [PATCH] app/test-pmd: Detect NUMA socket count Stephen Hurd
@ 2015-09-02 11:09 ` De Lara Guarch, Pablo
2015-10-24 20:20 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2015-09-02 11:09 UTC (permalink / raw)
To: Stephen Hurd, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hurd
> Sent: Friday, August 21, 2015 3:25 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] app/test-pmd: Detect NUMA socket count
>
> Currently, there is a MAX_SOCKET macro which artificially limits the
> number of NUMA sockets testpmd can use. Anything on a higher socket
> ends up using socket zero. This patch replaces this with a variable
> set during set_default_fwd_lcores_config() and uses
> RTE_MAX_NUMA_NODES
> where a hard-coded max number of sockets is required.
>
> Signed-off-by: Stephen Hurd <shurd@broadcom.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] app/test-pmd: Detect NUMA socket count
2015-09-02 11:09 ` De Lara Guarch, Pablo
@ 2015-10-24 20:20 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-10-24 20:20 UTC (permalink / raw)
To: Stephen Hurd; +Cc: dev
> > Currently, there is a MAX_SOCKET macro which artificially limits the
> > number of NUMA sockets testpmd can use. Anything on a higher socket
> > ends up using socket zero. This patch replaces this with a variable
> > set during set_default_fwd_lcores_config() and uses
> > RTE_MAX_NUMA_NODES
> > where a hard-coded max number of sockets is required.
> >
> > Signed-off-by: Stephen Hurd <shurd@broadcom.com>
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-24 20:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-21 2:25 [dpdk-dev] [PATCH] app/test-pmd: Detect NUMA socket count Stephen Hurd
2015-09-02 11:09 ` De Lara Guarch, Pablo
2015-10-24 20:20 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).