From bda182332784b9b021073fe8b800bee2a5a7518f Mon Sep 17 00:00:00 2001 From: "lal.harshita" Date: Thu, 15 Feb 2024 17:12:25 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-538] Thread Core configuration through XML file Change-Id: Iec9df8473e99e97791f8fe1d3313767729ac3afd Signed-off-by: lal.harshita --- build/odu/makefile | 5 ++- src/du_app/du_cfg.c | 100 +++++++++++++++++++++++++++++++++++++++++++++-- src/du_app/du_cfg.h | 8 +++- src/du_app/du_mgr_main.c | 29 ++------------ 4 files changed, 110 insertions(+), 32 deletions(-) diff --git a/build/odu/makefile b/build/odu/makefile index a1f4ffd30..efbb00033 100644 --- a/build/odu/makefile +++ b/build/odu/makefile @@ -86,8 +86,11 @@ endif ifeq ($(NODE),TEST_STUB) PLTFRM_FLAGS+=-DODU_TEST_STUB endif +ifdef PHY + PLTFRM_FLAGS+=-DTHREAD_AFFINITY +endif ifeq ($(PHY), INTEL_L1) - PLTFRM_FLAGS+=-DSS_USE_WLS_MEM -DINTEL_WLS_MEM -DDEBUG_MODE -DINTEL_L1_V20_03_ONWARDS -DINTEL_THREAD_AFFINITY + PLTFRM_FLAGS+=-DSS_USE_WLS_MEM -DINTEL_WLS_MEM -DDEBUG_MODE -DINTEL_L1_V20_03_ONWARDS ifeq ($(PHY_MODE),TIMER) PLTFRM_FLAGS+=-DINTEL_TIMER_MODE endif diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index e808132dd..dae15529f 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -5280,6 +5280,80 @@ uint8_t parseMacSliceCfgReq(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,MacSliceC } return ROK; } +#endif + +#ifdef THREAD_AFFINITY +/******************************************************************* + * + * @brief Set thread affinity to the core configured via XML file + * + * @details + * + * Function : parseThreadAffinity + * + * Functionality: Set thread affinity to the core configured + * via XML file + * + * @params[in] XML document pointer + * XML namespace + * Current node in XML + * Thread information + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t parseThreadAffinity(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ThreadInfo *threads) +{ + cur = cur -> xmlChildrenNode; + while(cur != NULL) + { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_APP_CORE")) && (cur->ns == ns)) + { + threads->duAppCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + ODU_SET_THREAD_AFFINITY(&threads->duAppSTskId, SS_AFFINITY_MODE_EXCL, threads->duAppCoreId, 0); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"EGTP_CORE")) && (cur->ns == ns)) + { + threads->egtpCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + ODU_SET_THREAD_AFFINITY(&threads->egtpSTskId, SS_AFFINITY_MODE_EXCL, threads->egtpCoreId, 0); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RLC_MAC_CORE")) && (cur->ns == ns)) + { + threads->rlcMacCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + ODU_SET_THREAD_AFFINITY(&threads->rlcMacSTskId, SS_AFFINITY_MODE_EXCL, threads->rlcMacCoreId, 0); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"RLC_UL_CORE")) && (cur->ns == ns)) + { + threads->rlcUlCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + ODU_SET_THREAD_AFFINITY(&threads->rlcUlSTskId, SS_AFFINITY_MODE_EXCL, threads->rlcUlCoreId, 0); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCH_CORE")) && (cur->ns == ns)) + { + threads->schCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + ODU_SET_THREAD_AFFINITY(&threads->schSTskId, SS_AFFINITY_MODE_EXCL, threads->schCoreId, 0); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCTP_CORE")) && (cur->ns == ns)) + { + threads->sctpCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + ODU_SET_THREAD_AFFINITY(&threads->sctpSTskId, SS_AFFINITY_MODE_EXCL, threads->sctpCoreId, 0); + } + + if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOWER_MAC_CORE")) && (cur->ns == ns)) + { + threads->lwrMacCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); + ODU_SET_THREAD_AFFINITY(&threads->lwrMacSTskId, SS_AFFINITY_MODE_EXCL, threads->lwrMacCoreId, 0); + } + + cur = cur -> next; + } + return ROK; +} +#endif /******************************************************************* * @@ -5308,10 +5382,20 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) CmInetIpAddr cuIp; CmInetIpAddr ricIp; - memset(&duCfgParam, 0, sizeof(struct duCfgParams)); cur = cur->xmlChildrenNode; while(cur != NULL) { + if ((!xmlStrcmp(cur->name, (const xmlChar *)"THREAD_AFFINITY")) && (cur->ns == ns)) + { +#ifdef THREAD_AFFINITY + if(parseThreadAffinity(doc, ns, cur, &duCfgParam.threadInfo) != ROK) + { + return RFAILED; + } +#endif + } + +#ifdef XML_BASED_CONFIG if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_DRB")) && (cur->ns == ns)) { duCfgParam.maxNumDrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); @@ -5447,12 +5531,12 @@ uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) return RFAILED; } } +#endif cur = cur -> next; } return ROK; } -#endif /******************************************************************* * @@ -5495,9 +5579,7 @@ uint8_t duReadCfg() return RFAILED; } -#ifdef XML_BASED_CONFIG parseDuCfgParams(doc, ns, cur); -#endif xmlFreeDoc(doc); xmlCleanupParser(); @@ -5645,6 +5727,16 @@ void printDuConfig() DU_LOG("\n ** DU CONFIGURATION ** \n"); DU_LOG("DU ID %d\n", duCfgParam.duId); DU_LOG("DU Name %s\n", duCfgParam.duName); + + DU_LOG("\n ** Thread Affinity ** \n"); + DU_LOG("DU APP CORE ID %d\n", duCfgParam.threadInfo.duAppCoreId); + DU_LOG("EGTP CORE ID %d\n", duCfgParam.threadInfo.egtpCoreId); + DU_LOG("SCTP CORE ID %d\n", duCfgParam.threadInfo.sctpCoreId); + DU_LOG("RLC-UL CORE ID %d\n", duCfgParam.threadInfo.rlcUlCoreId); + DU_LOG("RLC-DL and MAC CORE ID %d\n", duCfgParam.threadInfo.rlcMacCoreId); + DU_LOG("SCH CORE ID %d\n", duCfgParam.threadInfo.schCoreId); + DU_LOG("Lower MAC CORE ID %d\n", duCfgParam.threadInfo.lwrMacCoreId); + DU_LOG("MAX NUM DRB %d\n", duCfgParam.maxNumDrb); DU_LOG("MAX SUPPORTED UE %d\n", duCfgParam.maxSupportedUes); DU_LOG("MAX UE %d\n",duCfgParam.maxUe); diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index 14007fdfb..029b609a0 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -1250,13 +1250,19 @@ typedef struct sib1Params typedef struct threadInfo { SSTskId duAppSTskId; + uint8_t duAppCoreId; SSTskId egtpSTskId; + uint8_t egtpCoreId; SSTskId sctpSTskId; + uint8_t sctpCoreId; SSTskId rlcUlSTskId; + uint8_t rlcUlCoreId; SSTskId rlcMacSTskId; + uint8_t rlcMacCoreId; SSTskId schSTskId; + uint8_t schCoreId; SSTskId lwrMacSTskId; - SSTskId phyStubSlotIndSTskId; + uint8_t lwrMacCoreId; }ThreadInfo; typedef struct duCfgParams diff --git a/src/du_app/du_mgr_main.c b/src/du_app/du_mgr_main.c index 724d21b36..f7d4e2af6 100644 --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@ -573,7 +573,7 @@ uint8_t phyStubInit(SSTskId sysTskId) uint8_t commonInit() { /* Declare system task Ids */ - SSTskId du_app_stsk, egtp_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk, sch_stsk, lwr_mac_stsk, phy_stub_slot_ind_stsk; + SSTskId phyStubSlotIndSTskId; pthread_attr_t attr; @@ -587,10 +587,6 @@ uint8_t commonInit() return RFAILED; } -#ifdef INTEL_THREAD_AFFINITY - ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0); -#endif - /* system task for EGTP */ if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.egtpSTskId) != ROK) { @@ -598,10 +594,6 @@ uint8_t commonInit() return RFAILED; } -#ifdef INTEL_THREAD_AFFINITY - ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 27, 0); -#endif - /* system task for RLC_DL and MAC */ if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.rlcMacSTskId) != ROK) { @@ -610,9 +602,6 @@ uint8_t commonInit() } pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); -#ifdef INTEL_THREAD_AFFINITY - ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0); -#endif /* system task for RLC UL */ if(ODU_CREATE_TASK(PRIOR1, &duCfgParam.threadInfo.rlcUlSTskId) != ROK) @@ -620,9 +609,6 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for RLC UL failed"); return RFAILED; } -#ifdef INTEL_THREAD_AFFINITY - ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 22, 0); -#endif /* system task for SCH */ if(ODU_CREATE_TASK(PRIOR1, &duCfgParam.threadInfo.schSTskId) != ROK) @@ -630,9 +616,6 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for SCH failed"); return RFAILED; } -#ifdef INTEL_THREAD_AFFINITY - ODU_SET_THREAD_AFFINITY(&sch_stsk, SS_AFFINITY_MODE_EXCL, 22, 0); -#endif /* system task for SCTP receiver thread */ if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.sctpSTskId) != ROK) @@ -640,9 +623,6 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for SCTP failed"); return RFAILED; } -#ifdef INTEL_THREAD_AFFINITY - ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 25, 0); -#endif /* system task for lower-mac receiver thread */ if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.lwrMacSTskId) != ROK) @@ -650,13 +630,10 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for Lower MAC failed"); return RFAILED; } -#ifdef INTEL_THREAD_AFFINITY - ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0); -#endif #ifndef INTEL_WLS_MEM /* system task for phy stub's slot indication generator thread */ - if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.phyStubSlotIndSTskId) != ROK) + if(ODU_CREATE_TASK(PRIOR0, &phyStubSlotIndSTskId) != ROK) { DU_LOG("\nERROR --> DU_APP : System Task creation for Phy stub slot indication generator failed. MAX STSK [%d]", SS_MAX_STSKS); return RFAILED; @@ -708,7 +685,7 @@ uint8_t commonInit() } #ifndef INTEL_WLS_MEM - if(phyStubInit(duCfgParam.threadInfo.phyStubSlotIndSTskId) != ROK) + if(phyStubInit(phyStubSlotIndSTskId) != ROK) { DU_LOG("\nERROR --> DU_APP : PHY stub slot indication Tapa Task initialization failed"); return RFAILED; -- 2.16.6