> +
> +#ifdef RTE_LIBRTE_CFGFILE
> +/* Load config file path from command line */ static char *
> +cfgfile_load_path(int argc, char **argv) {
> +     int i;
> +
> +     for (i = 0; i < argc; i++) {
> +             if (!strcmp("--cfgfile-path", argv[i])) {
> +                     if (i < argc)
> +                             return strdup(argv[i+1]);
> +             }
> +     }
> +     return 0;
> +}
> +#endif
> +
It is a little confused. Is the cfgfile-path is application's argument or EAL's?
Where is it supposed to be located?

>  int
>  main(int argc, char** argv)
>  {
>       int  diag;
>       uint8_t port_id;
> +     struct rte_cfgfile *cfg = NULL;
> +     char *config_file = NULL;
> 
>       signal(SIGINT, signal_handler);
>       signal(SIGTERM, signal_handler);
> 
> +#ifdef RTE_LIBRTE_CFGFILE
> +     /* load --cfgfile-path argument from argv */
> +     config_file = cfgfile_load_path(argc, argv);
> +
> +     if (config_file) {
> +             printf("Info: found cfgfile-path \"%s\"\n", config_file);
> +     } else {
> +             printf("Info: not found cfgfile-path parameter "
> +                             "(searching for cfgfile "
> +                             "in default directory)\n");
> +             config_file = strdup("config.ini");
> +     }
> +     cfg = rte_cfgfile_load(config_file, CFG_FLAG_EMPTY_VALUES);
> +     if (cfg == NULL)
> +             printf("Info: Valid cfgfile not found\n");
> +     rte_eal_configure(cfg);
> +#endif
> +
Does it mean if RTE_LIBRTE_CFGFILE is defined, then the arguments are passed by
Cfgfile, if no cfgfile will use config.ini by default? How about the legacy 
command lines?
I think even cfgfile is good, we still need to keep the command line way.

>       diag = rte_eal_init(argc, argv);
>       if (diag < 0)
>               rte_panic("Cannot init EAL\n");
> @@ -2289,7 +2329,16 @@ uint8_t port_is_bonding_slave(portid_t slave_pid)
>       argc -= diag;
>       argv += diag;
>       if (argc > 1)
> -             launch_args_parse(argc, argv);
> +             launch_args_parse(argc, argv, cfg);
> +

The argc and argv have been overwritten by cfgfile, right? Does it make sense to
Pass cfg to  launch_args_parse?


And you also need to update the testpmd doc to describe this new use.

Thanks
Jingjing

Reply via email to