From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2] eal: read and parse device option separately Date: Wed, 02 Aug 2017 16:29:13 +0200 Message-ID: <3126300.2FJSgUKTSm@xps> References: <12b23f229a5a3b953c1c6063e5a381800f4ccdb9.1501611129.git.gaetan.rivet@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Dirk-Holger Lenz To: Gaetan Rivet Return-path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 333909B8B for ; Wed, 2 Aug 2017 16:29:15 +0200 (CEST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Gaetan 02/08/2017 10:56, Gaetan Rivet: > When the EAL parses the common options given to the application, > not all subsystems are available. Some device drivers are registered > afterward upon dynamic plugin loading. > > Devices using those drivers are thus unable to be parsed by any drivers > and are rejected. > > Store the device options first and keep them for later processing. > Parse these right before initializing the buses, the drivers must have > been stabilized at this point. > > Signed-off-by: Gaetan Rivet > --- > > v2: > > - Fix the -w / -b incompatibility check. > It was checking that no two incompatible rte_devargs were inserted. > As rte_devargs are now generated right before buses scan, this check > was always correct, even when it should have failed. You are doing this check in eal_check_common_options(). I think you can do the check earlier in eal_parse_common_option() with 2 static variables, instead of implementing the new function eal_option_device_type_count(). > +static unsigned int > +eal_option_device_type_count(enum rte_devtype type) [...] > @@ -944,14 +1013,14 @@ eal_parse_common_option(int opt, const char *optarg, > switch (opt) { > /* blacklist */ > case 'b': > - if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, > + if (eal_option_device_add(RTE_DEVTYPE_BLACKLISTED_PCI, > optarg) < 0) { > return -1; > } > break; > /* whitelist */ > case 'w': > - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, > + if (eal_option_device_add(RTE_DEVTYPE_WHITELISTED_PCI, > optarg) < 0) { > return -1; > } > @@ -1061,7 +1130,7 @@ eal_parse_common_option(int opt, const char *optarg, > break; > > case OPT_VDEV_NUM: > - if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, > + if (eal_option_device_add(RTE_DEVTYPE_VIRTUAL, > optarg) < 0) { > return -1; > } > @@ -1187,8 +1256,8 @@ eal_check_common_options(struct internal_config *internal_cfg) > return -1; > } > > - if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 0 && > - rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 0) { > + if (eal_option_device_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 0 && > + eal_option_device_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 0) { > RTE_LOG(ERR, EAL, "Options blacklist (-b) and whitelist (-w) " > "cannot be used at the same time\n"); > return -1; [...] > +static int > +eal_option_device_add(enum rte_devtype type, const char *optarg) > +{ > + struct device_option *deo; > + size_t optlen; Just a last comment about variable name: Instead of deo, opt or option would be more meaningful. Thanks for the important fix!