lib/event: Make reactor structure public in SPDK internal

Following the last patch, this is also a preparation to add
reactor_get_stats RPC.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia6dc29f591f7112512be8a67b180b056150f467b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478025
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-12-17 17:30:25 -05:00 committed by Tomasz Zawadzki
parent 60eb6da8b7
commit 653dbcb185
2 changed files with 31 additions and 30 deletions

View File

@ -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);

View File

@ -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;