Commit 7b3c6fbd authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

nvmf: Remove connect/disconnect_cb from subsystems



The requests are now sent using spdk_thread_send_msg
internally, so the user no longer needs to supply
these callbacks.

Change-Id: I84b0f5f0f1f6fa6eaf9a717934925d3ad802fcfd
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/376240


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJohn Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent d5ce9cff
Loading
Loading
Loading
Loading
+1 −40
Original line number Diff line number Diff line
@@ -124,44 +124,6 @@ subsystem_poll(void *arg)
	spdk_nvmf_subsystem_poll(app_subsys->subsystem);
}

static void
connect_event(void *arg1, void *arg2)
{
	struct spdk_nvmf_request *req = arg1;

	spdk_nvmf_handle_connect(req);
}

static void
connect_cb(void *cb_ctx, struct spdk_nvmf_request *req)
{
	struct nvmf_tgt_subsystem *app_subsys = cb_ctx;
	struct spdk_event *event;

	/* Pass an event to the lcore that owns this subsystem */
	event = spdk_event_allocate(app_subsys->lcore, connect_event, req, NULL);
	spdk_event_call(event);
}

static void
disconnect_event(void *arg1, void *arg2)
{
	struct spdk_nvmf_qpair *qpair = arg1;

	spdk_nvmf_ctrlr_disconnect(qpair);
}

static void
disconnect_cb(void *cb_ctx, struct spdk_nvmf_qpair *qpair)
{
	struct nvmf_tgt_subsystem *app_subsys = cb_ctx;
	struct spdk_event *event;

	/* Pass an event to the core that owns this connection */
	event = spdk_event_allocate(app_subsys->lcore, disconnect_event, qpair, NULL);
	spdk_event_call(event);
}

static void
_nvmf_tgt_start_subsystem(void *arg1, void *arg2)
{
@@ -202,8 +164,7 @@ nvmf_tgt_create_subsystem(const char *name, enum spdk_nvmf_subtype subtype, uint
		return NULL;
	}

	subsystem = spdk_nvmf_create_subsystem(g_tgt, name, subtype, num_ns, app_subsys, connect_cb,
					       disconnect_cb);
	subsystem = spdk_nvmf_create_subsystem(g_tgt, name, subtype, num_ns);
	if (subsystem == NULL) {
		SPDK_ERRLOG("Subsystem creation failed\n");
		free(app_subsys);
+1 −7
Original line number Diff line number Diff line
@@ -100,9 +100,6 @@ struct spdk_nvmf_request;
struct spdk_nvmf_host;
struct spdk_nvmf_listener;

typedef void (*spdk_nvmf_subsystem_connect_fn)(void *cb_ctx, struct spdk_nvmf_request *req);
typedef void (*spdk_nvmf_subsystem_disconnect_fn)(void *cb_ctx, struct spdk_nvmf_qpair *qpair);

/*
 * The NVMf subsystem, as indicated in the specification, is a collection
 * of controllers.  Any individual controller has
@@ -111,10 +108,7 @@ typedef void (*spdk_nvmf_subsystem_disconnect_fn)(void *cb_ctx, struct spdk_nvmf
struct spdk_nvmf_subsystem *spdk_nvmf_create_subsystem(struct spdk_nvmf_tgt *tgt,
		const char *nqn,
		enum spdk_nvmf_subtype type,
		uint32_t num_ns,
		void *cb_ctx,
		spdk_nvmf_subsystem_connect_fn connect_cb,
		spdk_nvmf_subsystem_disconnect_fn disconnect_cb);
		uint32_t num_ns);

/**
 * Search the target for a subsystem with the given NQN
+0 −4
Original line number Diff line number Diff line
@@ -97,10 +97,6 @@ struct spdk_nvmf_subsystem {
	uint32_t 				max_nsid;
	uint32_t				num_allocated_nsid;

	void					*cb_ctx;
	spdk_nvmf_subsystem_connect_fn		connect_cb;
	spdk_nvmf_subsystem_disconnect_fn	disconnect_cb;

	TAILQ_HEAD(, spdk_nvmf_ctrlr)		ctrlrs;

	TAILQ_HEAD(, spdk_nvmf_host)		hosts;
+10 −4
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include "transport.h"

#include "spdk/assert.h"
#include "spdk/io_channel.h"
#include "spdk/nvmf.h"
#include "spdk/nvmf_spec.h"
#include "spdk/string.h"
@@ -675,12 +676,19 @@ err0:
	return -1;
}

static void
nvmf_rdma_handle_disconnect(void *ctx)
{
	struct spdk_nvmf_qpair *qpair = ctx;

	spdk_nvmf_ctrlr_disconnect(qpair);
}

static int
nvmf_rdma_disconnect(struct rdma_cm_event *evt)
{
	struct spdk_nvmf_qpair		*qpair;
	struct spdk_nvmf_ctrlr		*ctrlr;
	struct spdk_nvmf_subsystem	*subsystem;
	struct spdk_nvmf_rdma_qpair 	*rdma_qpair;
	struct spdk_nvmf_rdma_qpair	*r, *t;

@@ -720,9 +728,7 @@ nvmf_rdma_disconnect(struct rdma_cm_event *evt)
		return 0;
	}

	subsystem = ctrlr->subsys;

	subsystem->disconnect_cb(subsystem->cb_ctx, qpair);
	spdk_thread_send_msg(qpair->thread, nvmf_rdma_handle_disconnect, qpair);

	return 0;
}
+2 −20
Original line number Diff line number Diff line
@@ -111,24 +111,6 @@ nvmf_process_property_set(struct spdk_nvmf_request *req)
	return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}

void
spdk_nvmf_handle_connect(struct spdk_nvmf_request *req)
{
	struct spdk_nvmf_fabric_connect_cmd *connect = &req->cmd->connect_cmd;
	struct spdk_nvmf_fabric_connect_data *connect_data = (struct spdk_nvmf_fabric_connect_data *)
			req->data;
	struct spdk_nvmf_fabric_connect_rsp *response = &req->rsp->connect_rsp;
	struct spdk_nvmf_qpair *qpair = req->qpair;

	spdk_nvmf_ctrlr_connect(qpair, connect, connect_data, response);

	SPDK_DEBUGLOG(SPDK_TRACE_NVMF, "connect capsule response: cntlid = 0x%04x\n",
		      response->status_code_specific.success.cntlid);

	spdk_nvmf_request_complete(req);
	return;
}

static void
invalid_connect_response(struct spdk_nvmf_fabric_connect_rsp *rsp, uint8_t iattr, uint16_t ipo)
{
@@ -195,9 +177,9 @@ nvmf_process_connect(struct spdk_nvmf_request *req)
		return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
	}

	subsystem->connect_cb(subsystem->cb_ctx, req);
	spdk_nvmf_ctrlr_connect(req->qpair, cmd, req->data, rsp);

	return SPDK_NVMF_REQUEST_EXEC_STATUS_ASYNCHRONOUS;
	return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}

static spdk_nvmf_request_exec_status
Loading