Commit c6ecddcc authored by paul luse's avatar paul luse Committed by Tomasz Zawadzki
Browse files

lib/accel: add RPC to get list of OP codes per module



In prep for upcoming patch that will provide an RPC to override
and automatic assignment of an op code to an engine.

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


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 72285fa5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -34,6 +34,11 @@ Renamed the `raid5` module to `raid5f` to reflect that it is not a traditional
RAID5 implementation - only full stripe writes are supported, partial stripe
writes (read-modify-write) are not.

### accel_fw

Added a new runtime RPC `accel_get_opc_assignments` to get a list of current opcode to engine
assignements.

## v22.05

### sock
+41 −0
Original line number Diff line number Diff line
@@ -441,6 +441,7 @@ Example response:
    "framework_get_subsystems",
    "framework_monitor_context_switch",
    "spdk_kill_instance",
    "accel_get_opc_assignments",
    "ioat_scan_accel_engine",
    "dsa_scan_accel_engine",
    "bdev_virtio_attach_controller",
@@ -1495,6 +1496,46 @@ Example response:

## Acceleration Framework Layer {#jsonrpc_components_accel_fw}

### accel_get_opc_assignments {#rpc_accel_get_opc_assignments}

Get a list of opcode names and their assigned accel_fw modules.

#### Parameters

None

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "accel_get_opc_assignments",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "copy": "software",
      "fill": "software",
      "dualcast": "software",
      "compare": "software",
      "crc32c": "software",
      "copy_crc32c": "software",
      "compress": "software",
      "decompress": "software"
    }
}
~~~

### dsa_scan_accel_engine {#rpc_dsa_scan_accel_engine}

Set config and enable dsa accel engine offload.
+12 −0
Original line number Diff line number Diff line
@@ -263,6 +263,18 @@ int spdk_accel_submit_decompress(struct spdk_io_channel *ch, void *dst, void *sr
				 uint64_t nbytes_dst, uint64_t nbytes_src, int flags,
				 spdk_accel_completion_cb cb_fn, void *cb_arg);

/**
 * Return the name of the engine assigned to a specfic opcode.
 *
 * \param opcode Accel Framework Opcode enum value. Valid codes can be retrieved using
 * `accel_get_opc_assignments` or `spdk_accel_get_opc_name`.
 * \param engine_name Pointer to update with engine name.
 *
 * \return 0 if a valid engine name was provided. -EINVAL for invalid opcode
 *  or -ENOENT no engine was found at this time for the provided opcode.
 */
int spdk_accel_get_opc_engine_name(enum accel_opcode opcode, const char **engine_name);

struct spdk_json_write_ctx;

/**
+2 −2
Original line number Diff line number Diff line
@@ -7,11 +7,11 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

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

LIBNAME = accel
C_SRCS = accel_engine.c
C_SRCS = accel_engine.c accel_engine_rpc.c

SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_accel.map)

+17 −0
Original line number Diff line number Diff line
@@ -49,6 +49,23 @@ static struct spdk_accel_engine *g_engines_opc[ACCEL_OPC_LAST] = {};

static int sw_accel_submit_tasks(struct spdk_io_channel *ch, struct spdk_accel_task *first_task);

int
spdk_accel_get_opc_engine_name(enum accel_opcode opcode, const char **engine_name)
{
	if (opcode >= ACCEL_OPC_LAST) {
		/* invalid opcode */
		return -EINVAL;
	}

	if (g_engines_opc[opcode]) {
		*engine_name = g_engines_opc[opcode]->name;
	} else {
		return -ENOENT;
	}

	return 0;
}

static struct spdk_accel_engine *
_engine_find_by_name(const char *name)
{
Loading