Commit fb51565a authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

env/dpdk: add spdk_pci_fini()



It's mostly needed for the next patch, but even
now it provides some value by printing errors if
there any leaked (still attached) PCI devices
at shutdown.

Change-Id: I8459a6049b3c6612d9f1d99444bf3acfd474a839
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449082


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 04814b72
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ int spdk_pci_device_init(struct rte_pci_driver *driver, struct rte_pci_device *d
int spdk_pci_device_fini(struct rte_pci_device *device);

void spdk_pci_init(void);
void spdk_pci_fini(void);
int spdk_mem_map_init(void);
int spdk_vtophys_init(void);

+2 −0
Original line number Diff line number Diff line
@@ -385,6 +385,8 @@ spdk_env_dpdk_post_init(void)
void
spdk_env_dpdk_post_fini(void)
{
	spdk_pci_fini();

	spdk_free_args(g_eal_cmdline, g_eal_cmdline_argcount);
}

+14 −0
Original line number Diff line number Diff line
@@ -147,6 +147,20 @@ spdk_pci_init(void)
#endif
}

void
spdk_pci_fini(void)
{
	struct spdk_pci_device *dev;
	char bdf[32];

	TAILQ_FOREACH(dev, &g_pci_devices, internal.tailq) {
		if (dev->internal.attached) {
			spdk_pci_addr_fmt(bdf, sizeof(bdf), &dev->addr);
			fprintf(stderr, "Device %s is still attached at shutdown!\n", bdf);
		}
	}
}

int
spdk_pci_device_init(struct rte_pci_driver *_drv,
		     struct rte_pci_device *_dev)