X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_mgr_main.c;h=13ef272372fa7a960b1de0cc1a3f93569a383e53;hb=75a90d3abafa8edf6c85aa28319f6ec93efde6b3;hp=576177db195f2b1d975c7ef9e068522a9042e779;hpb=829bbd114f1c3dc00c1da47bca0a8207c049df3f;p=o-du%2Fl2.git diff --git a/src/du_app/du_mgr_main.c b/src/du_app/du_mgr_main.c index 576177db1..13ef27237 100644 --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@ -17,19 +17,30 @@ *******************************************************************************/ /* This file is the entry point for DU APP */ - +#include "common_def.h" +#include "lrg.h" +#include "legtp.h" +#include "lrg.x" +#include "lkw.x" +#include "du_app_mac_inf.h" +#include "du_app_rlc_inf.h" +#include "du_cfg.h" +#include "du_mgr.h" #include "du_mgr_main.h" #include "du_sctp.h" +#include "du_egtp.h" -extern S16 kwUlActvTsk (Pst *, Buffer *); -extern S16 kwUlActvInit (Ent, Inst, Region, Reason); -extern S16 kwDlActvTsk (Pst *, Buffer *); -extern S16 kwDlActvInit (Ent, Inst, Region, Reason); -extern S16 rgActvTsk (Pst *, Buffer *); -extern S16 rgActvInit (Ent, Inst, Region, Reason); - -DuCfgParams ducfgparam; //global variable to hold all configs +uint8_t rlcUlActvTsk (Pst *, Buffer *); +uint8_t rlcUlActvInit (Ent, Inst, Region, Reason); +uint8_t rlcDlActvTsk (Pst *, Buffer *); +uint8_t rlcDlActvInit (Ent, Inst, Region, Reason); +uint8_t rgActvTsk (Pst *, Buffer *); +uint8_t rgActvInit (Ent, Inst, Region, Reason); +uint8_t lwrMacActvTsk(Pst *, Buffer *); +uint8_t lwrMacActvInit(Ent, Inst, Region, Reason); +/* Global variable */ +DuCfgParams duCfgParam; /******************************************************************* * @@ -48,25 +59,62 @@ DuCfgParams ducfgparam; //global variable to hold all configs * RFAILED - failure * * ****************************************************************/ -S16 duAppInit(SSTskId sysTskId) +uint8_t duAppInit(SSTskId sysTskId) { /* Register DU APP TAPA Task for DU */ - if(SRegTTsk((Ent)ENTDUAPP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, - duActvInit, (ActvTsk)duActvTsk) != ROK) + if(ODU_REG_TTSK((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0, + duActvInit, (ActvTsk)duActvTsk) != ROK) { return RFAILED; } /* Attach DU APP TAPA Task for DU */ - if (SAttachTTsk((Ent)ENTDUAPP, (Inst)0, sysTskId)!= ROK) + if (ODU_ATTACH_TTSK((Ent)ENTDUAPP, (Inst)0, sysTskId)!= ROK) { return RFAILED; } - printf("\nDU APP created and registered \ - to %d sys task\n", sysTskId); + DU_LOG("\nINFO --> DU_APP : DU APP created and registered \ + to %d sys task", sysTskId); return ROK; } +/******************************************************************* + * + * @brief Initializes EGTP + * + * @details + * + * Function : egtpInit + * + * Functionality: + * - Registers and attaches TAPA tasks belonging to + * DU_APP sys task + * + * @params[in] system task ID + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t egtpInit(SSTskId sysTskId) +{ + /* Register DU APP TAPA Task for DU */ + if(ODU_REG_TTSK((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0, + egtpActvInit, (ActvTsk)egtpActvTsk) != ROK) + { + return RFAILED; + } + /* Attach DU APP TAPA Task for DU */ + if (ODU_ATTACH_TTSK((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK) + { + return RFAILED; + } + + DU_LOG("\nINFO --> DU_APP : EGTP created and registered \ + to %d sys task", sysTskId); + return ROK; +} + + /******************************************************************* * * @brief Initializes SCTP task @@ -83,25 +131,24 @@ S16 duAppInit(SSTskId sysTskId) * RFAILED - failure * * ****************************************************************/ -S16 sctpInit(SSTskId sysTskId) +uint8_t sctpInit(SSTskId sysTskId) { /* Register SCTP TAPA Task */ - if(SRegTTsk((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, + if(ODU_REG_TTSK((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, sctpActvInit, (ActvTsk)sctpActvTsk) != ROK) { return RFAILED; } /* Attach SCTP TAPA Task */ - if (SAttachTTsk((Ent)ENTSCTP, (Inst)0, sysTskId)!= ROK) + if (ODU_ATTACH_TTSK((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK) { return RFAILED; } - printf("\nSCTP TAPA task created and registered to %d sys task\n", + DU_LOG("\nINFO --> DU_APP : SCTP TAPA task created and registered to %d sys task", sysTskId); return ROK; } - /******************************************************************* * * @brief Initializes RLC DL, MAC TAPA task @@ -118,34 +165,34 @@ S16 sctpInit(SSTskId sysTskId) * RFAILED - failure * * ****************************************************************/ -S16 rlcDlInit(SSTskId sysTskId) +uint8_t rlcDlInit(SSTskId sysTskId) { /* Register RLC DL TAPA Task */ - if(SRegTTsk((Ent)ENTKW, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0, - kwDlActvInit, (ActvTsk)kwDlActvTsk) != ROK) + if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0, + rlcDlActvInit, (ActvTsk)rlcDlActvTsk) != ROK) { return RFAILED; } /* Attach RLC DL Task */ - if (SAttachTTsk((Ent)ENTKW, (Inst)1, sysTskId)!= ROK) + if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)1, sysTskId)!= ROK) { return RFAILED; } /* Register MAC TAPA Task */ - if(SRegTTsk((Ent)ENTRG, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, + if(ODU_REG_TTSK((Ent)ENTMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, rgActvInit, (ActvTsk)rgActvTsk) != ROK) { return RFAILED; } /* Attach MAC Task */ - if (SAttachTTsk((Ent)ENTRG, (Inst)0, sysTskId)!= ROK) + if (ODU_ATTACH_TTSK((Ent)ENTMAC, (Inst)0, sysTskId)!= ROK) { return RFAILED; } - printf("\nRLC DL and MAC TAPA task created and registered to \ - %d sys task\n", sysTskId); + DU_LOG("\nINFO --> DU_APP : RLC DL and MAC TAPA task created and registered to \ + %d sys task", sysTskId); return ROK; } @@ -165,21 +212,56 @@ S16 rlcDlInit(SSTskId sysTskId) * RFAILED - failure * * ****************************************************************/ -S16 rlcUlInit(SSTskId sysTskId) +uint8_t rlcUlInit(SSTskId sysTskId) { /* Register RLC UL TAPA Task */ - if(SRegTTsk((Ent)ENTKW, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, - kwUlActvInit, (ActvTsk)kwUlActvTsk) != ROK) + if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, + rlcUlActvInit, (ActvTsk)rlcUlActvTsk) != ROK) { return RFAILED; } /* Attach RLC DL Task */ - if (SAttachTTsk((Ent)ENTKW, (Inst)0, sysTskId)!= ROK) + if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)0, sysTskId)!= ROK) { return RFAILED; } - printf("\nRLC UL TAPA task created and registered to \ - %d sys task\n", sysTskId); + DU_LOG("\nINFO --> DU_APP : RLC UL TAPA task created and registered to \ + %d sys task", sysTskId); + return ROK; +} + +/******************************************************************* + * + * @brief Initializes Lower MAC receiver task + * + * @details + * + * Function : lwrMacInit + * + * Functionality: + * - Registers and attaches TAPA tasks for Lower MAC receiver + * + * @params[in] system task ID + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t lwrMacInit(SSTskId sysTskId) +{ + /* Register SCTP TAPA Task */ + if(ODU_REG_TTSK((Ent)ENTLWRMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, + lwrMacActvInit, (ActvTsk)lwrMacActvTsk) != ROK) + { + return RFAILED; + } + /* Attach SCTP TAPA Task */ + if (ODU_ATTACH_TTSK((Ent)ENTLWRMAC, (Inst)0, sysTskId)!= ROK) + { + return RFAILED; + } + + DU_LOG("\nINFO --> DU_APP : LWR MAC TAPA task created and registered to %d sys task", + sysTskId); return ROK; } @@ -199,58 +281,102 @@ S16 rlcUlInit(SSTskId sysTskId) * RFAILED - failure * * ****************************************************************/ -S16 commonInit() +uint8_t commonInit() { /* Declare system task Ids */ - SSTskId du_app_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk; + SSTskId du_app_stsk, egtp_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk, lwr_mac_stsk; pthread_attr_t attr; - SSetProcId(DU_PROC); - //TODO: check regarding cores and add info here + ODU_SET_PROC_ID(DU_PROC); /* system task for DU APP */ - SCreateSTsk(PRIOR0, &du_app_stsk); - //TODO: check core info to pin the above task to whcih core + if(ODU_CREATE_TASK(PRIOR0, &du_app_stsk) != ROK) + { + DU_LOG("\nERROR --> DU_APP : System Task creation for DU APP failed"); + return RFAILED; + } + ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 15, 0); + + /* system task for EGTP */ + if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK) + { + DU_LOG("\nERROR --> DU_APP : System Task creation for EGTP failed"); + return RFAILED; + } + ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 16, 0); /* system task for RLC_DL and MAC */ - SCreateSTsk(PRIOR0, &rlc_mac_cl_stsk); + if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK) + { + DU_LOG("\nERROR --> DU_APP : System Task creation for RLC DL/MAC failed"); + return RFAILED; + } pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - //TODO: check core info to pin the above task to whcih core + ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 17, 0); /* system task for RLC UL */ - SCreateSTsk(PRIOR1, &rlc_ul_stsk); - //TODO: check core info to pin the above task to whcih core + if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK) + { + DU_LOG("\nERROR --> DU_APP : System Task creation for RLC UL failed"); + return RFAILED; + } + ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 18, 0); /* system task for SCTP receiver thread */ - SCreateSTsk(PRIOR3, &sctp_stsk); - //TODO: check core info to pin the above task to whcih core + if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK) + { + DU_LOG("\nERROR --> DU_APP : System Task creation for SCTP failed"); + return RFAILED; + } + ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 19, 0); + + /* system task for lower-mac receiver thread */ + if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK) + { + DU_LOG("\nERROR --> DU_APP : System Task creation for Lower MAC failed"); + return RFAILED; + } + ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 20, 0); /* Create TAPA tasks */ if(duAppInit(du_app_stsk) != ROK) { - printf("\nDU APP TAPA Task initialization failed"); + DU_LOG("\nERROR --> DU_APP : DU APP TAPA Task initialization failed"); + return RFAILED; + } + + if(egtpInit(egtp_stsk) != ROK) + { + DU_LOG("\nERROR --> DU_APP : EGTP TAPA Task initialization failed"); return RFAILED; } if(sctpInit(sctp_stsk) != ROK) { - printf("\nSCTP TAPA Task initialization failed"); + DU_LOG("\nERROR --> DU_APP : SCTP TAPA Task initialization failed"); return RFAILED; } if(rlcDlInit(rlc_mac_cl_stsk) != ROK) { - printf("\nRLC DL Tapa Task initialization failed"); + DU_LOG("\nERROR --> DU_APP : RLC DL Tapa Task initialization failed"); return RFAILED; } if(rlcUlInit(rlc_ul_stsk) != ROK) { - printf("\nRLC UL Tapa Task initialization failed"); + DU_LOG("\nERROR --> DU_APP : RLC UL Tapa Task initialization failed"); return RFAILED; } + + if(lwrMacInit(lwr_mac_stsk) != ROK) + { + DU_LOG("\nERROR --> DU_APP : Lower MAC Tapa Task initialization failed"); + return RFAILED; + } + return ROK; } @@ -271,17 +397,21 @@ S16 commonInit() * RFAILED - failure * * ****************************************************************/ -S16 duInit() +uint8_t duInit() { int ret = ROK; if(commonInit() != ROK) { ret = RFAILED; } - return ret; } +void init_log() +{ + openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); +} + /******************************************************************* * * @brief Entry point for the DU APP @@ -299,8 +429,9 @@ S16 duInit() * RFAILED - failure * * ****************************************************************/ -S16 tst(void) +uint8_t tst(void) { + init_log(); //Initialize TAPA layers if(duInit() != ROK) @@ -311,14 +442,6 @@ S16 tst(void) //Read all the configs from du_utils.c into duCfgParams duReadCfg(); -#if 0 - //Establish SCTP connection - while(ret == -1) - { - printf("\nEstablishing SCTP link with CU... \n"); - //ret = establishSctp(); //To be implemeted in du_sctp.c - } -#endif return ROK; }/* end of main()*/