From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id E73F29183 for ; Wed, 2 Aug 2017 17:23:27 +0200 (CEST) Received: by mail-wm0-f54.google.com with SMTP id t201so44559995wmt.1 for ; Wed, 02 Aug 2017 08:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=t72dAli2xgN1znakXKIfA+mkqHSjG/0HZZTo87m0+so=; b=y5EUF7l2TuuHuQGEsyGogoq60maWWdQXdm3GeU6bc882rrlaI4JAY31csAg61PpjJU Bvr0qBrGe3j2xP6SQ62CE3ArJxkJEUfveXRkA/DopPQnP7AXuo+k3K9banYm4MKxlvT+ bV7n2/4jigx4vg30Xef2ioT+l+mrYVKJ7YKcXcbupFvLq45kHkBb9frnnieUDbRz1T3r U23bQbMFQJ8TVZ1b59Dg/EXPElaUJI9a+2DgaSL0mBd//c14Kr3swiFrODysgIFwRtp4 MCVkyyUsqSHnWkzUa1tuTMNMsqxCIkO8FhJIP/o4TmQmArkJyGrFC5j2GVPYxY38u7cu NwvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=t72dAli2xgN1znakXKIfA+mkqHSjG/0HZZTo87m0+so=; b=VSTr6iqMvXTp7RcM5/xiQ7HTBFUcxXr/feKnwvnLfUXRI5T6fTx+VccKKVNB6Gh6ZA vbVK7jD8NUC6IxxfoDK9DWXx2oAUvfk95LAdmDR1QQ60KT+vW0hhoS53oYD8pYGO6sGy beDSdr2pjzuEHnXufGd3dkADkL/EPp7g8CWf5u2nkrdHS29v21Nb9Oe7TVIr3GGbKM2g APnvuUEdSaqfYD1z7/2GUbox3UQvhBdlLz8nAd+/00vwq4j9w2+Kpm1MSSzscto9Cvh8 tH76nufo6LaoBJV7i5b8M6LPemHKGXuMhiMOdThaL0dRNP3nkEnyzxO1VEFUsXKcvmPb 554Q== X-Gm-Message-State: AIVw1112gDJFDjxpx9cCYT6acFIdxSdWmxEHTbR5qXGivDJqEWK6w91L gD7+dJH7xLc6ZWXfKsI= X-Received: by 10.28.88.143 with SMTP id m137mr3867881wmb.71.1501687407350; Wed, 02 Aug 2017 08:23:27 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id h18sm2091189wme.3.2017.08.02.08.23.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2017 08:23:26 -0700 (PDT) Date: Wed, 2 Aug 2017 17:23:17 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Thomas Monjalon Cc: dev@dpdk.org, Dirk-Holger Lenz Message-ID: <20170802152317.GC8124@bidouze.vm.6wind.com> References: <12b23f229a5a3b953c1c6063e5a381800f4ccdb9.1501611129.git.gaetan.rivet@6wind.com> <3126300.2FJSgUKTSm@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3126300.2FJSgUKTSm@xps> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2] eal: read and parse device option separately 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: Wed, 02 Aug 2017 15:23:28 -0000 On Wed, Aug 02, 2017 at 04:29:13PM +0200, Thomas Monjalon wrote: > 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(). > Okay, will simplify. > > +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. > Will do. > Thanks for the important fix! -- Gaëtan Rivet 6WIND