All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kozak, KubaX" <kubax.kozak@intel.com>
To: "Wu, Jingjing" <jingjing.wu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Richardson, Bruce" <bruce.richardson@intel.com>,
	"Jain, Deepak K" <deepak.k.jain@intel.com>,
	"Jastrzebski, MichalX K" <michalx.k.jastrzebski@intel.com>,
	"Piasecki, JacekX" <jacekx.piasecki@intel.com>
Subject: Re: [PATCH 3/3] app/testpmd: changed example to parse	options from cfg file
Date: Tue, 20 Jun 2017 10:10:26 +0000	[thread overview]
Message-ID: <F6B2DFED41632040B39446096019FF8E6E1277@HASMSX106.ger.corp.intel.com> (raw)
In-Reply-To: <9BB6961774997848B5B42BEC655768F810DAA55B@SHSMSX103.ccr.corp.intel.com>

Comments inline.

Best regards,
Kuba Kozak

> -----Original Message-----
> From: Wu, Jingjing
> Sent: Tuesday, June 20, 2017 04:14
> To: Piasecki, JacekX <jacekx.piasecki@intel.com>; dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Jain, Deepak K <deepak.k.jain@intel.com>;
> Jastrzebski, MichalX K <michalx.k.jastrzebski@intel.com>; Kozak, KubaX <kubax.kozak@intel.com>
> Subject: RE: [dpdk-dev] [PATCH 3/3] app/testpmd: changed example to parse options from cfg file
> 
> > +
> > +#ifdef RTE_LIBRTE_CFGFILE
> > +/* Load config file path from command line */ static char *
> > +cfgfile_load_path(int argc, char **argv) {
> > +	int i;
> > +
> > +	for (i = 0; i < argc; i++) {
> > +		if (!strcmp("--cfgfile-path", argv[i])) {
> > +			if (i < argc)
> > +				return strdup(argv[i+1]);
> > +		}
> > +	}
> > +	return 0;
> > +}
> > +#endif
> > +
> It is a little confused. Is the cfgfile-path is application's argument or EAL's?
> Where is it supposed to be located?

It is an application argument.

> 
> >  int
> >  main(int argc, char** argv)
> >  {
> >  	int  diag;
> >  	uint8_t port_id;
> > +	struct rte_cfgfile *cfg = NULL;
> > +	char *config_file = NULL;
> >
> >  	signal(SIGINT, signal_handler);
> >  	signal(SIGTERM, signal_handler);
> >
> > +#ifdef RTE_LIBRTE_CFGFILE
> > +	/* load --cfgfile-path argument from argv */
> > +	config_file = cfgfile_load_path(argc, argv);
> > +
> > +	if (config_file) {
> > +		printf("Info: found cfgfile-path \"%s\"\n", config_file);
> > +	} else {
> > +		printf("Info: not found cfgfile-path parameter "
> > +				"(searching for cfgfile "
> > +				"in default directory)\n");
> > +		config_file = strdup("config.ini");
> > +	}
> > +	cfg = rte_cfgfile_load(config_file, CFG_FLAG_EMPTY_VALUES);
> > +	if (cfg == NULL)
> > +		printf("Info: Valid cfgfile not found\n");
> > +	rte_eal_configure(cfg);
> > +#endif
> > +
> Does it mean if RTE_LIBRTE_CFGFILE is defined, then the arguments are passed by Cfgfile, if no cfgfile
> will use config.ini by default? How about the legacy command lines?
> I think even cfgfile is good, we still need to keep the command line way.

If RTE_LIBRTE_CFGFILE is defined then arguments are passed both by cfgfile and command line. Command line arguments have priority over cfgfile arguments and they override their values.

> 
> >  	diag = rte_eal_init(argc, argv);
> >  	if (diag < 0)
> >  		rte_panic("Cannot init EAL\n");
> > @@ -2289,7 +2329,16 @@ uint8_t port_is_bonding_slave(portid_t slave_pid)
> >  	argc -= diag;
> >  	argv += diag;
> >  	if (argc > 1)
> > -		launch_args_parse(argc, argv);
> > +		launch_args_parse(argc, argv, cfg);
> > +
> 
> The argc and argv have been overwritten by cfgfile, right? Does it make sense to Pass cfg to
> launch_args_parse?

This function translate argv arguments into configuration file form and append/override current cfgfile.
Finally it parse application arguments from cfgfile. 
Intention was to parse arguments from single source (configuration file form).

> 
> 
> And you also need to update the testpmd doc to describe this new use.
> 
> Thanks
> Jingjing

      reply	other threads:[~2017-06-20 10:10 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30  8:30 [PATCH 0/3] Add support for using a config file for DPDK Jacek Piasecki
2017-05-30  8:30 ` [PATCH 1/3] cfgfile: add new API functions Jacek Piasecki
2017-05-31 14:20   ` Bruce Richardson
2017-05-31 14:22     ` Bruce Richardson
2017-06-26 10:59   ` [PATCH v2 0/7] Add support for using a config file for DPDK Jacek Piasecki
2017-06-26 10:59     ` [PATCH v2 1/7] cfgfile: remove EAL dependency Jacek Piasecki
2017-06-26 13:12       ` Dumitrescu, Cristian
2017-06-27 10:26       ` [PATCH v3 0/4] Rework cfgfile API to enable apps config file support Jacek Piasecki
2017-06-27 10:26         ` [PATCH v3 1/4] cfgfile: remove EAL dependency Jacek Piasecki
2017-06-30  9:44           ` Bruce Richardson
2017-06-30 11:16             ` Bruce Richardson
2017-06-27 10:26         ` [PATCH v3 2/4] cfgfile: add new functions to API Jacek Piasecki
2017-06-30  9:55           ` Bruce Richardson
2017-06-30 10:28           ` Bruce Richardson
2017-06-27 10:26         ` [PATCH v3 3/4] cfgfile: rework of load function Jacek Piasecki
2017-06-30 11:18           ` Bruce Richardson
2017-06-27 10:26         ` [PATCH v3 4/4] test/cfgfile: add new unit test Jacek Piasecki
2017-06-30 11:20         ` [PATCH v3 0/4] Rework cfgfile API to enable apps config file support Bruce Richardson
2017-06-26 10:59     ` [PATCH v2 2/7] cfgfile: add new functions to API Jacek Piasecki
2017-06-26 10:59     ` [PATCH v2 3/7] cfgfile: rework of load function Jacek Piasecki
2017-06-26 10:59     ` [PATCH v2 4/7] test/cfgfile: add new unit test Jacek Piasecki
2017-06-26 10:59     ` [PATCH v2 5/7] eal: add functions parsing EAL arguments Jacek Piasecki
2017-06-27 10:52       ` [PATCH v3 0/3] EAL change for using a config file for DPDK Jacek Piasecki
2017-06-27 10:52         ` [PATCH v3 1/3] eal: add functions parsing EAL arguments Jacek Piasecki
2017-06-30 16:04           ` Bruce Richardson
2017-07-10 12:44           ` [PATCH v4 0/5] Rework cfgfile API to enable apps config file support Jacek Piasecki
2017-07-10 12:44             ` [PATCH v4 1/5] cfgfile: remove EAL dependency Jacek Piasecki
2017-08-30 17:58               ` Bruce Richardson
2017-07-10 12:44             ` [PATCH v4 2/5] cfgfile: change existing API functions Jacek Piasecki
2017-08-30 20:07               ` Bruce Richardson
2017-07-10 12:44             ` [PATCH v4 3/5] cfgfile: add new functions to API Jacek Piasecki
2017-08-30 20:18               ` Bruce Richardson
2017-07-10 12:44             ` [PATCH v4 4/5] cfgfile: rework of load function Jacek Piasecki
2017-08-30 20:24               ` Bruce Richardson
2017-07-10 12:44             ` [PATCH v4 5/5] test/cfgfile: add new unit test Jacek Piasecki
2017-08-30 20:25               ` Bruce Richardson
2017-09-04  9:21                 ` Bruce Richardson
2017-09-04  9:30               ` Bruce Richardson
2017-09-15 13:56                 ` Thomas Monjalon
2017-09-18 13:49                   ` Jastrzebski, MichalX K
2017-07-10 15:13             ` [PATCH v4 0/5] Rework cfgfile API to enable apps config file support Thomas Monjalon
2017-07-20 21:48               ` Thomas Monjalon
2017-07-10 12:51           ` [PATCH v4 0/3] EAL change for using a config file for DPDK Kuba Kozak
2017-07-10 12:51             ` [PATCH v4 1/3] eal: add functions parsing EAL arguments Kuba Kozak
2017-07-13  9:26               ` [PATCH v5 0/3] EAL change for using a config file for DPDK Kuba Kozak
2017-07-13 10:07               ` Kuba Kozak
2017-07-13 10:07                 ` [PATCH v5 1/3] eal: add functions parsing EAL arguments Kuba Kozak
2017-07-13 10:07                 ` [PATCH v5 2/3] app/testpmd: add parse options from cfg file Kuba Kozak
2017-07-13 10:07                 ` [PATCH v5 3/3] app/testpmd: add parse options from JSON " Kuba Kozak
2019-01-23 19:31                 ` [PATCH v5 0/3] EAL change for using a config file for DPDK Ferruh Yigit
2019-01-23 20:26                   ` Thomas Monjalon
2019-01-24 13:54                     ` Ferruh Yigit
2019-01-24 14:32                       ` Thomas Monjalon
2019-01-24 14:46                         ` Ferruh Yigit
2019-01-24 16:06                           ` Thomas Monjalon
2019-01-24 16:18                             ` Ferruh Yigit
2019-01-24 17:45                               ` Thomas Monjalon
2019-01-28 14:43                                 ` Ferruh Yigit
2017-07-10 12:51             ` [PATCH v4 2/3] app/testpmd: add parse options from cfg file Kuba Kozak
2017-07-10 12:51             ` [PATCH v4 3/3] app/testpmd: add parse options from JSON " Kuba Kozak
2017-06-27 10:52         ` [PATCH v3 2/3] app/testpmd: changed example to parse options from " Jacek Piasecki
2017-06-27 10:52         ` [PATCH v3 3/3] app/testpmd: add parse arguments from JSON config file Jacek Piasecki
2017-07-05  0:00         ` [PATCH v3 0/3] EAL change for using a config file for DPDK Thomas Monjalon
2017-06-26 10:59     ` [PATCH v2 6/7] app/testpmd: changed example to parse options from cfg file Jacek Piasecki
2017-06-26 10:59     ` [PATCH v2 7/7] app/testpmd: add parse arguments from JSON config file Jacek Piasecki
2017-05-30  8:30 ` [PATCH 2/3] eal: add functions parsing EAL arguments Jacek Piasecki
2017-05-31 15:46   ` Bruce Richardson
2017-05-30  8:30 ` [PATCH 3/3] app/testpmd: changed example to parse options from cfg file Jacek Piasecki
2017-06-20  2:13   ` Wu, Jingjing
2017-06-20 10:10     ` Kozak, KubaX [this message]

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=F6B2DFED41632040B39446096019FF8E6E1277@HASMSX106.ger.corp.intel.com \
    --to=kubax.kozak@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=jacekx.piasecki@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=michalx.k.jastrzebski@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.