From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 5C9D9330C; Sat, 6 May 2017 03:41:07 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 May 2017 18:41:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,295,1491289200"; d="scan'208";a="97926587" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 05 May 2017 18:41:06 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 5 May 2017 18:41:06 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 5 May 2017 18:41:05 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.193]) with mapi id 14.03.0319.002; Sat, 6 May 2017 09:41:03 +0800 From: "Wu, Jingjing" To: Shahaf Shuler CC: "dev@dpdk.org" , "thomas@monjalon.net" , "stable@dpdk.org" Thread-Topic: [PATCH v2] app/testpmd: support non contiguous socket ids Thread-Index: AQHSxBNt8Bgnb7B1MEyktyKgEDyQkKHmhiGg Date: Sat, 6 May 2017 01:41:03 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810D624B2@SHSMSX103.ccr.corp.intel.com> References: <20170503134429.22723-1-shahafs@mellanox.com> In-Reply-To: <20170503134429.22723-1-shahafs@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] app/testpmd: support non contiguous socket ids X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 01:41:09 -0000 > -----Original Message----- > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > Sent: Wednesday, May 3, 2017 9:44 PM > To: Wu, Jingjing > Cc: dev@dpdk.org; thomas@monjalon.net; stable@dpdk.org > Subject: [PATCH v2] app/testpmd: support non contiguous socket ids >=20 > The test assumes the socket ids are contiguous. This is not necessarily t= he case > on all servers and may cause mempool creation to fail. >=20 > Fixing it by detecting the list of valid socket ids and use it for the me= mpool > creation. >=20 > Fixes: 7acf894d07d1 ("app/testpmd: detect numa socket count") >=20 > CC: stable@dpdk.org > Signed-off-by: Shahaf Shuler > --- > 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(-) >=20 > 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 =3D (uint8_t)int_fld[FLD_SOCKET]; > - if(socket_id >=3D max_socket) { > - printf("Invalid socket id, range is [0, %d]\n", > - max_socket - 1); > + if (new_socket_id(socket_id)) { > + unsigned int i =3D 0; > + > + printf("Invalid socket id, options are: "); > + for (i =3D 0; i < num_sockets; i++) { > + printf("%u%s", socket_ids[i], > + (i =3D=3D num_sockets - 1) ? "\n" : ","); > + } > return -1; > } > port_numa[port_id] =3D socket_id; > @@ -470,9 +475,14 @@ parse_ringnuma_config(const char *q_arg) > return -1; > } > socket_id =3D (uint8_t)int_fld[FLD_SOCKET]; > - if (socket_id >=3D max_socket) { > - printf("Invalid socket id, range is [0, %d]\n", > - max_socket - 1); > + if (new_socket_id(socket_id)) { > + unsigned int i =3D 0; > + > + printf("Invalid socket id, options are: "); > + for (i =3D 0; i < num_sockets; i++) { > + printf("%u%s", socket_ids[i], > + (i =3D=3D num_sockets - 1) ? "\n" : ","); > + } > return -1; > } > ring_flag =3D (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 =3D atoi(optarg); > - if((uint8_t)n < max_socket) > + if (!new_socket_id((uint8_t)n)) { > socket_num =3D (uint8_t)n; > - else > + } else { > + unsigned int i =3D 0; > + > + printf("socket id options are: "); > + for (i =3D 0; i < num_sockets; i++) { > + printf("%u%s", socket_ids[i], > + (i =3D=3D 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 =3D 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 =3D rx_queue_stats_mappings_a uint16_t > nb_tx_queue_stats_mappings =3D 0; uint16_t nb_rx_queue_stats_mappings = =3D 0; >=20 > -unsigned max_socket =3D 0; > +unsigned int num_sockets =3D 0; > +unsigned int socket_ids[RTE_MAX_NUMA_NODES]; >=20 > #ifdef RTE_LIBRTE_BITRATE > /* Bitrate statistics */ > @@ -377,6 +378,22 @@ static void eth_event_callback(uint8_t port_id, sta= tic > int all_ports_started(void); >=20 > /* > + * 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 =3D 0; i < num_sockets; i++) { > + if (socket_ids[i] =3D=3D socket_id) > + return 0; > + } > + return 1; > +} > + > +/* > * Setup default configuration. > */ > static void > @@ -388,12 +405,14 @@ set_default_fwd_lcores_config(void) >=20 > nb_lc =3D 0; > for (i =3D 0; i < RTE_MAX_LCORE; i++) { > - sock_num =3D 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 =3D sock_num; > + sock_num =3D rte_lcore_to_socket_id(i); +1 is missed?