Revert "[Epic-ID: ODUHIGH-462][Task-ID: ODUHIGH-472] Implementation of drx timer"
[o-du/l2.git] / src / 5gnrmac / rg_utl.c
index 87fe3e5..fbc659e 100755 (executable)
@@ -32,9 +32,6 @@
 @brief This file implements utility functions for LTE MAC
 */
 
-static const char* RLOG_MODULE_NAME="MAC";
-static int RLOG_MODULE_ID=4096;
-static int RLOG_FILE_ID=179;
 
 /* header include files (.h) */
 #include "common_def.h"
@@ -44,6 +41,7 @@ static int RLOG_FILE_ID=179;
 #include "tfu.h"           /* TFU Interface defines */
 #include "rg_sch_inf.h"    /* RGR Interface defines */
 #include "lrg.h"           /* LRG Interface defines */
+#include  "mac_utils.h"
 
 #include "rg_prg.h"        /* PRG(MAC-MAC) Interface includes */
 #include "rg.h"            /* MAC defines */
@@ -70,13 +68,13 @@ static int RLOG_FILE_ID=179;
 /* local externs */
  
 /* forward references */
-PRIVATE S16 rgUtlHndlCrntiChng ARGS((
+static S16 rgUtlHndlCrntiChng ARGS((
          Inst            inst,
          RgCellCb        *cell,
          CmLteRnti       rnti,
          CmLteRnti       newRnti
          ));
-PRIVATE Void rgUtlHndlCrntiRls ARGS((
+static Void rgUtlHndlCrntiRls ARGS((
          RgCellCb        *cell,
          RgInfRlsRnti    *rlsRnti
          ));
@@ -87,7 +85,7 @@ S16 rgDelUeFrmAllSCell ARGS((
          ));
 
 #ifdef LTE_ADV
-PRIVATE S16 rgUtlSndCrntiChngReq2AllSMacs ARGS((
+static S16 rgUtlSndCrntiChngReq2AllSMacs ARGS((
          RgCellCb        *cell,
          CmLteRnti       rnti,
          CmLteRnti       newRnti
@@ -112,19 +110,12 @@ PRIVATE S16 rgUtlSndCrntiChngReq2AllSMacs ARGS((
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
 S16 rgAllocShrablSBuf
 (
 Inst    inst,
 Data    **pData,            /* Pointer of the data to be returned */
 Size    size                /* size */
 )
-#else
-S16 rgAllocShrablSBuf(inst,pData, size)
-Inst    inst;
-Data    **pData;            /* Pointer of the data to be returned */
-Size    size;               /* size */
-#endif
 {
    RgUstaDgn dgn;      /* Alarm diagnostics structure */
 
@@ -137,7 +128,8 @@ Size    size;               /* size */
    }
 
    /* allocate buffer */
-   if (SGetStaticBuffer(rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, pData, size, 0) != ROK)
+   MAC_ALLOC_SHRABL_BUF(pData, size);
+   if(pData == NULLP)
    {
      dgn.type = LRG_USTA_DGNVAL_MEM;
      dgn.u.mem.region = rgCb[inst].rgInit.region;
@@ -145,16 +137,16 @@ Size    size;               /* size */
      /*  Send an alarm to Layer Manager */
      rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_SMEM_ALLOC_FAIL,
                                        LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
-      RGLOGERROR(inst,ERRCLS_DEBUG, ERG028, 0, "Unable to Allocate Buffer");
+      DU_LOG("\nERROR  -->  MAC : Unable to Allocate Buffer");
       return RFAILED;
    }
 
 #ifndef ALIGN_64BIT
-   RGDBGINFO(inst,(rgPBuf(inst), "SGetSBuf(Region (%d), Pool (%d), Size (%ld)), Data (0x%p))\n",
-             rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, size, *pData));
+   DU_LOG("\nDEBUG  -->  MAC : MAC_ALLOC(Region (%d), Pool (%d), Size (%ld)), Data (0x%p))\n",
+             rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, size, *pData);
 #else
-   RGDBGINFO(inst,(rgPBuf(inst), "SGetSBuf(Region (%d), Pool (%d), Size (%d)), Data (0x%p))\n",
-             rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, size, *pData));
+   DU_LOG("\nDEBUG  -->  MAC : MAC_ALLOC(Region (%d), Pool (%d), Size (%d)), Data (0x%p))\n",
+             rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, size, *pData);
 #endif
 
    /* zero out the allocated memory */
@@ -182,19 +174,12 @@ Size    size;               /* size */
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
 S16 rgAllocSBuf
 (
 Inst    inst,
 Data    **pData,            /* Pointer of the data to be returned */
 Size    size                /* size */
 )
-#else
-S16 rgAllocSBuf(inst,pData, size)
-Inst    inst;
-Data    **pData;            /* Pointer of the data to be returned */
-Size    size;               /* size */
-#endif
 {
    RgUstaDgn dgn;      /* Alarm diagnostics structure */
 
@@ -210,7 +195,8 @@ Size    size;               /* size */
 #ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
    MS_BUF_ADD_ALLOC_CALLER();
 #endif /* */
-   if (SGetSBuf(rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, pData, size) != ROK)
+   MAC_ALLOC(pData, size);
+   if(pData == NULLP)
    {
      dgn.type = LRG_USTA_DGNVAL_MEM;
      dgn.u.mem.region = rgCb[inst].rgInit.region;
@@ -218,7 +204,7 @@ Size    size;               /* size */
      /*  Send an alarm to Layer Manager */
      rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_SMEM_ALLOC_FAIL,
                                        LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
-      RGLOGERROR(inst,ERRCLS_DEBUG, ERG028, 0, "Unable to Allocate Buffer");
+      DU_LOG("\nERROR  -->  MAC : Unable to Allocate Buffer");
       return RFAILED;
    }
 
@@ -237,7 +223,7 @@ Size    size;               /* size */
 *              previously allocated by rgAllocSBuf() and size. It 
 *              deallocates the memory. 
 *
-*       Ret:   RETVOID
+*       Ret:   void
 *
 *       Notes: ccpu00117052 - MOD- changed the Data parameter from 
 *                             pointer to address of pointer so that
@@ -245,39 +231,30 @@ Size    size;               /* size */
 *
 *       File:  rg_utl.c
 */
-#ifdef ANSI
 Void rgFreeSharableSBuf
 (
 Inst inst,
 Data **data,         /* address of pointer to data */
 Size size            /* size */
 )
-#else
-Void rgFreeSharableSBuf(inst,data, size)
-Inst inst;
-Data **data;         /* address of pointer to data */
-Size size;          /* size */
-#endif
 {
 
-   S16 ret;
-
    if ((data == NULLP) || (*data == NULLP) || (size == 0))
    {
-      RETVOID;
+      return;
    }
 
    /* Deallocate buffer */
-   ret = SPutStaticBuffer(rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, *data, size, SS_SHARABLE_MEMORY);
-
-   if (ret != ROK)
+   MAC_FREE_SHRABL_BUF(rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, *data, size);
+   
+   if (data != NULLP)
    {
-      RETVOID;
+      return;
    }
 
    *data = NULLP;
 
-   RETVOID;
+   return;
 
 } /* end of rgFreeSharableBuf */
 
@@ -291,7 +268,7 @@ Size size;          /* size */
 *              previously allocated by rgAllocSBuf() and size. It 
 *              deallocates the memory. 
 *
-*       Ret:   RETVOID
+*       Ret:   void
 *
 *       Notes: ccpu00117052 - MOD- changed the Data parameter from 
 *                             pointer to address of pointer so that
@@ -299,26 +276,17 @@ Size size;          /* size */
 *
 *       File:  rg_utl.c
 */
-#ifdef ANSI
 Void rgFreeSBuf
 (
 Inst inst,
 Data **data,         /* address of pointer to data */
 Size size            /* size */
 )
-#else
-Void rgFreeSBuf(inst,data, size)
-Inst  inst;
-Data **data;         /* address of pointer to data */
-Size size;          /* size */
-#endif
 {
 
-   S16 ret;
-
    if ((data == NULLP) || (*data == NULLP) || (size == 0))
    {
-      RETVOID;
+      return;
    }
 
 
@@ -326,17 +294,17 @@ Size size;          /* size */
    MS_BUF_ADD_CALLER();
 #endif /* */
    /* Deallocate buffer */
-   ret = SPutSBuf(rgCb[inst].rgInit.region, rgCb[inst].rgInit.pool, *data, size);
+   MAC_FREE(data, size);
 
-   if (ret != ROK)
+   if (data != NULLP)
    {
-      RGLOGERROR(inst,ERRCLS_DEBUG, ERG029, (ErrVal) 0, "rgFreeSBuf failed.\n");
-      RETVOID;
+      DU_LOG("\nERROR  -->  MAC : rgFreeSBuf failed.\n");
+      return;
    }
 
    *data = NULLP;
 
-   RETVOID;
+   return;
 
 } /* end of rgFreeSBuf */
 
@@ -357,24 +325,18 @@ Size size;          /* size */
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
 S16 rgGetMsg
 (
 Inst    inst,
 Buffer  **mBuf            /* Message Buffer pointer be returned */
 )
-#else
-S16 rgGetMsg(inst,mBuf)
-Inst    inst;
-Buffer  **mBuf;           /* Message Buffer pointer be returned */
-#endif
 {
    S16         ret;
 
 #ifdef MS_MBUF_CORRUPTION /* Should be enabled when debugging mbuf corruption */
    MS_BUF_ADD_ALLOC_CALLER();
 #endif /* */
-   ret = SGetMsg(RG_GET_MEM_REGION(rgCb[inst]), RG_GET_MEM_POOL(rgCb[inst]), mBuf);
+   ret = ODU_GET_MSG_BUF(RG_GET_MEM_REGION(rgCb[inst]), RG_GET_MEM_POOL(rgCb[inst]), mBuf);
 
    if (ROK != ret) 
    {
@@ -386,7 +348,7 @@ Buffer  **mBuf;           /* Message Buffer pointer be returned */
       /*  Send an alarm to Layer Manager */
       rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
                                        LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
-      RGLOGERROR(inst,ERRCLS_DEBUG, ERG030, 0, "Unable to Allocate Buffer");
+      DU_LOG("\nERROR  -->  MAC : Unable to Allocate Buffer");
       return RFAILED;
    }
 
@@ -408,25 +370,18 @@ Buffer  **mBuf;           /* Message Buffer pointer be returned */
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
 Void rgFillDgnParams
 (
 Inst        inst,
 RgUstaDgn   *dgn,
-U8          dgnType
+uint8_t     dgnType
 )
-#else
-Void rgFillDgnParams(inst,dgn, dgnType)
-Inst        inst;
-RgUstaDgn   *dgn;
-U8          dgnType;
-#endif
 {
 
    switch(dgnType)
    {
       case LRG_USTA_DGNVAL_MEM:
-         dgn->type = (U8) LRG_USTA_DGNVAL_MEM;
+         dgn->type = (uint8_t) LRG_USTA_DGNVAL_MEM;
          dgn->u.mem.region  = rgCb[inst].rgInit.region;
          dgn->u.mem.pool    = rgCb[inst].rgInit.pool;
       break;
@@ -435,7 +390,7 @@ U8          dgnType;
       break;
    }
 
-   RETVOID;
+   return;
 } /* end of rgFillDgnParams */
 
 
@@ -455,24 +410,16 @@ U8          dgnType;
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
 Void rgUpdtRguDedSts
 (
 Inst           inst,
-RgUpSapCb     *rguDlSap,
-U8             stsType,   /* Statistics type to update */
+RgUpSapCb      *rguDlSap,
+uint8_t        stsType,   /* Statistics type to update */
 RgRguDedDatReq *datReq    /* DatReq pointer */
 )
-#else
-Void rgUpdtRguDedSts(inst,rguDlSap,stsType, datReq)
-Inst           inst;
-RgUpSapCb     *rguDlSap;
-U8             stsType;   /* Statistics type to update */
-RgRguDedDatReq *datReq;   /* DatReq pointer */
-#endif
 {
-   U8 idx1,idx2;
-   U32 idx;
+   uint8_t idx1,idx2;
+   uint32_t idx;
 
    switch(stsType)
    {
@@ -510,7 +457,7 @@ RgRguDedDatReq *datReq;   /* DatReq pointer */
          break;
    }
    
-   RETVOID;
+   return;
 } /* rgUpdtRguDedSts */
 
 
@@ -530,19 +477,12 @@ RgRguDedDatReq *datReq;   /* DatReq pointer */
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
 Void rgUpdtRguCmnSts
 (
 Inst           inst,
 RgUpSapCb     *rguDlSap,
-U8             stsType   /* Statistics type to update */
+uint8_t       stsType   /* Statistics type to update */
 )
-#else
-Void rgUpdtRguCmnSts(inst,rguDlSap,stsType)
-Inst           inst;
-RgUpSapCb     *rguDlSap;
-U8             stsType;   /* Statistics type to update */
-#endif
 {
 
    switch(stsType)
@@ -556,7 +496,7 @@ U8             stsType;   /* Statistics type to update */
          break;
    }
    
-   RETVOID;
+   return;
 } /* rgUpdtRguCmnSts */
 
 
@@ -577,17 +517,7 @@ U8             stsType;   /* Statistics type to update */
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
-Void rgUpdtCellCnt
-(
-Inst inst,
-U8 updtType
-)
-#else
-Void rgUpdtCellCnt(inst,updtType)
-Inst inst;
-U8 updtType;
-#endif
+Void rgUpdtCellCnt(Inst inst,uint8_t updtType)
 {
 
    switch (updtType)
@@ -602,7 +532,7 @@ U8 updtType;
          break;
    }
 
-   RETVOID;
+   return;
 } /* rgUpdtCellCnt */
 
 
@@ -623,17 +553,7 @@ U8 updtType;
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
-Void rgUpdtUeCnt
-(
-Inst inst,
-U8 updtType
-)
-#else
-Void rgUpdtUeCnt (inst,updtType)
-Inst inst;
-U8 updtType;
-#endif
+Void rgUpdtUeCnt(Inst inst,uint8_t updtType)
 {
    switch (updtType)
    {
@@ -646,7 +566,7 @@ U8 updtType;
       default:
          break;
    }
-   RETVOID;
+   return;
 } /* rgUpdtUeCnt */
 
 /*
@@ -663,22 +583,16 @@ U8 updtType;
 *       File:  rg_utl.c
 *
 */
-#ifdef ANSI
 S16 rgAllocEventMem
 (
 Inst     inst,
 Ptr       *memPtr,
 Size      memSize
 )
-#else
-S16 rgAllocEventMem(inst,memPtr, memSize)
-Inst     inst;
-Ptr       *memPtr;
-Size      memSize;
-#endif
 {
-   Mem              sMem;
-   VOLATILE U32     startTime=0;
+   Mem               sMem;
+   volatile uint32_t startTime=0;
+
 
    sMem.region = rgCb[inst].rgInit.region;
    sMem.pool = rgCb[inst].rgInit.pool;
@@ -686,8 +600,7 @@ Size      memSize;
 #if (ERRCLASS & ERRCLS_DEBUG)
    if (memSize<= 0)
    {
-      RGLOGERROR(inst,ERRCLS_INT_PAR, ERG031, memSize,
-                   "rgAllocEventMem(): memSize invalid\n");
+      DU_LOG("\nERROR  -->  MAC : rgAllocEventMem(): memSize invalid\n");
       return  (RFAILED);
    }
 #endif /* ERRCLASS & ERRCLS_DEBUG */
@@ -705,7 +618,7 @@ Size      memSize;
    if(ROK != cmAllocEvnt(memSize, TFU_MAX_MEMBLK_SIZE, &sMem, memPtr))
 #endif /* */
    {
-      RLOG0(L_ERROR,"cmAllocEvnt Failed"); 
+      DU_LOG("\nERROR  -->  MAC : cmAllocEvnt Failed"); 
       return RFAILED;
    }
 
@@ -729,7 +642,6 @@ Size      memSize;
 *       File:  rg_utl.c
 *
 */
-#ifdef ANSI
 S16 rgGetEventMem
 (
 Inst      inst,
@@ -737,13 +649,6 @@ Ptr       *ptr,
 Size      len,
 Ptr       memCp
 )
-#else
-S16 rgGetEventMem(inst,ptr, len, memCp)
-Inst      inst;
-Ptr       *ptr;
-Size      len;
-Ptr       memCp;
-#endif
 {
    S16   ret;
 
@@ -772,19 +677,12 @@ Ptr       memCp;
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
 Void rgGetPstToInst
 (
 Pst           *pst,
 Inst          srcInst,
 Inst          dstInst
 )
-#else
-Void rgGetPstToInst (pst, srcInst, dstInst)
-Pst           *pst;
-Inst          srcInst;
-Inst          dstInst;
-#endif
 {
 
    pst->srcEnt = rgCb[srcInst].rgInit.ent; 
@@ -801,7 +699,7 @@ Inst          dstInst;
    pst->intfVer   = 0;
    pst->route   = RTESPEC;
 
-   RETVOID
+   return
 } /* end of rgGetPstToInst */
 
 /***********************************************************
@@ -825,17 +723,7 @@ Inst          dstInst;
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
-S16 RgSchMacLcgRegReq
-(
-Pst            *pst,
-RgInfLcgRegReq *lcgRegReq
-)
-#else
-S16 RgSchMacLcgRegReq (pst, lcgRegReq)
-Pst            *pst;
-RgInfLcgRegReq *lcgRegReq;
-#endif
+S16 RgSchMacLcgRegReq(Pst *pst,RgInfLcgRegReq *lcgRegReq)
 {
    Inst       inst;
    RgCellCb   *cell = NULLP;
@@ -849,13 +737,13 @@ RgInfLcgRegReq *lcgRegReq;
       (cell->cellId != lcgRegReq->cellId))
    {
       
-      RLOG_ARG0(L_ERROR,DBG_CELLID,lcgRegReq->cellId,"Cell does not exist ");
+      DU_LOG("\nERROR  -->  MAC : Cell does not exist ");
       return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, lcgRegReq->crnti)) == NULLP)
    {
-      RLOG_ARG1(L_ERROR, DBG_CELLID,cell->cellId,"CRNTI:%d does not exist", 
+     DU_LOG("\nERROR  -->  MAC : CRNTI:%d does not exist", 
                         lcgRegReq->crnti);
       return RFAILED;
    }
@@ -882,17 +770,7 @@ RgInfLcgRegReq *lcgRegReq;
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
-S16 RgSchMacUlSpsResetReq
-(
-Pst            *pst,
-RgInfUlSpsReset *ulSpsResetInfo
-)
-#else
-S16 RgSchMacUlSpsResetReq (pst, lcInfo)
-Pst            *pst;
-RgInfUlSpsReset *ulSpsResetInfo;
-#endif
+S16 RgSchMacUlSpsResetReq(Pst *pst,RgInfUlSpsReset *ulSpsResetInfo)
 {
    Inst       inst;
    RgCellCb   *cell = NULLP;
@@ -906,13 +784,13 @@ RgInfUlSpsReset *ulSpsResetInfo;
       (cell->cellId != ulSpsResetInfo->cellId))
    {
       
-      RLOG_ARG0(L_ERROR, DBG_CELLID,ulSpsResetInfo->cellId,"Cell does not exist ");
+      DU_LOG("\nERROR  -->  MAC : Cell does not exist ");
       return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, ulSpsResetInfo->crnti)) == NULLP)
    {
-      RLOG_ARG1(L_ERROR, DBG_CELLID,cell->cellId,"CRNTI:%d does not exist", 
+      DU_LOG("\nERROR  -->  MAC : CRNTI:%d does not exist", 
                      ulSpsResetInfo->crnti);
       return RFAILED;
    }
@@ -950,22 +828,12 @@ RgInfUlSpsReset *ulSpsResetInfo;
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
-S16 RgSchMacSpsLcRegReq
-(
-Pst            *pst,
-RgInfSpsLcInfo *lcInfo
-)
-#else
-S16 RgSchMacSpsLcRegReq (pst, lcInfo)
-Pst            *pst;
-RgInfSpsLcInfo *lcInfo;
-#endif
+S16 RgSchMacSpsLcRegReq(Pst *pst,RgInfSpsLcInfo *lcInfo)
 {
    Inst       inst;
    RgCellCb   *cell= NULLP;
    RgUeCb     *ue;
-   U8         idx;
+   uint8_t    idx;
 
    RG_IS_INST_VALID(pst->dstInst);
    inst   = pst->dstInst - RG_INST_START;
@@ -975,13 +843,13 @@ RgInfSpsLcInfo *lcInfo;
       (cell->cellId != lcInfo->cellId))
    {
       
-      RLOG_ARG0(L_ERROR,DBG_CELLID,lcInfo->cellId, "Cell does not exist ");
+      DU_LOG("\nERROR  -->  MAC : Cell does not exist ");
       return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, lcInfo->crnti)) == NULLP)
    {
-      RLOG_ARG1(L_ERROR, DBG_CELLID,cell->cellId,"CRNTI:%d does not exist", 
+      DU_LOG("\nERROR  -->  MAC : CRNTI:%d does not exist", 
                      lcInfo->crnti);
       return RFAILED;
    }
@@ -999,8 +867,7 @@ RgInfSpsLcInfo *lcInfo;
    /* Insert the UE into SPS UE List */
    if (rgDBMInsSpsUeCb(cell, ue) == RFAILED)
    {
-      RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
-                   "Ue insertion into SPS list failed SPS CRNTI:%d", ue->spsRnti);
+      DU_LOG("\nERROR  -->  MAC : Ue insertion into SPS list failed SPS CRNTI:%d", ue->spsRnti);
       return RFAILED;
    } 
 
@@ -1031,19 +898,7 @@ RgInfSpsLcInfo *lcInfo;
  *     File : rg_utl.c
  *
  **********************************************************/
-#ifdef ANSI
-S16 RgSchMacSpsLcDeregReq
-(
-Pst            *pst,
-CmLteCellId    cellId,
-CmLteRnti      crnti
-)
-#else
-S16 RgSchMacSpsLcDeregReq (pst, cellId, crnti)
-Pst            *pst;
-CmLteCellId    cellId;
-CmLteRnti      crnti;
-#endif
+S16 RgSchMacSpsLcDeregReq(Pst  *pst,CmLteCellId cellId,CmLteRnti crnti)
 {
    Inst       inst;
    RgCellCb   *cell = NULLP;
@@ -1057,13 +912,13 @@ CmLteRnti      crnti;
       (cell->cellId != cellId))
    {
       
-      RLOG_ARG0(L_ERROR,DBG_CELLID,cellId, "Cell does not exist ");
+      DU_LOG("\nERROR  -->  MAC : Cell does not exist ");
       return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, crnti)) == NULLP)
    {
-      RLOG_ARG1(L_ERROR, DBG_CELLID,cellId,"CRNTI:%d Ue does not exist", crnti);
+      DU_LOG("\nERROR  -->  MAC : CRNTI:%d Ue does not exist", crnti);
       return RFAILED;
    }
 
@@ -1097,21 +952,13 @@ CmLteRnti      crnti;
  *      -# ROK 
  *      -# RFAILED
  **/
-#ifdef ANSI
-PRIVATE S16 rgUtlHndlCrntiChng 
+static S16 rgUtlHndlCrntiChng 
 (
 Inst            inst,
 RgCellCb        *cell,
 CmLteRnti       rnti,
 CmLteRnti       newRnti
 )
-#else
-PRIVATE S16 rgUtlHndlCrntiChng(inst,cell, rnti, newRnti)
-Inst            inst;
-RgCellCb        *cell;
-CmLteRnti       rnti;
-CmLteRnti       newRnti;
-#endif
 {
    RgUeCb         *ue = NULLP;
    RgUeCb         *newUe = NULLP;
@@ -1120,13 +967,12 @@ CmLteRnti       newRnti;
    newUe = rgDBMGetUeCbFromRachLst(cell, newRnti);
    if ((ue == NULLP) || (newUe == NULLP))
    {
-      RLOG_ARG4(L_ERROR,DBG_CELLID,cell->cellId,
-                       "RNTI:%d Failed to get UECB[%lu:%lu] or NEW RNTI:%d", 
+      DU_LOG("\nERROR  -->  MAC : RNTI:%d Failed to get UECB[%lu:%lu] or NEW RNTI:%d", 
                rnti, ((PTR)ue), ((PTR)newUe), newRnti);
       return RFAILED;
    }
 #ifdef XEON_SPECIFIC_CHANGES
-   CM_LOG_DEBUG(CM_LOG_ID_MAC, "MAC:UE[%d] id changed to %d\n", rnti, newRnti);
+   DU_LOG("\nDEBUG  -->  MAC : MAC:UE[%d] id changed to %d\n", rnti, newRnti);
 #endif
    rgDBMDelUeCb(cell, ue);
 
@@ -1163,20 +1009,10 @@ CmLteRnti       newRnti;
  *  @param[in] RgUeCb    *ue
  *  @return  ROK is SUCCESS 
  **/
-#ifdef ANSI
-S16 rgDelUeFrmAllSCell
-(
-RgCellCb      *cell,
-RgUeCb        *ue
-)
-#else
-S16 rgDelUeFrmAllSCell(cell, ue)
-RgCellCb      *cell;
-RgUeCb        *ue;
-#endif
+S16 rgDelUeFrmAllSCell(RgCellCb *cell,RgUeCb *ue)
 {
    Inst        inst     = cell->macInst - RG_INST_START;
-   U8          idx      = 0;
+   uint8_t     idx      = 0;
    Inst        sCellInstIdx;
    Pst         dstInstPst;
    RgPrgUeSCellDelInfo ueSCellDelInfo;
@@ -1218,19 +1054,7 @@ RgUeCb        *ue;
  *  @return  S16
  *      -# ROK 
  **/
-#ifdef ANSI
-S16 rgUtlVltdAddSCellCfg
-(
- RgPrgUeSCellCfgInfo *ueSCellCb,
- RgCellCb    *cell,
- Inst        inst
-)
-#else
-S16 rgUtlVltdAddSCellCfg(ueSCellCb, cell, inst)
- RgPrgUeSCellCfgInfo *ueSCellCb;
- RgCellCb    *cell;
- Inst        inst;
-#endif
+S16 rgUtlVltdAddSCellCfg(RgPrgUeSCellCfgInfo *ueSCellCb,RgCellCb *cell,Inst inst)
 {
   S16 ret = ROK; 
   
@@ -1238,19 +1062,18 @@ S16 rgUtlVltdAddSCellCfg(ueSCellCb, cell, inst)
   if((cell == NULLP) ||
         (cell->cellId != ueSCellCb->cellId))
   {
-     RGDBGERRNEW(inst, (rgPBuf(inst),
-              "[%d]Sec Cell does not exit %d\n",
-              ueSCellCb->ueId, ueSCellCb->cellId));
+     DU_LOG("\nERROR  -->  MAC : [%d]Sec Cell does not exit %d\n",
+              ueSCellCb->ueId, ueSCellCb->cellId);
      ret = RFAILED;
   }
 #ifdef TENB_MULT_CELL_SUPPRT
    if((ueSCellCb->rguDlSapId > rgCb[inst].numRguSaps) ||
       (ueSCellCb->rguUlSapId > rgCb[inst].numRguSaps))
    {
-      RGDBGERRNEW(inst,(rgPBuf(inst), "Invald Sap Id: DL %d UL %d for ueId %d failed\n",
+      DU_LOG("\nERROR  -->  MAC : Invald Sap Id: DL %d UL %d for ueId %d failed\n",
                ueSCellCb->rguDlSapId,
                ueSCellCb->rguUlSapId,
-               ueSCellCb->cellId));
+               ueSCellCb->cellId);
      ret = RFAILED;
    }
 #endif
@@ -1275,26 +1098,19 @@ S16 rgUtlVltdAddSCellCfg(ueSCellCb, cell, inst)
  *  @return  S16
  *      -# ROK 
  **/
-#ifdef ANSI
-PRIVATE S16 rgUtlSndCrntiChngReq2AllSMacs
+static S16 rgUtlSndCrntiChngReq2AllSMacs
 (
 RgCellCb        *cell,
 CmLteRnti       rnti,
 CmLteRnti       newRnti
 )
-#else
-PRIVATE S16 rgUtlSndCrntiChngReq2AllSMacs(cell, rnti, newRnti)
-RgCellCb        *cell;
-CmLteRnti       rnti;
-CmLteRnti       newRnti;
-#endif
 {
    Inst                inst = cell->macInst - RG_INST_START;
    Inst                sCellInstIdx;
    Pst                 dstInstPst;
    RgPrgUeSCellDelInfo ueIdChngReq;
    RgUeCb              *ue;
-   U8                  idx;
+   uint8_t                  idx;
 #ifdef L2_OPTMZ
 TfuDelDatReqInfo delDatReq;
 #endif
@@ -1303,8 +1119,8 @@ TfuDelDatReqInfo delDatReq;
    ue = rgDBMGetUeCb(cell, newRnti);
    if (ue == NULLP)
    {
-      RGDBGERRNEW(inst,(rgPBuf(inst),"[%d]RNTI:Failed to get ueCb \
-               newRnti=%d\n", rnti, newRnti));
+      DU_LOG("\nERROR  -->  MAC : [%d]RNTI:Failed to get ueCb \
+               newRnti=%d\n", rnti, newRnti);
       return RFAILED;
    }
    /* For all added SCells, prepare and send ueIdChngReq */
@@ -1357,17 +1173,7 @@ TfuDelDatReqInfo delDatReq;
  *  @param[in] CmLteRnti     rnti
  *  @return  Void 
  **/
-#ifdef ANSI
-PRIVATE Void rgUtlHndlCrntiRls
-(
-RgCellCb        *cell,
-RgInfRlsRnti    *rlsRnti
-)
-#else
-PRIVATE Void rgUtlHndlCrntiRls(cell, rlsRnti)
-RgCellCb        *cell;
-CmLteRnti       *rlsRnti;
-#endif
+static Void rgUtlHndlCrntiRls(RgCellCb *cell,RgInfRlsRnti *rlsRnti)
 {
    Inst           inst = cell->macInst - RG_INST_START;
    RgUeCb        *ue = NULLP;
@@ -1388,8 +1194,7 @@ CmLteRnti       *rlsRnti;
       }
       else
       {
-         RLOG_ARG1(L_WARNING,DBG_CELLID,cell->cellId,
-                   "RNTI:%d No ueCb found in RachLst",rlsRnti->rnti);
+          DU_LOG("\nERROR  -->  MAC : RNTI:%d No ueCb found in RachLst",rlsRnti->rnti);
       }
    }
    else
@@ -1417,13 +1222,12 @@ CmLteRnti       *rlsRnti;
       {
          if((ue=rgDBMGetUeCbFromRachLst (cell, rlsRnti->rnti)) != NULLP)
          {
-            RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
-                       "RNTI:%d STALE UE is still present", rlsRnti->rnti);         
+            DU_LOG("\nERROR  -->  MAC : RNTI:%d STALE UE is still present", rlsRnti->rnti);         
          }
       }
    }
 
-   RETVOID;
+   return;
 } /* end of rgUtlHndlCrntiRls */
 
 /**
@@ -1445,17 +1249,7 @@ CmLteRnti       *rlsRnti;
  *  @return  S16
  *      -# ROK 
  **/
-#ifdef ANSI
-S16 RgSchMacRlsRntiReq
-(
-Pst                 *pst,
-RgInfRlsRnti        *rlsRnti
-)
-#else
-S16 RgSchMacRlsRntiReq(pst, rlsRnti)
-Pst                 *pst;
-RgInfRlsRnti        *rlsRnti;
-#endif
+S16 RgSchMacRlsRntiReq(Pst *pst,RgInfRlsRnti *rlsRnti)
 {
 //   Pst            schPst;
 //   RgInfUeDelInd  ueDelInd;
@@ -1478,8 +1272,7 @@ TfuDelDatReqInfo delDatReq;
       (cell->cellId != rlsRnti->cellId))
    {
       
-      RLOG_ARG1(L_ERROR,DBG_CELLID,rlsRnti->cellId,
-               "No cellCb found with cellId for RNTI:%d", 
+      DU_LOG("\nERROR  -->  MAC : No cellCb found with cellId for RNTI:%d", 
                         rlsRnti->rnti);
       return RFAILED;
    }
@@ -1492,8 +1285,7 @@ TfuDelDatReqInfo delDatReq;
        * is dummy */      
       if (rgUtlHndlCrntiChng(macInst,cell, rlsRnti->rnti, rlsRnti->newRnti) != ROK)       
       {
-         RLOG_ARG2(L_ERROR,DBG_CELLID,rlsRnti->cellId,
-                       "CRNTI change failed for RNTI:%d new RNTI:%d",
+         DU_LOG("\nERROR  -->  MAC : CRNTI change failed for RNTI:%d new RNTI:%d",
                    rlsRnti->rnti,rlsRnti->newRnti);
          return RFAILED;
       }
@@ -1540,15 +1332,7 @@ TfuDelDatReqInfo delDatReq;
 } /* end of RgSchMacRlsRntiReq */
 
 #ifdef L2_OPTMZ
-#ifdef ANSI
-Bool RgUtlIsTbMuxed
-(
- TfuDatReqTbInfo *tb
-)
-#else
-Bool RgUtlIsTbMuxed()
-   TfuDatReqTbInfo *tb
-#endif
+Bool RgUtlIsTbMuxed(TfuDatReqTbInfo *tb)
 {
    MsgLen len = 0;
    SFndLenMsg(tb->macHdr, &len);