From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 3216811D4; Thu, 1 Feb 2018 17:38:08 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Feb 2018 08:38:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,444,1511856000"; d="scan'208";a="170920303" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.237.220.145]) ([10.237.220.145]) by orsmga004.jf.intel.com with ESMTP; 01 Feb 2018 08:38:02 -0800 To: Marko Kovacevic , dev@dpdk.org Cc: vipin.varghese@intel.com, bruce.richardson@intel.com, stable@dpdk.org References: <20180201153956.15021-1-marko.kovacevic@intel.com> From: "Burakov, Anatoly" Message-ID: <9ba4c406-dfbb-8c32-7c48-d95277c9f3f1@intel.com> Date: Thu, 1 Feb 2018 16:38:01 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180201153956.15021-1-marko.kovacevic@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v1] eal: add error check for core options 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: Thu, 01 Feb 2018 16:38:10 -0000 On 01-Feb-18 3:39 PM, Marko Kovacevic wrote: > Error information on the current core > usage list,mask and map were incomplete. > Added states to differentiate core usage > and to inform user. Nitpicking, but line width on commit message is a little on the short side... > > Signed-off-by: Marko Kovacevic > --- > doc/guides/testpmd_app_ug/run_app.rst | 4 ++++ > lib/librte_eal/common/eal_common_options.c | 33 +++++++++++++++++++++++++++--- > 2 files changed, 34 insertions(+), 3 deletions(-) > > diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst > index 46da1df..26500bf 100644 > --- a/doc/guides/testpmd_app_ug/run_app.rst > +++ b/doc/guides/testpmd_app_ug/run_app.rst > @@ -62,6 +62,10 @@ See the DPDK Getting Started Guides for more information on these options. > The grouping ``()`` can be omitted for single element group. > The ``@`` can be omitted if cpus and lcores have the same value. > > +.. Note:: > + When ``--lcores`` is in use, the options ``-l`` and ``-c`` cannot be used. > + > + > * ``--master-lcore ID`` > > Core ID that is used as master. > diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c > index b6d2762..6604c64 100644 > --- a/lib/librte_eal/common/eal_common_options.c > +++ b/lib/librte_eal/common/eal_common_options.c > @@ -57,6 +57,9 @@ > #include "eal_filesystem.h" > > #define BITS_PER_HEX 4 > +#define LCORE_OPT_LST 1 > +#define LCORE_OPT_MSK 2 > +#define LCORE_OPT_MAP 3 > > const char > eal_short_options[] = > @@ -1028,7 +1031,15 @@ eal_parse_common_option(int opt, const char *optarg, > RTE_LOG(ERR, EAL, "invalid coremask\n"); > return -1; > } > - core_parsed = 1; > + > + if (core_parsed) { > + RTE_LOG(ERR, EAL, "Core Mask Option is ignored, because core (%s) is set!\n", > + (core_parsed == LCORE_OPT_LST)?"LIST" : > + (core_parsed == LCORE_OPT_MAP)?"MAP" : "Unknown"); i think "LIST" and "MAP" are terribly undescriptive. It would be better to put the respective cmdline arguments ("-l" or "-c") there instead. Same applies to other cases. Otherwise, Reviewed-by: Anatoly Burakov > + return -1; > + } > + > + core_parsed = LCORE_OPT_MSK; > break; > /* corelist */ > case 'l': > @@ -1036,7 +1047,15 @@ eal_parse_common_option(int opt, const char *optarg, > RTE_LOG(ERR, EAL, "invalid core list\n"); > return -1; > } > - core_parsed = 1; > + > + if (core_parsed) { > + RTE_LOG(ERR, EAL, "Core List Option is ignored, because core (%s) is set!\n", > + (core_parsed == LCORE_OPT_MSK)?"LIST" : > + (core_parsed == LCORE_OPT_MAP)?"MAP" : "Unknown"); > + return -1; > + } > + > + core_parsed = LCORE_OPT_LST; > break; > /* service coremask */ > case 's': > @@ -1156,7 +1175,15 @@ eal_parse_common_option(int opt, const char *optarg, > OPT_LCORES "\n"); > return -1; > } > - core_parsed = 1; > + > + if (core_parsed) { > + RTE_LOG(ERR, EAL, "Core Map Option is ignored, because core (%s) is set!\n", > + (core_parsed == LCORE_OPT_LST)?"LIST" : > + (core_parsed == LCORE_OPT_MSK)?"MASK" : "Unknown"); > + return -1; > + } > + > + core_parsed = LCORE_OPT_MAP; > break; > > /* don't know what to do, leave this to caller */ > -- Thanks, Anatoly