Commit 435138b7 authored by Ben Walker's avatar Ben Walker
Browse files

scsi: Register all pollers to the current core



Register all pollers to the current core. If necessary, send
an event to the correct core before registering.

Change-Id: Ie34cc8b11143a58c0f621c87c409a3d09d929648
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387682


Reviewed-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent bfd55056
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -392,7 +392,7 @@ int spdk_initialize_iscsi_conns(void)
	}

	spdk_poller_register(&g_idle_conn_poller, spdk_iscsi_conn_idle_do_work, NULL,
			     rte_get_master_lcore(), 0);
			     spdk_env_get_current_core(), 0);

	return 0;
}
@@ -860,7 +860,7 @@ void spdk_shutdown_iscsi_conns(void)

	pthread_mutex_unlock(&g_conns_mutex);
	spdk_poller_register(&g_shutdown_timer, spdk_iscsi_conn_check_shutdown, NULL,
			     rte_get_master_lcore(), 1000);
			     spdk_env_get_current_core(), 1000);
}

int
+19 −2
Original line number Diff line number Diff line
@@ -235,9 +235,11 @@ spdk_scsi_lun_hotplug(void *arg)
}

static void
spdk_scsi_lun_hot_remove(void *remove_ctx)
_spdk_scsi_lun_hot_remove(void *arg1, void *arg2)
{
	struct spdk_scsi_lun *lun = (struct spdk_scsi_lun *)remove_ctx;
	struct spdk_scsi_lun *lun = arg1;

	assert(lun->lcore == spdk_env_get_current_core());

	lun->removed = true;
	if (lun->hotremove_cb) {
@@ -247,6 +249,21 @@ spdk_scsi_lun_hot_remove(void *remove_ctx)
	spdk_poller_register(&lun->hotplug_poller, spdk_scsi_lun_hotplug, lun, lun->lcore, 0);
}

static void
spdk_scsi_lun_hot_remove(void *remove_ctx)
{
	struct spdk_scsi_lun *lun = (struct spdk_scsi_lun *)remove_ctx;

	if (lun->lcore != spdk_env_get_current_core()) {
		struct spdk_event *event;

		event = spdk_event_allocate(lun->lcore, _spdk_scsi_lun_hot_remove, lun, NULL);
		spdk_event_call(event);
	} else {
		_spdk_scsi_lun_hot_remove(lun, NULL);
	}
}

/**
 * \brief Constructs a new spdk_scsi_lun object based on the provided parameters.
 *
+16 −0
Original line number Diff line number Diff line
@@ -66,6 +66,22 @@ spdk_poller_unregister(struct spdk_poller **ppoller,
{
}

struct spdk_event *
spdk_event_allocate(uint32_t lcore, spdk_event_fn fn,
		    void *arg1, void *arg2)
{
	return NULL;
}

/**
 * \brief Pass the given event to the associated lcore and call the function.
 */
void
spdk_event_call(struct spdk_event *event)
{

}

uint32_t
spdk_env_get_current_core(void)
{