From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id D99FE2C8 for ; Tue, 20 Jun 2017 12:10:31 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2017 03:10:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,364,1493708400"; d="scan'208";a="115265194" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga005.jf.intel.com with ESMTP; 20 Jun 2017 03:10:30 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 20 Jun 2017 03:10:30 -0700 Received: from lcsmsx153.ger.corp.intel.com (10.186.165.228) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 20 Jun 2017 03:10:29 -0700 Received: from hasmsx106.ger.corp.intel.com ([169.254.10.208]) by LCSMSX153.ger.corp.intel.com ([169.254.8.185]) with mapi id 14.03.0319.002; Tue, 20 Jun 2017 13:10:27 +0300 From: "Kozak, KubaX" To: "Wu, Jingjing" , "dev@dpdk.org" CC: "Richardson, Bruce" , "Jain, Deepak K" , "Jastrzebski, MichalX K" , "Piasecki, JacekX" Thread-Topic: [dpdk-dev] [PATCH 3/3] app/testpmd: changed example to parse options from cfg file Thread-Index: AQHS6WrW5+Uqg2FVqE+xWa7RmvJRjaIth3dA Date: Tue, 20 Jun 2017 10:10:26 +0000 Message-ID: References: <1496133037-3014-1-git-send-email-jacekx.piasecki@intel.com> <1496133037-3014-4-git-send-email-jacekx.piasecki@intel.com> <9BB6961774997848B5B42BEC655768F810DAA55B@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <9BB6961774997848B5B42BEC655768F810DAA55B@SHSMSX103.ccr.corp.intel.com> Accept-Language: pl-PL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.103.102.50] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 3/3] app/testpmd: changed example to parse options from cfg file 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: Tue, 20 Jun 2017 10:10:32 -0000 Comments inline. Best regards, Kuba Kozak > -----Original Message----- > From: Wu, Jingjing > Sent: Tuesday, June 20, 2017 04:14 > To: Piasecki, JacekX ; dev@dpdk.org > Cc: Richardson, Bruce ; Jain, Deepak K ; > Jastrzebski, MichalX K ; Kozak, KubaX > Subject: RE: [dpdk-dev] [PATCH 3/3] app/testpmd: changed example to parse= options from cfg file >=20 > > + > > +#ifdef RTE_LIBRTE_CFGFILE > > +/* Load config file path from command line */ static char * > > +cfgfile_load_path(int argc, char **argv) { > > + int i; > > + > > + for (i =3D 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. >=20 > > int > > main(int argc, char** argv) > > { > > int diag; > > uint8_t port_id; > > + struct rte_cfgfile *cfg =3D NULL; > > + char *config_file =3D NULL; > > > > signal(SIGINT, signal_handler); > > signal(SIGTERM, signal_handler); > > > > +#ifdef RTE_LIBRTE_CFGFILE > > + /* load --cfgfile-path argument from argv */ > > + config_file =3D 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 =3D strdup("config.ini"); > > + } > > + cfg =3D rte_cfgfile_load(config_file, CFG_FLAG_EMPTY_VALUES); > > + if (cfg =3D=3D 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 pas= sed 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 argumen= ts and they override their values. >=20 > > diag =3D 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 -=3D diag; > > argv +=3D diag; > > if (argc > 1) > > - launch_args_parse(argc, argv); > > + launch_args_parse(argc, argv, cfg); > > + >=20 > The argc and argv have been overwritten by cfgfile, right? Does it make s= ense to Pass cfg to > launch_args_parse? This function translate argv arguments into configuration file form and app= end/override current cfgfile. Finally it parse application arguments from cfgfile.=20 Intention was to parse arguments from single source (configuration file for= m). >=20 >=20 > And you also need to update the testpmd doc to describe this new use. >=20 > Thanks > Jingjing