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: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/376240 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: John Kariuki <John.K.Kariuki@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
d5ce9cff63
commit
7b3c6fbd40
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -116,10 +116,7 @@ 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)
|
||||
{
|
||||
struct spdk_nvmf_subsystem *subsystem;
|
||||
|
||||
@ -145,9 +142,6 @@ spdk_nvmf_create_subsystem(struct spdk_nvmf_tgt *tgt,
|
||||
subsystem->subtype = type;
|
||||
subsystem->max_nsid = num_ns;
|
||||
subsystem->num_allocated_nsid = 0;
|
||||
subsystem->cb_ctx = cb_ctx;
|
||||
subsystem->connect_cb = connect_cb;
|
||||
subsystem->disconnect_cb = disconnect_cb;
|
||||
snprintf(subsystem->subnqn, sizeof(subsystem->subnqn), "%s", nqn);
|
||||
TAILQ_INIT(&subsystem->listeners);
|
||||
TAILQ_INIT(&subsystem->hosts);
|
||||
|
@ -168,8 +168,7 @@ test_discovery_log(void)
|
||||
|
||||
/* Add one subsystem and verify that the discovery log contains it */
|
||||
subsystem = spdk_nvmf_create_subsystem(&tgt, "nqn.2016-06.io.spdk:subsystem1",
|
||||
SPDK_NVMF_SUBTYPE_NVME, 0,
|
||||
NULL, NULL, NULL);
|
||||
SPDK_NVMF_SUBTYPE_NVME, 0);
|
||||
SPDK_CU_ASSERT_FATAL(subsystem != NULL);
|
||||
|
||||
trid.trtype = SPDK_NVME_TRANSPORT_RDMA;
|
||||
|
@ -202,8 +202,7 @@ nvmf_test_create_subsystem(void)
|
||||
TAILQ_INIT(&tgt.subsystems);
|
||||
|
||||
strncpy(nqn, "nqn.2016-06.io.spdk:subsystem1", sizeof(nqn));
|
||||
subsystem = spdk_nvmf_create_subsystem(&tgt, nqn, SPDK_NVMF_SUBTYPE_NVME, 0,
|
||||
NULL, NULL, NULL);
|
||||
subsystem = spdk_nvmf_create_subsystem(&tgt, nqn, SPDK_NVMF_SUBTYPE_NVME, 0);
|
||||
SPDK_CU_ASSERT_FATAL(subsystem != NULL);
|
||||
CU_ASSERT_STRING_EQUAL(subsystem->subnqn, nqn);
|
||||
spdk_nvmf_delete_subsystem(subsystem);
|
||||
@ -213,8 +212,7 @@ nvmf_test_create_subsystem(void)
|
||||
memset(nqn + strlen(nqn), 'a', 223 - strlen(nqn));
|
||||
nqn[223] = '\0';
|
||||
CU_ASSERT(strlen(nqn) == 223);
|
||||
subsystem = spdk_nvmf_create_subsystem(&tgt, nqn, SPDK_NVMF_SUBTYPE_NVME, 0,
|
||||
NULL, NULL, NULL);
|
||||
subsystem = spdk_nvmf_create_subsystem(&tgt, nqn, SPDK_NVMF_SUBTYPE_NVME, 0);
|
||||
SPDK_CU_ASSERT_FATAL(subsystem != NULL);
|
||||
CU_ASSERT_STRING_EQUAL(subsystem->subnqn, nqn);
|
||||
spdk_nvmf_delete_subsystem(subsystem);
|
||||
@ -224,8 +222,7 @@ nvmf_test_create_subsystem(void)
|
||||
memset(nqn + strlen(nqn), 'a', 224 - strlen(nqn));
|
||||
nqn[224] = '\0';
|
||||
CU_ASSERT(strlen(nqn) == 224);
|
||||
subsystem = spdk_nvmf_create_subsystem(&tgt, nqn, SPDK_NVMF_SUBTYPE_NVME, 0,
|
||||
NULL, NULL, NULL);
|
||||
subsystem = spdk_nvmf_create_subsystem(&tgt, nqn, SPDK_NVMF_SUBTYPE_NVME, 0);
|
||||
CU_ASSERT(subsystem == NULL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user