X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_ue_mgr.c;fp=src%2Fdu_app%2Fdu_ue_mgr.c;h=e37ea0b453473b5bb97d4e3dc7f7a94403e74f99;hb=d1f428c3527bfff3b3eae2715e91ae8449ad1784;hp=974f6e6e84ef04534fcfb8e3b8697109d6d154e1;hpb=9625bef129812dfbc9b0a55ee52395c2fa7fbd93;p=o-du%2Fl2.git diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 974f6e6e8..e37ea0b45 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -116,6 +116,12 @@ DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] = packDuRlcUeDeleteReq /* Light weight-loose coupling */ }; +DuMacUeResetReq packMacUeResetReqOpts[] = +{ + packDuMacUeResetReq, /* Loose coupling */ + MacProcUeResetReq, /* TIght coupling */ + packDuMacUeResetReq /* Light weight-loose coupling */ +}; /****************************************************************** * * @brief Function to return Drb LcId @@ -3674,7 +3680,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 +3745,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) @@ -4019,6 +4025,150 @@ 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; +} + /********************************************************************** End of file ***********************************************************************/