DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Gaetan Rivet <gaetan.rivet@6wind.com>
Cc: dev@dpdk.org, Dirk-Holger Lenz <dirk.lenz@ng4t.com>
Subject: Re: [dpdk-dev] [PATCH v2] eal: read and parse device option separately
Date: Wed, 02 Aug 2017 16:29:13 +0200	[thread overview]
Message-ID: <3126300.2FJSgUKTSm@xps> (raw)
In-Reply-To: <b47e4c8217d5d52f48d6d6045f4a6a1e91ccb984.1501664002.git.gaetan.rivet@6wind.com>

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 <gaetan.rivet@6wind.com>
> ---
> 
> 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!

  reply	other threads:[~2017-08-02 14:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 18:13 [dpdk-dev] [PATCH] " Gaetan Rivet
2017-08-02  8:56 ` [dpdk-dev] [PATCH v2] " Gaetan Rivet
2017-08-02 14:29   ` Thomas Monjalon [this message]
2017-08-02 15:23     ` Gaëtan Rivet
2017-08-02 17:10   ` [dpdk-dev] [PATCH v3] " Gaetan Rivet
2017-08-03 17:57     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3126300.2FJSgUKTSm@xps \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=dirk.lenz@ng4t.com \
    --cc=gaetan.rivet@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).