Commit 12c40f05 authored by paul luse's avatar paul luse Committed by Jim Harris
Browse files

accel: plumb accel flags through operations that need them



This patch is just plumbing the flags param. Use of it for PMEM
will come in upcoming patches.

Signed-off-by: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: I620df072aaad3f8062a0312bbea3da1bc3f911b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9281


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 0d5ce8c2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -11,6 +11,16 @@ Removed deprecated spdk_bdev_module_finish_done(). Use spdk_bdev_module_fini_don
A new parameter `flags` was added to all low level submission and preparation
APIs to enable the caller to pass operation flags per the DSA specification.

### accel_fw

A new parameter `flags` was added to accel API.
The APIs include:
`spdk_accel_submit_copy`
`spdk_accel_submit_dualcast`
`spdk_accel_submit_fill`
`spdk_accel_submit_copy_crc32c`
`spdk_accel_submit_copy_crc32cv`

### bdev_nvme

Added `bdev_nvme_add_error_injection` and `bdev_nvme_remove_error_injection` RPCs to add and
+5 −4
Original line number Diff line number Diff line
@@ -350,18 +350,19 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
{
	int random_num;
	int rc = 0;
	int flags = 0;

	assert(worker);

	switch (g_workload_selection) {
	case ACCEL_COPY:
		rc = spdk_accel_submit_copy(worker->ch, task->dst, task->src,
					    g_xfer_size_bytes, accel_done, task);
					    g_xfer_size_bytes, flags, accel_done, task);
		break;
	case ACCEL_FILL:
		/* For fill use the first byte of the task->dst buffer */
		rc = spdk_accel_submit_fill(worker->ch, task->dst, *(uint8_t *)task->src,
					    g_xfer_size_bytes, accel_done, task);
					    g_xfer_size_bytes, flags, accel_done, task);
		break;
	case ACCEL_CRC32C:
		rc = spdk_accel_submit_crc32cv(worker->ch, &task->crc_dst,
@@ -370,7 +371,7 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
		break;
	case ACCEL_COPY_CRC32C:
		rc = spdk_accel_submit_copy_crc32cv(worker->ch, task->dst, task->iovs, task->iov_cnt,
						    &task->crc_dst, g_crc32c_seed, accel_done, task);
						    &task->crc_dst, g_crc32c_seed, flags, accel_done, task);
		break;
	case ACCEL_COMPARE:
		random_num = rand() % 100;
@@ -386,7 +387,7 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
		break;
	case ACCEL_DUALCAST:
		rc = spdk_accel_submit_dualcast(worker->ch, task->dst, task->dst2,
						task->src, g_xfer_size_bytes, accel_done, task);
						task->src, g_xfer_size_bytes, flags, accel_done, task);
		break;
	default:
		assert(false);
+11 −5
Original line number Diff line number Diff line
@@ -114,13 +114,14 @@ uint64_t spdk_accel_get_capabilities(struct spdk_io_channel *ch);
 * \param dst Destination to copy to.
 * \param src Source to copy from.
 * \param nbytes Length in bytes to copy.
 * \param flags Accel framework flags for operations.
 * \param cb_fn Called when this copy operation completes.
 * \param cb_arg Callback argument.
 *
 * \return 0 on success, negative errno on failure.
 */
int spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uint64_t nbytes,
			   spdk_accel_completion_cb cb_fn, void *cb_arg);
			   int flags, spdk_accel_completion_cb cb_fn, void *cb_arg);

/**
 * Submit a dual cast copy request.
@@ -130,13 +131,14 @@ int spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uin
 * \param dst2 Second destination to copy to (must be 4K aligned).
 * \param src Source to copy from.
 * \param nbytes Length in bytes to copy.
 * \param flags Accel framework flags for operations.
 * \param cb_fn Called when this copy operation completes.
 * \param cb_arg Callback argument.
 *
 * \return 0 on success, negative errno on failure.
 */
int spdk_accel_submit_dualcast(struct spdk_io_channel *ch, void *dst1, void *dst2, void *src,
			       uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg);
			       uint64_t nbytes, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg);

/**
 * Submit a compare request.
@@ -162,13 +164,14 @@ int spdk_accel_submit_compare(struct spdk_io_channel *ch, void *src1, void *src2
 * \param dst Destination to fill.
 * \param fill Constant byte to fill to the destination.
 * \param nbytes Length in bytes to fill.
 * \param flags Accel framework flags for operations.
 * \param cb_fn Called when this fill operation completes.
 * \param cb_arg Callback argument.
 *
 * \return 0 on success, negative errno on failure.
 */
int spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst, uint8_t fill, uint64_t nbytes,
			   spdk_accel_completion_cb cb_fn, void *cb_arg);
			   int flags, spdk_accel_completion_cb cb_fn, void *cb_arg);

/**
 * Submit a CRC-32C calculation request.
@@ -218,13 +221,14 @@ int spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst, str
 * \param crc_dst Destination to write the CRC-32C to.
 * \param seed Four byte seed value.
 * \param nbytes Length in bytes.
 * \param flags Accel framework flags for operations.
 * \param cb_fn Called when this CRC-32C operation completes.
 * \param cb_arg Callback argument.
 *
 * \return 0 on success, negative errno on failure.
 */
int spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
				  uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
				  uint32_t *crc_dst, uint32_t seed, uint64_t nbytes, int flags,
				  spdk_accel_completion_cb cb_fn, void *cb_arg);

/**
@@ -238,13 +242,15 @@ int spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *s
 * \param iovcnt The size of the io vectors.
 * \param crc_dst Destination to write the CRC-32C to.
 * \param seed Four byte seed value.
 * \param flags Accel framework flags for operations.
 * \param cb_fn Called when this CRC-32C operation completes.
 * \param cb_arg Callback argument.
 *
 * \return 0 on success, negative errno on failure.
 */
int spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct iovec *src_iovs,
				   uint32_t iovcnt, uint32_t *crc_dst, uint32_t seed, spdk_accel_completion_cb cb_fn, void *cb_arg);
				   uint32_t iovcnt, uint32_t *crc_dst, uint32_t seed,
				   int flags, spdk_accel_completion_cb cb_fn, void *cb_arg);


struct spdk_json_write_ctx;
+1 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ struct spdk_accel_task {
	uint32_t			*crc_dst;
	enum accel_opcode		op_code;
	uint64_t			nbytes;
	int				flags;
	int				status;
	TAILQ_ENTRY(spdk_accel_task)	link;
};
+10 −5
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ _add_to_comp_list(struct accel_io_channel *accel_ch, struct spdk_accel_task *acc
/* Accel framework public API for copy function */
int
spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uint64_t nbytes,
		       spdk_accel_completion_cb cb_fn, void *cb_arg)
		       int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
{
	struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
	struct spdk_accel_task *accel_task;
@@ -182,6 +182,7 @@ spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uint64_
	accel_task->src = src;
	accel_task->op_code = ACCEL_OPCODE_MEMMOVE;
	accel_task->nbytes = nbytes;
	accel_task->flags = flags;

	if (_is_supported(accel_ch->engine, ACCEL_COPY)) {
		return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
@@ -195,7 +196,7 @@ spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uint64_
/* Accel framework public API for dual cast copy function */
int
spdk_accel_submit_dualcast(struct spdk_io_channel *ch, void *dst1, void *dst2, void *src,
			   uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg)
			   uint64_t nbytes, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
{
	struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
	struct spdk_accel_task *accel_task;
@@ -214,6 +215,7 @@ spdk_accel_submit_dualcast(struct spdk_io_channel *ch, void *dst1, void *dst2, v
	accel_task->dst = dst1;
	accel_task->dst2 = dst2;
	accel_task->nbytes = nbytes;
	accel_task->flags = flags;
	accel_task->op_code = ACCEL_OPCODE_DUALCAST;

	if (_is_supported(accel_ch->engine, ACCEL_DUALCAST)) {
@@ -256,7 +258,7 @@ spdk_accel_submit_compare(struct spdk_io_channel *ch, void *src1, void *src2, ui
/* Accel framework public API for fill function */
int
spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst, uint8_t fill, uint64_t nbytes,
		       spdk_accel_completion_cb cb_fn, void *cb_arg)
		       int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
{
	struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
	struct spdk_accel_task *accel_task;
@@ -269,6 +271,7 @@ spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst, uint8_t fill, uint
	accel_task->dst = dst;
	accel_task->fill_pattern = fill;
	accel_task->nbytes = nbytes;
	accel_task->flags = flags;
	accel_task->op_code = ACCEL_OPCODE_MEMFILL;

	if (_is_supported(accel_ch->engine, ACCEL_FILL)) {
@@ -353,7 +356,7 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst, struct
/* Accel framework public API for copy with CRC-32C function */
int
spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
			      uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
			      uint32_t *crc_dst, uint32_t seed, uint64_t nbytes, int flags,
			      spdk_accel_completion_cb cb_fn, void *cb_arg)
{
	struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
@@ -370,6 +373,7 @@ spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
	accel_task->v.iovcnt = 0;
	accel_task->seed = seed;
	accel_task->nbytes = nbytes;
	accel_task->flags = flags;
	accel_task->op_code = ACCEL_OPCODE_COPY_CRC32C;

	if (_is_supported(accel_ch->engine, ACCEL_COPY_CRC32C)) {
@@ -385,7 +389,7 @@ spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
/* Accel framework public API for chained copy + CRC-32C function */
int
spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct iovec *src_iovs,
			       uint32_t iov_cnt, uint32_t *crc_dst, uint32_t seed,
			       uint32_t iov_cnt, uint32_t *crc_dst, uint32_t seed, int flags,
			       spdk_accel_completion_cb cb_fn, void *cb_arg)
{
	struct accel_io_channel *accel_ch;
@@ -414,6 +418,7 @@ spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct iov
	accel_task->dst = (void *)dst;
	accel_task->crc_dst = crc_dst;
	accel_task->seed = seed;
	accel_task->flags = flags;
	accel_task->op_code = ACCEL_OPCODE_COPY_CRC32C;

	if (_is_supported(accel_ch->engine, ACCEL_COPY_CRC32C)) {
Loading