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: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/441734 Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
bbcb35f58b
commit
e8eef29003
@ -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;
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user