On Tue, Apr 2, 2019 at 10:54 PM Stephen Hemminger < step...@networkplumber.org> wrote:
> C language does not really treat enum's as first class symbols. > The values in an enum live in a global namespace. That means if > DPDK defines "RUNNING" it can't be used by another enum in an > application using DPDK. > > To solve this add a prefix "RTE_LCORE_" to the enum values, and > make them grammatically consistent. > > Also, simplify the inline thread_is_running() which is copied > in softnic and ip_pipeline. > > Signed-off-by: Stephen Hemminger <step...@networkplumber.org> > --- > v3 - fix BSD and bond driver usage of state > > > > diff --git a/examples/bond/main.c b/examples/bond/main.c > index ef86194fff4a..12123a4b16d8 100644 > --- a/examples/bond/main.c > +++ b/examples/bond/main.c > @@ -527,7 +527,7 @@ static void cmd_start_parsed(__attribute__((unused)) > void *parsed_result, > > rte_spinlock_trylock(&global_flag_stru_p->lock); > if (global_flag_stru_p->LcoreMainIsRunning == 0) { > - if (lcore_config[global_flag_stru_p->LcoreMainCore].state > != WAIT) { > + if (lcore_config[global_flag_stru_p->LcoreMainCore].state > != RTE_LCORE_WAIT) { > rte_spinlock_unlock(&global_flag_stru_p->lock); > return; > } > @@ -796,7 +796,7 @@ main(int argc, char *argv[]) > > /* check state of lcores */ > RTE_LCORE_FOREACH_SLAVE(slave_core_id) { > - if (lcore_config[slave_core_id].state != WAIT) > + if (lcore_config[slave_core_id].state != RTE_LCORE_WAIT) > return -EBUSY; > } > /* start lcore main on core != master_core - ARP response thread */ > diff --git a/lib/librte_eal/freebsd/eal/eal.c > b/lib/librte_eal/freebsd/eal/eal.c > index 790c6afa7050..aae4243486bd 100644 > --- a/lib/librte_eal/freebsd/eal/eal.c > +++ b/lib/librte_eal/freebsd/eal/eal.c > @@ -784,7 +784,7 @@ rte_eal_init(int argc, char **argv) > if (pipe(lcore_config[i].pipe_slave2master) < 0) > rte_panic("Cannot create pipe\n"); > > - lcore_config[i].state = WAIT; > + lcore_config[i].state = RTE_LCORE_WAIT; > > /* create a thread for each lcore */ > ret = pthread_create(&lcore_config[i].thread_id, NULL, > s/RTE_LCORE_WAIT/RTE_LCORE_WAITING/g -- David Marchand