[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-501] Ue Create and Rsp correction in DUAPP...
[o-du/l2.git] / src / du_app / du_ue_mgr.c
index 914b07d..769f4e9 100644 (file)
 #include "CmInterface.h"
 #endif
 
+DuRlcUeReestablishReq packRlcUeReestablishReqOpts[] =
+{
+   packDuRlcUeReestablishReq,       /* Loose coupling */
+   RlcProcUeReestablishReq,         /* TIght coupling */
+   packDuRlcUeReestablishReq        /* Light weight-loose coupling */
+};
+
 DuMacDlCcchInd packMacDlCcchIndOpts[] =
 {
    packMacDlCcchInd,           /* Loose coupling */
@@ -116,6 +123,61 @@ DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] =
    packDuRlcUeDeleteReq        /* Light weight-loose coupling */
 };
 
+DuMacUeResetReq packMacUeResetReqOpts[] =
+{
+   packDuMacUeResetReq,       /* Loose coupling */
+   MacProcUeResetReq,         /* TIght coupling */
+   packDuMacUeResetReq        /* Light weight-loose coupling */
+};
+
+/*******************************************************************
+ *
+ * @brief Processes UE's max retransmission information received from RLC 
+ *
+ * @details
+ *
+ *    Function : DuProcRlcMaxRetransInd
+ *
+ *    Functionality:
+ *     Processes max retransmission reached information received from RLC 
+ *
+ *  @params[in]  Post structure
+ *               Pointer to RlcMaxRetransInfo
+ *  @return ROK     - success
+ *          RFAILED - failure
+ *
+ * *****************************************************************/
+
+uint8_t DuProcRlcMaxRetransInd(Pst *pst, RlcMaxRetransInfo *maxRetransInfo)
+{
+   uint8_t  ueId = 0, ret = RFAILED;
+   uint16_t cellIdx = 0,crnti=0;
+
+   if(maxRetransInfo)
+   {
+      GET_CELL_IDX(maxRetransInfo->cellId, cellIdx);
+
+      if(duCb.actvCellLst[cellIdx]!=NULLP)
+      {
+         ueId = maxRetransInfo->ueId;
+         GET_CRNTI(crnti, ueId);
+         if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti ==  crnti)
+         {
+            /*TODO: complete the processing of max retransmission */
+            ret = ROK;
+         }
+         else
+            DU_LOG("\nERROR  -->  DU APP : DuProcRlcMaxRetransInd(): CRNTI [%d] not found", crnti);
+      }
+      else
+         DU_LOG("\nERROR  -->  DU APP : DuProcRlcMaxRetransInd(): Cell Id[%d] is not found", maxRetransInfo->cellId);
+      
+      DU_FREE_SHRABL_BUF(pst->region, pst->pool, maxRetransInfo, sizeof(RlcMaxRetransInfo));
+
+   }
+   return ret;
+}
+
 /******************************************************************
  *
  * @brief Function to return Drb LcId
@@ -272,7 +334,7 @@ uint8_t duHdlEgtpDlData(EgtpMsg  *egtpMsg)
     DU_LOG("\nCall Flow: ENTEGTP -> ENTDUAPP : EVENT_HDL_RECV_DL_DATA\n");
 #endif
 
-   DU_LOG("\nDEBUG  --> DU_APP : Processing DL data in duHdlEgtpDlData()");
+   DU_LOG("\nDEBUG  -->  DU_APP : Processing DL data in duHdlEgtpDlData()");
    
    if(!egtpMsg->msg)
    {
@@ -431,7 +493,7 @@ uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, DuRlcUeCfg ueCfg, F1DlRrcMs
 
    /* Filling post structure and sending msg */ 
    FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_TRANS_TO_RLC);
-   DU_LOG("\nDEBUG   -->  DU_APP: Sending Dl RRC Msg to RLC \n");
+   DU_LOG("\nDEBUG  -->  DU_APP: Sending Dl RRC Msg to RLC \n");
    ret = (*duSendDlRrcMsgToRlcOpts[pst.selector])(&pst, dlRrcMsgInfo);
    if(ret != ROK)
    {
@@ -1602,7 +1664,7 @@ uint8_t fillRlcSrb1LcCfg(DuRlcBearerCfg *rlcLcCfg)
  *    Functionality: 
  *     Processes UE Reconfig Req to RLC UL
  * 
- *  @params[in]     Pointer to RlcUeCfg
+ *  @params[in]     Pointer to RlcUeRecfg
  *  @return ROK     - success
  *          RFAILED - failure
  * 
@@ -1627,7 +1689,7 @@ uint8_t sendUeRecfgReqToRlc(RlcUeRecfg *rlcUeRecfg)
    }
    else
    {
-      DU_LOG("\nERROR  -->   DU_APP: Received RlcUeCfg is NULL at sendUeRecfgReqToRlc()");
+      DU_LOG("\nERROR  -->   DU_APP: Received RlcUeRecfg is NULL at sendUeRecfgReqToRlc()");
       ret = RFAILED;
    }
    return ret;
@@ -1822,7 +1884,7 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
 
 /**********************************************************************************
  *
- * @brief Fills Ue Cfg from DU DB to MacUeCfg
+ * @brief Fills Ue Cfg from DU DB to MacUeCreateReq
  *
  * @details
  *
@@ -1831,12 +1893,12 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
  *    Functionality: fills ue Cfg to be sent to MAC
  *
  * @params[in] DuMacUeCfg Pointer
- *             MacUeCfg Pointer
+ *             MacUeCreateReq Pointer
  *
  * @return ROK     - success
  *         RFAILED - failure
  * *******************************************************************************/
-void fillMacUeCfg(DuMacUeCfg *duMacUeCfg, MacUeCfg *macUeCfg)
+void fillMacUeCfg(DuMacUeCfg *duMacUeCfg, MacUeCreateReq *macUeCfg)
 {
    uint8_t lcIdx = 0;
 
@@ -1909,12 +1971,12 @@ void fillMacUeCfg(DuMacUeCfg *duMacUeCfg, MacUeCfg *macUeCfg)
  *    Functionality: fills ue Cfg to be sent to RLC
  *
  * @params[in] DuRlcUeCfg Pointer
- *             RlcUeCfg Pointer
+ *             RlcUeCreate Pointer
  *
  * @return ROK     - success
  *         RFAILED - failure
  * *******************************************************************************/
-void fillRlcUeCfg(DuRlcUeCfg *duRlcUeCfg, RlcUeCfg *rlcUeCfg)
+void fillRlcUeCfg(DuRlcUeCfg *duRlcUeCfg, RlcUeCreate *rlcUeCfg)
 {
    uint8_t lcIdx = 0;
 
@@ -1956,7 +2018,7 @@ void fillRlcUeCfg(DuRlcUeCfg *duRlcUeCfg, RlcUeCfg *rlcUeCfg)
 uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, DuMacUeCfg *duMacUeCfg)
 {
    uint8_t  ret = ROK;
-   MacUeCfg *macUeCfg = NULLP;
+   MacUeCreateReq *macUeCfg = NULLP;
    Pst       pst;
    memset(&pst, 0, sizeof(Pst));
 
@@ -1972,10 +2034,10 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, u
    FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
 
    /* Copying ueCb to a sharable buffer */
-   DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
+   DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCreateReq));
    if(macUeCfg)
    {
-      memset(macUeCfg, 0, sizeof(MacUeCfg));
+      memset(macUeCfg, 0, sizeof(MacUeCreateReq));
       fillMacUeCfg(duMacUeCfg, macUeCfg); 
       DU_LOG("\nDEBUG   -->  DU_APP: Sending UE create request to MAC");
 
@@ -1984,7 +2046,7 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, u
       if(ret == RFAILED)
       {
          DU_LOG("\nERROR  -->  DU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()");
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCreateReq));
       }
    }
    else
@@ -2674,20 +2736,20 @@ uint8_t duUpdateDuUeCbCfg(uint8_t ueId, uint8_t cellId)
 
 /*******************************************************************
  *
- * @brief Handle UE config response from MAC
+ * @brief Handle UE create response from MAC
  *
  * @details
  *
- *    Function : DuProcMacUeCfgRsp
+ *    Function : DuProcMacUeCreateRsp
  *
- *    Functionality: Handle UE Config response from MAC
+ *    Functionality: Handle UE Create response from MAC
  *
- * @params[in] Pointer to MacUeCfgRsp and Pst 
+ * @params[in] Pointer to MacUeCreateRsp and Pst 
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
+uint8_t DuProcMacUeCreateRsp(Pst *pst, MacUeCreateRsp *cfgRsp)
 {
    uint8_t ret = ROK;
    uint16_t cellIdx;
@@ -2716,14 +2778,14 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
                      if((duBuildAndSendRachRsrcReqToMac(cfgRsp->cellId, cfgRsp->ueId)) != ROK)
                      {
                         DU_LOG("\nERROR  --> DU APP : Failed to send RACH Resource Request to MAC");
-                        DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp));
+                        DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCreateRsp));
                         return RFAILED;
                      }
                   }
                   else
                   {
                      DU_LOG("\nERROR  ->  DU APP : Failure in updating DU UE CB");
-                     DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp));
+                     DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCreateRsp));
                      return RFAILED;
                   }
                }
@@ -2735,11 +2797,11 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
          DU_LOG("\nERROR  -->  DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [DU UE F1AP ID : %d]", pst->event, cfgRsp->ueId);
          ret = RFAILED;
       }
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp));
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCreateRsp));
    }
    else
    {
-      DU_LOG("\nERROR  -->  DU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCfgRsp()");
+      DU_LOG("\nERROR  -->  DU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCreateRsp()");
       ret = RFAILED;
    }
    return ret;
@@ -2831,7 +2893,7 @@ uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *reCfgRsp)
  * 
  *  @params[in]  cellId,
  *               ueId,
- *               Pointer to RlcUeCfg
+ *               Pointer to RlcUeCreate
  *  @return ROK     - success
  *          RFAILED - failure
  * 
@@ -2840,7 +2902,7 @@ uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *reCfgRsp)
 uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, DuUeCfg *ueCfgDb, DuRlcUeCfg *duRlcUeCfg)
 {
    uint8_t  ret = ROK;
-   RlcUeCfg *rlcUeCfg = NULLP;
+   RlcUeCreate *rlcUeCfg = NULLP;
    Pst       pst;
   
    ret = updateRlcUeCfg(cellId, gnbDuUeF1apId, ueCfgDb, duRlcUeCfg);
@@ -2852,10 +2914,10 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, D
 
    FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CREATE_REQ);
    /* Copying ueCfg to a sharable buffer */
-   DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
+   DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCreate));
    if(rlcUeCfg)
    {
-      memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
+      memset(rlcUeCfg, 0, sizeof(RlcUeCreate));
       fillRlcUeCfg(duRlcUeCfg, rlcUeCfg);
 
       /* Processing one Ue at a time to RLC */
@@ -2864,7 +2926,7 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, D
       if(ret == RFAILED)
       {
          DU_LOG("\nERROR  -->  DU_APP : Failure in sending Ue Create Req to RLC");
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCreate));
          ret = RFAILED;
       }
    }
@@ -2883,7 +2945,7 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, D
  * @details
  *
  
- *    Function : DuProcRlcUeCfgRsp
+ *    Function : DuProcRlcUeCreateRsp
  *
  *    Functionality: 
  *     Processes UE create Rsp received from RLC UL
@@ -2894,7 +2956,7 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, D
  *          RFAILED - failure
  * 
  *****************************************************************/
-uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
+uint8_t DuProcRlcUeCreateRsp(Pst *pst, RlcUeCreateRsp *cfgRsp)
 {
    uint8_t ret = ROK;
 
@@ -2918,20 +2980,62 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
                   if((duBuildAndSendRachRsrcReqToMac(cfgRsp->cellId, cfgRsp->ueId)) != ROK)
                   {
                      DU_LOG("\nERROR  --> DU APP : Failed to send RACH Resource Request to MAC");
-                     DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp));
-                     DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
+                     DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCreateRsp));
                      return RFAILED;
                   }
                }
                else
                {
                   DU_LOG("\nERROR  -->  DU APP : Failure in updating DU UE CB");
-                  DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
+                  DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCreateRsp));
                   return RFAILED;
                }
             }
          }
-         else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  DU_APP: RLC UE CREATE Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
+               pst->event, cfgRsp->ueId, cfgRsp->reason);
+         ret = RFAILED;
+      }
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCreateRsp));
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  DU_APP: Received RLC Ue Create Response is NULL at DuProcRlcUeCreateRsp()");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Processes UE reconfig Rsp received from RLC UL
+ *
+ * @details
+ *
+ *    Function : DuProcRlcUeReconfigRsp
+ *
+ *    Functionality: 
+ *     Processes UE reconfig Rsp received from RLC UL
+ * 
+ *  @params[in]  Post structure
+ *               Pointer to RlcCfgCfm
+ *  @return ROK     - success
+ *          RFAILED - failure
+ * 
+ *****************************************************************/
+uint8_t DuProcRlcUeReconfigRsp(Pst *pst, RlcUeReconfigRsp *cfgRsp)
+{
+   uint8_t ret = ROK;
+
+   if(cfgRsp)
+   {
+      if(cfgRsp->result == RLC_DU_APP_RSP_OK)
+      {
+         if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
          {
             DU_LOG("\nINFO   -->  DU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueId);
 
@@ -2944,14 +3048,14 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
                   if((BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId)) != ROK)
                   {
                      DU_LOG("\nERROR  -->  DU APP : Failure in BuildAndSendUeCtxtRsp");
-                     DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
+                     DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeReconfigRsp));
                      return RFAILED;
                   }
                }
                else
                {
                   DU_LOG("\nERROR  -->  DU APP : Failure in updating DU UE CB");
-                  DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
+                  DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeReconfigRsp));
                   return RFAILED;
                }
             }
@@ -2959,7 +3063,7 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
       }
       else
       {
-         DU_LOG("\nERROR  -->  DU_APP: RLC UE CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
+         DU_LOG("\nERROR  -->  DU_APP: RLC UE RE-CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
                pst->event, cfgRsp->ueId, cfgRsp->reason);
          if((pst->event == EVENT_RLC_UE_RECONFIG_RSP))
          {
@@ -2967,16 +3071,15 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
          }
          ret = RFAILED;
       }
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeReconfigRsp));
    }
    else
    {
-      DU_LOG("\nERROR  -->  DU_APP: Received RLC Ue Config Response is NULL at DuProcRlcUeCfgRsp()");
+      DU_LOG("\nERROR  -->  DU_APP: Received RLC Ue ReConfig Response is NULL at DuProcRlcUeReconfigRsp()");
       ret = RFAILED;
    }
    return ret;
 }
-
 /**********************************************************************************
  *
  * @brief Fills Ue ReCfg from DU DB to RlcUeRecfg
@@ -3040,7 +3143,7 @@ void fillRlcUeRecfg(DuRlcUeCfg *duRlcUeCfg, RlcUeRecfg *rlcUeRecfg)
  *
  * @params[in] cellId, crnti
  *             DuUeCfg *ueCfgDb
- *             RlcUeCfg *rlcUeCfg
+ *             RlcUeCreate *rlcUeCfg
  * @return ROK     - success
  *         RFAILED - failure
  *
@@ -3674,7 +3777,7 @@ uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
    
    if(deleteRsp)
    {
-      if(deleteRsp->result == DEL_SUCCESSFUL)
+      if(deleteRsp->status == SUCCESSFUL)
       {
          DU_LOG("\nINFO   -->  DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueId);
          GET_CELL_IDX(deleteRsp->cellId, cellIdx);
@@ -3739,7 +3842,7 @@ uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp)
       ueId = delRsp->ueId;
       GET_CELL_IDX(delRsp->cellId, cellIdx);
 
-      if(delRsp->result == SUCCESSFUL)
+      if(delRsp->status == SUCCESSFUL)
       {
          DU_LOG("\nINFO   -->  DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueId);
          if(duCb.actvCellLst[cellIdx]!=NULLP)
@@ -3909,16 +4012,16 @@ uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId, uint16_t crnti)
 
 /*******************************************************************
  *
- * @brief delete RlcUeCfg from duCb
+ * @brief delete RlcUeCreate from duCb
  *
  * @details
  *
  *    Function : deleteRlcUeCfg
  *
  *    Functionality:
- *       delete  RlcUeCfg from duCb
+ *       delete  RlcUeCreate from duCb
  *
- *  @params[in] RlcUeCfg *ueCfg 
+ *  @params[in] RlcUeCreate *ueCfg 
  *               
  *  @return ROK     - success
  *          RFAILED - failure
@@ -3959,7 +4062,7 @@ void deleteRlcUeCfg(DuRlcUeCfg *ueCfg)
          }
          DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
       }
-      memset(ueCfg, 0, sizeof(RlcUeCfg));
+      memset(ueCfg, 0, sizeof(DuRlcUeCfg));
    }
 }
 
@@ -4019,6 +4122,374 @@ uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb)
    return ret;
 }
 
+/*******************************************************************
+ *
+ * @brief Sending UE Reset Req To Mac
+*
+* @details
+*
+*    Function : sendUeResetReqToMac
+*
+*    Functionality:
+*     sending UE Reset Req To Mac
+*
+*  @params[in]    cellId, ueId, crnti 
+*  @return ROK     - success
+*          RFAILED - failure
+*
+*****************************************************************/
+
+uint8_t sendUeResetReqToMac(uint16_t cellId, uint8_t ueId)
+{
+   Pst pst;
+   uint8_t ret=ROK;
+   MacUeResetReq *ueReset = NULLP;
+
+   DU_ALLOC_SHRABL_BUF(ueReset, sizeof(MacUeResetReq));
+   if(ueReset)
+   {
+      ueReset->cellId = cellId;
+      ueReset->ueId   = ueId;
+      FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RESET_REQ);
+
+      DU_LOG("\nDEBUG  -->  DU_APP: Sending UE Reset Request to MAC ");
+      ret = (*packMacUeResetReqOpts[pst.selector])(&pst, ueReset);
+      if(ret == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  DU_APP: sendUeResetReqToMac(): Failed to send UE Reset Req to MAC");
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueReset, sizeof(MacUeResetReq));
+      }
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->   DU_APP: sendUeResetReqToMac(): Failed to allocate memory"); 
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief DU processes UE reset req  and send it to MAC
+ *
+ * @details
+ *
+ *    Function : duBuildAndSendUeResetReq
+ *
+ *    Functionality: DU processes UE reset req and send to MAC
+ *                   
+ *
+ * @params[in] cellId, crnti 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duBuildAndSendUeResetReq(uint16_t cellId, uint16_t crnti)
+{
+   uint8_t  ueId =0;
+   uint16_t cellIdx = 0;
+
+   DU_LOG("\nDEBUG  -->  DU_APP : Building UE reset request");
+   GET_CELL_IDX(cellId, cellIdx);
+   GET_UE_ID(crnti, ueId);
+
+   if(duCb.actvCellLst[cellIdx] != NULLP)
+   {
+      if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti)
+      {
+         DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeResetReq(): CRNTI [%d] not found", crnti);
+         return RFAILED;
+      }
+
+      duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].ueState = UE_RESET_IN_PROGRESS; 
+      if(sendUeResetReqToMac(cellId, ueId) == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  DU APP : DuProcMacUeResetRsp(): Failed to build UE reset req for MAC ");
+         return RFAILED;
+      }
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeResetReq(): Cell Id %d not found", cellId);
+      return RFAILED;
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Handle UE reset response from MAC
+*
+* @details
+*
+*    Function : DuProcMacUeResetRsp
+*
+*    Functionality: Handle UE reset response from MAC
+*
+* @params[in] Pointer to MacUeResetRsp and Pst
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t DuProcMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp)
+{
+   uint8_t  ret =ROK;
+   uint16_t cellIdx=0;
+   
+   if(resetRsp)
+   {
+      if(resetRsp->status == SUCCESSFUL)
+      {
+         DU_LOG("\nINFO   -->  DU APP : MAC UE Reset Response : SUCCESS [UE IDX : %d]", resetRsp->ueId);
+         GET_CELL_IDX(resetRsp->cellId, cellIdx);
+         if(duCb.actvCellLst[cellIdx])
+         {
+            duCb.actvCellLst[cellIdx]->ueCb[resetRsp->ueId -1].duMacUeCfg.macUeCfgState = UE_RESET_COMPLETE;
+            /*TODO - Complete the processing after receiving successfully reset rsp*/
+         }
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  DU APP : DuProcMacUeResetRsp(): MAC UE Reset Response : FAILURE [UE IDX : %d]",resetRsp->ueId);
+         ret =  RFAILED;
+      }
+      DU_FREE_SHRABL_BUF(pst->region, pst->pool, resetRsp, sizeof(MacUeResetRsp));
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  DU APP : DuProcMacUeResetRsp(): MAC UE Reset Response is null");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+*
+* @brief Handle UE sync status indication from MAC
+*
+* @details
+*
+*    Function : DuProcMacUeSyncStatusInd
+*
+*    Functionality: Handle UE sync status indication from MAC
+*
+* @params[in] Pointer to MacUeSyncStatusInd and Pst
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t DuProcMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd)
+{
+   uint8_t  ret =RFAILED;
+   uint16_t cellIdx=0, crnti = 0;
+   char *status;
+
+   if(ueSyncStatusInd)
+   {
+      GET_CELL_IDX(ueSyncStatusInd->cellId, cellIdx);
+      if(duCb.actvCellLst[cellIdx])
+      {
+         GET_CRNTI(crnti, ueSyncStatusInd->ueId);
+         if(duCb.actvCellLst[cellIdx]->ueCb[ueSyncStatusInd->ueId-1].crnti == crnti)
+         {
+            switch(ueSyncStatusInd->status)
+            {
+               case IN_SYNC:
+                  status = "IN_SYNC";
+                  break;
+
+               case OUT_OF_SYNC:
+                  status = "OUT_OF_SYNC";
+                  break;
+
+               case OUT_OF_SUNC_MAX_RETRIES:
+                  status = "OUT_OF_SUNC_MAX_RETRIES";
+                  break;
+
+               default:
+                  status = "INVALID";
+                  break;
+                  
+            }
+            DU_LOG("\nINFO  -->   DU APP : MAC UE sync status for received UeId %d is %s", ueSyncStatusInd->ueId,status);
+         }
+         else
+         {
+            DU_LOG("\nERROR  -->  DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication : Ue Id [%d] not found",ueSyncStatusInd->cellId);
+         }
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication : Cell Id [%d] not found",ueSyncStatusInd->cellId);
+      }
+      DU_FREE_SHRABL_BUF(pst->region, pst->pool, ueSyncStatusInd, sizeof(MacUeSyncStatusInd));
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication is null");
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Sending UE Reestablishment Req To Rlc
+ *
+ * @details
+ *
+ *    Function : sendUeReestablishReqToRlc
+ *
+ *    Functionality:
+ *     Sending UE Reestablishment Req To Rlc
+ *
+ *  @params[in]  cellId, ueId 
+ *  @return ROK     - success
+ *          RFAILED - failure
+ *
+ *****************************************************************/
+
+uint8_t sendUeReestablishReqToRlc(uint16_t cellId, uint8_t ueId, uint8_t numLcToReestablish, uint8_t *lcId)
+{
+   uint8_t ret=ROK,idx=0;
+   Pst pst;
+   RlcUeReestablishReq *ueReestablish;
+
+   DU_ALLOC_SHRABL_BUF(ueReestablish, sizeof(RlcUeReestablishReq));
+   if(ueReestablish !=NULLP)
+   {
+      ueReestablish->cellId = cellId;
+      ueReestablish->ueId = ueId;
+      ueReestablish->numLcsToReestablish = numLcToReestablish;
+
+      for(idx = 0;idx<numLcToReestablish; idx++)
+      {
+         ueReestablish->lcToReestablish[idx]= lcId[idx];
+      }
+      FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_REESTABLISH_REQ);
+
+      ret = (*packRlcUeReestablishReqOpts[pst.selector])(&pst, ueReestablish);
+      if(ret == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  DU_APP : sendUeReestablishReqToRlc():Failed to send UE Reestablishment  Req to RLC"); 
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueReestablish, sizeof(RlcUeReestablishReq));
+      }
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->   DU_APP: sendUeReestablishReqToRlc():Memory allocation failed");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief DU processes UE reestablishment req and sends to MAC and RLC 
+ *
+ * @details
+ *
+ *    Function : duBuildAndSendUeReestablishReq
+ *
+ *    Functionality: DU processes UE reestablishment req and sends to MAC 
+ *                   and RLC 
+ *
+ * @params[in] cellId, crnti, numLcToReestablish, ListOflcid 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duBuildAndSendUeReestablishReq(uint16_t cellId, uint16_t crnti, uint8_t numLcToReestablish, uint8_t *lcId)
+{
+   uint8_t  ueId =0;
+   uint16_t cellIdx = 0;
+
+   DU_LOG("\nDEBUG  -->  DU_APP: Building UE Reestablishment Request ");
+   GET_CELL_IDX(cellId, cellIdx);
+   GET_UE_ID(crnti, ueId);
+
+   if(duCb.actvCellLst[cellIdx] != NULLP)
+   {
+      if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti)
+      {
+         DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeReestablishReq(): CRNTI [%d] not found", crnti);
+         return RFAILED;
+      }
+
+      if(sendUeReestablishReqToRlc(cellId, ueId, numLcToReestablish, lcId) == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeReestablishReq(): Failed to send UE reestablishment req for RLC ");
+         return RFAILED;
+      }
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeReestablishReq(): Cell Id %d is not found", cellId);
+      return RFAILED;
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Processes UE Reestablishment Rsp received from RLC 
+ *
+ * @details
+ *
+ *    Function : DuProcRlcUeReestablishRsp
+ *
+ *    Functionality:
+ *     Processes UE Reestablishment Rsp received from RLC 
+ *
+ *  @params[in]  Post structure
+ *               Pointer to RlcUeReestablishRsp
+ *  @return ROK     - success
+ *          RFAILED - failure
+ *
+ * *****************************************************************/
+
+uint8_t DuProcRlcUeReestablishRsp(Pst *pst, RlcUeReestablishRsp *ueReestablishRsp)
+{
+   uint8_t  ueId = 0, ret = RFAILED;
+   uint16_t cellIdx = 0,crnti=0;
+
+   if(ueReestablishRsp)
+   {
+      ueId = ueReestablishRsp->ueId;
+      GET_CELL_IDX(ueReestablishRsp->cellId, cellIdx);
+
+      if(ueReestablishRsp->status == SUCCESSFUL)
+      {
+         if(duCb.actvCellLst[cellIdx]!=NULLP)
+         {
+            GET_CRNTI(crnti, ueId);
+            if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti ==  crnti)
+            {
+               /*TODO: complete the processing of UE Reestablishment Response */
+               DU_LOG("\nINFO   -->  DU_APP: RLC UE Reestablishment Response : SUCCESS [UE IDX:%d]", ueId);
+               ret = ROK;
+            }
+            else
+               DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeReestablishRsp(): CRNTI [%d] not found", crnti);
+         }
+         else
+            DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeReestablishRsp(): Cell Id[%d] is not found", ueReestablishRsp->cellId);
+            
+      }
+      else
+      {
+         DU_LOG("\nERROR   -->  DU_APP: RLC UE Reestablishment Response : FAILED [UE IDX:%d]", ueId);
+      }
+      DU_FREE_SHRABL_BUF(pst->region, pst->pool, ueReestablishRsp, sizeof(RlcUeReestablishRsp));
+
+   }
+   return ret;
+}
 /**********************************************************************
   End of file
 ***********************************************************************/