From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 04C8A20AA4; Wed, 2 Aug 2017 10:29:15 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 02 Aug 2017 10:29:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=iT60NhztuPqb1uq TA4p5Znd1jr5oR8GOPnEoApMzJhw=; b=MqrXQMjB2B78wHbkEd8rlJlYiwZSsVv KfAg5W3X/CWdrF70KtCi/Z1W/NmpC7MJ5ElEGBSgp+8XJn6B7pfHS5jTlpF+sWlk hk0GfTB1UXjhHsZ/vUL6lB6kEFhLsdC1esXRbi3Ab5lIw+ppc2ZR3uYJxTgQojfS 3zfXejPUqYSo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=iT60NhztuPqb1uqTA4p5Znd1jr5oR8GOPnEoApMzJhw=; b=qyyTg6e5 VL28zePkOJmvJuC0kvEp6Ss63FBvLtAmWGiDc+in7OQKOtajvVKPUuEcx9oQW+wq eyUpjLZ+cNOF8/Hh03xiU3nwCfczvX11Jz/syy8nOsG14CMG5Tej2EH9qD7lJLbX o1VS7xWpNOQVEMfANh3eYpG1YDMpeVk+4kQBs9G6jrMWA5en1REQgZ8ZfVYMsbS2 DBLDlB91dAiGL0MNxkLGG+SJlxdtfc24upR75tHLnlm7E/Ds6+CmusmsVGE0VWV3 5K1tqH56q82gXshFXEFO/hah5lre782Zol7MfKRNcvQjf5IwOz03fHNW8IF80h5U Hgn96mCEBnTpJQ== X-ME-Sender: X-Sasl-enc: Tmr7DOSQsfaGSMxiMPsmRaj9dXhv6hq2TbVcKTi47sJO 1501684154 Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id AED1924515; Wed, 2 Aug 2017 10:29:14 -0400 (EDT) From: Thomas Monjalon To: Gaetan Rivet Cc: dev@dpdk.org, Dirk-Holger Lenz Date: Wed, 02 Aug 2017 16:29:13 +0200 Message-ID: <3126300.2FJSgUKTSm@xps> In-Reply-To: References: <12b23f229a5a3b953c1c6063e5a381800f4ccdb9.1501611129.git.gaetan.rivet@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 14:29:16 -0000 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!