vhost: add start_session
vhost_blk_start and vhost_scsi_start are now just a single vhost_user_session_send_event() call, so make this more generic by adding a top-level start_session function. Now this function will do the vhost_user_session_send_event(), using the user_dev_backend's start_session function pointer. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Ia89ba15011e231f0474405fb7225e713dcc920bf Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14327 Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
f8df19a49f
commit
01cec2499f
@ -919,6 +919,16 @@ new_connection(int vid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
vhost_user_session_start(struct spdk_vhost_dev *vdev, struct spdk_vhost_session *vsession)
|
||||
{
|
||||
const struct spdk_vhost_user_dev_backend *backend;
|
||||
|
||||
backend = to_user_dev(vdev)->user_backend;
|
||||
|
||||
return vhost_user_session_send_event(vsession, backend->start_session, 3, "start session");
|
||||
}
|
||||
|
||||
static int
|
||||
start_device(int vid)
|
||||
{
|
||||
@ -1040,7 +1050,7 @@ start_device(int vid)
|
||||
vhost_user_session_set_coalescing(vdev, vsession, NULL);
|
||||
vhost_session_mem_register(vsession->mem);
|
||||
vsession->initialized = true;
|
||||
rc = to_user_dev(vdev)->user_backend->start_session(vsession);
|
||||
rc = vhost_user_session_start(vdev, vsession);
|
||||
if (rc != 0) {
|
||||
vhost_session_mem_unregister(vsession->mem);
|
||||
free(vsession->mem);
|
||||
|
@ -1291,7 +1291,7 @@ alloc_task_pool(struct spdk_vhost_blk_session *bvsession)
|
||||
}
|
||||
|
||||
static int
|
||||
vhost_blk_start_cb(struct spdk_vhost_dev *vdev,
|
||||
vhost_blk_start(struct spdk_vhost_dev *vdev,
|
||||
struct spdk_vhost_session *vsession, void *unused)
|
||||
{
|
||||
struct spdk_vhost_blk_session *bvsession = to_blk_session(vsession);
|
||||
@ -1363,13 +1363,6 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
vhost_blk_start(struct spdk_vhost_session *vsession)
|
||||
{
|
||||
return vhost_user_session_send_event(vsession, vhost_blk_start_cb,
|
||||
3, "start session");
|
||||
}
|
||||
|
||||
static int
|
||||
destroy_session_poller_cb(void *arg)
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ struct spdk_vhost_user_dev_backend {
|
||||
*/
|
||||
size_t session_ctx_size;
|
||||
|
||||
int (*start_session)(struct spdk_vhost_session *vsession);
|
||||
spdk_vhost_session_fn start_session;
|
||||
int (*stop_session)(struct spdk_vhost_session *vsession);
|
||||
};
|
||||
|
||||
|
@ -112,7 +112,8 @@ struct spdk_vhost_scsi_task {
|
||||
struct spdk_vhost_virtqueue *vq;
|
||||
};
|
||||
|
||||
static int vhost_scsi_start(struct spdk_vhost_session *vsession);
|
||||
static int vhost_scsi_start(struct spdk_vhost_dev *vdev,
|
||||
struct spdk_vhost_session *vsession, void *unused);
|
||||
static int vhost_scsi_stop(struct spdk_vhost_session *vsession);
|
||||
static void vhost_scsi_dump_info_json(struct spdk_vhost_dev *vdev,
|
||||
struct spdk_json_write_ctx *w);
|
||||
@ -1351,7 +1352,7 @@ alloc_task_pool(struct spdk_vhost_scsi_session *svsession)
|
||||
}
|
||||
|
||||
static int
|
||||
vhost_scsi_start_cb(struct spdk_vhost_dev *vdev,
|
||||
vhost_scsi_start(struct spdk_vhost_dev *vdev,
|
||||
struct spdk_vhost_session *vsession, void *unused)
|
||||
{
|
||||
struct spdk_vhost_scsi_session *svsession = to_scsi_session(vsession);
|
||||
@ -1412,13 +1413,6 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
vhost_scsi_start(struct spdk_vhost_session *vsession)
|
||||
{
|
||||
return vhost_user_session_send_event(vsession, vhost_scsi_start_cb,
|
||||
3, "start session");
|
||||
}
|
||||
|
||||
static int
|
||||
destroy_session_poller_cb(void *arg)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user