Commit 1234a3e5 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

vhost: set lcore from the DPDK thread



Now that sessions have a separate flag to check if the
pollers are started, we can set the lcore field on any
thread we want. We currently assign it from within the
session thread to spdk_env_get_current_core(), but we
won't be able to use an equivalent get_current_poll_group()
function after we switch to poll groups. We will only
have a poll group object inside spdk_vhost_session_send_event(),
so that's where we move the lcore assignment for now.

Change-Id: Ib5fb37ec488de80e9d79432120c81500c297b608
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452395


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 376d893a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -898,7 +898,6 @@ void
spdk_vhost_session_start_done(struct spdk_vhost_session *vsession, int response)
{
	if (response == 0) {
		vsession->lcore = spdk_env_get_current_core();
		vsession->started = true;
		assert(vsession->vdev->active_session_num < UINT32_MAX);
		vsession->vdev->active_session_num++;
@@ -910,7 +909,6 @@ void
spdk_vhost_session_stop_done(struct spdk_vhost_session *vsession, int response)
{
	if (response == 0) {
		vsession->lcore = -1;
		vsession->started = false;
		assert(vsession->vdev->active_session_num > 0);
		vsession->vdev->active_session_num--;
@@ -1012,6 +1010,7 @@ spdk_vhost_session_send_event(int32_t lcore, struct spdk_vhost_session *vsession
	ev_ctx.vsession_id = vsession->id;
	ev_ctx.cb_fn = cb_fn;

	vsession->lcore = lcore;
	vsession->event_ctx = &ev_ctx;
	ev = spdk_event_allocate(lcore, spdk_vhost_event_cb, &ev_ctx, NULL);
	assert(ev);