Commit ece43e80 authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

lib/accel: API to get memory domains per opcode



There is an accel module API to return a memory domain
but no public wrapper for it. Next patch uses
the new API in vbdev_crypto

Signed-off-by: default avatarAlexey Marchuk <alexeymar@nvidia.com>
Change-Id: Idad82d1bfbd578fee3cce041978e51e6dd7f29a9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23097


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 6e09c615
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -853,6 +853,22 @@ struct spdk_accel_operation_exec_ctx {
uint8_t spdk_accel_get_buf_align(enum spdk_accel_opcode opcode,
				 const struct spdk_accel_operation_exec_ctx *ctx);

/**
 * Return memory domains used by specific opcode.
 *
 * The returned memory domains depend on the accel module which is assigned to handle the \b opcode
 *
 * \param opcode Accel Framework Opcode enum value.
 * \param domains Pointer to an array of memory domains to be filled by this function. The user should allocate big enough
  * array to keep all memory domains.
 * \param array_size size of \b domains array
 * \return the number of entries in \b domains array or negated errno. If returned value is bigger than \b array_size passed by the user
  * then the user should increase the size of \b domains array and call this function again. There is no guarantees that
  * the content of \b domains array is valid in that case.
 */
int spdk_accel_get_opc_memory_domains(enum spdk_accel_opcode opcode,
				      struct spdk_memory_domain **domains, int array_size);

/**
 * Return the name of an operation based on the opcode.
 *
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 15
SO_MINOR := 0
SO_MINOR := 1
SO_SUFFIX := $(SO_VER).$(SO_MINOR)

LIBNAME = accel
+14 −0
Original line number Diff line number Diff line
@@ -3243,4 +3243,18 @@ spdk_accel_get_module(const char *name)
	return NULL;
}

int
spdk_accel_get_opc_memory_domains(enum spdk_accel_opcode opcode,
				  struct spdk_memory_domain **domains,
				  int array_size)
{
	assert(opcode < SPDK_ACCEL_OPC_LAST);

	if (g_modules_opc[opcode].module->get_memory_domains) {
		return g_modules_opc[opcode].module->get_memory_domains(domains, array_size);
	}

	return 0;
}

SPDK_LOG_REGISTER_COMPONENT(accel)
+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
	spdk_accel_get_opcode_stats;
	spdk_accel_get_buf_align;
	spdk_accel_get_opcode_name;
	spdk_accel_get_opc_memory_domains;

	# functions needed by modules
	spdk_accel_module_list_add;