From 55fe098f9d0c51bc2a02e85e6b256dcb7cb03636 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Mon, 20 Apr 2020 04:36:35 -0400 Subject: [PATCH] vhost/nvme: fix the compliation issue with internal vhost library For the NVMe interface virtualization, we are developing the MUSER as the replacement for vhost_nvme target, before the MUSER solution be merged to SPDK, here we still maintain vhost_nvme for the coming 20.04 release. Change-Id: Ife117474330bf9e3fab1071dae2beb0f6897dff8 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1936 Community-CI: Mellanox Build Bot Reviewed-by: Paul Luse Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- lib/vhost/vhost_nvme.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/vhost/vhost_nvme.c b/lib/vhost/vhost_nvme.c index f05a51464..a472e231e 100644 --- a/lib/vhost/vhost_nvme.c +++ b/lib/vhost/vhost_nvme.c @@ -247,14 +247,22 @@ spdk_vhost_nvme_get_queue_head(struct spdk_vhost_nvme_dev *nvme, uint32_t offset return 0; } +static void * +vhost_nvme_gpa_to_vva(void *priv, uint64_t addr, uint64_t len) +{ + struct spdk_vhost_session *vsession = priv; + + return vhost_gpa_to_vva(vsession, addr, len); +} + static int spdk_vhost_nvme_map_prps(struct spdk_vhost_nvme_dev *nvme, struct spdk_nvme_cmd *cmd, struct spdk_vhost_nvme_task *task, uint32_t len) { int err; - err = spdk_nvme_map_prps(nvme->session, cmd, task->iovs, len, 4096, - vhost_gpa_to_vva); + err = spdk_nvme_map_prps(nvme->vsession, cmd, task->iovs, len, 4096, + vhost_nvme_gpa_to_vva); if (spdk_unlikely(err < 0)) { return err; } @@ -1069,7 +1077,7 @@ spdk_vhost_nvme_start(struct spdk_vhost_session *vsession) return -1; } - return vhost_session_send_event(pg, vsession, spdk_vhost_nvme_start_cb, + return vhost_session_send_event(vsession, spdk_vhost_nvme_start_cb, 3, "start session"); } @@ -1204,7 +1212,8 @@ spdk_vhost_nvme_write_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_ spdk_json_write_named_object_begin(w, "params"); spdk_json_write_named_string(w, "ctrlr", nvme->vdev.name); spdk_json_write_named_uint32(w, "io_queues", nvme->num_io_queues); - spdk_json_write_named_string(w, "cpumask", spdk_cpuset_fmt(&nvme->vdev.cpumask)); + spdk_json_write_named_string(w, "cpumask", + spdk_cpuset_fmt(spdk_thread_get_cpumask(nvme->vdev.thread))); spdk_json_write_object_end(w); spdk_json_write_object_end(w);