Replaced old SSI function with new macros jira id - ODUHIGH-212
[o-du/l2.git] / src / 5gnrmac / rg_dhm.c
index e387cb8..211e7f8 100755 (executable)
@@ -36,49 +36,30 @@ static const char* RLOG_MODULE_NAME="MAC";
 static int RLOG_FILE_ID=279;
 static int RLOG_MODULE_ID=4096;
 /* header include files -- defines (.h) */
-#include "envopt.h"        /* environment options */
-#include "envdep.h"        /* environment dependent */
-#include "envind.h"        /* environment independent */
-#include "gen.h"           /* general layer */
-#include "ssi.h"           /* system service interface */
+#include "common_def.h"
 #ifdef L2_OPTMZ
 #include "ss_strm.h"
 #endif
-#include "cm5.h"           /* common timers */
-#include "cm_hash.h"       /* common hash list */
-#include "cm_mblk.h"       /* common memory link list library */
-#include "cm_llist.h"      /* common linked list library */
-#include "cm_err.h"        /* common error */
-#include "cm_lte.h"        /* common LTE */
 #include "lrg.h"
 #include "crg.h"
-#include "rgu.h"
 #include "tfu.h"
+#include "rgu.h"
 #include "rg_sch_inf.h"
 #include "rg_env.h"
 #include "rg_err.h"
 #include "rg.h"
+#include "du_app_mac_inf.h"
 
 /* header/extern include files (.x) */
-#include "gen.x"           /* general layer */
-#include "ssi.x"           /* system service interface */
 #ifdef L2_OPTMZ
 #include "ss_strm.x"
 #endif
-#include "cm5.x"           /* common timers */
-#include "cm_lib.x"        /* common library */
-#include "cm_hash.x"       /* common hash list */
-#include "cm_llist.x"      /* common linked list library */
-#include "cm_mblk.x"       /* memory management */
-#include "cm_tkns.x"       /* common tokens */
-#include "cm_lte.x"        /* common LTE */
 #include "lrg.x"
 #include "crg.x"
-#include "rgu.x"
 #include "tfu.x"
+#include "rgu.x"
 #include "rg_sch_inf.x"
 #include "rg_prg.x"        /* PRG interface typedefs */
-#include "du_app_mac_inf.h"
 #include "rg.x"
 
 #ifdef L2_OPTMZ
@@ -163,7 +144,7 @@ U8                 maxHqProcs;
             rgFreeSBuf(inst,(Data **)&(hqE->procs[idx1]), sizeof(RgDlHqProcCb));
          }
          RLOG0(L_ERROR, "Memory Alloc Failure for RgDlHqProcCb");        
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
 
       hqE->procs[idx1]->procId      = idx1;
@@ -199,7 +180,7 @@ U8                 maxHqProcs;
    }
 
 
-   RETVALUE(ROK);
+   return ROK;
 } /* rgDHMHqEntInit */
 
 /**
@@ -411,7 +392,7 @@ U8                   tbIndex;
    if((tbIndex > RG_MAX_TB_PER_UE) ||
       (tbIndex == 0))
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    hqP->tbInfo[tbIndex-1].numSchLch = 0;
@@ -457,7 +438,7 @@ U8                   tbIndex;
    hqP->tbInfo[tbIndex-1].contResCe = NOTPRSNT;
    hqP->tbInfo[tbIndex-1].contResId = NULLP;
 
-   RETVALUE(ROK);
+   return ROK;
 } /* rgDHMRlsHqProc */
 
 /**
@@ -496,7 +477,7 @@ RgDlHqProcCb         **hqP;
    /* Pick the proc based on the index provided */
    *hqP = (ue->dl.hqEnt.procs[idx]);
 
-   RETVALUE(ROK);
+   return ROK;
 } /* rgDHMGetHqProcFrmId */
 
 /*PRIVATE U32 dataAvl; */
@@ -583,7 +564,7 @@ RgErrInfo       *err;
                /* Data not received but ta needs to be sent. */
                /* MUX TA and send it */
                bldPdu.datReq    =  NULLP;
-               bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
+               //bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
                bldPdu.schdTbSz  =  hqP->tbInfo[i].tbSz;
                bldPdu.ta        =  hqP->tbInfo[i].schdTa;
 #ifdef LTE_ADV
@@ -599,7 +580,7 @@ RgErrInfo       *err;
                   hqP->tbInfo[i].timingInfo.slot, hqP->procId, 
                   hqP->tbInfo[i].pdcch.rnti);
 
-                  RETVALUE(RFAILED);
+                  return RFAILED;
                }
             }
             else   
@@ -607,7 +588,7 @@ RgErrInfo       *err;
 #ifdef LTEMAC_RGU_PAD
                /* Data not received from RLC. Padding at MAC */
                bldPdu.datReq    =  NULLP;
-               bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
+               //bldPdu.reqType   =  EVENT_SLOT_IND_TO_MAC;
                bldPdu.schdTbSz  =  hqP->tbInfo[i].tbSz;
                bldPdu.ta        =  hqP->tbInfo[i].schdTa;
 #ifdef LTE_ADV
@@ -624,7 +605,7 @@ RgErrInfo       *err;
                   hqP->tbInfo[i].timingInfo.slot, hqP->procId, 
                   hqP->tbInfo[i].pdcch.rnti);
                   
-                  RETVALUE(RFAILED);
+                  return RFAILED;
                }
 #else
                /*Padding is not done so data for this UE will not be
@@ -654,13 +635,13 @@ RgErrInfo       *err;
          rgDHMRlsHqProcTB(cellCb, hqP, 2);
       }
       
-      RETVALUE(ROK);
+      return ROK;
    }
 
    if (rgGetEventMem(inst,(Ptr *)&datReq, sizeof(TfuDatReqPduInfo),
             &(datInfo->memCp)) != ROK)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    /* Fill the TFU Dat Req with information from Harq Proc */
   
@@ -681,7 +662,7 @@ RgErrInfo       *err;
    cmLListAdd2Tail(&datInfo->pdus, &(datReq->lnk));
    datReq->lnk.node = (PTR)datReq;
 
-   RETVALUE(ROK);
+   return ROK;
 }  /* rgDHMSndDatReq */
 
 /**
@@ -749,7 +730,7 @@ RgErrInfo      *err;
          } 
          rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
       }
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    for(i=0;i<datReq->nmbOfTbs;i++)
@@ -773,7 +754,7 @@ RgErrInfo      *err;
             rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
             printf("\nrgDHMHndlDedDatReq:: hqP %p \n", (Void *)hqProc);
          }
-         RETVALUE(RFAILED);
+         return RFAILED;
 
       }
 #ifndef L2_OPTMZ
@@ -821,13 +802,13 @@ RgErrInfo      *err;
             }
             rgDHMRlsHqProcTB(rgCb[inst].cell, hqProc, (U8)(j+1));
          }
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
       /*
       SFndLenMsg(hqProc->tbInfo[i].tb, &len);
       */
    }
-   RETVALUE(ROK);
+   return ROK;
 }  /* rgDHMHndlDedDatReq */
 
 /**
@@ -882,7 +863,7 @@ RgErrInfo      *err;
          rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_HARQ); 
          rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
                LRG_CAUSE_HQ_PROC_BUSY, &dgn);
-         RETVALUE(RFAILED);
+         return RFAILED;
       }
 
    bldPdu.datReq    =  datReq;
@@ -904,10 +885,10 @@ RgErrInfo      *err;
             hqProc->tbInfo[0].pdcch.rnti);
 
       RG_FREE_MSG(datReq->pdu);
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
-   RETVALUE(ROK);
+   return ROK;
 }  /* rgDHMHndlCmnDatReq */
 
 /**
@@ -1142,7 +1123,7 @@ RgErrInfo       *err;
                {
                   err->errType  = RGERR_DHM_SND_STA_IND;
                   err->errCause = RG_DHM_MEM_ALLOC_FAIL;
-                  RETVALUE(RFAILED)
+                  return RFAILED
                }
             }
 
@@ -1191,7 +1172,7 @@ RgErrInfo       *err;
                   err->errType  = RGERR_DHM_SND_STA_IND;
                   err->errCause = RG_DHM_MEM_ALLOC_FAIL;
                   /* Need to return as memory allocation will fail for other UEs also*/
-                  RETVALUE(RFAILED);
+                  return RFAILED;
                }
                dStaInd[rguDlSpId]->nmbOfUeGrantPerTti = 0;
                rguDlSap[rguDlSpId] = ue->rguDlSap;
@@ -1280,7 +1261,7 @@ RgErrInfo       *err;
       }
 
    }
-   RETVALUE(ROK);
+   return ROK;
 }  /* rgDHMSndConsolidatedStaInd */
 
 
@@ -1490,7 +1471,7 @@ U8                   tbIndex;
    if((tbIndex > RG_MAX_TB_PER_UE) ||
       (tbIndex == 0))
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    tb = &(hqP->tbInfo[tbIndex-1].tb);
@@ -1508,7 +1489,7 @@ U8                   tbIndex;
    }
       hqP->tbInfo[tbIndex-1].sfLnkInfo[idx].sf = NULLP;
    }
-   RETVALUE(ROK);
+   return ROK;
 }
 #endif
 
@@ -1610,19 +1591,19 @@ RgInfResetHqEnt*     hqEntInfo;
    {
       RGDBGERRNEW(inst,(rgPBuf(inst), "For user [%d]Cell does not exist %d\n",
                 hqEntInfo->crnti,hqEntInfo->cellId));
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if ((ue = rgDBMGetUeCb(cell, hqEntInfo->crnti)) == NULLP)
    {
       RGDBGERRNEW(inst,(rgPBuf(inst), "[%d]UE does not exist for this hqEntInfo\n",
                        hqEntInfo->crnti));
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    rgDHMUeReset(cell, &ue->dl.hqEnt);
 
-   RETVALUE(ROK);
+   return ROK;
 }
 U32 gSaveVal;
 \f
@@ -1679,7 +1660,7 @@ RgInfRlsHqInfo      *rlshqUeInfo;
 
    if(NULLP == rlshqUeInfo)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if((cell  == NULLP)
@@ -1688,12 +1669,12 @@ RgInfRlsHqInfo      *rlshqUeInfo;
        
       RLOG_ARG0(L_ERROR,DBG_CELLID,rlshqUeInfo->cellId,
                 "No cellCb found with cellId");
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    if(NULLP == rlshqUeInfo->ueHqInfo)
    {
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 
    for(idx1 = 0; idx1 < rlshqUeInfo->numUes; idx1++)
@@ -1802,7 +1783,7 @@ RgInfRlsHqInfo      *rlshqUeInfo;
    /*starting Task*/
    SStopTask(startTime,PID_MAC_AM_HARQ_RLS);
 
-   RETVALUE(ROK);
+   return ROK;
 } /* end of RgSchMacRlsHqReq */