Commit b832f99f authored by yupeng's avatar yupeng Committed by Ben Walker
Browse files

nvmf: Add nvmf_set_crdt RPC



Set the three CRDT values at SPDK_RPC_STARTUP time.

Signed-off-by: default avatarPeng Yu <yupeng0921@gmail.com>
Change-Id: I2fb4c4a3e367a4888cfec4658e6bf6899c7ae1f4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8007


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 26004a40
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ Added `min_cntlid` and `max_cntlid` to `nvmf_create_subsystem` to limit the cont

`spdk_nvmf_request_get_buffers_multi` API is removed.

Added the `nvmf_set_crdt` RPC for setting command retry delay times.

### nvme

Added a new function `spdk_nvme_ns_cmd_copy` to submit a Simple Copy Command to a Namespace.
+16 −0
Original line number Diff line number Diff line
@@ -6840,6 +6840,22 @@ Example response:
}
~~~


## nvmf_set_crdt {#rpc_nvmf_set_crdt}

Set the 3 CRDT (Command Retry Delay Time) values. For details about
CRDT, please refer to the NVMe specification. Currently all the
SPDK nvmf subsystems share the same CRDT values. The default values
are 0. This rpc can only be invoked in STARTUP stage. All values are
in units of 100 milliseconds (same as the NVMe specification).

### Parameters
Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
crdt1                   | Optional | number      | Command Retry Delay Time 1
crdt2                   | Optional | number      | Command Retry Delay Time 2
crdt3                   | Optional | number      | Command Retry Delay Time 3

# Vhost Target {#jsonrpc_components_vhost_tgt}

The following common preconditions need to be met in all target types.
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ struct spdk_nvmf_target_opts {
	char		name[NVMF_TGT_NAME_MAX_LENGTH];
	uint32_t	max_subsystems;
	uint32_t	acceptor_poll_rate;
	uint16_t	crdt[3];
};

struct spdk_nvmf_transport_opts {
+5 −7
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ nvmf_invalid_connect_response(struct spdk_nvmf_fabric_connect_rsp *rsp,
#define SPDK_NVMF_INVALID_CONNECT_DATA(rsp, field)	\
	nvmf_invalid_connect_response(rsp, 1, offsetof(struct spdk_nvmf_fabric_connect_data, field))


static void
nvmf_ctrlr_stop_keep_alive_timer(struct spdk_nvmf_ctrlr *ctrlr)
{
@@ -2338,13 +2339,10 @@ spdk_nvmf_ctrlr_identify_ctrlr(struct spdk_nvmf_ctrlr *ctrlr, struct spdk_nvme_c

		nvmf_ctrlr_populate_oacs(ctrlr, cdata);

		/*
		 * FIXME: Set all crdt to 0 currently,
		 * will provide an API to customize them later.
		 */
		cdata->crdt[0] = 0;
		cdata->crdt[1] = 0;
		cdata->crdt[2] = 0;
		assert(subsystem->tgt != NULL);
		cdata->crdt[0] = subsystem->tgt->crdt[0];
		cdata->crdt[1] = subsystem->tgt->crdt[1];
		cdata->crdt[2] = subsystem->tgt->crdt[2];

		SPDK_DEBUGLOG(nvmf, "ext ctrlr data: ioccsz 0x%x\n",
			      cdata->nvmf_specific.ioccsz);
+19 −0
Original line number Diff line number Diff line
@@ -283,6 +283,16 @@ spdk_nvmf_tgt_create(struct spdk_nvmf_target_opts *opts)
		acceptor_poll_rate = opts->acceptor_poll_rate;
	}

	if (!opts) {
		tgt->crdt[0] = 0;
		tgt->crdt[1] = 0;
		tgt->crdt[2] = 0;
	} else {
		tgt->crdt[0] = opts->crdt[0];
		tgt->crdt[1] = opts->crdt[1];
		tgt->crdt[2] = opts->crdt[2];
	}

	tgt->discovery_genctr = 0;
	TAILQ_INIT(&tgt->transports);
	TAILQ_INIT(&tgt->poll_groups);
@@ -572,6 +582,15 @@ spdk_nvmf_tgt_write_config_json(struct spdk_json_write_ctx *w, struct spdk_nvmf_

	spdk_json_write_object_end(w);

	spdk_json_write_object_begin(w);
	spdk_json_write_named_string(w, "method", "nvmf_set_crdt");
	spdk_json_write_named_object_begin(w, "params");
	spdk_json_write_named_uint32(w, "crdt1", tgt->crdt[0]);
	spdk_json_write_named_uint32(w, "crdt2", tgt->crdt[1]);
	spdk_json_write_named_uint32(w, "crdt3", tgt->crdt[2]);
	spdk_json_write_object_end(w);
	spdk_json_write_object_end(w);

	/* write transports */
	TAILQ_FOREACH(transport, &tgt->transports, link) {
		spdk_json_write_object_begin(w);
Loading