diff --git a/lib/vhost/rte_vhost_user.c b/lib/vhost/rte_vhost_user.c index 7545f1cb5..6403e8dcc 100644 --- a/lib/vhost/rte_vhost_user.c +++ b/lib/vhost/rte_vhost_user.c @@ -1685,7 +1685,7 @@ vhost_user_session_set_coalescing(struct spdk_vhost_dev *vdev, } int -spdk_vhost_set_coalescing(struct spdk_vhost_dev *vdev, uint32_t delay_base_us, +vhost_user_set_coalescing(struct spdk_vhost_dev *vdev, uint32_t delay_base_us, uint32_t iops_threshold) { int rc; @@ -1696,11 +1696,12 @@ spdk_vhost_set_coalescing(struct spdk_vhost_dev *vdev, uint32_t delay_base_us, } vhost_user_dev_foreach_session(vdev, vhost_user_session_set_coalescing, NULL, NULL); + return 0; } void -spdk_vhost_get_coalescing(struct spdk_vhost_dev *vdev, uint32_t *delay_base_us, +vhost_user_get_coalescing(struct spdk_vhost_dev *vdev, uint32_t *delay_base_us, uint32_t *iops_threshold) { struct spdk_vhost_user_dev *user_dev = to_user_dev(vdev); diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index d94228aa8..9d0116cc0 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -207,6 +207,22 @@ spdk_vhost_dev_remove(struct spdk_vhost_dev *vdev) return vdev->backend->remove_device(vdev); } +int +spdk_vhost_set_coalescing(struct spdk_vhost_dev *vdev, uint32_t delay_base_us, + uint32_t iops_threshold) +{ + assert(vdev->backend->set_coalescing != NULL); + return vdev->backend->set_coalescing(vdev, delay_base_us, iops_threshold); +} + +void +spdk_vhost_get_coalescing(struct spdk_vhost_dev *vdev, uint32_t *delay_base_us, + uint32_t *iops_threshold) +{ + assert(vdev->backend->get_coalescing != NULL); + vdev->backend->get_coalescing(vdev, delay_base_us, iops_threshold); +} + void spdk_vhost_lock(void) { diff --git a/lib/vhost/vhost_blk.c b/lib/vhost/vhost_blk.c index 5e5d22ead..057f66fc6 100644 --- a/lib/vhost/vhost_blk.c +++ b/lib/vhost/vhost_blk.c @@ -1557,6 +1557,8 @@ static const struct spdk_vhost_dev_backend vhost_blk_device_backend = { .dump_info_json = vhost_blk_dump_info_json, .write_config_json = vhost_blk_write_config_json, .remove_device = vhost_blk_destroy, + .set_coalescing = vhost_user_set_coalescing, + .get_coalescing = vhost_user_get_coalescing, }; int diff --git a/lib/vhost/vhost_internal.h b/lib/vhost/vhost_internal.h index 12115eccb..afff60b2a 100644 --- a/lib/vhost/vhost_internal.h +++ b/lib/vhost/vhost_internal.h @@ -234,6 +234,10 @@ struct spdk_vhost_dev_backend { void (*dump_info_json)(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w); void (*write_config_json)(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w); int (*remove_device)(struct spdk_vhost_dev *vdev); + int (*set_coalescing)(struct spdk_vhost_dev *vdev, uint32_t delay_base_us, + uint32_t iops_threshold); + void (*get_coalescing)(struct spdk_vhost_dev *vdev, uint32_t *delay_base_us, + uint32_t *iops_threshold); }; void *vhost_gpa_to_vva(struct spdk_vhost_session *vsession, uint64_t addr, uint64_t len); @@ -501,6 +505,10 @@ int vhost_user_dev_register(struct spdk_vhost_dev *vdev, const char *name, int vhost_user_dev_unregister(struct spdk_vhost_dev *vdev); int vhost_user_init(void); void vhost_user_fini(spdk_vhost_fini_cb vhost_cb); +int vhost_user_set_coalescing(struct spdk_vhost_dev *vdev, uint32_t delay_base_us, + uint32_t iops_threshold); +void vhost_user_get_coalescing(struct spdk_vhost_dev *vdev, uint32_t *delay_base_us, + uint32_t *iops_threshold); int virtio_blk_construct_ctrlr(struct spdk_vhost_dev *vdev, const char *address, struct spdk_cpuset *cpumask, const struct spdk_json_val *params, diff --git a/lib/vhost/vhost_scsi.c b/lib/vhost/vhost_scsi.c index 79aa93474..8c2f18809 100644 --- a/lib/vhost/vhost_scsi.c +++ b/lib/vhost/vhost_scsi.c @@ -136,6 +136,8 @@ static const struct spdk_vhost_dev_backend spdk_vhost_scsi_device_backend = { .dump_info_json = vhost_scsi_dump_info_json, .write_config_json = vhost_scsi_write_config_json, .remove_device = vhost_scsi_dev_remove, + .set_coalescing = vhost_user_set_coalescing, + .get_coalescing = vhost_user_get_coalescing, }; static inline void