Commit 5b03dd93 authored by paul luse's avatar paul luse Committed by Ben Walker
Browse files

module/idxd: accel framework plug-in for idxd



Docs, RPC, unit tests, etc., will follow.  Notes:

* The current implementation will only work with VFIO.

* The current implementation supports only the existing accel
framework API. The API will be expanded for DSA exclusive features
in a subsequent patch.

* SW is required to manage flow control, to not over-run the work queues.
This is provided in the accel plug-in module. The upper layers use public
API to manage this.

* As we need to support any number of channels (we can't limit ourselves
to the number of work queues) we need to dynamically size/resize our
per channel descriptor rings based on the number of current channels. This
is done from upper layers via public API into the lib.

* As channels are created, the total number of work queue slots is divided
across the channels evenly.  Same thing when they are destroyed, remaining
channels will see the ring sizes increase. This is done from upper layers
via public API into the lib.

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


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent e58e9fbd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ void spdk_idxd_detach(struct spdk_idxd_device *idxd);
 *
 * \param config_number the configuration number for a valid IDXD config.
  */
void spdk_idxd_set_config(int config_number);
void spdk_idxd_set_config(uint32_t config_number);

/**
 * Build and submit a DMA engine memory copy request.
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ enum accel_module {
	ACCEL_SW = 0,
	ACCEL_AUTO,
	ACCEL_CBDMA,
	ACCEL_IDXD_DSA,
	ACCEL_MODULE_MAX
};

+11 −4
Original line number Diff line number Diff line
@@ -75,12 +75,15 @@ accel_set_module(enum accel_module *opts)
	return 0;
}

/* Registration of hw modules (currently supports only 1) */
/* Registration of hw modules (currently supports only 1 at a time) */
void
spdk_accel_hw_engine_register(struct spdk_accel_engine *accel_engine)
{
	assert(g_hw_accel_engine == NULL);
	if (g_hw_accel_engine == NULL) {
		g_hw_accel_engine = accel_engine;
	} else {
		SPDK_NOTICELOG("Hardware offload engine already enabled\n");
	}
}

/* Registration of sw modules (currently supports only 1) */
@@ -160,13 +163,17 @@ accel_engine_create_cb(void *io_device, void *ctx_buf)
		return -EINVAL;
	}

	if (g_active_accel_module == ACCEL_IDXD_DSA && g_hw_accel_engine == NULL) {
		SPDK_ERRLOG("IDXD acceleration engine specified but not available.\n");
		return -EINVAL;
	}

	/* For either HW or AUTO */
	if (g_active_accel_module > ACCEL_SW) {
		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;
				SPDK_NOTICELOG("Acceleration framework using module: CBDMA\n");
				return 0;
			}
		}
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@
	spdk_vtophys;
	spdk_pci_nvme_get_driver;
	spdk_pci_vmd_get_driver;
	spdk_pci_idxd_get_driver;
	spdk_pci_ioat_get_driver;
	spdk_pci_virtio_get_driver;
	spdk_pci_enumerate;
+1 −1
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ spdk_idxd_reconfigure_chan(struct spdk_idxd_io_channel *chan, uint32_t num_chann

/* Called via RPC to select a pre-defined configuration. */
void
spdk_idxd_set_config(int config_num)
spdk_idxd_set_config(uint32_t config_num)
{
	switch (config_num) {
	case 0:
Loading