nvmf: Poll groups now automatically register pollers
This simplifies the public API and requirements for user applications. Change-Id: Ibb0d25a7838a0fa683f39e79cb4fef78adf6aee8 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/388040 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
2bbe6a8021
commit
eaaddf3d48
@ -44,7 +44,6 @@
|
|||||||
|
|
||||||
struct nvmf_tgt_poll_group {
|
struct nvmf_tgt_poll_group {
|
||||||
struct spdk_nvmf_poll_group *group;
|
struct spdk_nvmf_poll_group *group;
|
||||||
struct spdk_poller *poller;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nvmf_tgt g_tgt = {};
|
struct nvmf_tgt g_tgt = {};
|
||||||
@ -111,14 +110,6 @@ spdk_nvmf_shutdown_cb(void)
|
|||||||
nvmf_tgt_advance_state(NULL, NULL);
|
nvmf_tgt_advance_state(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
subsystem_poll(void *arg)
|
|
||||||
{
|
|
||||||
struct nvmf_tgt_subsystem *app_subsys = arg;
|
|
||||||
|
|
||||||
spdk_nvmf_subsystem_poll(app_subsys->subsystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_nvmf_tgt_start_subsystem(void *arg1, void *arg2)
|
_nvmf_tgt_start_subsystem(void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
@ -126,8 +117,6 @@ _nvmf_tgt_start_subsystem(void *arg1, void *arg2)
|
|||||||
struct spdk_nvmf_subsystem *subsystem = app_subsys->subsystem;
|
struct spdk_nvmf_subsystem *subsystem = app_subsys->subsystem;
|
||||||
|
|
||||||
spdk_nvmf_subsystem_start(subsystem);
|
spdk_nvmf_subsystem_start(subsystem);
|
||||||
|
|
||||||
app_subsys->poller = spdk_poller_register(subsystem_poll, app_subsys, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -210,14 +199,6 @@ acceptor_poll(void *arg)
|
|||||||
spdk_nvmf_tgt_accept(tgt);
|
spdk_nvmf_tgt_accept(tgt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
nvmf_tgt_poll_group_poll(void *arg)
|
|
||||||
{
|
|
||||||
struct nvmf_tgt_poll_group *app_poll_group = arg;
|
|
||||||
|
|
||||||
spdk_nvmf_poll_group_poll(app_poll_group->group);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nvmf_tgt_destroy_poll_group_done(void *arg1, void *arg2)
|
nvmf_tgt_destroy_poll_group_done(void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
@ -236,8 +217,6 @@ nvmf_tgt_destroy_poll_group(void *arg1, void *arg2)
|
|||||||
pg = &g_poll_groups[g_tgt.core];
|
pg = &g_poll_groups[g_tgt.core];
|
||||||
assert(pg != NULL);
|
assert(pg != NULL);
|
||||||
|
|
||||||
spdk_poller_unregister(&pg->poller);
|
|
||||||
|
|
||||||
spdk_nvmf_poll_group_destroy(pg->group);
|
spdk_nvmf_poll_group_destroy(pg->group);
|
||||||
pg->group = NULL;
|
pg->group = NULL;
|
||||||
|
|
||||||
@ -276,7 +255,6 @@ nvmf_tgt_create_poll_group(void *arg1, void *arg2)
|
|||||||
SPDK_ERRLOG("Failed to create poll group for core %u\n", g_tgt.core);
|
SPDK_ERRLOG("Failed to create poll group for core %u\n", g_tgt.core);
|
||||||
}
|
}
|
||||||
|
|
||||||
pg->poller = spdk_poller_register(nvmf_tgt_poll_group_poll, pg, 0);
|
|
||||||
g_active_poll_groups++;
|
g_active_poll_groups++;
|
||||||
|
|
||||||
spdk_event_call(event);
|
spdk_event_call(event);
|
||||||
|
@ -111,11 +111,6 @@ struct spdk_nvmf_poll_group *spdk_nvmf_poll_group_create(struct spdk_nvmf_tgt *t
|
|||||||
*/
|
*/
|
||||||
void spdk_nvmf_poll_group_destroy(struct spdk_nvmf_poll_group *group);
|
void spdk_nvmf_poll_group_destroy(struct spdk_nvmf_poll_group *group);
|
||||||
|
|
||||||
/**
|
|
||||||
* Check a poll group for work completions.
|
|
||||||
*/
|
|
||||||
int spdk_nvmf_poll_group_poll(struct spdk_nvmf_poll_group *group);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The NVMf subsystem, as indicated in the specification, is a collection
|
* The NVMf subsystem, as indicated in the specification, is a collection
|
||||||
* of controllers. Any individual controller has
|
* of controllers. Any individual controller has
|
||||||
@ -254,9 +249,6 @@ struct spdk_nvmf_listener *spdk_nvmf_subsystem_get_next_listener(
|
|||||||
const struct spdk_nvme_transport_id *spdk_nvmf_listener_get_trid(
|
const struct spdk_nvme_transport_id *spdk_nvmf_listener_get_trid(
|
||||||
struct spdk_nvmf_listener *listener);
|
struct spdk_nvmf_listener *listener);
|
||||||
|
|
||||||
|
|
||||||
void spdk_nvmf_subsystem_poll(struct spdk_nvmf_subsystem *subsystem);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a namespace to a subsytem.
|
* Add a namespace to a subsytem.
|
||||||
*
|
*
|
||||||
|
@ -589,12 +589,6 @@ spdk_nvmf_property_set(struct spdk_nvmf_request *req)
|
|||||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
spdk_nvmf_ctrlr_poll(struct spdk_nvmf_ctrlr *ctrlr)
|
|
||||||
{
|
|
||||||
return spdk_nvmf_poll_group_poll(ctrlr->group);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_nvmf_ctrlr_set_features_host_identifier(struct spdk_nvmf_request *req)
|
spdk_nvmf_ctrlr_set_features_host_identifier(struct spdk_nvmf_request *req)
|
||||||
{
|
{
|
||||||
|
@ -199,6 +199,21 @@ spdk_nvmf_tgt_accept(struct spdk_nvmf_tgt *tgt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
spdk_nvmf_poll_group_poll(void *ctx)
|
||||||
|
{
|
||||||
|
struct spdk_nvmf_poll_group *group = ctx;
|
||||||
|
int rc;
|
||||||
|
struct spdk_nvmf_transport_poll_group *tgroup;
|
||||||
|
|
||||||
|
TAILQ_FOREACH(tgroup, &group->tgroups, link) {
|
||||||
|
rc = spdk_nvmf_transport_poll_group_poll(tgroup);
|
||||||
|
if (rc < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct spdk_nvmf_poll_group *
|
struct spdk_nvmf_poll_group *
|
||||||
spdk_nvmf_poll_group_create(struct spdk_nvmf_tgt *tgt)
|
spdk_nvmf_poll_group_create(struct spdk_nvmf_tgt *tgt)
|
||||||
{
|
{
|
||||||
@ -223,6 +238,8 @@ spdk_nvmf_poll_group_create(struct spdk_nvmf_tgt *tgt)
|
|||||||
TAILQ_INSERT_TAIL(&group->tgroups, tgroup, link);
|
TAILQ_INSERT_TAIL(&group->tgroups, tgroup, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group->poller = spdk_poller_register(spdk_nvmf_poll_group_poll, group, 0);
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,6 +248,8 @@ spdk_nvmf_poll_group_destroy(struct spdk_nvmf_poll_group *group)
|
|||||||
{
|
{
|
||||||
struct spdk_nvmf_transport_poll_group *tgroup, *tmp;
|
struct spdk_nvmf_transport_poll_group *tgroup, *tmp;
|
||||||
|
|
||||||
|
spdk_poller_unregister(&group->poller);
|
||||||
|
|
||||||
TAILQ_FOREACH_SAFE(tgroup, &group->tgroups, link, tmp) {
|
TAILQ_FOREACH_SAFE(tgroup, &group->tgroups, link, tmp) {
|
||||||
TAILQ_REMOVE(&group->tgroups, tgroup, link);
|
TAILQ_REMOVE(&group->tgroups, tgroup, link);
|
||||||
spdk_nvmf_transport_poll_group_destroy(tgroup);
|
spdk_nvmf_transport_poll_group_destroy(tgroup);
|
||||||
@ -273,25 +292,6 @@ spdk_nvmf_poll_group_remove(struct spdk_nvmf_poll_group *group,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
spdk_nvmf_poll_group_poll(struct spdk_nvmf_poll_group *group)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
int count = 0;
|
|
||||||
struct spdk_nvmf_transport_poll_group *tgroup;
|
|
||||||
|
|
||||||
TAILQ_FOREACH(tgroup, &group->tgroups, link) {
|
|
||||||
rc = spdk_nvmf_transport_poll_group_poll(tgroup);
|
|
||||||
if (rc < 0) {
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
count += rc;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDK_TRACE_REGISTER_FN(nvmf_trace)
|
SPDK_TRACE_REGISTER_FN(nvmf_trace)
|
||||||
{
|
{
|
||||||
spdk_trace_register_object(OBJECT_NVMF_IO, 'r');
|
spdk_trace_register_object(OBJECT_NVMF_IO, 'r');
|
||||||
|
@ -78,7 +78,8 @@ struct spdk_nvmf_transport_poll_group {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct spdk_nvmf_poll_group {
|
struct spdk_nvmf_poll_group {
|
||||||
TAILQ_HEAD(, spdk_nvmf_transport_poll_group) tgroups;
|
struct spdk_poller *poller;
|
||||||
|
TAILQ_HEAD(, spdk_nvmf_transport_poll_group) tgroups;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum _spdk_nvmf_request_exec_status {
|
typedef enum _spdk_nvmf_request_exec_status {
|
||||||
@ -214,7 +215,6 @@ void spdk_nvmf_get_discovery_log_page(struct spdk_nvmf_tgt *tgt,
|
|||||||
uint32_t length);
|
uint32_t length);
|
||||||
|
|
||||||
struct spdk_nvmf_qpair *spdk_nvmf_ctrlr_get_qpair(struct spdk_nvmf_ctrlr *ctrlr, uint16_t qid);
|
struct spdk_nvmf_qpair *spdk_nvmf_ctrlr_get_qpair(struct spdk_nvmf_ctrlr *ctrlr, uint16_t qid);
|
||||||
int spdk_nvmf_ctrlr_poll(struct spdk_nvmf_ctrlr *ctrlr);
|
|
||||||
void spdk_nvmf_ctrlr_destruct(struct spdk_nvmf_ctrlr *ctrlr);
|
void spdk_nvmf_ctrlr_destruct(struct spdk_nvmf_ctrlr *ctrlr);
|
||||||
int spdk_nvmf_ctrlr_process_fabrics_cmd(struct spdk_nvmf_request *req);
|
int spdk_nvmf_ctrlr_process_fabrics_cmd(struct spdk_nvmf_request *req);
|
||||||
int spdk_nvmf_ctrlr_process_admin_cmd(struct spdk_nvmf_request *req);
|
int spdk_nvmf_ctrlr_process_admin_cmd(struct spdk_nvmf_request *req);
|
||||||
|
@ -50,17 +50,6 @@ spdk_nvmf_subsystem_start(struct spdk_nvmf_subsystem *subsystem)
|
|||||||
return spdk_nvmf_subsystem_bdev_attach(subsystem);
|
return spdk_nvmf_subsystem_bdev_attach(subsystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
spdk_nvmf_subsystem_poll(struct spdk_nvmf_subsystem *subsystem)
|
|
||||||
{
|
|
||||||
struct spdk_nvmf_ctrlr *ctrlr;
|
|
||||||
|
|
||||||
TAILQ_FOREACH(ctrlr, &subsystem->ctrlrs, link) {
|
|
||||||
/* For each connection in the ctrlr, check for completions */
|
|
||||||
spdk_nvmf_ctrlr_poll(ctrlr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
spdk_nvmf_valid_nqn(const char *nqn)
|
spdk_nvmf_valid_nqn(const char *nqn)
|
||||||
{
|
{
|
||||||
|
@ -81,12 +81,6 @@ spdk_nvmf_poll_group_remove(struct spdk_nvmf_poll_group *group,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
spdk_nvmf_poll_group_poll(struct spdk_nvmf_poll_group *group)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
spdk_nvmf_subsystem_get_sn(const struct spdk_nvmf_subsystem *subsystem)
|
spdk_nvmf_subsystem_get_sn(const struct spdk_nvmf_subsystem *subsystem)
|
||||||
{
|
{
|
||||||
|
@ -122,12 +122,6 @@ spdk_nvmf_ctrlr_destruct(struct spdk_nvmf_ctrlr *ctrlr)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
spdk_nvmf_ctrlr_poll(struct spdk_nvmf_ctrlr *ctrlr)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_nvmf_subsystem_bdev_attach(struct spdk_nvmf_subsystem *subsystem)
|
spdk_nvmf_subsystem_bdev_attach(struct spdk_nvmf_subsystem *subsystem)
|
||||||
{
|
{
|
||||||
|
@ -142,12 +142,6 @@ spdk_nvmf_ctrlr_destruct(struct spdk_nvmf_ctrlr *ctrlr)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
spdk_nvmf_ctrlr_poll(struct spdk_nvmf_ctrlr *ctrlr)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_bdev_open(struct spdk_bdev *bdev, bool write, spdk_bdev_remove_cb_t remove_cb,
|
spdk_bdev_open(struct spdk_bdev *bdev, bool write, spdk_bdev_remove_cb_t remove_cb,
|
||||||
void *remove_ctx, struct spdk_bdev_desc **desc)
|
void *remove_ctx, struct spdk_bdev_desc **desc)
|
||||||
|
Loading…
Reference in New Issue
Block a user