From: sphoorthi Date: Thu, 25 Mar 2021 05:39:53 +0000 (+0530) Subject: MAC/SCH Ue Delete Request and Response [JIRA ID - ODUHIGH-318] X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F95%2F5795%2F9;p=o-du%2Fl2.git MAC/SCH Ue Delete Request and Response [JIRA ID - ODUHIGH-318] Change-Id: I7f67e2485b1eb86f76609e99d2a8355f952e85a6 Signed-off-by: sphoorthi --- diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index 7ede4a5de..09f3aad3f 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -50,6 +50,20 @@ MacSchModUeConfigReqFunc macSchModUeConfigReqOpts[] = packMacSchModUeConfigReq /* packing for light weight loosely coupled */ }; +MacSchUeDeleteReqFunc macSchUeDeleteReqOpts[] = +{ + packMacSchUeDeleteReq, /* packing for loosely coupled */ + MacSchUeDeleteReq, /* packing for tightly coupled */ + packMacSchUeDeleteReq /* packing for light weight loosely coupled */ +}; + +MacDuUeDeleteRspFunc macDuUeDeleteRspOpts[] = +{ + packDuMacUeDeleteRsp, /* packing for loosely coupled */ + DuProcMacUeDeleteRsp, /* packing for tightly coupled */ + packDuMacUeDeleteRsp /* packing for light weight loosly coupled */ +}; + /******************************************************************* * * @brief Fills mac cell group config to be sent to scheduler @@ -2403,6 +2417,359 @@ uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) return ROK; } +/******************************************************************* +* +* @brief Fill and Send UE Delete response from MAC to DU APP +* +* @details +* +* Function : MacSendUeDeleteRsp +* +* Functionality: Fill and Send UE Delete response from MAC to DUAPP +* +* @params[in] MAC UE delete result +* SCH UE delete response +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t MacSendUeDeleteRsp(uint16_t cellId, uint16_t crnti, UeDeleteStatus result) +{ + MacUeDeleteRsp *deleteRsp; + Pst rspPst; + + MAC_ALLOC_SHRABL_BUF(deleteRsp, sizeof(MacUeDeleteRsp)); + if(!deleteRsp) + { + DU_LOG("\nERROR --> MAC : Memory allocation for UE delete response failed"); + return RFAILED; + } + + /* Filling UE delete response */ + deleteRsp->cellId = cellId; + GET_UE_IDX(crnti,deleteRsp->ueIdx); + deleteRsp->result = result; + + /* Fill Post structure and send UE delete response*/ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_DELETE_RSP); + return (*macDuUeDeleteRspOpts[rspPst.selector])(&rspPst, deleteRsp); +} +/******************************************************************* +* +* @brief freeing the Pucch Resrc Cfg +* +* @details +* +* Function : deletePucchResourcesCfg +* +* Functionality: freeing the Pucch Resrc Cfg +* +* @params[in] PucchResrcCfg *resrcCfg +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg) +{ + uint8_t resrcIdx; + for(resrcIdx =0; resrcIdx< resrcCfg->resrcToAddModListCount;resrcIdx++) + { + switch(resrcCfg->resrcToAddModList[resrcIdx].pucchFormat) + { + case PUCCH_FORMAT_0: + { + MAC_FREE(resrcCfg->resrcToAddModList[resrcIdx].PucchFormat.format0, sizeof(PucchFormat0)); + break; + } + case PUCCH_FORMAT_1: + { + MAC_FREE(resrcCfg->resrcToAddModList[resrcIdx].PucchFormat.format1, sizeof(PucchFormat1)); + break; + } + case PUCCH_FORMAT_2: + { + MAC_FREE(resrcCfg->resrcToAddModList[resrcIdx].PucchFormat.format2, sizeof(PucchFormat2_3)); + break; + } + case PUCCH_FORMAT_3: + { + MAC_FREE(resrcCfg->resrcToAddModList[resrcIdx].PucchFormat.format3, sizeof(PucchFormat2_3)); + break; + } + case PUCCH_FORMAT_4: + { + MAC_FREE(resrcCfg->resrcToAddModList[resrcIdx].PucchFormat.format4, sizeof(PucchFormat4)); + break; + } + } + } + +} +/******************************************************************* +* +* @brief Function to delete MAC Pdsch ServCellCfg +* +* @details +* +* Function : deleteMacPdschServCellCfg +* +* Functionality: Function to delete MAC Pdsch ServCellCfg +* +* @params[in] PdschServCellCfg *pdschServCellCfg +* @return void +* +* ****************************************************************/ +void deleteMacPdschServCellCfg(PdschServCellCfg *pdschServCellCfg) +{ + MAC_FREE(pdschServCellCfg->maxMimoLayers, sizeof(uint8_t)); + MAC_FREE(pdschServCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB)); + MAC_FREE(pdschServCellCfg->codeBlkGrpFlushInd, sizeof(bool)); + MAC_FREE(pdschServCellCfg->xOverhead, sizeof(PdschXOverhead)); +} +/******************************************************************* +* +* @brief Handles UE Delete requst from DU APP +* +* @details +* +* Function : deleteMacUeCb +* +* Functionality: Handles UE Delete requst from DU APP +* +* @params[in] MacCellCb *cellCb,uint16_t ueIdx +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +void deleteMacUeCb(MacUeCb *ueCb) +{ + MacUeCfg *ueCfg = NULLP; + ServCellCfgInfo *servCellCfg; + + if(ueCb->raCb) + { + MAC_FREE(ueCb->raCb->msg4Pdu, ueCb->raCb->msg4PduLen); + MAC_FREE(ueCb->raCb->msg4TxPdu , ueCb->raCb->msg4TbSize); + MAC_FREE(ueCb->raCb, sizeof(MacRaCbInfo)); + } + if(ueCb->cellCb) + { + if(ueCb->cellCb->ueCfgTmpData[ueCb->ueIdx-1]) + { + ueCfg =ueCb->cellCb->ueCfgTmpData[ueCb->ueIdx-1]; + MAC_FREE(ueCfg->ambrCfg, sizeof(AmbrCfg)); + if(ueCfg->spCellCfgPres) + { + servCellCfg = &ueCfg->spCellCfg.servCellCfg; + MAC_FREE(servCellCfg->bwpInactivityTmr, sizeof(uint8_t)); + + if(servCellCfg->initUlBwp.pucchPresent) + { + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.resrcSet, sizeof(PucchResrcSetCfg)); + + if(servCellCfg->initUlBwp.pucchCfg.resrc) + { + deletePucchResourcesCfg(servCellCfg->initUlBwp.pucchCfg.resrc); + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.resrc, sizeof(PucchResrcCfg)); + } + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.format1, sizeof(PucchFormatCfg)); + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.format2, sizeof(PucchFormatCfg)); + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.format3, sizeof(PucchFormatCfg)); + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.format4, sizeof(PucchFormatCfg)); + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.schedReq, sizeof(PucchSchedReqCfg)); + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.multiCsiCfg, sizeof(PucchMultiCsiCfg)); + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.spatialInfo, sizeof(PucchSpatialCfg)); + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.dlDataToUlAck , sizeof(PucchDlDataToUlAck)); + MAC_FREE(servCellCfg->initUlBwp.pucchCfg.powerControl, sizeof(PucchPowerControl)); + deleteMacPdschServCellCfg(&servCellCfg->pdschServCellCfg); + } + } + for(uint8_t idx=0 ;idx < ueCfg->numLcs; idx++) + { + MAC_FREE(ueCfg->lcCfgList[idx].drbQos, sizeof(DrbQosInfo)); + MAC_FREE(ueCfg->lcCfgList[idx].snssai, sizeof(Snssai)); + } + MAC_FREE(ueCb->cellCb->ueCfgTmpData[ueCb->ueIdx-1],sizeof(MacUeCfg)); + } + } + memset(ueCb, 0, sizeof(MacUeCb)); +} +/******************************************************************* +* +* @brief Processes UE delete response from scheduler +* +* @details +* +* Function : MacProcSchUeCfgRsp +* +* Functionality: +* Processes UE create delete from scheduler +* +* @params[in] Pst : Post structure +* schUeDelRsp : Scheduler UE delete respons +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp) +{ + uint8_t ueIdx =0; + uint16_t cellIdx=0; + uint8_t ret = RFAILED; + MacUeCb ueCb; + MacCellCb *cellCb= NULLP; + UeDeleteStatus result; + + if(schUeDelRsp) + { + if(schUeDelRsp->rsp == RSP_OK) + { + DU_LOG("\nINFO --> MAC : SCH UE Delete response for CRNTI[%d] is successful", schUeDelRsp->crnti); + GET_CELL_IDX(schUeDelRsp->cellId, cellIdx); + cellCb = macCb.macCell[cellIdx]; + if(cellCb) + { + GET_UE_IDX(schUeDelRsp->crnti, ueIdx); + ueCb = cellCb->ueCb[ueIdx -1]; + if(ueCb.crnti == schUeDelRsp->crnti) + { + deleteMacUeCb(&ueCb); + result = SUCCESS; + ret = ROK; + } + else + { + DU_LOG("\nERROR --> MAC : MacProcSchUeDeleteRsp(): crnti[%d] does not exist ",schUeDelRsp->crnti); + result = UEIDX_INVALID; + } + } + else + { + DU_LOG("\nERROR --> MAC : MacProcSchUeDeleteRsp(): cellId[%d] does not exist ",schUeDelRsp->cellId); + result = CELLID_INVALID; + } + } + else + { + result = (schUeDelRsp->cause == INVALID_CELLID) ? CELLID_INVALID : UEIDX_INVALID; + } + if(MacSendUeDeleteRsp(schUeDelRsp->cellId, schUeDelRsp->crnti, result) != ROK) + { + DU_LOG("\nERROR --> MAC: MacProcSchUeDeleteRsp(): Failed to send UE delete response"); + } + } + else + { + DU_LOG("\nERROR --> MAC: MacProcSchUeDeleteRsp(): Failed to receive UE delete response by SCH"); + } + return ret; +} +/******************************************************************* +* +* @brief Sends UE delete req to Scheduler +* +* @details +* +* Function : sendUeDelReqToSch +* +* Functionality: sends UE delete req to Scheduler +* +* @params[in] Pst *pst, MacUeDelete *ueDelete +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t sendUeDelReqToSch(Pst *pst, MacUeDelete *ueDelete) +{ + if(ueDelete != NULLP) + { + Pst schPst; + SchUeDelete schUeDel; + + memset(&schUeDel, 0, sizeof(SchUeDelete)); + schUeDel.cellId = ueDelete->cellId; + schUeDel.crnti = ueDelete->crnti; + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueDelete, sizeof(MacUeDelete)); + FILL_PST_MAC_TO_SCH(schPst, EVENT_UE_DELETE_REQ_TO_SCH); + return(*macSchUeDeleteReqOpts[schPst.selector])(&schPst, &schUeDel); + } + else + { + DU_LOG("\nERROR --> SCH: sendUeDelReqToSch():MAC Ue Delete is NULL"); + return RFAILED; + } + return ROK; +} +/******************************************************************* + * + * @brief Handles UE Delete requst from DU APP + * + * @details + * + * Function : MacProcUeDeleteReq + * + * Functionality: Handles UE Delete requst from DU APP + * + * @params[in] Pst *pst, MacUeDelete *ueDelete + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete) +{ + uint8_t ret = ROK; + uint8_t cellIdx=0; + UeDeleteStatus result=SUCCESS; + MacUeCb *ueCb = NULLP; + MacCellCb *cellCb = NULLP; + + DU_LOG("\nINFO --> MAC : UE Delete Request received for ueIdx[%d]", ueDelete->ueIdx); + + if(ueDelete) + { + GET_CELL_IDX(ueDelete->cellId, cellIdx); + cellCb = macCb.macCell[cellIdx]; + if(cellCb) + { + ueCb = &cellCb->ueCb[ueDelete->ueIdx-1]; + if(ueCb->crnti == ueDelete->crnti) + { + ret = sendUeDelReqToSch(pst, ueDelete); + if(ret != ROK) + { + DU_LOG("\nERROR --> MAC : MacProcUeDeleteReq(): Failed to send UE Delete Request to SCH"); + ret = RFAILED; + } + } + else + { + DU_LOG("\nERROR --> MAC : MacProcUeDeleteReq(): CRNTI is not matched"); + result = UEIDX_INVALID; + } + } + else + { + DU_LOG("\nERROR --> MAC : MacProcUeDeleteReq(): Failed to find the MacUeCb of UeIdx = %d",ueDelete->ueIdx); + result = CELLID_INVALID; + } + + if(result != SUCCESS) + { + MacSendUeDeleteRsp(ueDelete->cellId, ueDelete->crnti, result); + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueDelete, sizeof(MacUeDelete)); + ret = RFAILED; + } + } + else + { + DU_LOG("\nERROR --> MAC : MacProcUeDeleteReq(): MAC UE delete request processing failed"); + ret = RFAILED; + } + return ret; +} + /********************************************************************** End of file diff --git a/src/5gnrmac/rg_ex_ms.c b/src/5gnrmac/rg_ex_ms.c index ec2c85bee..0319cc2ce 100755 --- a/src/5gnrmac/rg_ex_ms.c +++ b/src/5gnrmac/rg_ex_ms.c @@ -127,7 +127,12 @@ Buffer *mBuf /* message buffer */ /* Process Ue Reconfig Request */ unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf); break; - default: + case EVENT_MAC_UE_DELETE_REQ: + { + unpackMacUeDeleteReq(MacProcUeDeleteReq, pst, mBuf); + break; + } + default: RG_FREE_MSG(mBuf); break; } diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index 097e0808c..7b4c4e4c9 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -37,6 +37,12 @@ SchUeCfgRspFunc SchUeCfgRspOpts[] = packSchUeCfgRsp /* LWLC */ }; +SchUeDeleteRspFunc SchUeDeleteRspOpts[] = +{ + packSchUeDeleteRsp, /* LC */ + MacProcSchUeDeleteRsp, /* TC */ + packSchUeDeleteRsp /* LWLC */ +}; /******************************************************************* * @@ -615,6 +621,228 @@ uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) } return ret; } +/******************************************************************* +* +* @brief Fill and send UE delete response to MAC +* +* @details +* +* Function : SchSendUeDeleteRspToMac +* +* Functionality: Fill and send UE delete response to MAC +* +* @params[in] Inst inst, SchUeDelete *ueDelete, SchMacRsp result, +* ErrorCause cause +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +void SchSendUeDeleteRspToMac(Inst inst, SchUeDelete *ueDelete, SchMacRsp result, ErrorCause cause) +{ + Pst rspPst; + SchUeDeleteRsp delRsp; + + memset(&delRsp, 0, sizeof(SchUeDeleteRsp)); + delRsp.cellId = ueDelete->cellId; + delRsp.crnti = ueDelete->crnti; + delRsp.rsp = result; + delRsp.cause = cause; + + /* Filling response post */ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_SCH_TO_MAC(rspPst, inst); + rspPst.event = EVENT_UE_DELETE_RSP_TO_MAC; + SchUeDeleteRspOpts[rspPst.selector](&rspPst, &delRsp); +} +/******************************************************************* +* +* @brief Function to delete Sch Pucch ResrcCfg +* +* @details +* +* Function : deleteSchPucchResrcCfg +* +* Functionality: Function to delete Sch Pucch ResrcCfg +* +* @params[in] SchPucchResrcCfg *resrc +* @return void +* +* ****************************************************************/ + +void deleteSchPucchResrcCfg(SchPucchResrcCfg *resrc) +{ + uint8_t rsrcIdx=0; + for(rsrcIdx=0; rsrcIdx < resrc->resrcToAddModListCount; rsrcIdx++) + { + switch(resrc->resrcToAddModList[rsrcIdx].pucchFormat) + { + case PUCCH_FORMAT_0: + { + SCH_FREE(resrc->resrcToAddModList[rsrcIdx].SchPucchFormat.format0,\ + sizeof(SchPucchFormat0)); + break; + } + case PUCCH_FORMAT_1: + { + SCH_FREE(resrc->resrcToAddModList[rsrcIdx].SchPucchFormat.format1,\ + sizeof(SchPucchFormat1)); + break; + } + case PUCCH_FORMAT_2: + { + SCH_FREE(resrc->resrcToAddModList[rsrcIdx].SchPucchFormat.format2,\ + sizeof(SchPucchFormat2_3)); + break; + } + case PUCCH_FORMAT_3: + { + SCH_FREE(resrc->resrcToAddModList[rsrcIdx].SchPucchFormat.format3,\ + sizeof(SchPucchFormat2_3)); + break; + } + case PUCCH_FORMAT_4: + { + SCH_FREE(resrc->resrcToAddModList[rsrcIdx].SchPucchFormat.format4,\ + sizeof(SchPucchFormat4)); + break; + } + } + } +} +/******************************************************************* +* +* @brief Function to delete SCH Pdsch ServCellCfg +* +* @details +* +* Function : deleteSchPdschServCellCfg +* +* Functionality: Function to delete SCH Pdsch ServCellCfg +* +* @params[in] SchPdschServCellCfg *pdschServCellCfg +* @return void +* +* ****************************************************************/ + +void deleteSchPdschServCellCfg(SchPdschServCellCfg *pdschServCellCfg) +{ + SCH_FREE(pdschServCellCfg->maxMimoLayers, sizeof(uint8_t)); + SCH_FREE(pdschServCellCfg->maxCodeBlkGrpPerTb, sizeof(SchMaxCodeBlkGrpPerTB)); + SCH_FREE(pdschServCellCfg->codeBlkGrpFlushInd, sizeof(bool)); + SCH_FREE(pdschServCellCfg->xOverhead, sizeof(SchPdschXOverhead)); +} +/******************************************************************* +* +* @brief Function to delete SCH UeCb +* +* @details +* +* Function : deleteSchUeCb +* +* Functionality: Function to delete SCH UeCb +* +* @params[in] +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +void deleteSchUeCb(SchUeCb *ueCb) +{ + SchPucchCfg *pucchCfg = NULLP; + if(ueCb) + { + SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg)); + if(ueCb->ueCfg.spCellCfgPres) + { + if(ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfgPres == true) + { + pucchCfg = &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg; + SCH_FREE(pucchCfg->resrcSet,sizeof(SchPucchResrcSetCfg)); + if(pucchCfg->resrc) + { + deleteSchPucchResrcCfg(pucchCfg->resrc); + SCH_FREE(pucchCfg->resrc, sizeof(SchPucchResrcCfg)); + } + SCH_FREE(pucchCfg->format1, sizeof(SchPucchFormatCfg)); + SCH_FREE(pucchCfg->format2, sizeof(SchPucchFormatCfg)); + SCH_FREE(pucchCfg->format3, sizeof(SchPucchFormatCfg)); + SCH_FREE(pucchCfg->format4, sizeof(SchPucchFormatCfg)); + SCH_FREE(pucchCfg->schedReq, sizeof(SchPucchSchedReqCfg)); + SCH_FREE(pucchCfg->multiCsiCfg, sizeof(SchPucchMultiCsiCfg)); + SCH_FREE(pucchCfg->spatialInfo, sizeof(SchPucchSpatialCfg)); + SCH_FREE(pucchCfg->dlDataToUlAck, sizeof(SchPucchDlDataToUlAck)); + SCH_FREE(pucchCfg->powerControl,sizeof(SchPucchPowerControl)); + } + SCH_FREE(ueCb->ueCfg.spCellCfg.servCellCfg.bwpInactivityTmr, sizeof(uint8_t)); + deleteSchPdschServCellCfg(&ueCb->ueCfg.spCellCfg.servCellCfg.pdschServCellCfg); + } + memset(ueCb, 0, sizeof(SchUeCb)); + } +} +/******************************************************************* +* +* @brief Function for Ue Delete request from MAC to SCH +* +* @details +* +* Function : MacSchUeDeleteReq +* +* Functionality: Function for Ue Delete request from MAC to SCH +* +* @params[in] Pst *pst, SchUeDelete *ueDelete +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) +{ + uint8_t idx=0, ueIdx=0, ret=ROK; + ErrorCause result; + SchCellCb *cellCb = NULLP; + SchUeCb ueCb ; + Inst inst = pst->dstInst - 1; + + if(!ueDelete) + { + DU_LOG("\nERROR --> SCH : MacSchUeDeleteReq(): Ue Delete request failed"); + ret = RFAILED; + } + DU_LOG("\nDEBUG --> SCH : Ue Delete request received for crnti[%d]", ueDelete->crnti); + + cellCb = schCb[inst].cells[idx]; + + if(cellCb->cellId != ueDelete->cellId) + { + DU_LOG("\nERROR --> SCH : MacSchUeDeleteReq(): cell Id is not available"); + result = INVALID_CELLID; + } + else + { + GET_UE_IDX(ueDelete->crnti, ueIdx); + ueCb = cellCb->ueCb[ueIdx-1]; + if((ueCb.crnti == ueDelete->crnti) && (ueCb.state == SCH_UE_STATE_ACTIVE)) + { + deleteSchUeCb(&ueCb); + result = NOT_APPLICABLE; + } + else + { + DU_LOG("\nERROR --> SCH : MacSchUeDeleteReq(): SchUeCb not found"); + result = INVALID_UEIDX; + } + } + + if(result == NOT_APPLICABLE) + { + SchSendUeDeleteRspToMac(inst, ueDelete, RSP_OK, result); + } + else + { + SchSendUeDeleteRspToMac(inst, ueDelete, RSP_NOK, result); + ret = RFAILED; + } + return ret; +} /********************************************************************** End of file diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 385ca1809..b136466bc 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -792,14 +792,13 @@ uint8_t packDuMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) return ODU_POST_TASK(pst,mBuf); } - /******************************************************************* * * @brief Unpack UE Config Response from MAC to DU APP * * @details * - * Function : unpackDuMacUeCfgRsp + * Function :unpackDuMacUeCfgRsp * * Functionality: Unpack UE Config Response from MAC to DU APP * @@ -902,7 +901,155 @@ uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf) return RFAILED; } +/******************************************************************* +* +* @brief Packs and Sends UE Delete Request from DUAPP to MAC +* +* @details +* +* Function : packDuMacUeDeleteReq +* +* Functionality: +* Packs and Sends UE Delete Request from DUAPP to MAC +* +* +* @params[in] Post structure pointer +* MacUeDelete pointer +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t packDuMacUeDeleteReq(Pst *pst, MacUeDelete *ueDel) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeDeleteReq"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer,(PTR)ueDel, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeDeleteReq"); + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); +} +/******************************************************************* +* +* @brief Unpacks UE Delete Request received from DU APP +* +* @details +* +* Function : unpackMacUeDeleteReq +* +* Functionality: +* Unpacks UE Delete Request received from DU APP +* +* @params[in] Pointer to Handler +* Post structure pointer +* Message Buffer +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t unpackMacUeDeleteReq(DuMacUeDeleteReq func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacUeDelete *ueDelete; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDelete, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, ueDelete); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nERROR --> DU APP : Only LWLC supported for UE Delete Request "); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} +/******************************************************************* + * + * @brief Pack and send UE delete response from MAC to DU APP + * + * @details + * + * Function : packDuMacUeDeleteRsp + * + * Functionality: + * Pack and send UE delete response from MAC to DU APP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacUeDeleteRsp"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer,(PTR)deleteRsp, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeDeleteRsp"); + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); + +} + +/******************************************************************* +* +* @brief Unpack UE Config Response from MAC to DU APP +* +* @details +* +* Function :unpackDuMacUeDeleteRsp +* +* Functionality: Unpack UE Config Response from MAC to DU APP +* +* @params[in] +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t unpackDuMacUeDeleteRsp(MacDuUeDeleteRspFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacUeDeleteRsp *ueDeleteRsp = NULLP; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDeleteRsp, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, ueDeleteRsp); + } + + ODU_PUT_MSG_BUF(mBuf); + return RFAILED; +} /********************************************************************** - End of file - **********************************************************************/ +End of file +**********************************************************************/ diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 612ec4b23..ba1b0d2fe 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -74,6 +74,8 @@ #define EVENT_MAC_UE_CREATE_RSP 209 #define EVENT_MAC_UE_RECONFIG_REQ 210 #define EVENT_MAC_UE_RECONFIG_RSP 211 +#define EVENT_MAC_UE_DELETE_REQ 212 +#define EVENT_MAC_UE_DELETE_RSP 213 #define BSR_PERIODIC_TIMER_SF_10 10 #define BSR_RETX_TIMER_SF_320 320 @@ -85,6 +87,13 @@ typedef enum MAC_DU_APP_RSP_OK }MacRsp; +typedef enum +{ + SUCCESS, + CELLID_INVALID, + UEIDX_INVALID +}UeDeleteStatus; + typedef enum { DUP_MODE_FDD, @@ -1232,6 +1241,20 @@ typedef struct ueCfgRsp SCellFailInfo *failedSCellList; }MacUeCfgRsp; +typedef struct ueDelete +{ + uint16_t cellId; + uint8_t ueIdx; + uint16_t crnti; +}MacUeDelete; + +typedef struct ueDeleteRsp +{ + uint16_t cellId; + uint8_t ueIdx; + UeDeleteStatus result; +}MacUeDeleteRsp; + /* Functions for slot Ind from MAC to DU APP*/ typedef uint8_t (*DuMacCellUpInd) ARGS(( Pst *pst, @@ -1294,6 +1317,15 @@ typedef uint8_t (*DuMacUeReconfigReq) ARGS(( Pst *pst, MacUeCfg *ueCfg )); +typedef uint8_t (*DuMacUeDeleteReq) ARGS(( + Pst *pst, + MacUeDelete *ueDel )); + +typedef uint8_t (*MacDuUeDeleteRspFunc) ARGS(( + Pst *pst, + MacUeDeleteRsp *deleteRsp)); + + uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId); uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf); uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId); @@ -1328,9 +1360,15 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp); uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg); uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf); uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg); - +uint8_t packDuMacUeDeleteReq(Pst *pst, MacUeDelete *ueDelete); +uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete); +uint8_t unpackMacUeDeleteReq(DuMacUeDeleteReq func, Pst *pst, Buffer *mBuf); +uint8_t packDuMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp); +uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp); +uint8_t unpackDuMacUeDeleteRsp(MacDuUeDeleteRspFunc func, Pst *pst, Buffer *mBuf); #endif + /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/mac_sch_interface.c b/src/cm/mac_sch_interface.c index a02172406..7076c2cce 100644 --- a/src/cm/mac_sch_interface.c +++ b/src/cm/mac_sch_interface.c @@ -268,7 +268,6 @@ uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp) { return ROK; } - /******************************************************************* * * @brief Pack and Send BSR from MAC to SCH @@ -355,6 +354,56 @@ uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) } return ROK; } +/******************************************************************* +* +* @brief Pack and Send UE Delete Request from MAC to SCH +* +* @details +* +* Function : packMacSchUeDeleteReq +* +* Functionality: +* Pack and Send UE Delete Request from MAC to SCH +* +* @params[in] +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t packMacSchUeDeleteReq(Pst *pst, SchUeDelete *schUeDel) +{ + if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LC)) + { + /* TODO */ + } + else + { + return RFAILED; + } + return ROK; +} +/******************************************************************* +* +* @brief Packs and send UE delete response +* +* @details +* +* Function : packSchUeDeleteRsp +* +* Functionality: +* Packs and send UE delete response +* +* @params[in] Post structure +* UE delete response +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t packSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *delRsp) +{ + return ROK; +} /********************************************************************** End of file diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index d8bd6aa53..e3e382538 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -31,7 +31,8 @@ #define EVENT_UCI_IND_TO_SCH 12 #define EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH 13 #define EVENT_UE_RECONFIG_RSP_TO_MAC 14 - +#define EVENT_UE_DELETE_REQ_TO_SCH 15 +#define EVENT_UE_DELETE_RSP_TO_MAC 16 /*macros*/ #define NO_SSB 0 @@ -125,6 +126,13 @@ typedef enum SR_PROHIBIT_MS128 }SchSrProhibitTimer; +typedef enum +{ + NOT_APPLICABLE, + INVALID_CELLID, + INVALID_UEIDX +}ErrorCause; + typedef enum { SR_TRANS_MAX_N4, @@ -1455,6 +1463,21 @@ typedef struct schUeCfgRsp SchFailureCause cause; }SchUeCfgRsp; +typedef struct schUeDelete +{ + uint16_t cellId; + uint16_t crnti; +}SchUeDelete; + +typedef struct schUeDeleteRsp +{ + uint16_t cellId; + uint16_t crnti; + SchMacRsp rsp; + ErrorCause cause; +}SchUeDeleteRsp; + + typedef struct dataVolInfo { uint8_t lcgId; @@ -1541,6 +1564,13 @@ typedef uint8_t (*MacSchModUeConfigReqFunc) ARGS(( typedef uint8_t (*SchUeReCfgRspFunc) ARGS(( Pst *pst, /* Post structure */ SchUeCfgRsp *cfgRsp)); /* Scheduler UE Cfg response */ +typedef uint8_t (*MacSchUeDeleteReqFunc) ARGS(( + Pst *pst, /* Post structure */ + SchUeDelete *schUeDel)); /*Scheduler UE Del*/ + +typedef uint8_t (*SchUeDeleteRspFunc) ARGS(( + Pst *pst, /* Post structure */ + SchUeDeleteRsp *delRsp)); /* Scheduler UE delete response */ /* function declarations */ uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd); @@ -1576,6 +1606,10 @@ uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch); uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch); uint8_t packSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp); uint8_t MacProcSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp); +uint8_t packMacSchUeDeleteReq(Pst *pst, SchUeDelete *schUeDel); +uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete); +uint8_t packSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *delRsp); +uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp); /********************************************************************** End of file diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index 8dcf644f6..76a524ac1 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -262,6 +262,11 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf); break; } + case EVENT_MAC_UE_DELETE_RSP: + { + ret = unpackDuMacUeDeleteRsp(DuProcMacUeDeleteRsp, pst, mBuf); + break; + } default: { DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC"); diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 53037eea5..89780b0c8 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -83,6 +83,14 @@ DuRlcDlUserDataToRlcFunc duSendRlcDlUserDataToRlcOpts[] = packRlcDlUserDataToRlc /* Light weight-loose coupling */ }; +DuMacUeDeleteReq packMacUeDeleteReqOpts[] = +{ + packDuMacUeDeleteReq, /* Loose coupling */ + MacProcUeDeleteReq, /* TIght coupling */ + packDuMacUeDeleteReq /* Light weight-loose coupling */ +}; + + /******************************************************************* * * @brief Function to fillDlUserDataInfo @@ -2628,6 +2636,272 @@ uint8_t duProcUeContextModReq(DuUeCb *ueCb) } return ROK; } +/******************************************************************* +* +* @brief Function to delete Pdsch ServCellCfg +* +* @details +* +* Function : deletePdschServCellCfg +* +* Functionality: Function to delete Pdsch ServCellCfg +* +* @params[in] PdschServCellCfg *pdschServCellCfg +* @return void +* +* ****************************************************************/ +void deletePdschServCellCfg(PdschServCellCfg *pdschServCellCfg) +{ + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->maxMimoLayers, sizeof(uint8_t)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->codeBlkGrpFlushInd, sizeof(bool)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,pdschServCellCfg->xOverhead, sizeof(PdschXOverhead)); +} + +/******************************************************************* + * +* @brief delete MacUeCfg from duCb +* +* @details +* +* Function : deleteMacUeCfg +* +* Functionality: delete MacUeCfg from duCb +* +* @params[in] Pointer to MacUeCfg +* @return ROK - success +* RFAILED - failure +* +*******************************************************************/ +void deleteMacUeCfg(MacUeCfg *ueCfg) +{ + uint8_t lcCfgIdx; + uint8_t resrcIdx; + ServCellCfgInfo *servCellCfg; + PucchResrcInfo *resrcToAddModList; + + if(ueCfg) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->ambrCfg, sizeof(AmbrCfg)); + if(ueCfg->spCellCfgPres) + { + servCellCfg = &ueCfg->spCellCfg.servCellCfg; + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->bwpInactivityTmr, sizeof(uint8_t)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.resrcSet,\ + sizeof(PucchResrcSetCfg)); + if(servCellCfg->initUlBwp.pucchCfg.resrc) + { + /*freeing the PucchResrcCfg*/ + for(resrcIdx= 0; resrcIdx< servCellCfg->initUlBwp.pucchCfg.resrc->resrcToAddModListCount; resrcIdx++) + { + resrcToAddModList=&servCellCfg->initUlBwp.pucchCfg.resrc->resrcToAddModList[resrcIdx]; + switch(resrcToAddModList->pucchFormat) + { + case PUCCH_FORMAT_0: + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format0 ,\ + sizeof(PucchFormat0)); + break; + } + case PUCCH_FORMAT_1: + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format1 ,\ + sizeof(PucchFormat1)); + break; + } + case PUCCH_FORMAT_2: + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format2 ,\ + sizeof(PucchFormat2_3)); + break; + } + case PUCCH_FORMAT_3: + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format3 ,\ + sizeof(PucchFormat2_3)); + break; + } + case PUCCH_FORMAT_4: + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format4 ,\ + sizeof(PucchFormat4)); + break; + } + } + } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.resrc,\ + sizeof(PucchResrcCfg)); + } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format1,\ + sizeof(PucchFormatCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format2,\ + sizeof(PucchFormatCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format3,\ + sizeof(PucchFormatCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format4,\ + sizeof(PucchFormatCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.schedReq,\ + sizeof(PucchSchedReqCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.multiCsiCfg,\ + sizeof(PucchMultiCsiCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.spatialInfo,\ + sizeof(PucchSpatialCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.dlDataToUlAck ,\ + sizeof(PucchDlDataToUlAck)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.powerControl,\ + sizeof(PucchPowerControl)); + deletePdschServCellCfg(&servCellCfg->pdschServCellCfg); + } + for(lcCfgIdx=0; lcCfgIdx< ueCfg->numLcs; lcCfgIdx++) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->lcCfgList[lcCfgIdx].drbQos, sizeof(DrbQosInfo)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->lcCfgList[lcCfgIdx].snssai, sizeof(Snssai)); + } + } + memset(ueCfg, 0, sizeof(MacUeCfg)); +} +/******************************************************************* +* +* @brief Handle UE delete response from MAC +* +* @details +* +* Function : DuProcMacUeDeleteRsp +* +* Functionality: Handle UE delete response from MAC +* +* @params[in] Pointer to MacUeDeleteRsp and Pst +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp) +{ + uint16_t cellIdx=0; + if(deleteRsp) + { + if(deleteRsp->result == SUCCESS) + { + DU_LOG("\nINFO --> DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueIdx); + GET_CELL_IDX(deleteRsp->cellId, cellIdx); + if(duCb.actvCellLst[cellIdx]) + { + deleteMacUeCfg(&duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueIdx -1].macUeCfg); + } + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response : FAILURE [UE IDX : %d]",\ + deleteRsp->ueIdx); + return RFAILED; + } + DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacUeDeleteRsp)); + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response is null"); + return RFAILED; + } + return ROK; +} +/******************************************************************* +* +* @brief Sending UE Delete Req To Mac +* +* @details +* +* Function : sendUeDeleteReqToMac +* +* Functionality: +* sending UE Delete Req To Mac +* +* @params[in] uint8_t cellId, uint8_t ueId +* @return ROK - success +* RFAILED - failure +* +*****************************************************************/ + +uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueIdx, uint16_t crnti) +{ + Pst pst; + uint8_t ret=ROK; + MacUeDelete *ueDelete = NULLP; + + DU_ALLOC_SHRABL_BUF(ueDelete, sizeof(MacUeDelete)); + if(ueDelete) + { + ueDelete->cellId = cellId; + ueDelete->ueIdx = ueIdx; + ueDelete->crnti = crnti; + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_DELETE_REQ); + + /* Processing one Ue at a time to MAC */ + DU_LOG("\nDEBUG --> DU_APP: Sending UE delete Request to MAC "); + ret = (*packMacUeDeleteReqOpts[pst.selector])(&pst, ueDelete); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToMac(): Failed to send UE delete Req to MAC"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueDelete, sizeof(MacUeDelete)); + } + } + else + { + DU_LOG("\nERROR --> DU_APP: sendUeDeleteReqToMac(): Failed to allocate memory"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* +* +* @brief Du preocess Ue Delete Req to MAC and RLC +* +* @details +* +* Function : duProcUeDeleteReq +* +* Functionality: Du process Ue Delete Req to MAC and RLC +* +* @params[in] cellId, crnti +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t duProcUeDeleteReq(uint16_t cellId, uint16_t crnti) +{ + uint16_t cellIdx = 0; + uint8_t ueIdx = 0; + + DU_LOG("\nDEBUG --> DU_APP: Processing UE Delete Request "); + GET_CELL_IDX(cellId, cellIdx); + GET_UE_IDX(crnti, ueIdx); + + if(duCb.actvCellLst[cellIdx] != NULLP) + { + if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].crnti == crnti) + { + if(sendUeDeleteReqToMac(cellId, ueIdx, crnti) == RFAILED) + { + DU_LOG("\nERROR --> DU APP : duProcUeDeleteReq(): Failed to build UE delete req for MAC "); + return RFAILED; + } + + } + else + { + DU_LOG("\nERROR --> DU APP : duProcUeDeleteReq(): crnti is not found"); + return RFAILED; + } + } + else + { + DU_LOG("\nERROR --> DU APP : duProcUeDeleteReq(): Cell Id is not found"); + return RFAILED; + } + + return ROK; +} + /********************************************************************** End of file ***********************************************************************/ diff --git a/src/du_app/du_ue_mgr.h b/src/du_app/du_ue_mgr.h index 7406ce2a9..03d23c666 100644 --- a/src/du_app/du_ue_mgr.h +++ b/src/du_app/du_ue_mgr.h @@ -28,6 +28,7 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx, RlcUeCfg *duRlcUeCfg); uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId); uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo); +uint8_t duProcUeDeleteReq(uint16_t cellId, uint16_t crnti); #endif /**********************************************************************