X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_mgr_main.c;h=a9a55ab9f87c8796eb5129f7923eb290fe108c93;hb=8660dd47a5ef27b62300fabf6b027852f1d5d026;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..a9a55ab9f 100644 --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@ -20,6 +20,8 @@ #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); @@ -28,8 +30,8 @@ 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 - +/* Global variable */ +DuCfgParams duCfgParam; /******************************************************************* * @@ -50,8 +52,8 @@ DuCfgParams ducfgparam; //global variable to hold all configs * ****************************************************************/ S16 duAppInit(SSTskId sysTskId) { - /* Register DU APP TAPA Task for DU */ - if(SRegTTsk((Ent)ENTDUAPP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, + /* Register DU APP TAPA Task for DU */ + if(SRegTTsk((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0, duActvInit, (ActvTsk)duActvTsk) != ROK) { return RFAILED; @@ -62,11 +64,48 @@ S16 duAppInit(SSTskId sysTskId) return RFAILED; } - printf("\nDU APP created and registered \ - to %d sys task\n", sysTskId); + DU_LOG("\nDU_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 + * + * ****************************************************************/ +S16 egtpInit(SSTskId sysTskId) +{ + /* Register DU APP TAPA Task for DU */ + if(SRegTTsk((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0, + egtpActvInit, (ActvTsk)egtpActvTsk) != ROK) + { + return RFAILED; + } + /* Attach DU APP TAPA Task for DU */ + if (SAttachTTsk((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK) + { + return RFAILED; + } + + DU_LOG("\nDU_APP : EGTP created and registered \ + to %d sys task", sysTskId); + return ROK; +} + + /******************************************************************* * * @brief Initializes SCTP task @@ -92,16 +131,15 @@ S16 sctpInit(SSTskId sysTskId) return RFAILED; } /* Attach SCTP TAPA Task */ - if (SAttachTTsk((Ent)ENTSCTP, (Inst)0, sysTskId)!= ROK) + if (SAttachTTsk((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK) { return RFAILED; } - printf("\nSCTP TAPA task created and registered to %d sys task\n", + DU_LOG("\nDU_APP : SCTP TAPA task created and registered to %d sys task", sysTskId); return ROK; } - /******************************************************************* * * @brief Initializes RLC DL, MAC TAPA task @@ -144,8 +182,8 @@ S16 rlcDlInit(SSTskId sysTskId) return RFAILED; } - printf("\nRLC DL and MAC TAPA task created and registered to \ - %d sys task\n", sysTskId); + DU_LOG("\nDU_APP : RLC DL and MAC TAPA task created and registered to \ + %d sys task", sysTskId); return ROK; } @@ -178,8 +216,8 @@ S16 rlcUlInit(SSTskId sysTskId) { return RFAILED; } - printf("\nRLC UL TAPA task created and registered to \ - %d sys task\n", sysTskId); + DU_LOG("\nDU_APP : RLC UL TAPA task created and registered to \ + %d sys task", sysTskId); return ROK; } @@ -207,48 +245,49 @@ S16 commonInit() pthread_attr_t attr; SSetProcId(DU_PROC); - //TODO: check regarding cores and add info here /* system task for DU APP */ SCreateSTsk(PRIOR0, &du_app_stsk); - //TODO: check core info to pin the above task to whcih core /* system task for RLC_DL and MAC */ SCreateSTsk(PRIOR0, &rlc_mac_cl_stsk); pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - //TODO: check core info to pin the above task to whcih core /* system task for RLC UL */ SCreateSTsk(PRIOR1, &rlc_ul_stsk); - //TODO: check core info to pin the above task to whcih core /* system task for SCTP receiver thread */ - SCreateSTsk(PRIOR3, &sctp_stsk); - //TODO: check core info to pin the above task to whcih core + SCreateSTsk(PRIOR0, &sctp_stsk); /* Create TAPA tasks */ if(duAppInit(du_app_stsk) != ROK) { - printf("\nDU APP TAPA Task initialization failed"); + DU_LOG("\nDU_APP : DU APP TAPA Task initialization failed"); + return RFAILED; + } + + if(egtpInit(du_app_stsk) != ROK) + { + DU_LOG("\nDU_APP : EGTP TAPA Task initialization failed"); return RFAILED; } if(sctpInit(sctp_stsk) != ROK) { - printf("\nSCTP TAPA Task initialization failed"); + DU_LOG("\nDU_APP : SCTP TAPA Task initialization failed"); return RFAILED; } if(rlcDlInit(rlc_mac_cl_stsk) != ROK) { - printf("\nRLC DL Tapa Task initialization failed"); + DU_LOG("\nDU_APP : RLC DL Tapa Task initialization failed"); return RFAILED; } if(rlcUlInit(rlc_ul_stsk) != ROK) { - printf("\nRLC UL Tapa Task initialization failed"); + DU_LOG("\nDU_APP : RLC UL Tapa Task initialization failed"); return RFAILED; } return ROK; @@ -282,6 +321,10 @@ S16 duInit() return ret; } +void init_log() +{ + openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); +} /******************************************************************* * * @brief Entry point for the DU APP @@ -301,24 +344,18 @@ S16 duInit() * ****************************************************************/ S16 tst(void) { + init_log(); - //Initialize TAPA layers - if(duInit() != ROK) - { + //Initialize TAPA layers + if(duInit() != ROK) + { return RFAILED; } + //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()*/