global: rename copy to accel

The copy engine library, modules and public APIs have been renamed.
Use of the word `copy` has been replaced with the word `accel`
short for accelerator in preparation for adding new capabilities
in the future. Additionally, APIs for what was previously called
the `memcpy` engine have been renamed to identify the engine as a
software accelerator.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ia607aa718416146fbba1e6792b8de0f66bd8a5de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/576
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
paul luse 2020-02-05 17:10:05 +00:00 committed by Tomasz Zawadzki
parent b1daf62be5
commit aa7a13afc7
49 changed files with 551 additions and 539 deletions

View File

@ -2,6 +2,13 @@
## v20.04: (Upcoming Release) ## v20.04: (Upcoming Release)
### copy
The copy engine library, modules and public APIs have been renamed. Use of the word `copy`
has been replaced with the word `accel` short for accelerator in preparation for adding new
capabilities in the future. Additionally, APIs for what was previously called the `memcpy`
engine have been renamed to identify the engine as a software accelerator.
### vmd ### vmd
A new function, `spdk_vmd_fini`, has been added. It releases all resources acquired by the VMD A new function, `spdk_vmd_fini`, has been added. It releases all resources acquired by the VMD

View File

@ -44,8 +44,8 @@ CFLAGS += -I$(SPDK_ROOT_DIR)/lib
C_SRCS := iscsi_tgt.c C_SRCS := iscsi_tgt.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_iscsi event_net event_scsi event_vmd event SPDK_LIB_LIST += event_bdev event_accel event_iscsi event_net event_scsi event_vmd event
SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev iscsi scsi copy trace conf SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev iscsi scsi accel trace conf
SPDK_LIB_LIST += thread util log log_rpc app_rpc net sock notify SPDK_LIB_LIST += thread util log log_rpc app_rpc net sock notify
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV)) ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))

View File

@ -40,8 +40,8 @@ APP = nvmf_tgt
C_SRCS := nvmf_main.c C_SRCS := nvmf_main.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_nvmf event_net event_vmd SPDK_LIB_LIST += event_bdev event_accel event_nvmf event_net event_vmd
SPDK_LIB_LIST += nvmf event log trace conf thread util bdev copy rpc jsonrpc json net sock SPDK_LIB_LIST += nvmf event log trace conf thread util bdev accel rpc jsonrpc json net sock
SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc notify SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc notify
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV)) ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))

View File

@ -50,8 +50,8 @@ endif
endif endif
endif endif
SPDK_LIB_LIST += event_bdev event_copy event_iscsi event_net event_scsi event_nvmf event_vmd event SPDK_LIB_LIST += event_bdev event_accel event_iscsi event_net event_scsi event_nvmf event_vmd event
SPDK_LIB_LIST += nvmf trace log conf thread util bdev iscsi scsi copy rpc jsonrpc json SPDK_LIB_LIST += nvmf trace log conf thread util bdev iscsi scsi accel rpc jsonrpc json
SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc net sock notify SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc net sock notify
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV)) ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))

View File

@ -46,8 +46,8 @@ ifeq ($(CONFIG_VHOST_INTERNAL_LIB),y)
SPDK_LIB_LIST += rte_vhost SPDK_LIB_LIST += rte_vhost
endif endif
SPDK_LIB_LIST += event_bdev event_copy event_net event_scsi event_vmd event SPDK_LIB_LIST += event_bdev event_accel event_net event_scsi event_vmd event
SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev scsi copy trace conf SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev scsi accel trace conf
SPDK_LIB_LIST += thread util log log_rpc app_rpc SPDK_LIB_LIST += thread util log log_rpc app_rpc
SPDK_LIB_LIST += event_nbd nbd net sock notify SPDK_LIB_LIST += event_nbd nbd net sock notify

View File

@ -279,7 +279,7 @@ Example response:
"framework_get_subsystems", "framework_get_subsystems",
"framework_monitor_context_switch", "framework_monitor_context_switch",
"spdk_kill_instance", "spdk_kill_instance",
"ioat_scan_copy_engine", "ioat_scan_accel_engine",
"bdev_virtio_attach_controller", "bdev_virtio_attach_controller",
"bdev_virtio_scsi_get_devices", "bdev_virtio_scsi_get_devices",
"bdev_virtio_detach_controller", "bdev_virtio_detach_controller",
@ -349,7 +349,7 @@ Example response:
"id": 1, "id": 1,
"result": [ "result": [
{ {
"subsystem": "copy", "subsystem": "accel",
"depends_on": [] "depends_on": []
}, },
{ {
@ -365,7 +365,7 @@ Example response:
{ {
"subsystem": "bdev", "subsystem": "bdev",
"depends_on": [ "depends_on": [
"copy" "accel"
] ]
}, },
{ {

View File

@ -43,7 +43,7 @@ CFLAGS += -I$(CONFIG_FIO_SOURCE_DIR)
LDFLAGS += -shared -rdynamic -Wl,-z,nodelete LDFLAGS += -shared -rdynamic -Wl,-z,nodelete
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += thread util bdev bdev_rpc conf copy rpc jsonrpc json log sock trace notify SPDK_LIB_LIST += thread util bdev bdev_rpc conf accel rpc jsonrpc json log sock trace notify
SPDK_LIB_LIST += event event_bdev event_copy event_vmd SPDK_LIB_LIST += event event_bdev event_accel event_vmd
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -34,7 +34,7 @@
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk/bdev.h" #include "spdk/bdev.h"
#include "spdk/copy_engine.h" #include "spdk/accel_engine.h"
#include "spdk/conf.h" #include "spdk/conf.h"
#include "spdk/env.h" #include "spdk/env.h"
#include "spdk/thread.h" #include "spdk/thread.h"

View File

@ -38,7 +38,7 @@ APP = hello_bdev
C_SRCS := hello_bdev.c C_SRCS := hello_bdev.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_vmd SPDK_LIB_LIST += event_bdev event_accel event_vmd
SPDK_LIB_LIST += bdev_rpc bdev copy event thread util conf trace log jsonrpc json rpc sock notify SPDK_LIB_LIST += bdev_rpc bdev accel event thread util conf trace log jsonrpc json rpc sock notify
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -39,8 +39,8 @@ C_SRCS := blobcli.c
# Don't link bdev_lvol in blobcli - otherwise this utility cannot operate on an lvolstore # Don't link bdev_lvol in blobcli - otherwise this utility cannot operate on an lvolstore
SPDK_LIB_LIST = $(filter-out bdev_lvol,$(ALL_MODULES_LIST)) SPDK_LIB_LIST = $(filter-out bdev_lvol,$(ALL_MODULES_LIST))
SPDK_LIB_LIST += event_bdev event_copy event_vmd SPDK_LIB_LIST += event_bdev event_accel event_vmd
SPDK_LIB_LIST += bdev copy event thread util conf trace \ SPDK_LIB_LIST += bdev accel event thread util conf trace \
log jsonrpc json rpc sock notify log jsonrpc json rpc sock notify
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -38,8 +38,8 @@ APP = hello_blob
C_SRCS := hello_blob.c C_SRCS := hello_blob.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_vmd SPDK_LIB_LIST += event_bdev event_accel event_vmd
SPDK_LIB_LIST += bdev copy event thread util conf trace \ SPDK_LIB_LIST += bdev accel event thread util conf trace \
log jsonrpc json rpc sock notify log jsonrpc json rpc sock notify
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -39,8 +39,8 @@ APP := nvmf
C_SRCS := nvmf.c C_SRCS := nvmf.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += nvmf thread util bdev conf copy rpc jsonrpc json log sock trace notify SPDK_LIB_LIST += nvmf thread util bdev conf accel rpc jsonrpc json log sock trace notify
SPDK_LIB_LIST += event event_bdev event_copy event_vmd SPDK_LIB_LIST += event event_bdev event_accel event_vmd
ifeq ($(CONFIG_FC),y) ifeq ($(CONFIG_FC),y)
ifneq ($(strip $(CONFIG_FC_PATH)),) ifneq ($(strip $(CONFIG_FC_PATH)),)

View File

@ -32,11 +32,11 @@
*/ */
/** \file /** \file
* Memory copy offload engine abstraction layer * Acceleration engine abstraction layer
*/ */
#ifndef SPDK_COPY_ENGINE_H #ifndef SPDK_ACCEL_ENGINE_H
#define SPDK_COPY_ENGINE_H #define SPDK_ACCEL_ENGINE_H
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
@ -45,66 +45,66 @@ extern "C" {
#endif #endif
/** /**
* Copy operation callback. * Acceleration operation callback.
* *
* \param ref 'copy_req' passed to the corresponding spdk_copy_submit() call. * \param ref 'accel_req' passed to the corresponding spdk_accel_submit* call.
* \param status 0 if it completed successfully, or negative errno if it failed. * \param status 0 if it completed successfully, or negative errno if it failed.
*/ */
typedef void (*spdk_copy_completion_cb)(void *ref, int status); typedef void (*spdk_accel_completion_cb)(void *ref, int status);
/** /**
* Copy engine finish callback. * Acceleration engine finish callback.
* *
* \param cb_arg Callback argument. * \param cb_arg Callback argument.
*/ */
typedef void (*spdk_copy_fini_cb)(void *cb_arg); typedef void (*spdk_accel_fini_cb)(void *cb_arg);
struct spdk_io_channel; struct spdk_io_channel;
struct spdk_copy_task; struct spdk_accel_task;
/** /**
* Initialize the copy engine. * Initialize the acceleration engine.
* *
* \return 0 on success. * \return 0 on success.
*/ */
int spdk_copy_engine_initialize(void); int spdk_accel_engine_initialize(void);
/** /**
* Close the copy engine. * Close the acceleration engine.
* *
* \param cb_fn Called when the close operation completes. * \param cb_fn Called when the close operation completes.
* \param cb_arg Argument passed to the callback function. * \param cb_arg Argument passed to the callback function.
*/ */
void spdk_copy_engine_finish(spdk_copy_fini_cb cb_fn, void *cb_arg); void spdk_accel_engine_finish(spdk_accel_fini_cb cb_fn, void *cb_arg);
/** /**
* Get the configuration for the copy engine. * Get the configuration for the acceleration engine.
* *
* \param fp The pointer to a file that will be written to the configuration. * \param fp The pointer to a file that will be written to the configuration.
*/ */
void spdk_copy_engine_config_text(FILE *fp); void spdk_accel_engine_config_text(FILE *fp);
/** /**
* Close the copy engine module and perform any necessary cleanup. * Close the acceleration engine module and perform any necessary cleanup.
*/ */
void spdk_copy_engine_module_finish(void); void spdk_accel_engine_module_finish(void);
/** /**
* Get the I/O channel registered on the copy engine. * Get the I/O channel registered on the acceleration engine.
* *
* This I/O channel is used to submit copy request. * This I/O channel is used to submit copy request.
* *
* \return a pointer to the I/O channel on success, or NULL on failure. * \return a pointer to the I/O channel on success, or NULL on failure.
*/ */
struct spdk_io_channel *spdk_copy_engine_get_io_channel(void); struct spdk_io_channel *spdk_accel_engine_get_io_channel(void);
/** /**
* Submit a copy request. * Submit a copy request.
* *
* \param copy_req Copy request task. * \param accel_req Accel request task.
* \param ch I/O channel to submit request to the copy engine. This channel can * \param ch I/O channel to submit request to the accel engine. This channel can
* be obtained by the function spdk_copy_engine_get_io_channel(). * be obtained by the function spdk_accel_engine_get_io_channel().
* \param dst Destination to copy to. * \param dst Destination to copy to.
* \param src Source to copy from. * \param src Source to copy from.
* \param nbytes Length in bytes to copy. * \param nbytes Length in bytes to copy.
@ -112,33 +112,33 @@ struct spdk_io_channel *spdk_copy_engine_get_io_channel(void);
* *
* \return 0 on success, negative errno on failure. * \return 0 on success, negative errno on failure.
*/ */
int spdk_copy_submit(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch, void *dst, int spdk_accel_submit_copy(struct spdk_accel_task *accel_req, struct spdk_io_channel *ch, void *dst,
void *src, uint64_t nbytes, spdk_copy_completion_cb cb); void *src, uint64_t nbytes, spdk_accel_completion_cb cb);
/** /**
* Submit a fill request. * Submit a fill request.
* *
* This operation will fill the destination buffer with the specified value. * This operation will fill the destination buffer with the specified value.
* *
* \param copy_req Copy request task. * \param accel_req Accel request task.
* \param ch I/O channel to submit request to the copy engine. This channel can * \param ch I/O channel to submit request to the accel engine. This channel can
* be obtained by the function spdk_copy_engine_get_io_channel(). * be obtained by the function spdk_accel_engine_get_io_channel().
* \param dst Destination to fill. * \param dst Destination to fill.
* \param fill Constant byte to fill to the destination. * \param fill Constant byte to fill to the destination.
* \param nbytes Length in bytes to fill. * \param nbytes Length in bytes to fill.
* \param cb Called when this copy operation completes. * \param cb Called when this fill operation completes.
* *
* \return 0 on success, negative errno on failure. * \return 0 on success, negative errno on failure.
*/ */
int spdk_copy_submit_fill(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch, int spdk_accel_submit_fill(struct spdk_accel_task *accel_req, struct spdk_io_channel *ch,
void *dst, uint8_t fill, uint64_t nbytes, spdk_copy_completion_cb cb); void *dst, uint8_t fill, uint64_t nbytes, spdk_accel_completion_cb cb);
/** /**
* Get the size of copy task. * Get the size of an acceleration task.
* *
* \return the size of copy task. * \return the size of acceleration task.
*/ */
size_t spdk_copy_task_size(void); size_t spdk_accel_task_size(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -31,28 +31,28 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef SPDK_INTERNAL_COPY_ENGINE_H #ifndef SPDK_INTERNAL_ACCEL_ENGINE_H
#define SPDK_INTERNAL_COPY_ENGINE_H #define SPDK_INTERNAL_ACCEL_ENGINE_H
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk/copy_engine.h" #include "spdk/accel_engine.h"
#include "spdk/queue.h" #include "spdk/queue.h"
struct spdk_copy_task { struct spdk_accel_task {
spdk_copy_completion_cb cb; spdk_accel_completion_cb cb;
uint8_t offload_ctx[0]; uint8_t offload_ctx[0];
}; };
struct spdk_copy_engine { struct spdk_accel_engine {
int (*copy)(void *cb_arg, struct spdk_io_channel *ch, void *dst, void *src, int (*copy)(void *cb_arg, struct spdk_io_channel *ch, void *dst, void *src,
uint64_t nbytes, spdk_copy_completion_cb cb); uint64_t nbytes, spdk_accel_completion_cb cb);
int (*fill)(void *cb_arg, struct spdk_io_channel *ch, void *dst, uint8_t fill, int (*fill)(void *cb_arg, struct spdk_io_channel *ch, void *dst, uint8_t fill,
uint64_t nbytes, spdk_copy_completion_cb cb); uint64_t nbytes, spdk_accel_completion_cb cb);
struct spdk_io_channel *(*get_io_channel)(void); struct spdk_io_channel *(*get_io_channel)(void);
}; };
struct spdk_copy_module_if { struct spdk_accel_module_if {
/** Initialization function for the module. Called by the spdk /** Initialization function for the module. Called by the spdk
* application during startup. * application during startup.
* *
@ -74,14 +74,14 @@ struct spdk_copy_module_if {
void (*config_text)(FILE *fp); void (*config_text)(FILE *fp);
size_t (*get_ctx_size)(void); size_t (*get_ctx_size)(void);
TAILQ_ENTRY(spdk_copy_module_if) tailq; TAILQ_ENTRY(spdk_accel_module_if) tailq;
}; };
void spdk_copy_engine_register(struct spdk_copy_engine *copy_engine); void spdk_accel_engine_register(struct spdk_accel_engine *accel_engine);
void spdk_copy_module_list_add(struct spdk_copy_module_if *copy_module); void spdk_accel_module_list_add(struct spdk_accel_module_if *accel_module);
#define SPDK_COPY_MODULE_REGISTER(init_fn, fini_fn, config_fn, ctx_size_fn) \ #define SPDK_ACCEL_MODULE_REGISTER(init_fn, fini_fn, config_fn, ctx_size_fn) \
static struct spdk_copy_module_if init_fn ## _if = { \ static struct spdk_accel_module_if init_fn ## _if = { \
.module_init = init_fn, \ .module_init = init_fn, \
.module_fini = fini_fn, \ .module_fini = fini_fn, \
.config_text = config_fn, \ .config_text = config_fn, \
@ -89,7 +89,7 @@ void spdk_copy_module_list_add(struct spdk_copy_module_if *copy_module);
}; \ }; \
__attribute__((constructor)) static void init_fn ## _init(void) \ __attribute__((constructor)) static void init_fn ## _init(void) \
{ \ { \
spdk_copy_module_list_add(&init_fn ## _if); \ spdk_accel_module_list_add(&init_fn ## _if); \
} }
#endif #endif

View File

@ -35,7 +35,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.lib_deps.mk include $(SPDK_ROOT_DIR)/mk/spdk.lib_deps.mk
DIRS-y += bdev blob blobfs conf copy event json jsonrpc \ DIRS-y += bdev blob blobfs conf accel event json jsonrpc \
log log_rpc lvol net rpc sock thread trace util nvme vmd nvmf scsi \ log log_rpc lvol net rpc sock thread trace util nvme vmd nvmf scsi \
ioat ut_mock iscsi notify ioat ut_mock iscsi notify
ifeq ($(OS),Linux) ifeq ($(OS),Linux)

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..) SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
LIBNAME = copy LIBNAME = accel
C_SRCS = copy_engine.c C_SRCS = accel_engine.c
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

320
lib/accel/accel_engine.c Normal file
View File

@ -0,0 +1,320 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "spdk/stdinc.h"
#include "spdk_internal/accel_engine.h"
#include "spdk/env.h"
#include "spdk/event.h"
#include "spdk/log.h"
#include "spdk/thread.h"
static size_t g_max_accel_module_size = 0;
static struct spdk_accel_engine *g_hw_accel_engine = NULL;
/* Software memcpy engine always exists */
static struct spdk_accel_engine *g_sw_accel_engine = NULL;
static TAILQ_HEAD(, spdk_accel_module_if) spdk_accel_module_list =
TAILQ_HEAD_INITIALIZER(spdk_accel_module_list);
struct accel_io_channel {
struct spdk_accel_engine *engine;
struct spdk_io_channel *ch;
};
static struct spdk_accel_module_if *g_accel_engine_module = NULL;
static spdk_accel_fini_cb g_fini_cb_fn = NULL;
static void *g_fini_cb_arg = NULL;
void
spdk_accel_engine_register(struct spdk_accel_engine *accel_engine)
{
assert(g_hw_accel_engine == NULL);
g_hw_accel_engine = accel_engine;
}
static void
spdk_sw_accel_register(struct spdk_accel_engine *accel_engine)
{
assert(g_sw_accel_engine == NULL);
g_sw_accel_engine = accel_engine;
}
static void
spdk_sw_accel_unregister(void)
{
g_sw_accel_engine = NULL;
}
static void
accel_engine_done(void *ref, int status)
{
struct spdk_accel_task *req = (struct spdk_accel_task *)ref;
req->cb(req, status);
}
int
spdk_accel_submit_copy(struct spdk_accel_task *accel_req, struct spdk_io_channel *ch,
void *dst, void *src, uint64_t nbytes, spdk_accel_completion_cb cb)
{
struct spdk_accel_task *req = accel_req;
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
req->cb = cb;
return accel_ch->engine->copy(req->offload_ctx, accel_ch->ch, dst, src, nbytes,
accel_engine_done);
}
int
spdk_accel_submit_fill(struct spdk_accel_task *accel_req, struct spdk_io_channel *ch,
void *dst, uint8_t fill, uint64_t nbytes, spdk_accel_completion_cb cb)
{
struct spdk_accel_task *req = accel_req;
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
req->cb = cb;
return accel_ch->engine->fill(req->offload_ctx, accel_ch->ch, dst, fill, nbytes,
accel_engine_done);
}
/* Software memcpy default accel engine */
static int
sw_accel_submit_copy(void *cb_arg, struct spdk_io_channel *ch, void *dst, void *src,
uint64_t nbytes,
spdk_accel_completion_cb cb)
{
struct spdk_accel_task *accel_req;
memcpy(dst, src, (size_t)nbytes);
accel_req = (struct spdk_accel_task *)((uintptr_t)cb_arg -
offsetof(struct spdk_accel_task, offload_ctx));
cb(accel_req, 0);
return 0;
}
static int
sw_accel_submit_fill(void *cb_arg, struct spdk_io_channel *ch, void *dst, uint8_t fill,
uint64_t nbytes,
spdk_accel_completion_cb cb)
{
struct spdk_accel_task *accel_req;
memset(dst, fill, nbytes);
accel_req = (struct spdk_accel_task *)((uintptr_t)cb_arg -
offsetof(struct spdk_accel_task, offload_ctx));
cb(accel_req, 0);
return 0;
}
static struct spdk_io_channel *sw_accel_get_io_channel(void);
static struct spdk_accel_engine sw_accel_engine = {
.copy = sw_accel_submit_copy,
.fill = sw_accel_submit_fill,
.get_io_channel = sw_accel_get_io_channel,
};
static int
sw_accel_create_cb(void *io_device, void *ctx_buf)
{
return 0;
}
static void
sw_accel_destroy_cb(void *io_device, void *ctx_buf)
{
}
static struct spdk_io_channel *sw_accel_get_io_channel(void)
{
return spdk_get_io_channel(&sw_accel_engine);
}
static size_t
accel_engine_sw_get_ctx_size(void)
{
return sizeof(struct spdk_accel_task);
}
size_t
spdk_accel_task_size(void)
{
return g_max_accel_module_size;
}
void spdk_accel_module_list_add(struct spdk_accel_module_if *accel_module)
{
TAILQ_INSERT_TAIL(&spdk_accel_module_list, accel_module, tailq);
if (accel_module->get_ctx_size && accel_module->get_ctx_size() > g_max_accel_module_size) {
g_max_accel_module_size = accel_module->get_ctx_size();
}
}
static int
accel_engine_create_cb(void *io_device, void *ctx_buf)
{
struct accel_io_channel *accel_ch = ctx_buf;
if (g_hw_accel_engine != NULL) {
accel_ch->ch = g_hw_accel_engine->get_io_channel();
if (accel_ch->ch != NULL) {
accel_ch->engine = g_hw_accel_engine;
return 0;
}
}
accel_ch->ch = g_sw_accel_engine->get_io_channel();
assert(accel_ch->ch != NULL);
accel_ch->engine = g_sw_accel_engine;
return 0;
}
static void
accel_engine_destroy_cb(void *io_device, void *ctx_buf)
{
struct accel_io_channel *accel_ch = ctx_buf;
spdk_put_io_channel(accel_ch->ch);
}
struct spdk_io_channel *
spdk_accel_engine_get_io_channel(void)
{
return spdk_get_io_channel(&spdk_accel_module_list);
}
static int
accel_engine_sw_accel_init(void)
{
spdk_sw_accel_register(&sw_accel_engine);
spdk_io_device_register(&sw_accel_engine, sw_accel_create_cb, sw_accel_destroy_cb, 0,
"sw_accel_engine");
return 0;
}
static void
accel_engine_sw_accel_fini(void *ctxt)
{
spdk_io_device_unregister(&sw_accel_engine, NULL);
spdk_sw_accel_unregister();
spdk_accel_engine_module_finish();
}
static void
spdk_accel_engine_module_initialize(void)
{
struct spdk_accel_module_if *accel_engine_module;
TAILQ_FOREACH(accel_engine_module, &spdk_accel_module_list, tailq) {
accel_engine_module->module_init();
}
}
int
spdk_accel_engine_initialize(void)
{
spdk_accel_engine_module_initialize();
/*
* We need a unique identifier for the accel engine framework, so use the
* spdk_accel_module_list address for this purpose.
*/
spdk_io_device_register(&spdk_accel_module_list, accel_engine_create_cb, accel_engine_destroy_cb,
sizeof(struct accel_io_channel), "accel_module");
return 0;
}
static void
spdk_accel_engine_module_finish_cb(void)
{
spdk_accel_fini_cb cb_fn = g_fini_cb_fn;
cb_fn(g_fini_cb_arg);
g_fini_cb_fn = NULL;
g_fini_cb_arg = NULL;
}
void
spdk_accel_engine_module_finish(void)
{
if (!g_accel_engine_module) {
g_accel_engine_module = TAILQ_FIRST(&spdk_accel_module_list);
} else {
g_accel_engine_module = TAILQ_NEXT(g_accel_engine_module, tailq);
}
if (!g_accel_engine_module) {
spdk_accel_engine_module_finish_cb();
return;
}
if (g_accel_engine_module->module_fini) {
spdk_thread_send_msg(spdk_get_thread(), g_accel_engine_module->module_fini, NULL);
} else {
spdk_accel_engine_module_finish();
}
}
void
spdk_accel_engine_finish(spdk_accel_fini_cb cb_fn, void *cb_arg)
{
assert(cb_fn != NULL);
g_fini_cb_fn = cb_fn;
g_fini_cb_arg = cb_arg;
spdk_io_device_unregister(&spdk_accel_module_list, NULL);
spdk_accel_engine_module_finish();
}
void
spdk_accel_engine_config_text(FILE *fp)
{
struct spdk_accel_module_if *accel_engine_module;
TAILQ_FOREACH(accel_engine_module, &spdk_accel_module_list, tailq) {
if (accel_engine_module->config_text) {
accel_engine_module->config_text(fp);
}
}
}
SPDK_ACCEL_MODULE_REGISTER(accel_engine_sw_accel_init, accel_engine_sw_accel_fini,
NULL, accel_engine_sw_get_ctx_size)

View File

@ -1,318 +0,0 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "spdk/stdinc.h"
#include "spdk_internal/copy_engine.h"
#include "spdk/env.h"
#include "spdk/event.h"
#include "spdk/log.h"
#include "spdk/thread.h"
static size_t g_max_copy_module_size = 0;
static struct spdk_copy_engine *hw_copy_engine = NULL;
/* Memcpy engine always exist */
static struct spdk_copy_engine *mem_copy_engine = NULL;
static TAILQ_HEAD(, spdk_copy_module_if) spdk_copy_module_list =
TAILQ_HEAD_INITIALIZER(spdk_copy_module_list);
struct copy_io_channel {
struct spdk_copy_engine *engine;
struct spdk_io_channel *ch;
};
static struct spdk_copy_module_if *g_copy_engine_module = NULL;
static spdk_copy_fini_cb g_fini_cb_fn = NULL;
static void *g_fini_cb_arg = NULL;
void
spdk_copy_engine_register(struct spdk_copy_engine *copy_engine)
{
assert(hw_copy_engine == NULL);
hw_copy_engine = copy_engine;
}
static void
spdk_memcpy_register(struct spdk_copy_engine *copy_engine)
{
assert(mem_copy_engine == NULL);
mem_copy_engine = copy_engine;
}
static void
spdk_memcpy_unregister(void)
{
mem_copy_engine = NULL;
}
static void
copy_engine_done(void *ref, int status)
{
struct spdk_copy_task *req = (struct spdk_copy_task *)ref;
req->cb(req, status);
}
int
spdk_copy_submit(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch,
void *dst, void *src, uint64_t nbytes, spdk_copy_completion_cb cb)
{
struct spdk_copy_task *req = copy_req;
struct copy_io_channel *copy_ch = spdk_io_channel_get_ctx(ch);
req->cb = cb;
return copy_ch->engine->copy(req->offload_ctx, copy_ch->ch, dst, src, nbytes,
copy_engine_done);
}
int
spdk_copy_submit_fill(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch,
void *dst, uint8_t fill, uint64_t nbytes, spdk_copy_completion_cb cb)
{
struct spdk_copy_task *req = copy_req;
struct copy_io_channel *copy_ch = spdk_io_channel_get_ctx(ch);
req->cb = cb;
return copy_ch->engine->fill(req->offload_ctx, copy_ch->ch, dst, fill, nbytes,
copy_engine_done);
}
/* memcpy default copy engine */
static int
mem_copy_submit(void *cb_arg, struct spdk_io_channel *ch, void *dst, void *src, uint64_t nbytes,
spdk_copy_completion_cb cb)
{
struct spdk_copy_task *copy_req;
memcpy(dst, src, (size_t)nbytes);
copy_req = (struct spdk_copy_task *)((uintptr_t)cb_arg -
offsetof(struct spdk_copy_task, offload_ctx));
cb(copy_req, 0);
return 0;
}
static int
mem_copy_fill(void *cb_arg, struct spdk_io_channel *ch, void *dst, uint8_t fill, uint64_t nbytes,
spdk_copy_completion_cb cb)
{
struct spdk_copy_task *copy_req;
memset(dst, fill, nbytes);
copy_req = (struct spdk_copy_task *)((uintptr_t)cb_arg -
offsetof(struct spdk_copy_task, offload_ctx));
cb(copy_req, 0);
return 0;
}
static struct spdk_io_channel *mem_get_io_channel(void);
static struct spdk_copy_engine memcpy_copy_engine = {
.copy = mem_copy_submit,
.fill = mem_copy_fill,
.get_io_channel = mem_get_io_channel,
};
static int
memcpy_create_cb(void *io_device, void *ctx_buf)
{
return 0;
}
static void
memcpy_destroy_cb(void *io_device, void *ctx_buf)
{
}
static struct spdk_io_channel *mem_get_io_channel(void)
{
return spdk_get_io_channel(&memcpy_copy_engine);
}
static size_t
copy_engine_mem_get_ctx_size(void)
{
return sizeof(struct spdk_copy_task);
}
size_t
spdk_copy_task_size(void)
{
return g_max_copy_module_size;
}
void spdk_copy_module_list_add(struct spdk_copy_module_if *copy_module)
{
TAILQ_INSERT_TAIL(&spdk_copy_module_list, copy_module, tailq);
if (copy_module->get_ctx_size && copy_module->get_ctx_size() > g_max_copy_module_size) {
g_max_copy_module_size = copy_module->get_ctx_size();
}
}
static int
copy_create_cb(void *io_device, void *ctx_buf)
{
struct copy_io_channel *copy_ch = ctx_buf;
if (hw_copy_engine != NULL) {
copy_ch->ch = hw_copy_engine->get_io_channel();
if (copy_ch->ch != NULL) {
copy_ch->engine = hw_copy_engine;
return 0;
}
}
copy_ch->ch = mem_copy_engine->get_io_channel();
assert(copy_ch->ch != NULL);
copy_ch->engine = mem_copy_engine;
return 0;
}
static void
copy_destroy_cb(void *io_device, void *ctx_buf)
{
struct copy_io_channel *copy_ch = ctx_buf;
spdk_put_io_channel(copy_ch->ch);
}
struct spdk_io_channel *
spdk_copy_engine_get_io_channel(void)
{
return spdk_get_io_channel(&spdk_copy_module_list);
}
static int
copy_engine_mem_init(void)
{
spdk_memcpy_register(&memcpy_copy_engine);
spdk_io_device_register(&memcpy_copy_engine, memcpy_create_cb, memcpy_destroy_cb, 0,
"memcpy_engine");
return 0;
}
static void
copy_engine_mem_fini(void *ctxt)
{
spdk_io_device_unregister(&memcpy_copy_engine, NULL);
spdk_memcpy_unregister();
spdk_copy_engine_module_finish();
}
static void
spdk_copy_engine_module_initialize(void)
{
struct spdk_copy_module_if *copy_engine_module;
TAILQ_FOREACH(copy_engine_module, &spdk_copy_module_list, tailq) {
copy_engine_module->module_init();
}
}
int
spdk_copy_engine_initialize(void)
{
spdk_copy_engine_module_initialize();
/*
* We need a unique identifier for the copy engine framework, so use the
* spdk_copy_module_list address for this purpose.
*/
spdk_io_device_register(&spdk_copy_module_list, copy_create_cb, copy_destroy_cb,
sizeof(struct copy_io_channel), "copy_module");
return 0;
}
static void
spdk_copy_engine_module_finish_cb(void)
{
spdk_copy_fini_cb cb_fn = g_fini_cb_fn;
cb_fn(g_fini_cb_arg);
g_fini_cb_fn = NULL;
g_fini_cb_arg = NULL;
}
void
spdk_copy_engine_module_finish(void)
{
if (!g_copy_engine_module) {
g_copy_engine_module = TAILQ_FIRST(&spdk_copy_module_list);
} else {
g_copy_engine_module = TAILQ_NEXT(g_copy_engine_module, tailq);
}
if (!g_copy_engine_module) {
spdk_copy_engine_module_finish_cb();
return;
}
if (g_copy_engine_module->module_fini) {
spdk_thread_send_msg(spdk_get_thread(), g_copy_engine_module->module_fini, NULL);
} else {
spdk_copy_engine_module_finish();
}
}
void
spdk_copy_engine_finish(spdk_copy_fini_cb cb_fn, void *cb_arg)
{
assert(cb_fn != NULL);
g_fini_cb_fn = cb_fn;
g_fini_cb_arg = cb_arg;
spdk_io_device_unregister(&spdk_copy_module_list, NULL);
spdk_copy_engine_module_finish();
}
void
spdk_copy_engine_config_text(FILE *fp)
{
struct spdk_copy_module_if *copy_engine_module;
TAILQ_FOREACH(copy_engine_module, &spdk_copy_module_list, tailq) {
if (copy_engine_module->config_text) {
copy_engine_module->config_text(fp);
}
}
}
SPDK_COPY_MODULE_REGISTER(copy_engine_mem_init, copy_engine_mem_fini,
NULL, copy_engine_mem_get_ctx_size)

View File

@ -54,8 +54,8 @@ CXXFLAGS += -fno-sanitize=address
endif endif
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_vmd SPDK_LIB_LIST += event_bdev event_accel event_vmd
SPDK_LIB_LIST += bdev copy event util conf trace log jsonrpc json rpc sock thread notify SPDK_LIB_LIST += bdev accel event util conf trace log jsonrpc json rpc sock thread notify
AM_LINK += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS) AM_LINK += $(SPDK_LIB_LINKER_ARGS) $(ENV_LINKER_ARGS)
AM_LINK += $(SYS_LIBS) AM_LINK += $(SYS_LIBS)

View File

@ -56,7 +56,7 @@ DEPDIRS-reduce := log util
DEPDIRS-thread := log util DEPDIRS-thread := log util
DEPDIRS-blob := log util thread DEPDIRS-blob := log util thread
DEPDIRS-copy := thread DEPDIRS-accel := thread
DEPDIRS-jsonrpc := log util json DEPDIRS-jsonrpc := log util json
DEPDIRS-virtio := log util json thread DEPDIRS-virtio := log util json thread
@ -100,8 +100,8 @@ DEPDIRS-blob_bdev := log thread bdev
# module/blobfs # module/blobfs
DEPDIRS-blobfs_bdev := $(BDEV_DEPS_THREAD) blob_bdev blobfs DEPDIRS-blobfs_bdev := $(BDEV_DEPS_THREAD) blob_bdev blobfs
# module/copy # module/accel
DEPDIRS-copy_ioat := log ioat conf thread $(JSON_LIBS) copy DEPDIRS-accel_ioat := log ioat conf thread $(JSON_LIBS) accel
# module/env_dpdk # module/env_dpdk
DEPDIRS-env_dpdk_rpc := log $(JSON_LIBS) DEPDIRS-env_dpdk_rpc := log $(JSON_LIBS)
@ -117,7 +117,7 @@ DEPDIRS-bdev_lvol := $(BDEV_DEPS) lvol blob blob_bdev
DEPDIRS-bdev_rpc := $(BDEV_DEPS) DEPDIRS-bdev_rpc := $(BDEV_DEPS)
DEPDIRS-bdev_error := $(BDEV_DEPS_CONF) DEPDIRS-bdev_error := $(BDEV_DEPS_CONF)
DEPDIRS-bdev_malloc := $(BDEV_DEPS_CONF) copy DEPDIRS-bdev_malloc := $(BDEV_DEPS_CONF) accel
DEPDIRS-bdev_split := $(BDEV_DEPS_CONF) DEPDIRS-bdev_split := $(BDEV_DEPS_CONF)
DEPDIRS-bdev_compress := $(BDEV_DEPS_THREAD) reduce DEPDIRS-bdev_compress := $(BDEV_DEPS_THREAD) reduce
@ -147,11 +147,11 @@ DEPDIRS-app_rpc := log util thread event $(JSON_LIBS)
# 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_copy := copy event DEPDIRS-event_accel := accel event
DEPDIRS-event_net := sock net event DEPDIRS-event_net := sock net event
DEPDIRS-event_vmd := vmd conf $(JSON_LIBS) event log thread DEPDIRS-event_vmd := vmd conf $(JSON_LIBS) event log thread
DEPDIRS-event_bdev := bdev event event_copy event_vmd DEPDIRS-event_bdev := bdev event event_accel event_vmd
DEPDIRS-event_nbd := event nbd event_bdev DEPDIRS-event_nbd := event nbd event_bdev
DEPDIRS-event_nvmf := $(BDEV_DEPS_CONF_THREAD) event nvme nvmf event_bdev DEPDIRS-event_nvmf := $(BDEV_DEPS_CONF_THREAD) event nvme nvmf event_bdev

View File

@ -99,6 +99,6 @@ SYS_LIBS += -Wl,--no-whole-archive
SOCK_MODULES_LIST += sock_vpp SOCK_MODULES_LIST += sock_vpp
endif endif
COPY_MODULES_LIST = copy_ioat ioat ACCEL_MODULES_LIST = accel_ioat ioat
ALL_MODULES_LIST = $(BLOCKDEV_MODULES_LIST) $(COPY_MODULES_LIST) $(SOCK_MODULES_LIST) ALL_MODULES_LIST = $(BLOCKDEV_MODULES_LIST) $(ACCEL_MODULES_LIST) $(SOCK_MODULES_LIST)

View File

@ -34,13 +34,13 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/..) SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y = bdev blob blobfs copy event sock DIRS-y = bdev blob blobfs accel event sock
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV)) ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
DIRS-y += env_dpdk DIRS-y += env_dpdk
endif endif
DEPDIRS-blob := DEPDIRS-blob :=
DEPDIRS-copy := DEPDIRS-accel :=
DEPDIRS-env_dpdk := DEPDIRS-env_dpdk :=
DEPDIRS-sock := DEPDIRS-sock :=
DEPDIRS-bdev := blob DEPDIRS-bdev := blob

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..) SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
LIBNAME = copy_ioat LIBNAME = accel_ioat
C_SRCS = copy_engine_ioat.c copy_engine_ioat_rpc.c C_SRCS = accel_engine_ioat.c accel_engine_ioat_rpc.c
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -31,11 +31,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "copy_engine_ioat.h" #include "accel_engine_ioat.h"
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk_internal/copy_engine.h" #include "spdk_internal/accel_engine.h"
#include "spdk_internal/log.h" #include "spdk_internal/log.h"
#include "spdk/env.h" #include "spdk/env.h"
@ -112,39 +112,39 @@ ioat_free_device(struct ioat_device *dev)
} }
struct ioat_task { struct ioat_task {
spdk_copy_completion_cb cb; spdk_accel_completion_cb cb;
}; };
static int copy_engine_ioat_init(void); static int accel_engine_ioat_init(void);
static void copy_engine_ioat_exit(void *ctx); static void accel_engine_ioat_exit(void *ctx);
static void copy_engine_ioat_config_text(FILE *fp); static void accel_engine_ioat_config_text(FILE *fp);
static size_t static size_t
copy_engine_ioat_get_ctx_size(void) accel_engine_ioat_get_ctx_size(void)
{ {
return sizeof(struct ioat_task) + sizeof(struct spdk_copy_task); return sizeof(struct ioat_task) + sizeof(struct spdk_accel_task);
} }
SPDK_COPY_MODULE_REGISTER(copy_engine_ioat_init, copy_engine_ioat_exit, SPDK_ACCEL_MODULE_REGISTER(accel_engine_ioat_init, accel_engine_ioat_exit,
copy_engine_ioat_config_text, accel_engine_ioat_config_text,
copy_engine_ioat_get_ctx_size) accel_engine_ioat_get_ctx_size)
static void static void
ioat_done(void *cb_arg) ioat_done(void *cb_arg)
{ {
struct spdk_copy_task *copy_req; struct spdk_accel_task *accel_req;
struct ioat_task *ioat_task = cb_arg; struct ioat_task *ioat_task = cb_arg;
copy_req = (struct spdk_copy_task *) accel_req = (struct spdk_accel_task *)
((uintptr_t)ioat_task - ((uintptr_t)ioat_task -
offsetof(struct spdk_copy_task, offload_ctx)); offsetof(struct spdk_accel_task, offload_ctx));
ioat_task->cb(copy_req, 0); ioat_task->cb(accel_req, 0);
} }
static int static int
ioat_copy_submit(void *cb_arg, struct spdk_io_channel *ch, void *dst, void *src, uint64_t nbytes, ioat_submit_copy(void *cb_arg, struct spdk_io_channel *ch, void *dst, void *src, uint64_t nbytes,
spdk_copy_completion_cb cb) spdk_accel_completion_cb cb)
{ {
struct ioat_task *ioat_task = (struct ioat_task *)cb_arg; struct ioat_task *ioat_task = (struct ioat_task *)cb_arg;
struct ioat_io_channel *ioat_ch = spdk_io_channel_get_ctx(ch); struct ioat_io_channel *ioat_ch = spdk_io_channel_get_ctx(ch);
@ -157,8 +157,8 @@ ioat_copy_submit(void *cb_arg, struct spdk_io_channel *ch, void *dst, void *src,
} }
static int static int
ioat_copy_submit_fill(void *cb_arg, struct spdk_io_channel *ch, void *dst, uint8_t fill, ioat_submit_fill(void *cb_arg, struct spdk_io_channel *ch, void *dst, uint8_t fill,
uint64_t nbytes, spdk_copy_completion_cb cb) uint64_t nbytes, spdk_accel_completion_cb cb)
{ {
struct ioat_task *ioat_task = (struct ioat_task *)cb_arg; struct ioat_task *ioat_task = (struct ioat_task *)cb_arg;
struct ioat_io_channel *ioat_ch = spdk_io_channel_get_ctx(ch); struct ioat_io_channel *ioat_ch = spdk_io_channel_get_ctx(ch);
@ -183,9 +183,9 @@ ioat_poll(void *arg)
static struct spdk_io_channel *ioat_get_io_channel(void); static struct spdk_io_channel *ioat_get_io_channel(void);
static struct spdk_copy_engine ioat_copy_engine = { static struct spdk_accel_engine ioat_accel_engine = {
.copy = ioat_copy_submit, .copy = ioat_submit_copy,
.fill = ioat_copy_submit_fill, .fill = ioat_submit_fill,
.get_io_channel = ioat_get_io_channel, .get_io_channel = ioat_get_io_channel,
}; };
@ -218,7 +218,7 @@ ioat_destroy_cb(void *io_device, void *ctx_buf)
static struct spdk_io_channel * static struct spdk_io_channel *
ioat_get_io_channel(void) ioat_get_io_channel(void)
{ {
return spdk_get_io_channel(&ioat_copy_engine); return spdk_get_io_channel(&ioat_accel_engine);
} }
static bool static bool
@ -227,7 +227,7 @@ probe_cb(void *cb_ctx, struct spdk_pci_device *pci_dev)
struct ioat_probe_ctx *ctx = cb_ctx; struct ioat_probe_ctx *ctx = cb_ctx;
struct spdk_pci_addr pci_addr = spdk_pci_device_get_addr(pci_dev); struct spdk_pci_addr pci_addr = spdk_pci_device_get_addr(pci_dev);
SPDK_INFOLOG(SPDK_LOG_COPY_IOAT, SPDK_INFOLOG(SPDK_LOG_ACCEL_IOAT,
" Found matching device at %04x:%02x:%02x.%x vendor:0x%04x device:0x%04x\n", " Found matching device at %04x:%02x:%02x.%x vendor:0x%04x device:0x%04x\n",
pci_addr.domain, pci_addr.domain,
pci_addr.bus, pci_addr.bus,
@ -265,13 +265,13 @@ attach_cb(void *cb_ctx, struct spdk_pci_device *pci_dev, struct spdk_ioat_chan *
} }
void void
copy_engine_ioat_enable_probe(void) accel_engine_ioat_enable_probe(void)
{ {
g_ioat_enable = true; g_ioat_enable = true;
} }
static int static int
copy_engine_ioat_add_whitelist_device(const char *pci_bdf) accel_engine_ioat_add_whitelist_device(const char *pci_bdf)
{ {
if (pci_bdf == NULL) { if (pci_bdf == NULL) {
return -1; return -1;
@ -295,12 +295,12 @@ copy_engine_ioat_add_whitelist_device(const char *pci_bdf)
} }
int int
copy_engine_ioat_add_whitelist_devices(const char *pci_bdfs[], size_t num_pci_bdfs) accel_engine_ioat_add_whitelist_devices(const char *pci_bdfs[], size_t num_pci_bdfs)
{ {
size_t i; size_t i;
for (i = 0; i < num_pci_bdfs; i++) { for (i = 0; i < num_pci_bdfs; i++) {
if (copy_engine_ioat_add_whitelist_device(pci_bdfs[i]) < 0) { if (accel_engine_ioat_add_whitelist_device(pci_bdfs[i]) < 0) {
return -1; return -1;
} }
} }
@ -309,7 +309,7 @@ copy_engine_ioat_add_whitelist_devices(const char *pci_bdfs[], size_t num_pci_bd
} }
static int static int
copy_engine_ioat_read_config_file_params(struct spdk_conf_section *sp) accel_engine_ioat_read_config_file_params(struct spdk_conf_section *sp)
{ {
int i; int i;
char *val, *pci_bdf; char *val, *pci_bdf;
@ -337,7 +337,7 @@ copy_engine_ioat_read_config_file_params(struct spdk_conf_section *sp)
break; break;
} }
if (copy_engine_ioat_add_whitelist_device(pci_bdf) < 0) { if (accel_engine_ioat_add_whitelist_device(pci_bdf) < 0) {
return -1; return -1;
} }
} }
@ -346,16 +346,16 @@ copy_engine_ioat_read_config_file_params(struct spdk_conf_section *sp)
} }
static int static int
copy_engine_ioat_init(void) accel_engine_ioat_init(void)
{ {
struct spdk_conf_section *sp; struct spdk_conf_section *sp;
int rc; int rc;
sp = spdk_conf_find_section(NULL, "Ioat"); sp = spdk_conf_find_section(NULL, "Ioat");
if (sp != NULL) { if (sp != NULL) {
rc = copy_engine_ioat_read_config_file_params(sp); rc = accel_engine_ioat_read_config_file_params(sp);
if (rc != 0) { if (rc != 0) {
SPDK_ERRLOG("copy_engine_ioat_read_config_file_params() failed\n"); SPDK_ERRLOG("accel_engine_ioat_read_config_file_params() failed\n");
return rc; return rc;
} }
} }
@ -370,20 +370,20 @@ copy_engine_ioat_init(void)
} }
g_ioat_initialized = true; g_ioat_initialized = true;
SPDK_INFOLOG(SPDK_LOG_COPY_IOAT, "Ioat Copy Engine Offload Enabled\n"); SPDK_INFOLOG(SPDK_LOG_ACCEL_IOAT, "Ioat Acceleration Engine Offload Enabled\n");
spdk_copy_engine_register(&ioat_copy_engine); spdk_accel_engine_register(&ioat_accel_engine);
spdk_io_device_register(&ioat_copy_engine, ioat_create_cb, ioat_destroy_cb, spdk_io_device_register(&ioat_accel_engine, ioat_create_cb, ioat_destroy_cb,
sizeof(struct ioat_io_channel), "ioat_copy_engine"); sizeof(struct ioat_io_channel), "ioat_accel_engine");
return 0; return 0;
} }
static void static void
copy_engine_ioat_exit(void *ctx) accel_engine_ioat_exit(void *ctx)
{ {
struct ioat_device *dev; struct ioat_device *dev;
if (g_ioat_initialized) { if (g_ioat_initialized) {
spdk_io_device_unregister(&ioat_copy_engine, NULL); spdk_io_device_unregister(&ioat_accel_engine, NULL);
} }
while (!TAILQ_EMPTY(&g_devices)) { while (!TAILQ_EMPTY(&g_devices)) {
@ -393,35 +393,35 @@ copy_engine_ioat_exit(void *ctx)
ioat_free_device(dev); ioat_free_device(dev);
free(dev); free(dev);
} }
spdk_copy_engine_module_finish(); spdk_accel_engine_module_finish();
} }
#define COPY_ENGINE_IOAT_HEADER_TMPL \ #define ACCEL_ENGINE_IOAT_HEADER_TMPL \
"[Ioat]\n" \ "[Ioat]\n" \
" # Users may not want to use offload even it is available.\n" \ " # Users may not want to use offload even it is available.\n" \
" # Users may use the whitelist to initialize specified devices, IDS\n" \ " # Users may use the whitelist to initialize specified devices, IDS\n" \
" # uses BUS:DEVICE.FUNCTION to identify each Ioat channel.\n" " # uses BUS:DEVICE.FUNCTION to identify each Ioat channel.\n"
#define COPY_ENGINE_IOAT_ENABLE_TMPL \ #define ACCEL_ENGINE_IOAT_ENABLE_TMPL \
" Enable %s\n" " Enable %s\n"
#define COPY_ENGINE_IOAT_WHITELIST_TMPL \ #define ACCEL_ENGINE_IOAT_WHITELIST_TMPL \
" Whitelist %.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 "\n" " Whitelist %.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 "\n"
static void static void
copy_engine_ioat_config_text(FILE *fp) accel_engine_ioat_config_text(FILE *fp)
{ {
int i; int i;
struct spdk_pci_addr *dev; struct spdk_pci_addr *dev;
fprintf(fp, COPY_ENGINE_IOAT_HEADER_TMPL); fprintf(fp, ACCEL_ENGINE_IOAT_HEADER_TMPL);
fprintf(fp, COPY_ENGINE_IOAT_ENABLE_TMPL, g_ioat_enable ? "Yes" : "No"); fprintf(fp, ACCEL_ENGINE_IOAT_ENABLE_TMPL, g_ioat_enable ? "Yes" : "No");
for (i = 0; i < g_probe_ctx.num_whitelist_devices; i++) { for (i = 0; i < g_probe_ctx.num_whitelist_devices; i++) {
dev = &g_probe_ctx.whitelist[i]; dev = &g_probe_ctx.whitelist[i];
fprintf(fp, COPY_ENGINE_IOAT_WHITELIST_TMPL, fprintf(fp, ACCEL_ENGINE_IOAT_WHITELIST_TMPL,
dev->domain, dev->bus, dev->dev, dev->func); dev->domain, dev->bus, dev->dev, dev->func);
} }
} }
SPDK_LOG_REGISTER_COMPONENT("copy_ioat", SPDK_LOG_COPY_IOAT) SPDK_LOG_REGISTER_COMPONENT("accel_ioat", SPDK_LOG_ACCEL_IOAT)

View File

@ -31,14 +31,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef SPDK_COPY_ENGINE_IOAT_H #ifndef SPDK_ACCEL_ENGINE_IOAT_H
#define SPDK_COPY_ENGINE_IOAT_H #define SPDK_ACCEL_ENGINE_IOAT_H
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#define IOAT_MAX_CHANNELS 64 #define IOAT_MAX_CHANNELS 64
int copy_engine_ioat_add_whitelist_devices(const char *pci_bdfs[], size_t num_pci_bdfs); int accel_engine_ioat_add_whitelist_devices(const char *pci_bdfs[], size_t num_pci_bdfs);
void copy_engine_ioat_enable_probe(void); void accel_engine_ioat_enable_probe(void);
#endif /* SPDK_COPY_ENGINE_IOAT_H */ #endif /* SPDK_ACCEL_ENGINE_IOAT_H */

View File

@ -31,7 +31,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "copy_engine_ioat.h" #include "accel_engine_ioat.h"
#include "spdk/rpc.h" #include "spdk/rpc.h"
#include "spdk/util.h" #include "spdk/util.h"
@ -61,55 +61,56 @@ free_rpc_pci_whitelist(struct rpc_pci_whitelist *list)
} }
} }
struct rpc_ioat_scan_copy_engine { struct rpc_ioat_scan_accel_engine {
struct rpc_pci_whitelist pci_whitelist; struct rpc_pci_whitelist pci_whitelist;
}; };
static void static void
free_rpc_ioat_scan_copy_engine(struct rpc_ioat_scan_copy_engine *p) free_rpc_ioat_scan_accel_engine(struct rpc_ioat_scan_accel_engine *p)
{ {
free_rpc_pci_whitelist(&p->pci_whitelist); free_rpc_pci_whitelist(&p->pci_whitelist);
} }
static const struct spdk_json_object_decoder rpc_ioat_scan_copy_engine_decoder[] = { static const struct spdk_json_object_decoder rpc_ioat_scan_accel_engine_decoder[] = {
{"pci_whitelist", offsetof(struct rpc_ioat_scan_copy_engine, pci_whitelist), decode_rpc_pci_whitelist}, {"pci_whitelist", offsetof(struct rpc_ioat_scan_accel_engine, pci_whitelist), decode_rpc_pci_whitelist},
}; };
static void static void
spdk_rpc_ioat_scan_copy_engine(struct spdk_jsonrpc_request *request, spdk_rpc_ioat_scan_accel_engine(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params) const struct spdk_json_val *params)
{ {
struct rpc_ioat_scan_copy_engine req = {}; struct rpc_ioat_scan_accel_engine req = {};
struct spdk_json_write_ctx *w; struct spdk_json_write_ctx *w;
int rc; int rc;
if (params != NULL) { if (params != NULL) {
if (spdk_json_decode_object(params, rpc_ioat_scan_copy_engine_decoder, if (spdk_json_decode_object(params, rpc_ioat_scan_accel_engine_decoder,
SPDK_COUNTOF(rpc_ioat_scan_copy_engine_decoder), SPDK_COUNTOF(rpc_ioat_scan_accel_engine_decoder),
&req)) { &req)) {
free_rpc_ioat_scan_copy_engine(&req); free_rpc_ioat_scan_accel_engine(&req);
SPDK_ERRLOG("spdk_json_decode_object() failed\n"); SPDK_ERRLOG("spdk_json_decode_object() failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"Invalid parameters"); "Invalid parameters");
return; return;
} }
rc = copy_engine_ioat_add_whitelist_devices((const char **)req.pci_whitelist.bdfs, rc = accel_engine_ioat_add_whitelist_devices((const char **)req.pci_whitelist.bdfs,
req.pci_whitelist.num_bdfs); req.pci_whitelist.num_bdfs);
free_rpc_ioat_scan_copy_engine(&req); free_rpc_ioat_scan_accel_engine(&req);
if (rc < 0) { if (rc < 0) {
SPDK_ERRLOG("copy_engine_ioat_add_whitelist_devices() failed\n"); SPDK_ERRLOG("accel_engine_ioat_add_whitelist_devices() failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"Invalid parameters"); "Invalid parameters");
return; return;
} }
} }
copy_engine_ioat_enable_probe(); accel_engine_ioat_enable_probe();
w = spdk_jsonrpc_begin_result(request); w = spdk_jsonrpc_begin_result(request);
spdk_json_write_bool(w, true); spdk_json_write_bool(w, true);
spdk_jsonrpc_end_result(request, w); spdk_jsonrpc_end_result(request, w);
} }
SPDK_RPC_REGISTER("ioat_scan_copy_engine", spdk_rpc_ioat_scan_copy_engine, SPDK_RPC_STARTUP) SPDK_RPC_REGISTER("ioat_scan_accel_engine", spdk_rpc_ioat_scan_accel_engine, SPDK_RPC_STARTUP)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(ioat_scan_copy_engine, scan_ioat_copy_engine) SPDK_RPC_REGISTER_ALIAS_DEPRECATED(ioat_scan_accel_engine, ioat_scan_copy_engine)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(ioat_scan_accel_engine, scan_ioat_copy_engine)

View File

@ -38,7 +38,7 @@
#include "spdk/conf.h" #include "spdk/conf.h"
#include "spdk/endian.h" #include "spdk/endian.h"
#include "spdk/env.h" #include "spdk/env.h"
#include "spdk/copy_engine.h" #include "spdk/accel_engine.h"
#include "spdk/json.h" #include "spdk/json.h"
#include "spdk/thread.h" #include "spdk/thread.h"
#include "spdk/queue.h" #include "spdk/queue.h"
@ -59,15 +59,15 @@ struct malloc_task {
}; };
static struct malloc_task * static struct malloc_task *
__malloc_task_from_copy_task(struct spdk_copy_task *ct) __malloc_task_from_copy_task(struct spdk_accel_task *ct)
{ {
return (struct malloc_task *)((uintptr_t)ct - sizeof(struct malloc_task)); return (struct malloc_task *)((uintptr_t)ct - sizeof(struct malloc_task));
} }
static struct spdk_copy_task * static struct spdk_accel_task *
__copy_task_from_malloc_task(struct malloc_task *mt) __copy_task_from_malloc_task(struct malloc_task *mt)
{ {
return (struct spdk_copy_task *)((uintptr_t)mt + sizeof(struct malloc_task)); return (struct spdk_accel_task *)((uintptr_t)mt + sizeof(struct malloc_task));
} }
static void static void
@ -98,7 +98,7 @@ static void bdev_malloc_get_spdk_running_config(FILE *fp);
static int static int
bdev_malloc_get_ctx_size(void) bdev_malloc_get_ctx_size(void)
{ {
return sizeof(struct malloc_task) + spdk_copy_task_size(); return sizeof(struct malloc_task) + spdk_accel_task_size();
} }
static struct spdk_bdev_module malloc_if = { static struct spdk_bdev_module malloc_if = {
@ -171,9 +171,9 @@ bdev_malloc_readv(struct malloc_disk *mdisk, struct spdk_io_channel *ch,
task->num_outstanding = iovcnt; task->num_outstanding = iovcnt;
for (i = 0; i < iovcnt; i++) { for (i = 0; i < iovcnt; i++) {
res = spdk_copy_submit(__copy_task_from_malloc_task(task), res = spdk_accel_submit_copy(__copy_task_from_malloc_task(task),
ch, iov[i].iov_base, ch, iov[i].iov_base,
src, iov[i].iov_len, malloc_done); src, iov[i].iov_len, malloc_done);
if (res != 0) { if (res != 0) {
malloc_done(__copy_task_from_malloc_task(task), res); malloc_done(__copy_task_from_malloc_task(task), res);
@ -206,9 +206,9 @@ bdev_malloc_writev(struct malloc_disk *mdisk, struct spdk_io_channel *ch,
task->num_outstanding = iovcnt; task->num_outstanding = iovcnt;
for (i = 0; i < iovcnt; i++) { for (i = 0; i < iovcnt; i++) {
res = spdk_copy_submit(__copy_task_from_malloc_task(task), res = spdk_accel_submit_copy(__copy_task_from_malloc_task(task),
ch, dst, iov[i].iov_base, ch, dst, iov[i].iov_base,
iov[i].iov_len, malloc_done); iov[i].iov_len, malloc_done);
if (res != 0) { if (res != 0) {
malloc_done(__copy_task_from_malloc_task(task), res); malloc_done(__copy_task_from_malloc_task(task), res);
@ -228,8 +228,8 @@ bdev_malloc_unmap(struct malloc_disk *mdisk,
task->status = SPDK_BDEV_IO_STATUS_SUCCESS; task->status = SPDK_BDEV_IO_STATUS_SUCCESS;
task->num_outstanding = 1; task->num_outstanding = 1;
return spdk_copy_submit_fill(__copy_task_from_malloc_task(task), ch, return spdk_accel_submit_fill(__copy_task_from_malloc_task(task), ch,
mdisk->malloc_buf + offset, 0, byte_count, malloc_done); mdisk->malloc_buf + offset, 0, byte_count, malloc_done);
} }
static int64_t static int64_t
@ -358,7 +358,7 @@ bdev_malloc_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
static struct spdk_io_channel * static struct spdk_io_channel *
bdev_malloc_get_io_channel(void *ctx) bdev_malloc_get_io_channel(void *ctx)
{ {
return spdk_copy_engine_get_io_channel(); return spdk_accel_engine_get_io_channel();
} }
static void static void

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..) SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += bdev copy iscsi net nvmf scsi vmd DIRS-y += bdev accel iscsi net nvmf scsi vmd
ifeq ($(OS),Linux) ifeq ($(OS),Linux)
DIRS-y += nbd DIRS-y += nbd
@ -46,7 +46,7 @@ DIRS-$(CONFIG_VHOST) += vhost
# 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-bdev := copy vmd DEPDIRS-bdev := accel vmd
DEPDIRS-iscsi := scsi DEPDIRS-iscsi := scsi
DEPDIRS-nbd := bdev DEPDIRS-nbd := bdev
DEPDIRS-nvmf := bdev DEPDIRS-nvmf := bdev

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..) SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
C_SRCS = copy.c C_SRCS = accel.c
LIBNAME = event_copy LIBNAME = event_accel
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -33,38 +33,38 @@
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk/copy_engine.h" #include "spdk/accel_engine.h"
#include "spdk_internal/event.h" #include "spdk_internal/event.h"
#include "spdk/env.h" #include "spdk/env.h"
static void static void
spdk_copy_engine_subsystem_initialize(void) spdk_accel_engine_subsystem_initialize(void)
{ {
int rc; int rc;
rc = spdk_copy_engine_initialize(); rc = spdk_accel_engine_initialize();
spdk_subsystem_init_next(rc); spdk_subsystem_init_next(rc);
} }
static void static void
spdk_copy_engine_subsystem_finish_done(void *cb_arg) spdk_accel_engine_subsystem_finish_done(void *cb_arg)
{ {
spdk_subsystem_fini_next(); spdk_subsystem_fini_next();
} }
static void static void
spdk_copy_engine_subsystem_finish(void) spdk_accel_engine_subsystem_finish(void)
{ {
spdk_copy_engine_finish(spdk_copy_engine_subsystem_finish_done, NULL); spdk_accel_engine_finish(spdk_accel_engine_subsystem_finish_done, NULL);
} }
static struct spdk_subsystem g_spdk_subsystem_copy = { static struct spdk_subsystem g_spdk_subsystem_accel = {
.name = "copy", .name = "accel",
.init = spdk_copy_engine_subsystem_initialize, .init = spdk_accel_engine_subsystem_initialize,
.fini = spdk_copy_engine_subsystem_finish, .fini = spdk_accel_engine_subsystem_finish,
.config = spdk_copy_engine_config_text, .config = spdk_accel_engine_config_text,
}; };
SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_copy); SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_accel);

View File

@ -79,5 +79,5 @@ static struct spdk_subsystem g_spdk_subsystem_bdev = {
}; };
SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_bdev); SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_bdev);
SPDK_SUBSYSTEM_DEPEND(bdev, copy) SPDK_SUBSYSTEM_DEPEND(bdev, accel)
SPDK_SUBSYSTEM_DEPEND(bdev, vmd) SPDK_SUBSYSTEM_DEPEND(bdev, vmd)

View File

@ -36,7 +36,7 @@ nvmf_dict["subsystems"] = []
# dictionary with new config that will be written to new json config file # dictionary with new config that will be written to new json config file
subsystem = { subsystem = {
"copy": None, "accel": None,
"interface": None, "interface": None,
"net_framework": None, "net_framework": None,
"bdev": bdev_dict, "bdev": bdev_dict,
@ -61,7 +61,7 @@ no_yes_map = {"no": False, "No": False, "Yes": True, "yes": True}
def generate_new_json_config(): def generate_new_json_config():
json_subsystem = [ json_subsystem = [
{'subsystem': "copy", 'config': None}, {'subsystem': "accel", 'config': None},
{"subsystem": "interface", "config": None}, {"subsystem": "interface", "config": None},
{"subsystem": "net_framework", "config": None}, {"subsystem": "net_framework", "config": None},
{"subsystem": "bdev", "config": []}, {"subsystem": "bdev", "config": []},

View File

@ -2100,18 +2100,19 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
p.set_defaults(func=bdev_ocssd_delete) p.set_defaults(func=bdev_ocssd_delete)
# ioat # ioat
def ioat_scan_copy_engine(args): def ioat_scan_accel_engine(args):
pci_whitelist = [] pci_whitelist = []
if args.pci_whitelist: if args.pci_whitelist:
for w in args.pci_whitelist.strip().split(" "): for w in args.pci_whitelist.strip().split(" "):
pci_whitelist.append(w) pci_whitelist.append(w)
rpc.ioat.ioat_scan_copy_engine(args.client, pci_whitelist) rpc.ioat.ioat_scan_accel_engine(args.client, pci_whitelist)
p = subparsers.add_parser('ioat_scan_copy_engine', aliases=['scan_ioat_copy_engine'], p = subparsers.add_parser('ioat_scan_accel_engine',
help='Set scan and enable IOAT copy engine offload.') aliases=['ioat_scan_copy_engine', 'scan_ioat_copy_engine'],
help='Set scan and enable IOAT accel engine offload.')
p.add_argument('-w', '--pci-whitelist', help="""Whitespace-separated list of PCI addresses in p.add_argument('-w', '--pci-whitelist', help="""Whitespace-separated list of PCI addresses in
domain:bus:device.function format or domain.bus.device.function format""") domain:bus:device.function format or domain.bus.device.function format""")
p.set_defaults(func=ioat_scan_copy_engine) p.set_defaults(func=ioat_scan_accel_engine)
# opal # opal
def bdev_nvme_opal_init(args): def bdev_nvme_opal_init(args):

View File

@ -1,9 +1,10 @@
from .helpers import deprecated_alias from .helpers import deprecated_alias
@deprecated_alias('ioat_scan_copy_engine')
@deprecated_alias('scan_ioat_copy_engine') @deprecated_alias('scan_ioat_copy_engine')
def ioat_scan_copy_engine(client, pci_whitelist): def ioat_scan_accel_engine(client, pci_whitelist):
"""Scan and enable IOAT copy engine. """Scan and enable IOAT accel engine.
Args: Args:
pci_whitelist: Python list of PCI addresses in pci_whitelist: Python list of PCI addresses in
@ -13,4 +14,4 @@ def ioat_scan_copy_engine(client, pci_whitelist):
params = {} params = {}
if pci_whitelist: if pci_whitelist:
params['pci_whitelist'] = pci_whitelist params['pci_whitelist'] = pci_whitelist
return client.call('ioat_scan_copy_engine', params) return client.call('ioat_scan_accel_engine', params)

View File

@ -40,8 +40,8 @@ APP = bdev_svc
C_SRCS := bdev_svc.c C_SRCS := bdev_svc.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_vmd SPDK_LIB_LIST += event_bdev event_accel event_vmd
SPDK_LIB_LIST += nvmf event log trace conf thread util bdev copy rpc jsonrpc json sock blobfs_bdev SPDK_LIB_LIST += nvmf event log trace conf thread util bdev accel rpc jsonrpc json sock blobfs_bdev
SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc notify SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc notify
ifeq ($(OS),Linux) ifeq ($(OS),Linux)

View File

@ -40,8 +40,8 @@ APP = bdevio
C_SRCS := bdevio.c C_SRCS := bdevio.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_vmd SPDK_LIB_LIST += event_bdev event_accel event_vmd
SPDK_LIB_LIST += app_rpc bdev bdev_rpc copy event trace log conf thread util rpc jsonrpc json sock notify SPDK_LIB_LIST += app_rpc bdev bdev_rpc accel event trace log conf thread util rpc jsonrpc json sock notify
LIBS += -lcunit LIBS += -lcunit

View File

@ -34,7 +34,7 @@
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk/bdev.h" #include "spdk/bdev.h"
#include "spdk/copy_engine.h" #include "spdk/accel_engine.h"
#include "spdk/env.h" #include "spdk/env.h"
#include "spdk/log.h" #include "spdk/log.h"
#include "spdk/thread.h" #include "spdk/thread.h"

View File

@ -40,8 +40,8 @@ APP = bdevperf
C_SRCS := bdevperf.c C_SRCS := bdevperf.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_vmd SPDK_LIB_LIST += event_bdev event_accel event_vmd
SPDK_LIB_LIST += bdev copy event trace log conf thread util sock notify SPDK_LIB_LIST += bdev accel event trace log conf thread util sock notify
SPDK_LIB_LIST += rpc jsonrpc json app_rpc log_rpc bdev_rpc SPDK_LIB_LIST += rpc jsonrpc json app_rpc log_rpc bdev_rpc
ifeq ($(OS),Linux) ifeq ($(OS),Linux)

View File

@ -34,7 +34,7 @@
#include "spdk/stdinc.h" #include "spdk/stdinc.h"
#include "spdk/bdev.h" #include "spdk/bdev.h"
#include "spdk/copy_engine.h" #include "spdk/accel_engine.h"
#include "spdk/endian.h" #include "spdk/endian.h"
#include "spdk/env.h" #include "spdk/env.h"
#include "spdk/event.h" #include "spdk/event.h"

View File

@ -40,8 +40,8 @@ APP = fuse
C_SRCS := fuse.c C_SRCS := fuse.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_vmd SPDK_LIB_LIST += event_bdev event_accel event_vmd
SPDK_LIB_LIST += bdev copy event thread util conf trace \ SPDK_LIB_LIST += bdev accel event thread util conf trace \
log jsonrpc json rpc sock notify blobfs_bdev log jsonrpc json rpc sock notify blobfs_bdev
# libfuse3 is required internally by blobfs_bdev # libfuse3 is required internally by blobfs_bdev

View File

@ -40,8 +40,8 @@ APP = mkfs
C_SRCS := mkfs.c C_SRCS := mkfs.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_vmd SPDK_LIB_LIST += event_bdev event_accel event_vmd
SPDK_LIB_LIST += bdev copy event thread util conf trace \ SPDK_LIB_LIST += bdev accel event thread util conf trace \
log jsonrpc json rpc sock notify blobfs_bdev log jsonrpc json rpc sock notify blobfs_bdev
# libfuse3 is required internally by blobfs_bdev # libfuse3 is required internally by blobfs_bdev

View File

@ -1,7 +1,7 @@
{ {
"subsystems": [ "subsystems": [
{ {
"subsystem": "copy", "subsystem": "accel",
"config": null "config": null
}, },
{ {

View File

@ -1,7 +1,7 @@
{ {
"subsystems": [ "subsystems": [
{ {
"subsystem": "copy", "subsystem": "accel",
"config": null "config": null
}, },
{ {

View File

@ -1,7 +1,7 @@
{ {
"subsystems": [ "subsystems": [
{ {
"subsystem": "copy", "subsystem": "accel",
"config": null "config": null
}, },
{ {

View File

@ -132,7 +132,7 @@ def clear_net_framework_subsystem(args, net_framework_config):
pass pass
def clear_copy_subsystem(args, copy_config): def clear_accel_subsystem(args, accel_config):
pass pass

View File

@ -115,13 +115,13 @@ subsystem_sort_test_depends_on_multiple(void)
set_up_subsystem(&g_ut_subsystems[4], "rpc"); set_up_subsystem(&g_ut_subsystems[4], "rpc");
set_up_subsystem(&g_ut_subsystems[5], "scsi"); set_up_subsystem(&g_ut_subsystems[5], "scsi");
set_up_subsystem(&g_ut_subsystems[6], "interface"); set_up_subsystem(&g_ut_subsystems[6], "interface");
set_up_subsystem(&g_ut_subsystems[7], "copy"); set_up_subsystem(&g_ut_subsystems[7], "accel");
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
spdk_add_subsystem(&g_ut_subsystems[i]); spdk_add_subsystem(&g_ut_subsystems[i]);
} }
set_up_depends(&g_ut_subsystem_deps[0], "bdev", "copy"); set_up_depends(&g_ut_subsystem_deps[0], "bdev", "accel");
set_up_depends(&g_ut_subsystem_deps[1], "scsi", "bdev"); set_up_depends(&g_ut_subsystem_deps[1], "scsi", "bdev");
set_up_depends(&g_ut_subsystem_deps[2], "rpc", "interface"); set_up_depends(&g_ut_subsystem_deps[2], "rpc", "interface");
set_up_depends(&g_ut_subsystem_deps[3], "sock", "interface"); set_up_depends(&g_ut_subsystem_deps[3], "sock", "interface");
@ -143,7 +143,7 @@ subsystem_sort_test_depends_on_multiple(void)
TAILQ_REMOVE(&g_subsystems, subsystem, tailq); TAILQ_REMOVE(&g_subsystems, subsystem, tailq);
subsystem = TAILQ_FIRST(&g_subsystems); subsystem = TAILQ_FIRST(&g_subsystems);
CU_ASSERT(strcmp(subsystem->name, "copy") == 0); CU_ASSERT(strcmp(subsystem->name, "accel") == 0);
TAILQ_REMOVE(&g_subsystems, subsystem, tailq); TAILQ_REMOVE(&g_subsystems, subsystem, tailq);
subsystem = TAILQ_FIRST(&g_subsystems); subsystem = TAILQ_FIRST(&g_subsystems);

View File

@ -1,7 +1,7 @@
{ {
"subsystems": [ "subsystems": [
{ {
"subsystem": "copy", "subsystem": "accel",
"config": null "config": null
}, },
{ {

View File

@ -1,7 +1,7 @@
{ {
"subsystems": [ "subsystems": [
{ {
"subsystem": "copy", "subsystem": "accel",
"config": null "config": null
}, },
{ {