vhost: dump interrupt coalescing parameters in RPC info/config
Change-Id: I7fec9a5fe30bb64f6c76fc951a40e27cf86ecdee Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-on: https://review.gerrithub.io/415461 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
20553a1a0e
commit
ca051264ae
@ -162,6 +162,18 @@ const struct spdk_cpuset *spdk_vhost_dev_get_cpumask(struct spdk_vhost_dev *vdev
|
||||
int spdk_vhost_set_coalescing(struct spdk_vhost_dev *vdev, uint32_t delay_base_us,
|
||||
uint32_t iops_threshold);
|
||||
|
||||
/**
|
||||
* Get coalescing parameters.
|
||||
*
|
||||
* \see spdk_vhost_set_coalescing
|
||||
*
|
||||
* \param vdev vhost device.
|
||||
* \param delay_base_us Optional pointer to store base delay time.
|
||||
* \param iops_threshold Optional pointer to store IOPS threshold.
|
||||
*/
|
||||
void spdk_vhost_get_coalescing(struct spdk_vhost_dev *vdev, uint32_t *delay_base_us,
|
||||
uint32_t *iops_threshold);
|
||||
|
||||
/**
|
||||
* Construct an empty vhost SCSI device. This will create a
|
||||
* Unix domain socket together with a vhost-user slave server waiting
|
||||
|
@ -338,7 +338,7 @@ spdk_vhost_set_coalescing(struct spdk_vhost_dev *vdev, uint32_t delay_base_us,
|
||||
uint32_t iops_threshold)
|
||||
{
|
||||
uint64_t delay_time_base = delay_base_us * spdk_get_ticks_hz() / 1000000ULL;
|
||||
uint32_t io_rate = iops_threshold * SPDK_VHOST_DEV_STATS_CHECK_INTERVAL_MS / 1000;
|
||||
uint32_t io_rate = iops_threshold * SPDK_VHOST_DEV_STATS_CHECK_INTERVAL_MS / 1000U;
|
||||
|
||||
if (delay_time_base >= UINT32_MAX) {
|
||||
SPDK_ERRLOG("Delay time of %"PRIu32" is to big\n", delay_base_us);
|
||||
@ -351,9 +351,25 @@ spdk_vhost_set_coalescing(struct spdk_vhost_dev *vdev, uint32_t delay_base_us,
|
||||
|
||||
vdev->coalescing_delay_time_base = delay_time_base;
|
||||
vdev->coalescing_io_rate_threshold = io_rate;
|
||||
|
||||
vdev->coalescing_delay_us = delay_base_us;
|
||||
vdev->coalescing_iops_threshold = iops_threshold;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
spdk_vhost_get_coalescing(struct spdk_vhost_dev *vdev, uint32_t *delay_base_us,
|
||||
uint32_t *iops_threshold)
|
||||
{
|
||||
if (delay_base_us) {
|
||||
*delay_base_us = vdev->coalescing_delay_us;
|
||||
}
|
||||
|
||||
if (iops_threshold) {
|
||||
*iops_threshold = vdev->coalescing_iops_threshold;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enqueue id and len to used ring.
|
||||
*/
|
||||
@ -1386,6 +1402,8 @@ static int
|
||||
spdk_vhost_config_json_cb(struct spdk_vhost_dev *vdev, void *arg)
|
||||
{
|
||||
struct spdk_vhost_write_config_json_ctx *ctx = arg;
|
||||
uint32_t delay_base_us;
|
||||
uint32_t iops_threshold;
|
||||
|
||||
if (vdev == NULL) {
|
||||
spdk_json_write_array_end(ctx->w);
|
||||
@ -1395,6 +1413,21 @@ spdk_vhost_config_json_cb(struct spdk_vhost_dev *vdev, void *arg)
|
||||
}
|
||||
|
||||
vdev->backend->write_config_json(vdev, ctx->w);
|
||||
|
||||
spdk_vhost_get_coalescing(vdev, &delay_base_us, &iops_threshold);
|
||||
if (delay_base_us) {
|
||||
spdk_json_write_object_begin(ctx->w);
|
||||
spdk_json_write_named_string(ctx->w, "method", "set_vhost_controller_coalescing");
|
||||
|
||||
spdk_json_write_named_object_begin(ctx->w, "params");
|
||||
spdk_json_write_named_string(ctx->w, "ctrlr", vdev->name);
|
||||
spdk_json_write_named_uint32(ctx->w, "delay_base_us", delay_base_us);
|
||||
spdk_json_write_named_uint32(ctx->w, "iops_threshold", iops_threshold);
|
||||
spdk_json_write_object_end(ctx->w);
|
||||
|
||||
spdk_json_write_object_end(ctx->w);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -150,6 +150,12 @@ struct spdk_vhost_dev {
|
||||
|
||||
const struct spdk_vhost_dev_backend *backend;
|
||||
|
||||
/* Saved orginal values used to setup coalescing to avoid integer
|
||||
* rounding issues during save/load config.
|
||||
*/
|
||||
uint32_t coalescing_delay_us;
|
||||
uint32_t coalescing_iops_threshold;
|
||||
|
||||
uint32_t coalescing_delay_time_base;
|
||||
|
||||
/* Threshold when event coalescing for virtqueue will be turned on. */
|
||||
|
@ -459,6 +459,8 @@ static int
|
||||
spdk_rpc_get_vhost_controllers_cb(struct spdk_vhost_dev *vdev, void *arg)
|
||||
{
|
||||
struct rpc_get_vhost_ctrlrs *ctx = arg;
|
||||
uint32_t delay_base_us, iops_threshold;
|
||||
|
||||
|
||||
if (vdev == NULL) {
|
||||
spdk_json_write_array_end(ctx->w);
|
||||
@ -467,10 +469,14 @@ spdk_rpc_get_vhost_controllers_cb(struct spdk_vhost_dev *vdev, void *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
spdk_vhost_get_coalescing(vdev, &delay_base_us, &iops_threshold);
|
||||
|
||||
spdk_json_write_object_begin(ctx->w);
|
||||
|
||||
spdk_json_write_named_string(ctx->w, "ctrlr", spdk_vhost_dev_get_name(vdev));
|
||||
spdk_json_write_named_string_fmt(ctx->w, "cpumask", "0x%s", spdk_cpuset_fmt(vdev->cpumask));
|
||||
spdk_json_write_named_uint32(ctx->w, "delay_base_us", delay_base_us);
|
||||
spdk_json_write_named_uint32(ctx->w, "iops_threshold", iops_threshold);
|
||||
|
||||
spdk_json_write_named_object_begin(ctx->w, "backend_specific");
|
||||
spdk_vhost_dump_info_json(vdev, ctx->w);
|
||||
|
Loading…
Reference in New Issue
Block a user