[Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-423] Fixes in DU APP to support cell ID other...
[o-du/l2.git] / src / du_app / du_msg_hdl.c
index 95d7e33..c1826e1 100644 (file)
@@ -58,7 +58,6 @@ DuCfgParams duCfgParam;
 uint8_t packRlcConfigReq(Pst *pst, RlcMngmt *cfg);
 uint8_t cmPkLkwCntrlReq(Pst *pst, RlcMngmt *cfg);
 uint8_t cmPkLrgCfgReq(Pst *pst, RgMngmt *cfg);
-uint8_t BuildAndSendE2SetupReq();
 uint8_t egtpHdlDatInd(EgtpMsg egtpMsg);
 uint8_t BuildAndSendDUConfigUpdate();
 uint16_t getTransId();
@@ -360,7 +359,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];
@@ -384,7 +383,6 @@ uint8_t duProcCfgComplete()
          cell->cellInfo.maxUe = duCfgParam.maxUe;
          cell->cellStatus = CELL_OUT_OF_SERVICE;
          gCellStatus = CELL_DOWN;
-         cell->gnbDuUeF1apIdGenerator = 0;
          duCb.cfgCellLst[duCb.numCfgCells] = cell;
          duCb.numCfgCells++;
       }
@@ -981,15 +979,12 @@ uint8_t duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy)
    {
       if(BuildAndSendF1SetupReq() != ROK)
       {
-        return RFAILED;
+         return RFAILED;
       }
    }
    else if(ricParams.assocId == ntfy->u.assocChange.assocId)
    {
-      if(BuildAndSendE2SetupReq() != ROK)
-      {
-        return RFAILED;
-      }
+       return ROK;
    }
    else
    {
@@ -1455,7 +1450,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));
@@ -1489,7 +1490,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;
       }
@@ -1544,16 +1545,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;
@@ -1792,7 +1793,7 @@ uint8_t DuProcRlcUlUserDataTrans(Pst *pst, RlcUlUserDatInfo *ulUserData)
    for(teIdx = 0; teIdx < duCb.numTeId; teIdx++)
    {
       /*TODO: If multiple Cell Support is enables then CellId also needs to be validated alongwith ueId and DrbId*/
-      if((duCb.upTnlCfg[teIdx] != NULLP) && (duCb.upTnlCfg[teIdx]->ueIdx == ulUserData->ueId) && \
+      if((duCb.upTnlCfg[teIdx] != NULLP) && (duCb.upTnlCfg[teIdx]->ueId == ulUserData->ueId) && \
          (duCb.upTnlCfg[teIdx]->drbId == ulUserData->rbId))
       {
          if(duCb.upTnlCfg[teIdx]->tnlCfg1)
@@ -1892,7 +1893,6 @@ void duFreeSliceCfgRsp(Pst *pst,  MacSliceCfgRsp *cfgRsp)
       }
       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacSliceCfgRsp)); 
    }
-   return ROK;
 }
 
 /*******************************************************************
@@ -2112,8 +2112,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)