Commit 17a286ba authored by Jin Yu's avatar Jin Yu Committed by Tomasz Zawadzki
Browse files

pci: fix rte dev remove handling



Can not remove device in the remove event
callback as we can not unregister the remove
callback. So use the alarm_set to fix this issue.

Fixes #1809

Change-Id: Ib86bc4eeecc0fe2bc51538e28684d015405e8835
Signed-off-by: default avatarJin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6553


Reviewed-by: default avatarVasuki Manikarnike <vasuki.manikarnike@hpe.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatar <dongx.yi@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
parent 6de10dfc
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -246,8 +246,17 @@ pci_device_rte_dev_event(const char *device_name,

		if (dev != NULL && can_detach) {
			/* if device is not attached we can remove it right away.
			* Otherwise it will be removed at detach. */
			remove_rte_dev(dev->dev_handle);
			 * Otherwise it will be removed at detach.
			 *
			 * Because the user's callback is invoked in eal interrupt
			 * callback, the interrupt callback need to be finished before
			 * it can be unregistered when detaching device. So finish
			 * callback soon and use a deferred removal to detach device
			 * is need. It is a workaround, once the device detaching be
			 * moved into the eal in the future, the deferred removal could
			 * be deleted.
			 */
			rte_eal_alarm_set(1, detach_rte_cb, dev->dev_handle);
		}
		break;
	}