From: Harshita Lal Date: Thu, 7 Apr 2022 07:52:15 +0000 (+0000) Subject: Merge "[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-435] Memory related Fixes in CU stub... X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=38ebc92a011353b8b2d9401efa4173c79114fa1c;hp=ff0c6fbd56fc24b9c286dc6444e1e0fbe8871625;p=o-du%2Fl2.git Merge "[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-435] Memory related Fixes in CU stub with respect to Ue context release" --- diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c index ba3752043..151510428 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.c +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -11026,13 +11026,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; } @@ -11396,6 +11397,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++; } } @@ -11461,16 +11463,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 01e62eae8..ed0adced7 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 5c907be92..63630e6cc 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -11920,9 +11920,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;