Commit e8eef290 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Changpeng Liu
Browse files

vhost: add active sessions counter



Before we implement the support for multiple sessions
per device, we still need to make a few intermediate
changes that will require a counter of currently polled
sessions. So here it is.

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


Reviewed-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent bbcb35f5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1072,6 +1072,8 @@ stop_device(int vid)
	free(vsession->mem);
	spdk_vhost_free_reactor(vdev->lcore);
	vdev->lcore = -1;
	assert(vdev->active_session_num > 0);
	vdev->active_session_num--;
	pthread_mutex_unlock(&g_spdk_vhost_mutex);
}

@@ -1152,8 +1154,11 @@ start_device(int vid)
		free(vsession->mem);
		spdk_vhost_free_reactor(vdev->lcore);
		vdev->lcore = -1;
		goto out;
	}

	assert(vdev->active_session_num < UINT32_MAX);
	vdev->active_session_num++;
out:
	pthread_mutex_unlock(&g_spdk_vhost_mutex);
	return rc;
+4 −1
Original line number Diff line number Diff line
@@ -157,9 +157,12 @@ struct spdk_vhost_dev {
	uint32_t coalescing_delay_us;
	uint32_t coalescing_iops_threshold;

	/* Active connection to the device */
	/* Current connection to the device */
	struct spdk_vhost_session *session;

	/* Number of started and actively polled sessions */
	uint32_t active_session_num;

	TAILQ_ENTRY(spdk_vhost_dev) tailq;
};