accel: add iobuf channel to accel channel
It will be used for allocating buffers from accel domain and allocating bounce buffers to push/pull the data from memory domains for modules that don't support memory domains. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Idbe4d2129d0aff87d9e517214e9f81e8470c5088 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15745 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
d3ac42caa4
commit
7b0f452b4f
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#define ALIGN_4K 0x1000
|
#define ALIGN_4K 0x1000
|
||||||
#define MAX_TASKS_PER_CHANNEL 0x800
|
#define MAX_TASKS_PER_CHANNEL 0x800
|
||||||
|
#define ACCEL_SMALL_CACHE_SIZE 128
|
||||||
|
#define ACCEL_LARGE_CACHE_SIZE 16
|
||||||
|
|
||||||
/* Largest context size for all accel modules */
|
/* Largest context size for all accel modules */
|
||||||
static size_t g_max_accel_module_size = sizeof(struct spdk_accel_task);
|
static size_t g_max_accel_module_size = sizeof(struct spdk_accel_task);
|
||||||
@ -57,6 +59,7 @@ struct accel_io_channel {
|
|||||||
struct spdk_accel_sequence *seq_pool_base;
|
struct spdk_accel_sequence *seq_pool_base;
|
||||||
TAILQ_HEAD(, spdk_accel_task) task_pool;
|
TAILQ_HEAD(, spdk_accel_task) task_pool;
|
||||||
TAILQ_HEAD(, spdk_accel_sequence) seq_pool;
|
TAILQ_HEAD(, spdk_accel_sequence) seq_pool;
|
||||||
|
struct spdk_iobuf_channel iobuf;
|
||||||
};
|
};
|
||||||
|
|
||||||
TAILQ_HEAD(accel_sequence_tasks, spdk_accel_task);
|
TAILQ_HEAD(accel_sequence_tasks, spdk_accel_task);
|
||||||
@ -1002,7 +1005,7 @@ accel_create_channel(void *io_device, void *ctx_buf)
|
|||||||
struct spdk_accel_task *accel_task;
|
struct spdk_accel_task *accel_task;
|
||||||
struct spdk_accel_sequence *seq;
|
struct spdk_accel_sequence *seq;
|
||||||
uint8_t *task_mem;
|
uint8_t *task_mem;
|
||||||
int i = 0, j;
|
int i = 0, j, rc;
|
||||||
|
|
||||||
accel_ch->task_pool_base = calloc(MAX_TASKS_PER_CHANNEL, g_max_accel_module_size);
|
accel_ch->task_pool_base = calloc(MAX_TASKS_PER_CHANNEL, g_max_accel_module_size);
|
||||||
if (accel_ch->task_pool_base == NULL) {
|
if (accel_ch->task_pool_base == NULL) {
|
||||||
@ -1034,6 +1037,13 @@ accel_create_channel(void *io_device, void *ctx_buf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = spdk_iobuf_channel_init(&accel_ch->iobuf, "accel", ACCEL_SMALL_CACHE_SIZE,
|
||||||
|
ACCEL_LARGE_CACHE_SIZE);
|
||||||
|
if (rc != 0) {
|
||||||
|
SPDK_ERRLOG("Failed to initialize iobuf accel channel\n");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
for (j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
@ -1051,6 +1061,8 @@ accel_destroy_channel(void *io_device, void *ctx_buf)
|
|||||||
struct accel_io_channel *accel_ch = ctx_buf;
|
struct accel_io_channel *accel_ch = ctx_buf;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
spdk_iobuf_channel_fini(&accel_ch->iobuf);
|
||||||
|
|
||||||
for (i = 0; i < ACCEL_OPC_LAST; i++) {
|
for (i = 0; i < ACCEL_OPC_LAST; i++) {
|
||||||
assert(accel_ch->module_ch[i] != NULL);
|
assert(accel_ch->module_ch[i] != NULL);
|
||||||
spdk_put_io_channel(accel_ch->module_ch[i]);
|
spdk_put_io_channel(accel_ch->module_ch[i]);
|
||||||
@ -1132,6 +1144,12 @@ spdk_accel_initialize(void)
|
|||||||
assert(g_modules_opc[op] != NULL);
|
assert(g_modules_opc[op] != NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
rc = spdk_iobuf_register_module("accel");
|
||||||
|
if (rc != 0) {
|
||||||
|
SPDK_ERRLOG("Failed to register accel iobuf module\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need a unique identifier for the accel framework, so use the
|
* We need a unique identifier for the accel framework, so use the
|
||||||
* spdk_accel_module_list address for this purpose.
|
* spdk_accel_module_list address for this purpose.
|
||||||
|
@ -146,7 +146,7 @@ DEPDIRS-bdev_xnvme := $(BDEV_DEPS_THREAD)
|
|||||||
# These depdirs include subsystem interdependencies which
|
# These depdirs include subsystem interdependencies which
|
||||||
# are not related to symbols, but are defined directly in
|
# are not related to symbols, but are defined directly in
|
||||||
# the SPDK event subsystem code.
|
# the SPDK event subsystem code.
|
||||||
DEPDIRS-event_accel := init accel
|
DEPDIRS-event_accel := init accel event_iobuf
|
||||||
DEPDIRS-event_vmd := init vmd $(JSON_LIBS) log thread util
|
DEPDIRS-event_vmd := init vmd $(JSON_LIBS) log thread util
|
||||||
|
|
||||||
DEPDIRS-event_bdev := init bdev event_accel event_vmd event_sock event_iobuf
|
DEPDIRS-event_bdev := init bdev event_accel event_vmd event_sock event_iobuf
|
||||||
|
@ -19,6 +19,7 @@ DIRS-$(CONFIG_VFIO_USER) += vfu_tgt
|
|||||||
# the subsystem dependency tree defined within the event subsystem C files
|
# the subsystem dependency tree defined within the event subsystem C files
|
||||||
# themselves. Should that tree change, these dependencies should change
|
# themselves. Should that tree change, these dependencies should change
|
||||||
# accordingly.
|
# accordingly.
|
||||||
|
DEPDIRS-accel := iobuf
|
||||||
DEPDIRS-bdev := accel vmd sock iobuf
|
DEPDIRS-bdev := accel vmd sock iobuf
|
||||||
DEPDIRS-iscsi := scsi
|
DEPDIRS-iscsi := scsi
|
||||||
DEPDIRS-nbd := bdev
|
DEPDIRS-nbd := bdev
|
||||||
|
@ -40,3 +40,4 @@ static struct spdk_subsystem g_spdk_subsystem_accel = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_accel);
|
SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_accel);
|
||||||
|
SPDK_SUBSYSTEM_DEPEND(accel, iobuf)
|
||||||
|
@ -1667,6 +1667,12 @@ test_sequence_setup(void)
|
|||||||
allocate_threads(1);
|
allocate_threads(1);
|
||||||
set_thread(0);
|
set_thread(0);
|
||||||
|
|
||||||
|
rc = spdk_iobuf_initialize();
|
||||||
|
if (rc != 0) {
|
||||||
|
CU_ASSERT(false);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
rc = spdk_accel_initialize();
|
rc = spdk_accel_initialize();
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
CU_ASSERT(false);
|
CU_ASSERT(false);
|
||||||
@ -1677,7 +1683,7 @@ test_sequence_setup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
accel_finish_cb(void *cb_arg)
|
finish_cb(void *cb_arg)
|
||||||
{
|
{
|
||||||
bool *done = cb_arg;
|
bool *done = cb_arg;
|
||||||
|
|
||||||
@ -1689,12 +1695,18 @@ test_sequence_cleanup(void)
|
|||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
spdk_accel_finish(accel_finish_cb, &done);
|
spdk_accel_finish(finish_cb, &done);
|
||||||
|
|
||||||
while (!done) {
|
while (!done) {
|
||||||
poll_threads();
|
poll_threads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done = false;
|
||||||
|
spdk_iobuf_finish(finish_cb, &done);
|
||||||
|
while (!done) {
|
||||||
|
poll_threads();
|
||||||
|
}
|
||||||
|
|
||||||
free_threads();
|
free_threads();
|
||||||
free_cores();
|
free_cores();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user