From: "Wu, Jingjing" <jingjing.wu@intel.com>
To: Shahaf Shuler <shahafs@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"thomas@monjalon.net" <thomas@monjalon.net>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] app/testpmd: support non contiguous socket ids
Date: Sat, 6 May 2017 01:41:03 +0000 [thread overview]
Message-ID: <9BB6961774997848B5B42BEC655768F810D624B2@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20170503134429.22723-1-shahafs@mellanox.com>
> -----Original Message-----
> From: Shahaf Shuler [mailto:shahafs@mellanox.com]
> Sent: Wednesday, May 3, 2017 9:44 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; stable@dpdk.org
> Subject: [PATCH v2] app/testpmd: support non contiguous socket ids
>
> The test assumes the socket ids are contiguous. This is not necessarily the case
> on all servers and may cause mempool creation to fail.
>
> Fixing it by detecting the list of valid socket ids and use it for the mempool
> creation.
>
> Fixes: 7acf894d07d1 ("app/testpmd: detect numa socket count")
>
> CC: stable@dpdk.org
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> ---
> on v2:
> * fix minor typo on commit message : be->by.
> ---
> app/test-pmd/parameters.c | 38 ++++++++++++++++++++++++++++----------
> app/test-pmd/testpmd.c | 38 +++++++++++++++++++++++++++++---------
> app/test-pmd/testpmd.h | 4 +++-
> 3 files changed, 60 insertions(+), 20 deletions(-)
>
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index
> 787e1434c..4822a8a8a 100644
> --- a/app/test-pmd/parameters.c
> +++ b/app/test-pmd/parameters.c
> @@ -410,9 +410,14 @@ parse_portnuma_config(const char *q_arg)
> return -1;
> }
> socket_id = (uint8_t)int_fld[FLD_SOCKET];
> - if(socket_id >= max_socket) {
> - printf("Invalid socket id, range is [0, %d]\n",
> - max_socket - 1);
> + if (new_socket_id(socket_id)) {
> + unsigned int i = 0;
> +
> + printf("Invalid socket id, options are: ");
> + for (i = 0; i < num_sockets; i++) {
> + printf("%u%s", socket_ids[i],
> + (i == num_sockets - 1) ? "\n" : ",");
> + }
> return -1;
> }
> port_numa[port_id] = socket_id;
> @@ -470,9 +475,14 @@ parse_ringnuma_config(const char *q_arg)
> return -1;
> }
> socket_id = (uint8_t)int_fld[FLD_SOCKET];
> - if (socket_id >= max_socket) {
> - printf("Invalid socket id, range is [0, %d]\n",
> - max_socket - 1);
> + if (new_socket_id(socket_id)) {
> + unsigned int i = 0;
> +
> + printf("Invalid socket id, options are: ");
> + for (i = 0; i < num_sockets; i++) {
> + printf("%u%s", socket_ids[i],
> + (i == num_sockets - 1) ? "\n" : ",");
> + }
> return -1;
> }
> ring_flag = (uint8_t)int_fld[FLD_FLAG]; @@ -700,12 +710,20
> @@ launch_args_parse(int argc, char** argv)
> "invalid ring-numa configuration\n");
> if (!strcmp(lgopts[opt_idx].name, "socket-num")) {
> n = atoi(optarg);
> - if((uint8_t)n < max_socket)
> + if (!new_socket_id((uint8_t)n)) {
> socket_num = (uint8_t)n;
> - else
> + } else {
> + unsigned int i = 0;
> +
> + printf("socket id options are: ");
> + for (i = 0; i < num_sockets; i++) {
> + printf("%u%s", socket_ids[i],
> + (i == num_sockets - 1) ?
> + "\n" : ",");
> + }
> rte_exit(EXIT_FAILURE,
> - "The socket number should be
> < %d\n",
> - max_socket);
> + "Invalid socket id");
> + }
> }
> 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
> dfe64427d..a556a8aff 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -354,7 +354,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;
> +unsigned int num_sockets = 0;
> +unsigned int socket_ids[RTE_MAX_NUMA_NODES];
>
> #ifdef RTE_LIBRTE_BITRATE
> /* Bitrate statistics */
> @@ -377,6 +378,22 @@ static void eth_event_callback(uint8_t port_id, static
> int all_ports_started(void);
>
> /*
> + * Helper function to check if socket is allready discovered.
> + * If yes, return positive value. If not, return zero.
> + */
> +int
> +new_socket_id(unsigned int socket_id)
> +{
> + unsigned int i;
> +
> + for (i = 0; i < num_sockets; i++) {
> + if (socket_ids[i] == socket_id)
> + return 0;
> + }
> + return 1;
> +}
> +
> +/*
> * Setup default configuration.
> */
> static void
> @@ -388,12 +405,14 @@ set_default_fwd_lcores_config(void)
>
> nb_lc = 0;
> for (i = 0; i < RTE_MAX_LCORE; 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;
> + sock_num = rte_lcore_to_socket_id(i);
+1 is missed?
next prev parent reply other threads:[~2017-05-06 1:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-03 13:44 Shahaf Shuler
2017-05-06 1:41 ` Wu, Jingjing [this message]
2017-05-07 6:06 ` Shahaf Shuler
2017-05-08 0:54 ` Wu, Jingjing
2017-05-08 17:35 ` Shahaf Shuler
2017-05-09 0:43 ` Wu, Jingjing
2017-05-07 12:14 ` Thomas Monjalon
2017-05-07 13:05 ` [dpdk-dev] [PATCH v3] " Shahaf Shuler
2017-05-09 7:28 ` [dpdk-dev] [PATCH v4] app/testpmd: fix mempool creation by socket id Shahaf Shuler
2017-05-09 8:54 ` Wu, Jingjing
2017-05-10 16:41 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9BB6961774997848B5B42BEC655768F810D624B2@SHSMSX103.ccr.corp.intel.com \
--to=jingjing.wu@intel.com \
--cc=dev@dpdk.org \
--cc=shahafs@mellanox.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).