From: lal.harshita Date: Thu, 21 Apr 2022 07:04:57 +0000 (+0530) Subject: [Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-423]Filled ReconfigurationWithSync IE, X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=91badb497240f15ed4de91a1eaae71534c044571;hp=86ce8157d6b459515f2a3f37f5bc84daee2d27ca;p=o-du%2Fl2.git [Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-423]Filled ReconfigurationWithSync IE, RACH resource request and response Signed-off-by: lal.harshita Change-Id: I7fde97b6b9dd6010baf569f63850df0c9843d646 Signed-off-by: lal.harshita --- diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index e46308e56..b6f0fcab6 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -292,9 +292,10 @@ uint8_t MacSchCellCfgReq(Pst *pst, MacCellCfg *macCellCfg) schCellCfg.schRachCfg.rootSeqIdx = macCellCfg->prachCfg.fdm[0].rootSeqIdx; schCellCfg.schRachCfg.numRootSeq = macCellCfg->prachCfg.fdm[0].numRootSeq; schCellCfg.schRachCfg.k1 = macCellCfg->prachCfg.fdm[0].k1; + schCellCfg.schRachCfg.totalNumRaPreamble = macCellCfg->prachCfg.totalNumRaPreamble; schCellCfg.schRachCfg.ssbPerRach = macCellCfg->prachCfg.ssbPerRach; - schCellCfg.schRachCfg.prachMultCarrBand = \ - macCellCfg->prachCfg.prachMultCarrBand; + schCellCfg.schRachCfg.numCbPreamblePerSsb = macCellCfg->prachCfg.numCbPreamblePerSsb; + schCellCfg.schRachCfg.prachMultCarrBand = macCellCfg->prachCfg.prachMultCarrBand; schCellCfg.schRachCfg.raContResTmr = macCellCfg->prachCfg.raContResTmr; schCellCfg.schRachCfg.rsrpThreshSsb = macCellCfg->prachCfg.rsrpThreshSsb; schCellCfg.schRachCfg.raRspWindow = macCellCfg->prachCfg.raRspWindow; diff --git a/src/5gnrmac/mac_msg_router.c b/src/5gnrmac/mac_msg_router.c index 60be907c5..057557c6f 100755 --- a/src/5gnrmac/mac_msg_router.c +++ b/src/5gnrmac/mac_msg_router.c @@ -104,50 +104,73 @@ Buffer *mBuf /* message buffer */ break; #endif /* LCRGMILRG */ case EVENT_MAC_CELL_CONFIG_REQ: - /* Process MAC cell config */ - unpackDuMacCellCfg(MacProcCellCfgReq, pst, mBuf); - break; + { + /* Process MAC cell config */ + unpackDuMacCellCfg(MacProcCellCfgReq, pst, mBuf); + break; + } case EVENT_MAC_CELL_START: - /* Process MAC cell start request */ - unpackMacCellStart(MacProcCellStart, pst, mBuf); - break; + { + /* Process MAC cell start request */ + unpackMacCellStart(MacProcCellStart, pst, mBuf); + break; + } case EVENT_MAC_CELL_STOP: - /* Process MAC cell stop request */ - unpackMacCellStop(MacProcCellStop, pst, mBuf); - break; + { + /* Process MAC cell stop request */ + unpackMacCellStop(MacProcCellStop, pst, mBuf); + break; + } case EVENT_MAC_DL_CCCH_IND: - /* Process DL CCCH Ind */ - unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf); - break; + { + /* Process DL CCCH Ind */ + unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf); + break; + } case EVENT_MAC_UE_CREATE_REQ: - /* Process Ue Create Request */ - unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf); - break; + { + /* Process Ue Create Request */ + unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf); + break; + } case EVENT_MAC_UE_RECONFIG_REQ: - /* Process Ue Reconfig Request */ - unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf); - break; - case EVENT_MAC_UE_DELETE_REQ: - { - unpackMacUeDeleteReq(MacProcUeDeleteReq, pst, mBuf); - break; - } - case EVENT_MAC_CELL_DELETE_REQ: - { - unpackMacCellDeleteReq(MacProcCellDeleteReq, pst, mBuf); - break; - } - case EVENT_MAC_SLICE_CFG_REQ: - { - unpackMacSliceCfgReq(MacProcSliceCfgReq, pst, mBuf); - break; - } - case EVENT_MAC_SLICE_RECFG_REQ: - { - unpackMacSliceCfgReq(MacProcSliceReCfgReq, pst, mBuf); - break; - } - default: + { + /* Process Ue Reconfig Request */ + unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf); + break; + } + case EVENT_MAC_UE_DELETE_REQ: + { + /* Process UE Delete Request */ + unpackMacUeDeleteReq(MacProcUeDeleteReq, pst, mBuf); + break; + } + case EVENT_MAC_CELL_DELETE_REQ: + { + /* Process Cell Delete Request */ + unpackMacCellDeleteReq(MacProcCellDeleteReq, pst, mBuf); + break; + } + case EVENT_MAC_SLICE_CFG_REQ: + { + /* Process Slice Configuration Request */ + unpackMacSliceCfgReq(MacProcSliceCfgReq, pst, mBuf); + break; + } + case EVENT_MAC_SLICE_RECFG_REQ: + { + /* Process Slice Reconfiguration Request */ + unpackMacSliceCfgReq(MacProcSliceReCfgReq, pst, mBuf); + break; + } + case EVENT_MAC_RACH_RESOURCE_REQ: + { + /* Process Rach Resource Request */ + unpackMacRachRsrcReq(MacProcRachRsrcReq, pst, mBuf); + break; + } + + default: RG_FREE_MSG(mBuf); break; } diff --git a/src/5gnrmac/mac_rach.c b/src/5gnrmac/mac_rach.c index 363f0b956..adbabda0a 100644 --- a/src/5gnrmac/mac_rach.c +++ b/src/5gnrmac/mac_rach.c @@ -28,9 +28,25 @@ /* Function pointer for sending rach ind from MAC to SCH */ MacSchRachIndFunc macSchRachIndOpts[]= { - packMacSchRachInd, - MacSchRachInd, - packMacSchRachInd + packMacSchRachInd, /* packing for loosely coupled */ + MacSchRachInd, /* packing for tightly coupled */ + packMacSchRachInd /* packing for light weight loosely coupled */ +}; + +/* Function pointer for sending RACH resource request from MAC to SCH */ +MacSchRachRsrcReqFunc macSchRachRsrcReqOpts[] = +{ + packMacSchRachRsrcReq, /* packing for loosely coupled */ + MacSchRachRsrcReq, /* packing for tightly coupled */ + packMacSchRachRsrcReq /* packing for light weight loosely coupled */ +}; + +/* Function pointer for sending RACH resource response from MAC to DU APP */ +MacDuRachRsrcRspFunc macDuRachRsrcRspOpts[] = +{ + packDuMacRachRsrcRsp, /* packing for loosely coupled */ + DuProcMacRachRsrcRsp, /* packing for tightly coupled */ + packDuMacRachRsrcRsp /* packing for light weight loosly coupled */ }; /******************************************************************* @@ -99,10 +115,8 @@ uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd) rachIndInfo->slotIdx = rachInd->rachPdu[pduIdx].slotIdx; rachIndInfo->symbolIdx = rachInd->rachPdu[pduIdx].symbolIdx; rachIndInfo->freqIdx = rachInd->rachPdu[pduIdx].freqIdx; - rachIndInfo->preambleIdx = \ - rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].preamIdx; - rachIndInfo->timingAdv = \ - rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv; + rachIndInfo->preambleIdx = rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].preamIdx; + rachIndInfo->timingAdv = rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv; /* Store the value in macRaCb */ createMacRaCb(rachIndInfo); @@ -114,6 +128,168 @@ uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd) return(sendRachIndMacToSch(rachIndInfo)); } +/******************************************************************* + * + * @brief Processes RACH Resource request from DU APP + * + * @details + * + * Function : MacProcRachRsrcReq + * + * Functionality: Processes RACH resource request from DU APP. + * Fills and sends RACH resource request towards SCH. + * + * @params[in] Post structure + * RACH resource request + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacProcRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq) +{ + uint8_t ret = RFAILED; + uint16_t cellIdx = 0; + Pst schPst; + MacCellCb *cellCb = NULLP; + MacUeCb *ueCb = NULLP; + SchRachRsrcReq *schRachRsrcReq = NULLP; + + DU_LOG("\nINFO --> MAC : Recieved RACH Resource Request for Cell ID [%d] UE ID [%d]",\ + rachRsrcReq->cellId, rachRsrcReq->ueId); + + /* Fetch Cell Cb */ + GET_CELL_IDX(rachRsrcReq->cellId, cellIdx); + if(macCb.macCell[cellIdx] && (macCb.macCell[cellIdx]->cellId == rachRsrcReq->cellId)) + { + cellCb = macCb.macCell[cellIdx]; + + /* Fetch UE Cb */ + if(cellCb->ueCb[rachRsrcReq->ueId-1].ueId == rachRsrcReq->ueId) + { + ueCb = &cellCb->ueCb[rachRsrcReq->ueId-1]; + /* Allocate memory to RACH resource request to be sent to SCH */ + MAC_ALLOC(schRachRsrcReq, sizeof(SchRachRsrcReq)); + if(schRachRsrcReq) + { + /* Fill SCH RACH resource request from information received from DU APP to MAC */ + schRachRsrcReq->cellId = rachRsrcReq->cellId; + schRachRsrcReq->crnti = ueCb->crnti; + schRachRsrcReq->numSsb = rachRsrcReq->numSsb; + memcpy(schRachRsrcReq->ssbIdx, rachRsrcReq->ssbIdx, sizeof(schRachRsrcReq->ssbIdx)); + + /* Send RACH resource request from MAC to SCH */ + FILL_PST_MAC_TO_SCH(schPst, EVENT_RACH_RESOURCE_REQUEST_TO_SCH); + ret = (*macSchRachRsrcReqOpts[schPst.selector])(&schPst, schRachRsrcReq); + } + else + DU_LOG("\nERROR --> MAC : Memory allocation failed for RACH resource request to SCH"); + } + else + DU_LOG("\nERROR --> MAC : UE ID [%d] not found", rachRsrcReq->ueId); + } + else + DU_LOG("\nERROR --> MAC : Cell ID [%d] not found", rachRsrcReq->cellId); + + /* Free sharable buffer used to send RACH reource request from DU APP to MAC */ + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rachRsrcReq, sizeof(MacRachRsrcReq)); + return ret; +} + +/******************************************************************* + * + * @brief Processes RACH Resource response from SCH + * + * @details + * + * Function : MacProcSchRachRsrcRsp + * + * Functionality: Processes RACH resource response from SCH + * Fills and sends RACH resource response towards DU APP + * + * @params[in] Post structure + * RACH resource response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacProcSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp) +{ + uint16_t cellIdx = 0; + Pst rspPst; + MacRachRsrcRsp *rachRsrcRsp = NULLP; + MacCellCb *cellCb = NULLP; + MacUeCb *ueCb = NULLP; + + DU_LOG("\nINFO --> MAC : Received RACH resource response from SCH : Cell ID [%d] CRNTI [%d]", \ + schRachRsrcRsp->cellId, schRachRsrcRsp->crnti); + + /* Fill RACH resource response to send to DU APP */ + MAC_ALLOC_SHRABL_BUF(rachRsrcRsp, sizeof(MacRachRsrcRsp)); + if(!rachRsrcRsp) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed for RACH resource response"); + MAC_FREE(schRachRsrcRsp, sizeof(SchRachRsrcRsp)); + return RFAILED; + } + rachRsrcRsp->cellId = schRachRsrcRsp->cellId; + GET_UE_ID(schRachRsrcRsp->crnti, rachRsrcRsp->ueId); + rachRsrcRsp->result = MAC_DU_APP_RSP_OK; + + /* Fill Pst structure to send RACH resource response from MAC to DU APP */ + FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_RACH_RESOURCE_RSP); + + /* If negative response is received from SCH, send it further to DU APP */ + if(schRachRsrcRsp->result == RSP_NOK) + { + DU_LOG("\nINFO --> MAC : RACH Resource response from SCH : Result [FAILURE]"); + rachRsrcRsp->result = MAC_DU_APP_RSP_NOK; + } + else + { + DU_LOG("\nINFO --> MAC : RACH Resource response from SCH : Result [SUCCESS]"); + + /* Fetch Cell Cb */ + GET_CELL_IDX(schRachRsrcRsp->cellId, cellIdx); + if(macCb.macCell[cellIdx] && (macCb.macCell[cellIdx]->cellId == schRachRsrcRsp->cellId)) + { + cellCb = macCb.macCell[cellIdx]; + + /* Fetch UE Cb */ + if(cellCb->ueCb[rachRsrcRsp->ueId-1].crnti == schRachRsrcRsp->crnti) + ueCb = &cellCb->ueCb[rachRsrcRsp->ueId-1]; + else + { + DU_LOG("\nERROR --> MAC : CRNTI [%d] not found", schRachRsrcRsp->crnti); + rachRsrcRsp->result = MAC_DU_APP_RSP_NOK; + } + } + else + { + DU_LOG("\nERROR --> MAC : Cell ID [%d] not found", schRachRsrcRsp->cellId); + rachRsrcRsp->result = MAC_DU_APP_RSP_NOK; + } + } + + /* TODO : Check if ra-preamble index is to be stored in UE CB */ + + /* Fill SSB RACH resource info if SCH has sent a positive response and + * processing of SCH RACH resource response at MAC has been successful so far */ + if(rachRsrcRsp->result == MAC_DU_APP_RSP_OK) + { + rachRsrcRsp->newCrnti = ueCb->crnti; + rachRsrcRsp->cfraResource.numSsb = schRachRsrcRsp->cfraResource.numSsb; + memcpy(rachRsrcRsp->cfraResource.ssbResource, schRachRsrcRsp->cfraResource.ssbResource, \ + rachRsrcRsp->cfraResource.numSsb * sizeof(MacCfraSsbResource)); + } + + /* Free SCH RACH resource response */ + MAC_FREE(schRachRsrcRsp, sizeof(SchRachRsrcRsp)); + + /* Send RACH resource response to DU APP */ + FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_RACH_RESOURCE_RSP); + return (*macDuRachRsrcRspOpts[rspPst.selector])(&rspPst, rachRsrcRsp); +} + /* spec-38.211 Table 6.3.3.1-7 */ uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX] = {0, 2, 4, 6, 8, 10, 12, 13, 15, 17, 19, 23, 27, 34, 46, 69}; diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index 20198eb8a..4206acd38 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -2299,6 +2299,13 @@ uint8_t MacProcUeCreateReq(Pst *pst, MacUeCfg *ueCfg) if(ueCfg) { + /* If CRNTI = 0, MAC must allot a CRNTI to this UE. This scenario hits in + * case of UE in handover */ + if(ueCfg->crnti == 0) + { + GET_CRNTI(ueCfg->crnti, ueCfg->ueId); + } + /*Storing received ueCfg in ueCfgTmpData */ ret = copyToTmpData(ueCfg); if(ret == ROK) diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 523ee9757..39b895852 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -268,6 +268,7 @@ typedef struct schUeCb SchUeCfgCb ueCfg; SchUeState state; SchCellCb *cellCb; + SchCfraResource cfraResource; bool srRcvd; bool bsrRcvd; BsrInfo bsrInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS]; @@ -330,15 +331,16 @@ typedef struct schCellCb SchCellCfg cellCfg; /*!< Cell ocnfiguration */ bool firstSsbTransmitted; bool firstSib1Transmitted; - uint8_t ssbStartSymbArr[SCH_MAX_SSB_BEAM]; /*! SCH : RACH occassion set for slot %d", prachOccasionTimingInfo.slot); } +/** + * @brief Process RACH resource request for CFRA + * + * @details + * + * Function : MacSchRachRsrcReq + * + * This function processes RACH resorce request + * from MAC for CFRA. It assigns a dedicated preamble + * to the UE and sends the same in RACH resource + * response + * + * @param[in] Post structure + * @param[in] RACH resource request + * @return ROK + * RFAILED + **/ +uint8_t MacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq) +{ + uint8_t ssbIdx = 0, cfraSsbIdx = 0; + uint8_t firstCFPreambleIndex = 0, lastCFPreambleIndex = 0; + uint16_t cellIdx = 0; + uint64_t mask = 0; + Pst rspPst; + Inst inst = pst->dstInst - SCH_INST_START; + SchCellCb *cellCb = NULLP; + SchUeCb *ueCb = NULLP; + SchRachRsrcRsp *rachRsrcRsp = NULLP; + + DU_LOG("\nINFO --> SCH : Received RACH resource request for Cell ID [%d] CRNTI [%d]", \ + schRachRsrcReq->cellId, schRachRsrcReq->crnti); + + /* Fill RACH resource response to MAC */ + SCH_ALLOC(rachRsrcRsp, sizeof(SchRachRsrcRsp)); + if(!rachRsrcRsp) + { + DU_LOG("\nERROR --> SCH : Memory allocation failed for RACH resource response"); + return RFAILED; + } + rachRsrcRsp->cellId = schRachRsrcReq->cellId; + rachRsrcRsp->crnti = schRachRsrcReq->crnti; + rachRsrcRsp->result = RSP_OK; + + /* Fill SCH to MAC Pst structure */ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_SCH_TO_MAC(rspPst, inst); + rspPst.event = EVENT_RACH_RESOURCE_RESPONSE_TO_MAC; + + /* Fetch Cell CB */ + for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++) + { + if((schCb[inst].cells[cellIdx]) && (schCb[inst].cells[cellIdx]->cellId == schRachRsrcReq->cellId)) + { + cellCb = schCb[inst].cells[cellIdx]; + break; + } + } + + if(cellCb) + { + /* Fetch UE CB */ + ueCb = schGetUeCb(cellCb, schRachRsrcReq->crnti); + if(ueCb->crnti != schRachRsrcReq->crnti) + { + DU_LOG("\nERROR --> SCH : CRNTI [%d] not found" ,schRachRsrcReq->crnti); + rachRsrcRsp->result = RSP_NOK; + } + } + else + { + DU_LOG("\nERROR --> SCH : Cell ID [%d] not found" ,schRachRsrcReq->cellId); + rachRsrcRsp->result = RSP_NOK; + } + + /* Allocate SSB resource if no failure has occurred until this step */ + if(rachRsrcRsp->result == RSP_OK) + { + /* Find first free preamble index from the pool CF preambles + * Preamble index from 0 to (numCbPreamblePerSsb-1) is used for CBRA + * Preamble index from numCbPreamblePerSsb to totalNumOfRAPreamble + * is used for CFRA */ + firstCFPreambleIndex = cellCb->cellCfg.schRachCfg.numCbPreamblePerSsb; + lastCFPreambleIndex = cellCb->cellCfg.schRachCfg.totalNumRaPreamble; + + /* Allocate resource for each SSB index requested */ + for(ssbIdx = 0; ssbIdx < schRachRsrcReq->numSsb; ssbIdx++) + { + /* Find the first CF Preamble index not dedicated to any UE currently */ + while(firstCFPreambleIndex <= lastCFPreambleIndex) + { + mask = 1 << firstCFPreambleIndex; + if(cellCb->dedPreambleBitMap & mask) + { + firstCFPreambleIndex++; + continue; + } + else + break; + } + + /* If firstCFPreambleIndex > lastCFPreambleIndex, it means all + * dedicated preambles are in use currently. In such a case, CBRA + * should be initiated. + * If a dedicated preamble is found, use this for CFRA and mark it as + * IN-USE in the bitmap. + * Considering only CFRA scenario for now. */ + if(firstCFPreambleIndex <= lastCFPreambleIndex) + { + ueCb->cfraResource.ssbResource[cfraSsbIdx].ssbIdx = schRachRsrcReq->ssbIdx[ssbIdx]; + ueCb->cfraResource.ssbResource[cfraSsbIdx].raPreambleIdx = firstCFPreambleIndex; + SET_ONE_BIT(firstCFPreambleIndex, cellCb->dedPreambleBitMap); + cfraSsbIdx++; + firstCFPreambleIndex++; + } + else + { + DU_LOG("\nINFO : SCH : No dedicated preameble availble to assign to ssbIdx[%d]", schRachRsrcReq->ssbIdx[ssbIdx]); + /* Breaking out of for loop since no dedicated preambles are available + * for remaining ssbIdx too */ + break; + } + } /* End of for */ + + ueCb->cfraResource.numSsb = cfraSsbIdx; + + if(ueCb->cfraResource.numSsb == 0) + { + /* If numSsb is 0, it means no CFRA resource was alloacted for any of the + * SSB Idx, hence send a negative response */ + rachRsrcRsp->result = RSP_NOK; + } + else + { + /* Send ssb resource information to MAC in RACH resource response */ + rachRsrcRsp->cfraResource.numSsb = ueCb->cfraResource.numSsb; + memcpy(rachRsrcRsp->cfraResource.ssbResource, ueCb->cfraResource.ssbResource, \ + ueCb->cfraResource.numSsb * sizeof(SchCfraSsbResource)); + } + } /* End of if */ + + /* Free RACH resource request memory allocated by MAC */ + SCH_FREE(schRachRsrcReq, sizeof(SchRachRsrcReq)); + + /* Send RACH resource response to MAC */ + return (SchRachRsrcRspOpts[rspPst.selector](&rspPst, rachRsrcRsp)); +} + /** * @brief calculate ra-rnti function. * diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index 85c166339..3595da0ae 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -554,7 +554,9 @@ uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfg) ueCb->state = SCH_UE_STATE_ACTIVE; } else + { ueCb->state = SCH_UE_HANDIN_IN_PROGRESS; + } ueCb->cellCb = cellCb; ueCb->srRcvd = false; diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 2f2f196d2..1678c8f61 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -62,6 +62,7 @@ #define MAX_NUM_LC MAX_DRB_LCID + 1 /*Spec 38.331: Sec 6.4: maxLC-ID Keyword*/ #define MAX_NUM_SRB 3 /* Max. no of Srbs */ #define MAX_NUM_DRB 29 /* spec 38.331, maxDRB */ +#define MAX_NUM_SSB 64 /* spec 28.331, maxNrofSSBs */ /* 5G ORAN phy delay */ #define PHY_DELTA_DL 1 diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index e0e75c52f..84dc32f98 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -863,6 +863,7 @@ uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) return ODU_POST_TASK(pst,mBuf); } + /******************************************************************* * * @brief Unpacks UE Reconfig Request received from DU APP @@ -901,6 +902,166 @@ uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf) return RFAILED; } + +/******************************************************************* + * + * @brief Packs and Sends RACH Resource request from DUAPP to MAC + * + * @details + * + * Function : packDuMacRachRsrcReq + * + * Functionality: + * Packs and Sends RACH Resource request from DU APP to MAC + * + * + * @params[in] Post structure pointer + * MacRachRsrcReq pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacRachRsrcReq,"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer, (PTR)rachRsrcReq, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacRachRsrcReq"); + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpacks RACH resource Request received from DU APP + * + * @details + * + * Function : unpackMacRachRsrcReq + * + * Functionality: + * Unpacks RACH resource Request received from DU APP + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackMacRachRsrcReq(DuMacRachRsrcReq func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacRachRsrcReq *rachRsrcReq; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcReq, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, rachRsrcReq); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nERROR --> DU APP : Only LWLC supported for RACH resource Request "); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} + +/******************************************************************* + * + * @brief Packs and Sends RACH Resource response from MAC to DU APP + * + * @details + * + * Function : packDuMacRachRsrcRsp + * + * Functionality: + * Packs and Sends RACH Resource response from MAC to DU APP + * + * + * @params[in] Post structure pointer + * MacRachRsrcRsp pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacRachRsrcRsp"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer, (PTR)rachRsrcRsp, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacRachRsrcRsp"); + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpacks RACH resource Response received from MAC + * + * @details + * + * Function : unpackDuMacRachRsrcRsp + * + * Functionality: + * Unpacks RACH resource Response received from MAC + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackDuMacRachRsrcRsp(MacDuRachRsrcRspFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacRachRsrcRsp *rachRsrcRsp; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcRsp, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, rachRsrcRsp); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nERROR --> DU APP : Only LWLC supported for RACH resource Response "); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} /******************************************************************* * * @brief Packs and Sends UE Delete Request from DUAPP to MAC diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 869278cfb..4815b4cab 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -80,6 +80,8 @@ #define EVENT_MAC_SLICE_RECFG_REQ 218 #define EVENT_MAC_SLICE_RECFG_RSP 219 #define EVENT_MAC_SLOT_IND 220 +#define EVENT_MAC_RACH_RESOURCE_REQ 221 +#define EVENT_MAC_RACH_RESOURCE_RSP 222 #define BSR_PERIODIC_TIMER_SF_10 10 #define BSR_RETX_TIMER_SF_320 320 @@ -572,7 +574,9 @@ typedef struct prachCfg uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */ uint8_t rootSeqLen; /* Root sequence length */ PrachFdmInfo fdm[8]; /* FDM info */ + uint8_t totalNumRaPreamble; /* Total number of RA preambles */ uint8_t ssbPerRach; /* SSB per RACH occassion */ + uint8_t numCbPreamblePerSsb; /* Number of CB preamble per SSB */ bool prachMultCarrBand; /* Multiple carriers in Band */ uint8_t prachRestrictedSet; /* Support for PRACH restricted set */ uint8_t raContResTmr; /* RA Contention Resoultion Timer */ @@ -1291,6 +1295,35 @@ typedef struct ueCfgRsp SCellFailInfo *failedSCellList; }MacUeCfgRsp; +typedef struct rachRsrcReq +{ + uint16_t cellId; + uint16_t ueId; + uint8_t numSsb; + uint8_t ssbIdx[MAX_NUM_SSB]; +}MacRachRsrcReq; + +typedef struct macCfraSsbResource +{ + uint8_t ssbIdx; + uint8_t raPreambleIdx; +}MacCfraSsbResource; + +typedef struct macCfraResource +{ + uint8_t numSsb; + MacCfraSsbResource ssbResource[MAX_NUM_SSB]; +}MacCfraResource; + +typedef struct macRachRsrcRsp +{ + uint16_t cellId; + uint16_t ueId; + MacRsp result; + uint16_t newCrnti; /* This parameter maps to 3GPP TS 38.331 newUE-Identity */ + MacCfraResource cfraResource; +}MacRachRsrcRsp; + typedef struct ueDelete { uint16_t cellId; @@ -1424,6 +1457,16 @@ typedef uint8_t (*DuMacUeReconfigReq) ARGS(( Pst *pst, MacUeCfg *ueCfg )); +/* RACH Resource Request from DU APP to MAC*/ +typedef uint8_t (*DuMacRachRsrcReq) ARGS(( + Pst *pst, + MacRachRsrcReq *rachRsrcReq)); + +/* RACH Resource Response from MAC to DU APP*/ +typedef uint8_t (*MacDuRachRsrcRspFunc) ARGS(( + Pst *pst, + MacRachRsrcRsp *rachRsrcRsp)); + /* UE Delete Request from DU APP to MAC*/ typedef uint8_t (*DuMacUeDeleteReq) ARGS(( Pst *pst, @@ -1500,6 +1543,12 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp); uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg); uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf); uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg); +uint8_t packDuMacRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq); +uint8_t unpackMacRachRsrcReq(DuMacRachRsrcReq func, Pst *pst, Buffer *mBuf); +uint8_t MacProcRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq); +uint8_t packDuMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp); +uint8_t unpackDuMacRachRsrcRsp(MacDuRachRsrcRspFunc func, Pst *pst, Buffer *mBuf); +uint8_t DuProcMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp); uint8_t packDuMacUeDeleteReq(Pst *pst, MacUeDelete *ueDelete); uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete); uint8_t unpackMacUeDeleteReq(DuMacUeDeleteReq func, Pst *pst, Buffer *mBuf); diff --git a/src/cm/mac_sch_interface.c b/src/cm/mac_sch_interface.c index 522bdf429..397697ce1 100644 --- a/src/cm/mac_sch_interface.c +++ b/src/cm/mac_sch_interface.c @@ -355,6 +355,66 @@ uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) return ROK; } +/******************************************************************* + * + * @brief Pack and Send RACH resource Request from MAC to SCH + * + * @details + * + * Function : packMacSchRachRsrcReq + * + * Functionality: + * Pack and Send RACH resouece Request from MAC to SCH + * + * @params[in] Post structure + * RACH resource request + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packMacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq) +{ + if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LC)) + { + /* TODO */ + } + else + { + return RFAILED; + } + return ROK; +} + +/******************************************************************* + * + * @brief Pack and Send RACH resource Response from SCH to MAC + * + * @details + * + * Function : packSchRachRsrcRsp + * + * Functionality: + * Pack and Send RACH resource Response from SCH to MAC + * + * @params[in] Post structure + * RACH resource response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp) +{ + if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LC)) + { + /* TODO */ + } + else + { + return RFAILED; + } + return ROK; +} + /******************************************************************* * * @brief Pack and Send UE Delete Request from MAC to SCH diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 2aa4c61e5..d09063a84 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -41,6 +41,8 @@ #define EVENT_SLICE_CFG_RSP_TO_MAC 22 #define EVENT_SLICE_RECFG_REQ_TO_SCH 23 #define EVENT_SLICE_RECFG_RSP_TO_MAC 24 +#define EVENT_RACH_RESOURCE_REQUEST_TO_SCH 25 +#define EVENT_RACH_RESOURCE_RESPONSE_TO_MAC 26 /*macros*/ #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */ @@ -621,7 +623,9 @@ typedef struct schRachCfg uint16_t rootSeqIdx; /* Root sequence index */ uint8_t numRootSeq; /* Number of root sequences required for FD */ uint16_t k1; /* Frequency Offset for each FD */ + uint8_t totalNumRaPreamble; /* Total number of RA preambles */ uint8_t ssbPerRach; /* SSB per RACH occassion */ + uint8_t numCbPreamblePerSsb; /* Number of CB preamble per SSB */ uint8_t prachMultCarrBand; /* Presence of Multiple carriers in Band */ uint8_t raContResTmr; /* RA Contention Resoultion Timer */ uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */ @@ -1590,6 +1594,34 @@ typedef struct schUeCfgRsp SchFailureCause cause; }SchUeCfgRsp; +typedef struct schRachRsrcReq +{ + uint16_t cellId; + uint16_t crnti; + uint8_t numSsb; + uint8_t ssbIdx[MAX_NUM_SSB]; +}SchRachRsrcReq; + +typedef struct schCfraSsbResource +{ + uint8_t ssbIdx; + uint8_t raPreambleIdx; +}SchCfraSsbResource; + +typedef struct schCfraRsrc +{ + uint8_t numSsb; + SchCfraSsbResource ssbResource[MAX_NUM_SSB]; +}SchCfraResource; + +typedef struct schRachRsrcRsp +{ + uint16_t cellId; + uint16_t crnti; + SchMacRsp result; + SchCfraResource cfraResource; +}SchRachRsrcRsp; + typedef struct schUeDelete { uint16_t cellId; @@ -1734,6 +1766,14 @@ typedef uint8_t (*SchUeReCfgRspFunc) ARGS(( Pst *pst, /* Post structure */ SchUeCfgRsp *cfgRsp)); /* Scheduler UE Cfg response */ +typedef uint8_t (*MacSchRachRsrcReqFunc) ARGS(( + Pst *pst, /* Post structure */ + SchRachRsrcReq *schRachRsrcReq)); /* RACH resource request to SCH */ + +typedef uint8_t (*SchRachRsrcRspFunc) ARGS(( + Pst *pst, /* Post structure */ + SchRachRsrcRsp *schRachRsrcRsp)); /* RACH resource request to MAC */ + typedef uint8_t (*MacSchUeDeleteReqFunc) ARGS(( Pst *pst, /* Post structure */ SchUeDelete *schUeDel)); /*Scheduler UE Del*/ @@ -1767,6 +1807,7 @@ typedef uint8_t (*SchSliceReCfgRspFunc) ARGS(( Pst *pst, /* Post Structure */ SchSliceCfgRsp *schSliceReCfgRsp /* Cell ReCfg Cfm */ )); + /* function declarations */ uint8_t packMacSchSlotInd(Pst *pst, SlotTimingInfo *slotInd); uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo); @@ -1800,6 +1841,10 @@ uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch); uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch); uint8_t packSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp); uint8_t MacProcSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp); +uint8_t packMacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq); +uint8_t MacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq); +uint8_t packSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp); +uint8_t MacProcSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp); uint8_t packMacSchUeDeleteReq(Pst *pst, SchUeDelete *schUeDel); uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete); uint8_t packSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *delRsp); diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c index 7e1b9ac42..a98fb752e 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.c +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -1960,6 +1960,9 @@ uint8_t extractDuToCuRrcCont(CuUeCb *ueCb, OCTET_STRING_t rrcCont) CellGroupConfigRrc_t cellGrpCfg, *cellGrpCfgMsg = NULLP; asn_dec_rval_t rval; /* Decoder return value */ + /* Copy the received container to UeCb */ + memcpy(&ueCb->f1apMsgDb.duToCuContainer, &rrcCont, sizeof(OCTET_STRING_t)); + /* Decoding DU to CU RRC container octet string to cell group config */ cellGrpCfgMsg = &cellGrpCfg; memset(cellGrpCfgMsg, 0, sizeof(CellGroupConfigRrc_t)); @@ -8442,13 +8445,28 @@ uint8_t fillRrcReconfigNonCriticalExt(CuUeCb *ueCb, RRCReconfiguration_v1530_IEs CU_ALLOC(rrcRecfg->masterCellGroup, sizeof(OCTET_STRING_t)); if(!rrcRecfg->masterCellGroup) { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in fillRrcReconfigNonCriticalExt"); return RFAILED; } + rrcRecfg->masterCellGroup->size = ueCb->f1apMsgDb.duToCuContainer.size; + CU_ALLOC(rrcRecfg->masterCellGroup->buf, rrcRecfg->masterCellGroup->size); + if(!rrcRecfg->masterCellGroup->buf) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in fillRrcReconfigNonCriticalExt"); + return RFAILED; + } + memcpy(rrcRecfg->masterCellGroup->buf, ueCb->f1apMsgDb.duToCuContainer.buf, rrcRecfg->masterCellGroup->size); + +#if 0 + /* Use below code if masterCEllGroup is to be filled explicitly at CU rather than copying from DUToCURRCContainer + * received from DU */ if(fillCellGrpCfg(ueCb, rrcRecfg->masterCellGroup, updateAllRbCfg) != ROK) { + DU_LOG("\nERROR --> F1AP : Failed to fill CellGroupCfg in fillRrcReconfigNonCriticalExt"); return RFAILED; } +#endif return ROK; } @@ -9270,6 +9288,7 @@ uint8_t procUeContextSetupResponse(uint32_t duId, F1AP_PDU_t *f1apMsg) DuDb *duDb = NULLP; CuUeCb *ueCb = NULLP; UEContextSetupResponse_t *ueCtxtSetupRsp = NULLP; + OCTET_STRING_t *duToCuRrcContainer; SEARCH_DU_DB(duIdx, duId, duDb); ueCtxtSetupRsp = &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse; @@ -9320,6 +9339,8 @@ uint8_t procUeContextSetupResponse(uint32_t duId, F1AP_PDU_t *f1apMsg) case ProtocolIE_ID_id_DUtoCURRCInformation: { DU_LOG("\nINFO --> Received Du to Cu RRC Information "); + duToCuRrcContainer = &ueCtxtSetupRsp->protocolIEs.list.array[idx]->value.choice.\ + DUtoCURRCInformation.cellGroupConfig; if((extractDuToCuRrcCont(ueCb, ueCtxtSetupRsp->protocolIEs.list.array[idx]->value.choice.\ DUtoCURRCInformation.cellGroupConfig)) != ROK) { @@ -9365,6 +9386,10 @@ uint8_t procUeContextSetupResponse(uint32_t duId, F1AP_PDU_t *f1apMsg) /* Store source DU info in the new UE context created in * tareget DU */ ueCb->hoInfo.sourceDuId = srcDuDb->duId; + + /* Copy the received container to UeCb */ + memcpy(&ueCbInSrcDu->f1apMsgDb.duToCuContainer, duToCuRrcContainer, sizeof(OCTET_STRING_t)); + if(BuildAndSendUeContextModificationReq(srcDuDb->duId, ueCbInSrcDu, STOP_DATA_TX) != ROK) { DU_LOG("\nERROR -> F1AP : Failed at BuildAndSendUeContextModificationReq()"); @@ -10718,6 +10743,7 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator = \ TransmissionActionIndicator_restart; } + ieIdx++; ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCContainer; ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; @@ -10754,10 +10780,15 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt else { DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for ueContextModifyReq\n"); +#if 0 + /* This for loop was going into an infinite loop even though encBufSize + * has a small value. Hence commented this + */ for(ieIdx=0; ieIdx< encBufSize; ieIdx++) { DU_LOG("%x",encBuf[ieIdx]); } +#endif } /* TODO : Hardcoding DU ID to 1 for messages other than F1 Setup Response. This will be made generic in future gerrit */ diff --git a/src/cu_stub/cu_stub.h b/src/cu_stub/cu_stub.h index 8b20b4dbd..ed0adced7 100644 --- a/src/cu_stub/cu_stub.h +++ b/src/cu_stub/cu_stub.h @@ -26,10 +26,10 @@ #define CU_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0011" #ifndef O1_ENABLE -#define DU_IP_V4_ADDR (char*[]){"192.168.130.85", "192.168.130.83"} +#define DU_IP_V4_ADDR (char*[]){"192.168.130.81", "192.168.130.83"} #define DU_SCTP_PORT (int[]){38472, 38473} -#define CU_IP_V4_ADDR "192.168.130.86" +#define CU_IP_V4_ADDR "192.168.130.82" #define CU_SCTP_PORT_TO_DU (int[]){38472, 38473} #endif diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index 1b3b6a0a3..e1c28a76e 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -31,7 +31,6 @@ #include "OCTET_STRING.h" #include "BIT_STRING.h" #include "odu_common_codec.h" -#include "du_sys_info_hdl.h" #include "MIB.h" #include "SearchSpace.h" #include "SIB-TypeInfo.h" @@ -52,6 +51,8 @@ #include "RACH-ConfigCommon.h" #include "BWP-DownlinkCommon.h" #include "BWP-UplinkCommon.h" +#include "TDD-UL-DL-ConfigCommon.h" +#include "du_sys_info_hdl.h" #ifdef O1_ENABLE #include "CmInterface.h" @@ -252,7 +253,10 @@ uint8_t readMacCfg() } *(duCfgParam.macCellCfg.prachCfg.fdm[0].unsuedRootSeq) = UNUSED_ROOT_SEQ; } + + duCfgParam.macCellCfg.prachCfg.totalNumRaPreamble = NUM_RA_PREAMBLE; duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH; + duCfgParam.macCellCfg.prachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB; duCfgParam.macCellCfg.prachCfg.prachMultCarrBand = PRACH_MULT_CARRIER_BAND; duCfgParam.macCellCfg.prachCfg.raContResTmr = RA_CONT_RES_TIMER; duCfgParam.macCellCfg.prachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB; @@ -503,6 +507,12 @@ uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) PucchCfgCommon pucchCfg; TddUlDlCfgCommon tddCfg; +#ifdef O1_ENABLE + srvCellCfgComm->scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing); +#else + srvCellCfgComm->scs = NR_SCS; +#endif + /* Configuring DL Config Common for SIB1*/ srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND; srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A; @@ -523,9 +533,7 @@ uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX; pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID; pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID; - pdcchCfg.monitorSlotPrdAndOffPresent = \ - - SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + pdcchCfg.monitorSlotPrdAndOffPresent = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; //pdcchCfg.monitorSlotPrdAndOff = \ SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; pdcchCfg.monitorSymbolsInSlot[0] = 128; @@ -546,20 +554,17 @@ uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup; pdschCfg.numTimeDomRsrcAlloc = 2; pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1; - pdschCfg.timeDomAlloc[0].mapType = \ - PDSCH_TimeDomainResourceAllocation__mappingType_typeA; + pdschCfg.timeDomAlloc[0].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA; pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL); pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2; - pdschCfg.timeDomAlloc[1].mapType = \ - PDSCH_TimeDomainResourceAllocation__mappingType_typeA; + pdschCfg.timeDomAlloc[1].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA; pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL); srvCellCfgComm->dlCfg.pdschCfg = pdschCfg; /* Configuring BCCH Config for SIB1 */ - srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = \ - BCCH_Config__modificationPeriodCoeff_n16; + srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = BCCH_Config__modificationPeriodCoeff_n16; /* Configuring PCCH Config for SIB1 */ pcchCfg.dfltPagingCycle = convertPagingCycleEnumToValue(PagingCycle_rf256); @@ -583,6 +588,7 @@ uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS; srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH; #endif + srvCellCfgComm->ulCfg.freqBandInd = NR_FREQ_BAND; srvCellCfgComm->ulCfg.pMax = UL_P_MAX; srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW; srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity; @@ -598,9 +604,8 @@ uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2; rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10; rachCfg.numRaPreamble = NUM_RA_PREAMBLE; - rachCfg.ssbPerRachOccPresent = \ - RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one; - rachCfg.numSsbPerRachOcc = SSB_PER_RACH; + rachCfg.numSsbPerRachOcc = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one; + rachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB; rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64; rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB; rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139; @@ -639,7 +644,7 @@ uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) srvCellCfgComm->tddCfg = tddCfg; srvCellCfgComm->ssbPosInBurst = 192; - srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY_20MS; + srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY; srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR; return ROK; diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index 59616dbbe..088ea6fb5 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -28,10 +28,9 @@ #define DU_ID 1 #ifndef O1_ENABLE - -#define DU_IP_V4_ADDR "192.168.130.85" -#define CU_IP_V4_ADDR "192.168.130.86" -#define RIC_IP_V4_ADDR "192.168.130.87" +#define DU_IP_V4_ADDR "192.168.130.81" +#define CU_IP_V4_ADDR "192.168.130.82" +#define RIC_IP_V4_ADDR "192.168.130.80" #define DU_PORT 38472 #define CU_PORT 38472 #define RIC_PORT 36421 @@ -88,12 +87,7 @@ #define NORMAL_CYCLIC_PREFIX 0 #define OFFSET_TO_POINT_A 24 /* PRB Offset to Point A */ #define BETA_PSS BETA_PSS_0DB -#define SSB_PERIODICITY_5MS 5 -#define SSB_PERIODICITY_10MS 10 -#define SSB_PERIODICITY_20MS 20 -#define SSB_PERIODICITY_40MS 40 -#define SSB_PERIODICITY_80MS 80 -#define SSB_PERIODICITY_160MS 160 +#define SSB_PERIODICITY 20 #define SSB_SUBCARRIER_OFFSET 0 #define SSB_MULT_CARRIER_BAND FALSE #define MULT_CELL_CARRIER FALSE @@ -118,6 +112,7 @@ #define NUM_UNUSED_ROOT_SEQ 0 #define UNUSED_ROOT_SEQ 1 #define SSB_PER_RACH 1 +#define CB_PREAMBLE_PER_SSB 8 #define PRACH_MULT_CARRIER_BAND FALSE #define PRACH_PREAMBLE_RCVD_TGT_PWR -74 #define NUM_RA_PREAMBLE 63 @@ -1149,8 +1144,8 @@ typedef struct rachCfgCommon long pwrRampingStep; /* Power ramping steps for PRACH */ long raRspWindow; /* RA response window */ long numRaPreamble; /* Total num of preamble used in random access */ - uint8_t ssbPerRachOccPresent; long numSsbPerRachOcc; /* Numer of SSBs per RACH Occassion */ + long numCbPreamblePerSsb; /* Number of Contention-Based preamble per SSB */ long contResTimer; /* Contention resolution timer */ long rsrpThreshSsb; uint8_t rootSeqIdxPresent; @@ -1185,6 +1180,7 @@ typedef struct pucchCfgCommon typedef struct ulCfgCommon { + long freqBandInd; /* Uplink frequency band indicator */ long pMax; /* Max UL transmission power that UE applies */ long locAndBw; /* Frequency location and bandwidth */ ScsSpecCarrier ulScsCarrier; /* SCS Specific carrier */ @@ -1206,6 +1202,7 @@ typedef struct tddUlDlCfgCommon typedef struct srvCellCfgCommSib { + long scs; DlCfgCommon dlCfg; UlCfgCommon ulCfg; uint8_t ssbPosInBurst; diff --git a/src/du_app/du_f1ap_conversions.c b/src/du_app/du_f1ap_conversions.c index 0086be2d3..df0e62eae 100644 --- a/src/du_app/du_f1ap_conversions.c +++ b/src/du_app/du_f1ap_conversions.c @@ -1298,6 +1298,204 @@ e_PCCH_Config__ns convertNsValueToEnum(uint8_t numPO) return PCCH_Config__ns_one; } } + +/************************************************************************ + * + * @brief Converts actual values into enum value of SSB Periodicity in SIB + * + * @details + * + * Function : convertSsbPeriodicityValueToEnumForSib + * + * Functionality: + * Converts actual values into enum value of SSB Periodicity in SIB + * + * + * @params[in] Actual value of SSB Periodicity + * @return Enum value of SSB Periodicity + * + * **********************************************************************/ +e_ServingCellConfigCommonSIB__ssb_PeriodicityServingCell convertSsbPeriodicityValueToEnumForSib(uint16_t ssbPeriodicity) +{ + switch(ssbPeriodicity) + { + case 5: + return ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5; + case 10: + return ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10; + case 20: + return ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20; + case 40: + return ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40; + case 80: + return ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80; + case 160: + return ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160; + default: + return ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20; + } +} + +/************************************************************************ + * + * @brief Converts actual values into enum value of SSB Periodicity + * + * @details + * + * Function : convertSsbPeriodicityValueToEnum + * + * Functionality: + * Converts actual values into enum value of SSB Periodicity + * + * + * @params[in] Actual value of SSB Periodicity + * @return Enum value of SSB Periodicity + * + * **********************************************************************/ +e_ServingCellConfigCommon__ssb_periodicityServingCell convertSsbPeriodicityValueToEnum(uint16_t ssbPeriodicity) +{ + switch(ssbPeriodicity) + { + case 5: + return ServingCellConfigCommon__ssb_periodicityServingCell_ms5; + case 10: + return ServingCellConfigCommon__ssb_periodicityServingCell_ms10; + case 20: + return ServingCellConfigCommon__ssb_periodicityServingCell_ms20; + case 40: + return ServingCellConfigCommon__ssb_periodicityServingCell_ms40; + case 80: + return ServingCellConfigCommon__ssb_periodicityServingCell_ms80; + case 160: + return ServingCellConfigCommon__ssb_periodicityServingCell_ms160; + default: + return ServingCellConfigCommon__ssb_periodicityServingCell_ms20; + } +} + +/************************************************************************ + * + * @brief Converts actual values into enum value of SSB per RACH occassion + * for CFRA + * + * @details + * + * Function : convertCFRASsbPerRachOccasionValueToEnum + * + * Functionality: + * Converts actual values into enum value of SSB occasion per RACH + * occassion for CFRA + * + * @params[in] Actual value of SSB Occasion per RACH + * @return Enum value + * + * **********************************************************************/ +e_CFRA__occasions__ssb_perRACH_Occasion convertCFRASsbPerRachOccasionValueToEnum(uint8_t ssbOccPerRach) +{ + switch(ssbOccPerRach) + { + case 1: + return CFRA__occasions__ssb_perRACH_Occasion_one; + case 2: + return CFRA__occasions__ssb_perRACH_Occasion_two; + case 4: + return CFRA__occasions__ssb_perRACH_Occasion_four; + case 8: + return CFRA__occasions__ssb_perRACH_Occasion_eight; + case 16: + return CFRA__occasions__ssb_perRACH_Occasion_sixteen; + default: + return CFRA__occasions__ssb_perRACH_Occasion_one; + } +} + +/************************************************************************ + * + * @brief Converts actual values into enum value of CB Preamble per SSB + * for one SSB per RACH occassion + * + * @details + * + * Function : convertCbPreamblePerSsbValueToEnum + * + * Functionality: + * Converts actual values into enum value of CB Preamble per + * SSB for one SSB per RACH occasion + * + * @params[in] Actual value of CB preambles per SSB + * @return Enum value + * + * **********************************************************************/ +e_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one convertCbPreamblePerSsbValueToEnum(uint8_t numCbPreamblePerSsb) +{ + switch(numCbPreamblePerSsb) + { + case 4: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n4; + case 8: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n8; + case 12: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n12; + case 16: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n16; + case 20: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n20; + case 24: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n24; + case 28: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n28; + case 32: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n32; + case 36: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n36; + case 40: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n40; + case 44: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n44; + case 48: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n48; + case 52: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n52; + case 56: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n56; + case 60: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n60; + case 64: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n64; + default: + return RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n8; + } +} + +/************************************************************************ + * + * @brief Converts actual values into enum value of DMRS Type A Position + * for CFRA + * + * @details + * + * Function : convertDmrsTypeAPosValueToEnum + * + * Functionality: + * Converts actual values into enum value of DMRS Type A Position + * + * @params[in] Actual value of DMRS Type A Position + * @return Enum value + * + * **********************************************************************/ +e_ServingCellConfigCommon__dmrs_TypeA_Position convertDmrsTypeAPosValueToEnum(uint8_t dmrsTypeAPos) +{ + switch(dmrsTypeAPos) + { + case 2: + return ServingCellConfigCommon__dmrs_TypeA_Position_pos2; + case 3: + return ServingCellConfigCommon__dmrs_TypeA_Position_pos3; + default: + return ServingCellConfigCommon__dmrs_TypeA_Position_pos2; + } +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_f1ap_conversions.h b/src/du_app/du_f1ap_conversions.h index 508ffd5f4..1da8132c0 100644 --- a/src/du_app/du_f1ap_conversions.h +++ b/src/du_app/du_f1ap_conversions.h @@ -30,6 +30,10 @@ #include "PUCCH-Resource.h" #include "PagingDRX.h" #include "PCCH-Config.h" +#include "ServingCellConfigCommonSIB.h" +#include "ServingCellConfigCommon.h" +#include "CFRA.h" +#include "RACH-ConfigCommon.h" #include "du_app_rlc_inf.h" RLC_BearerConfig__servedRadioBearer_PR covertRbTypeFromIntEnumToRrcEnum(RlcRbType rbType); @@ -60,6 +64,12 @@ uint16_t convertPagingCycleEnumToValue(e_PagingDRX pagingDrx); uint8_t convertNsEnumToValue(e_PCCH_Config__ns Ns); e_PCCH_Config__ns convertNsValueToEnum(uint8_t numPO); +e_ServingCellConfigCommonSIB__ssb_PeriodicityServingCell convertSsbPeriodicityValueToEnumForSib(uint16_t ssbPeriodicity); +e_ServingCellConfigCommon__ssb_periodicityServingCell convertSsbPeriodicityValueToEnum(uint16_t ssbPeriodicity); +e_CFRA__occasions__ssb_perRACH_Occasion convertCFRASsbPerRachOccasionValueToEnum(uint8_t ssbOccPerRach); +e_ServingCellConfigCommon__dmrs_TypeA_Position convertDmrsTypeAPosValueToEnum(uint8_t dmrsTypeAPos); +e_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one convertCbPreamblePerSsbValueToEnum(uint8_t numCbPreamblePerSsb); + /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index da896466c..66cbf486b 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -110,11 +110,21 @@ #include "UPTransportLayerInformation.h" #include "GTPTunnel.h" #include "SupportedSULFreqBandItem.h" -#include "du_sys_info_hdl.h" #include "du_e2ap_msg_hdl.h" #include "du_f1ap_conversions.h" #include "CNUEPagingIdentity.h" #include "PCCH-Config.h" +#include "SCS-SpecificCarrier.h" +#include "FrequencyInfoDL.h" +#include "DownlinkConfigCommon.h" +#include "FrequencyInfoUL.h" +#include "UplinkConfigCommon.h" +#include "TDD-UL-DL-ConfigCommon.h" +#include "RACH-ConfigDedicated.h" +#include "CFRA-SSB-Resource.h" +#include "BWP-UplinkCommon.h" +#include "ReconfigurationWithSync.h" +#include "du_sys_info_hdl.h" #ifdef O1_ENABLE #include "CmInterface.h" @@ -6187,279 +6197,977 @@ uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg) return ROK; } + /******************************************************************* * - * @brief Builds Spcell config + * @brief Fills SCS specific carrier list in DL frequency info * * @details * - * Function : BuildSpCellCfg + * Function : BuildScsSpecificCarrierListDl * - * Functionality: Builds sp cell config in DuToCuRrcContainer + * Functionality: Fills SCS specific carrier list in DL frequency info * - * @params[in] SpCellConfig_t spCellCfg + * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildSpCellCfg(DuUeCb *ueCb, SpCellConfig_t *spCellCfg) +uint8_t BuildScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList) { - spCellCfg->servCellIndex = NULLP; - DU_ALLOC(spCellCfg->servCellIndex, sizeof(long)); - if(!spCellCfg->servCellIndex) + uint8_t elementCnt = 0, listIdx = 0; + ScsSpecCarrier duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier; + + elementCnt = ODU_VALUE_ONE; + scsCarrierList->list.count = elementCnt; + scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *); + + DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size); + if(!scsCarrierList->list.array) { - DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg"); + DU_LOG("\nERROR --> DU APP : Memory allocation failed for scs carrier list array \ + in BuildScsSpecificCarrierListDl()"); return RFAILED; } - if(ueCb == NULLP) - *(spCellCfg->servCellIndex) = SERV_CELL_IDX; - else - *(spCellCfg->servCellIndex) = ueCb->macUeCfg.spCellCfg.servCellIdx; + for(listIdx = 0; listIdx < elementCnt; listIdx++) + { + DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t)); + if(!scsCarrierList->list.array[listIdx]) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for SCS Specific Carrier list array \ + element in BuildScsSpecificCarrierListDl()"); + return RFAILED; + } + } - spCellCfg->reconfigurationWithSync = NULLP; - spCellCfg->rlf_TimersAndConstants = NULLP; - spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP; + listIdx = 0; + scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset; + scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs; + scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw; - DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long)); - if(!spCellCfg->rlmInSyncOutOfSyncThreshold) + return ROK; +} + +/******************************************************************* + * + * @brief Fills DL frequency info in DL config common + * + * @details + * + * Function : BuildFreqInfoDl + * + * Functionality: Fills DL frequency info in DL config common + * + * @params[in] Pointer to DownlinkConfigCommon_t + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL) +{ + uint8_t freqBandIdx = 0, elementCnt = 0; + DlCfgCommon dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg; + + /* TODO : Fill SSB Absolute Frequency */ + /* + DU_ALLOC(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t)); + if(!frequencyInfoDL->absoluteFrequencySSB) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB Absolute Frequency in BuildFreqInfoDl()"); + return RFAILED; + } + frequencyInfoDL->absoluteFrequencySSB = ?; + */ + + /* NR Multi Frequency Band List */ + elementCnt = ODU_VALUE_ONE; + frequencyInfoDL->frequencyBandList.list.count = elementCnt; + frequencyInfoDL->frequencyBandList.list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *); + + DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size); + if(!frequencyInfoDL->frequencyBandList.list.array) { - DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg"); + DU_LOG("\nERROR --> DU APP : Memory allocation failed for Frequency Band List array in BuildFreqInfoDl()"); return RFAILED; } - *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD; - spCellCfg->spCellConfigDedicated = NULLP; - DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t)); - if(!spCellCfg->spCellConfigDedicated) + for(freqBandIdx = 0; freqBandIdx < elementCnt; freqBandIdx++) { - DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg"); - return RFAILED; + DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t)); + if(!frequencyInfoDL->frequencyBandList.list.array[freqBandIdx]) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoDl()"); + return RFAILED; + } } - if(BuildSpCellCfgDed(ueCb, spCellCfg->spCellConfigDedicated) != ROK) + + freqBandIdx = 0; + *(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx]) = dlCfg.freqBandInd; + + /* TODO : Absolute Frequency to Point A */ + //frequencyInfoDL->absoluteFrequencyPointA + + /* Subcarrier Spacing specifc carrier List */ + if((BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList)) != ROK) { - DU_LOG("\nERROR --> F1AP : BuildSpCellCfgDed failed"); + DU_LOG("\nERROR --> DU APP : Failed to fill SCS specific carrier list DL in BuildFreqInfoDl()"); return RFAILED; } return ROK; + } /******************************************************************* * - * @brief Builds Phy cell group config + * @brief Fills DL config common in Serving cell config common * * @details * - * Function : BuildPhyCellGrpCfg + * Function : BuildDlConfigCommon * - * Functionality: Builds Phy cell group config in DuToCuRrcContainer + * Functionality: Fills DL config common in Serving cell config common * - * @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg + * @params[in] Pointer to DownlinkConfigCommon_t * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildPhyCellGrpCfg(DuUeCb *ueCb, PhysicalCellGroupConfig_t *phyCellGrpCfg) +uint8_t BuildDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon) { - phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP; - phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP; - - phyCellGrpCfg->p_NR_FR1 = NULLP; - DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long)); - if(!phyCellGrpCfg->p_NR_FR1) + /* DL Frequency Info */ + DU_ALLOC(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t)); + if(!dlCfgCommon->frequencyInfoDL) { - DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhyCellGrpCfg"); + DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL frequency info in BuildDlConfigCommon()"); + return RFAILED; + } + if((BuildFreqInfoDl(dlCfgCommon->frequencyInfoDL))!= ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to fill DL frequency info in BuildDlConfigCommon()"); return RFAILED; } - if(ueCb == NULLP) + /* DL BWP config common */ + DU_ALLOC(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t)); + if(!dlCfgCommon->initialDownlinkBWP) { - *(phyCellGrpCfg->p_NR_FR1) = P_NR_FR1; - phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK; + DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL BWP config common in BuildDlConfigCommon()"); + return RFAILED; } - else + if((BuildBwpDlCommon(dlCfgCommon->initialDownlinkBWP)) != ROK) { - *(phyCellGrpCfg->p_NR_FR1) = ueCb->macUeCfg.phyCellGrpCfg.pNrFr1; - phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = ueCb->macUeCfg.phyCellGrpCfg.pdschHarqAckCodebook; + DU_LOG("\nERROR --> DU APP : Failed to fill DL DWP config common in BuildDlConfigCommon()"); + return RFAILED; } - phyCellGrpCfg->tpc_SRS_RNTI = NULLP; - phyCellGrpCfg->tpc_PUCCH_RNTI = NULLP; - phyCellGrpCfg->tpc_PUSCH_RNTI = NULLP; - phyCellGrpCfg->sp_CSI_RNTI = NULLP; - phyCellGrpCfg->cs_RNTI = NULLP; - phyCellGrpCfg->ext1 = NULLP; - phyCellGrpCfg->ext2 = NULLP; + return ROK; +} + +/******************************************************************* + * + * @brief Fills SCS specific carrier list in UL frequency Info + * + * @details + * + * Function : BuildScsSpecificCarrierListUl + * + * Functionality: Fills SCS specific carrier list in UL frequency Info + * + * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList) +{ + uint8_t elementCnt = 0, listIdx = 0; + ScsSpecCarrier duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier; + + elementCnt = ODU_VALUE_ONE; + scsCarrierList->list.count = elementCnt; + scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *); + + DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size); + if(!scsCarrierList->list.array) + { + DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed"); + return RFAILED; + } + + for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++) + { + DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t)); + if(!scsCarrierList->list.array[listIdx]) + { + DU_LOG("\nERROR --> DU APP : SCS Specific Carrier list memory allocation failed"); + return RFAILED; + } + } + listIdx = 0; + scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset; + scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs; + scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw; return ROK; } /******************************************************************* * - * @brief Builds Mac cell group config + * @brief Fills frequency info in UL config common * * @details * - * Function : BuildMacCellGrpCfg + * Function : BuildFreqInfoUl * - * Functionality: Builds Mac cell group config in DuToCuRrcContainer + * Functionality: Fills frequency info in UL config common * - * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg + * @params[in] Pointer to FrequencyInfoUL_t * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildMacCellGrpCfg(DuUeCb *ueCb, MAC_CellGroupConfig_t *macCellGrpCfg) +uint8_t BuildFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL) { - macCellGrpCfg->drx_Config = NULLP; - macCellGrpCfg->schedulingRequestConfig = NULLP; - DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig)); - if(!macCellGrpCfg->schedulingRequestConfig) + uint8_t elementCnt = 0, listIdx= 0; + UlCfgCommon ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg; + + /* NR Multi Frequency Band List */ + DU_ALLOC(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t)); + if(!frequencyInfoUL->frequencyBandList) { - DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg"); + DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band list in BuildFreqInfoUl()"); return RFAILED; } - if(BuildSchedulingReqConfig(ueCb, macCellGrpCfg->schedulingRequestConfig) != ROK) + elementCnt = ODU_VALUE_ONE; + frequencyInfoUL->frequencyBandList->list.count = elementCnt; + frequencyInfoUL->frequencyBandList->list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *); + + DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size); + if(!frequencyInfoUL->frequencyBandList->list.array) { - DU_LOG("\nERROR --> F1AP : BuildSchedulingReqConfig failed"); + DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array in BuildFreqInfoUl()"); return RFAILED; } - macCellGrpCfg->bsr_Config = NULLP; - DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config)); - if(!macCellGrpCfg->bsr_Config) + for(listIdx = 0; listIdx < elementCnt; listIdx++) { - DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg"); + DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t)); + if(!frequencyInfoUL->frequencyBandList->list.array[listIdx]) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoUl()"); + return RFAILED; + } + } + + listIdx = 0; + *(frequencyInfoUL->frequencyBandList->list.array[listIdx]) = ulCfg.freqBandInd; + + /* TODO : Fill Absolute frequency point A */ + /* + DU_ALLOC(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t)); + if(!frequencyInfoUL->absoluteFrequencyPointA) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for absolute frequency point A in BuildFreqInfoUl()"); + return RFAILED; + } + *(frequencyInfoUL->absoluteFrequencyPointA) = ?; + */ + + /* Subcarrier Spacing specifc carrier */ + if((BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList)) != ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to fill SCS Specific Carrier list UL in BuildFreqInfoUl()"); return RFAILED; } - if(BuildBsrConfig(ueCb, macCellGrpCfg->bsr_Config) != ROK) + /* P-MAX */ + DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t)); + if(!frequencyInfoUL->p_Max) { - DU_LOG("\nERROR --> F1AP : BuildBsrConfig failed"); + DU_LOG("\nERROR --> DU APP : UL Frequency Infoo memory allocation failure"); return RFAILED; } + *frequencyInfoUL->p_Max = ulCfg.pMax; - macCellGrpCfg->tag_Config = NULLP; - DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config)); - if(!macCellGrpCfg->tag_Config) + return ROK; +} + +/******************************************************************* + * + * @brief Fills UL config common in Serving cell config common + * + * @details + * + * Function : BuildUlConfigCommon + * + * Functionality: Fills UL config common in Serving cell config common + * + * @params[in] Pointer to UplinkConfigCommon_t + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon) +{ + /* UL Frequency Info */ + DU_ALLOC(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t)); + if(!ulCfgCommon->frequencyInfoUL) { - DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg"); + DU_LOG("\nERROR --> DU APP : Memory allocation failed for UL frequency info in BuildUlConfigCommon()"); return RFAILED; } - if(BuildTagConfig(ueCb, macCellGrpCfg->tag_Config) != ROK) + if((BuildFreqInfoUl(ulCfgCommon->frequencyInfoUL)) != ROK) { - DU_LOG("\nERROR --> F1AP : BuildTagConfig failed"); + DU_LOG("\nERROR --> DU APP : Failed to fill frequency info UL in BuildUlConfigCommon()"); return RFAILED; } - macCellGrpCfg->phr_Config = NULLP; - DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config)); - if(!macCellGrpCfg->phr_Config) + /* UL BWP common */ + DU_ALLOC(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t)); + if(!ulCfgCommon->initialUplinkBWP) { - DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg"); + DU_LOG("\nERROR --> DU APP : Memory allocation failed for initial UL BWP in BuildUlConfigCommon()"); return RFAILED; } - if(BuildPhrConfig(ueCb, macCellGrpCfg->phr_Config) != ROK) + if((BuildBwpUlCommon(ulCfgCommon->initialUplinkBWP)) != ROK) { - DU_LOG("\nERROR --> F1AP : BuildPhrConfig failed"); + DU_LOG("\nERROR --> DU APP : Failed to fill BWP UL common in BuildUlConfigCommon()"); return RFAILED; } - macCellGrpCfg->skipUplinkTxDynamic = false; - macCellGrpCfg->ext1 = NULLP; + /* Time Alignment timer */ + ulCfgCommon->dummy = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm; return ROK; } + /******************************************************************* * - * @brief Frees memeory allocated for SearchSpcToAddModList + * @brief Fills SSB position in burst in SP cell config common * * @details * - * Function : FreeSearchSpcToAddModList + * Function : BuildSsbPosInBurst * - * Functionality: Deallocating memory of SearchSpcToAddModList + * Functionality: + * Fills SSB position in burst in SP cell config common * - * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList + * @params[in] Pointer to struct ServingCellConfigCommon__ssb_PositionsInBurst * - * @return void + * @return ROK - success + * RFAILED - failure * - 4221 * ****************************************************************/ -void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList) + * ****************************************************************/ +uint8_t BuildSsbPosInBurst(struct ServingCellConfigCommon__ssb_PositionsInBurst *ssbPosInBurst) { - uint8_t idx1=0; - uint8_t idx2=0; - struct SearchSpace *searchSpc=NULLP; + uint8_t bitStringSizeInBytes = 0; - if(searchSpcList->list.array) + ssbPosInBurst->present = ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap; + + /* As per spec 38.331,in the definition of ServingCellConfigCommon */ + bitStringSizeInBytes = 1; + ssbPosInBurst->choice.mediumBitmap.size = bitStringSizeInBytes * sizeof(uint8_t); + + DU_ALLOC(ssbPosInBurst->choice.mediumBitmap.buf, ssbPosInBurst->choice.mediumBitmap.size); + if(!ssbPosInBurst->choice.mediumBitmap.buf) { - if(searchSpcList->list.array[idx2]) - { - searchSpc = searchSpcList->list.array[idx2]; - if(searchSpc->controlResourceSetId) - { - if(searchSpc->monitoringSlotPeriodicityAndOffset) - { - if(searchSpc->monitoringSymbolsWithinSlot) - { - if(searchSpc->monitoringSymbolsWithinSlot->buf) - { - if(searchSpc->nrofCandidates) - { - if(searchSpc->searchSpaceType) - { - DU_FREE(searchSpc->searchSpaceType->choice.ue_Specific,\ - sizeof(struct SearchSpace__searchSpaceType__ue_Specific)); - DU_FREE(searchSpc->searchSpaceType, sizeof(struct - SearchSpace__searchSpaceType)); - } - DU_FREE(searchSpc->nrofCandidates, - sizeof(struct SearchSpace__nrofCandidates)); - } - DU_FREE(searchSpc->monitoringSymbolsWithinSlot->buf, \ - searchSpc->monitoringSymbolsWithinSlot->size); - } - DU_FREE(searchSpc->monitoringSymbolsWithinSlot, - sizeof(BIT_STRING_t)); - } - DU_FREE(searchSpc->monitoringSlotPeriodicityAndOffset, \ - sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset)); - } - DU_FREE(searchSpc->controlResourceSetId, - sizeof(ControlResourceSetId_t)); - } - } - for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++) - { - DU_FREE(searchSpcList->list.array[idx1], - sizeof(struct SearchSpace)); - } - DU_FREE(searchSpcList->list.array,searchSpcList->list.size); + DU_LOG("\nERROR --> DU APP : Memory Allocation failed for medium bit map buffer in BuildSsbPosInBurst()"); + return RFAILED; + } + + if((fillBitString(&ssbPosInBurst->choice.mediumBitmap, 0, bitStringSizeInBytes, \ + duCfgParam.sib1Params.srvCellCfgCommSib.ssbPosInBurst)) != ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to fill medium bit map in BuildSsbPosInBurst()"); + return RFAILED; } + + return ROK; } + /******************************************************************* * - * @brief Frees memory allocated for PdschTimeDomAllocList + * @brief Fills SP cell config common in Reconfig with Sync * * @details * - * Function : FreePdschTimeDomAllocList + * Function : BuildSpCellConfigCommon * - * Functionality: Deallocating memory of PdschTimeDomAllocList + * Functionality: Fills SP cell config common in Reconfig with Sync * - * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList + * @params[in] Pointer to ServingCellConfigCommon_t * - * @return void + * @return ROK - success + * RFAILED - failure * * ****************************************************************/ -void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList) +uint8_t BuildSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon) +{ + /* Physical Cell Identity */ + DU_ALLOC(spCellConfigCommon->physCellId, sizeof(PhysCellId_t)); + if(!spCellConfigCommon->physCellId) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for physical cell id in BuildSpCellConfigCommon()"); + return RFAILED; + } + *(spCellConfigCommon->physCellId) = NR_PCI; + + /* Downlink Config Common */ + DU_ALLOC(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t)); + if(!spCellConfigCommon->downlinkConfigCommon) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for DL Config Common in BuildSpCellConfigCommon()"); + return RFAILED; + } + if((BuildDlConfigCommon(spCellConfigCommon->downlinkConfigCommon)) != ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to fill DL config commin in BuildSpCellConfigCommon()"); + return RFAILED; + } + + /* Uplinlink Config Common */ + DU_ALLOC(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t)); + if(!spCellConfigCommon->uplinkConfigCommon) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for UL Config Common in BuildSpCellConfigCommon()"); + return RFAILED; + } + if((BuildUlConfigCommon(spCellConfigCommon->uplinkConfigCommon)) != ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to fill UL config commin in BuildSpCellConfigCommon()"); + return RFAILED; + } + + /* Timing Advance offset */ + DU_ALLOC(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long)); + if(!spCellConfigCommon->n_TimingAdvanceOffset) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for Timing Advance Offset in BuildSpCellConfigCommon()"); + return RFAILED; + } + *(spCellConfigCommon->n_TimingAdvanceOffset) = ServingCellConfigCommon__n_TimingAdvanceOffset_n0; + + /* SSB Position In Burst */ + DU_ALLOC(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst)); + if(!spCellConfigCommon->ssb_PositionsInBurst) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for SSB Position In Burst in BuildSpCellConfigCommon()"); + return RFAILED; + } + if((BuildSsbPosInBurst(spCellConfigCommon->ssb_PositionsInBurst)) != ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to fill SSB Position In Burst in BuildSpCellConfigCommon()"); + return RFAILED; + } + + /* SSB Periodicity in Serving cell */ + DU_ALLOC(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long)); + if(!spCellConfigCommon->ssb_periodicityServingCell) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for SSB Periodicity serving cell in \ + BuildSpCellConfigCommon()"); + return RFAILED; + } + *(spCellConfigCommon->ssb_periodicityServingCell) = \ + convertSsbPeriodicityValueToEnum(duCfgParam.sib1Params.srvCellCfgCommSib.ssbPrdServingCell); + + /* DMRS Type A position */ + spCellConfigCommon->dmrs_TypeA_Position = convertDmrsTypeAPosValueToEnum(duCfgParam.macCellCfg.dmrsTypeAPos); + + /* SSB subcarrier spacing */ + DU_ALLOC(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t)); + if(!spCellConfigCommon->ssbSubcarrierSpacing) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for sub-carrier spacing in BuildSpCellConfigCommon()"); + return RFAILED; + } + *(spCellConfigCommon->ssbSubcarrierSpacing) = duCfgParam.sib1Params.srvCellCfgCommSib.scs; + + /* TDD UL-DL configuration common */ + DU_ALLOC(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t)); + if(!spCellConfigCommon->tdd_UL_DL_ConfigurationCommon) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for TDD UL-DL config common in BuildSpCellConfigCommon()"); + return RFAILED; + } + if((BuildTddUlDlCfgComm(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon)) != ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to fill TDD UL-DL config common in BuildSpCellConfigCommon()"); + return RFAILED; + } + + /* SS PBCH Block Power */ + spCellConfigCommon->ss_PBCH_BlockPower = duCfgParam.sib1Params.srvCellCfgCommSib.ssPbchBlockPwr; + + return ROK; +} + +/******************************************************************* + * + * @brief Fills dedicated RACH configuration in Reconfiguration with sync + * + * @details + * + * Function : BuildRecfgWithSync + * + * Functionality: + * Fills dedicated RACH configuration in Reconfiguration with sync + * + * @params[in] DU UE CB + * Pointer to Rach config dedicated struct + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildRachConfigDedicated(DuUeCb *ueCb, struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed) +{ + uint8_t elementCnt = 0, listIdx = 0; + CFRA_t *cfra = NULLP; + struct CFRA__resources__ssb *ssbResource = NULLP; + RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg; + + rachCfgDed->present = ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink; + + /* Uplink */ + DU_ALLOC(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t)); + if(!rachCfgDed->choice.uplink) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for RACH uplink configuration in BuildRachConfigDedicated()"); + return RFAILED; + } + + /* CFRA : Contention free Random Access */ + DU_ALLOC(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t)); + if(!rachCfgDed->choice.uplink->cfra) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA in BuildRachConfigDedicated()"); + return RFAILED; + } + cfra = rachCfgDed->choice.uplink->cfra; + + /* CFRA occassions */ + DU_ALLOC(cfra->occasions, sizeof(struct CFRA__occasions)); + if(!cfra->occasions) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA occassion in BuildRachConfigDedicated()"); + return RFAILED; + } + + /* CFRA occassions : RACH generic configuration */ + cfra->occasions->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx; + cfra->occasions->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm; + cfra->occasions->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart; + cfra->occasions->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg; + cfra->occasions->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr; + cfra->occasions->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax; + cfra->occasions->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep; + cfra->occasions->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow; + + /* CFRA occassions : SSB per RACH occasion */ + DU_ALLOC(cfra->occasions->ssb_perRACH_Occasion, sizeof(long)); + if(!cfra->occasions->ssb_perRACH_Occasion) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB per RACH occassion in BuildRachConfigDedicated()"); + return RFAILED; + } + *(cfra->occasions->ssb_perRACH_Occasion) = convertCFRASsbPerRachOccasionValueToEnum(duCfgParam.macCellCfg.prachCfg.ssbPerRach); + + /* CFRA resource */ + cfra->resources.present = CFRA__resources_PR_ssb; + + /* CFRA resource : SSB */ + DU_ALLOC(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb)); + if(!cfra->resources.choice.ssb) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for CFRA resource - SSB in BuildRachConfigDedicated()"); + return RFAILED; + } + ssbResource = cfra->resources.choice.ssb; + + /* CFRA SSB resource list */ + elementCnt = ueCb->cfraResource.numSsb; + ssbResource->ssb_ResourceList.list.count = elementCnt; + ssbResource->ssb_ResourceList.list.size = elementCnt * sizeof(CFRA_SSB_Resource_t *); + + DU_ALLOC(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size); + if(!ssbResource->ssb_ResourceList.list.array) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB resource list in BuildRachConfigDedicated()"); + return RFAILED; + } + + for(listIdx = 0; listIdx < elementCnt; listIdx++) + { + DU_ALLOC(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t)); + if(!ssbResource->ssb_ResourceList.list.array[listIdx]) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for SSB resource list element in BuildRachConfigDedicated()"); + return RFAILED; + } + ssbResource->ssb_ResourceList.list.array[listIdx]->ssb = ueCb->cfraResource.ssbResource[listIdx].ssbIdx; + ssbResource->ssb_ResourceList.list.array[listIdx]->ra_PreambleIndex = ueCb->cfraResource.ssbResource[listIdx].raPreambleIdx; + } + + return ROK; +} + +/******************************************************************* + * + * @brief Fills reconfiguration with sync in SP cell config + * + * @details + * + * Function : BuildRecfgWithSync + * + * Functionality: Fills reconfiguration with sync in SP cell config + * + * @params[in] DU UE CB + * Pointer to ReconfigurationWithSync_t + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildRecfgWithSync(DuUeCb *ueCb, ReconfigurationWithSync_t *recfgWithSync) +{ + /* SP Cell Config Common */ + DU_ALLOC(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t)); + if(!recfgWithSync->spCellConfigCommon) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for spCellConfigCommon in BuildRecfgWithSync()"); + return RFAILED; + } + + if((BuildSpCellConfigCommon(recfgWithSync->spCellConfigCommon)) != ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to build SpCellConfigCommon in BuildRecfgWithSync()"); + return RFAILED; + } + + /* New UE Identity */ + recfgWithSync->newUE_Identity = ueCb->crnti; + + /* T304 timer */ + recfgWithSync->t304 = ReconfigurationWithSync__t304_ms1000; + + /* RACH configuration dedicated */ + DU_ALLOC(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated)); + if(!recfgWithSync->rach_ConfigDedicated) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for RACH config dedicated in BuildRecfgWithSync()"); + return RFAILED; + } + + if((BuildRachConfigDedicated(ueCb, recfgWithSync->rach_ConfigDedicated)) != ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to build RACH config dedicated in BuildRecfgWithSync()"); + return RFAILED; + } + + return ROK; +} + +/******************************************************************* + * + * @brief Builds Spcell config + * + * @details + * + * Function : BuildSpCellCfg + * + * Functionality: Builds sp cell config in DuToCuRrcContainer + * + * @params[in] SpCellConfig_t spCellCfg + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildSpCellCfg(DuUeCb *ueCb, SpCellConfig_t *spCellCfg) +{ + spCellCfg->servCellIndex = NULLP; + DU_ALLOC(spCellCfg->servCellIndex, sizeof(long)); + if(!spCellCfg->servCellIndex) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg"); + return RFAILED; + } + + if(ueCb == NULLP) + *(spCellCfg->servCellIndex) = SERV_CELL_IDX; + else + *(spCellCfg->servCellIndex) = ueCb->macUeCfg.spCellCfg.servCellIdx; + + spCellCfg->reconfigurationWithSync = NULLP; + if(ueCb && (ueCb->ueState == UE_HANDIN_IN_PROGRESS)) + { + DU_ALLOC(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t)); + if(!spCellCfg->reconfigurationWithSync) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg"); + return RFAILED; + } + + if((BuildRecfgWithSync(ueCb, spCellCfg->reconfigurationWithSync)) != ROK) + { + DU_LOG("\nERROR --> F1AP : Building of reconfiguration with sync failed at BuildSpCellCfg"); + return RFAILED; + } + } + + spCellCfg->rlf_TimersAndConstants = NULLP; + spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP; + + DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long)); + if(!spCellCfg->rlmInSyncOutOfSyncThreshold) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg"); + return RFAILED; + } + *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD; + + spCellCfg->spCellConfigDedicated = NULLP; + DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t)); + if(!spCellCfg->spCellConfigDedicated) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSpCellCfg"); + return RFAILED; + } + if(BuildSpCellCfgDed(ueCb, spCellCfg->spCellConfigDedicated) != ROK) + { + DU_LOG("\nERROR --> F1AP : BuildSpCellCfgDed failed"); + return RFAILED; + } + + return ROK; +} + +/******************************************************************* + * + * @brief Builds Phy cell group config + * + * @details + * + * Function : BuildPhyCellGrpCfg + * + * Functionality: Builds Phy cell group config in DuToCuRrcContainer + * + * @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildPhyCellGrpCfg(DuUeCb *ueCb, PhysicalCellGroupConfig_t *phyCellGrpCfg) +{ + phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP; + phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP; + + phyCellGrpCfg->p_NR_FR1 = NULLP; + DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long)); + if(!phyCellGrpCfg->p_NR_FR1) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildPhyCellGrpCfg"); + return RFAILED; + } + + if(ueCb == NULLP) + { + *(phyCellGrpCfg->p_NR_FR1) = P_NR_FR1; + phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK; + } + else + { + *(phyCellGrpCfg->p_NR_FR1) = ueCb->macUeCfg.phyCellGrpCfg.pNrFr1; + phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = ueCb->macUeCfg.phyCellGrpCfg.pdschHarqAckCodebook; + } + + phyCellGrpCfg->tpc_SRS_RNTI = NULLP; + phyCellGrpCfg->tpc_PUCCH_RNTI = NULLP; + phyCellGrpCfg->tpc_PUSCH_RNTI = NULLP; + phyCellGrpCfg->sp_CSI_RNTI = NULLP; + phyCellGrpCfg->cs_RNTI = NULLP; + phyCellGrpCfg->ext1 = NULLP; + phyCellGrpCfg->ext2 = NULLP; + + return ROK; +} + +/******************************************************************* + * + * @brief Builds Mac cell group config + * + * @details + * + * Function : BuildMacCellGrpCfg + * + * Functionality: Builds Mac cell group config in DuToCuRrcContainer + * + * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildMacCellGrpCfg(DuUeCb *ueCb, MAC_CellGroupConfig_t *macCellGrpCfg) +{ + macCellGrpCfg->drx_Config = NULLP; + macCellGrpCfg->schedulingRequestConfig = NULLP; + DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig)); + if(!macCellGrpCfg->schedulingRequestConfig) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg"); + return RFAILED; + } + + if(BuildSchedulingReqConfig(ueCb, macCellGrpCfg->schedulingRequestConfig) != ROK) + { + DU_LOG("\nERROR --> F1AP : BuildSchedulingReqConfig failed"); + return RFAILED; + } + + macCellGrpCfg->bsr_Config = NULLP; + DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config)); + if(!macCellGrpCfg->bsr_Config) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg"); + return RFAILED; + } + + if(BuildBsrConfig(ueCb, macCellGrpCfg->bsr_Config) != ROK) + { + DU_LOG("\nERROR --> F1AP : BuildBsrConfig failed"); + return RFAILED; + } + + macCellGrpCfg->tag_Config = NULLP; + DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config)); + if(!macCellGrpCfg->tag_Config) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg"); + return RFAILED; + } + + if(BuildTagConfig(ueCb, macCellGrpCfg->tag_Config) != ROK) + { + DU_LOG("\nERROR --> F1AP : BuildTagConfig failed"); + return RFAILED; + } + + macCellGrpCfg->phr_Config = NULLP; + DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config)); + if(!macCellGrpCfg->phr_Config) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildMacCellGrpCfg"); + return RFAILED; + } + + if(BuildPhrConfig(ueCb, macCellGrpCfg->phr_Config) != ROK) + { + DU_LOG("\nERROR --> F1AP : BuildPhrConfig failed"); + return RFAILED; + } + + macCellGrpCfg->skipUplinkTxDynamic = false; + macCellGrpCfg->ext1 = NULLP; + + return ROK; +} +/******************************************************************* + * + * @brief Frees memeory allocated for SearchSpcToAddModList + * + * @details + * + * Function : FreeSearchSpcToAddModList + * + * Functionality: Deallocating memory of SearchSpcToAddModList + * + * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList + * + * @return void + * + 4221 * ****************************************************************/ +void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList) +{ + uint8_t idx1=0; + uint8_t idx2=0; + struct SearchSpace *searchSpc=NULLP; + + if(searchSpcList->list.array) + { + if(searchSpcList->list.array[idx2]) + { + searchSpc = searchSpcList->list.array[idx2]; + if(searchSpc->controlResourceSetId) + { + if(searchSpc->monitoringSlotPeriodicityAndOffset) + { + if(searchSpc->monitoringSymbolsWithinSlot) + { + if(searchSpc->monitoringSymbolsWithinSlot->buf) + { + if(searchSpc->nrofCandidates) + { + if(searchSpc->searchSpaceType) + { + DU_FREE(searchSpc->searchSpaceType->choice.ue_Specific,\ + sizeof(struct SearchSpace__searchSpaceType__ue_Specific)); + DU_FREE(searchSpc->searchSpaceType, sizeof(struct + SearchSpace__searchSpaceType)); + } + DU_FREE(searchSpc->nrofCandidates, + sizeof(struct SearchSpace__nrofCandidates)); + } + DU_FREE(searchSpc->monitoringSymbolsWithinSlot->buf, \ + searchSpc->monitoringSymbolsWithinSlot->size); + } + DU_FREE(searchSpc->monitoringSymbolsWithinSlot, + sizeof(BIT_STRING_t)); + } + DU_FREE(searchSpc->monitoringSlotPeriodicityAndOffset, \ + sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset)); + } + DU_FREE(searchSpc->controlResourceSetId, + sizeof(ControlResourceSetId_t)); + } + } + for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++) + { + DU_FREE(searchSpcList->list.array[idx1], + sizeof(struct SearchSpace)); + } + DU_FREE(searchSpcList->list.array,searchSpcList->list.size); + } +} +/******************************************************************* + * + * @brief Frees memory allocated for PdschTimeDomAllocList + * + * @details + * + * Function : FreePdschTimeDomAllocList + * + * Functionality: Deallocating memory of PdschTimeDomAllocList + * + * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList + * + * @return void + * + * ****************************************************************/ +void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList) { uint8_t idx1=0; @@ -6931,6 +7639,357 @@ void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp) } } +/******************************************************************* + * + * @brief Free SCS specific carrier list in DL frequency info + * + * @details + * + * Function : FreeScsSpecificCarrierListDl + * + * Functionality: Free SCS specific carrier list in DL frequency info + * + * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList + * + * @return void + * + * ****************************************************************/ +void FreeScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList) +{ + uint8_t listIdx = 0; + + if(!scsCarrierList->list.array) + { + for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++) + { + DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t)); + } + DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size); + } +} + +/******************************************************************* + * + * @brief Free DL frequency info in DL config common + * + * @details + * + * Function : FreeFreqInfoDl + * + * Functionality: Free DL frequency info in DL config common + * + * @params[in] Pointer to DownlinkConfigCommon_t + * + * @return void + * + * ****************************************************************/ +void FreeFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL) +{ + uint8_t freqBandIdx = 0; + + /* SSB Absolute Frequency */ + DU_FREE(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t)); + + /* NR Multi Frequency Band List */ + if(frequencyInfoDL->frequencyBandList.list.array) + { + for(freqBandIdx = 0; freqBandIdx < frequencyInfoDL->frequencyBandList.list.count; freqBandIdx++) + { + DU_FREE(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t)); + } + DU_FREE(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size); + } + + /* Subcarrier Spacing specifc carrier List */ + FreeScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList); +} + +/******************************************************************* + * + * @brief Free DL config common in Serving cell config common + * + * @details + * + * Function : FreeDlConfigCommon + * + * Functionality: Free DL config common in Serving cell config common + * + * @params[in] Pointer to DownlinkConfigCommon_t + * + * @return void + * + * ****************************************************************/ +void FreeDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon) +{ + /* DL Frequency Info */ + if(dlCfgCommon->frequencyInfoDL) + { + FreeFreqInfoDl(dlCfgCommon->frequencyInfoDL); + DU_FREE(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t)); + } + + /* DL BWP config common */ + if(dlCfgCommon->initialDownlinkBWP) + { + FreeBwpDlCommon(dlCfgCommon->initialDownlinkBWP); + DU_FREE(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t)); + } +} + +/******************************************************************* + * + * @brief Free SCS specific carrier list in UL frequency Info + * + * @details + * + * Function : FreeScsSpecificCarrierListUl + * + * Functionality: Free SCS specific carrier list in UL frequency Info + * + * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList + * + * @return void + * + * ****************************************************************/ +void FreeScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList) +{ + uint8_t listIdx = 0; + + if(scsCarrierList->list.array) + { + for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++) + { + DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t)); + } + DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size); + } +} + +/******************************************************************* + * + * @brief Free frequency info in UL config common + * + * @details + * + * Function : FreeFreqInfoUl + * + * Functionality: Free frequency info in UL config common + * + * @params[in] Pointer to FrequencyInfoUL_t + * + * @return void + * + * ****************************************************************/ +void FreeFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL) +{ + uint8_t listIdx= 0; + + /* NR Multi Frequency Band List */ + if(!frequencyInfoUL->frequencyBandList) + { + if(frequencyInfoUL->frequencyBandList->list.array) + { + for(listIdx = 0; listIdx < frequencyInfoUL->frequencyBandList->list.count; listIdx++) + { + DU_FREE(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t)); + } + DU_FREE(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size); + } + DU_FREE(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t)); + } + + /* Absolute frequency point A */ + DU_FREE(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t)); + + /* Subcarrier Spacing specifc carrier */ + FreeScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList); + + /* P-MAX */ + DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t)); +} + +/******************************************************************* + * + * @brief Free UL config common in Serving cell config common + * + * @details + * + * Function : FreeUlConfigCommon + * + * Functionality: Free UL config common in Serving cell config common + * + * @params[in] Pointer to UplinkConfigCommon_t + * + * @return void + * + * ****************************************************************/ +void FreeUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon) +{ + /* UL Frequency Info */ + if(ulCfgCommon->frequencyInfoUL) + { + FreeFreqInfoUl(ulCfgCommon->frequencyInfoUL); + DU_FREE(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t)); + } + + /* UL BWP common */ + if(ulCfgCommon->initialUplinkBWP) + { + FreeBwpUlCommon(ulCfgCommon->initialUplinkBWP); + DU_FREE(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t)); + } +} + +/******************************************************************* + * + * @brief Free SP cell config common in Reconfig with Sync + * + * @details + * + * Function : FreeSpCellConfigCommon + * + * Functionality: Free SP cell config common in Reconfig with Sync + * + * @params[in] Pointer to ServingCellConfigCommon_t + * + * @return void + * + * ****************************************************************/ +void FreeSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon) +{ + /* Free Physical cell identity */ + DU_FREE(spCellConfigCommon->physCellId, sizeof(PhysCellId_t)); + + /* Free Downlink Config common */ + if(spCellConfigCommon->downlinkConfigCommon) + { + FreeDlConfigCommon(spCellConfigCommon->downlinkConfigCommon); + DU_FREE(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t)); + } + + /* Free Uplink Config common */ + if(spCellConfigCommon->uplinkConfigCommon) + { + FreeUlConfigCommon(spCellConfigCommon->uplinkConfigCommon); + DU_FREE(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t)); + } + + /* Free Timing Advance offset */ + DU_FREE(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long)); + + /* Free SSB Position in Burst */ + if(spCellConfigCommon->ssb_PositionsInBurst) + { + DU_FREE(spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.buf, \ + spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.size); + DU_FREE(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst)); + } + + /* Free SSB Periodicity in Serving cell */ + DU_FREE(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long)); + + /* Free SSB subcarrier spacing */ + DU_FREE(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t)); + + /* TDD UL-DL configuration common */ + DU_FREE(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t)); +} + +/******************************************************************* + * + * @brief Free dedicated RACH configuration in Reconfiguration with sync + * + * @details + * + * Function : FreeRecfgWithSync + * + * Functionality: + * Free dedicated RACH configuration in Reconfiguration with sync + * + * @params[in] Pinter to Rach config dedicated struct + * + * @return void + * + * ****************************************************************/ +void FreeRachConfigDedicated(struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed) +{ + uint8_t listIdx = 0; + CFRA_t *cfra = NULLP; + struct CFRA__resources__ssb *ssbResource = NULLP; + + /* Uplink */ + if(rachCfgDed->choice.uplink) + { + /* CFRA : Contention free Random Access */ + if(rachCfgDed->choice.uplink->cfra) + { + cfra = rachCfgDed->choice.uplink->cfra; + + /* CFRA occassions */ + if(cfra->occasions) + { + /* CFRA occassions : SSB per RACH occasion */ + DU_FREE(cfra->occasions->ssb_perRACH_Occasion, sizeof(long)); + DU_FREE(cfra->occasions, sizeof(struct CFRA__occasions)); + } + + /* CFRA resource */ + cfra->resources.present = CFRA__resources_PR_ssb; + + /* CFRA resource : SSB */ + if(cfra->resources.choice.ssb) + { + ssbResource = cfra->resources.choice.ssb; + + /* CFRA SSB resource list */ + if(ssbResource->ssb_ResourceList.list.array) + { + for(listIdx = 0; listIdx < ssbResource->ssb_ResourceList.list.count; listIdx++) + { + DU_FREE(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t)); + } + DU_FREE(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size); + } + DU_FREE(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb)); + } + DU_FREE(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t)); + } + DU_FREE(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t)); + } +} + +/******************************************************************* + * + * @brief Frees reconfiguration with sync in SP cell config + * + * @details + * + * Function : FreeRecfgWithSync + * + * Functionality: Fress reconfiguration with sync in SP cell config + * + * @params[in] Pointer to ReconfigurationWithSync_t + * + * @return void + * + * ****************************************************************/ +void FreeRecfgWithSync(ReconfigurationWithSync_t *recfgWithSync) +{ + /* Free SP Cell config common */ + if(recfgWithSync->spCellConfigCommon) + { + FreeSpCellConfigCommon(recfgWithSync->spCellConfigCommon); + DU_FREE(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t)); + } + + /* Free Dedicated RACH configuration */ + if(recfgWithSync->rach_ConfigDedicated) + { + FreeRachConfigDedicated(recfgWithSync->rach_ConfigDedicated); + DU_FREE(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated)); + } +} + /******************************************************************* * * @brief Frees emmory allocated for DUToCURRCContainer @@ -7073,61 +8132,74 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg) spCellCfg = cellGrpCfg->spCellConfig; if(spCellCfg) { - if(spCellCfg->servCellIndex) + /* Free serving cell index */ + DU_FREE(spCellCfg->servCellIndex, sizeof(long)); + + /* Free Reconfiguration with sync */ + if(spCellCfg->reconfigurationWithSync) + { + FreeRecfgWithSync(spCellCfg->reconfigurationWithSync); + DU_FREE(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t)); + } + + /* Free rlmInSyncOutOfSyncThreshold */ + DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long)); + + /* Free SP Cell config dedicated */ + if(spCellCfg->spCellConfigDedicated) { - if(spCellCfg->rlmInSyncOutOfSyncThreshold) + srvCellCfg = spCellCfg->spCellConfigDedicated; + + /* Free TDD UL-DL config dedicated */ + DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t)); + + /* Free Initial Downlink BWP */ + if(srvCellCfg->initialDownlinkBWP) { - if(spCellCfg->spCellConfigDedicated) + dlBwp = srvCellCfg->initialDownlinkBWP; + + /* Free DL BWP PDCCH Config */ + if(dlBwp->pdcch_Config) { - srvCellCfg = spCellCfg->spCellConfigDedicated; - if(srvCellCfg->tdd_UL_DL_ConfigurationDedicated) - { - if(srvCellCfg->initialDownlinkBWP) - { - dlBwp = srvCellCfg->initialDownlinkBWP; - if(srvCellCfg->firstActiveDownlinkBWP_Id) - { - if(srvCellCfg->defaultDownlinkBWP_Id) - { - if(srvCellCfg->uplinkConfig) - { - if(srvCellCfg->pdsch_ServingCellConfig) - { - pdschCfg= srvCellCfg->pdsch_ServingCellConfig; - if(pdschCfg->choice.setup) - { - DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long)); - DU_FREE(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig)); - } - DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct - ServingCellConfig__pdsch_ServingCellConfig)); - } - FreeinitialUplinkBWP(srvCellCfg->uplinkConfig); - DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t)); - } - DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long)); - } - DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long)); - } - if(dlBwp->pdcch_Config) - { - if(dlBwp->pdsch_Config) - { - FreeBWPDlDedPdschCfg(dlBwp); - DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config)); - } - FreeBWPDlDedPdcchCfg(dlBwp); - DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config)); - } - DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t)); - } - DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t)); - } - DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t)); + FreeBWPDlDedPdcchCfg(dlBwp); + DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config)); + } + + /* Free DL BWP PDSCH config */ + if(dlBwp->pdsch_Config) + { + FreeBWPDlDedPdschCfg(dlBwp); + DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config)); + } + DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t)); + } + + /* Free First Active Downlink BWP */ + DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long)); + + /* Free Default downlink BWP */ + DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long)); + + /* Free Uplink config */ + if(srvCellCfg->uplinkConfig) + { + FreeinitialUplinkBWP(srvCellCfg->uplinkConfig); + DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t)); + } + + /* Free PDSCH serving cell config */ + if(srvCellCfg->pdsch_ServingCellConfig) + { + pdschCfg= srvCellCfg->pdsch_ServingCellConfig; + if(pdschCfg->choice.setup) + { + DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long)); + DU_FREE(pdschCfg->choice.setup, sizeof(struct PDSCH_ServingCellConfig)); } - DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long)); + DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig)); } - DU_FREE(spCellCfg->servCellIndex, sizeof(long)); + + DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t)); } DU_FREE(spCellCfg,sizeof(SpCellConfig_t)); } diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index d5a2dda42..7617f8a97 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -171,6 +171,7 @@ typedef struct duUeCb uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */ uint32_t drbBitMap; /* Drb Bit Map */ UeState ueState; /* UE Active/ Ue Inactive state */ + MacCfraResource cfraResource; /* CF-RA resource assigned by MAC/SCH */ MacUeCfg macUeCfg; /* Mac Ue Cfg */ RlcUeCfg rlcUeCfg; /* Rlc Ue Cfg */ }DuUeCb; diff --git a/src/du_app/du_mgr_msg_router.c b/src/du_app/du_mgr_msg_router.c index 95aff3e06..133ef0a59 100644 --- a/src/du_app/du_mgr_msg_router.c +++ b/src/du_app/du_mgr_msg_router.c @@ -561,6 +561,11 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) ret = unpackDuMacSliceReCfgRsp(DuProcMacSliceReCfgRsp, pst, mBuf); break; } + case EVENT_MAC_RACH_RESOURCE_RSP: + { + ret = unpackDuMacRachRsrcRsp(DuProcMacRachRsrcRsp, pst, mBuf); + break; + } default: { DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC"); diff --git a/src/du_app/du_sys_info_hdl.c b/src/du_app/du_sys_info_hdl.c index a4c883e66..6644079e1 100644 --- a/src/du_app/du_sys_info_hdl.c +++ b/src/du_app/du_sys_info_hdl.c @@ -697,7 +697,7 @@ uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_Sc * * @details * - * Function : BuildScsSpecificCarrierListDl + * Function : BuildScsSpecificCarrierListDlSib * * Functionality: * Builds Subcarrier specific carrier list for downlink @@ -707,7 +707,7 @@ uint8_t BuildSiSchedInfoList(struct SI_SchedulingInfo__schedulingInfoList *si_Sc * RFAILED - failure * * ****************************************************************/ -uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList) +uint8_t BuildScsSpecificCarrierListDlSib( struct FrequencyInfoDL_SIB__scs_SpecificCarrierList *scsCarrierList) { uint8_t idx; ScsSpecCarrier duScsSpecCarrier; @@ -737,7 +737,7 @@ uint8_t BuildScsSpecificCarrierListDl( struct FrequencyInfoDL_SIB__scs_SpecificC scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw; return ROK; -} /* End of BuildScsSpecificCarrierListDl */ +} /* End of BuildScsSpecificCarrierListDlSib */ /******************************************************************* * @@ -763,12 +763,12 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace duPdcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pdcchCfg; - DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size) - if(!searchSpclist->list.array) - { - DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); - return RFAILED; - } + DU_ALLOC(searchSpclist->list.array, searchSpclist->list.size); + if(!searchSpclist->list.array) + { + DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); + return RFAILED; + } for(idx = 0; idx < searchSpclist->list.count; idx++) { @@ -803,8 +803,8 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); return RFAILED; } - searchSpace->monitoringSlotPeriodicityAndOffset->present = \ - duPdcchCfg.monitorSlotPrdAndOffPresent; + searchSpace->monitoringSlotPeriodicityAndOffset->present = duPdcchCfg.monitorSlotPrdAndOffPresent; + switch(searchSpace->monitoringSlotPeriodicityAndOffset->present) { case SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1: @@ -890,16 +890,15 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace } /* Monitoring Symbols Within Slot */ - DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot,\ - sizeof(BIT_STRING_t)); + DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t)); if(!searchSpace->monitoringSymbolsWithinSlot) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); return RFAILED; } - searchSpace->monitoringSymbolsWithinSlot->size = 2*sizeof(uint8_t); - DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, \ - searchSpace->monitoringSymbolsWithinSlot->size ); + searchSpace->monitoringSymbolsWithinSlot->size = 2 * sizeof(uint8_t); + + DU_ALLOC(searchSpace->monitoringSymbolsWithinSlot->buf, searchSpace->monitoringSymbolsWithinSlot->size); if(!searchSpace->monitoringSymbolsWithinSlot->buf) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); @@ -910,8 +909,7 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace searchSpace->monitoringSymbolsWithinSlot->bits_unused = 2; /* Number of candidates per aggregation level */ - DU_ALLOC(searchSpace->nrofCandidates,\ - sizeof(struct SearchSpace__nrofCandidates)); + DU_ALLOC(searchSpace->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates)); if(!searchSpace->nrofCandidates) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); @@ -924,8 +922,7 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace searchSpace->nrofCandidates->aggregationLevel16 = duPdcchCfg.numCandAggLvl16; /* Search Space type and DCI Format */ - DU_ALLOC(searchSpace->searchSpaceType,\ - sizeof( struct SearchSpace__searchSpaceType)); + DU_ALLOC(searchSpace->searchSpaceType, sizeof( struct SearchSpace__searchSpaceType)); if(!searchSpace->searchSpaceType) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); @@ -949,9 +946,8 @@ uint8_t BuildCommonSerachSpaceList( struct PDCCH_ConfigCommon__commonSearchSpace return RFAILED; } - DU_ALLOC(searchSpace->searchSpaceType->choice.common->\ - dci_Format0_0_AndFormat1_0, sizeof(struct \ - SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0)); + DU_ALLOC(searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0, \ + sizeof(struct SearchSpace__searchSpaceType__common__dci_Format0_0_AndFormat1_0)); if(!searchSpace->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0) { DU_LOG("\nERROR --> DU APP : Common search space list memory alloc failed"); @@ -1041,8 +1037,7 @@ uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcch *pdcchSetup->searchSpaceZero = duPdcchCfg.searchSpcZero; /* Common Search Space List */ - DU_ALLOC(pdcchSetup->commonSearchSpaceList,\ - sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList)); + DU_ALLOC(pdcchSetup->commonSearchSpaceList, sizeof(struct PDCCH_ConfigCommon__commonSearchSpaceList)); if(!pdcchSetup->commonSearchSpaceList) { DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed"); @@ -1054,6 +1049,7 @@ uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcch ret = BuildCommonSerachSpaceList(pdcchSetup->commonSearchSpaceList); if(ret != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill common search space list"); return RFAILED; } CommonSerachSpaceListret=ROK; @@ -1067,7 +1063,7 @@ uint8_t BuildPdcchCfgCommon(struct BWP_DownlinkCommon__pdcch_ConfigCommon *pdcch } *pdcchSetup->searchSpaceSIB1 = duPdcchCfg.searchSpcSib1; - /* Serach Space for Paging */ + /* Search Space for Paging */ DU_ALLOC(pdcchSetup->pagingSearchSpace, sizeof(SearchSpaceId_t)); if(!pdcchSetup->pagingSearchSpace) { @@ -1148,16 +1144,17 @@ uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdsch pdschSetup = pdschCfg->choice.setup; /* Time Domain Allocation List */ - DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, \ - sizeof(PDSCH_TimeDomainResourceAllocationList_t)); + DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList, sizeof(PDSCH_TimeDomainResourceAllocationList_t)); if(!pdschSetup->pdsch_TimeDomainAllocationList) { DU_LOG("\nERROR --> DU APP : PDCCH Config memory alloc failed"); return RFAILED; } + elementCnt = duPdschCfg.numTimeDomRsrcAlloc; pdschSetup->pdsch_TimeDomainAllocationList->list.count = elementCnt; - pdschSetup->pdsch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *); + pdschSetup->pdsch_TimeDomainAllocationList->list.size = \ + elementCnt * sizeof(PDSCH_TimeDomainResourceAllocation_t *); DU_ALLOC(pdschSetup->pdsch_TimeDomainAllocationList->list.array,\ pdschSetup->pdsch_TimeDomainAllocationList->list.size); @@ -1224,40 +1221,39 @@ uint8_t BuildPdschCfgCommon(struct BWP_DownlinkCommon__pdsch_ConfigCommon *pdsch * ****************************************************************/ uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp) { - uint8_t ret; - DlCfgCommon duDlCfg; - - duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg; + DlCfgCommon duDlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg; + /* Generic Parameters */ bwp->genericParameters.locationAndBandwidth = duDlCfg.locAndBw; bwp->genericParameters.subcarrierSpacing = duDlCfg.dlScsCarrier.scs; /* PDCCH Config Common */ - DU_ALLOC(bwp->pdcch_ConfigCommon, \ - sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon)); + DU_ALLOC(bwp->pdcch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon)); if(!bwp->pdcch_ConfigCommon) { DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed"); return RFAILED; } - ret=BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon); - if(ret != ROK) + if((BuildPdcchCfgCommon(bwp->pdcch_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill PDCCH config common in BuildBwpDlCommon()"); return RFAILED; } + /* PDSCH Config Common */ - DU_ALLOC(bwp->pdsch_ConfigCommon, \ - sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon)); + DU_ALLOC(bwp->pdsch_ConfigCommon, sizeof(struct BWP_DownlinkCommon__pdsch_ConfigCommon)); if(!bwp->pdsch_ConfigCommon) { DU_LOG("\nERROR --> DU APP : DL BWP memory allocation failed"); return RFAILED; } - ret=BuildPdschCfgCommon(bwp->pdsch_ConfigCommon); - if(ret != ROK) + + if((BuildPdschCfgCommon(bwp->pdsch_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill PDSCH config common in BuildBwpDlCommon()"); return RFAILED; } + return ROK; } /* BuildBwpDlCommon */ @@ -1534,7 +1530,7 @@ uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg) * * @details * - * Function : BuildFreqInfoDl + * Function : BuildFreqInfoDlSib * * Functionality: * Builds Frequency Info for Downlink @@ -1545,7 +1541,7 @@ uint8_t BuildPcchConfig(PCCH_Config_t *pcchCfg) * * ****************************************************************/ -uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL) +uint8_t BuildFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL) { uint8_t ret; uint8_t idx; @@ -1600,7 +1596,7 @@ uint8_t BuildFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL) frequencyInfoDL->scs_SpecificCarrierList.list.count = elementCnt; frequencyInfoDL->scs_SpecificCarrierList.list.size = \ elementCnt * sizeof(SCS_SpecificCarrier_t *); - ret= BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList); + ret= BuildScsSpecificCarrierListDlSib(&frequencyInfoDL->scs_SpecificCarrierList); if(ret != ROK) { @@ -1630,7 +1626,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) { /* DL frequency info */ uint8_t ret; - ret = BuildFreqInfoDl(&dlCfg->frequencyInfoDL); + ret = BuildFreqInfoDlSib(&dlCfg->frequencyInfoDL); if(ret != ROK) { return RFAILED; @@ -1663,7 +1659,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) * * @details * - * Function : BuildScsSpecificCarrierListUl + * Function : BuildScsSpecificCarrierListUlSib * * Functionality: * Builds SCS specific carrier list for UL @@ -1674,10 +1670,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) * * ****************************************************************/ - uint8_t BuildScsSpecificCarrierListUl -( - struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList - ) +uint8_t BuildScsSpecificCarrierListUlSib(struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList) { uint8_t idx; ScsSpecCarrier duScsSpecCarrier; @@ -1706,7 +1699,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) scsCarrierList->list.array[idx]->carrierBandwidth = duScsSpecCarrier.scsBw; return ROK; -} /* End of BuildScsSpecificCarrierListUl */ +} /* End of BuildScsSpecificCarrierListUlSib */ /******************************************************************* * @@ -1714,7 +1707,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) * * @details * - * Function : BuildFreqInfoUl + * Function : BuildFreqInfoUlSib * * Functionality: * Builds frequency infor for UL @@ -1725,7 +1718,7 @@ uint8_t BuildDlCfgCommSib(DownlinkConfigCommonSIB_t *dlCfg) * * ****************************************************************/ -uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL) +uint8_t BuildFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL) { uint8_t elementCnt; UlCfgCommon ulCfg; @@ -1737,7 +1730,7 @@ uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL) frequencyInfoUL->scs_SpecificCarrierList.list.count = elementCnt; frequencyInfoUL->scs_SpecificCarrierList.list.size = \ elementCnt * sizeof(SCS_SpecificCarrier_t *); - ret=BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList); + ret=BuildScsSpecificCarrierListUlSib(&frequencyInfoUL->scs_SpecificCarrierList); if(ret != ROK) { return RFAILED; @@ -1752,7 +1745,7 @@ uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL) *frequencyInfoUL->p_Max = ulCfg.pMax; FreqInfoUlret=ROK; return ROK; -}/* BuildFreqInfoUl */ +}/* BuildFreqInfoUlSib */ /******************************************************************* * @@ -1773,10 +1766,8 @@ uint8_t BuildFreqInfoUl(FrequencyInfoUL_SIB_t *frequencyInfoUL) uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) { - RachCfgCommon duRachCfg; - RACH_ConfigCommon_t *setup; - - duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg; + RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg; + RACH_ConfigCommon_t *setup = NULLP; rachCfg->present = duRachCfg.present; switch(rachCfg->present) @@ -1828,8 +1819,8 @@ uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) DU_LOG("\nERROR --> DU APP : Rach Config memory alloc failed"); return RFAILED; } - setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = \ - duRachCfg.ssbPerRachOccPresent; + setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = duRachCfg.numSsbPerRachOcc; + switch(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present) { case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING: @@ -1854,8 +1845,8 @@ uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) } case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one: { - setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one =\ - duRachCfg.numSsbPerRachOcc; + setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = \ + convertCbPreamblePerSsbValueToEnum(duRachCfg.numCbPreamblePerSsb); } case RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two: { @@ -1879,8 +1870,7 @@ uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) } default: { - DU_LOG("\nERROR --> DU APP: Invalid value for \ - ssb_PerRach_OccassionAndCB_PreamblesPerSSB"); + DU_LOG("\nERROR --> DU APP: Invalid value for ssb_PerRach_OccassionAndCB_PreamblesPerSSB"); return RFAILED; } } @@ -1965,13 +1955,12 @@ uint8_t BuildRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg) { - uint8_t idx; - uint8_t elementCnt; - PuschCfgCommon duPuschCfg; - PUSCH_ConfigCommon_t *setup; - PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo; + uint8_t idx = 0; + uint8_t elementCnt = 0; + PuschCfgCommon duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg; + PUSCH_ConfigCommon_t *setup = NULLP; + PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP; - duPuschCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.puschCfg; puschCfg->present = duPuschCfg.puschCfgPresent; switch(puschCfg->present) @@ -1997,8 +1986,7 @@ uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCf setup = puschCfg->choice.setup; /* Time Domain Resource Allocation List */ - DU_ALLOC(setup->pusch_TimeDomainAllocationList,\ - sizeof(PUSCH_TimeDomainResourceAllocationList_t)); + DU_ALLOC(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t)); if(!setup->pusch_TimeDomainAllocationList) { DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed"); @@ -2006,11 +1994,9 @@ uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCf } elementCnt = duPuschCfg.numTimeDomRsrcAlloc; setup->pusch_TimeDomainAllocationList->list.count = elementCnt; - setup->pusch_TimeDomainAllocationList->list.size = \ - elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *); + setup->pusch_TimeDomainAllocationList->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *); - DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, \ - setup->pusch_TimeDomainAllocationList->list.size); + DU_ALLOC(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size); if(!setup->pusch_TimeDomainAllocationList->list.array) { DU_LOG("\nERROR --> DU APP : PUSCH Config memory alloc failed"); @@ -2043,6 +2029,7 @@ uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCf timeDomRsrcAllocInfo->mappingType = duPuschCfg.timeDomAllocList[idx].mapType; timeDomRsrcAllocInfo->startSymbolAndLength = duPuschCfg.timeDomAllocList[idx].sliv; } + /* Msg3 Delta Preamble */ DU_ALLOC(setup->msg3_DeltaPreamble, sizeof(long)); if(!setup->msg3_DeltaPreamble) @@ -2052,7 +2039,7 @@ uint8_t BuildPuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCf } *setup->msg3_DeltaPreamble = duPuschCfg.msg3DeltaPreamble; - /* P0 Nominal with grnat */ + /* P0 Nominal with grant */ DU_ALLOC(setup->p0_NominalWithGrant, sizeof(long)); if(!setup->p0_NominalWithGrant) { @@ -2171,57 +2158,56 @@ uint8_t BuildPucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchC uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp) { - uint8_t ret; - UlCfgCommon duUlCfg; - - duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg; + UlCfgCommon duUlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg; + /* Generic Parameters */ bwp->genericParameters.locationAndBandwidth = duUlCfg.locAndBw; bwp->genericParameters.subcarrierSpacing = duUlCfg.ulScsCarrier.scs; /* RACH Config Common */ - DU_ALLOC(bwp->rach_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); + DU_ALLOC(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); if(!bwp->rach_ConfigCommon) { DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed"); return RFAILED; } - ret = BuildRachCfgCommon(bwp->rach_ConfigCommon); - if(ret != ROK) + + if((BuildRachCfgCommon(bwp->rach_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill RACH config common in BuildBwpUlCommon()"); return RFAILED; } RachCfgCommonret=ROK; /* PUSCH Config Common */ - DU_ALLOC(bwp->pusch_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); + DU_ALLOC(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); if(!bwp->pusch_ConfigCommon) { DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed"); return RFAILED; - } - ret = BuildPuschCfgCommon(bwp->pusch_ConfigCommon); - if(ret != ROK) + } + + if((BuildPuschCfgCommon(bwp->pusch_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill PUSCH config common in BuildBwpUlCommon()"); return RFAILED; } PuschCfgCommonret = ROK; /* PUCCH Config Common */ - DU_ALLOC(bwp->pucch_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); + DU_ALLOC(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); if(!bwp->pucch_ConfigCommon) { DU_LOG("\nERROR --> DU APP : UL BWP memory allocation failed"); return RFAILED; - } - ret = BuildPucchCfgCommon(bwp->pucch_ConfigCommon); - if(ret != ROK) + } + + if((BuildPucchCfgCommon(bwp->pucch_ConfigCommon)) != ROK) { + DU_LOG("\nERROR --> DU APP : Failed to fill PUCCH config common in BuildBwpUlCommon()"); return RFAILED; } + return ROK; }/* BuildBwpUlCommon */ @@ -2246,7 +2232,7 @@ uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg) { uint8_t ret; /* UL frequency info */ - ret = BuildFreqInfoUl(&ulCfg->frequencyInfoUL); + ret = BuildFreqInfoUlSib(&ulCfg->frequencyInfoUL); if(ret != ROK) { return RFAILED; @@ -2283,9 +2269,7 @@ uint8_t BuildUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg) uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg) { - TddUlDlCfgCommon duTddCfg; - - duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg; + TddUlDlCfgCommon duTddCfg = duCfgParam.sib1Params.srvCellCfgCommSib.tddCfg; /* Reference Subcarrier spacing */ tddCfg->referenceSubcarrierSpacing = duTddCfg.refScs; @@ -2336,34 +2320,7 @@ uint8_t BuildServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg) ssbPosInBurst->buf[0] = duSrvCellCfg.ssbPosInBurst; ssbPosInBurst->bits_unused = 0; - switch(duSrvCellCfg.ssbPrdServingCell) - { - case SSB_PERIODICITY_5MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms5; - break; - case SSB_PERIODICITY_10MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms10; - break; - case SSB_PERIODICITY_20MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms20; - break; - case SSB_PERIODICITY_40MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms40; - break; - case SSB_PERIODICITY_80MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms80; - break; - case SSB_PERIODICITY_160MS: - srvCellCfg->ssb_PeriodicityServingCell = \ - ServingCellConfigCommonSIB__ssb_PeriodicityServingCell_ms160; - break; - } - + srvCellCfg->ssb_PeriodicityServingCell = convertSsbPeriodicityValueToEnumForSib(duSrvCellCfg.ssbPrdServingCell); srvCellCfg->ss_PBCH_BlockPower = duSrvCellCfg.ssPbchBlockPwr; /* Downlink config common */ @@ -2528,15 +2485,15 @@ uint8_t BuildSib1Msg() * * @details * - * Function : FreeFreqInfoDl + * Function : FreeFreqInfoDlSib * - * Functionality: Freeing memory of BuildFreqInfoDl + * Functionality: Freeing memory of BuildFreqInfoDlSib * * @params[in] : FrequencyInfoDL_SIB_t *frequencyInfoDL * @return : void * *******************************************************************/ -void FreeFreqInfoDl(FrequencyInfoDL_SIB_t *frequencyInfoDL) +void FreeFreqInfoDlSib(FrequencyInfoDL_SIB_t *frequencyInfoDL) { uint8_t idx=0; uint8_t idx1=0; @@ -2821,205 +2778,212 @@ void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp) DU_FREE(bwp->pdcch_ConfigCommon,sizeof(struct BWP_DownlinkCommon__pdcch_ConfigCommon)); } } + /******************************************************************* * - * @brief deallocating the memory of BuildSib1Msg + * @brief Free PUCCH configuration common * * @details * - * Function: FreeUlCfgCommSib + * Function : FreePucchCfgCommon * - * Functionality deallocating the memory of BuildUlCfgCommSib + * Functionality: + * Free PUCCH configuration common * - * @params[in] : UplinkConfigCommonSIB_t *ulCfg + * @params[in] Pointer to struct BWP_UplinkCommon__pucch_ConfigCommon + * @return void * - * @return : void + * ****************************************************************/ +void FreePucchCfgCommon( struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg) +{ + PUCCH_ConfigCommon_t *setup; + + if(pucchCfg->choice.setup) + { + setup = pucchCfg->choice.setup; + + /* Resource Common */ + DU_FREE(setup->pucch_ResourceCommon, sizeof(long)); + + /* P0 nominal */ + DU_FREE(setup->p0_nominal, sizeof(long)); + + DU_FREE(pucchCfg->choice.setup, sizeof(PUCCH_ConfigCommon_t)); + } +}/* FreePucchCfgCommon */ + +/******************************************************************* * - *******************************************************************/ -void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg) + * @brief Free PUSCH configuration for common + * + * @details + * + * Function : FreePuschCfgCommon + * + * Functionality: + * Free PUSCH configuration for common + * + * @params[in] Pointer to struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg + * @return void + * + * ****************************************************************/ +void FreePuschCfgCommon(struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg) { - uint8_t idx=0,arrIdx; - RACH_ConfigCommon_t *setup; - BWP_UplinkCommon_t *bwp=&ulCfg->initialUplinkBWP; - struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList; - struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg; - struct BWP_UplinkCommon__pucch_ConfigCommon *pucchCfg; - struct BWP_UplinkCommon__pusch_ConfigCommon *puschCfg; - puschCfg=ulCfg->initialUplinkBWP.pusch_ConfigCommon; - rachCfg =bwp->rach_ConfigCommon; - scsCarrierList = &ulCfg->frequencyInfoUL.scs_SpecificCarrierList; + uint8_t idx = 0; + PUSCH_ConfigCommon_t *setup = NULLP; + PUSCH_TimeDomainResourceAllocation_t *timeDomRsrcAllocInfo = NULLP; - if(scsCarrierList->list.array) + if(puschCfg->choice.setup) { - if(ulCfg->frequencyInfoUL.p_Max) + setup = puschCfg->choice.setup; + + /* Time Domain Resource Allocation List */ + if(setup->pusch_TimeDomainAllocationList) { - if(FreqInfoUlret == ROK) + if(setup->pusch_TimeDomainAllocationList->list.array) { - if(bwp->rach_ConfigCommon) + for(idx=0; idx < setup->pusch_TimeDomainAllocationList->list.count; idx++) { - if(RachCfgCommonret== ROK) + if(setup->pusch_TimeDomainAllocationList->list.array[idx]) { - if(bwp->pusch_ConfigCommon) - { + timeDomRsrcAllocInfo = setup->pusch_TimeDomainAllocationList->list.array[idx]; - if(PuschCfgCommonret==ROK) - { - if(bwp->pucch_ConfigCommon) - { - pucchCfg=bwp->pucch_ConfigCommon; - switch(pucchCfg->present) - { - case BWP_UplinkCommon__pucch_ConfigCommon_PR_NOTHING: - break; - case BWP_UplinkCommon__pucch_ConfigCommon_PR_release: - break; - case BWP_UplinkCommon__pucch_ConfigCommon_PR_setup: - { - if(pucchCfg->choice.setup) - { + /* K2 */ + DU_FREE(timeDomRsrcAllocInfo->k2, sizeof(long)); + DU_FREE(setup->pusch_TimeDomainAllocationList->list.array[idx],\ + sizeof(PUSCH_TimeDomainResourceAllocation_t)); + } + } + DU_FREE(setup->pusch_TimeDomainAllocationList->list.array, setup->pusch_TimeDomainAllocationList->list.size); + } + DU_FREE(setup->pusch_TimeDomainAllocationList, sizeof(PUSCH_TimeDomainResourceAllocationList_t)); + } - if(pucchCfg->choice.setup->pucch_ResourceCommon) - { - if(pucchCfg->choice.setup->p0_nominal) - { - DU_FREE(pucchCfg->choice.setup->p0_nominal, - sizeof(long)); - } - DU_FREE(pucchCfg->choice.setup->pucch_ResourceCommon, - sizeof(long)); - } - DU_FREE(pucchCfg->choice.setup, - sizeof(PUCCH_ConfigCommon_t)); - } - } - default: - break; - } - DU_FREE(bwp->pucch_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); - } - } - switch(puschCfg->present) - { - case BWP_UplinkCommon__pusch_ConfigCommon_PR_NOTHING: - break; - case BWP_UplinkCommon__pusch_ConfigCommon_PR_release: - break; - case BWP_UplinkCommon__pusch_ConfigCommon_PR_setup: - { - if(puschCfg->choice.setup) - { + /* Msg3 Delta Preamble */ + DU_FREE(setup->msg3_DeltaPreamble, sizeof(long)); - if( puschCfg->choice.setup->pusch_TimeDomainAllocationList) - { - if( puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array) - { - for(arrIdx = 0; arrIdxchoice.setup->pusch_TimeDomainAllocationList->list.count; arrIdx++) - { - if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx]) - { - if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[arrIdx]->k2) - { - if( puschCfg->choice.setup->msg3_DeltaPreamble) - { - if(puschCfg->choice.setup->p0_NominalWithGrant) - { - DU_FREE(puschCfg->choice.setup->p0_NominalWithGrant, - sizeof(long)); - } - DU_FREE(puschCfg->choice.setup->msg3_DeltaPreamble, - sizeof(long)); - } - DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.\ - array[arrIdx]->k2, sizeof(long)); - } - } - } - for(idx=0; - idxchoice.setup->pusch_TimeDomainAllocationList->list.count; - idx++) - { - if(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx]) - { - DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array[idx],\ - sizeof(PUSCH_TimeDomainResourceAllocation_t)); - } - } - DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.array,\ - puschCfg->choice.setup->pusch_TimeDomainAllocationList->list.size); - } - DU_FREE(puschCfg->choice.setup->pusch_TimeDomainAllocationList,\ - sizeof(PUSCH_TimeDomainResourceAllocationList_t)); - } - DU_FREE(puschCfg->choice.setup, - sizeof(PUSCH_ConfigCommon_t)); - } - } - default : - break; - } + /* P0 Nominal with grant */ + DU_FREE(setup->p0_NominalWithGrant, sizeof(long)); - DU_FREE(bwp->pusch_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); - } - } - switch(rachCfg->present) - { - case BWP_UplinkCommon__rach_ConfigCommon_PR_NOTHING: - break; - case BWP_UplinkCommon__rach_ConfigCommon_PR_release: - break; - case BWP_UplinkCommon__rach_ConfigCommon_PR_setup: - { - if(rachCfg->choice.setup) - { - setup = rachCfg->choice.setup; - if(setup->totalNumberOfRA_Preambles) - { - if(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB) - { - if(setup->rsrp_ThresholdSSB) - { - if(setup->msg1_SubcarrierSpacing) - { - DU_FREE(setup->msg1_SubcarrierSpacing, - sizeof(SubcarrierSpacing_t)); - } - DU_FREE(setup->rsrp_ThresholdSSB, - sizeof(RSRP_Range_t)); - } - DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\ - sizeof(struct - RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB)); - } - DU_FREE(setup->totalNumberOfRA_Preambles, - sizeof(long)); - } + DU_ALLOC(puschCfg->choice.setup, sizeof(PUSCH_ConfigCommon_t)); + } +}/* BuildPuschCfgCommon */ - DU_FREE(rachCfg->choice.setup, - sizeof(RACH_ConfigCommon_t)); - } - } - default: - break; - } - DU_FREE(bwp->rach_ConfigCommon,\ - sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); - } - } - DU_FREE(ulCfg->frequencyInfoUL.p_Max, sizeof(P_Max_t)); - } +/******************************************************************* + * + * @brief Free RACH configuration common + * + * @details + * + * Function : FreeRachCfgCommon + * + * Functionality: + * Free RACH configuration common + * + * @params[in] BWP_UplinkCommon__rach_ConfigCommon pointer + * @return void + * + * ****************************************************************/ + +void FreeRachCfgCommon(struct BWP_UplinkCommon__rach_ConfigCommon *rachCfg) +{ + RACH_ConfigCommon_t *setup = NULLP; + + if(rachCfg->choice.setup) + { + setup = rachCfg->choice.setup; + + /* Total number of RA preambles */ + DU_FREE(setup->totalNumberOfRA_Preambles, sizeof(long)); + + /* SSB per RACH occassion and CB Preambles per SSB */ + DU_FREE(setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,\ + sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB)); + + /* RSRP Threshold SSB */ + DU_FREE(setup->rsrp_ThresholdSSB, sizeof(RSRP_Range_t)); + + /* Msg 1 Subcarrier spacing */ + DU_FREE(setup->msg1_SubcarrierSpacing, sizeof(SubcarrierSpacing_t)); + + DU_FREE(rachCfg->choice.setup, sizeof(RACH_ConfigCommon_t)); + } +}/* FreeRachCfgCommon */ + +/******************************************************************* + * + * @brief Free UL BWP Common + * + * @details + * + * Function : FreeBwpUlCommon + * + * Functionality: + * Free UL BWP Common + * + * @params[in] BWP_UplinkCommon_t pointer + * @return void + * + * ****************************************************************/ +void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp) +{ + /* RACH Config Common */ + if(bwp->rach_ConfigCommon) + { + FreeRachCfgCommon(bwp->rach_ConfigCommon); + DU_FREE(bwp->rach_ConfigCommon, sizeof(struct BWP_UplinkCommon__rach_ConfigCommon)); + } + + /* PUSCH Config Common */ + if(bwp->pusch_ConfigCommon) + { + FreePuschCfgCommon(bwp->pusch_ConfigCommon); + DU_FREE(bwp->pusch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pusch_ConfigCommon)); + } + + /* PUCCH Config Common */ + if(bwp->pucch_ConfigCommon) + { + FreePucchCfgCommon(bwp->pucch_ConfigCommon); + DU_FREE(bwp->pucch_ConfigCommon, sizeof(struct BWP_UplinkCommon__pucch_ConfigCommon)); + } +}/* FreeBwpUlCommon */ + +/******************************************************************* + * + * @brief Free frequency infor for UL + * + * @details + * + * Function : FreeFreqInfoUlSib + * + * Functionality: + * Free frequency infor for UL + * + * @params[in] FrequencyInfoUL_SIB_t pointer + * @return void + * + * ****************************************************************/ + +void FreeFreqInfoUlSib(FrequencyInfoUL_SIB_t *frequencyInfoUL) +{ + uint8_t idx = 0; + struct FrequencyInfoUL_SIB__scs_SpecificCarrierList *scsCarrierList = &frequencyInfoUL->scs_SpecificCarrierList; + + /* Subcarrier Spacing specifc carrier */ + if(scsCarrierList->list.array) + { for(idx = 0; idx < scsCarrierList->list.count; idx++) { - if(scsCarrierList->list.array[idx]) - { - DU_FREE(scsCarrierList->list.array[idx], - sizeof(SCS_SpecificCarrier_t)); - } + DU_FREE(scsCarrierList->list.array[idx], sizeof(SCS_SpecificCarrier_t)); } DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size); } -} + + /* P-MAX */ + DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t)); +}/* FreeFreqInfoUlSib */ + /******************************************************************* * * @brief : Deallocating memory of SIB1 message @@ -3036,40 +3000,32 @@ void FreeUlCfgCommSib(UplinkConfigCommonSIB_t *ulCfg) *******************************************************************/ void FreeServCellCfgCommonSib(ServingCellConfigCommonSIB_t *srvCellCfg) { - BIT_STRING_t *ssbPosInBurst; + BIT_STRING_t *ssbPosInBurst = NULLP; + DownlinkConfigCommonSIB_t *dlCfg = NULLP; + UplinkConfigCommonSIB_t *ulCfg = NULLP; + + /* SSB Position in Burst buffer */ ssbPosInBurst = &srvCellCfg->ssb_PositionsInBurst.inOneGroup; - DownlinkConfigCommonSIB_t *dlCfg=&srvCellCfg->downlinkConfigCommon; + DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t)); + + /* Free Donwlink config common SIB */ + dlCfg = &srvCellCfg->downlinkConfigCommon; + FreeFreqInfoDlSib(&dlCfg->frequencyInfoDL); + FreeBwpDlCommon(&dlCfg->initialDownlinkBWP); - if(ssbPosInBurst->buf) + /* Uplink Config Comm */ + if(srvCellCfg->uplinkConfigCommon) { - /* Free DL frequency info */ - if(FreqInfoDlret == ROK) - { - if(DlCfgCommSibret == ROK) - { - /* Uplink Config Comm */ - if(srvCellCfg->uplinkConfigCommon) - { - if(UlCfgCommSibret==ROK) - { - /* TDD UL DL Config Comm */ - if(srvCellCfg->tdd_UL_DL_ConfigurationCommon) - { - DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, - sizeof(TDD_UL_DL_ConfigCommon_t)); - } - } - FreeUlCfgCommSib(srvCellCfg->uplinkConfigCommon); - DU_FREE(srvCellCfg->uplinkConfigCommon, - sizeof(UplinkConfigCommonSIB_t)); - } - } - FreeBwpDlCommon(&dlCfg->initialDownlinkBWP); - } - FreeFreqInfoDl(&dlCfg->frequencyInfoDL); - DU_FREE(ssbPosInBurst->buf, ssbPosInBurst->size * sizeof(uint8_t)); + ulCfg = srvCellCfg->uplinkConfigCommon; + FreeFreqInfoUlSib(&ulCfg->frequencyInfoUL); + FreeBwpUlCommon(&ulCfg->initialUplinkBWP); + DU_FREE(srvCellCfg->uplinkConfigCommon, sizeof(UplinkConfigCommonSIB_t)); } + + /* TDD UL DL Config Comm */ + DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t)); } + /******************************************************************* * * @brief : Deallcating memory of the function BuildSib1Msg diff --git a/src/du_app/du_sys_info_hdl.h b/src/du_app/du_sys_info_hdl.h index e93537355..2aab5fc0c 100644 --- a/src/du_app/du_sys_info_hdl.h +++ b/src/du_app/du_sys_info_hdl.h @@ -32,6 +32,12 @@ uint8_t BuildMibPdu(); uint8_t BuildMibMsg(); uint8_t BuildSib1Msg(); +uint8_t BuildBwpDlCommon(BWP_DownlinkCommon_t *bwp); +uint8_t BuildBwpUlCommon(BWP_UplinkCommon_t *bwp); +uint8_t BuildTddUlDlCfgComm(TDD_UL_DL_ConfigCommon_t *tddCfg); +void FreeBwpDlCommon(BWP_DownlinkCommon_t *bwp); +void FreeBwpUlCommon(BWP_UplinkCommon_t *bwp); + char encBuf[ENC_BUF_MAX_LEN]; DuCfgParams duCfgParam; diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 3f859cdbd..b2c434436 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -81,11 +81,18 @@ DuMacUeReconfigReq packMacUeReconfigReqOpts[] = packDuMacUeReconfigReq /* Light weight-loose coupling */ }; +DuMacRachRsrcReq packMacRachRsrcReqOpts[] = +{ + packDuMacRachRsrcReq, /* Loose coupling */ + MacProcRachRsrcReq, /* Tight coupling */ + packDuMacRachRsrcReq /* Light weight-loose coupling */ +}; + DuRlcDlUserDataToRlcFunc duSendRlcDlUserDataToRlcOpts[] = { - packRlcDlUserDataToRlc, /* Loose coupling */ + packRlcDlUserDataToRlc, /* Loose coupling */ RlcProcDlUserDataTransfer, /* Tight coupling */ - packRlcDlUserDataToRlc /* Light weight-loose coupling */ + packRlcDlUserDataToRlc /* Light weight-loose coupling */ }; DuMacUeDeleteReq packMacUeDeleteReqOpts[] = @@ -1163,7 +1170,7 @@ uint8_t sendUeReCfgReqToMac(MacUeCfg *macUeCfg) * @return ROK/RFAILED * *****************************************************************/ -uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, DuUeCfg *ueCfgDb, MacUeCfg *macUeCfg) +uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *macUeCfg) { uint8_t ret = ROK, dbIdx = 0, lcIdx = 0, cellIdx = 0; bool lcIdFound = false; @@ -1171,7 +1178,7 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, DuUeCfg *ueCfgDb, M macUeCfg->cellId = cellId; macUeCfg->ueId = gnbDuUef1apId; - GET_CRNTI(macUeCfg->crnti, macUeCfg->ueId); + macUeCfg->crnti = crnti; if(!ueCfgDb) { @@ -1719,7 +1726,7 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId) /* Filling Mac Ue Config */ memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg, 0, sizeof(MacUeCfg)); - ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueCcchCtxt->gnbDuUeF1apId, NULL, + ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueCcchCtxt->gnbDuUeF1apId, ueCcchCtxt->crnti, NULL, &duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC"); @@ -1759,7 +1766,7 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId) * * ****************************************************************/ -uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, DuUeCfg *ueCfgDb, MacUeCfg *duMacUeCfg) +uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *duMacUeCfg) { uint8_t ret = ROK; MacUeCfg *macUeCfg = NULLP; @@ -1767,7 +1774,7 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, D memset(&pst, 0, sizeof(Pst)); - ret = fillMacUeCfg(cellId, gnbDuUeF1apId, ueCfgDb, duMacUeCfg); + ret = fillMacUeCfg(cellId, gnbDuUeF1apId, crnti, ueCfgDb, duMacUeCfg); if(ret == RFAILED) { DU_LOG("\nERROR --> DU APP : Failed to fill MacUeCfg at duBuildAndSendUeCreateReqToMac()"); @@ -1801,6 +1808,130 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, D return ret; } +/******************************************************************* + * + * @brief Build and send RACH Resource request to MAC + * + * @details + * + * Function : duBuildAndSendRachRsrcReqToMac + * Functionality: + * Build and send RACH Resource request to MAC + * + * @params[in] Cell Id + * UE Id + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t duBuildAndSendRachRsrcReqToMac(uint16_t cellId, uint16_t ueId) +{ + uint16_t cellIdx = 0, ssbIdx = 0; + Pst pst; + MacRachRsrcReq *rachRsrcReq = NULLP; + + GET_CELL_IDX(cellId, cellIdx); + if(duCb.actvCellLst[cellIdx] == NULLP) + { + DU_LOG("\nERROR --> DU APP : Cell Id [%d] not found in duBuildAndSendRachRsrcReqToMac()", cellId); + return RFAILED; + } + + DU_ALLOC_SHRABL_BUF(rachRsrcReq, sizeof(MacRachRsrcReq)); + if(!rachRsrcReq) + { + DU_LOG("\nERROR --> DU APP : Failed to allocate memory for RACH Resource Request in \ + duBuildAndSendRachRsrcReqToMac()"); + return RFAILED; + } + + rachRsrcReq->cellId = cellId; + rachRsrcReq->ueId = ueId; + rachRsrcReq->numSsb = duCfgParam.macCellCfg.prachCfg.ssbPerRach; + for(ssbIdx = 0; ssbIdx < rachRsrcReq->numSsb; ssbIdx++) + { + rachRsrcReq->ssbIdx[ssbIdx] = ssbIdx; + } + + /* Fill Pst */ + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_RACH_RESOURCE_REQ); + + if(((*packMacRachRsrcReqOpts[pst.selector])(&pst, rachRsrcReq)) != ROK) + { + DU_LOG("\nERROR --> DU_APP : Failure in sending RACH Resource Request to MAC at \ + duBuildAndSendRachRsrcReqToMac()"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rachRsrcReq, sizeof(MacRachRsrcReq)); + return RFAILED; + } + + return ROK; +} + +/******************************************************************* + * + * @brief Process RACH resource response from MAC + * + * @details + * + * Function : DuProcMacRachRsrcRsp + * Functionality: + * Process RACH resource response from MAC + * + * @params[in] Post structure + * RACH resource response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t DuProcMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp) +{ + uint8_t ret = RFAILED; + uint16_t cellIdx = 0; + DuCellCb *cellCb = NULLP; + DuUeCb *ueCb = NULLP; + + DU_LOG("\nINFO --> DU APP : Received RACH Resource Response from MAC. Cell ID [%d] UE ID [%d]", + rachRsrcRsp->cellId, rachRsrcRsp->ueId); + + if(rachRsrcRsp->result == MAC_DU_APP_RSP_OK) + { + DU_LOG("\nINFO : DU APP : RACH Resource Response from MAC : Result [SUCCESS]"); + + /* Fetch Cell Cb */ + GET_CELL_IDX(rachRsrcRsp->cellId, cellIdx); + if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->cellId == rachRsrcRsp->cellId)) + { + cellCb = duCb.actvCellLst[cellIdx]; + + /* Fetch UE CB */ + if(cellCb->ueCb[rachRsrcRsp->ueId-1].gnbDuUeF1apId == rachRsrcRsp->ueId) + { + ueCb = &cellCb->ueCb[rachRsrcRsp->ueId-1]; + + /* Store CRNTI alloted to this UE by MAC */ + ueCb->crnti = rachRsrcRsp->newCrnti; + + /* Store the assigned CF-RA resources */ + memcpy(&ueCb->cfraResource, &rachRsrcRsp->cfraResource, sizeof(MacCfraResource)); + + /* RACH resources allocated to UE is sent to CU in UE Context Setup Response + * along with the result of UE Context setup requested by CU */ + if((ret = BuildAndSendUeCtxtRsp(rachRsrcRsp->cellId, rachRsrcRsp->ueId)) != ROK) + DU_LOG("\nERROR -> DU APP : Failure in BuildAndSendUeCtxtRsp()"); + } + else + DU_LOG("\nERROR --> DU APP : UE ID [%d] not found in DuProcMacRachRsrcRsp", rachRsrcRsp->ueId); + } + else + DU_LOG("\nERROR --> DU APP : Cell ID [%d] not found in DuProcMacRachRsrcRsp", rachRsrcRsp->cellId); + } + else + DU_LOG("\nINFO : DU APP : RACH Resource Response from MAC : Result [FAILURE]"); + + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rachRsrcRsp, sizeof(MacRachRsrcRsp)); + return ret; +} + /******************************************************************* * * @brief To update DuUeCb Mac Cfg @@ -2339,24 +2470,28 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) { duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState = UE_CREATE_COMPLETE; - if((duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].ueState == UE_HANDIN_IN_PROGRESS) && - (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState == UE_CREATE_COMPLETE) && - (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].rlcUeCfg.rlcUeCfgState == UE_CREATE_COMPLETE)) - { - if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK) - { - if((BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId)) != ROK) - { - DU_LOG("\nERROR -> DU APP : Failure in BuildAndSendUeCtxtRsp()"); - return RFAILED; - } - } - else - { - DU_LOG("\nERROR -> DU APP : Failure in updating DU UE CB"); - return RFAILED; - } - } + if((duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].ueState == UE_HANDIN_IN_PROGRESS) && + (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState == UE_CREATE_COMPLETE) && + (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].rlcUeCfg.rlcUeCfgState == UE_CREATE_COMPLETE)) + { + if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK) + { + /* If UE is in handover, RACH resource needs to be requested + * from MAC for CFRA */ + if((duBuildAndSendRachRsrcReqToMac(cfgRsp->cellId, cfgRsp->ueId)) != ROK) + { + DU_LOG("\nERROR --> DU APP : Failed to send RACH Resource Request to MAC"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); + return RFAILED; + } + } + else + { + DU_LOG("\nERROR -> DU APP : Failure in updating DU UE CB"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); + return RFAILED; + } + } } } else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP) @@ -2374,12 +2509,14 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) if((BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId)) != ROK) { DU_LOG("\nERROR -> DU APP : Failure in BuildAndSendUeCtxtRsp()"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); return RFAILED; } } else { DU_LOG("\nERROR -> DU APP : Failure in updating DU UE CB"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); return RFAILED; } } @@ -2495,20 +2632,25 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE; if((duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].ueState == UE_HANDIN_IN_PROGRESS) && - (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState == UE_CREATE_COMPLETE) && - (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].rlcUeCfg.rlcUeCfgState == UE_CREATE_COMPLETE)) + (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState == UE_CREATE_COMPLETE) && + (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].rlcUeCfg.rlcUeCfgState == UE_CREATE_COMPLETE)) { if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK) { - if((BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId)) != ROK) + /* If UE is in handover, RACH resource needs to be requested + * from MAC for CFRA */ + if((duBuildAndSendRachRsrcReqToMac(cfgRsp->cellId, cfgRsp->ueId)) != ROK) { - DU_LOG("\nERROR --> DU APP : Failure in BuildAndSendUeCtxtRsp"); + DU_LOG("\nERROR --> DU APP : Failed to send RACH Resource Request to MAC"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); return RFAILED; } } else { DU_LOG("\nERROR --> DU APP : Failure in updating DU UE CB"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); return RFAILED; } } @@ -2526,12 +2668,14 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) if((BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId)) != ROK) { DU_LOG("\nERROR --> DU APP : Failure in BuildAndSendUeCtxtRsp"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); return RFAILED; } } else { DU_LOG("\nERROR --> DU APP : Failure in updating DU UE CB"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); return RFAILED; } } @@ -2625,7 +2769,7 @@ uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t duUeF1apId, uint8_ if(macUeCfg) { memset(macUeCfg, 0, sizeof(MacUeCfg)); - ret = fillMacUeCfg(cellId, duUeF1apId, ueCfgDb, macUeCfg); + ret = fillMacUeCfg(cellId, duUeF1apId, crnti, ueCfgDb, macUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed to fill Mac Ue Cfg at duBuildAndSendUeReCfgReqToMac()"); else @@ -2685,7 +2829,7 @@ uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, DuUeCb *ueCb) memset(&ueCb->macUeCfg, 0, sizeof(MacUeCfg)); /* Since UE attach has not yet happened, crnti is unknow. Hence passing 0 */ - ret = duBuildAndSendUeCreateReqToMac(cellId, ueCb->gnbDuUeF1apId, duUeCfg, &ueCb->macUeCfg); + ret = duBuildAndSendUeCreateReqToMac(cellId, ueCb->gnbDuUeF1apId, 0, duUeCfg, &ueCb->macUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC"); diff --git a/src/du_app/du_ue_mgr.h b/src/du_app/du_ue_mgr.h index 979fdc1f4..529c2ea72 100644 --- a/src/du_app/du_ue_mgr.h +++ b/src/du_app/du_ue_mgr.h @@ -23,7 +23,7 @@ uint8_t duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf); uint8_t cmPkRlcDatReq(Pst * pst,RlcDatReqInfo* datReq,Buffer * mBuf); -uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t duUeF1apId, DuUeCfg *ueCfgDb, MacUeCfg *duMacUeCfg); +uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t duUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *duMacUeCfg); uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t duUeF1apId, DuUeCfg *ueCfgDb, RlcUeCfg *duRlcUeCfg); uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId); uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo); diff --git a/src/ric_stub/ric_stub.h b/src/ric_stub/ric_stub.h index ffb752639..b41e9c6da 100644 --- a/src/ric_stub/ric_stub.h +++ b/src/ric_stub/ric_stub.h @@ -26,10 +26,10 @@ #define RIC_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0011" #ifndef O1_ENABLE -#define DU_IP_V4_ADDR (char*[]){"192.168.130.85", "192.168.130.83"} +#define DU_IP_V4_ADDR (char*[]){"192.168.130.81", "192.168.130.83"} #define DU_SCTP_PORT (int[]){36421, 36422} -#define RIC_IP_V4_ADDR "192.168.130.87" +#define RIC_IP_V4_ADDR "192.168.130.80" #define RIC_SCTP_PORT_TO_DU (int[]){36421, 36422} #endif