Replaced old SSI function with new macros jira id - ODUHIGH-212
[o-du/l2.git] / src / 5gnrmac / rg_utl.c
index d7b87b0..9af90e4 100755 (executable)
@@ -37,18 +37,7 @@ static int RLOG_MODULE_ID=4096;
 static int RLOG_FILE_ID=179;
 
 /* header include files (.h) */
-#include "envopt.h"        /* environment options */
-#include "envdep.h"        /* environment dependent */
-#include "envind.h"        /* environment independent */
-  
-#include "gen.h"           /* general */
-#include "ssi.h"           /* system services */
-#include "cm_tkns.h"       /* Common Token Defines */
-#include "cm_llist.h"      /* Common Link List Defines */
-#include "cm_hash.h"       /* Common Hash List Defines */
-#include "cm_mblk.h"       /* common memory link list library */
-#include "cm_lte.h"        /* Common LTE */
-
+#include "common_def.h"
 #include "rg_env.h"        /* MAC Environment Defines */
 #include "crg.h"           /* CRG Interface defines */
 #include "rgu.h"           /* RGU Interface defines */
@@ -61,15 +50,7 @@ static int RLOG_FILE_ID=179;
 #include "rg_err.h"        /* MAC error defines */
 
 /* header/extern include files (.x) */
-#include "gen.x"           /* general */
-#include "ssi.x"           /* system services */
 #include "cm5.x"           /* Timer */
-#include "cm_tkns.x"       /* Common Token Definitions */
-#include "cm_llist.x"      /* Common Link List Definitions */
-#include "cm_lib.x"        /* Common Library Definitions */
-#include "cm_hash.x"       /* Common Hash List Definitions */
-#include "cm_mblk.x"       /* common memory link list library */
-#include "cm_lte.x"        /* Common LTE */
 
 #include "crg.x"           /* CRG Interface includes */
 #include "rgu.x"           /* RGU Interface includes */
@@ -154,7 +135,7 @@ Size    size;               /* size */
 
    if (size == 0)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    /* allocate buffer */
@@ -167,7 +148,7 @@ Size    size;               /* size */
      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");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
 #ifndef ALIGN_64BIT
@@ -181,7 +162,7 @@ Size    size;               /* size */
    /* zero out the allocated memory */
    cmMemset((U8 *)*pData, 0x00, size);
 
-   RETVALUE(ROK);
+   return ROK;
 
 } /* end of rgAllocSBuf */
 
@@ -226,7 +207,7 @@ Size    size;               /* size */
 
    if (size == 0)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    /* allocate buffer */
@@ -242,13 +223,13 @@ Size    size;               /* size */
      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");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    /* zero out the allocated memory */
    cmMemset((U8 *)*pData, 0x00, size);
 
-   RETVALUE(ROK);
+   return ROK;
 
 } /* end of rgAllocSBuf */
 
@@ -416,10 +397,10 @@ Buffer  **mBuf;           /* Message Buffer pointer be returned */
       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");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
-   RETVALUE(ROK);
+   return ROK;
 
 } /* end of rgGetMsg */
 
@@ -731,7 +712,7 @@ Size      memSize;
    {
       RGLOGERROR(inst,ERRCLS_INT_PAR, ERG031, memSize,
                    "rgAllocEventMem(): memSize invalid\n");
-      RETVALUE (RFAILED);
+      return  (RFAILED);
    }
 #endif /* ERRCLASS & ERRCLS_DEBUG */
 
@@ -749,13 +730,13 @@ Size      memSize;
 #endif /* */
    {
       RLOG0(L_ERROR,"cmAllocEvnt Failed"); 
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    /*stoping Task*/
    SStopTask(startTime, PID_MACUTL_CMALLCEVT);
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of rgAllocEventMem*/
 
 /*
@@ -796,7 +777,7 @@ Ptr       memCp;
 #else
    ret = cmGetMem(memCp, len, (Ptr *)ptr);
 #endif /* */
-   RETVALUE(ret);
+   return (ret);
 } /* end of rgGetEventMem*/
 
 /***********************************************************
@@ -897,18 +878,18 @@ RgInfLcgRegReq *lcgRegReq;
    {
       
       RLOG_ARG0(L_ERROR,DBG_CELLID,lcgRegReq->cellId,"Cell does not exist ");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, lcgRegReq->crnti)) == NULLP)
    {
       RLOG_ARG1(L_ERROR, DBG_CELLID,cell->cellId,"CRNTI:%d does not exist", 
                         lcgRegReq->crnti);
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    ue->ul.lcgArr[lcgRegReq->lcgId].isGbr = lcgRegReq->isGbr;
 
-   RETVALUE(ROK)
+   return ROK
 } /* end of RgSchMacLcgRegReq */
 
 #ifdef LTEMAC_SPS
@@ -956,20 +937,20 @@ RgInfUlSpsReset *ulSpsResetInfo;
    {
       
       RLOG_ARG0(L_ERROR, DBG_CELLID,ulSpsResetInfo->cellId,"Cell does not exist ");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, ulSpsResetInfo->crnti)) == NULLP)
    {
       RLOG_ARG1(L_ERROR, DBG_CELLID,cell->cellId,"CRNTI:%d does not exist", 
                      ulSpsResetInfo->crnti);
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    ue->ul.implRelCntr = 0;
    ue->ul.explRelCntr = 0;
 
-   RETVALUE(ROK)
+   return ROK
 } /* end of RgSchMacUlSpsResetReq */
 
 
@@ -1027,14 +1008,14 @@ RgInfSpsLcInfo *lcInfo;
    {
       
       RLOG_ARG0(L_ERROR,DBG_CELLID,lcInfo->cellId, "Cell does not exist ");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, lcInfo->crnti)) == NULLP)
    {
       RLOG_ARG1(L_ERROR, DBG_CELLID,cell->cellId,"CRNTI:%d does not exist", 
                      lcInfo->crnti);
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    /* Store the sps-rnti and SPS LC information in the UE */ 
@@ -1052,10 +1033,10 @@ RgInfSpsLcInfo *lcInfo;
    {
       RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,
                    "Ue insertion into SPS list failed SPS CRNTI:%d", ue->spsRnti);
-      RETVALUE(RFAILED);
+      return RFAILED;
    } 
 
-   RETVALUE(ROK)
+   return ROK
 } /* end of RgSchMacSpsLcRegReq */
 
 
@@ -1111,13 +1092,13 @@ CmLteRnti      crnti;
    {
       
       RLOG_ARG0(L_ERROR,DBG_CELLID,cellId, "Cell does not exist ");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, crnti)) == NULLP)
    {
       RLOG_ARG1(L_ERROR, DBG_CELLID,cellId,"CRNTI:%d Ue does not exist", crnti);
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    /* No need to reset the SPS LC Ids as they will not be looked at*/
@@ -1125,7 +1106,7 @@ CmLteRnti      crnti;
    /* Delete UE from the SPS UE List */
    rgDBMDelSpsUeCb(cell, ue);
    
-   RETVALUE(ROK)
+   return ROK
 } /* end of RgSchMacSpsLcDeregReq */
 
 #endif /* LTEMAC_SPS */
@@ -1178,7 +1159,7 @@ CmLteRnti       newRnti;
       RLOG_ARG4(L_ERROR,DBG_CELLID,cell->cellId,
                        "RNTI:%d Failed to get UECB[%lu:%lu] or NEW RNTI:%d", 
                rnti, ((PTR)ue), ((PTR)newUe), newRnti);
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 #ifdef XEON_SPECIFIC_CHANGES
    CM_LOG_DEBUG(CM_LOG_ID_MAC, "MAC:UE[%d] id changed to %d\n", rnti, newRnti);
@@ -1199,7 +1180,7 @@ CmLteRnti       newRnti;
    rgDBMDelUeCbFromRachLst(cell, newUe);
    rgFreeSBuf(inst,(Data **)&newUe, sizeof(*newUe));
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of rgUtlHndlCrntiChng */
 
 #ifdef LTE_ADV
@@ -1258,7 +1239,7 @@ RgUeCb        *ue;
       } /* loop of if */
    } /* loop of for */
 
-   RETVALUE(ROK);
+   return ROK;
 } /* rgDelUeFrmAllSCell */
 
 /**
@@ -1313,7 +1294,7 @@ PUBLIC S16 rgUtlVltdAddSCellCfg(ueSCellCb, cell, inst)
      ret = RFAILED;
    }
 #endif
-   RETVALUE(ret);
+   return (ret);
 } /* rgUtlVltdAddSCellCfg */
 
 /**
@@ -1366,7 +1347,7 @@ TfuDelDatReqInfo delDatReq;
    {
       RGDBGERRNEW(inst,(rgPBuf(inst),"[%d]RNTI:Failed to get ueCb \
                newRnti=%d\n", rnti, newRnti));
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    /* For all added SCells, prepare and send ueIdChngReq */
    for(idx = 0; idx < RG_MAX_SCELL_PER_UE ; idx++)
@@ -1398,7 +1379,7 @@ TfuDelDatReqInfo delDatReq;
       } /* loop of if */
    } /* loop of for */
 
-   RETVALUE(ROK);
+   return ROK;
 } /* rgUtlSndCrntiChngReq2AllSMacs */
 
 #endif /* LTE_ADV */
@@ -1536,7 +1517,7 @@ TfuDelDatReqInfo delDatReq;
 
    if(NULLP == rlsRnti)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if((cell == NULLP) ||
@@ -1546,7 +1527,7 @@ TfuDelDatReqInfo delDatReq;
       RLOG_ARG1(L_ERROR,DBG_CELLID,rlsRnti->cellId,
                "No cellCb found with cellId for RNTI:%d", 
                         rlsRnti->rnti);
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    /* Fix : syed Clearing UE context when SCH indicates to do so
     * UE DEL from CRG interface is now dummy. */
@@ -1560,7 +1541,7 @@ TfuDelDatReqInfo delDatReq;
          RLOG_ARG2(L_ERROR,DBG_CELLID,rlsRnti->cellId,
                        "CRNTI change failed for RNTI:%d new RNTI:%d",
                    rlsRnti->rnti,rlsRnti->newRnti);
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
 
 #ifdef LTE_ADV
@@ -1570,7 +1551,7 @@ TfuDelDatReqInfo delDatReq;
       if(rgUtlSndCrntiChngReq2AllSMacs(cell, rlsRnti->rnti, rlsRnti->newRnti) != ROK)
       {
          /* TODO: do we need to send DelInd to SCH in failure case*/ 
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
 #endif
 #ifdef L2_OPTMZ
@@ -1601,7 +1582,7 @@ TfuDelDatReqInfo delDatReq;
 #endif
    }
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of RgSchMacRlsRntiReq */
 
 #ifdef L2_OPTMZ
@@ -1617,7 +1598,7 @@ PUBLIC Bool RgUtlIsTbMuxed()
 {
    MsgLen len = 0;
    SFndLenMsg(tb->macHdr, &len);
-   RETVALUE(len?TRUE : FALSE);
+   return (len?TRUE : FALSE);
 }
 #endif