int main(int argc, char **argv) { int rc; int i; rc = parse_args(argc, argv); if (rc != 0) { return rc; } rc = rte_eal_init(sizeof(ealargs) / sizeof(ealargs[0]), ealargs); if (rc < 0) { fprintf(stderr, "could not initialize dpdk\n"); return 1; } request_mempool = rte_mempool_create("nvme_request", 8192, spdk_nvme_request_size(), 128, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0); if (request_mempool == NULL) { fprintf(stderr, "could not initialize request mempool\n"); return 1; } task_pool = rte_mempool_create("task_pool", 8192, sizeof(struct reset_task), 64, 0, NULL, NULL, task_ctor, NULL, SOCKET_ID_ANY, 0); g_tsc_rate = rte_get_timer_hz(); if (register_workers() != 0) { return 1; } if (register_controllers() != 0) { return 1; } if (associate_workers_with_ns() != 0) { rc = 1; goto cleanup; } printf("Initialization complete. Launching workers.\n"); for (i = 2; i >= 0; i--) { rc = run_nvme_reset_cycle(i); if (rc != 0) { goto cleanup; } } cleanup: unregister_controllers(); if (rc != 0) { fprintf(stderr, "%s: errors occured\n", argv[0]); } return rc; }
int main(int argc, char **argv) { int rc; struct worker_thread *worker; rc = parse_args(argc, argv); if (rc != 0) { return rc; } ealargs[1] = sprintf_alloc("-c %s", g_core_mask ? g_core_mask : "0x1"); if (ealargs[1] == NULL) { perror("ealargs sprintf_alloc"); return 1; } rc = rte_eal_init(sizeof(ealargs) / sizeof(ealargs[0]), ealargs); free(ealargs[1]); if (rc < 0) { fprintf(stderr, "could not initialize dpdk\n"); return 1; } request_mempool = rte_mempool_create("nvme_request", 8192, nvme_request_size(), 128, 0, NULL, NULL, NULL, NULL, SOCKET_ID_ANY, 0); if (request_mempool == NULL) { fprintf(stderr, "could not initialize request mempool\n"); return 1; } task_pool = rte_mempool_create("task_pool", 8192, sizeof(struct perf_task), 64, 0, NULL, NULL, task_ctor, NULL, SOCKET_ID_ANY, 0); g_tsc_rate = rte_get_timer_hz(); if (register_workers() != 0) { return 1; } if (register_aio_files(argc, argv) != 0) { return 1; } if (register_controllers() != 0) { return 1; } if (associate_workers_with_ns() != 0) { return 1; } printf("Initialization complete. Launching workers.\n"); /* Launch all of the slave workers */ worker = g_workers->next; while (worker != NULL) { rte_eal_remote_launch(work_fn, worker, worker->lcore); worker = worker->next; } rc = work_fn(g_workers); worker = g_workers->next; while (worker != NULL) { if (rte_eal_wait_lcore(worker->lcore) < 0) { rc = -1; } worker = worker->next; } print_stats(); unregister_controllers(); if (rc != 0) { fprintf(stderr, "%s: errors occured\n", argv[0]); } return rc; }
int main(int argc, char **argv) { int rc; rc = parse_args(argc, argv); if (rc != 0) { return rc; } rc = rte_eal_init(sizeof(ealargs) / sizeof(ealargs[0]), ealargs); if (rc < 0) { fprintf(stderr, "could not initialize dpdk\n"); return 1; } g_task = spdk_zmalloc(sizeof(struct perf_task), 0, NULL); if (g_task == NULL) { fprintf(stderr, "g_task alloc failed\n"); exit(1); } g_task->buf = spdk_zmalloc(g_io_size_bytes, 0x1000, NULL); if (g_task->buf == NULL) { fprintf(stderr, "g_task->buf spdk_zmalloc failed\n"); exit(1); } g_tsc_rate = spdk_get_ticks_hz(); #if HAVE_LIBAIO if (g_aio_optind < argc) { printf("Measuring overhead for AIO device %s.\n", argv[g_aio_optind]); if (register_aio_file(argv[g_aio_optind]) != 0) { rc = -1; goto cleanup; } } else #endif { if (register_controllers() != 0) { rc = -1; goto cleanup; } } printf("Initialization complete. Launching workers.\n"); rc = work_fn(); print_stats(); cleanup: free(g_ns); if (g_ctrlr) { spdk_nvme_detach(g_ctrlr->ctrlr); free(g_ctrlr); } if (rc != 0) { fprintf(stderr, "%s: errors occured\n", argv[0]); } return rc; }