From 1e3256d5495c8ff96506ce6f6cf60d2a500bafec Mon Sep 17 00:00:00 2001 From: sphoorthi Date: Tue, 4 May 2021 21:52:35 +0530 Subject: [PATCH] JIRA ID = ODUHIGH-334 Implementation of DLRRC message for RRC RELEASE Change-Id: If590bd38f1a6f9c8fa084e462a5d62d45755e80e Signed-off-by: sphoorthi --- src/5gnrmac/mac_msg_hdl.c | 50 +++++----- src/5gnrmac/mac_slot_ind.c | 8 +- src/5gnrmac/mac_ue_mgr.c | 8 +- src/5gnrrlc/rlc_cfg_dl.c | 9 +- src/5gnrrlc/rlc_cfg_ul.c | 1 + src/5gnrrlc/rlc_dbm_dl.c | 3 + src/5gnrrlc/rlc_dl_ul_inf_ul.c | 2 +- src/5gnrrlc/rlc_layer_mgr.c | 11 +++ src/5gnrrlc/rlc_mgr.h | 2 +- src/5gnrrlc/rlc_msg_hdl.c | 65 ++---------- src/5gnrrlc/rlc_tmr.c | 155 ++++++++++++++++++++++++----- src/5gnrrlc/rlc_ul.h | 30 ++++-- src/5gnrrlc/rlc_utils.h | 13 ++- src/5gnrrlc/rlc_utl_dl.c | 17 +--- src/5gnrsch/sch.c | 21 +++- src/5gnrsch/sch_slot_ind.c | 5 + src/cm/ckw.x | 4 +- src/cm/common_def.h | 8 +- src/cm/du_app_mac_inf.h | 4 +- src/cm/du_app_rlc_inf.h | 4 +- src/du_app/du_cell_mgr.c | 1 + src/du_app/du_f1ap_msg_hdl.c | 157 +++++++++++++++++++++++++---- src/du_app/du_f1ap_msg_hdl.h | 8 +- src/du_app/du_mgr.h | 5 +- src/du_app/du_msg_hdl.c | 97 ++++++++++-------- src/du_app/du_ue_mgr.c | 218 ++++++++++++++++++++++++++--------------- src/du_app/du_ue_mgr.h | 4 +- 27 files changed, 617 insertions(+), 293 deletions(-) diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index c3a4b80c1..cdfe2951e 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -213,11 +213,11 @@ uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData) uint8_t pduIdx =0; uint8_t lcIdx = 0; uint8_t *txPdu =NULLP; - uint16_t tbSize =0; + uint16_t tbSize =0,cellIdx=0; MacDlData macDlData; MacDlSlot *currDlSlot = NULLP; DlRlcBoInfo dlBoInfo; - + memset(&macDlData , 0, sizeof(MacDlData)); DU_LOG("\nDEBUG --> MAC: Received DL data for sfn=%d slot=%d numPdu= %d", \ dlData->slotInfo.sfn, dlData->slotInfo.slot, dlData->numPdu); @@ -230,24 +230,27 @@ uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData) macDlData.pduInfo[pduIdx].dlPdu = dlData->pduInfo[pduIdx].pduBuf; } + GET_CELL_IDX(dlData->cellId, cellIdx); /* Store DL data in the scheduled slot */ - currDlSlot = &macCb.macCell[dlData->cellId -1]->dlSlot[dlData->slotInfo.slot]; - if(currDlSlot) + if(macCb.macCell[cellIdx] ==NULLP) { - if(currDlSlot->dlInfo.dlMsgAlloc) + DU_LOG("\nERROR --> MAC : MacProcRlcDlData(): macCell does not exists"); + return RFAILED; + } + currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlData->slotInfo.slot]; + if(currDlSlot->dlInfo.dlMsgAlloc) + { + tbSize = currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg.codeword[0].tbSize; + MAC_ALLOC(txPdu, tbSize); + if(!txPdu) { - tbSize = currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg.codeword[0].tbSize; - MAC_ALLOC(txPdu, tbSize); - if(!txPdu) - { - DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcRlcDlData"); - return RFAILED; - } - macMuxPdu(&macDlData, NULLP, txPdu, tbSize); - - currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPduLen = tbSize; - currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu = txPdu; + DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcRlcDlData"); + return RFAILED; } + macMuxPdu(&macDlData, NULLP, txPdu, tbSize); + + currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPduLen = tbSize; + currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu = txPdu; } for(lcIdx = 0; lcIdx < dlData->numLc; lcIdx++) @@ -267,11 +270,11 @@ uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData) for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++) { MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData->pduInfo[pduIdx].pduBuf,\ - dlData->pduInfo[pduIdx].pduLen); + dlData->pduInfo[pduIdx].pduLen); } if(pstInfo->selector == ODU_SELECTOR_LWLC) { - MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData, sizeof(RlcData)); + MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData, sizeof(RlcData)); } return ROK; } @@ -478,10 +481,13 @@ uint8_t MacProcCellStop(Pst *pst, OduCellId *cellId) DU_LOG("\nINFO --> MAC : Sending cell stop request to Lower Mac"); GET_CELL_IDX(cellId->cellId, cellIdx); - slotInfo.cellId = cellId->cellId; - slotInfo.sfn = macCb.macCell[cellIdx]->currTime.sfn; - slotInfo.slot = macCb.macCell[cellIdx]->currTime.slot; - sendToLowerMac(FAPI_STOP_REQUEST, 0, &slotInfo); + if(macCb.macCell[cellIdx]) + { + slotInfo.cellId = cellId->cellId; + slotInfo.sfn = macCb.macCell[cellIdx]->currTime.sfn; + slotInfo.slot = macCb.macCell[cellIdx]->currTime.slot; + sendToLowerMac(FAPI_STOP_REQUEST, 0, &slotInfo); + } #endif MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \ diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index 37cb68751..0233223ab 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -303,7 +303,13 @@ uint8_t macProcSlotInd(SlotIndInfo slotInd) uint16_t cellIdx = 0; GET_CELL_IDX(slotInd.cellId, cellIdx); - + + if(macCb.macCell[cellIdx] == NULLP) + { + DU_LOG("ERROR --> MAC : macProcSlotInd(): CellId[%d] does not exist. Error occurred at SFN [%d] Slot [%d]",\ + slotInd.cellId, slotInd.sfn, slotInd.slot); + return RFAILED; + } /* Store current time info */ macCb.macCell[cellIdx]->currTime.cellId = slotInd.cellId; macCb.macCell[cellIdx]->currTime.slot = slotInd.slot; diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index 8262eeef9..965e2f77a 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -2462,7 +2462,7 @@ uint8_t MacSendUeDeleteRsp(uint16_t cellId, uint16_t crnti, UeDeleteStatus resul /* Filling UE delete response */ deleteRsp->cellId = cellId; - GET_UE_IDX(crnti,deleteRsp->ueIdx); + GET_UE_IDX(crnti,deleteRsp->ueId); deleteRsp->result = result; /* Fill Post structure and send UE delete response*/ @@ -2746,7 +2746,7 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete) MacUeCb *ueCb = NULLP; MacCellCb *cellCb = NULLP; - DU_LOG("\nINFO --> MAC : UE Delete Request received for ueIdx[%d]", ueDelete->ueIdx); + DU_LOG("\nINFO --> MAC : UE Delete Request received for ueId[%d]", ueDelete->ueId); if(ueDelete) { @@ -2754,7 +2754,7 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete) cellCb = macCb.macCell[cellIdx]; if(cellCb) { - ueCb = &cellCb->ueCb[ueDelete->ueIdx-1]; + ueCb = &cellCb->ueCb[ueDelete->ueId-1]; if(ueCb->crnti == ueDelete->crnti) { ret = sendUeDelReqToSch(pst, ueDelete); @@ -2772,7 +2772,7 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete) } else { - DU_LOG("\nERROR --> MAC : MacProcUeDeleteReq(): Failed to find the MacUeCb of UeIdx = %d",ueDelete->ueIdx); + DU_LOG("\nERROR --> MAC : MacProcUeDeleteReq(): Failed to find the MacUeCb of UeIdx = %d",ueDelete->ueId); result = CELLID_INVALID; } diff --git a/src/5gnrrlc/rlc_cfg_dl.c b/src/5gnrrlc/rlc_cfg_dl.c index dcc1a2c4b..89c4318c8 100755 --- a/src/5gnrrlc/rlc_cfg_dl.c +++ b/src/5gnrrlc/rlc_cfg_dl.c @@ -706,14 +706,9 @@ RlcEntCfgCfmInfo *entCfm return RFAILED; } /* Start throughput calculation for this UE */ - gCb->rlcThpt.thptPerUe[gCb->rlcThpt.numActvUe].ueIdx = ueId; - gCb->rlcThpt.thptPerUe[gCb->rlcThpt.numActvUe].dataVol = 0; + gCb->rlcThpt.thptPerUe[ueId -1].ueId = ueId; + gCb->rlcThpt.thptPerUe[ueId -1].dataVol = 0; gCb->rlcThpt.numActvUe++; - - if((rlcChkTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR)) == FALSE) - { - rlcStartTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR); - } } /* Validate LChId for UM and AM modes */ diff --git a/src/5gnrrlc/rlc_cfg_ul.c b/src/5gnrrlc/rlc_cfg_ul.c index 6d64fc090..ea54ed5fa 100755 --- a/src/5gnrrlc/rlc_cfg_ul.c +++ b/src/5gnrrlc/rlc_cfg_ul.c @@ -639,6 +639,7 @@ RlcUlCfgTmpData *cfgTmpData return RFAILED; } rlcDbmAddUlUeCb(gCb, cfgTmpData->ueId, cfgTmpData->cellId, cfgTmpData->ueCb); + cfgTmpData->ueCb->ueDeleteInfo.ueDelTmr.tmrEvnt = TMR_NONE; } else { diff --git a/src/5gnrrlc/rlc_dbm_dl.c b/src/5gnrrlc/rlc_dbm_dl.c index 68be78715..040d37a8b 100755 --- a/src/5gnrrlc/rlc_dbm_dl.c +++ b/src/5gnrrlc/rlc_dbm_dl.c @@ -468,6 +468,9 @@ Void rlcDbmDelDlUeCb(RlcCb *gCb,RlcDlUeCb *ueCb,Bool abortFlag) DU_LOG("\nERROR --> RLC_DL : UeId[%u] HashList Insertion Failed", ueCb->ueId); } + memset(&gCb->rlcThpt.thptPerUe[ueCb->ueId -1], 0, sizeof(RlcThptPerUe)); + gCb->rlcThpt.numActvUe--; + /* kw005.201 ccpu00117318, updating the statistics */ gCb->genSts.numUe--; diff --git a/src/5gnrrlc/rlc_dl_ul_inf_ul.c b/src/5gnrrlc/rlc_dl_ul_inf_ul.c index 0831de8e4..b97cf15ac 100755 --- a/src/5gnrrlc/rlc_dl_ul_inf_ul.c +++ b/src/5gnrrlc/rlc_dl_ul_inf_ul.c @@ -271,7 +271,7 @@ RlcCfgCfmInfo *cfmInfo else if (tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_DELETE_REQ) { FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_DELETE_RSP); - if(sendRlcUeDeleteRspToDu(cfgCfm->ueId, cfgCfm->cellId, SUCCESSFUL) != ROK) + if(sendRlcUeDeleteRspToDu(cfgCfm->cellId, cfgCfm->ueId, SUCCESSFUL) != ROK) { DU_LOG("ERROR --> RLC_UL: rlcUlUdxCfgCfm(): Failed to send UE delete response "); return RFAILED; diff --git a/src/5gnrrlc/rlc_layer_mgr.c b/src/5gnrrlc/rlc_layer_mgr.c index f08d4e4fa..8fc762ae0 100755 --- a/src/5gnrrlc/rlc_layer_mgr.c +++ b/src/5gnrrlc/rlc_layer_mgr.c @@ -392,6 +392,17 @@ static S16 rlcLmmGenCfg(RlcCb *gCb,RlcGenCfg *cfg) gCb->init.cfgDone = TRUE; + /* TODO : make this generic for DL and UL after support for UL throughput calculation is added */ + if(gCb->genCfg.rlcMode == LKW_RLC_MODE_DL) + { + /* Starting timer to print throughput */ + if((rlcChkTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR)) == FALSE) + { + DU_LOG("\nINFO --> RLC_DL : Starting Throughput timer"); + rlcStartTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR); + } + } + return (LCM_REASON_NOT_APPL); } diff --git a/src/5gnrrlc/rlc_mgr.h b/src/5gnrrlc/rlc_mgr.h index d89b95a36..dd5432c42 100644 --- a/src/5gnrrlc/rlc_mgr.h +++ b/src/5gnrrlc/rlc_mgr.h @@ -19,7 +19,7 @@ /* This file stores defines used at RLC interface */ uint8_t fillRlcUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp); uint8_t SendRlcUeCfgRspToDu(Pst *pst, RlcCfgCfmInfo *cfgRsp); -uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult result); +uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId, uint8_t ueId, UeDeleteResult result); /********************************************************************** End of file diff --git a/src/5gnrrlc/rlc_msg_hdl.c b/src/5gnrrlc/rlc_msg_hdl.c index 063d9e51f..d3fdff66d 100644 --- a/src/5gnrrlc/rlc_msg_hdl.c +++ b/src/5gnrrlc/rlc_msg_hdl.c @@ -730,13 +730,13 @@ uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo) * Functionality: * sending UE delete response to DU * - * @params[in] uint8_t ueIdx, uint8_t cellId, UeDeleteResult result + * @params[in] uint8_t cellId, uint8_t ueIdx, UeDeleteResult result * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult result) +uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId,uint8_t ueId, UeDeleteResult result) { Pst pst; RlcUeDeleteRsp *ueDeleteRsp = NULLP; @@ -752,7 +752,7 @@ uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult re else { ueDeleteRsp->cellId = cellId; - ueDeleteRsp->ueIdx = ueIdx; + ueDeleteRsp->ueId = ueId; ueDeleteRsp->result = result; if(rlcSendUeDeleteRspToDu(&pst, ueDeleteRsp) == ROK) @@ -769,41 +769,6 @@ uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult re return ROK; } -/* **************************************************************** -* -* @brief filling RLC UE delete configuration -* -* @details -* -* Function : fillRlcCfgInfo -* -* Functionality: filling RLC UE delete configuration -* -* @params[in] RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg -* -* @return void -* -* ****************************************************************/ - -void fillRlcUeDelInfo(RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg) -{ - uint8_t lcIdx; - - rlcUeCfg->ueId = ueCb->ueId; - rlcUeCfg->cellId = ueCb->cellId; - rlcUeCfg->numEnt = 0; - for(lcIdx=0; lcIdxnumEnt < 1; lcIdx++) - { - if(ueCb->lCh[lcIdx].ulRbCb != NULLP) - { - rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbId = 0; - rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbType = 0; - rlcUeCfg->entCfg[rlcUeCfg->numEnt].cfgType = CKW_CFG_DELETE_UE; - rlcUeCfg->numEnt++; - } - } -} - /******************************************************************* * * @brief Handles Ue delete Request from DU APP @@ -826,35 +791,23 @@ uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete) { uint8_t ret = ROK; RlcCb *gRlcCb = NULLP; - RlcCfgInfo *rlcUeCfg = NULLP; RlcUlUeCb *ueCb = NULLP; UeDeleteResult result=SUCCESSFUL; - DU_LOG("\nDEBUG --> RLC: UE Delete request received. CellID[%d] UEIDX[%d]",ueDelete->cellId, ueDelete->ueIdx); + DU_LOG("\nDEBUG --> RLC: UE Delete request received. CellID[%d] UEID[%d]",ueDelete->cellId, ueDelete->ueId); if(ueDelete != NULLP) { gRlcCb = RLC_GET_RLCCB(pst->dstInst); - rlcDbmFetchUlUeCb(gRlcCb,ueDelete->ueIdx, ueDelete->cellId, &ueCb); + rlcDbmFetchUlUeCb(gRlcCb,ueDelete->ueId, ueDelete->cellId, &ueCb); if(ueCb != NULLP) { if(ueDelete->cellId == ueCb->cellId) { - RLC_ALLOC(gRlcCb, rlcUeCfg, sizeof(RlcCfgInfo)); - if(rlcUeCfg == NULLP) - { - DU_LOG("\nERROR --> RLC: deleteRlcUeCb(): Failed to allocate memory"); - ret = RFAILED; - } - else + memcpy(&ueCb->ueDeleteInfo.pst, pst, sizeof(Pst)); + if((rlcChkTmr(gRlcCb, (PTR)ueCb, EVENT_RLC_UE_DELETE_TMR)) == FALSE) { - memset(rlcUeCfg, 0, sizeof(RlcCfgInfo)); - fillRlcUeDelInfo(ueCb, rlcUeCfg); - if(RlcProcCfgReq(pst, rlcUeCfg) != ROK) - { - DU_LOG("\nERROR --> RLC: deleteRlcUeCb(): Failed to delete UE information"); - result = INVALID_UEID; - } + rlcStartTmr(gRlcCb,(PTR)ueCb, EVENT_RLC_UE_DELETE_TMR); } } else @@ -869,7 +822,7 @@ uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete) if(result != SUCCESSFUL) { - ret = sendRlcUeDeleteRspToDu(ueDelete->ueIdx, ueDelete->cellId, result); + ret = sendRlcUeDeleteRspToDu(ueDelete->cellId, ueDelete->ueId, result); if(ret != ROK) { DU_LOG("\nERROR --> RLC: RlcProcUeDeleteReq():Failed to send UE Delete response to DU"); diff --git a/src/5gnrrlc/rlc_tmr.c b/src/5gnrrlc/rlc_tmr.c index d7ecd63d6..bd7ccfea5 100755 --- a/src/5gnrrlc/rlc_tmr.c +++ b/src/5gnrrlc/rlc_tmr.c @@ -48,10 +48,13 @@ #include "kwu.x" /* KWU */ #include "rgu.x" /* RGU */ +#include "du_app_rlc_inf.h" #include "rlc_utils.h" /* RLC defines */ #include "rlc_dl_ul_inf.h" #include "rlc_dl.h" #include "rlc_ul.h" +#include "rlc_mgr.h" + /** * @file gp_tmr.c * @brief RLC Timer Module @@ -81,7 +84,6 @@ /* private function declarations */ static Void rlcBndTmrExpiry(PTR cb); -void rlcThptTmrExpiry(PTR cb); /** * @brief Handler to start timer @@ -183,6 +185,14 @@ void rlcStartTmr(RlcCb *gCb, PTR cb, int16_t tmrEvnt) arg.max = RLC_MAX_THPT_TMR; break; } + case EVENT_RLC_UE_DELETE_TMR: + { + RlcUlUeCb *ulUeCb = (RlcUlUeCb*)cb; + RLC_TMR_CALCUATE_WAIT(arg.wait, RLC_UE_DELETE_WAIT_TIME, gCb->genCfg.timeRes); + arg.timers = &ulUeCb->ueDeleteInfo.ueDelTmr; + arg.max = RLC_MAX_UE_TMR; + break; + } default: { DU_LOG("\nERROR --> RLC : rlcStartTmr: Invalid tmr Evnt [%d]", tmrEvnt); @@ -270,6 +280,11 @@ void rlcStopTmr(RlcCb *gCb, PTR cb, uint8_t tmrType) arg.timers = &((RlcThpt *)cb)->thptTmr; arg.max = RLC_MAX_THPT_TMR; } + case EVENT_RLC_UE_DELETE_TMR: + { + arg.timers = &((RlcUlUeCb*)cb)->ueDeleteInfo.ueDelTmr; + arg.max = EVENT_RLC_UE_DELETE_TMR; + } default: { DU_LOG("\nERROR --> RLC : rlcStopTmr: Invalid tmr Evnt[%d]", tmrType); @@ -348,6 +363,11 @@ Void rlcTmrExpiry(PTR cb,S16 tmrEvnt) rlcThptTmrExpiry(cb); break; } + case EVENT_RLC_UE_DELETE_TMR: + { + rlcUeDeleteTmrExpiry(cb); + break; + } default: { break; @@ -401,6 +421,10 @@ bool rlcChkTmr(RlcCb *gCb, PTR cb, int16_t tmrEvnt) { return (((RlcThpt *)cb)->thptTmr.tmrEvnt == EVENT_RLC_THROUGHPUT_TMR); } + case EVENT_RLC_UE_DELETE_TMR: + { + return (((RlcUlUeCb *)cb)->ueDeleteInfo.ueDelTmr.tmrEvnt == EVENT_RLC_UE_DELETE_TMR); + } default: { DU_LOG("\nERROR --> RLC : rlcChkTmr: Invalid tmr Evnt [%d]", tmrEvnt); @@ -414,17 +438,17 @@ bool rlcChkTmr(RlcCb *gCb, PTR cb, int16_t tmrEvnt) * @brief Handler to do processing on expiry of the bind timer * * @details - * This function processes the RLC bind timer expiry. If the number of - * retries is less than the maximum retry counter, bind request is sent + * This function processes the RLC bind timer expiry. If the number of + * retries is less than the maximum retry counter, bind request is sent * again, else an alarm is raised to the layer manager. - * + * * @param[in] cb Pointer to the Rgu sap * * @return Void */ static Void rlcBndTmrExpiry(PTR cb) { - RlcRguSapCb *rguSapCb; + RlcRguSapCb *rguSapCb; rguSapCb = (RlcRguSapCb *) cb; @@ -434,9 +458,9 @@ static Void rlcBndTmrExpiry(PTR cb) { /* start timer to wait for bind confirm */ rlcStartTmr(RLC_GET_RLCCB(rguSapCb->pst.srcInst), - (PTR)rguSapCb, + (PTR)rguSapCb, EVENT_RLC_WAIT_BNDCFM); - + /* Send bind request */ rguSapCb->retryCnt++; RlcLiRguBndReq (&rguSapCb->pst, rguSapCb->suId, rguSapCb->spId); @@ -449,17 +473,17 @@ static Void rlcBndTmrExpiry(PTR cb) /* Send alarm to the layer manager */ #ifdef LTE_L2_MEAS rlcLmmSendAlarm(RLC_GET_RLCCB(rguSapCb->pst.srcInst), - LCM_CATEGORY_INTERFACE, + LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_FAIL, - LCM_CAUSE_TMR_EXPIRED, - 0, - 0, + LCM_CAUSE_TMR_EXPIRED, + 0, + 0, 0); #else rlcLmmSendAlarm(RLC_GET_RLCCB(rguSapCb->pst.srcInst), - LCM_CATEGORY_INTERFACE, + LCM_CATEGORY_INTERFACE, LCM_EVENT_BND_FAIL, - LCM_CAUSE_TMR_EXPIRED, + LCM_CAUSE_TMR_EXPIRED, 0, /* suId */ 0 /* ueId */); #endif @@ -484,22 +508,36 @@ void rlcThptTmrExpiry(PTR cb) uint16_t ueIdx; long double tpt; RlcThpt *rlcThptCb = (RlcThpt*)cb; + + /* If cell is not up, throughput details cannot be printed */ + if(gCellStatus != CELL_UP) + { + /* Restart timer */ + rlcStartTmr(RLC_GET_RLCCB(rlcThptCb->inst), (PTR)rlcThptCb, EVENT_RLC_THROUGHPUT_TMR); + return; + } - /* Print throughput */ + /* If cell is up, print throughout for each UE attached to the cell */ DU_LOG("\n===================== DL Throughput =============================="); DU_LOG("\nNumber of UEs : %d", rlcThptCb->numActvUe); - for(ueIdx = 0; ueIdx < rlcThptCb->numActvUe; ueIdx++) + if(rlcThptCb->numActvUe) { - /* Spec 28.552, section 5.1.1.3 : - * Throughput in kilobits/sec = (dataVol in kiloBits * 1000)/time in milligseconds - * - * Since our dataVol is in bytes, multiplying 0.008 to covert into kilobits i.e. - * Throughput[kbits/sec] = (dataVol * 0.008 * 1000)/time in ms - */ - tpt = (double)(rlcThptCb->thptPerUe[ueIdx].dataVol * 8)/(double)ODU_THROUGHPUT_PRINT_TIME_INTERVAL; + for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) + { + if(rlcThptCb->thptPerUe[ueIdx].ueId) + { + /* Spec 28.552, section 5.1.1.3 : + * Throughput in kilobits/sec = (dataVol in kiloBits * 1000)/time in milligseconds + * + * Since our dataVol is in bytes, multiplying 0.008 to covert into kilobits i.e. + * Throughput[kbits/sec] = (dataVol * 0.008 * 1000)/time in ms + */ + tpt = (double)(rlcThptCb->thptPerUe[ueIdx].dataVol * 8)/(double)ODU_THROUGHPUT_PRINT_TIME_INTERVAL; - DU_LOG("\nUE Id : %d DL Tpt : %.2Lf", rlcThptCb->thptPerUe[ueIdx].ueIdx, tpt); - rlcThptCb->thptPerUe[ueIdx].dataVol = 0; + DU_LOG("\nUE Id : %d DL Tpt : %.2Lf", rlcThptCb->thptPerUe[ueIdx].ueId, tpt); + rlcThptCb->thptPerUe[ueIdx].dataVol = 0; + } + } } DU_LOG("\n=================================================================="); @@ -509,6 +547,75 @@ void rlcThptTmrExpiry(PTR cb) return; } +/** +* +* @brief filling RLC UE delete configuration +* +* @details +* filling RLC UE delete configuration +* +* @params[in] RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg +* +* @return void +* +*/ + +void fillRlcUeDelInfo(RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg) +{ + uint8_t lcIdx; + + rlcUeCfg->ueId = ueCb->ueId; + rlcUeCfg->cellId = ueCb->cellId; + rlcUeCfg->numEnt = 0; + for(lcIdx=0; lcIdxnumEnt < 1; lcIdx++) + { + if(ueCb->lCh[lcIdx].ulRbCb != NULLP) + { + rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbId = 0; + rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbType = 0; + rlcUeCfg->entCfg[rlcUeCfg->numEnt].cfgType = CKW_CFG_DELETE_UE; + rlcUeCfg->numEnt++; + } + } +} + +/** +* @brief Handler to do processing on expiry of the UE delete timer +* +* @details +* This function processes the RLC UE delete timer expiry. +* +* @param[in] cb Pointer to the RlcUlUeCb +* +* @return uint8_t +*/ + +uint8_t rlcUeDeleteTmrExpiry(PTR cb) +{ + RlcCb *gRlcCb = NULLP; + RlcCfgInfo *rlcUeCfg = NULLP; + RlcUlUeCb *ueCb = (RlcUlUeCb*)cb; + + gRlcCb = RLC_GET_RLCCB(ueCb->ueDeleteInfo.pst.dstInst); + RLC_ALLOC(gRlcCb, rlcUeCfg, sizeof(RlcCfgInfo)); + if(rlcUeCfg == NULLP) + { + DU_LOG("\nERROR --> RLC: rlcUeDeleteTmrExpiry(): Failed to allocate memory"); + return RFAILED; + } + memset(rlcUeCfg, 0, sizeof(RlcCfgInfo)); + fillRlcUeDelInfo(ueCb, rlcUeCfg); + if(RlcProcCfgReq(&ueCb->ueDeleteInfo.pst, rlcUeCfg) != ROK) + { + DU_LOG("\nERROR --> RLC: rlcUeDeleteTmrExpiry(): Failed to delete UE"); + if(sendRlcUeDeleteRspToDu(rlcUeCfg->cellId, rlcUeCfg->ueId, INVALID_UEID) != ROK) + { + DU_LOG("ERROR --> RLC: rlcUeDeleteTmrExpiry(): Failed to send UE delete response "); + return RFAILED; + } + } + return ROK; +} /********************************************************************30** diff --git a/src/5gnrrlc/rlc_ul.h b/src/5gnrrlc/rlc_ul.h index f00d44547..69a4d71c5 100755 --- a/src/5gnrrlc/rlc_ul.h +++ b/src/5gnrrlc/rlc_ul.h @@ -295,6 +295,19 @@ typedef struct rlcUlLch RlcUlRbCb *ulRbCb; /**< Pointer to Uplink RbCb */ }RlcUlLch; +/** +* @brief Structure to hold ue delete information +* +* @details +* - pst : Pst +* - ueDelTmr : Ue delete timer +*/ +typedef struct rlcUeDeleteInfo +{ + Pst pst; /*Pst */ + CmTimer ueDelTmr; /*Ue delete timer*/ +}RlcUeDeleteInfo; + /** * @brief Structure to hold uplink information about the Cells * @@ -329,17 +342,18 @@ typedef struct rlcUlCellCb struct rlcUlUeCb { CmHashListEnt ueHlEnt; /**< Hash list entry for UeCb */ - CmLteRnti ueId; /*!< UE Id */ - CmLteCellId cellId; /*!< Cell Id */ - RlcUlRbCb *srbCb[RLC_MAX_SRB_PER_UE]; /**< SRB RbCbs within an UE */ - RlcUlRbCb *drbCb[RLC_MAX_DRB_PER_UE]; /**< DRB RbCbs within an UE */ - RlcUlLch lCh[RLC_MAX_LCH_PER_UE]; /**< Logical channels of an UE*/ + CmLteRnti ueId; /*!< UE Id */ + CmLteCellId cellId; /*!< Cell Id */ + RlcUlRbCb *srbCb[RLC_MAX_SRB_PER_UE]; /**< SRB RbCbs within an UE */ + RlcUlRbCb *drbCb[RLC_MAX_DRB_PER_UE]; /**< DRB RbCbs within an UE */ + RlcUlLch lCh[RLC_MAX_LCH_PER_UE]; /**< Logical channels of an UE*/ /* kw005.201 added support for L2 Measurement */ #ifdef LTE_L2_MEAS - uint32_t firstPacketTTI; /*!< is first packet of the burst */ - uint16_t numActRb[LKW_MAX_QCI]; /**< number of RBs Active */ - Bool isUlBurstActive; /*!staInd[idx]; /* Fetch Ue control block */ - GET_UE_IDX(staInd->rnti, ueIdx); - if(ROK != rlcDbmFetchDlUeCb(gCb, ueIdx, staIndInfo->cellId,&ueCb)) + GET_UE_IDX(staInd->rnti, ueId); + if(ROK != rlcDbmFetchDlUeCb(gCb, ueId, staIndInfo->cellId,&ueCb)) { /* Fetch UeCb failed */ DU_LOG("\nERROR --> RLC_DL : rlcUtlSendToMac: UeId[%u]:ueCb not found", @@ -430,13 +429,6 @@ uint8_t rlcUtlSendToMac(RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo) continue; } - /* Find ueIdx for throughput calculation */ - for(actvUeIdx = 0; actvUeIdx < gCb->rlcThpt.numActvUe; actvUeIdx++) - { - if(gCb->rlcThpt.thptPerUe[actvUeIdx].ueIdx == ueIdx) - break; - } - /* kw002.201 Removed the allocation of RlcDatReq */ /* kw004.201 Used SSI function to initialize the variable */ memset(&datReq, 0, sizeof(RlcDatReq) ); @@ -468,7 +460,8 @@ uint8_t rlcUtlSendToMac(RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo) if (rbCb && (!rlcDlUtlIsReestInProgress(rbCb))) { /* Cosider buffer size for throughput calculation */ - gCb->rlcThpt.thptPerUe[actvUeIdx].dataVol += staIndTb->lchStaInd[count].totBufSize; + if(gCb->rlcThpt.thptPerUe[ueId-1].ueId == ueId) + gCb->rlcThpt.thptPerUe[ueId-1].dataVol += staIndTb->lchStaInd[count].totBufSize; staIndSz += staIndTb->lchStaInd[count].totBufSize; datReq.pduSz = staIndTb->lchStaInd[count].totBufSize; diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index ef72d1a03..ebdab07f6 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -900,12 +900,18 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) DU_LOG("\nDEBUG --> SCH : Received RLC BO Status indication"); cell = schCb[inst].cells[inst]; + if(cell == NULLP) + { + DU_LOG("\nERROR --> SCH : MacSchDlRlcBoInfo(): Cell does not exists"); + return RFAILED; + } + GET_UE_IDX(dlBoInfo->crnti, ueIdx); ueCb = &cell->ueCb[ueIdx-1]; lcId = dlBoInfo->lcId; if(lcId == SRB1_LCID || lcId == SRB2_LCID || lcId == SRB3_LCID || \ - (lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID)) + (lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID)) { SET_ONE_BIT(ueIdx, cell->boIndBitMap); ueCb->dlInfo.dlLcCtxt[lcId].bo = dlBoInfo->dataVolume; @@ -924,20 +930,27 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) slotIdx++; if(slotIdx==cell->numSlots) { - DU_LOG("\nERROR --> SCH : No DL Slot available"); - return RFAILED; + DU_LOG("\nERROR --> SCH : No DL Slot available"); + return RFAILED; } } #endif + schDlSlotInfo = cell->schDlSlotInfo[slot]; + if(schDlSlotInfo == NULLP) + { + DU_LOG("\nERROR --> SCH : MacSchDlRlcBoInfo(): schDlSlotInfo does not exists"); + return RFAILED; + } SCH_ALLOC(schDlSlotInfo->dlMsgInfo, sizeof(DlMsgInfo)); - if(!schDlSlotInfo->dlMsgInfo) + if(schDlSlotInfo->dlMsgInfo == NULLP) { DU_LOG("\nERROR --> SCH : Memory allocation failed for dlMsgInfo"); schDlSlotInfo = NULL; return RFAILED; } + schDlSlotInfo->dlMsgInfo->crnti = dlBoInfo->crnti; schDlSlotInfo->dlMsgInfo->ndi = 1; schDlSlotInfo->dlMsgInfo->harqProcNum = 0; diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 42679065e..92a17d733 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -241,6 +241,11 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst) dlBrdcstAlloc->sib1Trans = NO_SIB1; cell = schCb[schInst].cells[schInst]; + if(cell == NULLP) + { + DU_LOG("\nERROR --> SCH : Cell Does not exist"); + return RFAILED; + } ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod; memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo)); dlBrdcstAlloc->ssbIdxSupported = 1; diff --git a/src/cm/ckw.x b/src/cm/ckw.x index 6d695887d..27288056b 100755 --- a/src/cm/ckw.x +++ b/src/cm/ckw.x @@ -170,10 +170,10 @@ typedef struct rlcEntCfgCfmInfo Configuration Confirmation Informatin RLC to RRC */ typedef struct rlcCfgCfmInfo { - uint32_t transId; /*!< Transaction Id */ + uint32_t transId; /*!< Transaction Id */ CmLteRnti ueId; /*!< UE ID */ CmLteCellId cellId; /*!< Cell ID */ - uint8_t numEnt; /*!< Number of entities configured */ + uint8_t numEnt; /*!< Number of entities configured */ RlcEntCfgCfmInfo entCfgCfm[CKW_MAX_ENT_CFG]; /*!< Array of Entity cfg confiramations */ }RlcCfgCfmInfo; diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 230445ae0..af3cccad2 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -223,6 +223,12 @@ typedef enum SCS_240KHZ }SCS; +typedef enum +{ + CELL_UP, + CELL_DOWN +}OduCellStatus; + typedef struct slotIndInfo { uint16_t cellId; @@ -250,7 +256,7 @@ typedef struct tddCfg }TDDCfg; #endif - +OduCellStatus gCellStatus; uint64_t gSlotCount; uint64_t gDlDataRcvdCnt; /* Number of DL data received at EGTP */ diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 5b770d1dd..ed4444144 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -1252,14 +1252,14 @@ typedef struct ueCfgRsp typedef struct ueDelete { uint16_t cellId; - uint8_t ueIdx; + uint8_t ueId; uint16_t crnti; }MacUeDelete; typedef struct ueDeleteRsp { uint16_t cellId; - uint8_t ueIdx; + uint8_t ueId; UeDeleteStatus result; }MacUeDeleteRsp; diff --git a/src/cm/du_app_rlc_inf.h b/src/cm/du_app_rlc_inf.h index 7c6b97317..0929506c7 100644 --- a/src/cm/du_app_rlc_inf.h +++ b/src/cm/du_app_rlc_inf.h @@ -212,13 +212,13 @@ typedef struct rlcUeCfgRsp typedef struct rlcUeDelete { uint16_t cellId; - uint8_t ueIdx; + uint8_t ueId; }RlcUeDelete; typedef struct rlcUeDeleteRsp { uint16_t cellId; - uint8_t ueIdx; + uint8_t ueId; UeDeleteResult result; }RlcUeDeleteRsp; diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index a06b642a5..761a7830c 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -199,6 +199,7 @@ uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId) { DU_LOG("\nINFO --> DU APP : 5G-NR Cell %d is UP", cellId->cellId); cellCb->cellStatus = ACTIVATED; + gCellStatus = CELL_UP; #ifdef O1_ENABLE DU_LOG("\nINFO --> DU APP : Raise cell UP alarm for cell id=%d", cellId->cellId); diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 524fe270f..b9c1c89f5 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -10073,7 +10073,7 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) if(ret == RFAILED) { /*TODO : Negative case*/ - // BuildAndSendUeContextSetupRsp(ueIdx, cellId); + // BuildAndSendUeContextSetupRsp(cellId,ueIdx); DU_LOG("\nERROR --> F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()"); } else @@ -10420,13 +10420,13 @@ uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg) * Functionality: Constructs the UE Setup Response and sends * it to the DU through SCTP. * - * @params[in] + * @params[in] uint8_t cellId,uint8_t ueIdx * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) +uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueIdx) { uint8_t idx, ret, cellIdx, elementCnt; uint32_t gnbCuUeF1apId; /* gNB-CU UE F1AP Id */ @@ -10621,7 +10621,7 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) * failure = RFAILED * * ****************************************************************/ -uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId) +uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueIdx) { uint8_t cellIdx = 0, actionType = 0; @@ -10631,11 +10631,15 @@ uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId) switch(actionType) { case UE_CTXT_SETUP: - BuildAndSendUeContextSetupRsp(ueIdx, cellId); - break; + { + BuildAndSendUeContextSetupRsp(cellId,ueIdx); + break; + } case UE_CTXT_MOD: - BuildAndSendUeContextModResp(ueIdx, cellId); - break; + { + BuildAndSendUeContextModRsp(cellId, ueIdx); + break; + } default: DU_LOG("ERROR --> F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType); break; @@ -11813,17 +11817,17 @@ void FreeUeContextModResp(F1AP_PDU_t *f1apMsg) * * @details * -* Function : BuildAndSendUeContextModResp +* Function : BuildAndSendUeContextModRsp * * Functionality: * - Creating the ue context modifcation response * -* @params[in] +* @params[in] uint8_t cellId,uint8_t ueIdx * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildAndSendUeContextModResp(uint8_t ueIdx, uint8_t cellId) +uint8_t BuildAndSendUeContextModRsp(uint8_t cellId,uint8_t ueIdx) { uint8_t ieIdx = 0; uint8_t cellIdx =0; @@ -12527,12 +12531,12 @@ void FreeUeContextReleaseComplete(F1AP_PDU_t *f1apMsg) * Functionality: * - Build and Send UE Context Release Complete * - * @params[in] + * @params[in] cellId, gnbCuUeF1apId, gnbDuUeF1apId * @return ROK - success * RFAILED - failure * * *************************************************************/ -uint8_t BuildAndSendUeContextReleaseComplete(uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId) +uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId) { bool memAllocFail = false; uint8_t ieIdx =0, ret = RFAILED, elementCnt = 0; @@ -12637,13 +12641,22 @@ uint8_t BuildAndSendUeContextReleaseComplete(uint32_t gnbCuUeF1apId, uint32_t ret = ROK; break; }while(true); - + + if(ret == ROK) + { + duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS; + ret = duSendCellDeletReq(cellId); + if(ret != ROK) + { + DU_LOG("\nERROR --> F1AP: BuildAndSendUeContextReleaseComplete(): Failed to process cell\ + Delete req for CellId"); + } + } FreeUeContextReleaseComplete(f1apMsg); return ret; - /*TODO: To add trigger for UE context release complete, once the operations of UE context - * release command are done*/ } + /******************************************************************* * * @brief added free part for the memory allocated by aper_decoder @@ -12714,10 +12727,116 @@ void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg) * ****************************************************************/ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg) { - /*TODO: processing of DL RRC Msg Transfer to RLC->SCH->MAC-LOWER-MAC->PHY, if RRC container is received */ - + uint8_t ieIdx=0, ret=ROK, ueIdx=0; + uint16_t cellIdx =0; + bool ueIdxFound; + uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0; + DuUeCb *duUeCb = NULLP; + UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP; + + ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand; + + if(ueContextReleaseCommand->protocolIEs.list.array) + { + for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++) + { + if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]) + { + switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + { + gnbCuUeF1apId= ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\ + value.choice.GNB_CU_UE_F1AP_ID; + break; + } + + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + { + gnbDuUeF1apId = ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\ + value.choice.GNB_DU_UE_F1AP_ID; + break; + } + + case ProtocolIE_ID_id_Cause: + { + break; + } + + case ProtocolIE_ID_id_RRCContainer: + { + for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++) + { + for(ueIdx = 0; ueIdx < duCb.numUe; ueIdx++) + { + if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\ + (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)) + { + duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx]; + DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb)); + if(duUeCb->f1UeDb) + { + memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb)); + duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE; + duUeCb->f1UeDb->cellIdx = cellIdx; + /* Filling Dl RRC Msg Info */ + DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg)); + if(!duUeCb->f1UeDb->dlRrcMsg) + { + DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \ + Memory allocation failed "); + ret = RFAILED; + } + else + { + duUeCb->f1UeDb->dlRrcMsgPres = true; + memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg)); + ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\ + &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\ + value.choice.RRCContainer); + } + + } + else + { + DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \ + Memory allocation failed "); + ret = RFAILED; + + } + + ueIdxFound = true; + break; + } + } + if(ueIdxFound == true) + { + break; + } + } + if(!ueIdxFound) + { + DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextSetupReq()"); + ret = RFAILED; + } + + + break; + } + default : + DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\ + ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id); + break; + } + } + } + } + if(ret != RFAILED) + { + duProcUeContextReleaseCommand(duUeCb); + } freeAperDecodeUeContextReleaseCommand(f1apMsg); - return ROK; + return ret; } /************************************************************** * diff --git a/src/du_app/du_f1ap_msg_hdl.h b/src/du_app/du_f1ap_msg_hdl.h index c52a83559..c956fe069 100644 --- a/src/du_app/du_f1ap_msg_hdl.h +++ b/src/du_app/du_f1ap_msg_hdl.h @@ -36,7 +36,7 @@ uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb ueCb, uint8_t lcId, uint16_t msgLen, uint8_t *rrcMsg); uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellGrp); void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg); -uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId); +uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueIdx); uint8_t getDrbLcId(uint32_t *drbBitMap); void freeMacLcCfg(LcCfg *lcCfg); void freeRlcLcCfg(RlcBearerCfg *lcCfg); @@ -48,10 +48,12 @@ void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap); int8_t getReAsmblTmr(uint8_t reAsmblTmrCfg); int16_t getStatProhTmr(uint8_t statProhTmrCfg); uint8_t duProcUeContextModReq(DuUeCb *ueCb); -uint8_t BuildAndSendUeContextModResp(uint8_t ueIdx, uint8_t cellId); +uint8_t BuildAndSendUeContextModRsp(uint8_t cellId,uint8_t ueIdx); 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 BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId); +uint8_t duSendCellDeletReq(uint16_t cellId); +uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb); /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index 4dfc7097d..037874879 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -75,7 +75,8 @@ typedef enum { UE_CTXT_UNKNOWN, UE_CTXT_SETUP, - UE_CTXT_MOD + UE_CTXT_MOD, + UE_CTXT_RELEASE }UeCtxtActionType; /** F1AP Msg IE **/ @@ -260,7 +261,7 @@ uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t teIdMod, GtpTnlCfg *tnlInf uint8_t duSendEgtpDatInd(Buffer *mBuf); uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm); uint8_t duBuildAndSendMacCellStart(); -uint8_t duBuildAndSendMacCellStop(); +uint8_t duBuildAndSendMacCellStop(uint16_t cellId); #endif /********************************************************************** diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 5a09fe3fa..0a6e586cb 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -334,40 +334,41 @@ uint8_t duProcCfgComplete() for(idx=0; idx< DEFAULT_CELLS; idx++) { DuCellCb *cell = NULLP; - DU_ALLOC(cell, sizeof(DuCellCb)) + DU_ALLOC(cell, sizeof(DuCellCb)); if(cell == NULLP) { - DU_LOG("\nERROR --> DU_APP : Memory Allocation failed in duProcCfgComplete"); - ret = RFAILED; + DU_LOG("\nERROR --> DU_APP : Memory Allocation failed in duProcCfgComplete"); + ret = RFAILED; } else { - uint8_t idx1=0; - memset(cell, 0, sizeof(DuCellCb)); - cell->cellId = ++cellId; - memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn)); - cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0; - cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1; - cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2; - cell->cellInfo.nrEcgi.plmn.mnc[0] = PLMN_MNC0; - cell->cellInfo.nrEcgi.plmn.mnc[1] = PLMN_MNC1; - cell->cellInfo.nrEcgi.cellId = NR_CELL_ID; - cell->cellInfo.nrPci = NR_PCI; - cell->cellInfo.fiveGsTac = DU_TAC; - memset(&cell->cellInfo.plmn[idx1], 0, sizeof(Plmn)); - for(idx1=0; idx1cellInfo.plmn[idx1].mcc[0] = PLMN_MCC0; - cell->cellInfo.plmn[idx1].mcc[1] = PLMN_MCC1; - cell->cellInfo.plmn[idx1].mcc[2] = PLMN_MCC2; - cell->cellInfo.plmn[idx1].mnc[0] = PLMN_MNC0; - cell->cellInfo.plmn[idx1].mnc[1] = PLMN_MNC1; - } - cell->cellInfo.maxUe = duCfgParam.maxUe; - cell->cellStatus = CELL_OUT_OF_SERVICE; - - duCb.cfgCellLst[duCb.numCfgCells] = cell; - duCb.numCfgCells++; + uint8_t idx1=0; + memset(cell, 0, sizeof(DuCellCb)); + cell->cellId = ++cellId; + memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn)); + cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0; + cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1; + cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2; + cell->cellInfo.nrEcgi.plmn.mnc[0] = PLMN_MNC0; + cell->cellInfo.nrEcgi.plmn.mnc[1] = PLMN_MNC1; + cell->cellInfo.nrEcgi.cellId = NR_CELL_ID; + cell->cellInfo.nrPci = NR_PCI; + cell->cellInfo.fiveGsTac = DU_TAC; + memset(&cell->cellInfo.plmn[idx1], 0, sizeof(Plmn)); + for(idx1=0; idx1cellInfo.plmn[idx1].mcc[0] = PLMN_MCC0; + cell->cellInfo.plmn[idx1].mcc[1] = PLMN_MCC1; + cell->cellInfo.plmn[idx1].mcc[2] = PLMN_MCC2; + cell->cellInfo.plmn[idx1].mnc[0] = PLMN_MNC0; + cell->cellInfo.plmn[idx1].mnc[1] = PLMN_MNC1; + } + cell->cellInfo.maxUe = duCfgParam.maxUe; + cell->cellStatus = CELL_OUT_OF_SERVICE; + gCellStatus = CELL_DOWN; + + duCb.cfgCellLst[duCb.numCfgCells] = cell; + duCb.numCfgCells++; } } if(ret != RFAILED) @@ -1558,26 +1559,38 @@ uint8_t duBuildAndSendMacCellStart() * RFAILED - failure * * ****************************************************************/ -uint8_t duBuildAndSendMacCellStop() +uint8_t duBuildAndSendMacCellStop(uint16_t cellId) { Pst pst; - OduCellId *cellId = NULL; - + uint16_t cellIdx=0; + OduCellId *oduCellId = NULL; + DU_LOG("\nINFO --> DU APP : Building and Sending cell stop request to MAC"); - /* Send Cell Stop Request to MAC */ - DU_ALLOC_SHRABL_BUF(cellId, sizeof(OduCellId)); - if(!cellId) + GET_CELL_IDX(cellId, cellIdx); + if(duCb.actvCellLst[cellIdx] != NULLP) { - DU_LOG("\nERROR --> DU APP : Memory alloc failed while building cell stop request"); - return RFAILED; - } - cellId->cellId = duCb.actvCellLst[0]->cellId; + /* Send Cell Stop Request to MAC */ + DU_ALLOC_SHRABL_BUF(oduCellId, sizeof(OduCellId)); + if(!oduCellId) + { + DU_LOG("\nERROR --> DU APP : duBuildAndSendMacCellStop(): Memory allocation failed "); + return RFAILED; + } - /* Fill Pst */ - FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP); + oduCellId->cellId = duCb.actvCellLst[cellIdx]->cellId; - return (*packMacCellStopOpts[pst.selector])(&pst, cellId); + /* Fill Pst */ + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP); + + return (*packMacCellStopOpts[pst.selector])(&pst, oduCellId); + } + else + { + DU_LOG("\nERROR --> DU APP : duBuildAndSendMacCellStop(): cellId[%d] doesnot exists", cellId); + return RFAILED; + } + return ROK; } /******************************************************************* diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index d6adbc675..5b0a14673 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -2200,7 +2200,7 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) macUeCfg.macUeCfgState = UE_RECFG_COMPLETE; if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK) { - BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId); + BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueIdx); } } } @@ -2321,7 +2321,7 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE; if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK) { - BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId); + BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueIdx); } } } @@ -2508,6 +2508,15 @@ uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg) if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed to process UE Context Mod Request in DuProcRlcDlRrcMsgRsp()"); } + if(ueCb->f1UeDb->actionType == UE_CTXT_RELEASE) + { + ret = duBuildAndSendUeDeleteReq(dlRrcMsg->cellId); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU APP : Failed to process UE Context Release Request in DuProcRlcDlRrcMsgRsp()"); + } + + } } } else @@ -2829,13 +2838,12 @@ uint8_t deleteUeCfg(uint16_t cellIdx, uint8_t ueIdx) } else { - DU_LOG("INFO --> DU APP : deleteUeCfg(): MAC or RLC UE configuration state not UE_DELETE_COMPLETE"); return RFAILED; } } else { - DU_LOG("ERROR --> DU APP : deleteUeCfg(): CellIdx[%d] is not found", cellIdx); + DU_LOG("\nERROR --> DU APP : deleteUeCfg(): CellIdx[%d] is not found", cellIdx); return RFAILED; } return ROK; @@ -2860,36 +2868,29 @@ uint8_t deleteUeCfg(uint16_t cellIdx, uint8_t ueIdx) uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp) { - uint8_t ueIdx = 0,ret =ROK; + uint8_t ret =ROK; uint16_t cellIdx=0; - uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId =0; if(deleteRsp) { if(deleteRsp->result == SUCCESS) { - DU_LOG("\nINFO --> DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueIdx); + DU_LOG("\nINFO --> DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueId); GET_CELL_IDX(deleteRsp->cellId, cellIdx); - ueIdx = deleteRsp->ueIdx; if(duCb.actvCellLst[cellIdx]) { - 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) + duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueId -1].macUeCfg.macUeCfgState = UE_DELETE_COMPLETE; + if(sendUeDeleteReqToRlc(deleteRsp->cellId, deleteRsp->ueId) == RFAILED) { - ret = BuildAndSendUeContextReleaseComplete(gnbCuUeF1apId, gnbDuUeF1apId); - if(ret !=ROK) - { - DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete"); - } + DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp():Failed to build UE delete req for RLC "); + ret = RFAILED; } } } else { DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response : FAILURE [UE IDX : %d]",\ - deleteRsp->ueIdx); + deleteRsp->ueId); ret = RFAILED; } DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacUeDeleteRsp)); @@ -2922,36 +2923,36 @@ uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp) uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp) { - uint8_t ueIdx = 0, ret = ROK; + uint8_t ueId = 0, ret = ROK; uint16_t cellIdx = 0; uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId =0; if(delRsp) { - ueIdx = delRsp->ueIdx; + ueId = delRsp->ueId; GET_CELL_IDX(delRsp->cellId, cellIdx); if(delRsp->result == SUCCESSFUL) { - DU_LOG("\nINFO --> DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueIdx); + DU_LOG("\nINFO --> DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueId); if(duCb.actvCellLst[cellIdx]!=NULLP) { - 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) + duCb.actvCellLst[cellIdx]->ueCb[ueId-1].rlcUeCfg.rlcUeCfgState = UE_DELETE_COMPLETE; + gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId; + gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId; + if(deleteUeCfg(cellIdx, ueId) == ROK) { - ret = BuildAndSendUeContextReleaseComplete(gnbCuUeF1apId, gnbDuUeF1apId); - if(ret != ROK) - { - DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete"); - } + ret = BuildAndSendUeContextReleaseComplete(delRsp->cellId, gnbCuUeF1apId, gnbDuUeF1apId); + if(ret != ROK) + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete"); + } } } } else { - DU_LOG("\nERROR --> DU_APP: RLC UE Delete Response : FAILED [UE IDX:%d]", ueIdx); + DU_LOG("\nERROR --> DU_APP: RLC UE Delete Response : FAILED [UE IDX:%d]", ueId); ret = RFAILED; } DU_FREE_SHRABL_BUF(pst->region, pst->pool, delRsp, sizeof(RlcUeDeleteRsp)); @@ -2971,13 +2972,13 @@ uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp) * Functionality: * sending UE Delete Req To Mac * -* @params[in] cellId, ueIdx, crnti +* @params[in] cellId, ueId, crnti * @return ROK - success * RFAILED - failure * *****************************************************************/ -uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueIdx, uint16_t crnti) +uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti) { Pst pst; uint8_t ret=ROK; @@ -2987,11 +2988,10 @@ uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueIdx, uint16_t crnti) if(ueDelete) { ueDelete->cellId = cellId; - ueDelete->ueIdx = ueIdx; + ueDelete->ueId = ueId; 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) @@ -3019,13 +3019,13 @@ uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueIdx, uint16_t crnti) * Functionality: * Sending UE Delete Req To Rlc * - * @params[in] cellId, ueIdx + * @params[in] cellId, ueId * @return ROK - success * RFAILED - failure * *****************************************************************/ -uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueIdx) +uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueId) { uint8_t ret; Pst pst; @@ -3035,7 +3035,7 @@ uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueIdx) if(ueDelete !=NULLP) { ueDelete->cellId = cellId; - ueDelete->ueIdx = ueIdx; + ueDelete->ueId = ueId; FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_DELETE_REQ); ret = (*packRlcUeDeleteReqOpts[pst.selector])(&pst, ueDelete); @@ -3059,7 +3059,7 @@ uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueIdx) * * @details * - * Function : duProcUeDeleteReq + * Function : duBuildAndSendUeDeleteReq * * Functionality: DU processes UE delete req from CU and sends to MAC * and RLC @@ -3070,37 +3070,30 @@ uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueIdx) * * ****************************************************************/ -uint8_t duProcUeDeleteReq(uint16_t cellId) +uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId) { uint8_t ueIdx = 0, ueId =0; uint16_t cellIdx = 0, crnti = 0; - DU_LOG("\nDEBUG --> DU_APP: Processing UE Delete Request "); + DU_LOG("\nDEBUG --> DU_APP: Processing UE Delete Request "); GET_CELL_IDX(cellId, cellIdx); - GET_CRNTI(crnti,ueIdx); if(duCb.actvCellLst[cellIdx] != NULLP) { for(ueIdx =0;ueIdx< duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++) { - ueId = ueIdx+1; - if(sendUeDeleteReqToRlc(cellId, ueId) == RFAILED) - { - DU_LOG("\nERROR --> DU APP : duProcUeDeleteReq():Failed to build UE delete req for RLC "); - return RFAILED; - } - - GET_CRNTI(crnti,ueId); + crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti; + GET_UE_IDX(crnti,ueId); if(sendUeDeleteReqToMac(cellId, ueId, crnti) == RFAILED) { - DU_LOG("\nERROR --> DU APP : duProcUeDeleteReq(): Failed to build UE delete req for MAC "); + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): Failed to build UE delete req for MAC "); return RFAILED; } } } else { - DU_LOG("\nERROR --> DU APP : duProcUeDeleteReq(): Cell Id is not found"); + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeDeleteReq(): Cell Id is not found"); return RFAILED; } @@ -3228,6 +3221,7 @@ uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp) if(duCb.actvCellLst[cellIdx]->cellId == deleteRsp->cellId) { deleteDuCellCb(duCb.actvCellLst[cellIdx]); + gCellStatus = CELL_DOWN; duCb.numActvCells--; DU_FREE(duCb.actvCellLst[cellIdx], sizeof(DuCellCb)); } @@ -3243,7 +3237,7 @@ uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp) [CELL IDX : %d]", deleteRsp->cellId); ret = RFAILED; } - DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacUeDeleteRsp)); + DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacCellDeleteRsp)); } else { @@ -3306,7 +3300,7 @@ uint8_t sendCellDeleteReqToMac(uint16_t cellId) * * @details * - * Function : duProcCellDeleteReq + * Function : duSendCellDeletReq * * Functionality: DU process Cell Delete Req to MAC * @@ -3316,42 +3310,112 @@ uint8_t sendCellDeleteReqToMac(uint16_t cellId) * * ****************************************************************/ -uint8_t duProcCellDeleteReq(uint16_t cellId) +uint8_t duSendCellDeletReq(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(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; - } + DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId); + return RFAILED; } - else + + if(duCb.actvCellLst[cellIdx]->cellId != cellId) + { + DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId); + return RFAILED; + + } + + if(duCb.actvCellLst[cellIdx]->cellStatus != DELETION_IN_PROGRESS) + { + DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): CellStatus[%d] of cellId[%d] is not correct.\ + Expected CellStatus is DELETION_IN_PROGRESS",duCb.actvCellLst[cellIdx]->cellStatus, cellId); + return RFAILED; + } + + if(duCb.actvCellLst[cellIdx]->numActvUes) + { + DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): Active UEs still present in cellId[%d].\ + Failed to delete cell", cellId); + return RFAILED; + } + + if(duBuildAndSendMacCellStop(cellId) == RFAILED) + { + DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): Failed to build and send cell stop request to MAC for\ + cellId[%d]",cellId); + return RFAILED; + } + + if(sendCellDeleteReqToMac(cellId) == RFAILED) { - DU_LOG("\nERROR --> DU APP : duProcCellDeleteReq(): CellId[%d] is not found", cellId); + DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): Failed to send Cell delete req to MAC for\ + cellId[%d]",cellId); return RFAILED; } return ROK; } +/******************************************************************* +* +* @brief Du process Ue Context Release Command +* +* @details +* +* Function : duProcUeContextReleaseCommand +* +* Functionality: Du process Ue Context Release Command +* +* @params[in] DuUeCb *duUeCb +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb) +{ + uint8_t ret =ROK, ueIdx=0; + uint16_t cellId=0; + if(duUeCb == NULLP) + { + DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : duUeCb is null"); + return RFAILED; + } + if(duUeCb->f1UeDb == NULLP) + { + DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : f1UeDb is null"); + return RFAILED; + } + + cellId = duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->cellId; + /* Send DL RRC msg for RRC release */ + if(duUeCb->f1UeDb->dlRrcMsg) + { + if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP) + { + ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueIdx].rlcUeCfg,\ + duUeCb->f1UeDb->dlRrcMsg); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\ + duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg)); + } + } + } + else + { + ret = duBuildAndSendUeDeleteReq(cellId); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request"); + } + } + return ret; +} /********************************************************************** End of file diff --git a/src/du_app/du_ue_mgr.h b/src/du_app/du_ue_mgr.h index 0fa49eb05..52c0574ad 100644 --- a/src/du_app/du_ue_mgr.h +++ b/src/du_app/du_ue_mgr.h @@ -28,9 +28,11 @@ 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); +uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId); void deleteRlcUeCfg(RlcUeCfg *ueCfg); void freeF1UeDb(F1UeContextSetupDb *f1UeDb); +uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti); +uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueId); #endif /********************************************************************** -- 2.16.6