Commit 0fed4e07 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

copy_engine: Support dump config text for IOAT config



IOAT module of copy engine requires config information in the .INI
config file. However dump config text is not supported yet.

Dump config text is legacy feature but this becomes a preparation
for the upcoming JSON config file.

Change-Id: I9b7349cac9c00ca3ce1d944a84cbc445a6f1aec4
Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/405845


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 3f522bfe
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -66,6 +66,13 @@ int spdk_copy_engine_initialize(void);
 */
void spdk_copy_engine_finish(spdk_copy_fini_cb cb_fn, void *cb_arg);

/**
 * Get the configuration for the copy engine.
 *
 * \param fp The pointer to a file that will be written to the configuration.
 */
void spdk_copy_engine_config_text(FILE *fp);

/**
 * Close the copy engine module and perform any necessary cleanup.
 */
+12 −0
Original line number Diff line number Diff line
@@ -285,4 +285,16 @@ spdk_copy_engine_finish(spdk_copy_fini_cb cb_fn, void *cb_arg)
	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, NULL, NULL, copy_engine_mem_get_ctx_size)
+31 −1
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ struct ioat_task {

static int copy_engine_ioat_init(void);
static void copy_engine_ioat_exit(void *ctx);
static void copy_engine_ioat_config_text(FILE *fp);

static size_t
copy_engine_ioat_get_ctx_size(void)
@@ -123,7 +124,8 @@ copy_engine_ioat_get_ctx_size(void)
	return sizeof(struct ioat_task) + sizeof(struct spdk_copy_task);
}

SPDK_COPY_MODULE_REGISTER(copy_engine_ioat_init, copy_engine_ioat_exit, NULL,
SPDK_COPY_MODULE_REGISTER(copy_engine_ioat_init, copy_engine_ioat_exit,
			  copy_engine_ioat_config_text,
			  copy_engine_ioat_get_ctx_size)

static void
@@ -319,3 +321,31 @@ copy_engine_ioat_init(void)
				sizeof(struct ioat_io_channel));
	return 0;
}

#define COPY_ENGINE_IOAT_HEADER_TMPL \
"[Ioat]\n" \
"  # Users may not want to use offload even it is available.\n" \
"  # Users may use the whitelist to initialize specified devices, IDS\n" \
"  #  uses BUS:DEVICE.FUNCTION to identify each Ioat channel.\n"

#define COPY_ENGINE_IOAT_DISABLE_TMPL \
"  Disable %s\n"

#define COPY_ENGINE_IOAT_WHITELIST_TMPL \
"  Whitelist %.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 "\n"

static void
copy_engine_ioat_config_text(FILE *fp)
{
	int i;
	struct spdk_pci_addr *dev;

	fprintf(fp, COPY_ENGINE_IOAT_HEADER_TMPL);
	fprintf(fp, COPY_ENGINE_IOAT_DISABLE_TMPL, g_ioat_disable ? "Yes" : "No");

	for (i = 0; i < g_probe_ctx.num_whitelist_devices; i++) {
		dev = &g_probe_ctx.whitelist[i];
		fprintf(fp, COPY_ENGINE_IOAT_WHITELIST_TMPL,
			dev->domain, dev->bus, dev->dev, dev->func);
	}
}
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ static struct spdk_subsystem g_spdk_subsystem_copy = {
	.name = "copy",
	.init = spdk_copy_engine_subsystem_initialize,
	.fini = spdk_copy_engine_subsystem_finish,
	.config = NULL,
	.config = spdk_copy_engine_config_text,
};

SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_copy);