[dpdk-dev] [PATCH] eal: parse args before any kinds of init

Thomas Monjalon thomas.monjalon at 6wind.com
Mon May 5 17:50:15 CEST 2014


2014-04-15 11:03, Wang Sheng-Hui:
> Parse args first, to resolve any invalid args and give out the usage string.
> E.g './helloworld --invalid', the '--invalid' will be checked before any
> init. After the options are checked, take any init actions.
> 
> Signed-off-by: Wang Sheng-Hui <shhuiw at gmail.com>
[...]
> @@ -637,6 +637,11 @@ eal_parse_args(int argc, char **argv)
>         };
>         struct shared_driver *solib;
> 
> +       /* check the no args case */
> +       if (argc == 1) {
> +               eal_usage(prgname);
> +               return (-1);
> +       }
>         argvopt = argv;

I wonder if there are some use cases where default values could be used for 
first tests.
If we can set some default values for coremask and memory channels, then we 
can accept having no argument.
Maybe that an option -h would be needed.

> @@ -964,16 +969,16 @@ rte_eal_init(int argc, char **argv)
> 
>         thread_id = pthread_self();
> 
> +       fctret = eal_parse_args(argc, argv);
> +       if (fctret < 0)
> +               exit(1);
> +
>         if (rte_eal_log_early_init() < 0)
>                 rte_panic("Cannot init early logs\n");
> 
>         if (rte_eal_cpu_init() < 0)
>                 rte_panic("Cannot detect lcores\n");
> 
> -       fctret = eal_parse_args(argc, argv);
> -       if (fctret < 0)
> -               exit(1);
> -
>         if (internal_config.no_hugetlbfs == 0 &&
>                         internal_config.process_type != RTE_PROC_SECONDARY
> && internal_config.xen_dom0_support == 0 &&

You should move eal_parse_args() just after rte_eal_log_early_init() in order 
to have logs available.

Could you send a v2 patch with this kind of change for BSD also.

Thank you
-- 
Thomas


More information about the dev mailing list