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