Commit 7f7c03a9 authored by Ben Walker's avatar Ben Walker
Browse files

env: Remove all use of RTE_LCORE_FOREACH



Replace with an env abstraction.

Change-Id: I706374d265a270890e1f3ca920a10a0dc09624b0
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
parent c80454a2
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -160,20 +160,20 @@ ioat_done(void *cb_arg)
static int
register_workers(void)
{
	unsigned lcore;
	uint32_t i;
	struct worker_thread *worker;

	g_workers = NULL;
	g_num_workers = 0;

	RTE_LCORE_FOREACH(lcore) {
	SPDK_ENV_FOREACH_CORE(i) {
		worker = calloc(1, sizeof(*worker));
		if (worker == NULL) {
			fprintf(stderr, "Unable to allocate worker\n");
			return -1;
		}

		worker->lcore = lcore;
		worker->lcore = i;
		worker->next = g_workers;
		g_workers = worker;
		g_num_workers++;
+16 −10
Original line number Diff line number Diff line
@@ -438,7 +438,7 @@ get_next_chan(void)
int
main(int argc, char **argv)
{
	unsigned lcore_id;
	uint32_t i, current_core;
	struct thread_entry threads[RTE_MAX_LCORE] = {};
	int rc;

@@ -453,23 +453,29 @@ main(int argc, char **argv)
	dump_user_config(&g_user_config);

	g_next_device = TAILQ_FIRST(&g_devices);
	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
		threads[lcore_id].chan = get_next_chan();
		rte_eal_remote_launch(work_fn, &threads[lcore_id], lcore_id);

	current_core = spdk_env_get_current_core();
	SPDK_ENV_FOREACH_CORE(i) {
		if (i != current_core) {
			threads[i].chan = get_next_chan();
			rte_eal_remote_launch(work_fn, &threads[i], i);
		}
	}

	threads[rte_get_master_lcore()].chan = get_next_chan();
	if (work_fn(&threads[rte_get_master_lcore()]) != 0) {
	threads[current_core].chan = get_next_chan();
	if (work_fn(&threads[current_core]) != 0) {
		rc = 1;
		goto cleanup;
	}

	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
		if (rte_eal_wait_lcore(lcore_id) != 0) {
	SPDK_ENV_FOREACH_CORE(i) {
		if (i != current_core) {
			if (rte_eal_wait_lcore(i) != 0) {
				rc = 1;
				goto cleanup;
			}
		}
	}

	rc = dump_result(threads, RTE_MAX_LCORE);

+3 −3
Original line number Diff line number Diff line
@@ -825,21 +825,21 @@ parse_args(int argc, char **argv)
static int
register_workers(void)
{
	unsigned lcore;
	uint32_t i;
	struct worker_thread *worker;
	enum spdk_nvme_qprio qprio = SPDK_NVME_QPRIO_URGENT;

	g_workers = NULL;
	g_arbitration.num_workers = 0;

	RTE_LCORE_FOREACH(lcore) {
	SPDK_ENV_FOREACH_CORE(i) {
		worker = calloc(1, sizeof(*worker));
		if (worker == NULL) {
			fprintf(stderr, "Unable to allocate worker\n");
			return -1;
		}

		worker->lcore = lcore;
		worker->lcore = i;
		worker->next = g_workers;
		g_workers = worker;
		g_arbitration.num_workers++;
+3 −3
Original line number Diff line number Diff line
@@ -987,20 +987,20 @@ parse_args(int argc, char **argv)
static int
register_workers(void)
{
	unsigned lcore;
	uint32_t i;
	struct worker_thread *worker;

	g_workers = NULL;
	g_num_workers = 0;

	RTE_LCORE_FOREACH(lcore) {
	SPDK_ENV_FOREACH_CORE(i) {
		worker = calloc(1, sizeof(*worker));
		if (worker == NULL) {
			fprintf(stderr, "Unable to allocate worker\n");
			return -1;
		}

		worker->lcore = lcore;
		worker->lcore = i;
		worker->next = g_workers;
		g_workers = worker;
		g_num_workers++;
+5 −0
Original line number Diff line number Diff line
@@ -182,6 +182,11 @@ uint32_t spdk_env_get_first_core(void);
 */
uint32_t spdk_env_get_next_core(uint32_t prev_core);

#define SPDK_ENV_FOREACH_CORE(i)		\
	for (i = spdk_env_get_first_core();	\
	     i < UINT32_MAX;			\
	     i = spdk_env_get_next_core(i))

/**
 * \brief Return the socket ID for the given core.
 */
Loading