> > >Ankur, following changes in upstream changed the thread APIs. I have >adapted to this change in [1]. Please review ASAP - It is blocking rc1 PR.
I have reviewed the changes. The changes are fine. Thanks. > >commit 1c1abf1786a6de044bd396da4cc316961e3fd812 >Author: Thomas Monjalon <tho...@monjalon.net> >Date: Wed Sep 13 13:28:19 2023 +0200 > > lib: convert to internal control threads > > Calls to rte_ctrl_thread_create() are replaced with > rte_thread_create_internal_control(). > Other pthread-related functions are replaced with the rte_thread API. > Only pthread_cancel() has no replacement. > > Signed-off-by: Thomas Monjalon <tho...@monjalon.net> > Acked-by: Morten Brørup <m...@smartsharesystems.com> > Acked-by: Tyler Retzlaff <roret...@linux.microsoft.com> > Acked-by: Konstantin Ananyev <konstantin.v.anan...@yandex.ru > > >[1] > >diff --git a/drivers/common/cnxk/roc_npc.c >b/drivers/common/cnxk/roc_npc.c index 83c04880f2..94c8e94400 100644 >--- a/drivers/common/cnxk/roc_npc.c >+++ b/drivers/common/cnxk/roc_npc.c >@@ -1623,7 +1623,8 @@ roc_npc_flow_destroy(struct roc_npc *roc_npc, >struct roc_npc_flow *flow) > npc_delete_prio_list_entry(npc, flow); > > npc_age_flow_list_entry_delete(roc_npc, flow); >- if (roc_npc->flow_age.age_flow_refcnt == 0 && >roc_npc->flow_age.aged_flows_poll_thread) >+ if (roc_npc->flow_age.age_flow_refcnt == 0 && >+ plt_thread_is_valid(roc_npc->flow_age.aged_flows_poll_thread)) > npc_aging_ctrl_thread_destroy(roc_npc); > > done: >diff --git a/drivers/common/cnxk/roc_npc.h >b/drivers/common/cnxk/roc_npc.h index ad1c3b08cc..5a7117eae4 100644 >--- a/drivers/common/cnxk/roc_npc.h >+++ b/drivers/common/cnxk/roc_npc.h >@@ -359,7 +359,7 @@ struct roc_npc_flow_age { > uint32_t aged_flows_cnt; > uint32_t start_id; > uint32_t end_id; >- pthread_t aged_flows_poll_thread; >+ rte_thread_t aged_flows_poll_thread; > struct plt_bitmap *aged_flows; > void *age_mem; > bool aged_flows_get_thread_exit; >diff --git a/drivers/common/cnxk/roc_npc_aging.c >b/drivers/common/cnxk/roc_npc_aging.c >index 4b845954b4..74543f227b 100644 >--- a/drivers/common/cnxk/roc_npc_aging.c >+++ b/drivers/common/cnxk/roc_npc_aging.c >@@ -134,7 +134,7 @@ npc_mcam_get_hit_status(struct npc *npc, uint64_t >*mcam_ids, uint16_t start_id, > return rc; > } > >-void * >+uint32_t > npc_aged_flows_get(void *args) > { > uint64_t hit_status[MCAM_ARR_SIZE] = {0}; @@ -182,7 +182,7 @@ >npc_aged_flows_get(void *args) > rc = npc_mcam_get_hit_status(npc, mcam_ids, start_id, end_id, > hit_status, true); > if (rc) >- return NULL; >+ return 0; > > plt_seqcount_write_begin(&flow_age->seq_cnt); > flow_age->aged_flows_cnt = 0; >@@ -201,7 +201,7 @@ npc_aged_flows_get(void *args) > sleep(flow_age->aging_poll_freq); > } > >- return NULL; >+ return 0; > } > > void >@@ -276,8 +276,8 @@ npc_aging_ctrl_thread_create(struct roc_npc >*roc_npc, > > if (flow_age->age_flow_refcnt == 0) { > flow_age->aged_flows_get_thread_exit = false; >- if (plt_ctrl_thread_create(&flow_age->aged_flows_poll_thread, >- "Aged Flows Get Ctrl Thread", NULL, >+ if (plt_thread_create_control(&flow_age->aged_flows_poll_thread, >+ "Aged Flows Get Ctrl Thread", > npc_aged_flows_get, roc_npc) != 0) { > plt_err("Failed to create thread for age flows"); > errcode = NPC_ERR_ACTION_NOTSUP; >@@ -295,7 +295,7 @@ npc_aging_ctrl_thread_destroy(struct roc_npc >*roc_npc) > > flow_age = &roc_npc->flow_age; > flow_age->aged_flows_get_thread_exit = true; >- pthread_join(flow_age->aged_flows_poll_thread, NULL); >+ plt_thread_join(flow_age->aged_flows_poll_thread, NULL); > npc_aged_flows_bitmap_free(roc_npc); > } > >diff --git a/drivers/common/cnxk/roc_npc_priv.h >b/drivers/common/cnxk/roc_npc_priv.h >index 6d6cb64c65..424f8e207a 100644 >--- a/drivers/common/cnxk/roc_npc_priv.h >+++ b/drivers/common/cnxk/roc_npc_priv.h >@@ -490,7 +490,7 @@ int npc_mcam_init(struct npc *npc, struct >roc_npc_flow *flow, int mcam_id); int npc_mcam_move(struct mbox *mbox, >uint16_t old_ent, uint16_t new_ent); void >npc_age_flow_list_entry_add(struct roc_npc *npc, struct roc_npc_flow >*flow); void npc_age_flow_list_entry_delete(struct roc_npc *npc, struct >roc_npc_flow *flow); -void *npc_aged_flows_get(void *args); >+uint32_t npc_aged_flows_get(void *args); > int npc_aged_flows_bitmap_alloc(struct roc_npc *roc_npc); void >npc_aged_flows_bitmap_free(struct roc_npc *roc_npc); int >npc_aging_ctrl_thread_create(struct roc_npc *roc_npc, diff --git >a/drivers/common/cnxk/roc_platform.h >b/drivers/common/cnxk/roc_platform.h >index ad0d1624a3..1e535a527d 100644 >--- a/drivers/common/cnxk/roc_platform.h >+++ b/drivers/common/cnxk/roc_platform.h >@@ -145,6 +145,12 @@ > #define plt_thread_create_control rte_thread_create_internal_control > #define plt_thread_join rte_thread_join > >+static inline bool >+plt_thread_is_valid(rte_thread_t thr) >+{ >+ return thr.opaque_id ? true : false; >+} >+ > #define plt_intr_efd_counter_size_get rte_intr_efd_counter_size_get #define >plt_intr_efd_counter_size_set rte_intr_efd_counter_size_set #define >plt_intr_vec_list_index_get rte_intr_vec_list_index_get