From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: Re: [PATCH v3] eal: add error check for core options Date: Fri, 2 Feb 2018 15:33:07 +0000 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 Cc: dev@dpdk.org, anatoly.burakov@intel.com, vipin.varghese@intel.com, stable@dpdk.org To: Marko Kovacevic Return-path: Content-Disposition: inline In-Reply-To: <20180202145128.6331-1-marko.kovacevic@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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