[Epic-ID: ODUHIGH-510][Task-ID: ODUHIGH-514] DU-initiated E2 Reset Procedure
[o-du/l2.git] / src / du_app / du_ue_mgr.c
index f501127..cf5df23 100644 (file)
@@ -28,6 +28,7 @@
 #include "legtp.h"
 #include "du_app_mac_inf.h"
 #include "du_app_rlc_inf.h"
+#include "du_e2ap_mgr.h"
 #include "du_cfg.h"
 #include "du_mgr.h"
 #include "du_utils.h"
 #include "CmInterface.h"
 #endif
 
+DuRlcUeReestablishReq packRlcUeReestablishReqOpts[] =
+{
+   packDuRlcUeReestablishReq,       /* Loose coupling */
+   RlcProcUeReestablishReq,         /* TIght coupling */
+   packDuRlcUeReestablishReq        /* Light weight-loose coupling */
+};
+
 DuMacDlCcchInd packMacDlCcchIndOpts[] =
 {
    packMacDlCcchInd,           /* Loose coupling */
@@ -122,6 +130,55 @@ DuMacUeResetReq packMacUeResetReqOpts[] =
    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
@@ -1608,7 +1665,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
  * 
@@ -1633,7 +1690,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;
@@ -1828,7 +1885,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
  *
@@ -1837,12 +1894,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;
 
@@ -1915,12 +1972,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;
 
@@ -1962,7 +2019,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));
 
@@ -1978,10 +2035,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");
 
@@ -1990,7 +2047,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
@@ -2644,7 +2701,8 @@ uint8_t duUpdateTunnelCfgDb(uint8_t ueId, uint8_t cellId, DuUeCfg *duUeCfg)
 
 uint8_t duUpdateDuUeCbCfg(uint8_t ueId, uint8_t cellId)
 {
-   uint8_t ret = ROK, cellIdx = 0, crnti=0;
+   uint8_t ret = ROK;
+   uint16_t cellIdx = 0, crnti=0;
    DuUeCb *ueCb = NULLP;
 
    GET_CELL_IDX(cellId, cellIdx);
@@ -2680,20 +2738,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;
@@ -2722,14 +2780,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;
                   }
                }
@@ -2741,11 +2799,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;
@@ -2837,7 +2895,7 @@ uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *reCfgRsp)
  * 
  *  @params[in]  cellId,
  *               ueId,
- *               Pointer to RlcUeCfg
+ *               Pointer to RlcUeCreate
  *  @return ROK     - success
  *          RFAILED - failure
  * 
@@ -2846,7 +2904,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);
@@ -2858,10 +2916,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 */
@@ -2870,7 +2928,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;
       }
    }
@@ -2889,7 +2947,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
@@ -2900,7 +2958,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;
 
@@ -2924,20 +2982,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);
 
@@ -2950,14 +3050,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;
                }
             }
@@ -2965,7 +3065,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))
          {
@@ -2973,16 +3073,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
@@ -3044,15 +3143,17 @@ void fillRlcUeRecfg(DuRlcUeCfg *duRlcUeCfg, RlcUeRecfg *rlcUeRecfg)
  *
  *    Functionality: Builds and Send Ue Reconfig Req to RLC
  *
- * @params[in] cellId, crnti
+ * @params[in] uint16_t cellId,
+ *             uint6_t crnti #AS per 38.473 V15.3.0, Section 9.3.1.32 crnti
+ *             value range is b/w 0..65535#  
  *             DuUeCfg *ueCfgDb
- *             RlcUeCfg *rlcUeCfg
+ *             RlcUeCreate *rlcUeCfg
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
 
-uint8_t duBuildAndSendUeRecfgReqToRlc(uint8_t cellId, uint8_t gnbDuUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb)
+uint8_t duBuildAndSendUeRecfgReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb)
 {
    uint8_t ret = ROK;
    DuRlcUeCfg *duRlcUeCfg = NULLP;
@@ -3172,14 +3273,17 @@ void fillMacUeRecfg(DuMacUeCfg *duMacUeCfg, MacUeRecfg *macUeRecfg)
  *
  *    Functionality: Builds and Send Ue Reconfig Req to MAC
  *
- * @params[in] CellGroupConfigRrc_t *macCellGrpCfg
+ * @params[in] uint16_t cellId,
+ *             uint6_t crnti #AS per 38.473 V15.3.0, Section 9.3.1.32 crnti
+ *             value range is b/w 0..65535#  
+ *             CellGroupConfigRrc_t *macCellGrpCfg
  *             DuUeCfg *ueCfgDb
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
 
-uint8_t duBuildAndSendUeRecfgReqToMac(uint8_t cellId, uint8_t duUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb)
+uint8_t duBuildAndSendUeRecfgReqToMac(uint16_t cellId, uint8_t duUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb)
 {
    uint8_t ret = ROK;
    DuMacUeCfg *duMacUeCfg = NULLP;
@@ -3915,16 +4019,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
@@ -3965,7 +4069,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));
    }
 }
 
@@ -4237,6 +4341,162 @@ uint8_t DuProcMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd)
    }
    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
 ***********************************************************************/