[dpdk-dev] [PATCH v2] eal: read and parse device option separately
Thomas Monjalon
thomas at monjalon.net
Wed Aug 2 16:29:13 CEST 2017
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 at 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!
More information about the dev
mailing list