Commit 5b8c0c5a authored by Ben Walker's avatar Ben Walker
Browse files

nvme: Rename spdk_nvme_transport to spdk_nvme_transport_type



It's not the whole transport - it's just an enum for the
type of transport.

Change-Id: Ia435a21792f221ddf50ddf4f0923c6152622eccb
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 47f13f5e
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -44,14 +44,14 @@ int32_t spdk_nvme_retry_count;
static int		hotplug_fd = -1;

struct spdk_nvme_ctrlr *
nvme_attach(enum spdk_nvme_transport transport,
nvme_attach(enum spdk_nvme_transport_type trtype,
	    const struct spdk_nvme_ctrlr_opts *opts,
	    const struct spdk_nvme_probe_info *probe_info,
	    void *devhandle)
{
	struct spdk_nvme_ctrlr	*ctrlr;

	ctrlr = nvme_transport_ctrlr_construct(transport, opts, probe_info, devhandle);
	ctrlr = nvme_transport_ctrlr_construct(trtype, opts, probe_info, devhandle);

	return ctrlr;
}
@@ -314,7 +314,7 @@ nvme_driver_init(void)
}

int
nvme_probe_one(enum spdk_nvme_transport transport, spdk_nvme_probe_cb probe_cb, void *cb_ctx,
nvme_probe_one(enum spdk_nvme_transport_type trtype, spdk_nvme_probe_cb probe_cb, void *cb_ctx,
	       struct spdk_nvme_probe_info *probe_info, void *devhandle)
{
	struct spdk_nvme_ctrlr *ctrlr;
@@ -323,7 +323,7 @@ nvme_probe_one(enum spdk_nvme_transport transport, spdk_nvme_probe_cb probe_cb,
	spdk_nvme_ctrlr_opts_set_defaults(&opts);

	if (probe_cb(cb_ctx, probe_info, &opts)) {
		ctrlr = nvme_attach(transport, &opts, probe_info, devhandle);
		ctrlr = nvme_attach(trtype, &opts, probe_info, devhandle);
		if (ctrlr == NULL) {
			SPDK_ERRLOG("nvme_attach() failed\n");
			return -1;
@@ -414,7 +414,7 @@ _spdk_nvme_probe(const struct spdk_nvme_discover_info *info, void *cb_ctx,
		 spdk_nvme_remove_cb remove_cb)
{
	int rc;
	enum spdk_nvme_transport transport;
	enum spdk_nvme_transport_type trtype;
	struct spdk_nvme_ctrlr *ctrlr;

	rc = nvme_driver_init();
@@ -432,7 +432,7 @@ _spdk_nvme_probe(const struct spdk_nvme_discover_info *info, void *cb_ctx,
	}

	if (!info) {
		transport = SPDK_NVME_TRANSPORT_PCIE;
		trtype = SPDK_NVME_TRANSPORT_PCIE;
	} else {
		if (!spdk_nvme_transport_available(info->trtype)) {
			SPDK_ERRLOG("NVMe over Fabrics trtype %u not available\n", info->trtype);
@@ -440,10 +440,10 @@ _spdk_nvme_probe(const struct spdk_nvme_discover_info *info, void *cb_ctx,
			return -1;
		}

		transport = (uint8_t)info->trtype;
		trtype = (uint8_t)info->trtype;
	}

	nvme_transport_ctrlr_scan(transport, probe_cb, cb_ctx, (void *)info, NULL);
	nvme_transport_ctrlr_scan(trtype, probe_cb, cb_ctx, (void *)info, NULL);

	if (!spdk_process_is_primary()) {
		TAILQ_FOREACH(ctrlr, &g_spdk_nvme_driver->attached_ctrlrs, tailq) {
+7 −7
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ struct nvme_request {
 * Currently, this uses 0 for PCIe since it is reserved by NVMe-oF.  If 0 is ever assigned as a
 * valid TRTYPE, this would need to be changed.
 */
enum spdk_nvme_transport {
enum spdk_nvme_transport_type {
	SPDK_NVME_TRANSPORT_PCIE = 0,
	SPDK_NVME_TRANSPORT_RDMA = SPDK_NVMF_TRTYPE_RDMA,
};
@@ -250,7 +250,7 @@ struct nvme_async_event_request {
struct spdk_nvme_qpair {
	STAILQ_HEAD(, nvme_request)	queued_req;

	enum spdk_nvme_transport	transport;
	enum spdk_nvme_transport_type	trtype;

	uint16_t			id;

@@ -345,7 +345,7 @@ struct spdk_nvme_ctrlr {
	/** Array of namespaces indexed by nsid - 1 */
	struct spdk_nvme_ns		*ns;

	enum spdk_nvme_transport	transport;
	enum spdk_nvme_transport_type	trtype;

	uint32_t			num_ns;

@@ -501,7 +501,7 @@ void nvme_completion_poll_cb(void *arg, const struct spdk_nvme_cpl *cpl);
int	nvme_ctrlr_add_process(struct spdk_nvme_ctrlr *ctrlr, void *devhandle);
void	nvme_ctrlr_free_processes(struct spdk_nvme_ctrlr *ctrlr);

int	nvme_probe_one(enum spdk_nvme_transport type, spdk_nvme_probe_cb probe_cb, void *cb_ctx,
int	nvme_probe_one(enum spdk_nvme_transport_type trtype, spdk_nvme_probe_cb probe_cb, void *cb_ctx,
		       struct spdk_nvme_probe_info *probe_info, void *devhandle);

int	nvme_ctrlr_construct(struct spdk_nvme_ctrlr *ctrlr);
@@ -546,17 +546,17 @@ int nvme_mutex_init_recursive_shared(pthread_mutex_t *mtx);
bool	nvme_completion_is_retry(const struct spdk_nvme_cpl *cpl);
void	nvme_qpair_print_command(struct spdk_nvme_qpair *qpair, struct spdk_nvme_cmd *cmd);
void	nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair, struct spdk_nvme_cpl *cpl);
struct	spdk_nvme_ctrlr *nvme_attach(enum spdk_nvme_transport transport,
struct	spdk_nvme_ctrlr *nvme_attach(enum spdk_nvme_transport_type trtype,
				     const struct spdk_nvme_ctrlr_opts *opts,
				     const struct spdk_nvme_probe_info *probe_info,
				     void *devhandle);

/* Transport specific functions */
#define DECLARE_TRANSPORT(name) \
	struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(enum spdk_nvme_transport transport, const struct spdk_nvme_ctrlr_opts *opts, \
	struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(enum spdk_nvme_transport_type trtype, const struct spdk_nvme_ctrlr_opts *opts, \
		const struct spdk_nvme_probe_info *probe_info, void *devhandle); \
	int nvme_ ## name ## _ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr); \
	int nvme_ ## name ## _ctrlr_scan(enum spdk_nvme_transport transport, spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address); \
	int nvme_ ## name ## _ctrlr_scan(enum spdk_nvme_transport_type trtype, spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address); \
	int nvme_ ## name ## _ctrlr_enable(struct spdk_nvme_ctrlr *ctrlr); \
	int nvme_ ## name ## _ctrlr_get_pci_id(struct spdk_nvme_ctrlr *ctrlr, struct spdk_pci_id *pci_id); \
	int nvme_ ## name ## _ctrlr_set_reg_4(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, uint32_t value); \
+7 −6
Original line number Diff line number Diff line
@@ -229,14 +229,14 @@ nvme_pcie_ctrlr_setup_signal(void)
static inline struct nvme_pcie_ctrlr *
nvme_pcie_ctrlr(struct spdk_nvme_ctrlr *ctrlr)
{
	assert(ctrlr->transport == SPDK_NVME_TRANSPORT_PCIE);
	assert(ctrlr->trtype == SPDK_NVME_TRANSPORT_PCIE);
	return (struct nvme_pcie_ctrlr *)((uintptr_t)ctrlr - offsetof(struct nvme_pcie_ctrlr, ctrlr));
}

static inline struct nvme_pcie_qpair *
nvme_pcie_qpair(struct spdk_nvme_qpair *qpair)
{
	assert(qpair->transport == SPDK_NVME_TRANSPORT_PCIE);
	assert(qpair->trtype == SPDK_NVME_TRANSPORT_PCIE);
	return (struct nvme_pcie_qpair *)((uintptr_t)qpair - offsetof(struct nvme_pcie_qpair, qpair));
}

@@ -552,8 +552,9 @@ pcie_nvme_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)
}

int
nvme_pcie_ctrlr_scan(enum spdk_nvme_transport transport,
		     spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address)
nvme_pcie_ctrlr_scan(enum spdk_nvme_transport_type trtype,
		     spdk_nvme_probe_cb probe_cb, void *cb_ctx,
		     void *devhandle, void *pci_address)
{
	struct nvme_pcie_enum_ctx enum_ctx;

@@ -567,7 +568,7 @@ nvme_pcie_ctrlr_scan(enum spdk_nvme_transport transport,
	}
}

struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(enum spdk_nvme_transport transport,
struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(enum spdk_nvme_transport_type trtype,
		const struct spdk_nvme_ctrlr_opts *opts,
		const struct spdk_nvme_probe_info *probe_info,
		void *devhandle)
@@ -586,7 +587,7 @@ struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(enum spdk_nvme_transport trans

	pctrlr->is_remapped = false;
	pctrlr->ctrlr.is_removed = false;
	pctrlr->ctrlr.transport = SPDK_NVME_TRANSPORT_PCIE;
	pctrlr->ctrlr.trtype = SPDK_NVME_TRANSPORT_PCIE;
	pctrlr->devhandle = devhandle;
	pctrlr->ctrlr.opts = *opts;
	pctrlr->ctrlr.probe_info = *probe_info;
+1 −1
Original line number Diff line number Diff line
@@ -352,7 +352,7 @@ nvme_qpair_construct(struct spdk_nvme_qpair *qpair, uint16_t id,
	qpair->qprio = qprio;

	qpair->ctrlr = ctrlr;
	qpair->transport = ctrlr->transport;
	qpair->trtype = ctrlr->trtype;

	STAILQ_INIT(&qpair->queued_req);

+13 −11
Original line number Diff line number Diff line
@@ -128,14 +128,14 @@ static int nvme_rdma_qpair_destroy(struct spdk_nvme_qpair *qpair);
static inline struct nvme_rdma_qpair *
nvme_rdma_qpair(struct spdk_nvme_qpair *qpair)
{
	assert(qpair->transport == SPDK_NVME_TRANSPORT_RDMA);
	assert(qpair->trtype == SPDK_NVME_TRANSPORT_RDMA);
	return (struct nvme_rdma_qpair *)((uintptr_t)qpair - offsetof(struct nvme_rdma_qpair, qpair));
}

static inline struct nvme_rdma_ctrlr *
nvme_rdma_ctrlr(struct spdk_nvme_ctrlr *ctrlr)
{
	assert(ctrlr->transport == SPDK_NVME_TRANSPORT_RDMA);
	assert(ctrlr->trtype == SPDK_NVME_TRANSPORT_RDMA);
	return (struct nvme_rdma_ctrlr *)((uintptr_t)ctrlr - offsetof(struct nvme_rdma_ctrlr, ctrlr));
}

@@ -1052,8 +1052,9 @@ nvme_fabrics_get_log_discovery_page(struct spdk_nvme_ctrlr *ctrlr,

/* This function must only be called while holding g_spdk_nvme_driver->lock */
int
nvme_rdma_ctrlr_scan(enum spdk_nvme_transport transport,
		     spdk_nvme_probe_cb probe_cb, void *cb_ctx, void *devhandle, void *pci_address)
nvme_rdma_ctrlr_scan(enum spdk_nvme_transport_type trtype,
		     spdk_nvme_probe_cb probe_cb, void *cb_ctx,
		     void *devhandle, void *pci_address)
{
	struct spdk_nvme_discover_info *discover_info = devhandle;
	struct spdk_nvme_probe_info probe_info;
@@ -1067,13 +1068,13 @@ nvme_rdma_ctrlr_scan(enum spdk_nvme_transport transport,

	spdk_nvme_ctrlr_opts_set_defaults(&discovery_opts);

	probe_info.trtype = (uint8_t)transport;
	probe_info.trtype = (uint8_t)trtype;
	snprintf(probe_info.subnqn, sizeof(probe_info.subnqn), "%s", discover_info->subnqn);
	snprintf(probe_info.traddr, sizeof(probe_info.traddr), "%s", discover_info->traddr);
	snprintf(probe_info.trsvcid, sizeof(probe_info.trsvcid), "%s", discover_info->trsvcid);

	memset(buffer, 0x0, 4096);
	discovery_ctrlr = nvme_attach(transport, &discovery_opts, &probe_info, NULL);
	discovery_ctrlr = nvme_attach(trtype, &discovery_opts, &probe_info, NULL);
	if (discovery_ctrlr == NULL) {
		return -1;
	}
@@ -1145,7 +1146,8 @@ nvme_rdma_ctrlr_scan(enum spdk_nvme_transport transport,
	return 0;
}

struct spdk_nvme_ctrlr *nvme_rdma_ctrlr_construct(enum spdk_nvme_transport transport,
struct spdk_nvme_ctrlr *
	nvme_rdma_ctrlr_construct(enum spdk_nvme_transport_type trtype,
			  const struct spdk_nvme_ctrlr_opts *opts,
			  const struct spdk_nvme_probe_info *probe_info,
			  void *devhandle)
@@ -1160,7 +1162,7 @@ struct spdk_nvme_ctrlr *nvme_rdma_ctrlr_construct(enum spdk_nvme_transport trans
		return NULL;
	}

	rctrlr->ctrlr.transport = SPDK_NVME_TRANSPORT_RDMA;
	rctrlr->ctrlr.trtype = SPDK_NVME_TRANSPORT_RDMA;
	rctrlr->ctrlr.opts = *opts;
	rctrlr->ctrlr.probe_info = *probe_info;

Loading