示例#1
0
int main(void){
	/* Launch all of the slave workers */

	int rc;
	rc = initSPDK();
	if (rc != 0){
		printf("Init SPDK&DPDK error \n");
		exit(1);
	}
	
	rc = initTrace();
	if (rc != 0){
		printf("Init trace file error \n");
		exit(1);
	}
	
	// Init task buffer resource
	master_fn();
	free(iotasks);
	unregister_controllers();

}
示例#2
0
文件: perf.c 项目: ninataki/spdk
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;
}
示例#3
0
文件: reset.c 项目: ceph/spdk
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;
}