nvmf: add a periodical admin poller for AER event in direct mode
Change-Id: Ib8cba61fe3d531f9228d0c385913d63914ba8093 Signed-off-by: GangCao <gang.cao@intel.com>
This commit is contained in:
parent
89d10dd80e
commit
7224a42d9d
@ -134,9 +134,10 @@ struct spdk_nvmf_subsystem {
|
|||||||
bool is_removed;
|
bool is_removed;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
struct spdk_nvme_ctrlr *ctrlr;
|
struct spdk_nvme_ctrlr *ctrlr;
|
||||||
struct spdk_nvme_qpair *io_qpair;
|
struct spdk_nvme_qpair *io_qpair;
|
||||||
struct spdk_pci_addr pci_addr;
|
struct spdk_pci_addr pci_addr;
|
||||||
|
struct spdk_poller *admin_poller;
|
||||||
} direct;
|
} direct;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@ -160,7 +161,7 @@ struct spdk_nvmf_subsystem {
|
|||||||
|
|
||||||
TAILQ_HEAD(, spdk_nvmf_subsystem_allowed_listener) allowed_listeners;
|
TAILQ_HEAD(, spdk_nvmf_subsystem_allowed_listener) allowed_listeners;
|
||||||
|
|
||||||
TAILQ_ENTRY(spdk_nvmf_subsystem) entries;
|
TAILQ_ENTRY(spdk_nvmf_subsystem) entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct spdk_nvmf_subsystem *spdk_nvmf_create_subsystem(const char *nqn,
|
struct spdk_nvmf_subsystem *spdk_nvmf_create_subsystem(const char *nqn,
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "spdk/nvmf_spec.h"
|
#include "spdk/nvmf_spec.h"
|
||||||
#include "spdk/trace.h"
|
#include "spdk/trace.h"
|
||||||
#include "spdk/util.h"
|
#include "spdk/util.h"
|
||||||
|
#include "spdk/event.h"
|
||||||
|
|
||||||
#include "spdk_internal/log.h"
|
#include "spdk_internal/log.h"
|
||||||
|
|
||||||
@ -51,10 +52,27 @@ nvmf_direct_ctrlr_get_data(struct spdk_nvmf_session *session)
|
|||||||
memcpy(&session->vcdata, cdata, sizeof(struct spdk_nvme_ctrlr_data));
|
memcpy(&session->vcdata, cdata, sizeof(struct spdk_nvme_ctrlr_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nvmf_direct_ctrlr_poll_for_admin_completions(void *arg)
|
||||||
|
{
|
||||||
|
struct spdk_nvmf_subsystem *subsystem = arg;
|
||||||
|
|
||||||
|
spdk_nvme_ctrlr_process_admin_completions(subsystem->dev.direct.ctrlr);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nvmf_direct_ctrlr_poll_for_completions(struct spdk_nvmf_subsystem *subsystem)
|
nvmf_direct_ctrlr_poll_for_completions(struct spdk_nvmf_subsystem *subsystem)
|
||||||
{
|
{
|
||||||
spdk_nvme_ctrlr_process_admin_completions(subsystem->dev.direct.ctrlr);
|
if (subsystem->dev.direct.admin_poller == NULL) {
|
||||||
|
int lcore = spdk_app_get_current_core();
|
||||||
|
|
||||||
|
spdk_poller_register(&subsystem->dev.direct.admin_poller,
|
||||||
|
nvmf_direct_ctrlr_poll_for_admin_completions,
|
||||||
|
subsystem, lcore, 10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
nvmf_direct_ctrlr_poll_for_admin_completions(subsystem);
|
||||||
|
|
||||||
spdk_nvme_qpair_process_completions(subsystem->dev.direct.io_qpair, 0);
|
spdk_nvme_qpair_process_completions(subsystem->dev.direct.io_qpair, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,6 +262,10 @@ static void
|
|||||||
nvmf_direct_ctrlr_detach(struct spdk_nvmf_subsystem *subsystem)
|
nvmf_direct_ctrlr_detach(struct spdk_nvmf_subsystem *subsystem)
|
||||||
{
|
{
|
||||||
if (subsystem->dev.direct.ctrlr) {
|
if (subsystem->dev.direct.ctrlr) {
|
||||||
|
if (subsystem->dev.direct.admin_poller != NULL) {
|
||||||
|
spdk_poller_unregister(&subsystem->dev.direct.admin_poller, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
spdk_nvme_detach(subsystem->dev.direct.ctrlr);
|
spdk_nvme_detach(subsystem->dev.direct.ctrlr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,25 @@
|
|||||||
|
|
||||||
SPDK_LOG_REGISTER_TRACE_FLAG("nvmf", SPDK_TRACE_NVMF)
|
SPDK_LOG_REGISTER_TRACE_FLAG("nvmf", SPDK_TRACE_NVMF)
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
spdk_app_get_current_core(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spdk_poller_register(struct spdk_poller **ppoller, spdk_poller_fn fn, void *arg,
|
||||||
|
uint32_t lcore, uint64_t period_microseconds)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spdk_poller_unregister(struct spdk_poller **ppoller, struct spdk_event *complete)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
spdk_nvme_ctrlr_process_admin_completions(struct spdk_nvme_ctrlr *ctrlr)
|
spdk_nvme_ctrlr_process_admin_completions(struct spdk_nvme_ctrlr *ctrlr)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user