env/dpdk: fix the PCI detach error in secondary process
DPDK will report error when detaching the PCI device in secondary process, because SPDK will return -1 in `pci_device_fini`, so here we will reset the `attached` flag before that. Also return the errno instead of -1. Change-Id: I3efa4d97ceab504215faeb9d3d80a694bdd6014c Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7944 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Dong Yi <dongx.yi@intel.com>
This commit is contained in:
parent
289252eafa
commit
aa530161f7
@ -528,7 +528,7 @@ pci_device_fini(struct rte_pci_device *_dev)
|
|||||||
if (dev == NULL || dev->internal.attached) {
|
if (dev == NULL || dev->internal.attached) {
|
||||||
/* The device might be still referenced somewhere in SPDK. */
|
/* The device might be still referenced somewhere in SPDK. */
|
||||||
pthread_mutex_unlock(&g_pci_mutex);
|
pthread_mutex_unlock(&g_pci_mutex);
|
||||||
return -1;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove our allowed_at option */
|
/* remove our allowed_at option */
|
||||||
@ -552,6 +552,7 @@ spdk_pci_device_detach(struct spdk_pci_device *dev)
|
|||||||
spdk_pci_device_unclaim(dev);
|
spdk_pci_device_unclaim(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev->internal.attached = false;
|
||||||
if (strcmp(dev->type, "pci") == 0) {
|
if (strcmp(dev->type, "pci") == 0) {
|
||||||
/* if it's a physical device we need to deal with DPDK on
|
/* if it's a physical device we need to deal with DPDK on
|
||||||
* a different process and we can't just unset one flag
|
* a different process and we can't just unset one flag
|
||||||
@ -561,8 +562,6 @@ spdk_pci_device_detach(struct spdk_pci_device *dev)
|
|||||||
* to a different process, or to a kernel driver like nvme.
|
* to a different process, or to a kernel driver like nvme.
|
||||||
*/
|
*/
|
||||||
detach_rte(dev);
|
detach_rte(dev);
|
||||||
} else {
|
|
||||||
dev->internal.attached = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_pci_devices();
|
cleanup_pci_devices();
|
||||||
|
Loading…
Reference in New Issue
Block a user