Commit 6bfff2f1 authored by Liang Yan's avatar Liang Yan Committed by Daniel Verkamp
Browse files

examples/perf: exit perf tool if no controllers found



Change-Id: Ie70236f6be40ad9598969da2a462af44763c4ac4
Signed-off-by: default avatarLiang Yan <liang.z.yan@intel.com>
Reviewed-on: https://review.gerrithub.io/379437


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent ad9a842c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ static bool g_latency_ssd_tracking_enable = false;
static int g_latency_sw_tracking_level = 0;

static struct ctrlr_entry *g_controllers = NULL;
static int g_controllers_found = 0;
static struct ns_entry *g_namespaces = NULL;
static int g_num_namespaces = 0;
static struct worker_thread *g_workers = NULL;
@@ -1202,6 +1203,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
	struct spdk_pci_device	*pci_dev;
	struct spdk_pci_id	pci_id;

	g_controllers_found++;
	if (trid->trtype != SPDK_NVME_TRANSPORT_PCIE) {
		printf("Attached to NVMe over Fabrics controller at %s:%s: %s\n",
		       trid->traddr, trid->trsvcid,
@@ -1365,6 +1367,11 @@ int main(int argc, char **argv)
		goto cleanup;
	}

	if (g_controllers_found == 0) {
		fprintf(stderr, "No NVMe controllers found.\n");
		return 0;
	}

	if (associate_workers_with_ns() != 0) {
		rc = -1;
		goto cleanup;