X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_msg_hdl.c;h=054a2a9c6fd10647639c6916f33a416675eff73f;hb=392607b7a8cbf1b7415b15517275dd1ef4e897a9;hp=c56a308a4302048a6386aabdf34217a6bbee4d74;hpb=e006592159c0a16a4c2f24cc50f712ff9461a000;p=o-du%2Fl2.git diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index c56a308a4..054a2a9c6 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -17,7 +17,13 @@ *******************************************************************************/ /* This file contains message handling functionality for DU APP */ - +#include "common_def.h" +#include "lrg.h" +#include "legtp.h" +#include "lkw.h" +#include "lrg.x" +#include "lkw.x" +#include "du_cfg.h" #include "du_mgr.h" #include "du_sctp.h" #include "du_f1ap_msg_hdl.h" @@ -39,7 +45,7 @@ extern S16 cmPkLkwCntrlReq(Pst *pst, KwMngmt *cfg); extern S16 cmPkLrgCfgReq(Pst *pst, RgMngmt *cfg); extern S16 BuildAndSendE2SetupReq(); extern S16 egtpHdlDatInd(EgtpMsg egtpMsg); -extern S16 BuildAndSendDUConfigUpdate(); +extern uint8_t BuildAndSendDUConfigUpdate(); extern U16 getTransId(); extern S16 cmPkLrgSchCfgReq(Pst * pst,RgMngmt * cfg); @@ -112,7 +118,7 @@ S16 duBuildRlcCfg(Inst inst) genCfg->lmPst.region = (inst == RLC_UL_INST) ? RLC_UL_MEM_REGION:RLC_DL_MEM_REGION; genCfg->lmPst.pool = RLC_POOL; - genCfg->lmPst.selector = DU_SELECTOR_LC; + genCfg->lmPst.selector = ODU_SELECTOR_LC; /* Fill Header */ kwMngmt.hdr.msgType = TCFG; @@ -128,10 +134,10 @@ S16 duBuildRlcCfg(Inst inst) kwMngmt.hdr.response.mem.region = (inst == RLC_UL_INST) ? RLC_UL_MEM_REGION:RLC_DL_MEM_REGION; kwMngmt.hdr.response.mem.pool = DU_POOL; - kwMngmt.hdr.response.selector = DU_SELECTOR_LC; + kwMngmt.hdr.response.selector = ODU_SELECTOR_LC; /* Fill Pst */ - pst.selector = DU_SELECTOR_LC; + pst.selector = ODU_SELECTOR_LC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTKW; pst.dstInst = inst; @@ -181,7 +187,7 @@ S16 duBuildRlcLsapCfg(Ent ent, Inst inst, U8 lsapInst) kwMngmt.hdr.response.mem.pool = RLC_POOL; /* Fill Pst */ - pst.selector = DU_SELECTOR_LC; + pst.selector = ODU_SELECTOR_LC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTKW; pst.dstProcId = DU_PROC; @@ -203,7 +209,7 @@ S16 duBuildRlcLsapCfg(Ent ent, Inst inst, U8 lsapInst) lSap->ent = ENTRG; lSap->inst = lsapInst; lSap->sapId = lsapInst; /* SapId will be stored as suId in MAC */ - lSap->selector = (inst == RLC_UL_INST) ? DU_SELECTOR_LWLC : DU_SELECTOR_TC; + lSap->selector = (inst == RLC_UL_INST) ? ODU_SELECTOR_LWLC : ODU_SELECTOR_TC; kwMngmt.hdr.elmId.elmnt = STRGUSAP; DU_LOG("\nDU_APP : RLC MAC Lower Sap Cfg Req sent for inst %d", inst); @@ -215,7 +221,7 @@ S16 duBuildRlcLsapCfg(Ent ent, Inst inst, U8 lsapInst) lSap->inst = (inst == RLC_UL_INST) ? RLC_DL_INST : RLC_UL_INST; lSap->sapId = 0; - lSap->selector = DU_SELECTOR_LC; + lSap->selector = ODU_SELECTOR_LC; kwMngmt.hdr.elmId.elmnt = STUDXSAP; DU_LOG("\nDU_APP : RLC DL/UL Lower Sap Cfg Req sent for inst %d", inst); } @@ -250,7 +256,7 @@ S16 duBuildRlcUsapCfg(U8 elemId, Ent ent, Inst inst) uSap = &(kwMngmt.t.cfg.s.sap); - uSap->selector = DU_SELECTOR_LC; + uSap->selector = ODU_SELECTOR_LC; uSap->mem.region = (inst == RLC_UL_INST) ? RLC_UL_MEM_REGION:RLC_DL_MEM_REGION; uSap->mem.pool = RLC_POOL; @@ -276,7 +282,7 @@ S16 duBuildRlcUsapCfg(U8 elemId, Ent ent, Inst inst) kwMngmt.hdr.response.mem.pool = RLC_POOL; /* Fill Pst */ - pst.selector = DU_SELECTOR_LC; + pst.selector = ODU_SELECTOR_LC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTKW; pst.dstProcId = DU_PROC; @@ -313,7 +319,7 @@ S16 duProcCfgComplete() U16 idx; for(idx=0; idx< DEFAULT_CELLS; idx++) { - DuCellCb *cell; + DuCellCb *cell = NULLP; DU_ALLOC(cell, sizeof(DuCellCb)) if(cell == NULLP) { @@ -325,7 +331,7 @@ S16 duProcCfgComplete() U32 nci; U8 idx1; memset(cell, 0, sizeof(DuCellCb)); - cell->cellId = cellId++; + cell->cellId = ++cellId; cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0; cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1; cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2; @@ -349,6 +355,7 @@ S16 duProcCfgComplete() nci = (U16)cell->cellInfo.nrEcgi.cellId; duCb.cfgCellLst[nci-1] = cell; + duCb.numCfgCells++; } } if(ret != RFAILED) @@ -702,7 +709,7 @@ S16 duBuildMacGenCfg() genCfg->lmPst.route = RTESPEC; genCfg->lmPst.region = MAC_MEM_REGION; genCfg->lmPst.pool = RG_POOL; - genCfg->lmPst.selector = DU_SELECTOR_LC; + genCfg->lmPst.selector = ODU_SELECTOR_LC; /* Fill Header */ rgMngmt.hdr.msgType = TCFG; @@ -718,10 +725,10 @@ S16 duBuildMacGenCfg() rgMngmt.hdr.response.route = RTESPEC; rgMngmt.hdr.response.mem.region = MAC_MEM_REGION; rgMngmt.hdr.response.mem.pool = RG_POOL; - rgMngmt.hdr.response.selector = DU_SELECTOR_LC; + rgMngmt.hdr.response.selector = ODU_SELECTOR_LC; /* Fill Pst */ - pst.selector = DU_SELECTOR_LC; + pst.selector = ODU_SELECTOR_LC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTRG; pst.dstInst = macCfgInst; @@ -772,7 +779,7 @@ S16 duBuildMacUsapCfg(SpId sapId) uSap->inst = sapId; uSap->prior = PRIOR0; uSap->route = RTESPEC; - uSap->selector = DU_SELECTOR_LC ; + uSap->selector = ODU_SELECTOR_LC ; /* fill header */ rgMngmt.hdr.msgType = TCFG; @@ -783,7 +790,7 @@ S16 duBuildMacUsapCfg(SpId sapId) rgMngmt.hdr.response.mem.pool = RG_POOL; /* fill pst */ - pst.selector = DU_SELECTOR_LC; + pst.selector = ODU_SELECTOR_LC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTRG; pst.dstInst = macCfgInst; @@ -907,7 +914,7 @@ S16 duBindUnbindRlcToMacSap(U8 inst, U8 action) kwMngmt.hdr.response.mem.pool = RLC_POOL; /* Fill pst */ - pst.selector = DU_SELECTOR_LC; + pst.selector = ODU_SELECTOR_LC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTKW; pst.dstProcId = DU_PROC; @@ -988,7 +995,7 @@ S16 duFillEgtpPst(Pst *pst, Event event) pst->dstInst = (Inst)EGTP_INST; pst->dstProcId = pst->srcProcId; pst->event = event; - pst->selector = DU_SELECTOR_LC; + pst->selector = ODU_SELECTOR_LC; pst->pool= DU_POOL; RETVALUE(ROK); @@ -1387,7 +1394,7 @@ S16 duSendSchCfg() cfg->genCfg.lmPst.route = RTESPEC; cfg->genCfg.lmPst.region = MAC_MEM_REGION; cfg->genCfg.lmPst.pool = RG_POOL; - cfg->genCfg.lmPst.selector = DU_SELECTOR_LC; + cfg->genCfg.lmPst.selector = ODU_SELECTOR_LC; /* Fill Header */ rgMngmt.hdr.msgType = TCFG; @@ -1398,7 +1405,7 @@ S16 duSendSchCfg() rgMngmt.hdr.response.mem.pool = RG_POOL; /* Fill Pst */ - pst.selector = DU_SELECTOR_LC; + pst.selector = ODU_SELECTOR_LC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTRG; pst.dstProcId = DU_PROC; @@ -1543,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; @@ -1555,18 +1562,17 @@ S16 duBuildAndSendMacCellCfg() /* copy the mac config structure from duCfgParams */ memcpy(duMacCellCfg,&duCfgParam.macCellCfg,sizeof(MacCellCfg)); - duMacCellCfg->transId = getTransId(); /* transaction ID */ - /* Fill Pst */ - pst.selector = DU_SELECTOR_LWLC; + pst.selector = ODU_SELECTOR_LWLC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTRG; pst.dstInst = 0; 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); @@ -1589,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; } /******************************************************************* @@ -1668,7 +1668,7 @@ uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo) duSendEgtpSlotInd(); #endif - if((pst->selector == DU_SELECTOR_LWLC) || (pst->selector == DU_SELECTOR_TC)) + if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC)) DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, slotInfo, sizeof(SlotInfo)); return ROK; @@ -1713,7 +1713,7 @@ uint16_t duBuildAndSendMacCellStartReq() cellStartInfo->cellId = duCb.actvCellLst[id]->cellInfo.nrEcgi.cellId; /* Fill Pst */ - pst.selector = DU_MAC_LWLC; + pst.selector = ODU_SELECTOR_LWLC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTRG; pst.dstInst = 0; @@ -1763,7 +1763,7 @@ uint16_t duBuildAndSendMacCellStopReq() cellStopInfo->cellId = duCb.actvCellLst[0]->cellId; /* Fill Pst */ - pst.selector = DU_MAC_LWLC; + pst.selector = ODU_SELECTOR_LWLC; pst.srcEnt = ENTDUAPP; pst.dstEnt = ENTRG; pst.dstInst = 0; @@ -1812,7 +1812,7 @@ uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellStopId) } } } - if((pst->selector == DU_SELECTOR_LWLC) || (pst->selector == DU_SELECTOR_TC)) + if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC)) DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, cellStopId, sizeof(MacCellStopInfo)); return ROK;