JIRA ID ODUHIGH193: Allocation and deallocation of MaceCellCfg sharable buffer 63/4463/7
authorBalaji Shankaran <balaji.shankaran@radisys.com>
Tue, 28 Jul 2020 13:00:47 +0000 (18:30 +0530)
committerBalaji Shankaran <balaji.shankaran@radisys.com>
Thu, 20 Aug 2020 09:46:28 +0000 (15:16 +0530)
Change-Id: Ifc01bb76cc8865b17a26ab7e5d0548e909a0deba
Signed-off-by: Balaji Shankaran <balaji.shankaran@radisys.com>
Allocation and deallocation of MaceCellCfg sharable buffer
JIRA ID ODUHIGH193

Change-Id: Ifc01bb76cc8865b17a26ab7e5d0548e909a0deba
Signed-off-by: Balaji Shankaran <balaji.shankaran@radisys.com>
Dockerfile-ric-stub [deleted file]
src/5gnrmac/rg_lmm.c
src/cm/du_app_mac_inf.c
src/cm/du_app_mac_inf.h
src/du_app/du_cell_mgr.c
src/du_app/du_cfg.c
src/du_app/du_mgr.h
src/du_app/du_mgr_ex_ms.c
src/du_app/du_msg_hdl.c

diff --git a/Dockerfile-ric-stub b/Dockerfile-ric-stub
deleted file mode 100644 (file)
index dbc3818..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:6-u18.04-nng as ubuntu
-
-ADD . /opt/o-du-l2
-WORKDIR /opt/o-du-l2
-
-RUN apt-get update && apt-get install -y libpcap-dev
-
-RUN cd build/odu && make clean_ric ric_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD
-
index 1fc073e..d7e6e1b 100755 (executable)
@@ -2119,16 +2119,36 @@ int MacHdlCellCfgReq
        memset(macCellCb, 0, sizeof(MacCellCb));
    macCb.macCell = macCellCb;
    macCb.macCell->cellId = macCellCfg->cellId;
-   /* Send cell cfg to scheduler */
+   
+       MAC_ALLOC(cellCb->macCellCfg.sib1Cfg.sib1Pdu,  macCellCfg->sib1Cfg.sib1PduLen);
+       if(cellCb->macCellCfg.sib1Cfg.sib1Pdu == NULLP)
+       {
+          DU_LOG("\nMAC : macCellCb is NULL at handling of sib1Pdu of macCellCfg\n");
+          return RFAILED;
+       }
+       memcpy(cellCb->macCellCfg.sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1PduLen);
+       
+       /* Send cell cfg to scheduler */
    ret = MacSchCellCfgReq(pst, macCellCfg);
        if(ret != ROK)
        {
                MacCellCfgCfm macCellCfgCfm;
                macCellCfgCfm.rsp = RSP_NOK;
-               macCellCfgCfm.transId = macCellCfg->transId;
+               macCellCfgCfm.cellId = macCellCfg->cellId;
                macCellCfgFillCfmPst(pst,&cfmPst);
                ret = (*packMacCellCfmOpts[cfmPst.selector])(&cfmPst,&macCellCfgCfm);
        }
+   else
+       {
+          if(macCellCfg->prachCfg.fdm[0].numUnusedRootSeq != 0)
+          {
+              MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg->prachCfg.fdm[0].unsuedRootSeq,
+              macCellCfg->prachCfg.fdm[0].numUnusedRootSeq* sizeof(uint8_t));
+          }
+          MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg->sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1PduLen);
+          MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macCellCfg ,sizeof(MacCellCfg));
+       }
+
 #ifdef INTEL_WLS
    LwrMacEnqueueWlsBlock();
 #endif
@@ -2286,7 +2306,7 @@ void MacSendCellCfgCfm(uint8_t response)
    cmMemset((U8 *)&pst, 0, sizeof(Pst));
    cellCb = rgCb[macCb.macInst].cell;
  
-   macCellCfgCfm.transId = cellCb->macCellCfg.transId;
+   macCellCfgCfm.cellId = cellCb->macCellCfg.cellId;
    macCellCfgCfm.rsp = response;
 
    memcpy((void *)&pst, (void *)&rgCb[macCb.macInst].rgInit.lmPst, sizeof(Pst));
index ba44692..dd2784b 100644 (file)
@@ -134,8 +134,8 @@ int  packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
       }
 
       /* pack the transaction ID in CNF structure */
+      CMCHKPK(SPkU16, macCellCfgCfm->cellId, mBuf);
       CMCHKPK(SPkU8, macCellCfgCfm->rsp, mBuf);
-      CMCHKPK(SPkU16, macCellCfgCfm->transId, mBuf);
 
       return SPstTsk(pst,mBuf);
    }
@@ -174,9 +174,8 @@ int unpackMacCellCfgCfm(
    if(pst->selector == ODU_SELECTOR_LC)
    {
       /* unpack the transaction ID in CNF structure */
-      CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.transId), mBuf);
       CMCHKUNPK(SUnpkU8, &(macCellCfgCfm.rsp), mBuf);
-
+      CMCHKUNPK(SUnpkU16, &(macCellCfgCfm.cellId), mBuf);
       return (*func)(pst, &macCellCfgCfm);
    }
    else
index 6230948..a3017a0 100644 (file)
@@ -579,7 +579,6 @@ typedef struct bwpUlConfig
 
 typedef struct macCellCfg
 {
-   U16            transId;          /* Trans Id */
    U16            cellId;           /* Cell Id */
    U8             numTlv;           /* Number of configuration TLVs */
    U8             carrierId;        /* Carrired Index */
@@ -600,8 +599,8 @@ typedef struct macCellCfg
 
 typedef struct macCellCfgCfm
 {
+   U16            cellId;
    uint8_t        rsp; 
-   U16            transId;
 }MacCellCfgCfm;
 
 typedef struct slotInfo
index 12a9672..b974773 100644 (file)
@@ -86,7 +86,7 @@ S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
       /* Now remove this cell from configured list and move to active list */
       duCb.cfgCellLst[nci-1] = NULL;
       duCb.actvCellLst[nci-1] = cellCb;
-
+      duCb.numActvCells++;
       /* Build and send Mac Cell Cfg for the number of active cells */
       ret = duBuildAndSendMacCellCfg();
       if(ret != ROK)
index 72b60e9..e79ffdc 100644 (file)
@@ -200,15 +200,15 @@ S16 readMacCfg()
    duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq = NUM_UNUSED_ROOT_SEQ;
    if(duCfgParam.macCellCfg.prachCfg.fdm[0].numUnusedRootSeq != 0)
    {
-      DU_ALLOC(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, 
-           NUM_UNUSED_ROOT_SEQ * sizeof(U8));
-      if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
-      {
-        DU_LOG("\nDU_APP : Memory allocation failed");
-        RETVALUE(RFAILED);
-      }
-      *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
-   }
+       DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq, 
+       NUM_UNUSED_ROOT_SEQ * sizeof(uint8_t));
+        if(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq == NULLP)
+       {
+           DU_LOG("\nDU_APP : Memory allocation failed");
+           RETVALUE(RFAILED);
+       }
+       *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ;
+    }
    duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
    duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND;
    duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER;
@@ -226,7 +226,7 @@ S16 readMacCfg()
 
    /* fill SIB1 configuration */
    duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
-   DU_ALLOC(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
+   DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
    memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
         duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
    duCfgParam.macCellCfg.sib1Cfg.sib1NewTxPeriod = SIB1_NEW_TX_PERIOD;
index e818fe5..6fb3cc9 100644 (file)
@@ -163,7 +163,7 @@ typedef struct duCellCb
    CellCfgParams  cellInfo;         /* Cell info */
    Bool           firstSlotIndRcvd;
    CellStatus     cellStatus;       /* Cell status */
-       uint32_t       numActvUes;       /* Total Active UEs */
+   uint32_t       numActvUes;       /* Total Active UEs */
    DuUeCb         ueCb[DU_MAX_UE];  /* UE CONTEXT */
 }DuCellCb;
 
@@ -196,7 +196,9 @@ typedef struct duCb
    //DuLSapCb      **macSap;  /* MAC SAP */
    Bool          f1Status; /* Status of F1 connection */
    Bool          e2Status; /* Status of E2 connection */
+   uint8_t       numCfgCells; 
    DuCellCb*     cfgCellLst[DU_MAX_CELLS];     /* List of cells at DU APP of type DuCellCb */
+   uint8_t       numActvCells;
    DuCellCb*     actvCellLst[DU_MAX_CELLS];    /* List of cells activated/to be activated of type DuCellCb */
    /* pointer to store the address of macCellCfg params used to send du-app to MAC */
    MacCellCfg    *duMacCellCfg;         /* pointer to store params while sending DU-APP to MAC */
index f812bad..d7b2107 100644 (file)
@@ -88,7 +88,8 @@ S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason)
    }
    duCb.numUe = 0;
    memset(duCb.ueCcchCtxt, 0, DU_MAX_UE * sizeof(UeCcchCtxt));
-
+   duCb.numCfgCells  = 0;
+   duCb.numActvCells = 0;
    SSetProcId(DU_PROC);
 
    return ROK;
index 199ba76..054a2a9 100644 (file)
@@ -355,6 +355,7 @@ S16 duProcCfgComplete()
          nci = (U16)cell->cellInfo.nrEcgi.cellId;
          
          duCb.cfgCellLst[nci-1] = cell;
+        duCb.numCfgCells++;
       }
    }
    if(ret != RFAILED)
@@ -1549,7 +1550,7 @@ S16 duBuildAndSendMacCellCfg()
    DU_SET_ZERO(&pst, sizeof(Pst));
    MacCellCfg *duMacCellCfg = NULLP;
 
-   DU_ALLOC(duMacCellCfg, sizeof(MacCellCfg));
+   DU_ALLOC_SHRABL_BUF(duMacCellCfg, sizeof(MacCellCfg));
    if(duMacCellCfg == NULLP)
    {
       return RFAILED;
@@ -1561,8 +1562,6 @@ S16 duBuildAndSendMacCellCfg()
    /* copy the mac config structure from duCfgParams */
    memcpy(duMacCellCfg,&duCfgParam.macCellCfg,sizeof(MacCellCfg));
 
-   duMacCellCfg->transId = getTransId(); /* transaction ID */
-   
    /* Fill Pst */
    pst.selector  = ODU_SELECTOR_LWLC;
    pst.srcEnt    = ENTDUAPP;
@@ -1571,8 +1570,9 @@ S16 duBuildAndSendMacCellCfg()
    pst.srcInst   = 0;
    pst.dstProcId = DU_PROC;
    pst.srcProcId = DU_PROC;
-   pst.region = duCb.init.region;
-   pst.event = EVENT_MAC_CELL_CONFIG_REQ;
+   pst.region    = DU_APP_MEM_REGION;
+   pst.pool      = DU_POOL;
+   pst.event     = EVENT_MAC_CELL_CONFIG_REQ;
 
    /* Send MAC cell config to MAC */
    return (*packMacCellCfgOpts[pst.selector])(&pst, duMacCellCfg);
@@ -1595,38 +1595,32 @@ S16 duBuildAndSendMacCellCfg()
  ***************************************************************************/
 int  duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
 {
-   S16 ret = ROK;
+   uint8_t actvCellIdx  = 0;
+   S16     ret          = ROK;
 
    if(macCellCfgCfm->rsp == ROK)  
+   {
+       for(actvCellIdx = 0 ; actvCellIdx <duCb.numActvCells ; actvCellIdx++)
        {
-               if(macCellCfgCfm->transId == duCb.duMacCellCfg->transId)
-               {
-                       /* free the memory allocated during sending macCellCfg request */
-                       DU_FREE(duCb.duMacCellCfg->sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
-                       DU_FREE(duCb.duMacCellCfg,sizeof(MacCellCfg));
-                       duCb.duMacCellCfg = NULLP;
-
-                       /* Build and send GNB-DU config update */
-                       ret = BuildAndSendDUConfigUpdate();
-
-         /* TODO: Trigger cell start req once cell up slot ind is received*/
-                       /* Build and Send Cell Start Req to MAC */
-                       ret = duBuildAndSendMacCellStartReq();
-
-               }
-               else
-               {
-                       /* transaction ID missmatch */
-                       DU_LOG("\n transaction ID mismatch in macCellCfg");
-                       ret = RFAILED;
-               }
-       }
-       else
-       {
-               DU_LOG("\nMac cell cfg failed");
-               ret = RFAILED;
+           if(macCellCfgCfm->cellId == duCb.actvCellLst[actvCellIdx]->cellId)
+           {
+               duCb.duMacCellCfg = NULLP;
+               /* Build and send GNB-DU config update */
+               ret = BuildAndSendDUConfigUpdate();
+
+                /* TODO: Trigger cell start req once cell up slot ind is received*/
+               /* Build and Send Cell Start Req to MAC */
+               ret = duBuildAndSendMacCellStartReq();
+
+           }  
        }
-   return ret;
+    }
+    else
+    {
+       DU_LOG("\nMac cell cfg failed");
+       ret = RFAILED;
+    }
+    return ret;
 }
 
 /*******************************************************************