[Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-449] Fixes releate to Cell Id
[o-du/l2.git] / src / du_app / du_msg_hdl.c
index 7b27cae..72e5949 100644 (file)
@@ -344,7 +344,6 @@ uint8_t duBuildRlcUsapCfg(uint8_t elemId, Ent ent, Inst inst)
 uint8_t duProcCfgComplete()
 {
    uint8_t         ret = ROK;
-   uint16_t        cellId = 0;
    uint16_t        idx;
    for(idx=0; idx< DEFAULT_CELLS; idx++)
    {
@@ -359,7 +358,7 @@ uint8_t duProcCfgComplete()
       {
          uint8_t idx1=0; 
          memset(cell, 0, sizeof(DuCellCb));
-         cell->cellId = ++cellId;
+         cell->cellId = NR_CELL_ID; //++cellId;
          memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn));
          cell->cellInfo.nrEcgi.plmn.mcc[0] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[0];
          cell->cellInfo.nrEcgi.plmn.mcc[1] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[1];
@@ -1450,7 +1449,13 @@ uint8_t duBuildAndSendMacCellCfg(uint16_t cellId)
    }
 
    /* store the address in the duCellCb so that we can free on confirm msg */
-   duCb.actvCellLst[cellId-1]->duMacCellCfg = duMacCellCfg;
+   if(duCb.actvCellLst[cellId-1])
+      duCb.actvCellLst[cellId-1]->duMacCellCfg = duMacCellCfg;
+   else
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duMacCellCfg, sizeof(MacCellCfg));
+      return RFAILED;
+   }
 
    /* copy the mac config structure from duCfgParams */
    memcpy(duMacCellCfg,&duCfgParam.macCellCfg,sizeof(MacCellCfg));
@@ -1484,7 +1489,7 @@ uint8_t  duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
 
    for(actvCellIdx = 0; actvCellIdx < MAX_NUM_CELL; actvCellIdx++)
    {
-      if(macCellCfgCfm->cellId == duCb.actvCellLst[actvCellIdx]->cellId)
+      if((duCb.actvCellLst[actvCellIdx]) && (macCellCfgCfm->cellId == duCb.actvCellLst[actvCellIdx]->cellId))
       {
          duCb.actvCellLst[actvCellIdx]->duMacCellCfg = NULLP;
       }
@@ -1539,16 +1544,16 @@ uint8_t duBuildAndSendMacCellStart()
       return RFAILED;
    }
 
-   for(uint8_t id = 0; id < duCb.numActvCells; id++) 
+   for(uint8_t id = 0; id < MAX_NUM_CELL; id++) 
    {
       if(duCb.actvCellLst[id])
       {
-        cellId->cellId = duCb.actvCellLst[id]->cellId;
+         cellId->cellId = duCb.actvCellLst[id]->cellId;
 
-        /* Fill Pst */
-        FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_START);
+         /* Fill Pst */
+         FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_START);
 
-        return (*packMacCellStartOpts[pst.selector])(&pst, cellId);
+         return (*packMacCellStartOpts[pst.selector])(&pst, cellId);
       }
    }
    return ROK;
@@ -1887,7 +1892,6 @@ void duFreeSliceCfgRsp(Pst *pst,  MacSliceCfgRsp *cfgRsp)
       }
       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacSliceCfgRsp)); 
    }
-   return ROK;
 }
 
 /*******************************************************************
@@ -1921,7 +1925,7 @@ uint8_t DuProcMacSliceCfgRsp(Pst *pst,  MacSliceCfgRsp *cfgRsp)
                     duCb.sliceState = SLICE_CONFIGURED;
                 }
             }
-            DU_LOG("\nINFO  -->  DU_APP : Slice Configuration is done sucessfully ");
+            DU_LOG("\nINFO  -->  DU_APP : Slice Configuration is done successfully ");
         }
         duFreeSliceCfgRsp(pst, cfgRsp);
     }
@@ -2107,8 +2111,8 @@ uint8_t BuildAndSendSliceReCfgReq(RrmPolicy *rrmPolicy[], uint8_t totalRrmPolicy
  **********************************************************************/
 uint8_t DuProcMacSliceReCfgRsp(Pst *pst,  MacSliceCfgRsp *reCfgRsp)
 {
-   uint8_t cfgIdx = 0, sliceIdx =0;
-   
+   uint8_t cfgIdx = 0;
+
    if(reCfgRsp)
    {
       if(reCfgRsp->listOfSliceCfgRsp)
@@ -2163,8 +2167,9 @@ uint8_t DuProcRlcSliceMetrics(Pst *pst, SlicePmList *sliceStats)
     
     for(sliceRecord = 0; sliceRecord < sliceStats->numSlice; sliceRecord++)
     {
-       DU_LOG("\nINFO   -->  DU_APP: SliceIndx:%d, DlTput %.5lf, UlTput:%.5lf", sliceStats->sliceRecord[sliceRecord].networkSliceIdentifier,\
-                        sliceStats->sliceRecord[sliceRecord].ThpDl, sliceStats->sliceRecord[sliceRecord].ThpUl);
+       DU_LOG("\nINFO   -->  DU_APP: SliceId[SST-SD]:%d-%d, DlTput %.5lf, UlTput:%.5lf", sliceStats->sliceRecord[sliceRecord].networkSliceIdentifier.sst,\
+                        sliceStats->sliceRecord[sliceRecord].networkSliceIdentifier.sd,sliceStats->sliceRecord[sliceRecord].ThpDl,\
+                        sliceStats->sliceRecord[sliceRecord].ThpUl);
     }
 #ifdef O1_ENABLE
     if(sliceStats)