DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Hunt, David" <david.hunt@intel.com>
To: Euan Bourke <euan.bourke@intel.com>, <dev@dpdk.org>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>,
	Sivaprasad Tummala <sivaprasad.tummala@amd.com>
Subject: Re: [PATCH v3 8/8] examples/l3fwd-power: update to call arg parser API
Date: Mon, 11 Dec 2023 12:01:54 +0000	[thread overview]
Message-ID: <fc820709-21a1-46c1-bfd7-490879d05224@intel.com> (raw)
In-Reply-To: <20231207161818.2590661-9-euan.bourke@intel.com>

Hi Euan,

On 07/12/2023 16:18, Euan Bourke wrote:
> Update to the l3fwd-power example application to call the arg parser
> library for its 'combined core string parser' instead of implementing its
> own corelist parser. The default_type passed into the function call is
> a corelist.
>
> Signed-off-by: Euan Bourke <euan.bourke@intel.com>
> ---
>   examples/l3fwd-power/perf_core.c | 51 +++++---------------------------
>   1 file changed, 8 insertions(+), 43 deletions(-)
>
> diff --git a/examples/l3fwd-power/perf_core.c b/examples/l3fwd-power/perf_core.c
> index 41ef6d0c9a..f8511e30b3 100644
> --- a/examples/l3fwd-power/perf_core.c
> +++ b/examples/l3fwd-power/perf_core.c
> @@ -12,6 +12,7 @@
>   #include <rte_lcore.h>
>   #include <rte_power.h>
>   #include <rte_string_fns.h>
> +#include <rte_arg_parser.h>
>   
>   #include "perf_core.h"
>   #include "main.h"
> @@ -177,56 +178,20 @@ parse_perf_config(const char *q_arg)
>   int
>   parse_perf_core_list(const char *corelist)
>   {
> -	int i, idx = 0;
> -	unsigned int count = 0;
> -	char *end = NULL;
> -	int min, max;
> +	int count;
> +	uint16_t cores[RTE_MAX_LCORE];
>   
>   	if (corelist == NULL) {
>   		printf("invalid core list\n");
>   		return -1;
>   	}
>   
> +	count = rte_arg_parse_core_string(corelist, cores, RTE_DIM(cores), 1);
>   
> -	/* Remove all blank characters ahead and after */
> -	while (isblank(*corelist))
> -		corelist++;
> -	i = strlen(corelist);
> -	while ((i > 0) && isblank(corelist[i - 1]))
> -		i--;
> +	for (int i = 0; i < count; i++)


nit: you've used int here, but below you use uint16_t for a for loop. If 
you're re-spinning, it might be worth making consistent. But no biggie.

--snip--

> @@ -234,7 +199,7 @@ parse_perf_core_list(const char *corelist)
>   	nb_hp_lcores = count;
>   
>   	printf("Configured %d high performance cores\n", nb_hp_lcores);
> -	for (i = 0; i < nb_hp_lcores; i++)
> +	for (uint16_t i = 0; i < nb_hp_lcores; i++)
>   		printf("\tHigh performance core %d %d\n",
>   				i, hp_lcores[i]);
>   


I've also tested this with a 16-core incantation of l3fwd-power with 
various combinations of cores, seems to work well.

Acked-by: David Hunt <david.hunt@intel.com>






  reply	other threads:[~2023-12-11 12:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 16:18 [PATCH v3 0/8] add new command line argument parsing library Euan Bourke
2023-12-07 16:18 ` [PATCH v3 1/8] arg_parser: new library for command line parsing Euan Bourke
2023-12-07 16:44   ` Bruce Richardson
2023-12-07 19:32   ` Tyler Retzlaff
2023-12-07 16:18 ` [PATCH v3 2/8] arg_parser: add new coremask parsing API Euan Bourke
2023-12-07 16:18 ` [PATCH v3 3/8] eal: add support for new arg parsing library Euan Bourke
2023-12-07 16:18 ` [PATCH v3 4/8] eal: update to service core related parsers Euan Bourke
2023-12-07 16:18 ` [PATCH v3 5/8] event/dlb2: add new arg parsing library API support Euan Bourke
2023-12-07 16:18 ` [PATCH v3 6/8] arg_parser: added common core string and heuristic parsers Euan Bourke
2023-12-07 16:58   ` Bruce Richardson
2023-12-07 16:18 ` [PATCH v3 7/8] examples/eventdev_pipeline: update to call arg parser API Euan Bourke
2023-12-07 16:18 ` [PATCH v3 8/8] examples/l3fwd-power: " Euan Bourke
2023-12-11 12:01   ` Hunt, David [this message]
2023-12-11 16:50   ` Tummala, Sivaprasad
2023-12-07 17:34 ` [PATCH v3 0/8] add new command line argument parsing library Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc820709-21a1-46c1-bfd7-490879d05224@intel.com \
    --to=david.hunt@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=euan.bourke@intel.com \
    --cc=sivaprasad.tummala@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).