diff --git a/examples/vmd/lsvmd/lsvmd.c b/examples/vmd/lsvmd/lsvmd.c index 0b7440911..c609715d9 100644 --- a/examples/vmd/lsvmd/lsvmd.c +++ b/examples/vmd/lsvmd/lsvmd.c @@ -62,9 +62,8 @@ parse_args(int argc, char **argv) int main(int argc, char **argv) { struct spdk_env_opts opts; - size_t vmd_cnt; - int rc = parse_args(argc, argv); + if (rc != 0) { return rc; } @@ -77,9 +76,9 @@ int main(int argc, char **argv) return 1; } - vmd_cnt = spdk_vmd_probe(&g_probe_addr); + rc = spdk_vmd_init(); - if (vmd_cnt == 0) { + if (rc) { SPDK_ERRLOG("No VMD Controllers found\n"); } diff --git a/include/spdk/vmd.h b/include/spdk/vmd.h index 6c68be026..5de5874c5 100644 --- a/include/spdk/vmd.h +++ b/include/spdk/vmd.h @@ -51,15 +51,11 @@ extern "C" { #define MAX_VMD_TARGET 24 /* - * Takes an input VMD D-BDF, probes it and attaches to it. The resulting vmd - * adapter is placed in a vmd container. If input BDF is NULL, then all VMD - * probed is consumed in the application VMD container list. + * Enumerate VMD devices and hook them into the spdk pci subsystem * - * \param vmd_bdf VMD BDF - * - * \return number of VMD devices available in the system + * \return 0 on success, -1 on failure */ -int spdk_vmd_probe(struct spdk_pci_addr *vmd_bdf); +int spdk_vmd_init(void); /* * Returns a list of nvme devices found on the given vmd pci BDF. diff --git a/lib/vmd/vmd.c b/lib/vmd/vmd.c index 83cc2053d..6669964c2 100644 --- a/lib/vmd/vmd.c +++ b/lib/vmd/vmd.c @@ -55,8 +55,6 @@ static unsigned char *device_type[] = { */ struct vmd_container { uint32_t count; - /* can target specific vmd or all vmd when null */ - struct spdk_pci_addr *vmd_target_addr; struct vmd_adapter vmd[MAX_VMD_SUPPORTED]; }; @@ -833,14 +831,6 @@ vmd_enum_cb(void *ctx, struct spdk_pci_device *pci_dev) struct vmd_container *vmd_c = ctx; size_t i; - /* - * If vmd target addr is NULL, then all spdk returned devices are consumed - */ - if (vmd_c->vmd_target_addr && - spdk_pci_addr_compare(&pci_dev->addr, vmd_c->vmd_target_addr)) { - return -1; - } - spdk_pci_device_cfg_read32(pci_dev, &cmd_reg, 4); cmd_reg |= 0x6; /* PCI bus master/memory enable. */ spdk_pci_device_cfg_write32(pci_dev, cmd_reg, 4); @@ -909,13 +899,9 @@ spdk_vmd_pci_device_list(struct spdk_pci_addr vmd_addr, struct spdk_pci_device * } int -spdk_vmd_probe(struct spdk_pci_addr *vmd_bdf) +spdk_vmd_init(void) { - g_vmd_container.vmd_target_addr = vmd_bdf; - spdk_pci_enumerate(spdk_pci_vmd_get_driver(), vmd_enum_cb, &g_vmd_container); - g_vmd_container.vmd_target_addr = NULL; - - return g_vmd_container.count; + return spdk_pci_enumerate(spdk_pci_vmd_get_driver(), vmd_enum_cb, &g_vmd_container); } SPDK_LOG_REGISTER_COMPONENT("vmd", SPDK_LOG_VMD)