Commit dc2fb2ed authored by GangCao's avatar GangCao Committed by Daniel Verkamp
Browse files

nvme: add a public API to rename spdk_nvme_ctrlr_opts_set_defaults



This change is relating to add a new public API spdk_nvme_connect() under
include/spdk/nvme.h. This new spdk_nvme_connect() API will connect the user
specified trid and have a user optional ctlr opts. Rename this API and make
it as public.

A typical usage of this API as following:
1. struct spdk_nvme_ctrlr_opts user_opts = {}
2. Call spdk_nvme_ctrlr_get_default_ctrlr_opts(&user_opts, sizeof(user_opts))
3. Modify the content of the initialized user_opts with user required value like
   user_opts.num_io_queues = 8
4. Call spdk_nvme_connect(&trid, &user_opts, sizeof(user_opts))

Change-Id: Ideec8247365ebf7dd15069e29821be8ea27b08be
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/380849


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 356a9bc7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -146,6 +146,15 @@ struct spdk_nvme_ctrlr_opts {
	uint8_t extended_host_id[16];
};

/**
 * \brief Get the default options for the creation of a specific NVMe controller.
 *
 * \param[out] opts Will be filled with the default option.
 * \param opts_size Must be set to sizeof(struct spdk_nvme_ctrlr_opts).
 */
void spdk_nvme_ctrlr_get_default_ctrlr_opts(struct spdk_nvme_ctrlr_opts *opts,
		size_t opts_size);

/**
 * NVMe library transports
 *
+1 −1
Original line number Diff line number Diff line
@@ -320,7 +320,7 @@ nvme_ctrlr_probe(const struct spdk_nvme_transport_id *trid, void *devhandle,
	struct spdk_nvme_ctrlr *ctrlr;
	struct spdk_nvme_ctrlr_opts opts;

	spdk_nvme_ctrlr_opts_set_defaults(&opts, sizeof(opts));
	spdk_nvme_ctrlr_get_default_ctrlr_opts(&opts, sizeof(opts));

	if (probe_cb(cb_ctx, trid, &opts)) {
		ctrlr = nvme_transport_ctrlr_construct(trid, &opts, devhandle);
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ nvme_ctrlr_set_cc(struct spdk_nvme_ctrlr *ctrlr, const union spdk_nvme_cc_regist
}

void
spdk_nvme_ctrlr_opts_set_defaults(struct spdk_nvme_ctrlr_opts *opts, size_t opts_size)
spdk_nvme_ctrlr_get_default_ctrlr_opts(struct spdk_nvme_ctrlr_opts *opts, size_t opts_size)
{
	char host_id_str[37];

+0 −2
Original line number Diff line number Diff line
@@ -587,8 +587,6 @@ void nvme_free_request(struct nvme_request *req);
void	nvme_request_remove_child(struct nvme_request *parent, struct nvme_request *child);
uint64_t nvme_get_quirks(const struct spdk_pci_id *id);

void	spdk_nvme_ctrlr_opts_set_defaults(struct spdk_nvme_ctrlr_opts *opts, size_t opts_size);

int	nvme_robust_mutex_init_shared(pthread_mutex_t *mtx);
int	nvme_robust_mutex_init_recursive_shared(pthread_mutex_t *mtx);

+1 −1
Original line number Diff line number Diff line
@@ -1192,7 +1192,7 @@ nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *discovery_trid,
		return rc;
	}

	spdk_nvme_ctrlr_opts_set_defaults(&discovery_opts, sizeof(discovery_opts));
	spdk_nvme_ctrlr_get_default_ctrlr_opts(&discovery_opts, sizeof(discovery_opts));
	/* For discovery_ctrlr set the timeout to 0 */
	discovery_opts.keep_alive_timeout_ms = 0;

Loading