nvmf: remove tgt_opts from nvmf_tgt
This option is deprecated. Also, rename the rpc and configuration options for setting the opts to reflect that they now only set the max number of subsystems Change-Id: Iaabcbf33dd0a0dc489d81233fda74e9e7f3e0d2e Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/430161 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
70ef3d917f
commit
962ba4e89a
12
CHANGELOG.md
12
CHANGELOG.md
@ -2,6 +2,18 @@
|
|||||||
|
|
||||||
## v19.01: (Upcoming Release)
|
## v19.01: (Upcoming Release)
|
||||||
|
|
||||||
|
### NVMe-oF Target
|
||||||
|
|
||||||
|
The `spdk_nvmf_tgt_opts` struct has been deprecated in favor of `spdk_nvmf_transport_opts`.
|
||||||
|
Users will no longer be able to specify target wide I/O parameters. `spdk_nvmf_tgt_listen`
|
||||||
|
will also no longer implicitly initialize a transport with the default target options (since
|
||||||
|
there are none). Instead, a user must manually instantiate the transport with `spdk_nvmf_transport_create`
|
||||||
|
prior to calling `spdk_nvmf_tgt_listen`.
|
||||||
|
|
||||||
|
Related to the previous change, the rpc `set_nvmf_target_options` has been renamed to
|
||||||
|
`set_nvmf_target_max_subsystems` to indicate that this is the only target option available for the user to edit.
|
||||||
|
Usage of this rpc is still confined to the time prior to application subsystem initialization.
|
||||||
|
|
||||||
## v18.10:
|
## v18.10:
|
||||||
|
|
||||||
### nvme
|
### nvme
|
||||||
|
@ -3316,21 +3316,16 @@ Example response:
|
|||||||
}
|
}
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
## set_nvmf_target_options {#rpc_set_nvmf_target_options}
|
## set_nvmf_target_max_subsystems {#rpc_set_nvmf_target_max_subsystems}
|
||||||
|
|
||||||
Set global parameters for the NVMe-oF target. This RPC may only be called before SPDK subsystems
|
Set the maximum allowed subsystems for the NVMe-oF target. This RPC may only be called
|
||||||
have been initialized.
|
before SPDK subsystems have been initialized.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
Name | Optional | Type | Description
|
Name | Optional | Type | Description
|
||||||
----------------------- | -------- | ----------- | -----------
|
----------------------- | -------- | ----------- | -----------
|
||||||
max_queue_depth | Optional | number | Maximum number of outstanding I/Os per queue
|
max_subsystems | Required | number | Maximum number of NVMe-oF subsystems
|
||||||
max_qpairs_per_ctrlr | Optional | number | Maximum number of SQ and CQ per controller
|
|
||||||
in_capsule_data_size | Optional | number | Maximum number of in-capsule data size
|
|
||||||
max_io_size | Optional | number | Maximum I/O size (bytes)
|
|
||||||
max_subsystems | Optional | number | Maximum number of NVMe-oF subsystems
|
|
||||||
io_unit_size | Optional | number | I/O unit size (bytes)
|
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
@ -3339,13 +3334,8 @@ Example request:
|
|||||||
{
|
{
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"method": "set_nvmf_target_options",
|
"method": "set_nvmf_target_max_subsystems",
|
||||||
"params": {
|
"params": {
|
||||||
"in_capsule_data_size": 4096,
|
|
||||||
"io_unit_size": 131072,
|
|
||||||
"max_qpairs_per_ctrlr": 64,
|
|
||||||
"max_queue_depth": 128,
|
|
||||||
"max_io_size": 131072,
|
|
||||||
"max_subsystems": 1024
|
"max_subsystems": 1024
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,15 +63,6 @@ struct spdk_nvmf_poll_group;
|
|||||||
struct spdk_json_write_ctx;
|
struct spdk_json_write_ctx;
|
||||||
struct spdk_nvmf_transport;
|
struct spdk_nvmf_transport;
|
||||||
|
|
||||||
struct spdk_nvmf_tgt_opts {
|
|
||||||
uint16_t max_queue_depth;
|
|
||||||
uint16_t max_qpairs_per_ctrlr;
|
|
||||||
uint32_t in_capsule_data_size;
|
|
||||||
uint32_t max_io_size;
|
|
||||||
uint32_t max_subsystems;
|
|
||||||
uint32_t io_unit_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct spdk_nvmf_transport_opts {
|
struct spdk_nvmf_transport_opts {
|
||||||
uint16_t max_queue_depth;
|
uint16_t max_queue_depth;
|
||||||
uint16_t max_qpairs_per_ctrlr;
|
uint16_t max_qpairs_per_ctrlr;
|
||||||
@ -81,21 +72,14 @@ struct spdk_nvmf_transport_opts {
|
|||||||
uint32_t max_aq_depth;
|
uint32_t max_aq_depth;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the default value of opts.
|
|
||||||
*
|
|
||||||
* \param opts Data structure where SPDK will initialize the default options.
|
|
||||||
*/
|
|
||||||
void spdk_nvmf_tgt_opts_init(struct spdk_nvmf_tgt_opts *opts);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an NVMe-oF target.
|
* Construct an NVMe-oF target.
|
||||||
*
|
*
|
||||||
* \param opts Options.
|
* \param max_subsystems the maximum number of subsystems allowed by the target.
|
||||||
*
|
*
|
||||||
* \return a pointer to a NVMe-oF target on success, or NULL on failure.
|
* \return a pointer to a NVMe-oF target on success, or NULL on failure.
|
||||||
*/
|
*/
|
||||||
struct spdk_nvmf_tgt *spdk_nvmf_tgt_create(struct spdk_nvmf_tgt_opts *opts);
|
struct spdk_nvmf_tgt *spdk_nvmf_tgt_create(uint32_t max_subsystems);
|
||||||
|
|
||||||
typedef void (spdk_nvmf_tgt_destroy_done_fn)(void *ctx, int status);
|
typedef void (spdk_nvmf_tgt_destroy_done_fn)(void *ctx, int status);
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@
|
|||||||
|
|
||||||
#define SPDK_NVMF_MAX_NAMESPACES (1 << 14)
|
#define SPDK_NVMF_MAX_NAMESPACES (1 << 14)
|
||||||
|
|
||||||
struct spdk_nvmf_tgt_opts *g_spdk_nvmf_tgt_opts = NULL;
|
|
||||||
struct spdk_nvmf_tgt_conf *g_spdk_nvmf_tgt_conf = NULL;
|
struct spdk_nvmf_tgt_conf *g_spdk_nvmf_tgt_conf = NULL;
|
||||||
|
uint32_t g_spdk_nvmf_tgt_max_subsystems = 0;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_add_nvmf_discovery_subsystem(void)
|
spdk_add_nvmf_discovery_subsystem(void)
|
||||||
@ -64,38 +64,40 @@ spdk_add_nvmf_discovery_subsystem(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_nvmf_read_config_file_tgt_opts(struct spdk_conf_section *sp,
|
spdk_nvmf_read_config_file_tgt_max_subsystems(struct spdk_conf_section *sp,
|
||||||
struct spdk_nvmf_tgt_opts *opts)
|
int *deprecated_values)
|
||||||
{
|
{
|
||||||
int max_queue_depth;
|
int tgt_max_subsystems;
|
||||||
int max_queues_per_sess;
|
int deprecated;
|
||||||
int in_capsule_data_size;
|
|
||||||
int max_io_size;
|
|
||||||
int io_unit_size;
|
|
||||||
|
|
||||||
max_queue_depth = spdk_conf_section_get_intval(sp, "MaxQueueDepth");
|
tgt_max_subsystems = spdk_conf_section_get_intval(sp, "MaxSubsystems");
|
||||||
if (max_queue_depth >= 0) {
|
if (tgt_max_subsystems >= 0) {
|
||||||
opts->max_queue_depth = max_queue_depth;
|
g_spdk_nvmf_tgt_max_subsystems = tgt_max_subsystems;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_queues_per_sess = spdk_conf_section_get_intval(sp, "MaxQueuesPerSession");
|
deprecated = spdk_conf_section_get_intval(sp, "MaxQueueDepth");
|
||||||
if (max_queues_per_sess >= 0) {
|
if (deprecated >= 0) {
|
||||||
opts->max_qpairs_per_ctrlr = max_queues_per_sess;
|
*deprecated_values = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_capsule_data_size = spdk_conf_section_get_intval(sp, "InCapsuleDataSize");
|
deprecated = spdk_conf_section_get_intval(sp, "MaxQueuesPerSession");
|
||||||
if (in_capsule_data_size >= 0) {
|
if (deprecated >= 0) {
|
||||||
opts->in_capsule_data_size = in_capsule_data_size;
|
*deprecated_values = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_io_size = spdk_conf_section_get_intval(sp, "MaxIOSize");
|
deprecated = spdk_conf_section_get_intval(sp, "InCapsuleDataSize");
|
||||||
if (max_io_size >= 0) {
|
if (deprecated >= 0) {
|
||||||
opts->max_io_size = max_io_size;
|
*deprecated_values = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
io_unit_size = spdk_conf_section_get_intval(sp, "IOUnitSize");
|
deprecated = spdk_conf_section_get_intval(sp, "MaxIOSize");
|
||||||
if (io_unit_size >= 0) {
|
if (deprecated >= 0) {
|
||||||
opts->io_unit_size = io_unit_size;
|
*deprecated_values = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated = spdk_conf_section_get_intval(sp, "IOUnitSize");
|
||||||
|
if (deprecated >= 0) {
|
||||||
|
*deprecated_values = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,26 +113,18 @@ spdk_nvmf_read_config_file_tgt_conf(struct spdk_conf_section *sp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spdk_nvmf_tgt_opts *
|
static int
|
||||||
spdk_nvmf_parse_tgt_opts(void)
|
spdk_nvmf_parse_tgt_max_subsystems(void)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_tgt_opts *opts;
|
|
||||||
struct spdk_conf_section *sp;
|
struct spdk_conf_section *sp;
|
||||||
|
int deprecated_values = 0;
|
||||||
opts = calloc(1, sizeof(*opts));
|
|
||||||
if (!opts) {
|
|
||||||
SPDK_ERRLOG("calloc() failed for target options\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
spdk_nvmf_tgt_opts_init(opts);
|
|
||||||
|
|
||||||
sp = spdk_conf_find_section(NULL, "Nvmf");
|
sp = spdk_conf_find_section(NULL, "Nvmf");
|
||||||
if (sp != NULL) {
|
if (sp != NULL) {
|
||||||
spdk_nvmf_read_config_file_tgt_opts(sp, opts);
|
spdk_nvmf_read_config_file_tgt_max_subsystems(sp, &deprecated_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
return opts;
|
return deprecated_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spdk_nvmf_tgt_conf *
|
static struct spdk_nvmf_tgt_conf *
|
||||||
@ -160,12 +154,17 @@ static int
|
|||||||
spdk_nvmf_parse_nvmf_tgt(void)
|
spdk_nvmf_parse_nvmf_tgt(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
int using_deprecated_options;
|
||||||
|
|
||||||
if (!g_spdk_nvmf_tgt_opts) {
|
if (!g_spdk_nvmf_tgt_max_subsystems) {
|
||||||
g_spdk_nvmf_tgt_opts = spdk_nvmf_parse_tgt_opts();
|
using_deprecated_options = spdk_nvmf_parse_tgt_max_subsystems();
|
||||||
if (!g_spdk_nvmf_tgt_opts) {
|
if (using_deprecated_options < 0) {
|
||||||
SPDK_ERRLOG("spdk_nvmf_parse_tgt_opts() failed\n");
|
SPDK_ERRLOG("Deprecated options detected for the NVMe-oF target.\n"
|
||||||
return -1;
|
"The following options are no longer controlled by the target\n"
|
||||||
|
"and should be set in the transport on a per-transport basis:\n"
|
||||||
|
"MaxQueueDepth, MaxQueuesPerSession, InCapsuleDataSize, MaxIOSize, IOUnitSize\n"
|
||||||
|
"This can be accomplished by setting the options through the create_nvmf_transport RPC.\n"
|
||||||
|
"You may also continue to configure these options in the conf file under each transport.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,10 +176,9 @@ spdk_nvmf_parse_nvmf_tgt(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_spdk_nvmf_tgt = spdk_nvmf_tgt_create(g_spdk_nvmf_tgt_opts);
|
g_spdk_nvmf_tgt = spdk_nvmf_tgt_create(g_spdk_nvmf_tgt_max_subsystems);
|
||||||
|
|
||||||
free(g_spdk_nvmf_tgt_opts);
|
g_spdk_nvmf_tgt_max_subsystems = 0;
|
||||||
g_spdk_nvmf_tgt_opts = NULL;
|
|
||||||
|
|
||||||
if (!g_spdk_nvmf_tgt) {
|
if (!g_spdk_nvmf_tgt) {
|
||||||
SPDK_ERRLOG("spdk_nvmf_tgt_create() failed\n");
|
SPDK_ERRLOG("spdk_nvmf_tgt_create() failed\n");
|
||||||
|
@ -55,9 +55,10 @@ struct spdk_nvmf_tgt_conf {
|
|||||||
enum spdk_nvmf_connect_sched conn_sched;
|
enum spdk_nvmf_connect_sched conn_sched;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct spdk_nvmf_tgt_opts *g_spdk_nvmf_tgt_opts;
|
|
||||||
extern struct spdk_nvmf_tgt_conf *g_spdk_nvmf_tgt_conf;
|
extern struct spdk_nvmf_tgt_conf *g_spdk_nvmf_tgt_conf;
|
||||||
|
|
||||||
|
extern uint32_t g_spdk_nvmf_tgt_max_subsystems;
|
||||||
|
|
||||||
extern struct spdk_nvmf_tgt *g_spdk_nvmf_tgt;
|
extern struct spdk_nvmf_tgt *g_spdk_nvmf_tgt;
|
||||||
|
|
||||||
typedef void (*spdk_nvmf_parse_conf_done_fn)(int status);
|
typedef void (*spdk_nvmf_parse_conf_done_fn)(int status);
|
||||||
|
@ -1299,42 +1299,36 @@ SPDK_RPC_REGISTER("nvmf_subsystem_allow_any_host", nvmf_rpc_subsystem_allow_any_
|
|||||||
SPDK_RPC_RUNTIME)
|
SPDK_RPC_RUNTIME)
|
||||||
|
|
||||||
static const struct spdk_json_object_decoder nvmf_rpc_subsystem_tgt_opts_decoder[] = {
|
static const struct spdk_json_object_decoder nvmf_rpc_subsystem_tgt_opts_decoder[] = {
|
||||||
{"max_queue_depth", offsetof(struct spdk_nvmf_tgt_opts, max_queue_depth), spdk_json_decode_uint16, true},
|
{"max_subsystems", 0, spdk_json_decode_uint32, true}
|
||||||
{"max_qpairs_per_ctrlr", offsetof(struct spdk_nvmf_tgt_opts, max_qpairs_per_ctrlr), spdk_json_decode_uint16, true},
|
|
||||||
{"in_capsule_data_size", offsetof(struct spdk_nvmf_tgt_opts, in_capsule_data_size), spdk_json_decode_uint32, true},
|
|
||||||
{"max_io_size", offsetof(struct spdk_nvmf_tgt_opts, max_io_size), spdk_json_decode_uint32, true},
|
|
||||||
{"max_subsystems", offsetof(struct spdk_nvmf_tgt_opts, max_subsystems), spdk_json_decode_uint32, true},
|
|
||||||
{"io_unit_size", offsetof(struct spdk_nvmf_tgt_opts, io_unit_size), spdk_json_decode_uint32, true},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nvmf_rpc_subsystem_set_tgt_opts(struct spdk_jsonrpc_request *request,
|
nvmf_rpc_subsystem_set_tgt_opts(struct spdk_jsonrpc_request *request,
|
||||||
const struct spdk_json_val *params)
|
const struct spdk_json_val *params)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_tgt_opts *opts;
|
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_REQUEST,
|
||||||
struct spdk_json_write_ctx *w;
|
"This function has been deprecated in favor of set_nvmf_target_max_subsystems and create_nvmf_transport");
|
||||||
|
}
|
||||||
|
SPDK_RPC_REGISTER("set_nvmf_target_options", nvmf_rpc_subsystem_set_tgt_opts,
|
||||||
|
SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)
|
||||||
|
|
||||||
if (g_spdk_nvmf_tgt_opts != NULL) {
|
static void
|
||||||
|
nvmf_rpc_subsystem_set_tgt_max_subsystems(struct spdk_jsonrpc_request *request,
|
||||||
|
const struct spdk_json_val *params)
|
||||||
|
{
|
||||||
|
struct spdk_json_write_ctx *w;
|
||||||
|
uint32_t max_subsystems = 0;
|
||||||
|
|
||||||
|
if (g_spdk_nvmf_tgt_max_subsystems != 0) {
|
||||||
SPDK_ERRLOG("this RPC must not be called more than once.\n");
|
SPDK_ERRLOG("this RPC must not be called more than once.\n");
|
||||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
|
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
|
||||||
"Must not call more than once");
|
"Must not call more than once");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
opts = calloc(1, sizeof(*opts));
|
|
||||||
if (opts == NULL) {
|
|
||||||
SPDK_ERRLOG("malloc() failed for target options\n");
|
|
||||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
|
|
||||||
"Out of memory");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
spdk_nvmf_tgt_opts_init(opts);
|
|
||||||
|
|
||||||
if (params != NULL) {
|
if (params != NULL) {
|
||||||
if (spdk_json_decode_object(params, nvmf_rpc_subsystem_tgt_opts_decoder,
|
if (spdk_json_decode_object(params, nvmf_rpc_subsystem_tgt_opts_decoder,
|
||||||
SPDK_COUNTOF(nvmf_rpc_subsystem_tgt_opts_decoder), opts)) {
|
SPDK_COUNTOF(nvmf_rpc_subsystem_tgt_opts_decoder), &max_subsystems)) {
|
||||||
free(opts);
|
|
||||||
SPDK_ERRLOG("spdk_json_decode_object() failed\n");
|
SPDK_ERRLOG("spdk_json_decode_object() failed\n");
|
||||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||||
"Invalid parameters");
|
"Invalid parameters");
|
||||||
@ -1342,7 +1336,7 @@ nvmf_rpc_subsystem_set_tgt_opts(struct spdk_jsonrpc_request *request,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_spdk_nvmf_tgt_opts = opts;
|
g_spdk_nvmf_tgt_max_subsystems = max_subsystems;
|
||||||
|
|
||||||
w = spdk_jsonrpc_begin_result(request);
|
w = spdk_jsonrpc_begin_result(request);
|
||||||
if (w == NULL) {
|
if (w == NULL) {
|
||||||
@ -1352,7 +1346,8 @@ nvmf_rpc_subsystem_set_tgt_opts(struct spdk_jsonrpc_request *request,
|
|||||||
spdk_json_write_bool(w, true);
|
spdk_json_write_bool(w, true);
|
||||||
spdk_jsonrpc_end_result(request, w);
|
spdk_jsonrpc_end_result(request, w);
|
||||||
}
|
}
|
||||||
SPDK_RPC_REGISTER("set_nvmf_target_options", nvmf_rpc_subsystem_set_tgt_opts, SPDK_RPC_STARTUP)
|
SPDK_RPC_REGISTER("set_nvmf_target_max_subsystems", nvmf_rpc_subsystem_set_tgt_max_subsystems,
|
||||||
|
SPDK_RPC_STARTUP)
|
||||||
|
|
||||||
static int decode_conn_sched(const struct spdk_json_val *val, void *out)
|
static int decode_conn_sched(const struct spdk_json_val *val, void *out)
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ nvmf_update_discovery_log(struct spdk_nvmf_tgt *tgt)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (sid = 0; sid < tgt->opts.max_subsystems; sid++) {
|
for (sid = 0; sid < tgt->max_subsystems; sid++) {
|
||||||
subsystem = tgt->subsystems[sid];
|
subsystem = tgt->subsystems[sid];
|
||||||
if (subsystem == NULL) {
|
if (subsystem == NULL) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -49,12 +49,7 @@
|
|||||||
|
|
||||||
SPDK_LOG_REGISTER_COMPONENT("nvmf", SPDK_LOG_NVMF)
|
SPDK_LOG_REGISTER_COMPONENT("nvmf", SPDK_LOG_NVMF)
|
||||||
|
|
||||||
#define SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH 128
|
|
||||||
#define SPDK_NVMF_DEFAULT_MAX_QPAIRS_PER_CTRLR 64
|
|
||||||
#define SPDK_NVMF_DEFAULT_IN_CAPSULE_DATA_SIZE 4096
|
|
||||||
#define SPDK_NVMF_DEFAULT_MAX_IO_SIZE 131072
|
|
||||||
#define SPDK_NVMF_DEFAULT_MAX_SUBSYSTEMS 1024
|
#define SPDK_NVMF_DEFAULT_MAX_SUBSYSTEMS 1024
|
||||||
#define SPDK_NVMF_DEFAULT_IO_UNIT_SIZE 131072
|
|
||||||
|
|
||||||
typedef void (*nvmf_qpair_disconnect_cpl)(void *ctx, int status);
|
typedef void (*nvmf_qpair_disconnect_cpl)(void *ctx, int status);
|
||||||
static void spdk_nvmf_tgt_destroy_poll_group(void *io_device, void *ctx_buf);
|
static void spdk_nvmf_tgt_destroy_poll_group(void *io_device, void *ctx_buf);
|
||||||
@ -91,17 +86,6 @@ spdk_nvmf_qpair_set_state(struct spdk_nvmf_qpair *qpair,
|
|||||||
qpair->state = state;
|
qpair->state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
spdk_nvmf_tgt_opts_init(struct spdk_nvmf_tgt_opts *opts)
|
|
||||||
{
|
|
||||||
opts->max_queue_depth = SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH;
|
|
||||||
opts->max_qpairs_per_ctrlr = SPDK_NVMF_DEFAULT_MAX_QPAIRS_PER_CTRLR;
|
|
||||||
opts->in_capsule_data_size = SPDK_NVMF_DEFAULT_IN_CAPSULE_DATA_SIZE;
|
|
||||||
opts->max_io_size = SPDK_NVMF_DEFAULT_MAX_IO_SIZE;
|
|
||||||
opts->max_subsystems = SPDK_NVMF_DEFAULT_MAX_SUBSYSTEMS;
|
|
||||||
opts->io_unit_size = SPDK_NVMF_DEFAULT_IO_UNIT_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_nvmf_poll_group_poll(void *ctx)
|
spdk_nvmf_poll_group_poll(void *ctx)
|
||||||
{
|
{
|
||||||
@ -136,13 +120,13 @@ spdk_nvmf_tgt_create_poll_group(void *io_device, void *ctx_buf)
|
|||||||
spdk_nvmf_poll_group_add_transport(group, transport);
|
spdk_nvmf_poll_group_add_transport(group, transport);
|
||||||
}
|
}
|
||||||
|
|
||||||
group->num_sgroups = tgt->opts.max_subsystems;
|
group->num_sgroups = tgt->max_subsystems;
|
||||||
group->sgroups = calloc(tgt->opts.max_subsystems, sizeof(struct spdk_nvmf_subsystem_poll_group));
|
group->sgroups = calloc(tgt->max_subsystems, sizeof(struct spdk_nvmf_subsystem_poll_group));
|
||||||
if (!group->sgroups) {
|
if (!group->sgroups) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (sid = 0; sid < tgt->opts.max_subsystems; sid++) {
|
for (sid = 0; sid < tgt->max_subsystems; sid++) {
|
||||||
struct spdk_nvmf_subsystem *subsystem;
|
struct spdk_nvmf_subsystem *subsystem;
|
||||||
|
|
||||||
subsystem = tgt->subsystems[sid];
|
subsystem = tgt->subsystems[sid];
|
||||||
@ -233,7 +217,7 @@ spdk_nvmf_tgt_destroy_poll_group_qpairs(struct spdk_nvmf_poll_group *group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct spdk_nvmf_tgt *
|
struct spdk_nvmf_tgt *
|
||||||
spdk_nvmf_tgt_create(struct spdk_nvmf_tgt_opts *opts)
|
spdk_nvmf_tgt_create(uint32_t max_subsystems)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_tgt *tgt;
|
struct spdk_nvmf_tgt *tgt;
|
||||||
|
|
||||||
@ -242,10 +226,10 @@ spdk_nvmf_tgt_create(struct spdk_nvmf_tgt_opts *opts)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opts) {
|
if (!max_subsystems) {
|
||||||
spdk_nvmf_tgt_opts_init(&tgt->opts);
|
tgt->max_subsystems = SPDK_NVMF_DEFAULT_MAX_SUBSYSTEMS;
|
||||||
} else {
|
} else {
|
||||||
tgt->opts = *opts;
|
tgt->max_subsystems = max_subsystems;
|
||||||
}
|
}
|
||||||
|
|
||||||
tgt->discovery_genctr = 0;
|
tgt->discovery_genctr = 0;
|
||||||
@ -253,7 +237,7 @@ spdk_nvmf_tgt_create(struct spdk_nvmf_tgt_opts *opts)
|
|||||||
tgt->discovery_log_page_size = 0;
|
tgt->discovery_log_page_size = 0;
|
||||||
TAILQ_INIT(&tgt->transports);
|
TAILQ_INIT(&tgt->transports);
|
||||||
|
|
||||||
tgt->subsystems = calloc(tgt->opts.max_subsystems, sizeof(struct spdk_nvmf_subsystem *));
|
tgt->subsystems = calloc(tgt->max_subsystems, sizeof(struct spdk_nvmf_subsystem *));
|
||||||
if (!tgt->subsystems) {
|
if (!tgt->subsystems) {
|
||||||
free(tgt);
|
free(tgt);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -282,7 +266,7 @@ spdk_nvmf_tgt_destroy_cb(void *io_device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tgt->subsystems) {
|
if (tgt->subsystems) {
|
||||||
for (i = 0; i < tgt->opts.max_subsystems; i++) {
|
for (i = 0; i < tgt->max_subsystems; i++) {
|
||||||
if (tgt->subsystems[i]) {
|
if (tgt->subsystems[i]) {
|
||||||
spdk_nvmf_subsystem_destroy(tgt->subsystems[i]);
|
spdk_nvmf_subsystem_destroy(tgt->subsystems[i]);
|
||||||
}
|
}
|
||||||
@ -461,15 +445,10 @@ spdk_nvmf_tgt_write_config_json(struct spdk_json_write_ctx *w, struct spdk_nvmf_
|
|||||||
struct spdk_nvmf_transport *transport;
|
struct spdk_nvmf_transport *transport;
|
||||||
|
|
||||||
spdk_json_write_object_begin(w);
|
spdk_json_write_object_begin(w);
|
||||||
spdk_json_write_named_string(w, "method", "set_nvmf_target_options");
|
spdk_json_write_named_string(w, "method", "set_nvmf_target_max_subsystems");
|
||||||
|
|
||||||
spdk_json_write_named_object_begin(w, "params");
|
spdk_json_write_named_object_begin(w, "params");
|
||||||
spdk_json_write_named_uint32(w, "max_queue_depth", tgt->opts.max_queue_depth);
|
spdk_json_write_named_uint32(w, "max_subsystems", tgt->max_subsystems);
|
||||||
spdk_json_write_named_uint32(w, "max_qpairs_per_ctrlr", tgt->opts.max_qpairs_per_ctrlr);
|
|
||||||
spdk_json_write_named_uint32(w, "in_capsule_data_size", tgt->opts.in_capsule_data_size);
|
|
||||||
spdk_json_write_named_uint32(w, "max_io_size", tgt->opts.max_io_size);
|
|
||||||
spdk_json_write_named_uint32(w, "max_subsystems", tgt->opts.max_subsystems);
|
|
||||||
spdk_json_write_named_uint32(w, "io_unit_size", tgt->opts.io_unit_size);
|
|
||||||
spdk_json_write_object_end(w);
|
spdk_json_write_object_end(w);
|
||||||
|
|
||||||
spdk_json_write_object_end(w);
|
spdk_json_write_object_end(w);
|
||||||
@ -605,7 +584,7 @@ spdk_nvmf_tgt_find_subsystem(struct spdk_nvmf_tgt *tgt, const char *subnqn)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (sid = 0; sid < tgt->opts.max_subsystems; sid++) {
|
for (sid = 0; sid < tgt->max_subsystems; sid++) {
|
||||||
subsystem = tgt->subsystems[sid];
|
subsystem = tgt->subsystems[sid];
|
||||||
if (subsystem == NULL) {
|
if (subsystem == NULL) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -68,10 +68,10 @@ enum spdk_nvmf_qpair_state {
|
|||||||
typedef void (*spdk_nvmf_state_change_done)(void *cb_arg, int status);
|
typedef void (*spdk_nvmf_state_change_done)(void *cb_arg, int status);
|
||||||
|
|
||||||
struct spdk_nvmf_tgt {
|
struct spdk_nvmf_tgt {
|
||||||
struct spdk_nvmf_tgt_opts opts;
|
|
||||||
|
|
||||||
uint64_t discovery_genctr;
|
uint64_t discovery_genctr;
|
||||||
|
|
||||||
|
uint32_t max_subsystems;
|
||||||
|
|
||||||
/* Array of subsystem pointers of size max_subsystems indexed by sid */
|
/* Array of subsystem pointers of size max_subsystems indexed by sid */
|
||||||
struct spdk_nvmf_subsystem **subsystems;
|
struct spdk_nvmf_subsystem **subsystems;
|
||||||
|
|
||||||
|
@ -253,12 +253,12 @@ spdk_nvmf_subsystem_create(struct spdk_nvmf_tgt *tgt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Find a free subsystem id (sid) */
|
/* Find a free subsystem id (sid) */
|
||||||
for (sid = 0; sid < tgt->opts.max_subsystems; sid++) {
|
for (sid = 0; sid < tgt->max_subsystems; sid++) {
|
||||||
if (tgt->subsystems[sid] == NULL) {
|
if (tgt->subsystems[sid] == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sid >= tgt->opts.max_subsystems) {
|
if (sid >= tgt->max_subsystems) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ spdk_nvmf_subsystem_get_first(struct spdk_nvmf_tgt *tgt)
|
|||||||
struct spdk_nvmf_subsystem *subsystem;
|
struct spdk_nvmf_subsystem *subsystem;
|
||||||
uint32_t sid;
|
uint32_t sid;
|
||||||
|
|
||||||
for (sid = 0; sid < tgt->opts.max_subsystems; sid++) {
|
for (sid = 0; sid < tgt->max_subsystems; sid++) {
|
||||||
subsystem = tgt->subsystems[sid];
|
subsystem = tgt->subsystems[sid];
|
||||||
if (subsystem) {
|
if (subsystem) {
|
||||||
return subsystem;
|
return subsystem;
|
||||||
@ -581,7 +581,7 @@ spdk_nvmf_subsystem_get_next(struct spdk_nvmf_subsystem *subsystem)
|
|||||||
|
|
||||||
tgt = subsystem->tgt;
|
tgt = subsystem->tgt;
|
||||||
|
|
||||||
for (sid = subsystem->id + 1; sid < tgt->opts.max_subsystems; sid++) {
|
for (sid = subsystem->id + 1; sid < tgt->max_subsystems; sid++) {
|
||||||
subsystem = tgt->subsystems[sid];
|
subsystem = tgt->subsystems[sid];
|
||||||
if (subsystem) {
|
if (subsystem) {
|
||||||
return subsystem;
|
return subsystem;
|
||||||
|
@ -30,7 +30,7 @@ iscsi_dict["construct_target_node"] = []
|
|||||||
|
|
||||||
nvmf_dict = OrderedDict()
|
nvmf_dict = OrderedDict()
|
||||||
nvmf_dict["set_nvmf_target_config"] = []
|
nvmf_dict["set_nvmf_target_config"] = []
|
||||||
nvmf_dict["set_nvmf_target_options"] = []
|
nvmf_dict["set_nvmf_target_max_subsystems"] = []
|
||||||
nvmf_dict["construct_nvmf_subsystem"] = []
|
nvmf_dict["construct_nvmf_subsystem"] = []
|
||||||
|
|
||||||
|
|
||||||
@ -291,11 +291,6 @@ def get_split_bdev_json(config, section):
|
|||||||
def get_nvmf_options_json(config, section):
|
def get_nvmf_options_json(config, section):
|
||||||
params = [
|
params = [
|
||||||
["AcceptorPollRate", "acceptor_poll_rate", int, 10000],
|
["AcceptorPollRate", "acceptor_poll_rate", int, 10000],
|
||||||
["MaxQueuesPerSession", "max_qpairs_per_ctrlr", int, 64],
|
|
||||||
["MaxQueueDepth", "max_queue_depth", int, 128],
|
|
||||||
["IncapsuleDataSize", "in_capsule_data_size", int, 4096],
|
|
||||||
["MaxIOSize", "max_io_size", int, 131072],
|
|
||||||
["IOUnitSize", "io_unit_size", int, 131072],
|
|
||||||
["MaxSubsystems", "max_subsystems", int, 1024]
|
["MaxSubsystems", "max_subsystems", int, 1024]
|
||||||
]
|
]
|
||||||
for option in config.options("Nvmf"):
|
for option in config.options("Nvmf"):
|
||||||
@ -307,7 +302,7 @@ def get_nvmf_options_json(config, section):
|
|||||||
})
|
})
|
||||||
nvmf_json.append({
|
nvmf_json.append({
|
||||||
"params": to_json_params(params[1:7]),
|
"params": to_json_params(params[1:7]),
|
||||||
"method": "set_nvmf_target_options"
|
"method": "set_nvmf_target_max_subsystems"
|
||||||
})
|
})
|
||||||
|
|
||||||
return nvmf_json
|
return nvmf_json
|
||||||
|
@ -1277,6 +1277,15 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
|||||||
p.add_argument('-u', '--io-unit-size', help='I/O unit size (bytes)', type=int)
|
p.add_argument('-u', '--io-unit-size', help='I/O unit size (bytes)', type=int)
|
||||||
p.set_defaults(func=set_nvmf_target_options)
|
p.set_defaults(func=set_nvmf_target_options)
|
||||||
|
|
||||||
|
@call_cmd
|
||||||
|
def set_nvmf_target_max_subsystems(args):
|
||||||
|
rpc.nvmf.set_nvmf_target_max_subsystems(args.client,
|
||||||
|
max_subsystems=args.max_subsystems)
|
||||||
|
|
||||||
|
p = subparsers.add_parser('set_nvmf_target_max_subsystems', help='Set the maximum number of NVMf target subsystems')
|
||||||
|
p.add_argument('-x', '--max-subsystems', help='Max number of NVMf subsystems', type=int, required=True)
|
||||||
|
p.set_defaults(func=set_nvmf_target_max_subsystems)
|
||||||
|
|
||||||
@call_cmd
|
@call_cmd
|
||||||
def set_nvmf_target_config(args):
|
def set_nvmf_target_config(args):
|
||||||
rpc.nvmf.set_nvmf_target_config(args.client,
|
rpc.nvmf.set_nvmf_target_config(args.client,
|
||||||
|
@ -37,6 +37,22 @@ def set_nvmf_target_options(client,
|
|||||||
return client.call('set_nvmf_target_options', params)
|
return client.call('set_nvmf_target_options', params)
|
||||||
|
|
||||||
|
|
||||||
|
def set_nvmf_target_max_subsystems(client,
|
||||||
|
max_subsystems=None):
|
||||||
|
"""Set NVMe-oF target options.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
max_subsystems: Maximum number of NVMe-oF subsystems (e.g. 1024)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
True or False
|
||||||
|
"""
|
||||||
|
params = {}
|
||||||
|
|
||||||
|
params['max_subsystems'] = max_subsystems
|
||||||
|
return client.call('set_nvmf_target_max_subsystems', params)
|
||||||
|
|
||||||
|
|
||||||
def set_nvmf_target_config(client,
|
def set_nvmf_target_config(client,
|
||||||
acceptor_poll_rate=None,
|
acceptor_poll_rate=None,
|
||||||
conn_sched=None):
|
conn_sched=None):
|
||||||
|
@ -182,14 +182,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": {
|
"params": {
|
||||||
"in_capsule_data_size": 4096,
|
|
||||||
"io_unit_size": 131072,
|
|
||||||
"max_qpairs_per_ctrlr": 4,
|
|
||||||
"max_queue_depth": 128,
|
|
||||||
"max_io_size": 131072,
|
|
||||||
"max_subsystems": 1024
|
"max_subsystems": 1024
|
||||||
},
|
},
|
||||||
"method": "set_nvmf_target_options"
|
"method": "set_nvmf_target_max_subsystems"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": {
|
"params": {
|
||||||
|
@ -88,14 +88,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"params": {
|
"params": {
|
||||||
"in_capsule_data_size": 4096,
|
|
||||||
"io_unit_size": 131072,
|
|
||||||
"max_qpairs_per_ctrlr": 64,
|
|
||||||
"max_queue_depth": 128,
|
|
||||||
"max_io_size": 131072,
|
|
||||||
"max_subsystems": 1024
|
"max_subsystems": 1024
|
||||||
},
|
},
|
||||||
"method": "set_nvmf_target_options"
|
"method": "set_nvmf_target_max_subsystems"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -25,7 +25,7 @@ def filter_methods(do_remove_global_rpcs):
|
|||||||
global_rpcs = [
|
global_rpcs = [
|
||||||
'set_iscsi_options',
|
'set_iscsi_options',
|
||||||
'set_nvmf_target_config',
|
'set_nvmf_target_config',
|
||||||
'set_nvmf_target_options',
|
'set_nvmf_target_max_subsystems',
|
||||||
'nvmf_create_transport',
|
'nvmf_create_transport',
|
||||||
'set_bdev_options',
|
'set_bdev_options',
|
||||||
'set_bdev_nvme_options',
|
'set_bdev_nvme_options',
|
||||||
|
@ -218,8 +218,8 @@ test_discovery_log(void)
|
|||||||
struct spdk_nvmf_discovery_log_page_entry *entry;
|
struct spdk_nvmf_discovery_log_page_entry *entry;
|
||||||
struct spdk_nvme_transport_id trid = {};
|
struct spdk_nvme_transport_id trid = {};
|
||||||
|
|
||||||
tgt.opts.max_subsystems = 1024;
|
tgt.max_subsystems = 1024;
|
||||||
tgt.subsystems = calloc(tgt.opts.max_subsystems, sizeof(struct spdk_nvmf_subsystem *));
|
tgt.subsystems = calloc(tgt.max_subsystems, sizeof(struct spdk_nvmf_subsystem *));
|
||||||
SPDK_CU_ASSERT_FATAL(tgt.subsystems != NULL);
|
SPDK_CU_ASSERT_FATAL(tgt.subsystems != NULL);
|
||||||
|
|
||||||
/* Add one subsystem and verify that the discovery log contains it */
|
/* Add one subsystem and verify that the discovery log contains it */
|
||||||
|
@ -253,8 +253,8 @@ test_spdk_nvmf_subsystem_add_ns(void)
|
|||||||
struct spdk_nvmf_ns_opts ns_opts;
|
struct spdk_nvmf_ns_opts ns_opts;
|
||||||
uint32_t nsid;
|
uint32_t nsid;
|
||||||
|
|
||||||
tgt.opts.max_subsystems = 1024;
|
tgt.max_subsystems = 1024;
|
||||||
tgt.subsystems = calloc(tgt.opts.max_subsystems, sizeof(struct spdk_nvmf_subsystem *));
|
tgt.subsystems = calloc(tgt.max_subsystems, sizeof(struct spdk_nvmf_subsystem *));
|
||||||
SPDK_CU_ASSERT_FATAL(tgt.subsystems != NULL);
|
SPDK_CU_ASSERT_FATAL(tgt.subsystems != NULL);
|
||||||
|
|
||||||
/* Allow NSID to be assigned automatically */
|
/* Allow NSID to be assigned automatically */
|
||||||
@ -304,8 +304,8 @@ nvmf_test_create_subsystem(void)
|
|||||||
char nqn[256];
|
char nqn[256];
|
||||||
struct spdk_nvmf_subsystem *subsystem;
|
struct spdk_nvmf_subsystem *subsystem;
|
||||||
|
|
||||||
tgt.opts.max_subsystems = 1024;
|
tgt.max_subsystems = 1024;
|
||||||
tgt.subsystems = calloc(tgt.opts.max_subsystems, sizeof(struct spdk_nvmf_subsystem *));
|
tgt.subsystems = calloc(tgt.max_subsystems, sizeof(struct spdk_nvmf_subsystem *));
|
||||||
SPDK_CU_ASSERT_FATAL(tgt.subsystems != NULL);
|
SPDK_CU_ASSERT_FATAL(tgt.subsystems != NULL);
|
||||||
|
|
||||||
snprintf(nqn, sizeof(nqn), "nqn.2016-06.io.spdk:subsystem1");
|
snprintf(nqn, sizeof(nqn), "nqn.2016-06.io.spdk:subsystem1");
|
||||||
|
Loading…
Reference in New Issue
Block a user