From f0f283a72b3bdf0740cb49071a2f025159f0bf15 Mon Sep 17 00:00:00 2001 From: sphoorthi Date: Thu, 11 Mar 2021 14:40:13 +0530 Subject: [PATCH] JIRA ID = ODUHIGH-298 RB configuration at MAC/SCH/RLC for ue modification Change-Id: I5059c688847e4c3824aa80c0cd96a35798eb1720 Signed-off-by: sphoorthi --- src/5gnrmac/mac_ue_mgr.c | 76 +++++++----- src/5gnrsch/sch.h | 17 ++- src/5gnrsch/sch_ue_mgr.c | 92 +++++++++----- src/cm/du_app_mac_inf.h | 3 + src/cm/mac_sch_interface.h | 3 + src/du_app/du_f1ap_msg_hdl.c | 96 ++++++++------- src/du_app/du_f1ap_msg_hdl.h | 1 + src/du_app/du_mgr.h | 1 + src/du_app/du_ue_mgr.c | 285 ++++++++++++++++++++++++++++--------------- 9 files changed, 372 insertions(+), 202 deletions(-) diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index 1bee3b544..7ede4a5de 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -1606,36 +1606,46 @@ uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg) schUeCfg->crnti = ueCfg->crnti; /* Copy MAC cell group config */ - memset(&schUeCfg->macCellGrpCfg, 0, sizeof(SchMacCellGrpCfg)); - if(fillMacCellGroupCfg(ueCfg->macCellGrpCfg, &schUeCfg->macCellGrpCfg) != ROK) + if(ueCfg->macCellGrpCfgPres == true) { - DU_LOG("\nERROR --> MAC : fillMacCellGroupCfg() failed"); - return RFAILED; + schUeCfg->macCellGrpCfgPres = true; + memset(&schUeCfg->macCellGrpCfg, 0, sizeof(SchMacCellGrpCfg)); + if(fillMacCellGroupCfg(ueCfg->macCellGrpCfg, &schUeCfg->macCellGrpCfg) != ROK) + { + DU_LOG("\nERROR --> MAC : fillMacCellGroupCfg() failed"); + return RFAILED; + } } - - /* Copy Physical cell group config */ - memset(&schUeCfg->phyCellGrpCfg, 0,sizeof(SchPhyCellGrpCfg)); - if(fillPhyCellGroupCfg(ueCfg->phyCellGrpCfg, &schUeCfg->phyCellGrpCfg) != ROK) + if(ueCfg->phyCellGrpCfgPres == true) { - DU_LOG("\nERROR --> MAC : fillPhyCellGroupCfg() failed"); - return RFAILED; + schUeCfg->phyCellGrpCfgPres = true; + /* Copy Physical cell group config */ + memset(&schUeCfg->phyCellGrpCfg, 0,sizeof(SchPhyCellGrpCfg)); + if(fillPhyCellGroupCfg(ueCfg->phyCellGrpCfg, &schUeCfg->phyCellGrpCfg) != ROK) + { + DU_LOG("\nERROR --> MAC : fillPhyCellGroupCfg() failed"); + return RFAILED; + } } - /* Copy sp cell config */ - memset(&schUeCfg->spCellCfg, 0, sizeof(SchSpCellCfg)); - if(fillSpCellCfg(ueCfg->spCellCfg, &schUeCfg->spCellCfg) != ROK) + if(ueCfg->spCellCfgPres == true) { - DU_LOG("\nERROR --> MAC : fillSpCellCfg() failed"); - return RFAILED; + schUeCfg->spCellCfgPres = true; + /* Copy sp cell config */ + memset(&schUeCfg->spCellCfg, 0, sizeof(SchSpCellCfg)); + if(fillSpCellCfg(ueCfg->spCellCfg, &schUeCfg->spCellCfg) != ROK) + { + DU_LOG("\nERROR --> MAC : fillSpCellCfg() failed"); + return RFAILED; + } } - if(ueCfg->ambrCfg != NULLP) { MAC_ALLOC(schUeCfg->ambrCfg, sizeof(SchAmbrCfg)); if(!schUeCfg->ambrCfg) { - DU_LOG("\nERROR --> MAC : Memory allocation failed in sendReconfigReqToSch"); - return RFAILED; + DU_LOG("\nERROR --> MAC : Memory allocation failed in sendReconfigReqToSch"); + return RFAILED; } schUeCfg->ambrCfg->ulBr = ueCfg->ambrCfg->ulBr; } @@ -1811,13 +1821,19 @@ uint8_t fillMacUeCb(MacUeCb *ueCb, MacUeCfg *ueCfg, uint8_t cellIdx) ueCb->ueIdx = ueCfg->ueIdx; ueCb->crnti = ueCfg->crnti; ueCb->cellCb = macCb.macCell[cellIdx]; - ueCb->dlInfo.dlHarqEnt.numHarqProcs = \ + if(ueCfg->spCellCfgPres) + { + ueCb->dlInfo.dlHarqEnt.numHarqProcs = \ ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch; + } ueCb->state = UE_STATE_ACTIVE; /*TODO: To check the bsr value during implementation */ - ueCb->bsrTmrCfg.periodicTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer; - ueCb->bsrTmrCfg.retxTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer; - ueCb->bsrTmrCfg.srDelayTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer; + if(ueCfg->macCellGrpCfgPres) + { + ueCb->bsrTmrCfg.periodicTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer; + ueCb->bsrTmrCfg.retxTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer; + ueCb->bsrTmrCfg.srDelayTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer; + } ret = fillMacLcCfgList(ueCb, ueCfg); if(ret == RFAILED) { @@ -2361,20 +2377,20 @@ uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) if(ret == ROK) { /*Sending Cfg Req to SCH */ - ret = fillSchUeCfg(pst, &schUeCfg, ueCfg); - if(ret != ROK) - DU_LOG("\nERROR --> MAC : Failed to fill sch Ue Cfg at MacProcUeReconfigReq()"); + ret = fillSchUeCfg(pst, &schUeCfg, ueCfg); + if(ret != ROK) + DU_LOG("\nERROR --> MAC : Failed to fill sch Ue Cfg at MacProcUeReconfigReq()"); else - { + { /* Fill event and send UE create request to SCH */ ret = sendUeReqToSch(pst, &schUeCfg); - if(ret != ROK) - DU_LOG("\nERROR --> MAC : Failed to send UE Reconfig Request to SCH"); - } + if(ret != ROK) + DU_LOG("\nERROR --> MAC : Failed to send UE Reconfig Request to SCH"); + } } else { - DU_LOG("\nERROR --> MAC : Failed to store MAC UE Cb "); + DU_LOG("\nERROR --> MAC : Failed to store MAC UE Cb "); } } else diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index d99f67183..8cc292109 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -168,6 +168,21 @@ typedef struct schUlCb SchUlLcCtxt ulLcCtxt[MAX_NUM_LC]; }SchUlCb; +typedef struct schUeCfgCb +{ + uint16_t cellId; + uint16_t crnti; + bool macCellGrpCfgPres; + SchMacCellGrpCfg macCellGrpCfg; + bool phyCellGrpCfgPres; + SchPhyCellGrpCfg phyCellGrpCfg; + bool spCellCfgPres; + SchSpCellCfg spCellCfg; + SchAmbrCfg *ambrCfg; + SchModulationInfo dlModInfo; + SchModulationInfo ulModInfo; +}SchUeCfgCb; + /** * @brief * UE control block @@ -176,7 +191,7 @@ typedef struct schUeCb { uint16_t ueIdx; uint16_t crnti; - SchUeCfg ueCfg; + SchUeCfgCb ueCfg; SchUeState state; SchCellCb *cellCb; bool srRcvd; diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index 22f16a702..097e0808c 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -201,41 +201,67 @@ void updateSchDlCb(uint8_t delIdx, SchDlCb *dlInfo) uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) { uint8_t lcIdx, ueLcIdx; + + ueCb->ueCfg.cellId = ueCfg->cellId; + ueCb->ueCfg.crnti = ueCfg->crnti; + if(ueCfg->macCellGrpCfgPres == true) + { + memcpy(&ueCb->ueCfg.macCellGrpCfg , &ueCfg->macCellGrpCfg, sizeof(SchMacCellGrpCfg)); + ueCb->ueCfg.macCellGrpCfgPres = true; + } + + if(ueCfg->phyCellGrpCfgPres == true) + { + memcpy(&ueCb->ueCfg.phyCellGrpCfg , &ueCfg->phyCellGrpCfg, sizeof(SchPhyCellGrpCfg)); + ueCb->ueCfg.phyCellGrpCfgPres = true; + } - memset(&ueCb->ueCfg, 0, sizeof(SchUeCfg)); - memcpy(&ueCb->ueCfg, ueCfg, sizeof(SchUeCfg)); + if(ueCfg->spCellCfgPres == true) + { + memcpy(&ueCb->ueCfg.spCellCfg , &ueCfg->spCellCfg, sizeof(SchSpCellCfg)); + ueCb->ueCfg.spCellCfgPres = true; + } ueCb->state = SCH_UE_STATE_ACTIVE; + if(ueCfg->ambrCfg != NULLP) + { + SCH_ALLOC(ueCb->ueCfg.ambrCfg , sizeof(SchAmbrCfg)); + memcpy(&ueCb->ueCfg.ambrCfg->ulBr , &ueCfg->ambrCfg->ulBr, sizeof(SchAmbrCfg)); + } + + memcpy(&ueCb->ueCfg.dlModInfo, &ueCfg->dlModInfo , sizeof(SchModulationInfo)); + memcpy(&ueCb->ueCfg.ulModInfo, &ueCfg->ulModInfo , sizeof(SchModulationInfo)); + //Updating SchUlCb and SchDlCb DB in SchUeCb for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++) { if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_ADD) { - fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueCb->ulInfo.numUlLc], &ueCfg->schLcCfg[lcIdx]); - ueCb->ulInfo.numUlLc++; - fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueCb->dlInfo.numDlLc], &ueCfg->schLcCfg[lcIdx]); - ueCb->dlInfo.numDlLc++; + fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueCb->ulInfo.numUlLc], &ueCfg->schLcCfg[lcIdx]); + ueCb->ulInfo.numUlLc++; + fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueCb->dlInfo.numDlLc], &ueCfg->schLcCfg[lcIdx]); + ueCb->dlInfo.numDlLc++; } else { - for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++) //searching for Lc to be Mod + for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++) //searching for Lc to be Mod { - if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId) - { - if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD) - { - fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); - fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); - break; - } + if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId) + { + if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD) + { + fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); + fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); + break; + } if(ueCfg->schLcCfg[ueLcIdx].configType == CONFIG_DEL) { - memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt)); - ueCb->ulInfo.numUlLc--; - updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead - memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt)); - ueCb->dlInfo.numDlLc--; - updateSchDlCb(ueLcIdx, &ueCb->dlInfo); //moving arr elements one idx ahead - break; + memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt)); + ueCb->ulInfo.numUlLc--; + updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead + memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt)); + ueCb->dlInfo.numDlLc--; + updateSchDlCb(ueLcIdx, &ueCb->dlInfo); //moving arr elements one idx ahead + break; } } }/*End of inner for loop */ @@ -390,10 +416,14 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S uint8_t idx = 0; SchCellCb *cellCb = ueCb->cellCb; SchUlSlotInfo *schUlSlotInfo = NULLP; - uint8_t k2 = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].k2; - uint8_t startSymb = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].startSymbol; - uint8_t symbLen = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].symbolLength; - + uint8_t k2=0, startSymb=0 , symbLen=0; + + if(ueCb->ueCfg.spCellCfgPres == true) + { + k2 = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].k2; + startSymb = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].startSymbol; + symbLen = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[0].symbolLength; + } puschSlot = (pdcchSlot + k2) % cellCb->numSlots; startRb = cellCb->schUlSlotInfo[puschSlot]->puschCurrentPrb; @@ -457,8 +487,14 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo puschInfo, DciInfo *dciInfo) { SchCellCb *cellCb = ueCb->cellCb; - SchControlRsrcSet coreset1 = ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0]; - + SchControlRsrcSet coreset1 ; + + memset(&coreset1, 0, sizeof(SchControlRsrcSet)); + if(ueCb->ueCfg.spCellCfgPres == true) + { + coreset1 = ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0]; + } + dciInfo->cellId = cellCb->cellId; dciInfo->crnti = ueCb->crnti; diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index e622de808..92eab3c26 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -1183,8 +1183,11 @@ typedef struct macUeCfg uint16_t cellId; uint8_t ueIdx; uint16_t crnti; + bool macCellGrpCfgPres; MacCellGrpCfg macCellGrpCfg; + bool phyCellGrpCfgPres; PhyCellGrpCfg phyCellGrpCfg; + bool spCellCfgPres; SpCellCfg spCellCfg; AmbrCfg *ambrCfg; ModulationInfo dlModInfo; /* DL modulation info */ diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 7fd0d6d1c..80ef9bfc7 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -1430,8 +1430,11 @@ typedef struct schUeCfg { uint16_t cellId; uint16_t crnti; + bool macCellGrpCfgPres; SchMacCellGrpCfg macCellGrpCfg; + bool phyCellGrpCfgPres; SchPhyCellGrpCfg phyCellGrpCfg; + bool spCellCfgPres; SchSpCellCfg spCellCfg; SchAmbrCfg *ambrCfg; SchModulationInfo dlModInfo; diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index b611dccce..0357523dd 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -8788,79 +8788,82 @@ uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg /* Fill MacCell Group Reconfig */ if(cellGrp->mac_CellGroupConfig) { + macUeCfg->macCellGrpCfgPres = true; macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig)); if(macCellGroup->schedulingRequestConfig) - { + { extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg); - } + } if(macCellGroup->tag_Config) - { + { extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg); - } - if(macCellGroup->bsr_Config) - { + } + if(macCellGroup->bsr_Config) + { macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer; macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer; - if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer) - { + if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer) + { macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\ - *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer); - } - } - if(macCellGroup->phr_Config) - { - if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup) - { + *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer); + } + } + if(macCellGroup->phr_Config) + { + if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup) + { macUeCfg->macCellGrpCfg.phrCfgSetupPres = true; if(macCellGroup->phr_Config->choice.setup) - { - macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \ - macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer; - macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \ - macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer; - macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \ - macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange; - macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \ - macCellGroup->phr_Config->choice.setup->multiplePHR; - macUeCfg->macCellGrpCfg.phrCfg.dummy = \ - macCellGroup->phr_Config->choice.setup->dummy; - macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \ - macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell; - macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \ - macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG; - } - } - } + { + macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \ + macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer; + macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \ + macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer; + macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \ + macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange; + macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \ + macCellGroup->phr_Config->choice.setup->multiplePHR; + macUeCfg->macCellGrpCfg.phrCfg.dummy = \ + macCellGroup->phr_Config->choice.setup->dummy; + macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \ + macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell; + macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \ + macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG; + } + } + } } /* Fill Physical Cell Group Reconfig */ if(cellGrp->physicalCellGroupConfig) { + macUeCfg->phyCellGrpCfgPres = true; phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig)); if(phyCellGrpCfg->p_NR_FR1) - { - if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1) + { + if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1) macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1); - } + } macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook; } /* Fill SpCell Reconfig */ if(cellGrp->spCellConfig) { + macUeCfg->spCellCfgPres = true; spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig)); if(spcellCfg->servCellIndex) - { + { macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex); - } + } /* Fill Serving cell Reconfig info */ - if(cellGrp->spCellConfig->spCellConfigDedicated) - { - servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated)); + if(cellGrp->spCellConfig->spCellConfigDedicated) + { + servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated)); ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg); - if(ret == RFAILED) - { - DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()"); - } - } + if(ret == RFAILED) + { + DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()"); + } + } } } return ret; @@ -10004,6 +10007,7 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) } else { + duUeCb->f1UeDb->dlRrcMsgPres = true; memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg)); ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\ &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer); diff --git a/src/du_app/du_f1ap_msg_hdl.h b/src/du_app/du_f1ap_msg_hdl.h index 3eac79dc5..65d42e186 100644 --- a/src/du_app/du_f1ap_msg_hdl.h +++ b/src/du_app/du_f1ap_msg_hdl.h @@ -49,6 +49,7 @@ int8_t getReAsmblTmr(uint8_t reAsmblTmrCfg); int16_t getStatProhTmr(uint8_t statProhTmrCfg); uint8_t duProcUeContextModReq(DuUeCb *ueCb); uint8_t BuildAndSendUeContextModResp(uint8_t ueIdx, uint8_t cellId); +uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg); /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index 9182bc337..4dfc7097d 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -132,6 +132,7 @@ typedef struct f1UeContextSetup UeCtxtActionType actionType; uint8_t cellIdx; DuUeCfg duUeCfg; + bool dlRrcMsgPres; F1DlRrcMsg *dlRrcMsg; }F1UeContextSetupDb; diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 748f71aaa..53037eea5 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -1130,59 +1130,62 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \ ret = procUeReCfgCellInfo(macUeCfg, ueCfgDb->cellGrpCfg); if(ret == ROK) { - if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent) - { - fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\ - &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL); - } - if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent) + if(macUeCfg->spCellCfgPres == true) { - fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\ - NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg); + if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent) + { + fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\ + &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL); + } + if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent) + { + fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\ + NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg); + } } - ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg); - + ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg); + duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability); } /* Filling LC Context */ for(dbIdx = 0; (dbIdx < ueCfgDb->numMacLcs && ret == ROK); dbIdx++) { - if(!ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres) - { - /* Filling default UL LC config in MAC if not present */ - ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres = true; - fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].ulLcCfg); - } - for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++) - { - if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId) - { - lcIdFound = true; - if((ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) || - (ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_MOD)) - { - ueCfgDb->macLcCfg[dbIdx].configType = CONFIG_MOD; - ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]); - } - } - else - lcIdFound = false; - } - if(!lcIdFound) - { - /* ADD/DEL CONFIG */ - ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]); - } - if(ret == ROK) - { - macUeCfg->numLcs++; - } - else - { - DU_LOG("\nERROR --> DU APP : Failed to add Lc at Idx %d in fillMacUeCfg()", dbIdx); - break; - } + if(!ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres) + { + /* Filling default UL LC config in MAC if not present */ + ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres = true; + fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].ulLcCfg); + } + for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++) + { + if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId) + { + lcIdFound = true; + if((ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) || + (ueCfgDb->macLcCfg[dbIdx].configType == CONFIG_MOD)) + { + ueCfgDb->macLcCfg[dbIdx].configType = CONFIG_MOD; + ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]); + } + } + else + lcIdFound = false; + } + if(!lcIdFound) + { + /* ADD/DEL CONFIG */ + ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx]); + } + if(ret == ROK) + { + macUeCfg->numLcs++; + } + else + { + DU_LOG("\nERROR --> DU APP : Failed to add Lc at Idx %d in fillMacUeCfg()", dbIdx); + break; + } }/*End of Outer FOR loop */ } return ret; @@ -2143,27 +2146,31 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) if(cfgRsp->result == MAC_DU_APP_RSP_OK) { if(pst->event == EVENT_MAC_UE_CREATE_RSP) - { + { DU_LOG("\nINFO --> DU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx); duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ - macUeCfg.macUeCfgState = UE_CREATE_COMPLETE; - } + macUeCfg.macUeCfgState = UE_CREATE_COMPLETE; + } else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP) { DU_LOG("\nINFO --> DU APP : MAC UE Reconfig Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx); duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ - macUeCfg.macUeCfgState = UE_RECFG_COMPLETE; + macUeCfg.macUeCfgState = UE_RECFG_COMPLETE; if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK) + { BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId); + duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ + macUeCfg.macUeCfgState = 0; + } } } else { DU_LOG("\nERROR --> DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [UE IDX : %d]", pst->event, cfgRsp->ueIdx); - if(pst->event == EVENT_MAC_UE_RECONFIG_RSP) - { - //TODO: Send the failure case in Ue Context Setup Response - } + if(pst->event == EVENT_MAC_UE_RECONFIG_RSP) + { + //TODO: Send the failure case in Ue Context Setup Response + } ret = RFAILED; } DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); @@ -2262,29 +2269,33 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) if(cfgRsp->result == RLC_DU_APP_RSP_OK) { if(pst->event == EVENT_RLC_UE_CREATE_RSP) - { - DU_LOG("\nINFO --> DU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx); - duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ - rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE; - } - else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP) - { + { + DU_LOG("\nINFO --> DU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx); + duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ + rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE; + } + else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP) + { DU_LOG("\nINFO --> DU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx); - duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ - rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE; - if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK) + duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ + rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE; + if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK) + { BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId); - } + duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ + rlcUeCfg.rlcUeCfgState = 0; + } + } } else { DU_LOG("\nERROR --> DU_APP: RLC UE CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\ - pst->event, cfgRsp->ueIdx, cfgRsp->reason); - if((pst->event == EVENT_RLC_UE_RECONFIG_RSP)) - { + pst->event, cfgRsp->ueIdx, cfgRsp->reason); + if((pst->event == EVENT_RLC_UE_RECONFIG_RSP)) + { //TODO: update failure case in ue Context setup Response - } - ret = RFAILED; + } + ret = RFAILED; } DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); } @@ -2296,8 +2307,6 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) return ret; } - - /******************************************************************* * * @brief Builds and Send Ue Reconfig Req to RLC @@ -2447,11 +2456,20 @@ uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg) { GET_UE_IDX(dlRrcMsg->crnti, ueIdx); ueCb = &duCb.actvCellLst[dlRrcMsg->cellId -1]->ueCb[ueIdx -1]; - if(ueCb->f1UeDb && ueCb->f1UeDb->actionType == UE_CTXT_SETUP) + if(ueCb->f1UeDb && ueCb->f1UeDb->dlRrcMsgPres) { - ret = duBuildAndSendUeContextSetupReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg); - if(ret == RFAILED) - DU_LOG("\nERROR --> DU APP : Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()"); + if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP) + { + ret = duBuildAndSendUeContextSetupReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg); + if(ret == RFAILED) + DU_LOG("\nERROR --> DU APP : Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()"); + } + if(ueCb->f1UeDb->actionType == UE_CTXT_MOD) + { + ret = duBuildAndSendUeContextModReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg); + if(ret == RFAILED) + DU_LOG("\nERROR --> DU APP : Failed to process UE Context Mod Request in DuProcRlcDlRrcMsgRsp()"); + } } } else @@ -2479,7 +2497,7 @@ uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg) uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb) { uint8_t ret, cellId; - + ret = ROK; if(ueCb) { @@ -2495,7 +2513,7 @@ uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb) { DU_LOG("\nERROR --> DU APP : Failed to send DL RRC msg in duProcUeContextSetupRequest()"); DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\ - ueCb->f1UeDb->dlRrcMsg->rrcMsgSize); + ueCb->f1UeDb->dlRrcMsg->rrcMsgSize); DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg)); } } @@ -2503,10 +2521,10 @@ uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb) else if(ueCb->f1UeDb->actionType == UE_CTXT_SETUP) { ret = duBuildAndSendUeContextSetupReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg); - if(ret == RFAILED) - { + if(ret == RFAILED) + { DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextSetupRequest()"); - } + } } } else @@ -2516,26 +2534,99 @@ uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb) } return ret; } + /******************************************************************* -* -* @brief Process UE context modification request from CU -* -* @details -* -* Function : duProcUeContextModReq -* -* Functionality: Process UE context modification request from CU -* -* @params[in] DuUeCb *ueCb -* @return ROK - success -* RFAILED - failure -* -* ****************************************************************/ + * + * @brief Build and Send Ue context mod request + * + * @details + * + * + * Function : duBuildAndSendUeContextModReq + * + * Functionality: + * Build and Send Ue context mod request + * + * @params[in] cellId, crnti, DuUeCfg pointer + * @return ROK - success + * RFAILED - failure + * + *****************************************************************/ + +uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg) +{ + uint8_t ret = ROK; + + DU_LOG("\nDEBUG --> DU_APP: Processing Ue Context Mod Request for cellId [%d]", cellId); + /* Filling RLC Ue Reconfig */ + ret = duBuildAndSendUeReCfgReqToRlc(cellId, crnti, duUeCfg); + if(ret == RFAILED) + DU_LOG("\nERROR --> DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextModReq()"); + + /* Filling MAC Ue Reconfig */ + ret = duBuildAndSendUeReCfgReqToMac(cellId, crnti, duUeCfg); + if(ret == RFAILED) + DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextModReq()"); + + return ret; +} +/******************************************************************* + * + * @brief Processing Ue context mod request + * + * @details + * + * + * Function : duProcUeContextModReq + * + * Functionality: + * Processing Ue context mod request + * + * @params[in] DuUeCb *ueCb + * @return ROK - success + * RFAILED - failure + * + *****************************************************************/ + uint8_t duProcUeContextModReq(DuUeCb *ueCb) { - - //TODO:After RB configuration are done Mod Response is triggered - return ROK; + uint8_t ret, cellId; + + ret = ROK; + if(ueCb) + { + cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId; + /* Send DL RRC msg for security Mode */ + if(ueCb->f1UeDb->dlRrcMsg) + { + if(ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu) + { + /* Sending DL RRC Message to RLC */ + ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, ueCb->f1UeDb->dlRrcMsg); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU APP : Failed to send DL RRC msg in duProcUeContextModReq()"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\ + ueCb->f1UeDb->dlRrcMsg->rrcMsgSize); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg)); + } + } + } + else + { + ret = duBuildAndSendUeContextModReq(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU APP : Failed to build ue context setup Req in duProcUeContextModReq()"); + } + } + } + else + { + //TODO: To send the failure cause in UeContextModRsp + DU_LOG("ERROR --> DU APP : Failed to process UE CNTXT MOD REQ at duProcUeContextModReq()"); + } + return ROK; } /********************************************************************** End of file -- 2.16.6