diff --git a/include/spdk_internal/event.h b/include/spdk_internal/event.h index 9524bcb83..4ce25fed0 100644 --- a/include/spdk_internal/event.h +++ b/include/spdk_internal/event.h @@ -43,6 +43,7 @@ extern "C" { #include "spdk/event.h" #include "spdk/json.h" #include "spdk/thread.h" +#include "spdk/util.h" struct spdk_event { uint32_t lcore; @@ -51,6 +52,36 @@ struct spdk_event { void *arg2; }; +enum spdk_reactor_state { + SPDK_REACTOR_STATE_UNINITIALIZED = 0, + SPDK_REACTOR_STATE_INITIALIZED = 1, + SPDK_REACTOR_STATE_RUNNING = 2, + SPDK_REACTOR_STATE_EXITING = 3, + SPDK_REACTOR_STATE_SHUTDOWN = 4, +}; + +struct spdk_lw_thread { + TAILQ_ENTRY(spdk_lw_thread) link; +}; + +struct spdk_reactor { + /* Lightweight threads running on this reactor */ + TAILQ_HEAD(, spdk_lw_thread) threads; + + /* Logical core number for this reactor. */ + uint32_t lcore; + + struct { + uint32_t is_valid : 1; + uint32_t reserved : 31; + } flags; + + struct spdk_ring *events; + + /* The last known rusage values */ + struct rusage rusage; +} __attribute__((aligned(SPDK_CACHE_LINE_SIZE))); + int spdk_reactors_init(void); void spdk_reactors_fini(void); diff --git a/lib/event/reactor.c b/lib/event/reactor.c index a9cd98aef..5fc91d919 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -53,36 +53,6 @@ #define SPDK_EVENT_BATCH_SIZE 8 -enum spdk_reactor_state { - SPDK_REACTOR_STATE_UNINITIALIZED = 0, - SPDK_REACTOR_STATE_INITIALIZED = 1, - SPDK_REACTOR_STATE_RUNNING = 2, - SPDK_REACTOR_STATE_EXITING = 3, - SPDK_REACTOR_STATE_SHUTDOWN = 4, -}; - -struct spdk_lw_thread { - TAILQ_ENTRY(spdk_lw_thread) link; -}; - -struct spdk_reactor { - /* Lightweight threads running on this reactor */ - TAILQ_HEAD(, spdk_lw_thread) threads; - - /* Logical core number for this reactor. */ - uint32_t lcore; - - struct { - uint32_t is_valid : 1; - uint32_t reserved : 31; - } flags; - - struct spdk_ring *events; - - /* The last known rusage values */ - struct rusage rusage; -} __attribute__((aligned(SPDK_CACHE_LINE_SIZE))); - static struct spdk_reactor *g_reactors; static struct spdk_cpuset g_reactor_core_mask; static enum spdk_reactor_state g_reactor_state = SPDK_REACTOR_STATE_UNINITIALIZED;