Commit 23a7e4b9 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Tomasz Zawadzki
Browse files

env/pci: cleanup spdk_detach_rte by moving code

parent 9db80407
Loading
Loading
Loading
Loading
+32 −31
Original line number Diff line number Diff line
@@ -131,7 +131,11 @@ spdk_detach_rte(struct spdk_pci_device *dev)
	 * again while we go asynchronous, so we explicitly forbid that.
	 */
	dev->internal.pending_removal = true;
	if (spdk_process_is_primary() && !pthread_equal(g_dpdk_tid, pthread_self())) {
	if (!spdk_process_is_primary() || pthread_equal(g_dpdk_tid, pthread_self())) {
		spdk_detach_rte_cb(rte_dev);
		return;
	}

	rte_eal_alarm_set(1, spdk_detach_rte_cb, rte_dev);
	/* wait up to 2s for the cb to finish executing */
	for (i = 2000; i > 0; i--) {
@@ -166,9 +170,6 @@ spdk_detach_rte(struct spdk_pci_device *dev)
		/* If we reach this state, then the device couldn't be removed and most likely
		   a subsequent hot add of a device in the same BDF will fail */
	}
	} else {
		spdk_detach_rte_cb(rte_dev);
	}
}

void