Replaced old SSI function with new macros jira id - ODUHIGH-212
[o-du/l2.git] / src / 5gnrmac / rg_tom.c
index f4cd5d9..046fe8a 100755 (executable)
@@ -37,7 +37,6 @@ invoked by PHY towards MAC
 */
 /* header include files -- defines (.h) */
 #include "common_def.h"
-#include "du_app_mac_inf.h"
 #include "rgu.h"           /* RGU defines */
 #include "tfu.h"           /* RGU defines */
 #include "lrg.h"           /* layer management defines for LTE-MAC */
@@ -57,16 +56,11 @@ invoked by PHY towards MAC
 #include "rg_prg.x"        /* PRG interface typedefs */
 #include "rgm.x"           /* layer management typedefs for MAC */
 #include "rg.x"            /* typedefs for MAC */
-#include "mac.h"
-#include "lwr_mac_fsm.h"
 #ifdef MAC_RLC_UL_RBUF
 #include "ss_rbuf.h"
 #include "ss_rbuf.x"
 #endif
 
-uint16_t handleDlTtiReq(SlotIndInfo currTimingInfo);
-uint16_t handleUlTtiReq(SlotIndInfo currTimingInfo);
-
 /* ADD Changes for Downlink UE Timing Optimization */
 #ifndef LTEMAC_DLUE_TMGOPTMZ 
 PRIVATE S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf, RgCellCb   *cellCb,
@@ -220,7 +214,7 @@ PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)
       {
          err->errCause = RGERR_TOM_MEM_EXHAUST;
          RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion ");
-         RETVALUE(ret);
+         return (ret);
       }
 #ifdef TFU_ALLOC_EVENT_NO_INIT
 #ifndef L2_OPTMZ      
@@ -266,7 +260,7 @@ PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)
       {
          err->errCause = RGERR_TOM_MEM_EXHAUST;
          RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion CRNTI:%d",datReq->rnti);
-         RETVALUE(ret);
+         return (ret);
       }
 #ifdef TFU_ALLOC_EVENT_NO_INIT
 #ifndef L2_OPTMZ      
@@ -306,7 +300,7 @@ PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)
          err->errCause = RGERR_TOM_MEM_EXHAUST;
          RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"Memory Exhaustion CRNTI:%d",
                         datReq->rnti);
-         RETVALUE(ret);
+         return (ret);
       }
 #ifdef TFU_ALLOC_EVENT_NO_INIT
 #ifndef L2_OPTMZ      
@@ -357,7 +351,7 @@ PRIVATE S16 rgTOMUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)
       } /* end of while */
    } 
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of rgTOMUtlFillDatReqPdus*/ 
 
 /** @brief This function does all the processing related to a single downlink
@@ -418,7 +412,7 @@ PUBLIC S16 rgTOMUtlProcDlSf (dlSf, cellCb, err)
                             sizeof(TfuDatReqInfo))) != ROK)
    {
       RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to Allocate TfuDatReqInfo");
-      RETVALUE(ret);
+      return (ret);
    }
    else
    {
@@ -449,7 +443,7 @@ PUBLIC S16 rgTOMUtlProcDlSf (dlSf, cellCb, err)
       if ((ret = rgTOMEmtcUtlFillDatReqPdus(datInfo, dlSf, cellCb, err)) != ROK)
       {
          RG_FREE_MEM(datInfo);
-         RETVALUE(ret);
+         return (ret);
       }
 #endif 
       /* Fill the DLSCH PDUs of BCCH, PCCH and Dedicated Channels */
@@ -457,7 +451,7 @@ PUBLIC S16 rgTOMUtlProcDlSf (dlSf, cellCb, err)
       {
          RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to send data for cell");
          RG_FREE_MEM(datInfo);
-         RETVALUE(ret);
+         return (ret);
       }
       if((datInfo->pdus.count) || (datInfo->bchDat.pres == TRUE))
       {
@@ -473,237 +467,11 @@ PUBLIC S16 rgTOMUtlProcDlSf (dlSf, cellCb, err)
          RG_FREE_MEM(datInfo);
       }
    }
-   RETVALUE(ROK);
+   return ROK;
 } /* end of */
 
 U32  rgMacGT;
 
-/**
- * @brief Handler for processing TTI indication recieved from 
- * PHY for a cell.
- *
- * @details
- *
- *     Function: macProcessSlotInd
- *
- *     Handler for processing slot indication recieved from PHY
- *     for a cell.
- *
- *     Invoked by: macProcessSlotInd
- *
- *     Processing Steps:
- *     - Get cell and update the cell's current time with the timing value given
- *     by PHY
- *     - Invoke the cmPrcTmr to process the timing queue.
- *     - Append the PHICH information to the downlink subframe that needs to go
- *       out to PHY in this subframe.
- *     - Invoke DHM to release the downlink subframe that occured earlier
- *     rgDHMRlsDlsfHqProc.
- *     - Invoke the TTI handler of scheduler. 
- *     - Invoke the TTI handler of RAM module. 
- *     - Get the downlink subframe that has to go out to PHY in this subframe
- *     rgSCHSubFrmGet.
- *     - Invoke rgTOMUtlProcTA to perform and timing advance processing. 
- *     - Invoke rgTOMUtlProcDlSf to do further processing on the downlink
- *     subframe.
- *     - Get the downlink subframe that would occur after RG_DL_DELTA and 
- *     invoke rgTOMUtlProcDlSfStaInd to send status indications to the higher
- *     layer.
- *     - Invoke GOM's TTI handler rgGOMTtiHndlr
- *     - Invoke COM's TTI handler rgCOMTtiHndlr
- *           
- *  @param[in]  Inst        inst
- *  @param[in] SlotIndInfo slotInd
- *  @return  S16
- *      -# ROK 
- *      -# RFAILED 
- **/
-#if (defined (MAC_FREE_RING_BUF) || defined (RLC_FREE_RING_BUF))
-pthread_t gMacTId = 0;
-#endif
-PUBLIC S16 macProcessSlotInd
-(
-Inst          inst,
-SlotIndInfo slotInd
-)
-{
-   RgCellCb             *cellCb;
-   RgErrInfo            err;
-   RgDlSf               *dlSf;
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
-   RgDlSf               *prevDlSf;
-   CmLteTimingInfo       prevTmInfo;  
-#endif
-   //SlotIndInfo *slotInd = &ttiInfo->cells[0];
-
-   TRC2(macProcessSlotInd);
-
-#ifdef MAC_FREE_RING_BUF
-   gMacTId = pthread_self();
-#endif
-
-   cellCb = rgCb[inst].cell;
-   if (cellCb == NULLP)
-   {
-      err.errType = RGERR_TOM_TTIIND;
-      err.errCause = RGERR_TOM_INV_CELL_ID;
-      RETVALUE(RFAILED);
-   }
-
-   RGCPYTIMEINFO(slotInd, cellCb->crntTime);
-
-   rgMacGT = (slotInd.sfn * RG_NUM_SUB_FRAMES_5G) + slotInd.slot;
-#ifdef LTE_L2_MEAS
-   rgL2Meas(cellCb);
-   /*Included to track the number of 10240 cycles completed */
-
-  if((cellCb->crntTime.sfn == 0) && (cellCb->crntTime.slot==0))
-  {
-     cellCb->ttiCycle += 1;
-  }
-
-#endif
-
-   /*Check if we have transmitted the previous DL SF, it could be the
-     case that we haven't received all the DATA from RLC as yet
-     and thus we would not have transmitted previous DL SF yet.*/
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
-   RGSUBFRMCRNTTIME(slotInd, prevTmInfo, 1);
-   prevDlSf = &cellCb->subFrms[(prevTmInfo.slot % RG_NUM_SUB_FRAMES)];
-   if(FALSE == prevDlSf->txDone)
-   {
-      if (ROK != rgTOMUtlProcDlSf (prevDlSf, cellCb, &err))
-      {
-         RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,"Unable to process "
-               "previous downlink subframe for cell");
-         err.errType = RGERR_TOM_TTIIND;
-      }
-
-      /* Mark this frame as sent */
-      prevDlSf->txDone = TRUE;
-
-      if(prevDlSf->remDatReqCnt)
-      {
-         /*We have not received 1 or more data requests from RLC, this is
-           error scenario. MAC & SCH need to discard the allocations for
-           which data request hasn't been received as yet. And MAC
-           needs to inform SCH about the list of UEs for which 
-           allocation need to be discarded. */
-         prevDlSf->remDatReqCnt = 0;
-      }
-   }
-#endif
-
-   /* Mux Pdu for Msg4 */
-   SlotIndInfo muxTimingInfo;
-   memset(&muxTimingInfo, 0, sizeof(SlotIndInfo));
-   MacDlSlot *currDlSlot = NULLP;
-   ADD_DELTA_TO_TIME(slotInd, muxTimingInfo, PHY_DELTA);
-   currDlSlot = &macCb.macCell->dlSlot[muxTimingInfo.slot];
-   if(currDlSlot->dlInfo.msg4Alloc)
-       {
-      BuildAndSendMsg4MuxPdu(currDlSlot->dlInfo.msg4Alloc);
-               currDlSlot = NULLP;
-   }
-   
-   /* Trigger for DL TTI REQ */
-   handleDlTtiReq(slotInd);
-
-   /* Trigger for UL TTI REQ */
-   handleUlTtiReq(slotInd);
-
-   dlSf = &cellCb->subFrms[(slotInd.slot % RG_NUM_SUB_FRAMES)];
-
-   if((dlSf->txDone == TRUE) ||
-      (!RG_TIMEINFO_SAME(slotInd,dlSf->schdTime)))
-   {
-   /* MS_WORKAROUND */
-#ifndef LTEMAC_DLUE_TMGOPTMZ
-      TfuDatReqInfo     *datInfo;
-     CmLteTimingInfo   timingInfo;
-#ifdef TFU_DL_DELTA_CHANGE
-         RGADDTOCRNTTIME(cellCb->crntTime, timingInfo, TFU_DLDATA_DLDELTA);
-#else
-         RGADDTOCRNTTIME(cellCb->crntTime, timingInfo, TFU_DELTA);
-#endif
-     /* Fill Data Request from MAC for BCH  */
-     if ((timingInfo.sfn % 4 == 0) && (timingInfo.slot == 0))
-     {
-         if (ROK != rgAllocEventMem(inst,(Ptr *)&datInfo, 
-                            sizeof(TfuDatReqInfo)))
-         {
-            RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
-               "rgTOMUtlProcDlSf() Unable to Allocate TfuDatReqInfo for cell");
-            RETVALUE(RFAILED);
-         }
-         else
-         {
-            cmLListInit(&datInfo->pdus);
-            datInfo->cellId = cellCb->cellId;
-            datInfo->bchDat.pres = NOTPRSNT;
-            datInfo->timingInfo = timingInfo;
-            
-                                  
-          /* sending the dummy data req to Phy */
-            if (rgLIMTfuDatReq(inst,datInfo) != ROK)
-            {
-               RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
-                        "rgTOMUtlProcDlSf() Unable to send data info for cell");
-            }
-         
-         }
-     }      
-#endif
-      /* Freeing as the part of CL Non RT Indication */
-      /* TDOD : Generalize for all SOCs */
-#if !(defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
-      rgDHMFreeTbBufs(inst);
-#endif
-      RETVALUE(ROK);
-   }
-
-   /*Return if there is still some data to be received
-     from RLC for this DL SF. */
-/* ADD Changes for Downlink UE Timing Optimization */
-#ifdef LTEMAC_DLUE_TMGOPTMZ
-   if(0 != dlSf->remDatReqCnt) 
-   {
-      /* Freeing as the part of CL Non RT Indication */
-      /* TODO : Generalize for all SOCs and remove this flag */
-#if !(defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
-      rgDHMFreeTbBufs(inst);
-#endif
-      RETVALUE(ROK);
-   }
-#endif
-
-#ifdef XEON_SPECIFIC_CHANGES
-   CM_MEAS_TIME((slotInd.slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_DL_BR_PRC);
-#endif
-
-   if (ROK != rgTOMUtlProcDlSf (dlSf, cellCb, &err))
-   {
-      //RLOG_ARG0(L_ERROR,DBG_CELLID,slotInd->cellId,
-      //             "Unable to process downlink subframe for cell");
-      err.errType = RGERR_TOM_TTIIND;
-   }
-#ifdef XEON_SPECIFIC_CHANGES
-   CM_MEAS_TIME((slotInd->slot % RG_NUM_SUB_FRAMES), CM_DBG_MAC_TTI_IND, CM_DBG_MAC_DL_AFTER_PRC);
-#endif
-
-   /* Mark this frame as sent */
-   dlSf->txDone = TRUE;
-
-   /* Freeing as the part of CL Non RT Indication */
-   /* TODO : Generalize for all SOCs and remove this flag */
-#if !(defined(TENB_T2K3K_SPECIFIC_CHANGES) && defined(LTE_TDD))
-   rgDHMFreeTbBufs(inst);
-#endif 
-   RETVALUE(ROK);
-}  /* macProcessSlotInd */
-
 /** @brief This function allocates the RgMacPdu that will be populated by DEMUX
  * with the SubHeaders list and the values of the Control elements.
  *
@@ -754,13 +522,13 @@ Inst             inst;
       rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
                                        LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
       RLOG0(L_ERROR,"Allocation of DUX event failed");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    /*stoping Task*/
    SStopTask(startTime, PID_TOMUTL_CMALLCEVT);
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of */ 
 
 /** @brief This function frees up the RgMacPdu structure that has been
@@ -862,13 +630,13 @@ RgInfSfDatInd **sfInfo;
       rgLMMStaInd(inst,LCM_CATEGORY_RESOURCE, LCM_EVENT_DMEM_ALLOC_FAIL,
                                        LCM_CAUSE_MEM_ALLOC_FAIL, &dgn);
       RLOG0(L_ERROR,"Allocation failed");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    /*stoping Task*/
    SStopTask(startTime, PID_TOMINF_CMALLCEVT);
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of */ 
 
 /** @brief This function frees up the RgMacPdu structure that has been
@@ -953,7 +721,7 @@ PRIVATE S16 rgTomUtlPrepareL2MUlThrpInfo(cellCb,ueCb,dDatInd)
                }
    }
 
-   RETVALUE(ROK);
+   return ROK;
 }
 
 #endif
@@ -1092,7 +860,7 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes)
          /* code for common channel dat indications */
          if ((ret = rgAllocShrablSBuf (inst,(Data**)&cDatInd, sizeof(RgRguCmnDatInd))) != ROK)
          {
-            RETVALUE(RFAILED);
+            return RFAILED;
          }
          cDatInd->cellId   = cellCb->cellId;
          cDatInd->rnti     = ueCb->ueId;
@@ -1114,19 +882,19 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes)
 #endif
          sdu->mBuf = NULLP;
          rgUIMSndCmnDatInd(inst,cellCb->rguUlSap,cDatInd);
-         RETVALUE(ROK);
+         return ROK;
       } /* end of common channel processing */
 #ifndef SS_RBUF 
       if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK)
       {
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
 #else
                        glblueCb5 = ueCb;
       elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
       if (NULLP == elem)
       { 
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       dDatInd = (RgRguDedDatInd *)elem;
       cmMemset((U8 *)dDatInd, 0x00, sizeof(RgRguDedDatInd));
@@ -1192,18 +960,18 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes)
          {
             RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
                "Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId);
-            RETVALUE(ret);
+            return (ret);
          }
 #ifndef SS_RBUF
          if ((ret = rgAllocShrablSBuf (inst,(Data**)&dDatInd, sizeof(RgRguDedDatInd))) != ROK)
          {
-            RETVALUE(RFAILED);
+            return RFAILED;
          }
 #else
       elem = SRngGetWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
       if (NULLP == elem)
       { 
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       dDatInd = (RgRguDedDatInd *)elem;
       cmMemset((U8 *)dDatInd, 0x00, sizeof(RgRguDedDatInd));
@@ -1337,7 +1105,7 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes)
       {
          RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
                "Failed to send datIndication to RGU CRNTI:%d",ueCb->ueId);
-         RETVALUE(ret);
+         return (ret);
       }
    }
 #ifndef SS_RBUF
@@ -1348,7 +1116,7 @@ PRIVATE S16 rgTOMUtlProcMsg(cellCb, ueCb, pdu, slot, lcgBytes)
       rgFreeSharableSBuf(inst,(Data **)&dDatInd,sizeof(RgRguDedDatInd)); 
    }
 #endif
-   RETVALUE(ROK);
+   return ROK;
 } /* end of */ 
 
 /** @brief This function frees up the RgMacPdu structure that has been
@@ -1419,7 +1187,7 @@ U32         *lcgBytes;
 
    if(ROK != ret)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    ueInfo->rnti = rnti; 
@@ -1437,7 +1205,7 @@ U32         *lcgBytes;
       }
    }
    cmLListAdd2Tail(&sfInfo->ueLst, &ueInfo->ueLstEnt);
-   RETVALUE(ROK);
+   return ROK;
 } /* end of rgTOMUtlInsSchInfo */
 
 #include <stdlib.h>
@@ -1544,7 +1312,7 @@ Inst             inst;
    {
        
       RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to get the cellCb for cell");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    /* Avoiding memset as all the fields are getting initialized further */
 
@@ -1553,7 +1321,7 @@ Inst             inst;
       err.errType = RGERR_TOM_DATIND;
       RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to Allocate PDU for DUX cell");
       node =  datInd->datIndLst.first;
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    cmLListInit(&sfInfo->ueLst);
    sfInfo->cellId = datInd->cellId;
@@ -1591,7 +1359,7 @@ Inst             inst;
          err.errType = RGERR_TOM_DATIND;
          RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"Unable to Allocate PDU for DUX cell");
          rgTOMInfFreePduEvnt (sfInfo);
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
 
       if ((ret = rgDUXDemuxData (inst,pdu, &ceInfo, 
@@ -1715,7 +1483,7 @@ Inst             inst;
       {
          rgTOMInfFreePduEvnt (sfInfo);
          rgTOMUtlFreePduEvnt (pdu, FALSE);
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       /* free up the PDU memory */
       rgTOMUtlFreePduEvnt (pdu, FALSE);
@@ -1744,7 +1512,7 @@ Inst             inst;
    rgGetPstToInst(&schPst, inst,cellCb->schInstMap.schInst);
    sfInfo->cellSapId = cellCb->schInstMap.cellSapId;
    //TODO: commented for compilation without SCH RgMacSchSfRecp(&schPst, sfInfo);
-   RETVALUE(ROK);
+   return ROK;
 }  /* rgTOMDatInd */
 
 /**
@@ -1813,18 +1581,18 @@ RgErrInfo           *err;
       #if (ERRCLASS & ERRCLS_DEBUG) 
       if(NULLP == (bch = rgDBMGetBcchOnBch(cell)))
       {
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       if(cmnLcInfo->bchInfo.lcId != bch->lcId)
       {
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       #endif
 
       if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK)
       {
          err->errCause = RGERR_TOM_MEM_EXHAUST;
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       staInd->cellId = cell->cellId;
       staInd->rnti   = RG_INVALID_RNTI;
@@ -1836,7 +1604,7 @@ RgErrInfo           *err;
 #endif
       if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
       {
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
 #else
       /*Store the received BCH Data in the scheduled subframe*/
@@ -1849,11 +1617,11 @@ RgErrInfo           *err;
       #if (ERRCLASS & ERRCLS_DEBUG) 
       if(NULLP == (pcch = rgDBMGetPcch(cell)))
       {
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       if(cmnLcInfo->pcchInfo.lcId != pcch->lcId)
       {
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       #endif
 
@@ -1868,7 +1636,7 @@ RgErrInfo           *err;
       if (rgAllocShrablSBuf (inst,(Data**)&staInd, sizeof(RguCStaIndInfo)) != ROK)
       {
          err->errCause = RGERR_TOM_MEM_EXHAUST;
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       staInd->cellId = cell->cellId;
       staInd->rnti   = RG_INVALID_RNTI;
@@ -1883,7 +1651,7 @@ RgErrInfo           *err;
        */
       if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
       {
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
    }
 
@@ -1901,7 +1669,7 @@ RgErrInfo           *err;
       if(NULLP == 
          (bcch=rgDBMGetBcchOnDlsch(cell,cmnLcInfo->bcchInfo.lcId)))
       {
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       if(TRUE == cmnLcInfo->bcchInfo.sndStatInd)
       {
@@ -1910,7 +1678,7 @@ RgErrInfo           *err;
                   sizeof(RguCStaIndInfo)) != ROK)
          {
             err->errCause = RGERR_TOM_MEM_EXHAUST;
-            RETVALUE(RFAILED);
+            return RFAILED;
          }
          staInd->cellId = cell->cellId;
          staInd->rnti   = RG_INVALID_RNTI;
@@ -1922,7 +1690,7 @@ RgErrInfo           *err;
 #endif
          if (rgUIMSndCmnStaInd (inst,cell->rguDlSap,staInd) != ROK)
          {
-            RETVALUE(RFAILED);
+            return RFAILED;
          }
       }
       else
@@ -1936,7 +1704,7 @@ RgErrInfo           *err;
 #endif/*RGR_SI_SCH*/
    }
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of rgHndlCmnChnl */
 
 /**
@@ -1987,12 +1755,12 @@ RgErrInfo           *err;
 
    if(NULLP == ueInfo->allocInfo)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    rgDHMSndConsolidatedStaInd(cell, ueInfo, timingInfo, err);
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of rgHndlSchdUe */
 
 #ifdef LTE_L2_MEAS
@@ -2054,7 +1822,7 @@ RgInfUlUeInfo       *ueInfo;
        if((ret = rgAllocSBuf(inst,(Data**)&(cell->ulSf[(timingInfo.slot % RGSCH_NUM_SUB_FRAMES)].
                  ueUlAllocInfo), ueInfo->numUes *  sizeof(RgUeUlAlloc))) != ROK)
        {
-          RETVALUE(ret);
+          return (ret);
        }
    }
 #ifdef XEON_SPECIFIC_CHANGES
@@ -2070,7 +1838,7 @@ RgInfUlUeInfo       *ueInfo;
       }
    }
    RGCPYTIMEINFO(timingInfo, ulSf->schdTime);
-   RETVALUE(ROK);
+   return ROK;
 } /* end of rgHndlUlUeInfo */
 #endif
 /**
@@ -2232,7 +2000,7 @@ RgInfSfAlloc        *sfInfo;
       }
    }
    RgUiRguFlowCntrlInd(pst, cell->rguDlSap->sapCfg.spId,flowCntrlInd); /* TODO: Rishi confirm if the suId and pst pointer is correct */
-   RETVALUE(ROK);
+   return ROK;
 }
 /**
  * @brief Function is called by the scheduler once it has completed the
@@ -2287,13 +2055,13 @@ RgInfSfAlloc        *sfInfo;
 
    if(NULLP == sfInfo)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if((cell = rgCb[inst].cell) == NULLP)
    {
       RLOG_ARG0(L_ERROR,DBG_CELLID,sfInfo->cellId, "No cellCb found with cell");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    dlSf = &cell->subFrms[(sfInfo->timingInfo.slot % RG_NUM_SUB_FRAMES)];
@@ -2335,7 +2103,7 @@ RgInfSfAlloc        *sfInfo;
    if(rgHndlUlUeInfo(cell, sfInfo->ulUeInfo.timingInfo, 
                      &sfInfo->ulUeInfo) != ROK)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 #endif
 #ifdef XEON_SPECIFIC_CHANGES
@@ -2376,7 +2144,7 @@ RgInfSfAlloc        *sfInfo;
    }
    /*stoping Task*/
    SStopTask(startTime, PID_MAC_SF_ALLOC_REQ);
-   RETVALUE(ROK);
+   return ROK;
 } /* end of RgSchMacSfAllocReq */
 /**
  * @brief Handler for processing data indication recieved from PHY for UEs.
@@ -2448,7 +2216,7 @@ U16               slot;
    {
        RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
                "RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti);
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
 
    prevUeCb = rgDBMGetUeCb (cellCb, ceInfo->ces.cRnti);
@@ -2456,7 +2224,7 @@ U16               slot;
    {
        RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
                 "RNTI:%d Received MSG3 with CRNTI,unable to find ueCb", ceInfo->ces.cRnti);
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
    RLOG_ARG2(L_DEBUG,DBG_CELLID,cellCb->cellId,
             "CRNTI CE(%d) received through tmpCrnti(%d)",
@@ -2472,9 +2240,9 @@ U16               slot;
    {
        RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
                       "RNTI:%d Processing for MSG3 failed",datInfo->rnti);
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
-   RETVALUE(ROK);
+   return ROK;
 }
 /**
  * @brief Handler for processing data indication recieved from PHY for UEs.
@@ -2548,7 +2316,7 @@ U16               slot;
    {
        RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
                       "CRNTI:%d Received MSG3 with CCCH",ceInfo->ces.cRnti);
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
    
    ueCb = rgDBMGetUeCbFromRachLst (cellCb, datInfo->rnti);
@@ -2557,7 +2325,7 @@ U16               slot;
    {
        RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,
                       "RNTI:%d Processing for MSG3 failed", datInfo->rnti);
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
    /* Fix: syed Drop any duplicate Msg3(CCCH Sdu) */
    if (ueCb->dl.hqEnt.numHqProcs)
@@ -2565,7 +2333,7 @@ U16               slot;
       /* HqE is already initialized by a previuos Msg3 */ 
        RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Processing for MSG3 failed. Duplicate "
           "MSG3 received. Dropping", datInfo->rnti);
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
    
    if(rgDHMHqEntInit(inst,&ueCb->dl.hqEnt,
@@ -2573,7 +2341,7 @@ U16               slot;
    {
        RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Harq Initialization failed ", 
           datInfo->rnti);
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
     RLOG_ARG1(L_DEBUG,DBG_CELLID,cellCb->cellId,
              "CCCH SDU received through tmpCrnti(%d)",datInfo->rnti);
@@ -2585,9 +2353,9 @@ U16               slot;
    {
        RLOG_ARG1(L_ERROR,DBG_CELLID,cellCb->cellId,"RNTI:%d Processing for MSG3 failed", 
           datInfo->rnti);
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
-   RETVALUE(ROK);
+   return ROK;
 }
 
 #ifdef LTE_L2_MEAS
@@ -2644,7 +2412,7 @@ PRIVATE S16 rgTOMUtlL2MStoreBufSz (ueCb, ceInfo)
       ueCb->ul.lcgArr[2].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs3];
       ueCb->ul.lcgArr[3].lcgBsInfo.outStndngBs = rgLwrBsrTbl[ceInfo->ces.bsr.longBsr.bs4];
    }
-   RETVALUE(ROK);
+   return ROK;
 } /* end of rgTOMUtlL2MStoreBufSz*/
 
 /** @brief : Compiles list of LCs received in UL data for DTCH RBs