Merge "Part -6 Classification of log [JIRA-ID ODUHIGH-275]"
[o-du/l2.git] / src / 5gnrrlc / rlc_msg_hdl.c
index e7085d0..1b06379 100644 (file)
@@ -109,23 +109,23 @@ void fillEntModeAndDir(uint8_t *entMode, uint8_t *direction, RlcMode rlcMode)
    switch(rlcMode)
    {
       case RLC_AM:
-         *entMode   = CM_LTE_MODE_AM;
+         *entMode   = RLC_MODE_AM;
          *direction = RLC_CFG_DIR_BOTH;
          break;
       case RLC_UM_BI_DIRECTIONAL:
-         *entMode = CM_LTE_MODE_UM;
+         *entMode = RLC_MODE_UM;
          *direction = RLC_CFG_DIR_BOTH;
          break;
       case RLC_UM_UNI_DIRECTIONAL_UL:
-         *entMode = CM_LTE_MODE_UM;
+         *entMode = RLC_MODE_UM;
          *direction = RLC_CFG_DIR_UL;
          break;
       case RLC_UM_UNI_DIRECTIONAL_DL:
-         *entMode = CM_LTE_MODE_UM;
+         *entMode = RLC_MODE_UM;
          *direction = RLC_CFG_DIR_DL;
          break;
       default : 
-         DU_LOG("\nRLC: Rlc Mode invalid %d", rlcMode);
+         DU_LOG("\nERROR  -->  RLC: Rlc Mode invalid %d", rlcMode);
     break;
    }
 }
@@ -161,7 +161,7 @@ void fillLcCfg(RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg, uint8_t cfgTyp
    switch(rlcUeCfg->entMode)
    {
 
-      case CM_LTE_MODE_AM:
+      case RLC_MODE_AM:
          {
             /* DL AM INFO */
             rlcUeCfg->m.amInfo.dl.snLen       = duRlcUeCfg->u.amCfg->dlAmCfg.snLenDl; 
@@ -176,14 +176,14 @@ void fillLcCfg(RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg, uint8_t cfgTyp
             rlcUeCfg->lCh[lChRbIdx].type     = duRlcUeCfg->lcType;
             rlcUeCfg->m.amInfo.ul.snLen      = duRlcUeCfg->u.amCfg->ulAmCfg.snLenUl; 
             rlcUeCfg->m.amInfo.ul.staProhTmr = duRlcUeCfg->u.amCfg->ulAmCfg.statProhTmr;
-            rlcUeCfg->m.amInfo.ul.reOrdTmr   = duRlcUeCfg->u.amCfg->ulAmCfg.reAssemTmr;
+            rlcUeCfg->m.amInfo.ul.reOrdTmr   = duRlcUeCfg->u.amCfg->ulAmCfg.reAssemTmr * RLC_REASSEMBLY_TMR_BASE;
             break;
          }
-      case CM_LTE_MODE_UM:
+      case RLC_MODE_UM:
          {
             /* UL UM CONFIG */
-            rlcUeCfg->m.umInfo.ul.snLen    = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm; 
-            rlcUeCfg->m.umInfo.ul.reOrdTmr = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr;
+            rlcUeCfg->m.umInfo.ul.snLen      = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm; 
+            rlcUeCfg->m.umInfo.ul.reAsmblTmr = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr * RLC_REASSEMBLY_TMR_BASE;
 
             /* DL UM CONFIG */
             rlcUeCfg->m.umInfo.dl.snLen = duRlcUeCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm; 
@@ -254,7 +254,7 @@ uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
    RLC_ALLOC(rlcUeCb, rlcUeCfg, sizeof(RlcCfgInfo));
    if(rlcUeCfg == NULLP)
    {
-      DU_LOG("\nRLC: Failed to allocate memory at RlcProcUeCreateReq()");
+      DU_LOG("\nERROR  -->  RLC: Failed to allocate memory at RlcProcUeCreateReq()");
       ret = RFAILED;
    }
    else
@@ -263,7 +263,7 @@ uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
       fillRlcCfg(rlcUeCfg, ueCfg); 
       ret = RlcProcCfgReq(pst, rlcUeCfg);
       if(ret != ROK)
-         DU_LOG("\nRLC: Failed to configure Add/Mod/Del entities at RlcProcUeCreateReq()");
+         DU_LOG("\nERROR  -->  RLC: Failed to configure Add/Mod/Del entities at RlcProcUeCreateReq()");
 
    }
    RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));
@@ -289,7 +289,7 @@ uint8_t BuildAndSendRrcDeliveryReportToDu( RlcDlRrcMsgInfo *dlRrcMsgInfo )
     Pst             pst;
     RrcDeliveryReport *rrcDelivery;
 
-    DU_LOG("\nRLC : Filling the RRC Delivery Report");
+    DU_LOG("\nINFO  -->  RLC : Filling RRC Delivery Report");
     RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, rrcDelivery, sizeof(RrcDeliveryReport));
 
     if(rrcDelivery)
@@ -307,7 +307,7 @@ uint8_t BuildAndSendRrcDeliveryReportToDu( RlcDlRrcMsgInfo *dlRrcMsgInfo )
     }
     else
     {
-       DU_LOG("\nRLC : Memory allocation failed");
+       DU_LOG("\nERROR  -->  RLC : Memory allocation failed");
     }
 
    return ROK;
@@ -336,7 +336,7 @@ uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
    RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo));
    if(!datReqInfo)
    {
-      DU_LOG("\nRLC : Memory allocation failed in RlcProcDlRrcMsgTransfer");
+      DU_LOG("\nERROR  -->  RLC : Memory allocation failed in RlcProcDlRrcMsgTransfer");
       RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
       RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
       return RFAILED;
@@ -352,7 +352,7 @@ uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
    /* Copy fixed buffer to message */
    if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &mBuf) != ROK)
    {
-      DU_LOG("\nRLC : Memory allocation failed at RlcMacProcUlData");
+      DU_LOG("\nERROR  -->  RLC : Memory allocation failed at RlcMacProcUlData");
       RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo));
       RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
       RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
@@ -360,7 +360,10 @@ uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
    }
    oduCpyFixBufToMsg(dlRrcMsgInfo->rrcMsg, mBuf, dlRrcMsgInfo->msgLen);
 
-   rlcProcDlData(pst, datReqInfo, mBuf);
+   if(rlcProcDlData(pst, datReqInfo, mBuf) != ROK)
+   {
+      return RFAILED;
+   }
 
    /* RRC Delivery report is only send when RRC Delivery status report is true in DL RRC Message */
    if(dlRrcMsgInfo->deliveryStaRpt)
@@ -396,16 +399,16 @@ uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
 uint8_t RlcProcUlData(Pst *pst, RlcData *ulData)
 {
    uint8_t         ret = ROK;
-   uint8_t              idx, pduIdx;
-   uint8_t              lcId;                    /* Logical Channel */
-   uint8_t              numDLch = 0;             /* Number of dedicated logical channel */
+   uint8_t         idx, pduIdx;
+   uint8_t         lcId;                    /* Logical Channel */
+   uint8_t         numDLch = 0;             /* Number of dedicated logical channel */
    bool            dLchPduPres;             /* PDU received on dedicated logical channel */
-   RguLchDatInd    dLchData[MAX_NUM_LC];  /* PDU info on dedicated logical channel */
-   RguDDatIndInfo  *dLchUlDat;               /* UL data on dedicated logical channel */
-   RguCDatIndInfo  *cLchUlDat;               /* UL data on common logical channel */
+   RguLchDatInd    dLchData[MAX_NUM_LC];    /* PDU info on dedicated logical channel */
+   RguDDatIndInfo  *dLchUlDat;              /* UL data on dedicated logical channel */
+   RguCDatIndInfo  *cLchUlDat;              /* UL data on common logical channel */
 
    /* Initializing dedicated logical channel Database */
-   DU_LOG("\nRLC: Received UL Data request from MAC");
+   DU_LOG("\nDEBUG  -->  RLC: Received UL Data request from MAC");
    for(idx = 0; idx < MAX_NUM_LC; idx++)
    {
       dLchData[idx].lcId = idx;
@@ -423,7 +426,7 @@ uint8_t RlcProcUlData(Pst *pst, RlcData *ulData)
            sizeof(RguCDatIndInfo));
         if(!cLchUlDat)
         {
-           DU_LOG("\nRLC : Memory allocation failed at RlcProcUlData");
+           DU_LOG("\nERROR  -->  RLC : Memory allocation failed at RlcProcUlData");
            ret = RFAILED;
            break;
         }
@@ -436,7 +439,7 @@ uint8_t RlcProcUlData(Pst *pst, RlcData *ulData)
          /* Copy fixed buffer to message */
          if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &cLchUlDat->pdu) != ROK)
          {
-            DU_LOG("\nRLC : Memory allocation failed at RlcProcUlData");
+            DU_LOG("\nERROR  -->  RLC : Memory allocation failed at RlcProcUlData");
            RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, cLchUlDat, \
               sizeof(RguCDatIndInfo));
             ret = RFAILED;
@@ -455,7 +458,7 @@ uint8_t RlcProcUlData(Pst *pst, RlcData *ulData)
               sizeof(RguDDatIndInfo));
            if(!dLchUlDat)
            {
-              DU_LOG("\nRLC : Memory allocation failed at RlcMacProcUlData");
+              DU_LOG("\nERROR  -->  RLC : Memory allocation failed at RlcMacProcUlData");
               ret = RFAILED;
               break;
            }
@@ -467,7 +470,7 @@ uint8_t RlcProcUlData(Pst *pst, RlcData *ulData)
         if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, \
                  &dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]) != ROK)
         {
-           DU_LOG("\nRLC : Memory allocation failed at RlcMacProcUlData");
+           DU_LOG("\nERROR  -->  RLC : Memory allocation failed at RlcMacProcUlData");
            for(pduIdx=0; pduIdx < dLchData[lcId].pdu.numPdu; pduIdx++)
            {
               ODU_PUT_MSG_BUF(dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]);
@@ -492,7 +495,7 @@ uint8_t RlcProcUlData(Pst *pst, RlcData *ulData)
       if(dLchPduPres)
       {
         dLchUlDat->cellId = ulData->cellId;
-        dLchUlDat->rnti   = ulData->rnti;
+        GET_UE_IDX(ulData->rnti, dLchUlDat->rnti);
 
         for(idx = 0; idx < MAX_NUM_LC; idx++)
         {
@@ -543,7 +546,7 @@ uint8_t RlcProcSchedResultRpt(Pst *pst, RlcSchedResultRpt *schRep)
    RguCStaIndInfo   *cLchSchInfo;    /* Common logical channel scheduling result */
    RguDStaIndInfo   *dLchSchInfo;  /* Dedicated logical channel scheduling result */
 
-   DU_LOG("\nRLC : Received scheduling report from MAC");
+   DU_LOG("\nDEBUG  -->  RLC : Received scheduling report from MAC");
    for(idx=0; idx < schRep->numLc; idx++)
    {
       /* If it is common channel, fill status indication information
@@ -554,7 +557,7 @@ uint8_t RlcProcSchedResultRpt(Pst *pst, RlcSchedResultRpt *schRep)
             sizeof(RguCStaIndInfo));
          if(!cLchSchInfo)
          {
-            DU_LOG("\nRLC: RlcProcSchedResultRpt: Memory allocation failed for cLchSchInfo");
+            DU_LOG("\nERROR  -->  RLC: RlcProcSchedResultRpt: Memory allocation failed for cLchSchInfo");
             ret = RFAILED;
             break;
          }
@@ -578,7 +581,7 @@ uint8_t RlcProcSchedResultRpt(Pst *pst, RlcSchedResultRpt *schRep)
                sizeof(RguDStaIndInfo));
              if(!dLchSchInfo)
              {
-                DU_LOG("\nRLC: RlcProcSchedResultRpt: Memory allocation failed for dLchSchInfo");
+                DU_LOG("\nERROR  -->  RLC: RlcProcSchedResultRpt: Memory allocation failed for dLchSchInfo");
                 ret = RFAILED;
                 break;
              }
@@ -644,13 +647,13 @@ uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg)
    RlcCfgInfo *rlcUeCfg = NULLP; //Seed code Rlc cfg struct
    RlcCb *rlcUeCb = NULLP;
     
-   DU_LOG("\nRLC: UE reconfig request received. CellID[%d] UEIDX[%d]",ueCfg->cellId, ueCfg->ueIdx);
+   DU_LOG("\nDEBUG  -->  RLC: UE reconfig request received. CellID[%d] UEIDX[%d]",ueCfg->cellId, ueCfg->ueIdx);
 
    rlcUeCb = RLC_GET_RLCCB(pst->dstInst);
    RLC_ALLOC(rlcUeCb, rlcUeCfg, sizeof(RlcCfgInfo));
    if(rlcUeCfg == NULLP)
    {
-      DU_LOG("\nRLC: Failed to allocate memory at RlcProcUeReconfigReq()");
+      DU_LOG("\nERROR  -->  RLC: Failed to allocate memory at RlcProcUeReconfigReq()");
       ret = RFAILED;
    }
    else
@@ -659,7 +662,7 @@ uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg)
       fillRlcCfg(rlcUeCfg, ueCfg);
       ret = RlcProcCfgReq(pst, rlcUeCfg);
       if(ret != ROK)
-         DU_LOG("\nRLC: Failed to configure Add/Mod/Del entities at RlcProcUeReconfigReq()");
+         DU_LOG("\nERROR  -->  RLC: Failed to configure Add/Mod/Del entities at RlcProcUeReconfigReq()");
    }
    
    RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));