DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] eal: add option --master-lcore
Date: Wed, 05 Nov 2014 17:52:46 +0100
Message-ID: <2670906.3ddkbcCbba@xps13> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB977258213A2877@IRSMSX105.ger.corp.intel.com>

2014-11-05 11:54, Ananyev, Konstantin:
> From: Thomas Monjalon
> > +	long master_lcore;
> > +	char *parsing_end;
> > +	struct rte_config *cfg = rte_eal_get_configuration();
> > +
> > +	errno = 0;
> > +	master_lcore = strtol(arg, &parsing_end, 0);
> > +	if (errno || parsing_end == arg)
> > +		return -1;
> 
> Why not: "errno || parsing_end[0] != 0"
> ?
> Otherwise something like "1blah" would be considered as valid input.

Good point.

> > +	if (!(master_lcore >= 0 && master_lcore < RTE_MAX_LCORE))
> > +		return -1;
> 
> If negative values are not allowed, then why not:
> 
> unsigned long master_lcore;
> ...
> master_lcore = strtoul(...)
> ...
> if(master_clore > RTE_MAX_LCORE)
>     return -1;   

Matter of taste. Your code is less explicit.
But it should be
	if(master_clore >= RTE_MAX_LCORE)
Anyone else to vote for 1 solution or the other?

> > +		if (opt == OPT_MASTER_LCORE_NUM && !coremask_ok) {
> > +			RTE_LOG(ERR, EAL, "please specify the master lcore id"
> > +				"after specifying the coremask\n");
> > +			eal_usage(prgname);
> > +			return -1;
> > +		}
> > +
> 
> I don't really like an idea of introducing strict order between -c and  "--master-lcore..

Me too. And Aaron too :)

> Can we move check for coremask_ok/ and assignment of cfg->master_lcore out of  
> while (getopt_long(...)) loop?
> 
> >  		ret = eal_parse_common_option(opt, optarg, &internal_config);
> >  		/* common parser is not happy */
> >  		if (ret < 0) {

Yes we should move the check outside of the loop.
First we should migrate all flags check in a common function for BSD and Linux.

Simon made the v1. I made the v2. Any volunteer for the v3?

-- 
Thomas

  reply	other threads:[~2014-11-05 16:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08  8:28 [dpdk-dev] [PATCH] eal/linuxapp: Add parameter to specify master lcore id Simon Kuenzer
2014-07-08  9:42 ` Simon Kuenzer
2014-07-21 16:21   ` Simon Kuenzer
2014-07-22 23:40     ` Hiroshi Shimamoto
2014-07-23  7:50       ` Thomas Monjalon
2014-07-23  8:53         ` Hiroshi Shimamoto
2014-07-23  9:04           ` Thomas Monjalon
2014-07-23 12:05             ` Simon Kuenzer
2014-08-04  2:48             ` Hiroshi Shimamoto
2014-07-23 12:10           ` Simon Kuenzer
2014-11-03 17:02             ` Aaron Campbell
2014-11-03 22:29               ` Thomas Monjalon
2014-07-23  8:03       ` Gray, Mark D
2014-11-03 17:02 ` Aaron Campbell
2014-11-04 19:00   ` Thomas Monjalon
2014-11-05 15:34     ` Aaron Campbell
2014-11-04 21:40 ` [dpdk-dev] [PATCH v2] eal: add option --master-lcore Thomas Monjalon
2014-11-05 11:54   ` Ananyev, Konstantin
2014-11-05 16:52     ` Thomas Monjalon [this message]
2014-11-05 15:34   ` Aaron Campbell
2014-11-05 23:43   ` Simon Kuenzer

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=2670906.3ddkbcCbba@xps13 \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git