copy_engine: Hold module configuration to dump it
This patch is a preparation for JSON-RPC and JSON config file. Change-Id: Ieef3ccfb68405b5d6b98fdfb3f99eafd92bccaf7 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/405844 Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
61e8486c10
commit
3f522bfeb0
@ -44,6 +44,15 @@
|
|||||||
|
|
||||||
#define IOAT_MAX_CHANNELS 64
|
#define IOAT_MAX_CHANNELS 64
|
||||||
|
|
||||||
|
static bool g_ioat_disable = false;
|
||||||
|
|
||||||
|
struct ioat_probe_ctx {
|
||||||
|
int num_whitelist_devices;
|
||||||
|
struct spdk_pci_addr whitelist[IOAT_MAX_CHANNELS];
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct ioat_probe_ctx g_probe_ctx;
|
||||||
|
|
||||||
struct ioat_device {
|
struct ioat_device {
|
||||||
struct spdk_ioat_chan *ioat;
|
struct spdk_ioat_chan *ioat;
|
||||||
bool is_allocated;
|
bool is_allocated;
|
||||||
@ -224,11 +233,6 @@ ioat_get_io_channel(void)
|
|||||||
return spdk_get_io_channel(&ioat_copy_engine);
|
return spdk_get_io_channel(&ioat_copy_engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ioat_probe_ctx {
|
|
||||||
int num_whitelist_devices;
|
|
||||||
struct spdk_pci_addr whitelist[IOAT_MAX_CHANNELS];
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
probe_cb(void *cb_ctx, struct spdk_pci_device *pci_dev)
|
probe_cb(void *cb_ctx, struct spdk_pci_device *pci_dev)
|
||||||
{
|
{
|
||||||
@ -277,12 +281,11 @@ copy_engine_ioat_init(void)
|
|||||||
struct spdk_conf_section *sp = spdk_conf_find_section(NULL, "Ioat");
|
struct spdk_conf_section *sp = spdk_conf_find_section(NULL, "Ioat");
|
||||||
const char *pci_bdf;
|
const char *pci_bdf;
|
||||||
int i;
|
int i;
|
||||||
struct ioat_probe_ctx probe_ctx = {};
|
|
||||||
|
|
||||||
if (sp != NULL) {
|
if (sp != NULL) {
|
||||||
if (spdk_conf_section_get_boolval(sp, "Disable", false)) {
|
if (spdk_conf_section_get_boolval(sp, "Disable", false)) {
|
||||||
|
g_ioat_disable = true;
|
||||||
/* Disable Ioat */
|
/* Disable Ioat */
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init the whitelist */
|
/* Init the whitelist */
|
||||||
@ -292,15 +295,20 @@ copy_engine_ioat_init(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spdk_pci_addr_parse(&probe_ctx.whitelist[probe_ctx.num_whitelist_devices], pci_bdf) < 0) {
|
if (spdk_pci_addr_parse(&g_probe_ctx.whitelist[g_probe_ctx.num_whitelist_devices],
|
||||||
|
pci_bdf) < 0) {
|
||||||
SPDK_ERRLOG("Invalid Ioat Whitelist address %s\n", pci_bdf);
|
SPDK_ERRLOG("Invalid Ioat Whitelist address %s\n", pci_bdf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
probe_ctx.num_whitelist_devices++;
|
g_probe_ctx.num_whitelist_devices++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spdk_ioat_probe(&probe_ctx, probe_cb, attach_cb) != 0) {
|
if (g_ioat_disable) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spdk_ioat_probe(&g_probe_ctx, probe_cb, attach_cb) != 0) {
|
||||||
SPDK_ERRLOG("spdk_ioat_probe() failed\n");
|
SPDK_ERRLOG("spdk_ioat_probe() failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -309,6 +317,5 @@ copy_engine_ioat_init(void)
|
|||||||
spdk_copy_engine_register(&ioat_copy_engine);
|
spdk_copy_engine_register(&ioat_copy_engine);
|
||||||
spdk_io_device_register(&ioat_copy_engine, ioat_create_cb, ioat_destroy_cb,
|
spdk_io_device_register(&ioat_copy_engine, ioat_create_cb, ioat_destroy_cb,
|
||||||
sizeof(struct ioat_io_channel));
|
sizeof(struct ioat_io_channel));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user