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: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387682
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Ben Walker 2017-11-14 14:02:02 -07:00
parent bfd55056b0
commit 435138b76d
3 changed files with 37 additions and 4 deletions

View File

@ -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

View File

@ -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.
*

View File

@ -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)
{