diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 1c8950803..05cf1684e 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -1458,18 +1458,6 @@ spdk_vhost_init(spdk_vhost_init_cb init_cb) goto out; } - ret = vhost_scsi_controller_construct(); - if (ret != 0) { - SPDK_ERRLOG("Cannot construct vhost controllers\n"); - goto out; - } - - ret = vhost_blk_controller_construct(); - if (ret != 0) { - SPDK_ERRLOG("Cannot construct vhost block controllers\n"); - goto out; - } - spdk_cpuset_zero(&g_vhost_core_mask); /* iterate threads instead of using SPDK_ENV_FOREACH_CORE to ensure that threads are really diff --git a/lib/vhost/vhost_blk.c b/lib/vhost/vhost_blk.c index eeb788012..df04eee8c 100644 --- a/lib/vhost/vhost_blk.c +++ b/lib/vhost/vhost_blk.c @@ -36,7 +36,6 @@ #include "spdk/env.h" #include "spdk/bdev.h" #include "spdk/bdev_module.h" -#include "spdk/conf.h" #include "spdk/thread.h" #include "spdk/likely.h" #include "spdk/string.h" @@ -1190,52 +1189,6 @@ static const struct spdk_vhost_dev_backend vhost_blk_device_backend = { .remove_device = vhost_blk_destroy, }; -int -vhost_blk_controller_construct(void) -{ - struct spdk_conf_section *sp; - unsigned ctrlr_num; - char *bdev_name; - char *cpumask; - char *name; - bool readonly; - bool packed_ring; - - for (sp = spdk_conf_first_section(NULL); sp != NULL; sp = spdk_conf_next_section(sp)) { - if (!spdk_conf_section_match_prefix(sp, "VhostBlk")) { - continue; - } - - if (sscanf(spdk_conf_section_get_name(sp), "VhostBlk%u", &ctrlr_num) != 1) { - SPDK_ERRLOG("Section '%s' has non-numeric suffix.\n", - spdk_conf_section_get_name(sp)); - return -1; - } - - name = spdk_conf_section_get_val(sp, "Name"); - if (name == NULL) { - SPDK_ERRLOG("VhostBlk%u: missing Name\n", ctrlr_num); - return -1; - } - - cpumask = spdk_conf_section_get_val(sp, "Cpumask"); - readonly = spdk_conf_section_get_boolval(sp, "ReadOnly", false); - packed_ring = spdk_conf_section_get_boolval(sp, "PackedRing", false); - - bdev_name = spdk_conf_section_get_val(sp, "Dev"); - if (bdev_name == NULL) { - continue; - } - - if (spdk_vhost_blk_construct(name, cpumask, bdev_name, - readonly, packed_ring) < 0) { - return -1; - } - } - - return 0; -} - int spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_name, bool readonly, bool packed_ring) diff --git a/lib/vhost/vhost_internal.h b/lib/vhost/vhost_internal.h index 9030caeed..46bfd048f 100644 --- a/lib/vhost/vhost_internal.h +++ b/lib/vhost/vhost_internal.h @@ -380,8 +380,6 @@ int vhost_dev_register(struct spdk_vhost_dev *vdev, const char *name, const char const struct spdk_vhost_dev_backend *backend); int vhost_dev_unregister(struct spdk_vhost_dev *vdev); -int vhost_scsi_controller_construct(void); -int vhost_blk_controller_construct(void); void vhost_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w); /* diff --git a/lib/vhost/vhost_scsi.c b/lib/vhost/vhost_scsi.c index 7361eb83f..632e096ea 100644 --- a/lib/vhost/vhost_scsi.c +++ b/lib/vhost/vhost_scsi.c @@ -39,7 +39,6 @@ #include "spdk/thread.h" #include "spdk/scsi.h" #include "spdk/scsi_spec.h" -#include "spdk/conf.h" #include "spdk/util.h" #include "spdk/likely.h" @@ -1295,74 +1294,6 @@ vhost_scsi_dev_param_changed(struct spdk_vhost_dev *vdev, unsigned scsi_tgt_num) return 0; } -int -vhost_scsi_controller_construct(void) -{ - struct spdk_conf_section *sp = spdk_conf_first_section(NULL); - struct spdk_vhost_dev *vdev; - int i, dev_num; - unsigned ctrlr_num = 0; - char *bdev_name, *tgt_num_str; - char *cpumask; - char *name; - char *tgt = NULL; - - while (sp != NULL) { - if (!spdk_conf_section_match_prefix(sp, "VhostScsi")) { - sp = spdk_conf_next_section(sp); - continue; - } - - if (sscanf(spdk_conf_section_get_name(sp), "VhostScsi%u", &ctrlr_num) != 1) { - SPDK_ERRLOG("Section '%s' has non-numeric suffix.\n", - spdk_conf_section_get_name(sp)); - return -1; - } - - name = spdk_conf_section_get_val(sp, "Name"); - cpumask = spdk_conf_section_get_val(sp, "Cpumask"); - - if (spdk_vhost_scsi_dev_construct(name, cpumask) < 0) { - return -1; - } - - vdev = spdk_vhost_dev_find(name); - assert(vdev); - - for (i = 0; ; i++) { - - tgt = spdk_conf_section_get_nval(sp, "Target", i); - if (tgt == NULL) { - break; - } - - tgt_num_str = spdk_conf_section_get_nmval(sp, "Target", i, 0); - if (tgt_num_str == NULL) { - SPDK_ERRLOG("%s: invalid or missing SCSI target number\n", name); - return -1; - } - - dev_num = (int)strtol(tgt_num_str, NULL, 10); - bdev_name = spdk_conf_section_get_nmval(sp, "Target", i, 1); - if (bdev_name == NULL) { - SPDK_ERRLOG("%s: invalid or missing bdev name for SCSI target %d\n", name, dev_num); - return -1; - } else if (spdk_conf_section_get_nmval(sp, "Target", i, 2)) { - SPDK_ERRLOG("%s: only one LUN per SCSI target is supported\n", name); - return -1; - } - - if (spdk_vhost_scsi_dev_add_tgt(vdev, dev_num, bdev_name) < 0) { - return -1; - } - } - - sp = spdk_conf_next_section(sp); - } - - return 0; -} - static void free_task_pool(struct spdk_vhost_scsi_session *svsession) { diff --git a/mk/spdk.lib_deps.mk b/mk/spdk.lib_deps.mk index 4184577b1..d6cf411c7 100644 --- a/mk/spdk.lib_deps.mk +++ b/mk/spdk.lib_deps.mk @@ -86,7 +86,7 @@ endif DEPDIRS-scsi := log util thread $(JSON_LIBS) trace bdev DEPDIRS-iscsi := log sock util conf thread $(JSON_LIBS) trace scsi -DEPDIRS-vhost = log util conf thread $(JSON_LIBS) bdev scsi +DEPDIRS-vhost = log util thread $(JSON_LIBS) bdev scsi # ------------------------------------------------------------------------ # Start module/ directory - This section extends the organizational pattern from