From 84bdaa05da864fda46bbbdd184963787a827d0ab Mon Sep 17 00:00:00 2001 From: "lal.harshita" Date: Wed, 6 Apr 2022 09:36:31 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-435] Memory related Fixes in CU stub with respect to Ue context release Signed-off-by: lal.harshita Change-Id: Iabceb21ec7575f8ac6f2e3701d54f408c7550a03 Signed-off-by: lal.harshita --- src/cu_stub/cu_f1ap_msg_hdl.c | 32 ++++++++++++++++++++------------ src/cu_stub/cu_stub.h | 7 +++++++ src/du_app/du_f1ap_msg_hdl.c | 4 ++-- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c index 601e18efa..45d6859e6 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.c +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -11025,13 +11025,14 @@ uint8_t procGnbDuUpdate(uint32_t duId, F1AP_PDU_t *f1apMsg) { SEARCH_DU_DB(duIdx, duId, duDb); SEARCH_CELL_DB(cellIdx, duDb, nrCellId, cellCb); - for(ueIdx = 0; ueIdx < cellCb->numUe; ueIdx++) + if(cellCb->numUe == 0) { - CU_FREE(cellCb->ueCb[ueIdx]->f1apMsgDb.duToCuContainer.buf, cellCb->ueCb[ueIdx]->f1apMsgDb.duToCuContainer.size); - memset(cellCb->ueCb[ueIdx], 0, sizeof(CuUeCb)); + memset(cellCb, 0, sizeof(CuCellCb)); + duDb->numCells--; } + else + cellCb->cellStatus = CELL_DELETION_IN_PROGRESS; } - return ROK; } @@ -11395,6 +11396,7 @@ void procF1SetupReq(uint32_t *destDuId, F1AP_PDU_t *f1apMsg) cellCb = &duDb->cellCb[duDb->numCells]; memset(cellCb, 0, sizeof(CuCellCb)); cellCb->nrCellId = nrCellId; + cellCb->cellStatus = CELL_ACTIVE; duDb->numCells++; } } @@ -11460,16 +11462,22 @@ void procUeContextReleaseComplete(uint32_t duId, F1AP_PDU_t *f1apMsg) { gnbDuUeF1apId = ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID; ueCb = &duDb->ueCb[gnbDuUeF1apId-1]; - - for(ueIdx = 0; ueIdx < ueCb->cellCb->numUe; ueIdx++) + for(ueIdx = 0; ueIdx cellCb->ueCb[ueIdx]->gnbCuUeF1apId == gnbCuUeF1apId) && - (ueCb->cellCb->ueCb[ueIdx]->gnbDuUeF1apId == gnbDuUeF1apId)) + if(ueCb->cellCb && ueCb->cellCb->ueCb[ueIdx]) { - ueCb->cellCb->ueCb[ueIdx] = NULLP; - ueCb->cellCb->numUe--; - break; - + if((ueCb->cellCb->ueCb[ueIdx]->gnbCuUeF1apId == gnbCuUeF1apId) && + (ueCb->cellCb->ueCb[ueIdx]->gnbDuUeF1apId == gnbDuUeF1apId)) + { + ueCb->cellCb->ueCb[ueIdx] = NULLP; + ueCb->cellCb->numUe--; + if((ueCb->cellCb->numUe == 0) && (ueCb->cellCb->cellStatus = CELL_DELETION_IN_PROGRESS)) + { + memset(ueCb->cellCb, 0, sizeof(CuCellCb)); + duDb->numCells--; + } + break; + } } } memset(ueCb, 0, sizeof(CuUeCb)); diff --git a/src/cu_stub/cu_stub.h b/src/cu_stub/cu_stub.h index 826038a4a..34cef6f77 100644 --- a/src/cu_stub/cu_stub.h +++ b/src/cu_stub/cu_stub.h @@ -95,6 +95,12 @@ }\ } +typedef enum +{ + CELL_INACTIVE, + CELL_ACTIVE, + CELL_DELETION_IN_PROGRESS +}CellStatusInfo; typedef enum { @@ -266,6 +272,7 @@ struct cuCellCb uint32_t nrCellId; uint8_t numUe; CuUeCb *ueCb[MAX_NUM_UE]; + CellStatusInfo cellStatus; }; typedef struct duDb diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 079b234cc..e0064dc0f 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -11918,9 +11918,9 @@ void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t *ueSetReq) uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) { int8_t ueIdx = -1; - uint8_t ret=0, ieIdx=0, ieExtIdx = 0, cellIdx=0, servCellIdx = 0; + uint8_t ret=0, ieIdx=0, ieExtIdx = 0, servCellIdx = 0; bool ueCbFound = false, hoInProgress = false; - uint16_t nrCellId = 0; + uint16_t nrCellId = 0, cellIdx=0; uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0; DuUeCb *duUeCb = NULL; UEContextSetupRequest_t *ueSetReq = NULL; -- 2.16.6