[Epic-ID: ODUHIGH-464][Task-ID: ODUHIGH-483] Memeory related fix in FDD and TDD mode
[o-du/l2.git] / src / 5gnrsch / rg_sch_l2m.c
index b23df0c..d69e388 100755 (executable)
@@ -43,8 +43,6 @@
 #include "rg_sch_cmn.h"
 #include "rg_sch_inf.h"         /* typedefs for Scheduler */
 #include "rg_sch_err.h"
-#include "rl_interface.h"
-#include "rl_common.h"
 
 /* header/extern include files (.x) */
 #include "tfu.x"           /* TFU types */
 #include "rg_sch.x"        /* typedefs for Scheduler */
 #include "rg_sch_cmn.x"    /* typedefs for Scheduler */
 /* local defines */
-U32 dlPrbCnt;
+uint32_t dlPrbCnt;
 #ifdef LTE_L2_MEAS
 
-static const char* RLOG_MODULE_NAME="MAC";
-static int RLOG_MODULE_ID=4096;
-static int RLOG_FILE_ID=166;
 
-PRIVATE S16 rgSchL2mInsertMeasCb ARGS((
+static S16 rgSchL2mInsertMeasCb ARGS((
          RgSchCellCb       *cell,
          RgSchL2MeasCb     *measCb,
          LrgSchMeasReqInfo *measInfo ));
 
-PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb ARGS((
+static RgSchL2MeasCb * rgSchL2mAllocMeasCb ARGS((
          RgSchCellCb       *cell,
          LrgSchMeasReqInfo *measInfo,
          RgSchErrInfo      err));
@@ -86,26 +81,18 @@ PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb ARGS((
  * @param  [in] measTime
  * @return  Void
  */
-#ifdef ANSI
 S16 rgSchFillL2MeasCfm
 (
 RgSchCellCb       *cell,
 RgSchL2MeasCb     *measCb,
 LrgSchMeasCfmInfo *cfm,
-U32               measTime   
+uint32_t          measTime   
 )
-#else
-S16 rgSchFillL2MeasCfm(cell, measCb, cfm, measTime)
-RgSchCellCb       *cell;
-RgSchL2MeasCb     *measCb;
-LrgSchMeasCfmInfo *cfm;
-U32               measTime;
-#endif
 {
-   U8                 idx;
+   uint8_t            idx;
    LrgSchMeasReqInfo  *measInfo;
-   U8                 qciVal = 0;
-   U32                 sampOc = 0;
+   uint8_t            qciVal = 0;
+   uint32_t           sampOc = 0;
 
    measInfo = &measCb->measReq;   
 
@@ -190,8 +177,7 @@ U32               measTime;
                    cell->qciArray[qciVal].dlTotal_UeCount / sampOc;
                 cfm->numUeQciDlCfm.numActvUeQci[idx].qciValue = qciVal;
                 
-                RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
-                      "L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
+                DU_LOG("\nDEBUG  -->  SCH : L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
                       qciVal,cell->qciArray[qciVal].dlTotal_UeCount,
                       cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci);
                 
@@ -212,8 +198,7 @@ U32               measTime;
                       cell->qciArray[qciVal].dlTotal_UeCount / sampOc;
                    cfm->numUeQciDlCfm.numActvUeQci[idx].qciValue = qciVal;
 
-                   RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
-                         "L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
+                   DU_LOG("\nDEBUG  -->  SCH : L2_MEAS:CFM DL QCI %u TOTAL Count %lu Active UE %d ",
                          qciVal,cell->qciArray[qciVal].dlTotal_UeCount,
                          cfm->numUeQciDlCfm.numActvUeQci[idx].numActvUeQci);
 
@@ -244,8 +229,7 @@ U32               measTime;
                    cell->qciArray[qciVal].ulTotal_UeCount/ sampOc;
                 cfm->numUeQciUlCfm.numActvUeQci[idx].qciValue = qciVal;
                 
-                RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
-                      "L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
+                DU_LOG("\nDEBUG  -->  SCH : L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
                       qciVal,cell->qciArray[qciVal].ulTotal_UeCount,
                       cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci);
                 
@@ -265,8 +249,7 @@ U32               measTime;
                       cell->qciArray[qciVal].ulTotal_UeCount/ sampOc;
                    cfm->numUeQciUlCfm.numActvUeQci[idx].qciValue = qciVal;
 
-                   RLOG_ARG3(L_DEBUG,DBG_CELLID,cell->cellId,
-                         "L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
+                   DU_LOG("\nDEBUG  -->  SCH : L2_MEAS:CFM UL QCI %d TOTAL Count %lu Active UE %d ",
                          qciVal,cell->qciArray[qciVal].ulTotal_UeCount,
                          cfm->numUeQciUlCfm.numActvUeQci[idx].numActvUeQci);
 
@@ -317,7 +300,6 @@ U32               measTime;
  * @param  [in] Bool     isErr
  * @return  Void
  */
-#ifdef ANSI
 S16 rgSchL2mSndCfm
 (
 Pst               *pst,
@@ -325,13 +307,6 @@ RgSchL2MeasCb     *measCb,
 LrgSchMeasReqInfo *measInfo,
 Bool              isErr
 )
-#else
-S16 rgSchL2mSndCfm(pst, measCb, measInfo, isErr)
-Pst               *pst;
-RgSchL2MeasCb     *measCb;
-LrgSchMeasReqInfo *measInfo;
-Bool              isErr;
-#endif
 {
    LrgSchMeasCfmInfo   cfm;
 
@@ -361,19 +336,12 @@ Bool              isErr;
  * @param  [in] LrgSchMeasReqInfo *measInfo
  * @return  Void
  */
-#ifdef ANSI
 Void rgSchL2mFillCfmPst
 (
 Pst    *pst,
 Pst    *cfmPst,
 LrgSchMeasReqInfo *measInfo 
 )
-#else
-Void rgSchL2mFillCfmPst(pst, cfmPst, measInfo)
-Pst    *pst;
-Pst    *cfmPst;
-LrgSchMeasReqInfo *measInfo;
-#endif
 {
  
    cfmPst->srcEnt    = pst->dstEnt;
@@ -389,7 +357,7 @@ LrgSchMeasReqInfo *measInfo;
    cfmPst->region    = measInfo->hdr.response.mem.region;
    cfmPst->pool      = measInfo->hdr.response.mem.pool;
 
-   RETVOID;
+   return;
 } /* rgSchL2mFillCfmPst */
 
 /** @brief This function inserts the MeasCb in to data base
@@ -405,23 +373,16 @@ LrgSchMeasReqInfo *measInfo;
  *      -# ROK 
  *      -# RFAILED 
  */
-#ifdef ANSI
-PRIVATE S16 rgSchL2mInsertMeasCb
+static S16 rgSchL2mInsertMeasCb
 (
 RgSchCellCb       *cell,
 RgSchL2MeasCb     *measCb,
 LrgSchMeasReqInfo *measInfo
 )
-#else
-PRIVATE S16 rgSchL2mInsertMeasCb(cell, measCb, measInfo)
-RgSchCellCb       *cell;
-RgSchL2MeasCb     *measCb;
-LrgSchMeasReqInfo *measInfo;
-#endif
 {
    CmLList   *lnk, *node;
    RgSchL2MeasCb   *oldMeasCb;
-   U32              diffTime;
+   uint32_t        diffTime;
    
    /* 
     * 1. Check if l2mList has any entries.
@@ -466,20 +427,12 @@ LrgSchMeasReqInfo *measInfo;
  *
  * @param  [in] RgSchCellCb       *cell
  */
-#ifdef ANSI
-PRIVATE Void rgSchL2CalDlPrbCount
-(
-RgSchCellCb       *cell
-)
-#else
-PRIVATE Void rgSchL2CalDlPrbCount(cell)
-RgSchCellCb       *cell;
-#endif
+static Void rgSchL2CalDlPrbCount(RgSchCellCb *cell)
 {
    CmLteTimingInfo    frm;
    RgSchDlSf          *sf = NULLP;
 #ifdef LTE_TDD
-   U8                 idx;
+   uint8_t            idx;
 #endif
 
    frm   = cell->crntTime;
@@ -496,7 +449,7 @@ RgSchCellCb       *cell;
 #else
    cell->avgPrbDl.prbCount += sf->bwAssigned;
 #endif
-   RETVOID;
+   return;
 }
 
 /** @brief This function calculates the up link prb count 
@@ -508,20 +461,12 @@ RgSchCellCb       *cell;
  *
  * @param  [in] RgSchCellCb       *cell
  */
-#ifdef ANSI
-PRIVATE Void rgSchL2CalUlPrbCount
-(
-RgSchCellCb       *cell
-)
-#else
-PRIVATE Void rgSchL2CalUlPrbCount(cell)
-RgSchCellCb       *cell;
-#endif
+static Void rgSchL2CalUlPrbCount(RgSchCellCb  *cell)
 {
    RgSchUlSf        *sf = NULLP;
    RgSchCmnUlCell   *cellUl = RG_SCH_CMN_GET_UL_CELL(cell);
 #ifdef LTE_TDD
-   U8                 idx;
+   uint8_t  idx;
 #endif
 
 #ifdef LTE_TDD
@@ -535,7 +480,7 @@ RgSchCellCb       *cell;
    sf = &cellUl->ulSfArr[cellUl->schdIdx];
    cell->avgPrbUl.prbCount += sf->totPrb;
 #endif
-   RETVOID;
+   return;
 }
 /** @brief This function allocates memory from the heap
  *
@@ -548,19 +493,12 @@ RgSchCellCb       *cell;
  * @param  [out] RgSchErrInfo      *err
  * @return  RgSchL2MeasCb *
  */
-#ifdef ANSI
-PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb
+static RgSchL2MeasCb * rgSchL2mAllocMeasCb
 (
 RgSchCellCb       *cell,
 LrgSchMeasReqInfo *measInfo,
 RgSchErrInfo      err
 )
-#else
-PRIVATE RgSchL2MeasCb * rgSchL2mAllocMeasCb(cell, measInfo, err)
-RgSchCellCb       *cell;
-LrgSchMeasReqInfo *measInfo;
-RgSchErrInfo      err;
-#endif
 {
    RgSchL2MeasCb       *measCb = NULLP;
    Inst                inst = cell->instIdx;
@@ -569,8 +507,7 @@ RgSchErrInfo      err;
    if((rgSCHUtlAllocSBuf(inst, (Data **)&measCb,
                    sizeof(RgSchL2MeasCb))) == RFAILED)
    {
-      RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId,"rgSchL2mAllocMeasCb():"
-                  "Allocation of RgSchL2MeasCb failed");
+      DU_LOG("\nERROR  -->  SCH : Allocation of RgSchL2MeasCb failed");
       return (NULLP);
    }
    memcpy(&measCb->measReq, measInfo, sizeof(LrgSchMeasReqInfo));
@@ -601,23 +538,16 @@ RgSchErrInfo      err;
  *      -# ROK
  *      -# RFAILED
  **/
-#ifdef ANSI
 S16 rgSchL2mMeasReq 
 (
 RgSchCellCb       *cell,
 LrgSchMeasReqInfo *measInfo,
 RgSchErrInfo      err
 )
-#else
-S16 rgSchL2mMeasReq(cell, measInfo, err)
-RgSchCellCb       *cell;
-LrgSchMeasReqInfo *measInfo;
-RgSchErrInfo      err;
-#endif    
 {
    RgSchL2MeasCb *measCb;
-   U8            idx;
-   U8            qciVal;
+   uint8_t       idx;
+   uint8_t       qciVal;
 
 
    qciVal = 0;
@@ -625,8 +555,7 @@ RgSchErrInfo      err;
    {
        RGSCHFILLERR(err, RGSCHERR_L2M_MEASREQ,
                     RGSCHERR_SCH_ALLOC_FAILED);
-       RLOG_ARG0(L_ERROR,DBG_CELLID,cell->cellId, "rgSchL2mMeasReq():"
-                "Allocation of RgSchL2MeasCb failed");
+       DU_LOG("\nERROR  -->  SCH : Allocation of RgSchL2MeasCb failed");
        return RFAILED;
    }
    /*memcpy(&measCb->measReq, measInfo,\
@@ -696,31 +625,25 @@ RgSchErrInfo      err;
  *      -# ROK
  *      -# RFAILED
  **/
-#ifdef ANSI
 S16 rgSCHL2Meas
 (
 RgSchCellCb  *cell,
-U8 isCalrCrcInd
+uint8_t isCalrCrcInd
 )
-#else
-S16 rgschL2Meas(cell,isCalrCrcInd)
-RgSchCellCb  *cell;
-U8 isCalrCrcInd
-#endif
 {
    CmLList           *node = NULLP;
    RgSchL2MeasCb     *measCb = NULLP;
-   U8                idx;
+   uint8_t           idx;
    LrgSchMeasCfmInfo measCfm;
-   U8                qciVal = 0;
-   U32               sfDiff;
-   U32               meas;
+   uint8_t           qciVal = 0;
+   uint32_t          sfDiff;
+   uint32_t          meas;
 #ifdef LTE_TDD
-   U8                sfIdx;
+   uint8_t           sfIdx;
    Bool              isDlDataAllowed;  
-   U8                rem;
-   U32               numDlSf;
-   U32               numUlSf;
+   uint8_t           rem;
+   uint32_t          numDlSf;
+   uint32_t          numUlSf;
 #endif
 
    node = cell->l2mList.first;