[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-435] Memory related Fixes in CU stub with... 44/8044/3
authorlal.harshita <Harshita.Lal@radisys.com>
Wed, 6 Apr 2022 04:06:31 +0000 (09:36 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Wed, 6 Apr 2022 11:07:30 +0000 (16:37 +0530)
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
Change-Id: Iabceb21ec7575f8ac6f2e3701d54f408c7550a03
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
src/cu_stub/cu_f1ap_msg_hdl.c
src/cu_stub/cu_stub.h
src/du_app/du_f1ap_msg_hdl.c

index 601e18e..45d6859 100644 (file)
@@ -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 <MAX_NUM_UE; ueIdx++)
                {
-                  if((ueCb->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));
index 826038a..34cef6f 100644 (file)
    }\
 }
 
+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
index 079b234..e0064dc 100644 (file)
@@ -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;