Commit 21c450e1 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: add transport function pointer table



Make the core NVMf to transport interface generic and allow for multiple
transport types to be registered.

Change-Id: I0a2767a47d55999c45f788ae1318bb50af60ab4e
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 6a138381
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -44,9 +44,9 @@

#include "spdk/event.h"

#include "nvmf/rdma.h"
#include "nvmf/port.h"
#include "nvmf/host.h"
#include "nvmf/transport.h"

#include "spdk/log.h"
#include "spdk/nvme.h"
@@ -59,7 +59,7 @@ struct rte_mempool *request_mempool;
static void
spdk_nvmf_shutdown_cb(void)
{
	nvmf_acceptor_stop();
	spdk_nvmf_acceptor_stop();
	spdk_app_stop(0);

	fprintf(stdout, "\n=========================\n");
@@ -99,9 +99,9 @@ spdk_nvmf_startup(spdk_event_t event)

	/* start the rdma poller that will listen
	   on all available ports */
	rc = nvmf_acceptor_start();
	rc = spdk_nvmf_acceptor_start();
	if (rc < 0) {
		SPDK_ERRLOG("nvmf_acceptor_start() failed\n");
		SPDK_ERRLOG("spdk_nvmf_acceptor_start() failed\n");
		goto initialize_error;
	}

+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ CFLAGS += $(DPDK_INC)
LIBNAME = nvmf
C_SRCS = port.c conn.c controller.c \
	 host.c subsystem.c conf.c \
	 nvmf.c request.c session.c
	 nvmf.c request.c session.c transport.c

C_SRCS-$(CONFIG_RDMA) += rdma.c

+6 −2
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include "nvmf_internal.h"
#include "port.h"
#include "subsystem.h"
#include "transport.h"
#include "spdk/conf.h"
#include "spdk/log.h"

@@ -197,12 +198,15 @@ spdk_nvmf_parse_port(struct spdk_conf_section *sp)

	/* Loop over the listen addresses and add them to the port */
	for (i = 0; ; i++) {
		const struct spdk_nvmf_transport *transport;

		transport_name = spdk_conf_section_get_nmval(sp, "Listen", i, 0);
		if (transport_name == NULL) {
			break;
		}

		if (strcasecmp(transport_name, "RDMA") != 0) {
		transport = spdk_nvmf_transport_get(transport_name);
		if (transport == NULL) {
			SPDK_ERRLOG("Unknown transport type '%s'\n", transport_name);
			return -1;
		}
@@ -216,7 +220,7 @@ spdk_nvmf_parse_port(struct spdk_conf_section *sp)
		if (rc < 0) {
			continue;
		}
		fabric_intf = spdk_nvmf_fabric_intf_create(host, listen_port);
		fabric_intf = spdk_nvmf_fabric_intf_create(transport, host, listen_port);
		if (!fabric_intf) {
			continue;
		}
+2 −2
Original line number Diff line number Diff line
@@ -47,10 +47,10 @@

#include "spdk/nvmf_spec.h"
#include "conn.h"
#include "rdma.h"
#include "request.h"
#include "session.h"
#include "subsystem.h"
#include "transport.h"
#include "spdk/queue.h"
#include "spdk/log.h"
#include "spdk/trace.h"
@@ -64,5 +64,5 @@ void
spdk_nvmf_conn_destruct(struct spdk_nvmf_conn *conn)
{
	nvmf_disconnect(conn->sess, conn);
	nvmf_rdma_conn_cleanup(conn);
	conn->transport->conn_fini(conn);
}
+7 −5
Original line number Diff line number Diff line
@@ -40,14 +40,16 @@
#include "nvmf_internal.h"
#include "spdk/queue.h"

struct spdk_nvmf_transport;

enum conn_type {
	CONN_TYPE_AQ = 0,
	CONN_TYPE_IOQ = 1,
};

struct spdk_nvmf_conn {
	const struct spdk_nvmf_transport	*transport;
	struct nvmf_session			*sess;

	enum conn_type				type;

	uint16_t				sq_head;
Loading