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: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449082 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
04814b72a8
commit
fb51565a59
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user