From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 4B5F9199B4; Fri, 2 Feb 2018 16:33:13 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 07:33:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,448,1511856000"; d="scan'208";a="26812810" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.77]) by fmsmga004.fm.intel.com with SMTP; 02 Feb 2018 07:33:08 -0800 Received: by (sSMTP sendmail emulation); Fri, 02 Feb 2018 15:33:08 +0000 Date: Fri, 2 Feb 2018 15:33:07 +0000 From: Bruce Richardson To: Marko Kovacevic Cc: dev@dpdk.org, anatoly.burakov@intel.com, vipin.varghese@intel.com, stable@dpdk.org Message-ID: <20180202153306.GA7932@bricha3-MOBL3.ger.corp.intel.com> References: <20180201170732.3225-1-marko.kovacevic@intel.com> <20180202145128.6331-1-marko.kovacevic@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180202145128.6331-1-marko.kovacevic@intel.com> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.1 (2017-09-22) Subject: Re: [dpdk-dev] [PATCH v3] 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: Fri, 02 Feb 2018 15:33:14 -0000 On Fri, Feb 02, 2018 at 02:51:28PM +0000, Marko Kovacevic wrote: > Error information on current core usage list, mask or map > were incomplete. Added states to differentiate core usage > and to inform user. > > Signed-off-by: Marko Kovacevic > Reviewed-by: Anatoly Burakov Acked-by: Bruce Richardson This is fine as-is - one comment below for future consideration. > > --- > > V3: > - Changed to reflect the coding guidelines - Bruce > - update the documentation for better clarity - Bruce > - Added back the reviewer information - Anatoly > > V2: > - Cleaned up the logging for error cases - Anatoly > --- > doc/guides/testpmd_app_ug/run_app.rst | 4 ++++ > lib/librte_eal/common/eal_common_options.c | 36 +++++++++++++++++++++++++++--- > 2 files changed, 37 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..85e725f 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:: > + At a given instance only one core option ``--lcores``, ``-l`` or ``-c`` can 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..66f0868 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,16 @@ 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, "Option -c is ignored, because (%s) is set!\n", > + (core_parsed == LCORE_OPT_LST) ? "-l" : > + (core_parsed == LCORE_OPT_MAP) ? "--lcore" : > + "-c"); This block is repeated in slightly different forms 3 times. It should probably be replaced using a function or macro to return the appropriate string based on core_parsed value. Thanks, /Bruce