From 392607b7a8cbf1b7415b15517275dd1ef4e897a9 Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Tue, 28 Jul 2020 18:30:47 +0530 Subject: [PATCH] JIRA ID ODUHIGH193: Allocation and deallocation of MaceCellCfg sharable buffer Change-Id: Ifc01bb76cc8865b17a26ab7e5d0548e909a0deba Signed-off-by: Balaji Shankaran Allocation and deallocation of MaceCellCfg sharable buffer JIRA ID ODUHIGH193 Change-Id: Ifc01bb76cc8865b17a26ab7e5d0548e909a0deba Signed-off-by: Balaji Shankaran --- Dockerfile-ric-stub | 9 ------- src/5gnrmac/rg_lmm.c | 26 +++++++++++++++++--- src/cm/du_app_mac_inf.c | 5 ++-- src/cm/du_app_mac_inf.h | 3 +-- src/du_app/du_cell_mgr.c | 2 +- src/du_app/du_cfg.c | 20 ++++++++-------- src/du_app/du_mgr.h | 4 +++- src/du_app/du_mgr_ex_ms.c | 3 ++- src/du_app/du_msg_hdl.c | 60 +++++++++++++++++++++-------------------------- 9 files changed, 69 insertions(+), 63 deletions(-) delete mode 100644 Dockerfile-ric-stub diff --git a/Dockerfile-ric-stub b/Dockerfile-ric-stub deleted file mode 100644 index dbc381840..000000000 --- a/Dockerfile-ric-stub +++ /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 - diff --git a/src/5gnrmac/rg_lmm.c b/src/5gnrmac/rg_lmm.c index 1fc073e8f..d7e6e1b01 100755 --- a/src/5gnrmac/rg_lmm.c +++ b/src/5gnrmac/rg_lmm.c @@ -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)); diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index ba446929c..dd2784b56 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -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 diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 6230948f4..a3017a04c 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -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 diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index 12a967217..b974773ba 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -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) diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index 72b60e9d3..e79ffdce4 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -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; diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index e818fe572..6fb3cc95b 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -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 */ diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index f812bad25..d7b210748 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -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; diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 199ba76ad..054a2a9c6 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -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 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; } /******************************************************************* -- 2.16.6