+
+/*******************************************************************
+ *
+ * @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;
+}