lib/env_dpdk: Add support for vfio-vf-token parameter
The kernel vfio_pci driver module introduced vf_token checking mechanism since kernel version 5.7, and has been supported by DPDK. So add support for it to deal with the scenario of VF. Signed-off-by: Jun Zeng <jun1.zeng@intel.com> Change-Id: Ie9700fa395327da4e847c6213167284c148a64e3 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14424 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
dda78a882f
commit
86431df168
@ -62,6 +62,7 @@ struct spdk_env_opts {
|
|||||||
|
|
||||||
/** Opaque context for use of the env implementation. */
|
/** Opaque context for use of the env implementation. */
|
||||||
void *env_context;
|
void *env_context;
|
||||||
|
const char *vf_token;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,8 +157,14 @@ struct spdk_app_opts {
|
|||||||
* If non-NULL, a string array of allowed RPC methods.
|
* If non-NULL, a string array of allowed RPC methods.
|
||||||
*/
|
*/
|
||||||
const char **rpc_allowlist;
|
const char **rpc_allowlist;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to pass vf_token to vfio_pci driver through DPDK.
|
||||||
|
* The vf_token is an UUID that shared between SR-IOV PF and VF.
|
||||||
|
*/
|
||||||
|
const char *vf_token;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
SPDK_STATIC_ASSERT(sizeof(struct spdk_app_opts) == 208, "Incorrect size");
|
SPDK_STATIC_ASSERT(sizeof(struct spdk_app_opts) == 216, "Incorrect size");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the default value of opts
|
* Initialize the default value of opts
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
|
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
|
||||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||||
|
|
||||||
SO_VER := 10
|
SO_VER := 11
|
||||||
SO_MINOR := 0
|
SO_MINOR := 0
|
||||||
|
|
||||||
CFLAGS += $(ENV_CFLAGS)
|
CFLAGS += $(ENV_CFLAGS)
|
||||||
|
@ -459,6 +459,15 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --vfio-vf-token used for VF initialized by vfio_pci driver. */
|
||||||
|
if (opts->vf_token) {
|
||||||
|
args = push_arg(args, &argcount, _sprintf_alloc("--vfio-vf-token=%s",
|
||||||
|
opts->vf_token));
|
||||||
|
if (args == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_eal_cmdline = args;
|
g_eal_cmdline = args;
|
||||||
|
@ -125,7 +125,9 @@ static const struct option g_cmdline_options[] = {
|
|||||||
#define DISABLE_CPUMASK_LOCKS_OPT_IDX 267
|
#define DISABLE_CPUMASK_LOCKS_OPT_IDX 267
|
||||||
{"disable-cpumask-locks", no_argument, NULL, DISABLE_CPUMASK_LOCKS_OPT_IDX},
|
{"disable-cpumask-locks", no_argument, NULL, DISABLE_CPUMASK_LOCKS_OPT_IDX},
|
||||||
#define RPCS_ALLOWED_OPT_IDX 268
|
#define RPCS_ALLOWED_OPT_IDX 268
|
||||||
{"rpcs-allowed", required_argument, NULL, RPCS_ALLOWED_OPT_IDX}
|
{"rpcs-allowed", required_argument, NULL, RPCS_ALLOWED_OPT_IDX},
|
||||||
|
#define ENV_VF_TOKEN_OPT_IDX 269
|
||||||
|
{"vfio-vf-token", required_argument, NULL, ENV_VF_TOKEN_OPT_IDX},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -337,6 +339,7 @@ app_setup_env(struct spdk_app_opts *opts)
|
|||||||
env_opts.base_virtaddr = opts->base_virtaddr;
|
env_opts.base_virtaddr = opts->base_virtaddr;
|
||||||
env_opts.env_context = opts->env_context;
|
env_opts.env_context = opts->env_context;
|
||||||
env_opts.iova_mode = opts->iova_mode;
|
env_opts.iova_mode = opts->iova_mode;
|
||||||
|
env_opts.vf_token = opts->vf_token;
|
||||||
|
|
||||||
rc = spdk_env_init(&env_opts);
|
rc = spdk_env_init(&env_opts);
|
||||||
free(env_opts.pci_blocked);
|
free(env_opts.pci_blocked);
|
||||||
@ -516,10 +519,11 @@ app_copy_opts(struct spdk_app_opts *opts, struct spdk_app_opts *opts_user, size_
|
|||||||
SET_FIELD(disable_signal_handlers);
|
SET_FIELD(disable_signal_handlers);
|
||||||
SET_FIELD(msg_mempool_size);
|
SET_FIELD(msg_mempool_size);
|
||||||
SET_FIELD(rpc_allowlist);
|
SET_FIELD(rpc_allowlist);
|
||||||
|
SET_FIELD(vf_token);
|
||||||
|
|
||||||
/* You should not remove this statement, but need to update the assert statement
|
/* You should not remove this statement, but need to update the assert statement
|
||||||
* if you add a new field, and also add a corresponding SET_FIELD statement */
|
* if you add a new field, and also add a corresponding SET_FIELD statement */
|
||||||
SPDK_STATIC_ASSERT(sizeof(struct spdk_app_opts) == 208, "Incorrect size");
|
SPDK_STATIC_ASSERT(sizeof(struct spdk_app_opts) == 216, "Incorrect size");
|
||||||
|
|
||||||
#undef SET_FIELD
|
#undef SET_FIELD
|
||||||
}
|
}
|
||||||
@ -872,6 +876,7 @@ usage(void (*app_usage)(void))
|
|||||||
SPDK_APP_DEFAULT_NUM_TRACE_ENTRIES);
|
SPDK_APP_DEFAULT_NUM_TRACE_ENTRIES);
|
||||||
printf(" --rpcs-allowed comma-separated list of permitted RPCS\n");
|
printf(" --rpcs-allowed comma-separated list of permitted RPCS\n");
|
||||||
printf(" --env-context Opaque context for use of the env implementation\n");
|
printf(" --env-context Opaque context for use of the env implementation\n");
|
||||||
|
printf(" --vfio-vf-token VF token (UUID) shared between SR-IOV PF and VFs for vfio_pci driver\n");
|
||||||
spdk_log_usage(stdout, "-L");
|
spdk_log_usage(stdout, "-L");
|
||||||
spdk_trace_mask_usage(stdout, "-e");
|
spdk_trace_mask_usage(stdout, "-e");
|
||||||
if (app_usage) {
|
if (app_usage) {
|
||||||
@ -1129,6 +1134,9 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ENV_VF_TOKEN_OPT_IDX:
|
||||||
|
opts->vf_token = optarg;
|
||||||
|
break;
|
||||||
case VERSION_OPT_IDX:
|
case VERSION_OPT_IDX:
|
||||||
printf(SPDK_VERSION_STRING"\n");
|
printf(SPDK_VERSION_STRING"\n");
|
||||||
retval = SPDK_APP_PARSE_ARGS_HELP;
|
retval = SPDK_APP_PARSE_ARGS_HELP;
|
||||||
|
Loading…
Reference in New Issue
Block a user