Commit 962ba4e8 authored by Seth Howell's avatar Seth Howell Committed by Jim Harris
Browse files

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: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/430161


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 70ef3d91
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -2,6 +2,18 @@

## 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:

### nvme
+5 −15
Original line number Diff line number Diff line
@@ -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
have been initialized.
Set the maximum allowed subsystems for the NVMe-oF target.  This RPC may only be called
before SPDK subsystems have been initialized.

### Parameters

Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
max_queue_depth         | Optional | number      | Maximum number of outstanding I/Os per queue
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)
max_subsystems          | Required | number      | Maximum number of NVMe-oF subsystems

### Example

@@ -3339,13 +3334,8 @@ Example request:
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "set_nvmf_target_options",
  "method": "set_nvmf_target_max_subsystems",
  "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
  }
}
+2 −18
Original line number Diff line number Diff line
@@ -63,15 +63,6 @@ struct spdk_nvmf_poll_group;
struct spdk_json_write_ctx;
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 {
	uint16_t max_queue_depth;
	uint16_t max_qpairs_per_ctrlr;
@@ -81,21 +72,14 @@ struct spdk_nvmf_transport_opts {
	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.
 *
 * \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.
 */
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);

+43 −45
Original line number Diff line number Diff line
@@ -43,8 +43,8 @@

#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;
uint32_t g_spdk_nvmf_tgt_max_subsystems = 0;

static int
spdk_add_nvmf_discovery_subsystem(void)
@@ -64,38 +64,40 @@ spdk_add_nvmf_discovery_subsystem(void)
}

static void
spdk_nvmf_read_config_file_tgt_opts(struct spdk_conf_section *sp,
				    struct spdk_nvmf_tgt_opts *opts)
spdk_nvmf_read_config_file_tgt_max_subsystems(struct spdk_conf_section *sp,
		int *deprecated_values)
{
	int max_queue_depth;
	int max_queues_per_sess;
	int in_capsule_data_size;
	int max_io_size;
	int io_unit_size;
	int tgt_max_subsystems;
	int deprecated;

	max_queue_depth = spdk_conf_section_get_intval(sp, "MaxQueueDepth");
	if (max_queue_depth >= 0) {
		opts->max_queue_depth = max_queue_depth;
	tgt_max_subsystems = spdk_conf_section_get_intval(sp, "MaxSubsystems");
	if (tgt_max_subsystems >= 0) {
		g_spdk_nvmf_tgt_max_subsystems = tgt_max_subsystems;
	}

	max_queues_per_sess = spdk_conf_section_get_intval(sp, "MaxQueuesPerSession");
	if (max_queues_per_sess >= 0) {
		opts->max_qpairs_per_ctrlr = max_queues_per_sess;
	deprecated = spdk_conf_section_get_intval(sp, "MaxQueueDepth");
	if (deprecated >= 0) {
		*deprecated_values = -1;
	}

	in_capsule_data_size = spdk_conf_section_get_intval(sp, "InCapsuleDataSize");
	if (in_capsule_data_size >= 0) {
		opts->in_capsule_data_size = in_capsule_data_size;
	deprecated = spdk_conf_section_get_intval(sp, "MaxQueuesPerSession");
	if (deprecated >= 0) {
		*deprecated_values = -1;
	}

	max_io_size = spdk_conf_section_get_intval(sp, "MaxIOSize");
	if (max_io_size >= 0) {
		opts->max_io_size = max_io_size;
	deprecated = spdk_conf_section_get_intval(sp, "InCapsuleDataSize");
	if (deprecated >= 0) {
		*deprecated_values = -1;
	}

	io_unit_size = spdk_conf_section_get_intval(sp, "IOUnitSize");
	if (io_unit_size >= 0) {
		opts->io_unit_size = io_unit_size;
	deprecated = spdk_conf_section_get_intval(sp, "MaxIOSize");
	if (deprecated >= 0) {
		*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 *
spdk_nvmf_parse_tgt_opts(void)
static int
spdk_nvmf_parse_tgt_max_subsystems(void)
{
	struct spdk_nvmf_tgt_opts *opts;
	struct spdk_conf_section *sp;

	opts = calloc(1, sizeof(*opts));
	if (!opts) {
		SPDK_ERRLOG("calloc() failed for target options\n");
		return NULL;
	}

	spdk_nvmf_tgt_opts_init(opts);
	int deprecated_values = 0;

	sp = spdk_conf_find_section(NULL, "Nvmf");
	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 *
@@ -160,12 +154,17 @@ static int
spdk_nvmf_parse_nvmf_tgt(void)
{
	int rc;
	int using_deprecated_options;

	if (!g_spdk_nvmf_tgt_opts) {
		g_spdk_nvmf_tgt_opts = spdk_nvmf_parse_tgt_opts();
		if (!g_spdk_nvmf_tgt_opts) {
			SPDK_ERRLOG("spdk_nvmf_parse_tgt_opts() failed\n");
			return -1;
	if (!g_spdk_nvmf_tgt_max_subsystems) {
		using_deprecated_options = spdk_nvmf_parse_tgt_max_subsystems();
		if (using_deprecated_options < 0) {
			SPDK_ERRLOG("Deprecated options detected for the NVMe-oF target.\n"
				    "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_opts = NULL;
	g_spdk_nvmf_tgt_max_subsystems = 0;

	if (!g_spdk_nvmf_tgt) {
		SPDK_ERRLOG("spdk_nvmf_tgt_create() failed\n");
+2 −1
Original line number Diff line number Diff line
@@ -55,9 +55,10 @@ struct spdk_nvmf_tgt_conf {
	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 uint32_t g_spdk_nvmf_tgt_max_subsystems;

extern struct spdk_nvmf_tgt *g_spdk_nvmf_tgt;

typedef void (*spdk_nvmf_parse_conf_done_fn)(int status);
Loading