From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id E9D31376C for ; Mon, 17 Jul 2017 17:53:36 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2017 08:53:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,374,1496127600"; d="scan'208";a="127686007" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga005.fm.intel.com with ESMTP; 17 Jul 2017 08:53:35 -0700 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.9]) by IRSMSX102.ger.corp.intel.com ([169.254.2.211]) with mapi id 14.03.0319.002; Mon, 17 Jul 2017 16:53:34 +0100 From: "Ananyev, Konstantin" To: "Van Haaren, Harry" , "dev@dpdk.org" CC: "thomas@monjalon.net" , "jerin.jacob@caviumnetworks.com" , "Van Haaren, Harry" Thread-Topic: [dpdk-dev] [PATCH] service: add corelist to EAL arguments Thread-Index: AQHS/xCAcjzw6uv6kkGyT2/40gL0SKJYKydw Date: Mon, 17 Jul 2017 15:53:33 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258404CA1B4@IRSMSX103.ger.corp.intel.com> References: <2348349.WgB7oMYfnC@xps> <1500304914-42805-1-git-send-email-harry.van.haaren@intel.com> In-Reply-To: <1500304914-42805-1-git-send-email-harry.van.haaren@intel.com> Accept-Language: en-IE, 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: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] service: add corelist to EAL arguments 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: Mon, 17 Jul 2017 15:53:37 -0000 Hi Harry, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Harry van Haaren > Sent: Monday, July 17, 2017 4:22 PM > To: dev@dpdk.org > Cc: thomas@monjalon.net; jerin.jacob@caviumnetworks.com; Van Haaren, Harr= y > Subject: [dpdk-dev] [PATCH] service: add corelist to EAL arguments >=20 > This commit allows the -S (captial 's') to be used to indicate > a corelist for Services. This is a "nice to have" patch, and does > not modify any of the service core functionality. >=20 > Suggested-by: Jerin Jacob > Suggested-by: Thomas Monjalon > Signed-off-by: Harry van Haaren > --- > lib/librte_eal/common/eal_common_options.c | 74 ++++++++++++++++++++++++= ++++++ > 1 file changed, 74 insertions(+) >=20 > diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/= common/eal_common_options.c > index 00265d6..696a627 100644 > --- a/lib/librte_eal/common/eal_common_options.c > +++ b/lib/librte_eal/common/eal_common_options.c > @@ -65,6 +65,7 @@ eal_short_options[] =3D > "d:" /* driver */ > "h" /* help */ > "l:" /* corelist */ > + "S:" /* service corelist */ > "m:" /* memory size */ > "n:" /* memory channels */ > "r:" /* memory ranks */ > @@ -402,6 +403,72 @@ eal_parse_coremask(const char *coremask) > } >=20 Do we need a new parsing function here? Can't we reuse at least part of '-l' parsing code? Konstantin > static int > +eal_parse_service_corelist(const char *corelist) > +{ > + struct rte_config *cfg =3D rte_eal_get_configuration(); > + int i, idx =3D 0; > + unsigned count =3D 0; > + char *end =3D NULL; > + int min, max; > + > + if (corelist =3D=3D NULL) > + return -1; > + > + /* Remove all blank characters ahead and after */ > + while (isblank(*corelist)) > + corelist++; > + i =3D strlen(corelist); > + while ((i > 0) && isblank(corelist[i - 1])) > + i--; > + > + /* Get list of cores */ > + min =3D RTE_MAX_LCORE; > + do { > + while (isblank(*corelist)) > + corelist++; > + if (*corelist =3D=3D '\0') > + return -1; > + errno =3D 0; > + idx =3D strtoul(corelist, &end, 10); > + if (errno || end =3D=3D NULL) > + return -1; > + while (isblank(*end)) > + end++; > + if (*end =3D=3D '-') { > + min =3D idx; > + } else if ((*end =3D=3D ',') || (*end =3D=3D '\0')) { > + max =3D idx; > + if (min =3D=3D RTE_MAX_LCORE) > + min =3D idx; > + for (idx =3D min; idx <=3D max; idx++) { > + if (cfg->lcore_role[idx] !=3D ROLE_SERVICE) { > + /* handle master lcore already parsed */ > + uint32_t lcore =3D idx; > + if (cfg->master_lcore =3D=3D lcore && > + master_lcore_parsed) { > + RTE_LOG(ERR, EAL, > + "Error: lcore %u is master lcore, cannot use as service core\n", > + idx); > + return -1; > + } > + lcore_config[idx].core_role =3D > + ROLE_SERVICE; > + count++; > + } > + } > + min =3D RTE_MAX_LCORE; > + } else > + return -1; > + corelist =3D end + 1; > + } while (*end !=3D '\0'); > + > + if (count =3D=3D 0) > + return -1; > + > + return 0; > +} > + > +static int > eal_parse_corelist(const char *corelist) > { > struct rte_config *cfg =3D rte_eal_get_configuration(); > @@ -912,6 +979,13 @@ eal_parse_common_option(int opt, const char *optarg, > return -1; > } > break; > + /* service corelist */ > + case 'S': > + if (eal_parse_service_corelist(optarg) < 0) { > + RTE_LOG(ERR, EAL, "invalid service core list\n"); > + return -1; > + } > + break; > /* size of memory */ > case 'm': > conf->memory =3D atoi(optarg); > -- > 2.7.4