From 5007af25423493fbc002e30d847aa05d44bc180e Mon Sep 17 00:00:00 2001 From: sphoorthi Date: Mon, 26 Apr 2021 13:08:21 +0530 Subject: [PATCH] [ISSUE ID = ODUHIGH-321] Implementation of cell delete req and rsp Change-Id: I4269c66ae088858754e8f787e6d0b895ddf13841 Signed-off-by: sphoorthi Signed-off-by: sphoorthi --- src/5gnrmac/mac_ue_mgr.c | 292 ++++++++++++++++++++++++++-- src/5gnrmac/rg_ex_ms.c | 5 + src/5gnrsch/sch_ue_mgr.c | 177 ++++++++++++++++- src/cm/common_def.h | 2 + src/cm/du_app_mac_inf.c | 158 ++++++++++++++- src/cm/du_app_mac_inf.h | 38 ++++ src/cm/mac_sch_interface.c | 53 ++++++ src/cm/mac_sch_interface.h | 39 +++- src/du_app/du_f1ap_msg_hdl.h | 1 - src/du_app/du_mgr_ex_ms.c | 5 + src/du_app/du_ue_mgr.c | 443 ++++++++++++++++++++++++++++++++++--------- src/du_app/du_ue_mgr.h | 4 +- 12 files changed, 1099 insertions(+), 118 deletions(-) diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index 09f3aad3f..8262eeef9 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -64,6 +64,20 @@ MacDuUeDeleteRspFunc macDuUeDeleteRspOpts[] = packDuMacUeDeleteRsp /* packing for light weight loosly coupled */ }; +MacSchCellDeleteReqFunc macSchCellDeleteReqOpts[]= +{ + packMacSchCellDeleteReq, /* packing for loosely coupled */ + MacSchCellDeleteReq, /* packing for tightly coupled */ + packMacSchCellDeleteReq /* packing for light weight loosely coupled */ +}; + +MacDuCellDeleteRspFunc macDuCellDeleteRspOpts[] = +{ + packDuMacCellDeleteRsp, /* packing for loosely coupled */ + DuProcMacCellDeleteRsp, /* packing for tightly coupled */ + packDuMacCellDeleteRsp /* packing for light weight loosly coupled */ +}; + /******************************************************************* * * @brief Fills mac cell group config to be sent to scheduler @@ -2433,6 +2447,7 @@ uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) * RFAILED - failure * * ****************************************************************/ + uint8_t MacSendUeDeleteRsp(uint16_t cellId, uint16_t crnti, UeDeleteStatus result) { MacUeDeleteRsp *deleteRsp; @@ -2455,6 +2470,7 @@ uint8_t MacSendUeDeleteRsp(uint16_t cellId, uint16_t crnti, UeDeleteStatus resul FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_DELETE_RSP); return (*macDuUeDeleteRspOpts[rspPst.selector])(&rspPst, deleteRsp); } + /******************************************************************* * * @brief freeing the Pucch Resrc Cfg @@ -2470,6 +2486,7 @@ uint8_t MacSendUeDeleteRsp(uint16_t cellId, uint16_t crnti, UeDeleteStatus resul * RFAILED - failure * * ****************************************************************/ + void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg) { uint8_t resrcIdx; @@ -2506,6 +2523,7 @@ void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg) } } + /******************************************************************* * * @brief Function to delete MAC Pdsch ServCellCfg @@ -2520,6 +2538,7 @@ void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg) * @return void * * ****************************************************************/ + void deleteMacPdschServCellCfg(PdschServCellCfg *pdschServCellCfg) { MAC_FREE(pdschServCellCfg->maxMimoLayers, sizeof(uint8_t)); @@ -2527,6 +2546,7 @@ void deleteMacPdschServCellCfg(PdschServCellCfg *pdschServCellCfg) MAC_FREE(pdschServCellCfg->codeBlkGrpFlushInd, sizeof(bool)); MAC_FREE(pdschServCellCfg->xOverhead, sizeof(PdschXOverhead)); } + /******************************************************************* * * @brief Handles UE Delete requst from DU APP @@ -2542,19 +2562,17 @@ void deleteMacPdschServCellCfg(PdschServCellCfg *pdschServCellCfg) * 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) { + MAC_FREE(ueCb->cellCb->macRaCb[ueCb->ueIdx-1].msg4Pdu, ueCb->cellCb->macRaCb[ueCb->ueIdx-1].msg4PduLen); + MAC_FREE(ueCb->cellCb->macRaCb[ueCb->ueIdx-1].msg4TxPdu, ueCb->cellCb->macRaCb[ueCb->ueIdx-1].msg4TbSize); + if(ueCb->cellCb->ueCfgTmpData[ueCb->ueIdx-1]) { ueCfg =ueCb->cellCb->ueCfgTmpData[ueCb->ueIdx-1]; @@ -2595,6 +2613,7 @@ void deleteMacUeCb(MacUeCb *ueCb) } memset(ueCb, 0, sizeof(MacUeCb)); } + /******************************************************************* * * @brief Processes UE delete response from scheduler @@ -2612,13 +2631,12 @@ void deleteMacUeCb(MacUeCb *ueCb) * 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) @@ -2627,14 +2645,13 @@ uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp) { 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) + if(macCb.macCell[cellIdx]) { GET_UE_IDX(schUeDelRsp->crnti, ueIdx); - ueCb = cellCb->ueCb[ueIdx -1]; - if(ueCb.crnti == schUeDelRsp->crnti) + if(macCb.macCell[cellIdx]->ueCb[ueIdx -1].crnti == schUeDelRsp->crnti) { - deleteMacUeCb(&ueCb); + deleteMacUeCb(&macCb.macCell[cellIdx]->ueCb[ueIdx -1]); + macCb.macCell[cellIdx]->numActvUe--; result = SUCCESS; ret = ROK; } @@ -2662,9 +2679,11 @@ uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp) else { DU_LOG("\nERROR --> MAC: MacProcSchUeDeleteRsp(): Failed to receive UE delete response by SCH"); + ret = RFAILED; } return ret; } + /******************************************************************* * * @brief Sends UE delete req to Scheduler @@ -2702,6 +2721,7 @@ uint8_t sendUeDelReqToSch(Pst *pst, MacUeDelete *ueDelete) } return ROK; } + /******************************************************************* * * @brief Handles UE Delete requst from DU APP @@ -2717,6 +2737,7 @@ uint8_t sendUeDelReqToSch(Pst *pst, MacUeDelete *ueDelete) * RFAILED - failure * * ****************************************************************/ + uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete) { uint8_t ret = ROK; @@ -2770,6 +2791,251 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete) return ret; } +/******************************************************************* + * + * @brief Fill and Send Cell Delete response from MAC to DU APP + * + * @details + * + * Function : MacSendCellDeleteRsp + * + * Functionality: Fill and Send Cell Delete response from MAC to DUAPP + * + * @params[in] MAC Cell delete result + * SCH Cell delete response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacSendCellDeleteRsp(CellDeleteStatus result, uint8_t cellId) +{ + MacCellDeleteRsp *deleteRsp=NULLP; + Pst rspPst; + + MAC_ALLOC_SHRABL_BUF(deleteRsp, sizeof(MacCellDeleteRsp)); + if(!deleteRsp) + { + DU_LOG("\nERROR --> MAC : MacSendCellDeleteRsp(): Memory allocation for Cell delete response failed"); + return RFAILED; + } + + /* Filling CELL delete response */ + deleteRsp->cellId = cellId; + deleteRsp->result = result; + + /* Fill Post structure and send CELL delete response*/ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_CELL_DELETE_RSP); + return (*macDuCellDeleteRspOpts[rspPst.selector])(&rspPst, deleteRsp); +} + +/******************************************************************* + * + * @brief delete MAC CellCb information + * + * @details + * + * Function : deleteMacCellCb + * + * Functionality: + * delete MAC CellCb information + * + * @params[in] MacCellCb * cellCb + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void deleteMacCellCb(MacCellCb * cellCb) +{ + uint8_t idx; + for(idx=0; idxdlSlot[idx].dlInfo.rarAlloc, sizeof(RarAlloc)); + if(cellCb->dlSlot[idx].dlInfo.ulGrant) + { + MAC_FREE(cellCb->dlSlot[idx].dlInfo.ulGrant->dciInfo.pdschCfg, sizeof(PdschCfg)); + MAC_FREE(cellCb->dlSlot[idx].dlInfo.ulGrant, sizeof(DciInfo)); + } + if(cellCb->dlSlot[idx].dlInfo.dlMsgAlloc) + { + MAC_FREE(cellCb->dlSlot[idx].dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu,\ + cellCb->dlSlot[idx].dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPduLen); + MAC_FREE(cellCb->dlSlot[idx].dlInfo.dlMsgAlloc, sizeof(DlMsgAlloc)); + } + } + + memset(cellCb, 0, sizeof(MacCellCb)); +} + +/******************************************************************* + * + * @brief Processes CELL delete response from scheduler + * + * @details + * + * Function : MacProcSchCellDeleteRsp + * + * Functionality: + * Processes CELL delete from scheduler + * + * @params[in] Pst : Post structure + * schCellDelRsp : Scheduler CELL delete respons + * @return ROK - success + * RFAILED - failure + * + * * ****************************************************************/ +uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp) +{ + uint8_t ret = ROK; + uint16_t cellIdx=0; + CellDeleteStatus status; + + if(schCellDelRsp) + { + if(schCellDelRsp->rsp == RSP_OK) + { + DU_LOG("\nINFO --> MAC : SCH CELL Delete response for cellId[%d] is successful ", \ + schCellDelRsp->cellId); + GET_CELL_IDX(schCellDelRsp->cellId, cellIdx); + if(macCb.macCell[cellIdx]) + { + if(macCb.macCell[cellIdx]->cellId == schCellDelRsp->cellId) + { + deleteMacCellCb(macCb.macCell[cellIdx]); + status = SUCCESSFUL_RSP; + MAC_FREE(macCb.macCell[cellIdx], sizeof(MacCellCb)); + } + else + { + DU_LOG("ERROR --> MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId); + status = CELL_ID_INVALID; + ret = RFAILED; + } + } + else + { + DU_LOG("ERROR --> MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId); + status = CELL_ID_INVALID; + ret = RFAILED; + } + } + else + { + DU_LOG("ERROR --> MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId); + status = CELL_ID_INVALID; + ret = RFAILED; + } + if(MacSendCellDeleteRsp(status, schCellDelRsp->cellId) != ROK) + { + DU_LOG("\nERROR --> MAC: MacProcSchCellDeleteRsp(): Failed to send CELL delete response"); + ret = RFAILED; + } + + } + else + { + DU_LOG("\nERROR --> MAC: MacProcSchCellDeleteRsp(): schCellDelRsp is NULL"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* + * + * @brief Sends Cell delete req to Scheduler + * + * @details + * + * Function : sendCellDelReqToSch + * + * Functionality: sends Cell delete req to Scheduler + * + * @params[in] SchCellDelete *schCellDel + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t sendCellDelReqToSch(SchCellDelete *schCellDel) +{ + Pst schPst; + FILL_PST_MAC_TO_SCH(schPst, EVENT_CELL_DELETE_REQ_TO_SCH); + return(*macSchCellDeleteReqOpts[schPst.selector])(&schPst, schCellDel); +} + +/******************************************************************* + * + * @brief Handles CELL Delete requst from DU APP + * + * @details + * + * Function : MacProcCellDeleteReq + * + * Functionality: Handles CELL Delete requst from DU APP + * + * @params[in] Pst *pst, MacCellDelete *cellDelete + * @return ROK - success + * RFAILED - failure + * + * + * ****************************************************************/ +uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDelete *cellDelete) +{ + uint8_t ret = ROK, cellIdx=0; + SchCellDelete schCellDelete; + + DU_LOG("\nINFO --> MAC : Cell Delete Request received for cellId[%d]", cellDelete->cellId); + + if(cellDelete) + { + GET_CELL_IDX(cellDelete->cellId, cellIdx); + if(macCb.macCell[cellIdx]) + { + if(macCb.macCell[cellIdx]->cellId == cellDelete->cellId) + { + memset(&schCellDelete, 0, sizeof(SchCellDelete)); + schCellDelete.cellId = cellDelete->cellId; + ret = sendCellDelReqToSch(&schCellDelete); + if(ret != ROK) + { + DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Failed to send UE Delete Request to SCH"); + ret = RFAILED; + } + } + else + { + DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Failed to find the MacUeCb of CellId = %d",\ + cellDelete->cellId); + ret = RFAILED; + } + } + else + { + DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Failed to find the MacUeCb of CellId = %d",\ + cellDelete->cellId); + ret = RFAILED; + } + + if(ret == RFAILED) + { + DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Sending failure response to DU"); + if(MacSendCellDeleteRsp(CELL_ID_INVALID, cellDelete->cellId) != ROK) + { + DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): failed to send cell delete rsp for cellID[%d]",\ + cellDelete->cellId); + } + + } + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellDelete, sizeof(MacCellDelete)); + } + else + { + DU_LOG("\nERROR --> MAC : MacProcCellDeleteReq(): Received MacCellDelete is NULL"); + ret = RFAILED; + } + return ret; +} /********************************************************************** End of file diff --git a/src/5gnrmac/rg_ex_ms.c b/src/5gnrmac/rg_ex_ms.c index 0319cc2ce..8f5f68d71 100755 --- a/src/5gnrmac/rg_ex_ms.c +++ b/src/5gnrmac/rg_ex_ms.c @@ -132,6 +132,11 @@ Buffer *mBuf /* message buffer */ unpackMacUeDeleteReq(MacProcUeDeleteReq, pst, mBuf); break; } + case EVENT_MAC_CELL_DELETE_REQ: + { + unpackMacCellDeleteReq(MacProcCellDeleteReq, 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 7b4c4e4c9..a3a0c5529 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -39,11 +39,17 @@ SchUeCfgRspFunc SchUeCfgRspOpts[] = SchUeDeleteRspFunc SchUeDeleteRspOpts[] = { - packSchUeDeleteRsp, /* LC */ - MacProcSchUeDeleteRsp, /* TC */ - packSchUeDeleteRsp /* LWLC */ + packSchUeDeleteRsp, /* LC */ + MacProcSchUeDeleteRsp, /* TC */ + packSchUeDeleteRsp /* LWLC */ }; +SchCellDeleteRspFunc SchCellDeleteRspOpts[]= +{ + packSchCellDeleteRsp, /* LC */ + MacProcSchCellDeleteRsp, /* TC */ + packSchCellDeleteRsp /* LWLC */ +}; /******************************************************************* * * @brief Fill and send UE cfg response to MAC @@ -621,6 +627,7 @@ uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) } return ret; } + /******************************************************************* * * @brief Fill and send UE delete response to MAC @@ -654,6 +661,7 @@ void SchSendUeDeleteRspToMac(Inst inst, SchUeDelete *ueDelete, SchMacRsp result rspPst.event = EVENT_UE_DELETE_RSP_TO_MAC; SchUeDeleteRspOpts[rspPst.selector](&rspPst, &delRsp); } + /******************************************************************* * * @brief Function to delete Sch Pucch ResrcCfg @@ -709,6 +717,7 @@ void deleteSchPucchResrcCfg(SchPucchResrcCfg *resrc) } } } + /******************************************************************* * * @brief Function to delete SCH Pdsch ServCellCfg @@ -731,6 +740,7 @@ void deleteSchPdschServCellCfg(SchPdschServCellCfg *pdschServCellCfg) SCH_FREE(pdschServCellCfg->codeBlkGrpFlushInd, sizeof(bool)); SCH_FREE(pdschServCellCfg->xOverhead, sizeof(SchPdschXOverhead)); } + /******************************************************************* * * @brief Function to delete SCH UeCb @@ -779,6 +789,7 @@ void deleteSchUeCb(SchUeCb *ueCb) memset(ueCb, 0, sizeof(SchUeCb)); } } + /******************************************************************* * * @brief Function for Ue Delete request from MAC to SCH @@ -799,7 +810,6 @@ 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) @@ -819,10 +829,10 @@ uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) else { GET_UE_IDX(ueDelete->crnti, ueIdx); - ueCb = cellCb->ueCb[ueIdx-1]; - if((ueCb.crnti == ueDelete->crnti) && (ueCb.state == SCH_UE_STATE_ACTIVE)) + if(( cellCb->ueCb[ueIdx-1].crnti == ueDelete->crnti) && ( cellCb->ueCb[ueIdx-1].state == SCH_UE_STATE_ACTIVE)) { - deleteSchUeCb(&ueCb); + deleteSchUeCb(&cellCb->ueCb[ueIdx-1]); + cellCb->numActvUe--; result = NOT_APPLICABLE; } else @@ -844,6 +854,159 @@ uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) return ret; } +/******************************************************************* + * + * @brief Fill and send Cell delete response to MAC + * + * @details + * + * Function : SchSendCellDeleteRspToMac + * + * Functionality: Fill and send Cell delete response to MAC + * + * @params[in] SchCellDelete *ueDelete, Inst inst, SchMacRsp result + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t SchSendCellDeleteRspToMac(SchCellDelete *ueDelete, Inst inst, SchMacRsp result) +{ + Pst rspPst; + uint8_t ret=0; + + SchCellDeleteRsp delRsp; + + DU_LOG("\nINFO --> SCH : Filling Cell Delete response"); + memset(&delRsp, 0, sizeof(SchCellDeleteRsp)); + delRsp.cellId = ueDelete->cellId; + delRsp.rsp = result; + + /* Filling response post */ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_SCH_TO_MAC(rspPst, inst); + rspPst.event = EVENT_CELL_DELETE_RSP_TO_MAC; + ret = SchCellDeleteRspOpts[rspPst.selector](&rspPst, &delRsp); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> SCH : SchSendCellDeleteRspToMac(): failed to send the Cell Delete response"); + return ret; + } + return ret; +} + +/******************************************************************* + * + * @brief Function for cellCb Deletion + * + * @details + * + * Function : deleteSchCellCb + * + * Functionality: Function for cellCb Deletion + * + * @params[in] SchCellDelete *cellDelete + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void deleteSchCellCb(SchCellCb *cellCb) +{ + uint8_t idx=0; + if(cellCb->schDlSlotInfo) + { + for(idx=0; idxnumSlots; idx++) + { + if(cellCb->schDlSlotInfo[idx]) + { + SCH_FREE(cellCb->schDlSlotInfo[idx]->rarInfo, sizeof(RarInfo)); + if(cellCb->schDlSlotInfo[idx]->dlMsgInfo) + { + SCH_FREE(cellCb->schDlSlotInfo[idx]->dlMsgInfo->dlMsgPdu,\ + cellCb->schDlSlotInfo[idx]->dlMsgInfo->dlMsgPduLen); + SCH_FREE(cellCb->schDlSlotInfo[idx]->dlMsgInfo, sizeof(DlMsgInfo)); + } + SCH_FREE(cellCb->schDlSlotInfo[idx], sizeof(SchDlSlotInfo)); + } + } + SCH_FREE(cellCb->schDlSlotInfo, sizeof(SchDlSlotInfo)); + } + if(cellCb->schUlSlotInfo) + { + for(idx=0; idxnumSlots; idx++) + { + if(cellCb->schUlSlotInfo[idx]) + { + SCH_FREE(cellCb->schUlSlotInfo[idx]->schPuschInfo,sizeof(SchPuschInfo)); + SCH_FREE(cellCb->schUlSlotInfo[idx], sizeof(SchUlSlotInfo)); + } + } + SCH_FREE(cellCb->schUlSlotInfo, sizeof(SchUlSlotInfo)); + } + SCH_FREE(cellCb->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg, sizeof(PdschCfg)); + memset(cellCb, 0, sizeof(SchCellCb)); +} + +/******************************************************************* + * + * @brief Function for cell Delete request from MAC to SCH + * + * @details + * + * Function : MacSchCellDeleteReq + * + * Functionality: Function for cell Delete request from MAC to SCH + * + * @params[in] Pst *pst, SchCellDelete *cellDelete + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t MacSchCellDeleteReq(Pst *pst, SchCellDelete *cellDelete) +{ + uint8_t cellIdx=0, ret = RFAILED; + Inst inst = pst->dstInst - 1; + SchMacRsp result= RSP_OK; + + if(!cellDelete) + { + DU_LOG("\nERROR --> SCH : MacSchCellDeleteReq(): Ue Delete request failed"); + } + else + { + GET_CELL_IDX(cellDelete->cellId, cellIdx); + if(schCb[inst].cells[cellIdx] == NULLP) + { + DU_LOG("\nERROR --> SCH : MacSchCellDeleteReq(): cell Id[%d] is not available", cellDelete->cellId); + result = RSP_NOK; + } + else + { + if(schCb[inst].cells[cellIdx]->cellId == cellDelete->cellId) + { + deleteSchCellCb(schCb[inst].cells[cellIdx]); + result = RSP_OK; + ret = ROK; + SCH_FREE(schCb[inst].cells[cellIdx], sizeof(SchCellCb)); + DU_LOG("\nINFO --> SCH : Sending Cell Delete response to MAC"); + } + else + { + DU_LOG("\nERROR --> SCH : MacSchCellDeleteReq(): cell Id[%d] is not available",cellDelete->cellId); + result = RSP_NOK; + } + } + + if(SchSendCellDeleteRspToMac(cellDelete, inst, result)!=ROK) + { + DU_LOG("\nERROR --> SCH : MacSchCellDeleteReq(): failed to send Cell Delete response"); + ret = RFAILED; + } + + } + return ret; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 9fe214dbf..c18af93e1 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -178,7 +178,9 @@ typedef enum { UE_CFG_INACTIVE, + UE_CFG_INPROGRESS, UE_CREATE_COMPLETE, + UE_DELETE_COMPLETE, UE_RECFG_COMPLETE }UeCfgState; diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index b136466bc..131b7fba7 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -1050,6 +1050,160 @@ uint8_t unpackDuMacUeDeleteRsp(MacDuUeDeleteRspFunc func, Pst *pst, Buffer *mBuf return RFAILED; } +/******************************************************************* + * + * @brief Unpacks Cell Delete Request received from DU APP + * + * @details + * + * Function : unpackMacCellDeleteReq + * + * Functionality: + * Unpacks Cell Delete Request received from DU APP + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t unpackMacCellDeleteReq(DuMacCellDeleteReq func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacCellDelete *cellDelete=NULLP; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&cellDelete, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, cellDelete); + } + else + { + /* Nothing to do for other + * selectors */ + DU_LOG("\nERROR --> DU APP : unpackMacCellDeleteReq(): Only LWLC supported for CELL Delete Request "); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} + +/******************************************************************* + * + * @brief Pack and send Cell delete request to MAC + * + * @details + * + * Function : packDuMacCellDeleteReq + * + * Functionality: + * Pack and send Cell delete request to MAC + * + * @params[in] Post structure + * MacCellDelete *cellDelete; + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t packDuMacCellDeleteReq(Pst *pst, MacCellDelete *cellDelete) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : packDuMacCellDeleteReq(): Memory allocation failed "); + return RFAILED; + } + CMCHKPK(oduPackPointer,(PTR)cellDelete, mBuf); + return ODU_POST_TASK(pst,mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: packDuMacCellDeleteReq(): Only LWLC supported "); + } + return RFAILED; +} + +/******************************************************************* + * + * @brief Pack and send CELL delete response from MAC to DU APP + * + * @details + * + * Function : packDuMacCellDeleteRsp + * + * Functionality: + * Pack and send CELL delete response from MAC to DU APP + * + * @params[in] Pst *pst, MacCellDeleteRsp *deleteRsp + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t packDuMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : packDuMacCellDeleteRsp(): Memory allocation failed "); + return RFAILED; + } + CMCHKPK(oduPackPointer,(PTR)cellDeleteRsp, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: packDuMacCellDeleteRsp(): Only LWLC supported "); + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); + +} + +/******************************************************************* + * + * @brief Unpack cell delete response from MAC to DU APP + * + * @details + * + * Function : unpackDuMacCellDeleteRsp + * + * Functionality: Unpack cell delete response from MAC to DU APP + * + * @params[in] MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t unpackDuMacCellDeleteRsp(MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacCellDeleteRsp *cellDeleteRsp = NULLP; + + CMCHKUNPK(oduUnpackPointer, (PTR *)&cellDeleteRsp, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, cellDeleteRsp); + } + else + { + DU_LOG("\nERROR --> DU APP : unpackDuMacCellDeleteRsp(): Only LWLC supported "); + 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 ba1b0d2fe..5b770d1dd 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -76,6 +76,8 @@ #define EVENT_MAC_UE_RECONFIG_RSP 211 #define EVENT_MAC_UE_DELETE_REQ 212 #define EVENT_MAC_UE_DELETE_RSP 213 +#define EVENT_MAC_CELL_DELETE_REQ 214 +#define EVENT_MAC_CELL_DELETE_RSP 215 #define BSR_PERIODIC_TIMER_SF_10 10 #define BSR_RETX_TIMER_SF_320 320 @@ -94,6 +96,12 @@ typedef enum UEIDX_INVALID }UeDeleteStatus; +typedef enum +{ + SUCCESSFUL_RSP, + CELL_ID_INVALID +}CellDeleteStatus; + typedef enum { DUP_MODE_FDD, @@ -1255,6 +1263,18 @@ typedef struct ueDeleteRsp UeDeleteStatus result; }MacUeDeleteRsp; +typedef struct macCellDelete +{ + uint16_t cellId; +}MacCellDelete; + +typedef struct macCellDeleteRsp +{ + uint16_t cellId; + CellDeleteStatus result; +} +MacCellDeleteRsp; + /* Functions for slot Ind from MAC to DU APP*/ typedef uint8_t (*DuMacCellUpInd) ARGS(( Pst *pst, @@ -1317,14 +1337,25 @@ typedef uint8_t (*DuMacUeReconfigReq) ARGS(( Pst *pst, MacUeCfg *ueCfg )); +/* UE Delete Request from DU APP to MAC*/ typedef uint8_t (*DuMacUeDeleteReq) ARGS(( Pst *pst, MacUeDelete *ueDel )); +/* UE Delete Response from MAC to DU APP*/ typedef uint8_t (*MacDuUeDeleteRspFunc) ARGS(( Pst *pst, MacUeDeleteRsp *deleteRsp)); +/* Cell Delete Request from DU APP to MAC*/ +typedef uint8_t (*DuMacCellDeleteReq) ARGS(( + Pst *pst, + MacCellDelete *cellDelete )); + +/* Cell Delete Response from MAC to DU APP*/ +typedef uint8_t (*MacDuCellDeleteRspFunc) ARGS(( + Pst *pst, + MacCellDeleteRsp *cellDeleteRsp)); uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId); uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf); @@ -1366,6 +1397,13 @@ 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); +uint8_t packDuMacCellDeleteReq(Pst *pst, MacCellDelete *cellDelete); +uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDelete *cellDelete); +uint8_t unpackMacCellDeleteReq(DuMacCellDeleteReq func, Pst *pst, Buffer *mBuf); +uint8_t packDuMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp); +uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp); +uint8_t unpackDuMacCellDeleteRsp(MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf); + #endif diff --git a/src/cm/mac_sch_interface.c b/src/cm/mac_sch_interface.c index 7076c2cce..430e23a83 100644 --- a/src/cm/mac_sch_interface.c +++ b/src/cm/mac_sch_interface.c @@ -354,6 +354,7 @@ uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) } return ROK; } + /******************************************************************* * * @brief Pack and Send UE Delete Request from MAC to SCH @@ -382,6 +383,7 @@ uint8_t packMacSchUeDeleteReq(Pst *pst, SchUeDelete *schUeDel) } return ROK; } + /******************************************************************* * * @brief Packs and send UE delete response @@ -405,6 +407,57 @@ uint8_t packSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *delRsp) return ROK; } +/******************************************************************* + * + * @brief Pack and Send Cell Delete Request from MAC to SCH + * + * @details + * + * Function : packMacSchCellDeleteReq + * + * Functionality: + * Pack and Send Cell Delete Request from MAC to SCH + * + * @params[in] Pst *pst, SchCellDelete *schCellDelete + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packMacSchCellDeleteReq(Pst *pst, SchCellDelete *schCellDelete) +{ + if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LC)) + { + /* TODO */ + } + else + { + return RFAILED; + } + return ROK; +} + +/******************************************************************* + * + * @brief Packs and send CELL delete response + * + * @details + * + * Function : packSchCellDeleteRsp + * + * Functionality: + * * @params[in] Post structure, SchCellDeleteRsp schCellDeleteRsp + * + * @return ROK - success + * RFAILED - failure + * + * + * ****************************************************************/ + +uint8_t packSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp) +{ + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index e3e382538..285d2000d 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -33,6 +33,9 @@ #define EVENT_UE_RECONFIG_RSP_TO_MAC 14 #define EVENT_UE_DELETE_REQ_TO_SCH 15 #define EVENT_UE_DELETE_RSP_TO_MAC 16 +#define EVENT_CELL_DELETE_REQ_TO_SCH 17 +#define EVENT_CELL_DELETE_RSP_TO_MAC 18 + /*macros*/ #define NO_SSB 0 @@ -1471,12 +1474,23 @@ typedef struct schUeDelete typedef struct schUeDeleteRsp { - uint16_t cellId; - uint16_t crnti; - SchMacRsp rsp; - ErrorCause cause; + uint16_t cellId; + uint16_t crnti; + SchMacRsp rsp; + ErrorCause cause; }SchUeDeleteRsp; +typedef struct schCellDelete +{ + uint16_t cellId; +}SchCellDelete; + + +typedef struct schCellDeleteRsp +{ + uint16_t cellId; + SchMacRsp rsp; +}SchCellDeleteRsp; typedef struct dataVolInfo { @@ -1564,13 +1578,22 @@ 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 */ + Pst *pst, /* Post structure */ + SchUeDeleteRsp *delRsp)); /* Scheduler UE delete response */ + +typedef uint8_t (*MacSchCellDeleteReqFunc) ARGS(( + Pst *pst, /* Post structure */ + SchCellDelete *schCellDelete)); /*Scheduler UE Del*/ + +typedef uint8_t (*SchCellDeleteRspFunc) ARGS(( + Pst *pst, /* Post structure */ + SchCellDeleteRsp *schCellDeleteRsp)); /* Scheduler UE delete response */ /* function declarations */ uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd); @@ -1610,6 +1633,10 @@ 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); +uint8_t packMacSchCellDeleteReq(Pst *pst, SchCellDelete *schCellDelete); +uint8_t MacSchCellDeleteReq(Pst *pst, SchCellDelete *schCellDelete); +uint8_t packSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp); +uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp); /********************************************************************** End of file diff --git a/src/du_app/du_f1ap_msg_hdl.h b/src/du_app/du_f1ap_msg_hdl.h index 27aa8200c..c52a83559 100644 --- a/src/du_app/du_f1ap_msg_hdl.h +++ b/src/du_app/du_f1ap_msg_hdl.h @@ -52,7 +52,6 @@ uint8_t BuildAndSendUeContextModResp(uint8_t ueIdx, uint8_t cellId); uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg); uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueIdx); uint8_t BuildAndSendUeContextReleaseComplete(uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId); -uint8_t duProcUeDeleteReq(uint16_t cellId, uint16_t crnti); /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index 7165e54d8..25c184291 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -272,6 +272,11 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) ret = unpackDuMacUeDeleteRsp(DuProcMacUeDeleteRsp, pst, mBuf); break; } + case EVENT_MAC_CELL_DELETE_RSP: + { + ret = unpackDuMacCellDeleteRsp(DuProcMacCellDeleteRsp, 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 34318ee20..df2d14c03 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -97,6 +97,13 @@ DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] = packDuRlcUeDeleteReq /* Light weight-loose coupling */ }; +DuMacCellDeleteReq packMacCellDeleteReqOpts[] = +{ + packDuMacCellDeleteReq, /* Loose coupling */ + MacProcCellDeleteReq, /* TIght coupling */ + packDuMacCellDeleteReq /* Light weight-loose coupling */ +}; + /******************************************************************* * * @brief Function to fillDlUserDataInfo @@ -1137,6 +1144,7 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \ /* Fetching MacDb from DuUeCb */ GET_CELL_IDX(cellId, cellIdx); duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg; + duMacDb->macUeCfgState = UE_CFG_INPROGRESS; /* Fetching MaUeCfg List for ADD/MOD/DEL */ macUeCfg->cellId = cellId; macUeCfg->ueIdx = ueIdx; @@ -1503,6 +1511,7 @@ uint8_t fillRlcUeCfg(uint16_t cellId, uint8_t ueIdx,\ /* Fetch RlcDb from DuUeCb */ GET_CELL_IDX(cellId, cellIdx); duRlcDb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg; + duRlcDb->rlcUeCfgState = UE_CFG_INPROGRESS; /*Filling RlcUeCfg */ rlcUeCfg->cellId = cellId; rlcUeCfg->ueIdx = ueIdx; @@ -1640,7 +1649,7 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\ if(macUeCfg) { memset(macUeCfg, 0, sizeof(MacUeCfg)); - memcpy(macUeCfg, &duCb.actvCellLst[cellId - 1]->ueCb[ueIdx -1].macUeCfg, sizeof(MacUeCfg)); + memcpy(macUeCfg, duMacUeCfg, sizeof(MacUeCfg)); DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to MAC"); /* Processing one Ue at a time to MAC */ @@ -2175,8 +2184,6 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK) { BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId); - duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ - macUeCfg.macUeCfgState = 0; } } } @@ -2298,8 +2305,6 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK) { BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId); - duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ - rlcUeCfg.rlcUeCfgState = 0; } } } @@ -2500,7 +2505,7 @@ uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg) * * @details * - * Function : duProcUeContextSetupRequest + * Function : duProcUeContextSetupRequest * * Functionality: Process UE context setup request from CU * @@ -2774,138 +2779,157 @@ void deleteMacUeCfg(MacUeCfg *ueCfg) /******************************************************************* * -* @brief Handle UE delete response from MAC +* @brief delete UE Configuration of a particular UE * * @details * -* Function : DuProcMacUeDeleteRsp +* Function : deleteUeCfg * -* Functionality: Handle UE delete response from MAC +* Functionality: delete UE Configuration of a particular UE * -* @params[in] Pointer to MacUeDeleteRsp and Pst +* @params[in] uint16_t cellIdx, uint8_t ueIdx * @return ROK - success * RFAILED - failure * * ****************************************************************/ - -uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp) +uint8_t deleteUeCfg(uint16_t cellIdx, uint8_t ueIdx) { - uint16_t cellIdx=0; - if(deleteRsp) + DuUeCb *ueCb = NULLP; + if(duCb.actvCellLst[cellIdx] != NULLP) { - if(deleteRsp->result == SUCCESS) + if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg.macUeCfgState == UE_DELETE_COMPLETE)\ + &&(duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg.rlcUeCfgState == UE_DELETE_COMPLETE)) { - 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]) + ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1]; + deleteMacUeCfg(&ueCb->macUeCfg); + deleteRlcUeCfg(&ueCb->rlcUeCfg); + if(ueCb->f1UeDb !=NULLP) { - deleteMacUeCfg(&duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueIdx -1].macUeCfg); + freeF1UeDb(ueCb->f1UeDb); } + duCb.actvCellLst[cellIdx]->numActvUes--; + memset(ueCb, 0, sizeof(DuUeCb)); } else { - DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response : FAILURE [UE IDX : %d]",\ - deleteRsp->ueIdx); + DU_LOG("INFO --> DU APP : deleteUeCfg(): MAC or RLC UE configuration state not UE_DELETE_COMPLETE"); 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"); + DU_LOG("ERROR --> DU APP : deleteUeCfg(): CellIdx[%d] is not found", cellIdx); return RFAILED; } return ROK; } + /******************************************************************* * -* @brief delete RlcUeCfg from duCb +* @brief Handle UE delete response from MAC * * @details * -* Function : deleteDuRlcUeCfg +* Function : DuProcMacUeDeleteRsp * -* Functionality: -* delete RlcUeCfg from duCb +* Functionality: Handle UE delete response from MAC * -* @params[in] Post structure -* Pointer to RlcUeCfg -* @return ROK - success -* RFAILED - failure +* @params[in] Pointer to MacUeDeleteRsp and Pst +* @return ROK - success +* RFAILED - failure * -*****************************************************************/ +* ****************************************************************/ -void deleteDuRlcUeCfg(RlcUeCfg *ueCfg) +uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp) { - uint8_t lcIdx = 0; - RlcBearerCfg *lcCfg= NULLP; - if(ueCfg) + uint8_t ueIdx = 0,ret =ROK; + uint16_t cellIdx=0; + uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId =0; + + if(deleteRsp) { - for(lcIdx =0 ; lcIdx < ueCfg->numLcs ; lcIdx++) + if(deleteRsp->result == SUCCESS) { - lcCfg = &ueCfg->rlcLcCfg[lcIdx]; - switch(lcCfg->rlcMode) + DU_LOG("\nINFO --> DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueIdx); + GET_CELL_IDX(deleteRsp->cellId, cellIdx); + ueIdx = deleteRsp->ueIdx; + if(duCb.actvCellLst[cellIdx]) { - case RLC_AM : - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg)); - break; - } - case RLC_UM_BI_DIRECTIONAL : + duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueIdx -1].macUeCfg.macUeCfgState = UE_DELETE_COMPLETE; + gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId; + gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId; + if(deleteUeCfg(cellIdx, ueIdx) == ROK) { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg)); - break; - } - case RLC_UM_UNI_DIRECTIONAL_UL : - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg)); - break; - } - case RLC_UM_UNI_DIRECTIONAL_DL : - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg)); - break; + ret = BuildAndSendUeContextReleaseComplete(gnbCuUeF1apId, gnbDuUeF1apId); + if(ret !=ROK) + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete"); + } } } } - memset(ueCfg, 0, sizeof(RlcUeCfg)); + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response : FAILURE [UE IDX : %d]",\ + deleteRsp->ueIdx); + ret = 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"); + ret = RFAILED; + } + return ret; } /******************************************************************* -* -* @brief Processes UE Delete Rsp received from RLC -* -* @details -* -* Function : DuProcRlcUeDeleteRsp -* -* Functionality: -* Processes UE Delete Rsp received from RLC -* -* @params[in] Post structure -* Pointer to RlcUeDeleteRsp -* @return ROK - success -* RFAILED - failure -* -*****************************************************************/ + * + * @brief Processes UE Delete Rsp received from RLC + * + * @details + * + * Function : DuProcRlcUeDeleteRsp + * + * Functionality: + * Processes UE Delete Rsp received from RLC + * + * @params[in] Post structure + * Pointer to RlcUeDeleteRsp + * @return ROK - success + * RFAILED - failure + * + * *****************************************************************/ uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp) { - uint8_t ueIdx = 0, ret = ROK; + uint8_t ueIdx = 0, ret = ROK; uint16_t cellIdx = 0; + uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId =0; + if(delRsp) { ueIdx = delRsp->ueIdx; GET_CELL_IDX(delRsp->cellId, cellIdx); - + if(delRsp->result == SUCCESSFUL) { DU_LOG("\nINFO --> DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueIdx); if(duCb.actvCellLst[cellIdx]!=NULLP) { - deleteDuRlcUeCfg(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg); + duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg.rlcUeCfgState = UE_DELETE_COMPLETE; + gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId; + gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId; + if(deleteUeCfg(cellIdx, ueIdx) == ROK) + { + ret = BuildAndSendUeContextReleaseComplete(gnbCuUeF1apId, gnbDuUeF1apId); + if(ret != ROK) + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete"); + } + } } } else @@ -2920,8 +2944,8 @@ uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp) } /******************************************************************* -* -* @brief Sending UE Delete Req To Mac + * + * @brief Sending UE Delete Req To Mac * * @details * @@ -3029,40 +3053,283 @@ uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueIdx) * * ****************************************************************/ -uint8_t duProcUeDeleteReq(uint16_t cellId, uint16_t crnti) +uint8_t duProcUeDeleteReq(uint16_t cellId) { - uint16_t cellIdx = 0; - uint8_t ueIdx = 0; + uint8_t ueIdx = 0, ueId =0; + uint16_t cellIdx = 0, crnti = 0; DU_LOG("\nDEBUG --> DU_APP: Processing UE Delete Request "); GET_CELL_IDX(cellId, cellIdx); - GET_UE_IDX(crnti, ueIdx); + GET_CRNTI(crnti,ueIdx); if(duCb.actvCellLst[cellIdx] != NULLP) { - if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].crnti == crnti) + for(ueIdx =0;ueIdx< duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++) { - if(sendUeDeleteReqToRlc(cellId, ueIdx) == RFAILED) + ueId = ueIdx+1; + if(sendUeDeleteReqToRlc(cellId, ueId) == RFAILED) { DU_LOG("\nERROR --> DU APP : duProcUeDeleteReq():Failed to build UE delete req for RLC "); return RFAILED; } - if(sendUeDeleteReqToMac(cellId, ueIdx, crnti) == RFAILED) + + GET_CRNTI(crnti,ueId); + if(sendUeDeleteReqToMac(cellId, ueId, 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(): Cell Id is not found"); + return RFAILED; + } + + return ROK; +} + +/******************************************************************* + * + * @brief delete RlcUeCfg from duCb + * + * @details + * + * Function : deleteRlcUeCfg + * + * Functionality: + * delete RlcUeCfg from duCb + * + * @params[in] RlcUeCfg *ueCfg + * + * @return ROK - success + * RFAILED - failure + * + *****************************************************************/ + +void deleteRlcUeCfg(RlcUeCfg *ueCfg) +{ + uint8_t lcIdx = 0; + RlcBearerCfg *lcCfg= NULLP; + if(ueCfg) + { + for(lcIdx =0 ; lcIdx < ueCfg->numLcs ; lcIdx++) + { + lcCfg = &ueCfg->rlcLcCfg[lcIdx]; + switch(lcCfg->rlcMode) + { + case RLC_AM : + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg)); + break; + } + case RLC_UM_BI_DIRECTIONAL : + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg)); + break; + } + case RLC_UM_UNI_DIRECTIONAL_UL : + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg)); + break; + } + case RLC_UM_UNI_DIRECTIONAL_DL : + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg)); + break; + } + } + } + memset(ueCfg, 0, sizeof(RlcUeCfg)); + } +} +/******************************************************************* + * + * @brief Delete DU CellCb information + * + * @details + * + * Function : deleteDuCellCb + * + * Functionality: Delete DU CellCb information + * + * @params[in] DuCellCb *cellCb + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +void deleteDuCellCb(DuCellCb *cellCb) +{ + + if(cellCb->duMacCellCfg) + { + if(cellCb->duMacCellCfg->prachCfg.fdm[0].unsuedRootSeq) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellCb->duMacCellCfg->prachCfg.fdm[0].unsuedRootSeq,\ + cellCb->duMacCellCfg->prachCfg.fdm[0].numUnusedRootSeq); + } + if(cellCb->duMacCellCfg->sib1Cfg.sib1Pdu) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,cellCb->duMacCellCfg->sib1Cfg.sib1Pdu,\ + cellCb->duMacCellCfg->sib1Cfg.sib1PduLen); + } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellCb->duMacCellCfg, sizeof(MacCellCfg)); + } + memset(cellCb, 0, sizeof(DuCellCb)); + +} + +/******************************************************************* + * + * @brief Handle Cell delete response from MAC + * + * @details + * + * Function : DuProcMacCellDeleteRsp + * + * Functionality: Handle Cell delete response from MAC + * + * @params[in] Pointer to MacCellDeleteRsp and Pst + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp) +{ + uint8_t ret = ROK; + uint16_t cellIdx=0; + if(deleteRsp) + { + if(deleteRsp->result == SUCCESSFUL_RSP) + { + GET_CELL_IDX(deleteRsp->cellId, cellIdx); + DU_LOG("\nINFO --> DU APP : MAC CELL Delete Response : SUCCESS [CELL IDX : %d]", deleteRsp->cellId); + if(duCb.actvCellLst[cellIdx]->cellId == deleteRsp->cellId) + { + deleteDuCellCb(duCb.actvCellLst[cellIdx]); + duCb.numActvCells--; + DU_FREE(duCb.actvCellLst[cellIdx], sizeof(DuCellCb)); + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacCellDeleteRsp(): CellId [%d] doesnot exist", deleteRsp->cellId); + ret = RFAILED; + } } else { - DU_LOG("\nERROR --> DU APP : duProcUeDeleteReq(): crnti is not found"); + DU_LOG("\nERROR --> DU APP : DuProcMacCellDeleteRsp(): MAC CELL Delete Response : FAILED\ + [CELL IDX : %d]", deleteRsp->cellId); + ret = RFAILED; + } + DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacUeDeleteRsp)); + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacCellDeleteRsp(): Received MAC cell delete response is NULL"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* + * + * @brief Sending Cell Delete Req To Mac + * + * @details + * + * Function : sendCellDeleteReqToMac + * + * Functionality: + * sending Cell Delete Req To Mac + * + * @params[in] uint16_t cellId + * @return ROK - success + * RFAILED - failure + * + * + *****************************************************************/ + +uint8_t sendCellDeleteReqToMac(uint16_t cellId) +{ + Pst pst; + uint8_t ret=ROK; + MacCellDelete *cellDelete = NULLP; + + DU_ALLOC(cellDelete, sizeof(MacCellDelete)); + if(cellDelete) + { + cellDelete->cellId = cellId; + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_DELETE_REQ); + + DU_LOG("\nINFO --> DU APP : Sending Cell Delete Request to MAC"); + /* Processing one Cell at a time to MAC */ + ret = (*packMacCellDeleteReqOpts[pst.selector])(&pst, cellDelete); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU APP : sendCellDeleteReqToMac(): Failed to send Cell delete Req to MAC"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellDelete, sizeof(MacCellDelete)); + } + } + else + { + DU_LOG("\nERROR --> DU APP : sendCellDeleteReqToMac(): Failed to allocate memory"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* + * + * @brief DU preocess Cell Delete Req to MAC + * + * @details + * + * Function : duProcCellDeleteReq + * + * Functionality: DU process Cell Delete Req to MAC + * + * @params[in] uint16_t cellId + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t duProcCellDeleteReq(uint16_t cellId) +{ + uint16_t cellIdx = 0; + + DU_LOG("\nINFO --> DU APP : Processing Cell Delete Request "); + GET_CELL_IDX(cellId, cellIdx); + + if(duCb.actvCellLst[cellIdx] != NULLP) + { + if(duBuildAndSendMacCellStop() == RFAILED) + { + DU_LOG("\nERROR --> DU APP : duProcCellDeleteReq(): Failed to process Cell delete req for cellId[%d]",cellId); + return RFAILED; + } + + if(duCb.actvCellLst[cellIdx]->numActvUes) + { + DU_LOG("\nERROR --> DU APP : duProcCellDeleteReq(): Active UEs present Failed to process cell Delete\ + Req for cellID[%d]", cellId); + return RFAILED; + } + if(sendCellDeleteReqToMac(cellId) == RFAILED) + { + DU_LOG("\nERROR --> DU APP : duProcCellDeleteReq(): Failed to build and send Cell delete req for MAC for\ + cellId[%d]",cellId); return RFAILED; } } else { - DU_LOG("\nERROR --> DU APP : duProcUeDeleteReq(): Cell Id is not found"); + DU_LOG("\nERROR --> DU APP : duProcCellDeleteReq(): CellId[%d] is not found", cellId); return RFAILED; } diff --git a/src/du_app/du_ue_mgr.h b/src/du_app/du_ue_mgr.h index 03d23c666..0fa49eb05 100644 --- a/src/du_app/du_ue_mgr.h +++ b/src/du_app/du_ue_mgr.h @@ -28,7 +28,9 @@ 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); +uint8_t duProcUeDeleteReq(uint16_t cellId); +void deleteRlcUeCfg(RlcUeCfg *ueCfg); +void freeF1UeDb(F1UeContextSetupDb *f1UeDb); #endif /********************************************************************** -- 2.16.6