for (i = 0, cpu_cpt = 0; i < cpus->nb_available_cpus; i++) {
/* be sure that we get cores on the wanted numa */
if (cpus->numacore == numa_node_of_cpu(i)) {
cpus->cpus_to_use[cpu_cpt++] = i;
ifdef DEBUG
printf(" %i", i);
endif / DEBUG /
if (cpu_cpt == cpus->nb_needed_cpus + 1) /* +1 to keep the first as fake master */
break;
} else cpus->numacores = 2;
}
ifdef DEBUG
putchar('\n');
endif / DEBUG /
if (cpu_cpt < cpus->nb_needed_cpus + 1) {
printf("Wanted %i threads on numa %i, but found only %i CPUs.\n",
cpus->nb_needed_cpus + 1, cpus->numacore, cpu_cpt);
free(cpus->cpus_to_use);
return (ENODEV);
}
return (0);
/* calculate the number of needed cpu cores */
for (i = 0; opts->pcicards[i]; i++);
cpus->nb_needed_cpus = i;
printf("-> Needed cpus: %i\n", cpus->nb_needed_cpus);
/* lookup on cores ID to use */
ret = find_cpus_to_use(opts, cpus);
if (ret)
return (ret);
/* generate coremask of selected cpu cores for dpdk init */
/* NOTES: get an extra one to not use the 0/master one. TODO: do better :) */
cpus->coremask = generate_mask(cpus, cpus->nb_needed_cpus + 1);
if (!cpus->coremask)
return (EINVAL);
return (0);
*/
include
include
include
include
include
include
include
include "main.h"
static int find_cpus_to_use(const struct cmd_opts opts, struct cpus_bindings cpus) { unsigned int i; unsigned int cpu_cpt;
ifdef DEBUG
endif / DEBUG /
ifdef DEBUG
endif / DEBUG /
ifdef DEBUG
endif / DEBUG /
}
static uint64_t generate_mask(const struct cpus_bindings* cpus, uint8_t number) { int i; uint64_t coremask;
ifdef DEBUG
endif / DEBUG /
}
int init_cpus(const struct cmd_opts opts, struct cpus_bindings cpus) { int ret; int i;
ifdef DEBUG
endif / DEBUG /
}