[Epic-ID: ODUHIGH-538] Thread Core configuration through XML file 43/12543/2
authorlal.harshita <Harshita.Lal@radisys.com>
Thu, 15 Feb 2024 11:42:25 +0000 (17:12 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Fri, 16 Feb 2024 10:08:25 +0000 (15:38 +0530)
Change-Id: Iec9df8473e99e97791f8fe1d3313767729ac3afd
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
build/odu/makefile
src/du_app/du_cfg.c
src/du_app/du_cfg.h
src/du_app/du_mgr_main.c

index a1f4ffd..efbb000 100644 (file)
@@ -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
index e808132..dae1552 100644 (file)
@@ -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);
index 14007fd..029b609 100644 (file)
@@ -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
index 724d21b..f7d4e2a 100644 (file)
@@ -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;