event: accept negative --shm-id as a valid option
Before this change, a negative `--shm-id` value is rejected by `spdk_app_parse_args()` and this function simply errors out after detecting it. However, `build_eal_cmdline()` has a dedicated branch checking for a negative `opts->shm_id` and passes `--no-shconf` down to DPDK as a parameter, so we cannot disable the shared config support in DPDK. After this change, a negative value `--shm-id` is accepted, but if it cannot be parsed as an integer, `spdk_app_parse_args()` errors out as before. In result we can disable shared config support in DPDK by passing `--shm-id=-1` to SPDK application. Signed-off-by: Kefu Chai <tchaikov@gmail.com> Change-Id: Ibe089f13638eefa9ac28c5c99e303bcc3102f307 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14097 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
dd3460582b
commit
5a6f3a6f91
@ -750,6 +750,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
|
||||
int ch, rc, opt_idx, global_long_opts_len, app_long_opts_len;
|
||||
struct option *cmdline_options;
|
||||
char *cmdline_short_opts = NULL;
|
||||
char *shm_id_str = NULL;
|
||||
enum spdk_app_parse_args_rvals retval = SPDK_APP_PARSE_ARGS_FAIL;
|
||||
long int tmp;
|
||||
|
||||
@ -822,11 +823,22 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
|
||||
retval = SPDK_APP_PARSE_ARGS_HELP;
|
||||
goto out;
|
||||
case SHM_ID_OPT_IDX:
|
||||
opts->shm_id = spdk_strtol(optarg, 0);
|
||||
shm_id_str = optarg;
|
||||
/* a negative shm-id disables shared configuration file */
|
||||
if (optarg[0] == '-') {
|
||||
shm_id_str++;
|
||||
}
|
||||
/* check if the positive value of provided shm_id can be parsed as
|
||||
* an integer
|
||||
*/
|
||||
opts->shm_id = spdk_strtol(shm_id_str, 0);
|
||||
if (opts->shm_id < 0) {
|
||||
SPDK_ERRLOG("Invalid shared memory ID %s\n", optarg);
|
||||
goto out;
|
||||
}
|
||||
if (optarg[0] == '-') {
|
||||
opts->shm_id = -opts->shm_id;
|
||||
}
|
||||
break;
|
||||
case CPUMASK_OPT_IDX:
|
||||
opts->reactor_mask = optarg;
|
||||
|
Loading…
Reference in New Issue
Block a user