From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id E6DD82C13 for ; Tue, 20 Jun 2017 04:13:41 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP; 19 Jun 2017 19:13:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,363,1493708400"; d="scan'208";a="99601157" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 19 Jun 2017 19:13:40 -0700 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 19 Jun 2017 19:13:40 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 19 Jun 2017 19:13:40 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.197]) with mapi id 14.03.0319.002; Tue, 20 Jun 2017 10:13:37 +0800 From: "Wu, Jingjing" To: "Piasecki, JacekX" , "dev@dpdk.org" CC: "Richardson, Bruce" , "Jain, Deepak K" , "Jastrzebski, MichalX K" , "Kozak, KubaX" Thread-Topic: [dpdk-dev] [PATCH 3/3] app/testpmd: changed example to parse options from cfg file Thread-Index: AQHS2R/TXboFDkTFZUWepqfjfZWXUKItHqow Date: Tue, 20 Jun 2017 02:13:37 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810DAA55B@SHSMSX103.ccr.corp.intel.com> References: <1496133037-3014-1-git-send-email-jacekx.piasecki@intel.com> <1496133037-3014-4-git-send-email-jacekx.piasecki@intel.com> In-Reply-To: <1496133037-3014-4-git-send-email-jacekx.piasecki@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] 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 02:13:42 -0000 > + > +#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 E= AL's? Where is it supposed to be located? > int > main(int argc, char** argv) > { > int diag; > uint8_t port_id; > + struct rte_cfgfile *cfg =3D NULL; > + char *config_file =3D NULL; >=20 > signal(SIGINT, signal_handler); > signal(SIGTERM, signal_handler); >=20 > +#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 passe= d 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. > 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); > + The argc and argv have been overwritten by cfgfile, right? Does it make sen= se to Pass cfg to launch_args_parse? And you also need to update the testpmd doc to describe this new use. Thanks Jingjing