eal: revert prefix of lcore roles
PATCH 1/1 eal: revert prefix of lcore roles
The CI is not ready to accept changing the prefix of an enum because some warnings are raised by old versions of abidiff.
Let's revert for now and take time to update the CI labs.
Fixes c3640830470b ("eal: prefix lcore role values")
Signed-off-by Thomas Monjalon <[email protected]>
--- app/test/test_lcores.c | 2 +- app/test/test_mempool.c | 2 +- drivers/net/softnic/rte_eth_softnic_thread.c | 4 +-- lib/eal/common/eal_common_lcore.c | 34 ++++++++++---------- lib/eal/common/eal_common_options.c | 28 ++++++++-------- lib/eal/common/eal_private.h | 4 +-- lib/eal/common/rte_service.c | 12 +++---- lib/eal/include/rte_lcore.h | 17 +++------- lib/graph/graph.c | 2 +- 9 files changed, 49 insertions(+), 56 deletions(-)
app/test/test_lcores.c +1 -1
@@ -396,7 +396,7 @@ test_lcores(void)unsigned int i;for (i =0 ; i <RTE_MAX_LCORE ; i++) { -if (!rte_lcore_has_role (i,RTE_LCORE_ROLE_OFF )) +if (!rte_lcore_has_role (i,ROLE_OFF )) eal_threads_count++; }if (eal_threads_count ==0 ) {
app/test/test_mempool.c +1 -1
@@ -353,7 +353,7 @@ test_mempool_sp_sc(void) ret =-1 ; goto err; } -if (rte_eal_lcore_role (lcore_next) !=RTE_LCORE_ROLE_RTE ) { +if (rte_eal_lcore_role (lcore_next) !=ROLE_RTE ) { ret =-1 ; goto err; }
drivers/net/softnic/rte_eth_softnic_thread.c +2 -2
@@ -98,9 +98,9 @@ thread_is_valid(struct pmd_internals *softnic, uint32_t thread_id)if (thread_id ==rte_get_main_lcore ())return 0 ;/* FALSE */ -if (softnic->params.sc &&rte_lcore_has_role (thread_id,RTE_LCORE_ROLE_SERVICE )) +if (softnic->params.sc &&rte_lcore_has_role (thread_id,ROLE_SERVICE ))return 1 ;/* TRUE */ -if (!softnic->params.sc &&rte_lcore_has_role (thread_id,RTE_LCORE_ROLE_RTE )) +if (!softnic->params.sc &&rte_lcore_has_role (thread_id,ROLE_RTE ))return 1 ;/* TRUE */ return 0 ;/* FALSE */
lib/eal/common/eal_common_lcore.c +17 -17
@@ -77,7 +77,7 @@ rte_eal_lcore_role(unsigned int lcore_id)struct rte_config *cfg =rte_eal_get_configuration ();if (lcore_id >=RTE_MAX_LCORE ) -return RTE_LCORE_ROLE_OFF ; +return ROLE_OFF ;return cfg->lcore_role[lcore_id]; }
@@ -100,7 +100,7 @@ int rte_lcore_is_enabled(unsigned int lcore_id)if (lcore_id >=RTE_MAX_LCORE )return 0 ; -return cfg->lcore_role[lcore_id] ==RTE_LCORE_ROLE_RTE ; +return cfg->lcore_role[lcore_id] ==ROLE_RTE ; }RTE_EXPORT_SYMBOL (rte_get_next_lcore)
@@ -177,7 +177,7 @@ rte_eal_cpu_init(void) lcore_to_socket_id[lcore_id] = socket_id;if (eal_cpu_detected (lcore_id) ==0 ) { - config->lcore_role[lcore_id] =RTE_LCORE_ROLE_OFF ; + config->lcore_role[lcore_id] =ROLE_OFF ; lcore_config[lcore_id].core_index =-1 ;continue ; }
@@ -189,8 +189,8 @@ rte_eal_cpu_init(void)rte_bitset_set (config->core_indices, count);/* By default, each detected core is enabled */ - config->lcore_role[lcore_id] =RTE_LCORE_ROLE_RTE ; - lcore_config[lcore_id].core_role =RTE_LCORE_ROLE_RTE ; + config->lcore_role[lcore_id] =ROLE_RTE ; + lcore_config[lcore_id].core_role =ROLE_RTE ; lcore_config[lcore_id].core_id =eal_cpu_core_id (lcore_id); lcore_config[lcore_id].numa_id = socket_id; EAL_LOG(DEBUG, "Detected lcore %u as "
@@ -318,7 +318,7 @@ rte_lcore_callback_register(const char *name, rte_lcore_init_cb init,if (callback->init ==NULL ) goto no_init;for (lcore_id =0 ; lcore_id <RTE_MAX_LCORE ; lcore_id++) { -if (cfg->lcore_role[lcore_id] ==RTE_LCORE_ROLE_OFF ) +if (cfg->lcore_role[lcore_id] ==ROLE_OFF )continue ;if (callback_init (callback, lcore_id) ==0 )continue ;
@@ -326,7 +326,7 @@ rte_lcore_callback_register(const char *name, rte_lcore_init_cb init,* previous lcore. */ while (lcore_id-- !=0 ) { -if (cfg->lcore_role[lcore_id] ==RTE_LCORE_ROLE_OFF ) +if (cfg->lcore_role[lcore_id] ==ROLE_OFF )continue ;callback_uninit (callback, lcore_id); }
@@ -358,7 +358,7 @@ rte_lcore_callback_unregister(void *handle)if (callback->uninit ==NULL ) goto no_uninit;for (lcore_id =0 ; lcore_id <RTE_MAX_LCORE ; lcore_id++) { -if (cfg->lcore_role[lcore_id] ==RTE_LCORE_ROLE_OFF ) +if (cfg->lcore_role[lcore_id] ==ROLE_OFF )continue ;callback_uninit (callback, lcore_id); }
@@ -387,11 +387,11 @@ eal_lcore_non_eal_allocate(void) goto out; }for (lcore_id =0 ; lcore_id <RTE_MAX_LCORE ; lcore_id++) { -if (cfg->lcore_role[lcore_id] !=RTE_LCORE_ROLE_OFF ) +if (cfg->lcore_role[lcore_id] !=ROLE_OFF )continue ;rte_bitset_set (cfg->core_indices, core_index); lcore_config[lcore_id].core_index = core_index; - cfg->lcore_role[lcore_id] =RTE_LCORE_ROLE_NON_EAL ; + cfg->lcore_role[lcore_id] =ROLE_NON_EAL ; cfg->lcore_count++;break ; }
@@ -414,7 +414,7 @@ eal_lcore_non_eal_allocate(void) lcore_id);rte_bitset_clear (cfg->core_indices, lcore_config[lcore_id].core_index); lcore_config[lcore_id].core_index =-1 ; - cfg->lcore_role[lcore_id] =RTE_LCORE_ROLE_OFF ; + cfg->lcore_role[lcore_id] =ROLE_OFF ; cfg->lcore_count--; lcore_id =RTE_MAX_LCORE ; goto out;
@@ -431,13 +431,13 @@ eal_lcore_non_eal_release(unsigned int lcore_id)struct lcore_callback *callback;rte_rwlock_write_lock (&lcore_lock); -if (cfg->lcore_role[lcore_id] !=RTE_LCORE_ROLE_NON_EAL ) +if (cfg->lcore_role[lcore_id] !=ROLE_NON_EAL ) goto out; TAILQ_FOREACH(callback, &lcore_callbacks, next)callback_uninit (callback, lcore_id);rte_bitset_clear (cfg->core_indices, lcore_config[lcore_id].core_index); lcore_config[lcore_id].core_index =-1 ; - cfg->lcore_role[lcore_id] =RTE_LCORE_ROLE_OFF ; + cfg->lcore_role[lcore_id] =ROLE_OFF ; cfg->lcore_count--; out:rte_rwlock_write_unlock (&lcore_lock);
@@ -453,7 +453,7 @@ rte_lcore_iterate(rte_lcore_iterate_cb cb, void *arg)rte_rwlock_read_lock (&lcore_lock);for (lcore_id =0 ; lcore_id <RTE_MAX_LCORE ; lcore_id++) { -if (cfg->lcore_role[lcore_id] ==RTE_LCORE_ROLE_OFF ) +if (cfg->lcore_role[lcore_id] ==ROLE_OFF )continue ; ret =cb (lcore_id, arg);if (ret !=0 )
@@ -467,11 +467,11 @@ static const char * lcore_role_str(enum rte_lcore_role_t role) {switch (role) { -case RTE_LCORE_ROLE_RTE : +case ROLE_RTE :return "RTE" ; -case RTE_LCORE_ROLE_SERVICE : +case ROLE_SERVICE :return "SERVICE" ; -case RTE_LCORE_ROLE_NON_EAL : +case ROLE_NON_EAL :return "NON_EAL" ;default :return "UNKNOWN" ;
lib/eal/common/eal_common_options.c +14 -14
@@ -898,10 +898,10 @@ eal_parse_service_coremask(const char *coremask)return -1 ; } -if (cfg->lcore_role[idx] ==RTE_LCORE_ROLE_RTE ) +if (cfg->lcore_role[idx] ==ROLE_RTE ) taken_lcore_count++; - lcore_config[idx].core_role =RTE_LCORE_ROLE_SERVICE ; + lcore_config[idx].core_role =ROLE_SERVICE ; count++; } }
@@ -940,7 +940,7 @@ update_lcore_config(const rte_cpuset_t *cpuset, bool remap, uint16_t remap_base)/* set everything to disabled first, then set up values */ rte_bitset_clear_all (cfg->core_indices,RTE_MAX_LCORE );for (i =0 ; i <RTE_MAX_LCORE ; i++) { - cfg->lcore_role[i] =RTE_LCORE_ROLE_OFF ; + cfg->lcore_role[i] =ROLE_OFF ; lcore_config[i].core_index =-1 ; }
@@ -969,7 +969,7 @@ update_lcore_config(const rte_cpuset_t *cpuset, bool remap, uint16_t remap_base) }rte_bitset_set (cfg->core_indices, count); - cfg->lcore_role[lcore_id] =RTE_LCORE_ROLE_RTE ; + cfg->lcore_role[lcore_id] =ROLE_RTE ; lcore_config[lcore_id].core_index = count;CPU_ZERO (&lcore_config[lcore_id].cpuset);CPU_SET (i, &lcore_config[lcore_id].cpuset);
@@ -1141,12 +1141,12 @@ eal_parse_service_corelist(const char *corelist)if (min ==RTE_MAX_LCORE ) min = idx;for (idx = min; idx <= max; idx++) { -if (cfg->lcore_role[idx] !=RTE_LCORE_ROLE_SERVICE ) { -if (cfg->lcore_role[idx] ==RTE_LCORE_ROLE_RTE ) +if (cfg->lcore_role[idx] !=ROLE_SERVICE ) { +if (cfg->lcore_role[idx] ==ROLE_RTE ) taken_lcore_count++; lcore_config[idx].core_role = -RTE_LCORE_ROLE_SERVICE ; +ROLE_SERVICE ; count++; } }
@@ -1169,7 +1169,7 @@ eal_parse_service_corelist(const char *corelist)rte_cpuset_t service_cpuset;CPU_ZERO (&service_cpuset);for (i =0 ; i <RTE_MAX_LCORE ; i++) { -if (lcore_config[i].core_role ==RTE_LCORE_ROLE_SERVICE ) +if (lcore_config[i].core_role ==ROLE_SERVICE )CPU_SET (i, &service_cpuset); }if (CPU_COUNT (&service_cpuset) >0 ) {
@@ -1198,12 +1198,12 @@ eal_parse_main_lcore(const char *arg)return -1 ;/* ensure main core is not used as service core */ -if (lcore_config[cfg->main_lcore].core_role ==RTE_LCORE_ROLE_SERVICE ) { +if (lcore_config[cfg->main_lcore].core_role ==ROLE_SERVICE ) {EAL_LOG (ERR ,"Error: Main lcore is used as a service core" );return -1 ; }/* check that we have the core recorded in the core list */ -if (cfg->lcore_role[cfg->main_lcore] !=RTE_LCORE_ROLE_RTE ) { +if (cfg->lcore_role[cfg->main_lcore] !=ROLE_RTE ) {EAL_LOG (ERR ,"Error: Main lcore is not enabled for DPDK" );return -1 ; }
@@ -1393,7 +1393,7 @@ eal_parse_lcores(const char *lcores)/* Reset lcore config */ rte_bitset_clear_all (cfg->core_indices,RTE_MAX_LCORE );for (idx =0 ; idx <RTE_MAX_LCORE ; idx++) { - cfg->lcore_role[idx] =RTE_LCORE_ROLE_OFF ; + cfg->lcore_role[idx] =ROLE_OFF ; lcore_config[idx].core_index =-1 ;CPU_ZERO (&lcore_config[idx].cpuset); }
@@ -1455,10 +1455,10 @@ eal_parse_lcores(const char *lcores)continue ; set_count--; -if (cfg->lcore_role[idx] !=RTE_LCORE_ROLE_RTE ) { +if (cfg->lcore_role[idx] !=ROLE_RTE ) {rte_bitset_set (cfg->core_indices, count); lcore_config[idx].core_index = count; - cfg->lcore_role[idx] =RTE_LCORE_ROLE_RTE ; + cfg->lcore_role[idx] =ROLE_RTE ; count++; }
@@ -2437,7 +2437,7 @@ compute_ctrl_threads_cpuset(struct internal_config *internal_cfg)unsigned int lcore_id;for (lcore_id =0 ; lcore_id <RTE_MAX_LCORE ; lcore_id++) { -if (rte_lcore_has_role (lcore_id,RTE_LCORE_ROLE_OFF )) +if (rte_lcore_has_role (lcore_id,ROLE_OFF ))continue ;RTE_CPU_OR (cpuset, cpuset, &lcore_config[lcore_id].cpuset); }
lib/eal/common/eal_private.h +2 -2
@@ -433,7 +433,7 @@ uint64_t get_tsc_freq_arch(void);* Allocate a free lcore to associate to a non-EAL thread. * * @return -* - the id of a lcore with role RTE_LCORE_ROLE_NON_EAL on success. +* - the id of a lcore with role ROLE_NON_EAL on success. * - RTE_MAX_LCORE if none was available or initializing was refused (see * rte_lcore_callback_register). */
@@ -444,7 +444,7 @@ unsigned int eal_lcore_non_eal_allocate(void);* Counterpart of eal_lcore_non_eal_allocate(). * * @param lcore_id -* The lcore with role RTE_LCORE_ROLE_NON_EAL to release. +* The lcore with role ROLE_NON_EAL to release. */ void eal_lcore_non_eal_release (unsigned int lcore_id);
lib/eal/common/rte_service.c +6 -6
@@ -107,7 +107,7 @@ rte_service_init(void)int i;struct rte_config *cfg =rte_eal_get_configuration ();for (i =0 ; i <RTE_MAX_LCORE ; i++) { -if (lcore_config[i].core_role ==RTE_LCORE_ROLE_SERVICE ) { +if (lcore_config[i].core_role ==ROLE_SERVICE ) {if ((unsigned int )i == cfg->main_lcore)continue ;rte_service_lcore_add (i);
@@ -718,7 +718,7 @@ set_lcore_state(uint32_t lcore, int32_t state) lcore_config[lcore].core_role = state;/* update per-lcore optimized state tracking */ - cs->is_service_core = (state ==RTE_LCORE_ROLE_SERVICE ); + cs->is_service_core = (state ==ROLE_SERVICE );rte_eal_trace_service_lcore_state_change (lcore, state); }
@@ -734,7 +734,7 @@ rte_service_lcore_reset_all(void)if (cs->is_service_core) {rte_bitset_clear_all (cs->mapped_services,RTE_SERVICE_NUM_MAX ); -set_lcore_state (i,RTE_LCORE_ROLE_RTE ); +set_lcore_state (i,ROLE_RTE );/* runstate act as guard variable Use * store-release memory order here to synchronize * with load-acquire in runstate read functions.
@@ -761,7 +761,7 @@ rte_service_lcore_add(uint32_t lcore)if (cs->is_service_core)return -EALREADY ; -set_lcore_state (lcore,RTE_LCORE_ROLE_SERVICE ); +set_lcore_state (lcore,ROLE_SERVICE );/* ensure that after adding a core the mask and state are defaults */ rte_bitset_clear_all (cs->mapped_services,RTE_SERVICE_NUM_MAX );
@@ -793,7 +793,7 @@ rte_service_lcore_del(uint32_t lcore) RUNSTATE_STOPPED)return -EBUSY ; -set_lcore_state (lcore,RTE_LCORE_ROLE_RTE ); +set_lcore_state (lcore,ROLE_RTE );rte_smp_wmb ();return 0 ;
@@ -1126,7 +1126,7 @@ rte_service_dump(FILE *f, uint32_t id)fprintf (f,"Service Cores Summary\n" );for (i =0 ; i <RTE_MAX_LCORE ; i++) { -if (lcore_config[i].core_role !=RTE_LCORE_ROLE_SERVICE ) +if (lcore_config[i].core_role !=ROLE_SERVICE )continue ;service_dump_calls_per_lcore (f, i);
lib/eal/include/rte_lcore.h +5 -12
@@ -31,18 +31,12 @@ RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */* The lcore role (used in RTE or not). */ enum rte_lcore_role_t { -RTE_LCORE_ROLE_RTE , -RTE_LCORE_ROLE_OFF , -RTE_LCORE_ROLE_SERVICE , -RTE_LCORE_ROLE_NON_EAL , +ROLE_RTE , +ROLE_OFF , +ROLE_SERVICE , +ROLE_NON_EAL , }; -/* Old lcore role aliases for backward compatibility. */ -#define ROLE_RTE RTE_LCORE_ROLE_RTE -#define ROLE_OFF RTE_LCORE_ROLE_OFF -#define ROLE_SERVICE RTE_LCORE_ROLE_SERVICE -#define ROLE_NON_EAL RTE_LCORE_ROLE_NON_EAL -/** * Get a lcore's role. *
@@ -314,8 +308,7 @@ rte_lcore_callback_unregister(void *handle);typedef int (*rte_lcore_iterate_cb )(unsigned int lcore_id,void *arg);/** -* Iterate on all active lcores (RTE_LCORE_ROLE_RTE, RTE_LCORE_ROLE_SERVICE -* and RTE_LCORE_ROLE_NON_EAL). +* Iterate on all active lcores (ROLE_RTE, ROLE_SERVICE and ROLE_NON_EAL). * No modification on the lcore states is allowed in the callback. * * Note: as opposed to init/uninit callbacks, iteration callbacks can be
lib/graph/graph.c +1 -1
@@ -359,7 +359,7 @@ rte_graph_model_mcore_dispatch_core_bind(rte_graph_t id, int lcore) goto fail; } -if (rte_lcore_has_role (lcore,RTE_LCORE_ROLE_OFF )) +if (rte_lcore_has_role (lcore,ROLE_OFF ))SET_ERR_JMP (ENOLINK , fail,"lcore %d is invalid" , lcore);STAILQ_FOREACH (graph, &graph_list, next)
Signature · 1 line
2.54.0
21/06/2026 12:14, Thomas Monjalon:
Quoted 8 lines
The CI is not ready to accept changing the prefix of an enum because some warnings are raised by old versions of abidiff.
Let's revert for now and take time to update the CI labs.
Fixes c3640830470b ("eal: prefix lcore role values")Signed-off-by Thomas Monjalon <[email protected]>
Quickly applied to resolve CI results.