From: lal.harshita Date: Mon, 5 Dec 2022 01:12:44 +0000 (+0530) Subject: [Epic-ID: ODUHIGH-464][Task-ID: ODUHIGH-479] WG8 Alignment | Second Phase | UeCfg... X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=o-du%2Fl2.git;a=commitdiff_plain;h=ca0353e5cb5699aecb6840efe9572934a1150e2b [Epic-ID: ODUHIGH-464][Task-ID: ODUHIGH-479] WG8 Alignment | Second Phase | UeCfg and ReCfg separation Change-Id: I018c528f2faabae0a20a1da872c75a8e3dcbc632 Signed-off-by: lal.harshita --- diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index 534b80eb2..296c20e45 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -237,6 +237,7 @@ struct macCellCb MacUlSlot ulSlot[MAX_SLOTS]; uint16_t numActvUe; MacUeCfg *ueCfgTmpData[MAX_NUM_UE]; + MacUeRecfg *ueRecfgTmpData[MAX_NUM_UE]; MacUeCb ueCb[MAX_NUM_UE]; MacCellCfg macCellCfg; SlotTimingInfo currTime; @@ -273,6 +274,7 @@ uint8_t sendSchedRptToRlc(DlSchedInfo dlInfo, SlotTimingInfo slotInfo, uint8_t u uint8_t macProcLongBsr(uint16_t cellId, uint16_t crnti,uint8_t numLcg,\ DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS]); void freeMacSliceCfgReq(MacSliceCfgReq *cfgReq,Pst *pst); +void deleteMacRaCb(uint16_t cellIdx, MacUeCb *ueCb); #endif /********************************************************************** End of file diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index b247bb168..018244cc1 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -43,6 +43,13 @@ MacDuUeCfgRspFunc macDuUeCfgRspOpts[] = packDuMacUeCfgRsp /* packing for light weight loosly coupled */ }; +MacDuUeRecfgRspFunc macDuUeRecfgRspOpts[] = +{ + packDuMacUeRecfgRsp, /* packing for loosely coupled */ + DuProcMacUeRecfgRsp, /* packing for tightly coupled */ + packDuMacUeRecfgRsp /* packing for light weight loosly coupled */ +}; + MacSchModUeConfigReqFunc macSchModUeConfigReqOpts[] = { packMacSchModUeConfigReq, /* packing for loosely coupled */ @@ -1355,15 +1362,14 @@ uint8_t fillSpCellCfg(SpCellCfg macSpCellCfg, SchSpCellCfg *schSpCellCfg) servCellCfg->numDlBwpToAdd = macSpCellCfg.servCellCfg.numDlBwpToAdd; if(servCellCfg->numDlBwpToAdd > MAX_NUM_BWP) { - DU_LOG("\nERROR --> MAC : Number of DL BWP to ADD/MOD [%d] exceeds max limit [%d]",\ + DU_LOG("\nERROR --> MAC : Number of DL BWP to ADD [%d] exceeds max limit [%d]",\ servCellCfg->numDlBwpToAdd, MAX_NUM_BWP); return RFAILED; } for(idx = 0; idx < servCellCfg->numDlBwpToAdd; idx++) { - /* TODO : As of now numDlBwpToAdd = 0 */ + memcpy(&servCellCfg->dlBwpToAddList[idx], &macSpCellCfg.servCellCfg.dlBwpToAddList[idx], sizeof(DlBwpInfo)); } - servCellCfg->firstActvDlBwpId = macSpCellCfg.servCellCfg.firstActvDlBwpId; servCellCfg->defaultDlBwpId = macSpCellCfg.servCellCfg.defaultDlBwpId; servCellCfg->bwpInactivityTmr = NULL; @@ -1391,19 +1397,124 @@ uint8_t fillSpCellCfg(SpCellCfg macSpCellCfg, SchSpCellCfg *schSpCellCfg) servCellCfg->numUlBwpToAdd = macSpCellCfg.servCellCfg.numUlBwpToAdd; if(servCellCfg->numUlBwpToAdd > MAX_NUM_BWP) { - DU_LOG("\nERROR --> MAC : Number of UL BWP to ADD/MOD [%d] exceeds max limit [%d]",\ + DU_LOG("\nERROR --> MAC : Number of UL BWP to ADD [%d] exceeds max limit [%d]",\ servCellCfg->numUlBwpToAdd, MAX_NUM_BWP); return RFAILED; } for(idx = 0; idx < servCellCfg->numUlBwpToAdd; idx++) { - /* TODO : As of now numDlBwpToAdd = 0 */ + memcpy(&servCellCfg->ulBwpToAddList[idx], &macSpCellCfg.servCellCfg.ulBwpToAddList[idx], sizeof(UlBwpInfo)); } servCellCfg->firstActvUlBwpId = macSpCellCfg.servCellCfg.firstActvUlBwpId; return ROK; } +/******************************************************************* + * + * @brief Fills Sp Cell Reconfig to be sent to scheduler + * + * @details + * + * Function : fillSpCellRecfg + * + * Functionality: Fills Sp Cell Reconfig to be sent to scheduler + * + * @params[in] macSpCellRecfg : SP cell Recfg at MAC + * schSpCellRecfg : SP cell Recfg to be filled + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t fillSpCellRecfg(SpCellRecfg macSpCellRecfg, SchSpCellRecfg *schSpCellRecfg) +{ + uint8_t idx; + SchServCellRecfgInfo *servCellRecfg; + + schSpCellRecfg->servCellIdx = macSpCellRecfg.servCellIdx; + servCellRecfg = &schSpCellRecfg->servCellRecfg; + + /* Fill initial DL BWP */ + if(fillInitialDlBwp(macSpCellRecfg.servCellCfg.initDlBwp, \ + &servCellRecfg->initDlBwp) != ROK ) + { + DU_LOG("\nERROR --> MAC : fillInitialDlBwp() failed"); + return RFAILED; + } + + servCellRecfg->numDlBwpToAddOrMod = macSpCellRecfg.servCellCfg.numDlBwpToAddOrMod; + if(servCellRecfg->numDlBwpToAddOrMod > MAX_NUM_BWP) + { + DU_LOG("\nERROR --> MAC : Number of DL BWP to ADD/MOD [%d] exceeds max limit [%d]",\ + servCellRecfg->numDlBwpToAddOrMod, MAX_NUM_BWP); + return RFAILED; + } + for(idx = 0; idx < servCellRecfg->numDlBwpToAddOrMod; idx++) + { + memcpy(&servCellRecfg->dlBwpToAddOrModList[idx], &macSpCellRecfg.servCellCfg.dlBwpToAddOrModList[idx], sizeof(DlBwpInfo)); + } + servCellRecfg->numDlBwpToRel = macSpCellRecfg.servCellCfg.numDlBwpToRel; + if(servCellRecfg->numDlBwpToRel > MAX_NUM_BWP) + { + DU_LOG("\nERROR --> MAC : Number of DL BWP to RELEASE [%d] exceeds max limit [%d]",\ + servCellRecfg->numDlBwpToRel, MAX_NUM_BWP); + return RFAILED; + } + for(idx = 0; idx < servCellRecfg->numDlBwpToRel; idx++) + { + memcpy(&servCellRecfg->dlBwpToRelList[idx], &macSpCellRecfg.servCellCfg.dlBwpToRelList[idx], sizeof(DlBwpInfo)); + } + servCellRecfg->firstActvDlBwpId = macSpCellRecfg.servCellCfg.firstActvDlBwpId; + servCellRecfg->defaultDlBwpId = macSpCellRecfg.servCellCfg.defaultDlBwpId; + servCellRecfg->bwpInactivityTmr = NULL; + if(macSpCellRecfg.servCellCfg.bwpInactivityTmr) + { + /* TODO : This is an optional parameter, not filled currently */ + } + + /* Fill PDSCH serving cell config */ + if(fillPdschServCellCfg(macSpCellRecfg.servCellCfg.pdschServCellCfg, \ + &servCellRecfg->pdschServCellCfg) != ROK) + { + DU_LOG("\nERROR --> MAC : fillPdschServCellCfg() failed"); + return RFAILED; + } + + /* Fill Initail UL BWP */ + if(fillInitialUlBwp(macSpCellRecfg.servCellCfg.initUlBwp, \ + &servCellRecfg->initUlBwp) != ROK) + { + DU_LOG("\nERROR --> MAC : fillInitialUlBwp() failed"); + return RFAILED; + } + + servCellRecfg->numUlBwpToAddOrMod = macSpCellRecfg.servCellCfg.numUlBwpToAddOrMod; + if(servCellRecfg->numUlBwpToAddOrMod > MAX_NUM_BWP) + { + DU_LOG("\nERROR --> MAC : Number of UL BWP to ADD/MOD [%d] exceeds max limit [%d]",\ + servCellRecfg->numUlBwpToAddOrMod, MAX_NUM_BWP); + return RFAILED; + } + for(idx = 0; idx < servCellRecfg->numUlBwpToAddOrMod; idx++) + { + memcpy(&servCellRecfg->ulBwpToAddOrModList[idx], &macSpCellRecfg.servCellCfg.ulBwpToAddOrModList[idx], sizeof(UlBwpInfo)); + } + servCellRecfg->numUlBwpToRel = macSpCellRecfg.servCellCfg.numUlBwpToRel; + if(servCellRecfg->numUlBwpToRel > MAX_NUM_BWP) + { + DU_LOG("\nERROR --> MAC : Number of UL BWP to RELEASE [%d] exceeds max limit [%d]",\ + servCellRecfg->numUlBwpToRel, MAX_NUM_BWP); + return RFAILED; + } + for(idx = 0; idx < servCellRecfg->numUlBwpToRel; idx++) + { + memcpy(&servCellRecfg->ulBwpToRelList[idx], &macSpCellRecfg.servCellCfg.ulBwpToRelList[idx], sizeof(UlBwpInfo)); + } + servCellRecfg->firstActvUlBwpId = macSpCellRecfg.servCellCfg.firstActvUlBwpId; + + return ROK; +} + /******************************************************************* * * @brief Sends UE configuration to Scheduler @@ -1420,21 +1531,30 @@ uint8_t fillSpCellCfg(SpCellCfg macSpCellCfg, SchSpCellCfg *schSpCellCfg) * * ****************************************************************/ -uint8_t sendUeReqToSch(Pst *pst, SchUeCfg *schUeCfg) +uint8_t sendUeReqToSch(Pst *pst, void *schUeCfg) { Pst schPst; switch(pst->event) { case EVENT_MAC_UE_CREATE_REQ: - FILL_PST_MAC_TO_SCH(schPst, EVENT_ADD_UE_CONFIG_REQ_TO_SCH); - return(*macSchAddUeConfigReqOpts[schPst.selector])(&schPst, schUeCfg); - + { + SchUeCfgReq *schUeCfgReq = NULLP; + schUeCfgReq = (SchUeCfgReq *)schUeCfg; + FILL_PST_MAC_TO_SCH(schPst, EVENT_ADD_UE_CONFIG_REQ_TO_SCH); + return(*macSchAddUeConfigReqOpts[schPst.selector])(&schPst, schUeCfgReq); + } case EVENT_MAC_UE_RECONFIG_REQ: - FILL_PST_MAC_TO_SCH(schPst, EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH); - return(*macSchModUeConfigReqOpts[schPst.selector])(&schPst,schUeCfg); + { + SchUeRecfgReq *schUeRecfgReq = NULLP; + schUeRecfgReq = (SchUeRecfgReq *)schUeCfg; + FILL_PST_MAC_TO_SCH(schPst, EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH); + return(*macSchModUeConfigReqOpts[schPst.selector])(&schPst,schUeRecfgReq); + } default: - DU_LOG("\nERROR --> Invalid Pst received %d", pst->event); - return RFAILED; + { + DU_LOG("\nERROR --> Invalid Pst received %d", pst->event); + return RFAILED; + } } } @@ -1532,7 +1652,6 @@ uint8_t fillLogicalChannelCfg(SchLcCfg *schLcCfg, LcCfg *macLcCfg) uint8_t sdIdx; uint8_t ret = ROK; schLcCfg->lcId = macLcCfg->lcId; - schLcCfg->configType = macLcCfg->configType; schLcCfg->dlLcCfg.lcp = macLcCfg->dlLcCfg.lcp; fillSchUlLcCfg(&schLcCfg->ulLcCfg, &macLcCfg->ulLcCfg); @@ -1592,13 +1711,13 @@ uint8_t fillLogicalChannelCfg(SchLcCfg *schLcCfg, LcCfg *macLcCfg) /******************************************************************* * - * @brief Fills Logical channel Cfg List to Add/Mod/Del + * @brief Fills Logical channel Cfg List to Add * * @details * * Function : fillSchLcCfgList * - * Functionality: Fills Logical channel Cfg List to Add/Mod/Del + * Functionality: Fills Logical channel Cfg List to Add * * @params[in] MAC UE Cb Cfg , MAC UE Configuration * @return ROK - success @@ -1606,7 +1725,7 @@ uint8_t fillLogicalChannelCfg(SchLcCfg *schLcCfg, LcCfg *macLcCfg) * * ****************************************************************/ -uint8_t fillSchLcCfgList(SchUeCfg *schUeCfg, MacUeCfg *ueCfg) +uint8_t fillSchLcCfgList(SchUeCfgReq *schUeCfg, MacUeCfg *ueCfg) { uint8_t lcIdx; @@ -1614,10 +1733,59 @@ uint8_t fillSchLcCfgList(SchUeCfg *schUeCfg, MacUeCfg *ueCfg) { if(fillLogicalChannelCfg(&schUeCfg->schLcCfg[lcIdx], &ueCfg->lcCfgList[lcIdx]) != ROK) { - DU_LOG("\nERROR --> MAC : fillLogicalChannelCfg() failed for lc Idx[%d]", lcIdx); - return RFAILED; + DU_LOG("\nERROR --> MAC : fillLogicalChannelCfg() failed for lc Idx[%d]", lcIdx); + return RFAILED; } - schUeCfg->numLcs++; + schUeCfg->numLcsToAdd++; + } + return ROK; +} + +/******************************************************************* + * + * @brief Fills Logical channel Recfg List to Add/Mod/Del + * + * @details + * + * Function : fillSchLcRecfgList + * + * Functionality: Fills Logical channel Recfg List to Add/Mod/Del + * + * @params[in] MAC UE Cb Recfg , MAC UE ReConfiguration + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t fillSchLcRecfgList(SchUeRecfgReq *schUeRecfg, MacUeRecfg *ueRecfg) +{ + uint8_t lcIdx; + + /*LC to ADD*/ + for(lcIdx = 0; lcIdx < ueRecfg->numLcsToAdd; lcIdx++) + { + if(fillLogicalChannelCfg(&schUeRecfg->schLcCfgAdd[lcIdx], &ueRecfg->lcCfgAdd[lcIdx]) != ROK) + { + DU_LOG("\nERROR --> MAC : fillLogicalChannelCfg() failed for lc Idx[%d]", lcIdx); + return RFAILED; + } + schUeRecfg->numLcsToAdd++; + } + /*LC to DEL*/ + for(lcIdx = 0; lcIdx < ueRecfg->numLcsToDel; lcIdx++) + { + schUeRecfg->lcIdToDel[lcIdx] = ueRecfg->lcIdToDel[lcIdx]; + schUeRecfg->numLcsToDel++; + } + /*LC to MOD*/ + for(lcIdx = 0; lcIdx < ueRecfg->numLcsToMod; lcIdx++) + { + if(fillLogicalChannelCfg(&schUeRecfg->schLcCfgMod[lcIdx], &ueRecfg->lcCfgMod[lcIdx]) != ROK) + { + DU_LOG("\nERROR --> MAC : fillLogicalChannelCfg() failed for lc Idx[%d]", lcIdx); + return RFAILED; + } + schUeRecfg->numLcsToMod++; } return ROK; } @@ -1637,14 +1805,13 @@ uint8_t fillSchLcCfgList(SchUeCfg *schUeCfg, MacUeCfg *ueCfg) * RFAILED - failure * * ****************************************************************/ -uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg) +uint8_t fillSchUeCfg(SchUeCfgReq *schUeCfg, MacUeCfg *ueCfg) { uint8_t ret = ROK; schUeCfg->cellId = ueCfg->cellId; schUeCfg->ueId = ueCfg->ueId; schUeCfg->crnti = ueCfg->crnti; - schUeCfg->dataTransmissionInfo = ueCfg->transmissionAction; /* Copy MAC cell group config */ if(ueCfg->macCellGrpCfgPres == true) { @@ -1703,7 +1870,7 @@ uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg) schUeCfg->ulModInfo.mcsIndex = ueCfg->ulModInfo.mcsIndex; schUeCfg->ulModInfo.mcsTable = ueCfg->ulModInfo.mcsTable; - /* Fill sch Lc Cfg to Add/ Mod/ Del */ + /* Fill sch Lc Cfg to Add*/ ret = fillSchLcCfgList(schUeCfg, ueCfg); if(ret == RFAILED) { @@ -1711,8 +1878,100 @@ uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg) return ret; } + return ret; +} + +/******************************************************************* + * + * @brief Fills and sends UE Re-configuration to Scheduler + * + * @details + * + * Function : fillSchUeRecfg + * + * Functionality: Fills and sends UE Reconfiguration to Scheduler + * + * @params[in] Ue configuration from DU APP + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t fillSchUeRecfg(SchUeRecfgReq *schUeRecfg, MacUeRecfg *ueRecfg) +{ + uint8_t ret = ROK; + + schUeRecfg->cellId = ueRecfg->cellId; + schUeRecfg->ueId = ueRecfg->ueId; + schUeRecfg->crnti = ueRecfg->crnti; + schUeRecfg->dataTransmissionInfo = ueRecfg->transmissionAction; + /* Copy MAC cell group config */ + if(ueRecfg->macCellGrpRecfgPres == true) + { + schUeRecfg->macCellGrpRecfgPres = true; + memset(&schUeRecfg->macCellGrpRecfg, 0, sizeof(SchMacCellGrpCfg)); + if(fillMacCellGroupCfg(ueRecfg->macCellGrpRecfg, &schUeRecfg->macCellGrpRecfg) != ROK) + { + DU_LOG("\nERROR --> MAC : fillMacCellGroupRecfg() failed"); + return RFAILED; + } + } + if(ueRecfg->phyCellGrpRecfgPres == true) + { + schUeRecfg->phyCellGrpRecfgPres = true; + /* Copy Physical cell group config */ + memset(&schUeRecfg->phyCellGrpRecfg, 0,sizeof(SchPhyCellGrpCfg)); + if(fillPhyCellGroupCfg(ueRecfg->phyCellGrpRecfg, &schUeRecfg->phyCellGrpRecfg) != ROK) + { + DU_LOG("\nERROR --> MAC : fillPhyCellGroupRecfg() failed"); + return RFAILED; + } + } + + if(ueRecfg->spCellRecfgPres == true) + { + schUeRecfg->spCellRecfgPres = true; + /* Copy sp cell config */ + memset(&schUeRecfg->spCellRecfg, 0, sizeof(SchSpCellCfg)); + if(fillSpCellRecfg(ueRecfg->spCellRecfg, &schUeRecfg->spCellRecfg) != ROK) + { + DU_LOG("\nERROR --> MAC : fillSpCellRecfg() failed"); + return RFAILED; + } + } + if(ueRecfg->ambrRecfg != NULLP) + { + MAC_ALLOC(schUeRecfg->ambrRecfg, sizeof(SchAmbrCfg)); + if(!schUeRecfg->ambrRecfg) + { + DU_LOG("\nERROR --> MAC : Memory allocation failed in sendReconfigReqToSch"); + return RFAILED; + } + schUeRecfg->ambrRecfg->ulBr = ueRecfg->ambrRecfg->ulBr; + } + else + { + schUeRecfg->ambrRecfg = NULLP; + } + /* Fill DL modulation infor */ + schUeRecfg->dlModInfo.modOrder = ueRecfg->dlModInfo.modOrder; + schUeRecfg->dlModInfo.mcsIndex = ueRecfg->dlModInfo.mcsIndex; + schUeRecfg->dlModInfo.mcsTable = ueRecfg->dlModInfo.mcsTable; + + /* Fill UL modulation infor */ + schUeRecfg->ulModInfo.modOrder = ueRecfg->ulModInfo.modOrder; + schUeRecfg->ulModInfo.mcsIndex = ueRecfg->ulModInfo.mcsIndex; + schUeRecfg->ulModInfo.mcsTable = ueRecfg->ulModInfo.mcsTable; + + /* Fill sch Lc Cfg to Add/ Mod/ Del */ + ret = fillSchLcRecfgList(schUeRecfg, ueRecfg); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> MAC : Failed to copy LCs at fillSchUeRecfg()"); + return ret; + } + #ifdef NR_DRX - schUeCfg->drxConfigIndicatorRelease = ueCfg->drxConfigIndicatorRelease;; + schUeRecfg->drxConfigIndicatorRelease = ueRecfg->drxConfigIndicatorRelease;; #endif return ret; @@ -1812,53 +2071,52 @@ void updateMacDlCb(uint8_t delIdx, UeDlCb *dlCb) * * Functionality: Update UeUlCb Lc List * - * @params[in] UeUlCb pointer, ueLcCfg(received from DUAPP) + * @params[in] UeUlCb pointer [For DEL case, NULL is passed] + * ueLcCfg(received from DUAPP) + * lcIdToDel [For MOD case, Invalid Value = MAX_NUM_LC is passed] * @return void * * ****************************************************************/ -void updateMacUlLcCtxt(UeUlCb *ulInfo, LcCfg *ueLcCfg) +void updateMacUlLcCtxt(UeUlCb *ulInfo, LcCfg *ueLcCfg, uint8_t lcIdToDel) { uint8_t ueLcIdx = 0; /*Traversing UL LC to be updated/Deleted*/ for(ueLcIdx = 0; ueLcIdx < ulInfo->numUlLc; ueLcIdx++) { - if(ulInfo->lcCb[ueLcIdx].lcId == ueLcCfg->lcId) + if((ueLcCfg != NULLP) && (ulInfo->lcCb[ueLcIdx].lcId == ueLcCfg->lcId)) { - if(ueLcCfg->configType == CONFIG_MOD) - { - /*Modify UL LC CB */ - ulInfo->lcCb[ueLcIdx].lcGrpId = ueLcCfg->ulLcCfg.lcGroup; + /*Modify UL LC CB */ + ulInfo->lcCb[ueLcIdx].lcGrpId = ueLcCfg->ulLcCfg.lcGroup; - /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/ + /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/ #if 0 - /*Modifying/Copying PduSession ID and S-NSSAI into MAC's UECB*/ - if(ueLcCfg->drbQos) + /*Modifying/Copying PduSession ID and S-NSSAI into MAC's UECB*/ + if(ueLcCfg->drbQos) + { + ulInfo->lcCb[ueLcIdx].pduSessionId = ueLcCfg->drbQos->pduSessionId; + } + if(ueLcCfg->snssai) + { + if(ulInfo->lcCb[ueLcIdx].snssai == NULLP) { - ulInfo->lcCb[ueLcIdx].pduSessionId = ueLcCfg->drbQos->pduSessionId; + MAC_ALLOC(ulInfo->lcCb[ueLcIdx].snssai, sizeof(Snssai)); } - if(ueLcCfg->snssai) - { - if(ulInfo->lcCb[ueLcIdx].snssai == NULLP) - { - MAC_ALLOC(ulInfo->lcCb[ueLcIdx].snssai, sizeof(Snssai)); - } - memcpy(ulInfo->lcCb[ueLcIdx].snssai, ueLcCfg->snssai, sizeof(Snssai)); - } -#endif - DU_LOG("\nINFO --> MAC: Successfully Modified LC context for lcId[%d], ueLcIdx:%d",\ - ueLcCfg->lcId,ueLcIdx); - break; - } - if(ueLcCfg->configType == CONFIG_DEL) - { - memset(&ulInfo->lcCb[ueLcIdx], 0, sizeof(UlLcCb)); - (ulInfo->numUlLc)--; - updateMacUlCb(ueLcIdx, ulInfo); - DU_LOG("\nINFO --> MAC: Successfully Deleted LC context for lcId[%d]", ueLcCfg->lcId); - break; + memcpy(ulInfo->lcCb[ueLcIdx].snssai, ueLcCfg->snssai, sizeof(Snssai)); } +#endif + DU_LOG("\nINFO --> MAC: Successfully Modified LC context for lcId[%d], ueLcIdx:%d",\ + ueLcCfg->lcId,ueLcIdx); + break; + } + else if(lcIdToDel != MAX_NUM_LC && (ulInfo->lcCb[ueLcIdx].lcId == lcIdToDel)) + { + memset(&ulInfo->lcCb[ueLcIdx], 0, sizeof(UlLcCb)); + (ulInfo->numUlLc)--; + updateMacUlCb(ueLcIdx, ulInfo); + DU_LOG("\nINFO --> MAC: Successfully Deleted LC context for lcId[%d]", lcIdToDel); + break; } } } @@ -1873,53 +2131,53 @@ void updateMacUlLcCtxt(UeUlCb *ulInfo, LcCfg *ueLcCfg) * * Functionality: Update UeDlCb Lc List * - * @params[in] UeDlCb pointer, ueLcCfg(received from DUAPP) + * @params[in] UeDlCb pointer [For DEL case, NULL is passed] + * ueLcCfg(received from DUAPP) + * lcIdToDel [For MOD case, Invalid Value = MAX_NUM_LC is passed] * @return void * * ****************************************************************/ -void updateMacDlLcCtxt(UeDlCb *dlInfo, LcCfg *ueLcCfg) +void updateMacDlLcCtxt(UeDlCb *dlInfo, LcCfg *ueLcCfg, uint8_t lcIdToDel) { uint8_t ueLcIdx = 0; /*Traversing DL LC to be updated/Deleted*/ for(ueLcIdx = 0; ueLcIdx < dlInfo->numDlLc; ueLcIdx++) { - if(dlInfo->lcCb[ueLcIdx].lcId == ueLcCfg->lcId) + if((ueLcCfg != NULLP) && (dlInfo->lcCb[ueLcIdx].lcId == ueLcCfg->lcId)) { - if(ueLcCfg->configType == CONFIG_MOD) - { - /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/ + /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/ #if 0 - /*Modifying/Copying PduSession ID and S-NSSAI into MAC's UECB*/ - if(ueLcCfg->drbQos) + /*Modifying/Copying PduSession ID and S-NSSAI into MAC's UECB*/ + if(ueLcCfg->drbQos) + { + dlInfo->lcCb[ueLcIdx].pduSessionId = ueLcCfg->drbQos->pduSessionId; + } + if(ueLcCfg->snssai) + { + if(dlInfo->lcCb[ueLcIdx].snssai == NULLP) { - dlInfo->lcCb[ueLcIdx].pduSessionId = ueLcCfg->drbQos->pduSessionId; + MAC_ALLOC(dlInfo->lcCb[ueLcIdx].snssai, sizeof(Snssai)); } - if(ueLcCfg->snssai) - { - if(dlInfo->lcCb[ueLcIdx].snssai == NULLP) - { - MAC_ALLOC(dlInfo->lcCb[ueLcIdx].snssai, sizeof(Snssai)); - } - memcpy(dlInfo->lcCb[ueLcIdx].snssai, ueLcCfg->snssai, sizeof(Snssai)); - } -#endif - DU_LOG("\nINFO --> MAC: Successfully Modified LC context for lcId[%d], ueLcIdx:%d",\ - ueLcCfg->lcId,ueLcIdx); - break; - } - if(ueLcCfg->configType == CONFIG_DEL) - { - memset(&dlInfo->lcCb[ueLcIdx], 0, sizeof(DlLcCb)); - (dlInfo->numDlLc)--; - updateMacDlCb(ueLcIdx, dlInfo); - DU_LOG("\nINFO --> MAC: Successfully Deleted LC context for lcId[%d]", ueLcCfg->lcId); - break; + memcpy(dlInfo->lcCb[ueLcIdx].snssai, ueLcCfg->snssai, sizeof(Snssai)); } +#endif + DU_LOG("\nINFO --> MAC: Successfully Modified LC context for lcId[%d], ueLcIdx:%d",\ + ueLcCfg->lcId,ueLcIdx); + break; + } + else if(lcIdToDel != MAX_NUM_LC && (dlInfo->lcCb[ueLcIdx].lcId == lcIdToDel)) + { + memset(&dlInfo->lcCb[ueLcIdx], 0, sizeof(DlLcCb)); + (dlInfo->numDlLc)--; + updateMacDlCb(ueLcIdx, dlInfo); + DU_LOG("\nINFO --> MAC: Successfully Deleted LC context for lcId[%d]", lcIdToDel); + break; } } } + /******************************************************************* * * @brief Fills Logical channel Cfg List to Add/Mod/Del @@ -1944,8 +2202,6 @@ uint8_t fillMacLcCfgList(MacUeCb *ueCb, MacUeCfg *ueCfg) { if(ueCb->dlInfo.numDlLc < MAX_NUM_LC) { - if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_ADD) - { /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/ #if 0 /*Copying PduSession ID and S-NSSAI into MAC's UECB*/ @@ -1985,12 +2241,90 @@ uint8_t fillMacLcCfgList(MacUeCb *ueCb, MacUeCfg *ueCfg) ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcGrpId = ueCfg->lcCfgList[lcIdx].ulLcCfg.lcGroup; ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcActive = MAC_LC_STATE_ACTIVE; ueCb->ulInfo.numUlLc++; - }/*End of Add Config */ - else + } + } + return ROK; +} + +/******************************************************************* + * + * @brief Fills Logical channel Cfg List to Add/Mod/Del + * + * @details + * + * Function : updateMacLcCfgList + * + * Functionality: Fills Logical channel Cfg List to Add/Mod/Del + * + * @params[in] MAC UE Cb Cfg , MAC UE Configuration + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t updateMacLcCfgList(MacUeCb *ueCb, MacUeRecfg *ueRecfg) +{ + uint8_t lcIdx = 0; + + for(lcIdx = 0; lcIdx < ueRecfg->numLcsToAdd; lcIdx++) + { + if(ueCb->dlInfo.numDlLc < MAX_NUM_LC) + { + /*Commenting as S-NSSAI and PDU session will be stored in MAC DB in future scope*/ +#if 0 + /*Copying PduSession ID and S-NSSAI into MAC's UECB*/ + if(ueRecfg->lcCfgList[lcIdx].drbQos) + { + ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].pduSessionId = \ + ueRecfg->lcCfgList[lcIdx].drbQos->pduSessionId; + + ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].pduSessionId = \ + ueRecfg->lcCfgList[lcIdx].drbQos->pduSessionId; + } + if(ueRecfg->lcCfgList[lcIdx].snssai) { - updateMacUlLcCtxt(&ueCb->ulInfo, &ueCfg->lcCfgList[lcIdx]); - updateMacDlLcCtxt(&ueCb->dlInfo, &ueCfg->lcCfgList[lcIdx]); - }/*End of Mod Config */ + if(ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].snssai == NULLP) + { + MAC_ALLOC(ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].snssai, sizeof(Snssai)); + } + if(ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].snssai == NULLP) + { + MAC_ALLOC(ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].snssai, sizeof(Snssai)); + } + + memcpy(ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].snssai, \ + ueRecfg->lcCfgList[lcIdx].snssai, sizeof(Snssai)); + + memcpy(ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].snssai, \ + ueRecfg->lcCfgList[lcIdx].snssai, sizeof(Snssai)); + + } +#endif + /*Filling DL LC CB */ + ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcId = ueRecfg->lcCfgAdd[lcIdx].lcId; + ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcState = MAC_LC_STATE_ACTIVE; + ueCb->dlInfo.numDlLc++; + /*Filling UL LC CB */ + ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcId = ueRecfg->lcCfgAdd[lcIdx].lcId; + ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcGrpId = ueRecfg->lcCfgAdd[lcIdx].ulLcCfg.lcGroup; + ueCb->ulInfo.lcCb[ueCb->ulInfo.numUlLc].lcActive = MAC_LC_STATE_ACTIVE; + ueCb->ulInfo.numUlLc++; + }/*End of Add Config */ + } + for(lcIdx = 0; lcIdx < ueRecfg->numLcsToDel; lcIdx++) + { + if(ueCb->dlInfo.numDlLc < MAX_NUM_LC) + { + updateMacUlLcCtxt(&ueCb->ulInfo, NULLP, ueRecfg->lcIdToDel[lcIdx]); + updateMacDlLcCtxt(&ueCb->dlInfo, NULLP, ueRecfg->lcIdToDel[lcIdx]); + } + } + for(lcIdx = 0; lcIdx < ueRecfg->numLcsToMod; lcIdx++) + { + if(ueCb->dlInfo.numDlLc < MAX_NUM_LC) + { + updateMacUlLcCtxt(&ueCb->ulInfo, &ueRecfg->lcCfgMod[lcIdx], MAX_NUM_LC); + updateMacDlLcCtxt(&ueCb->dlInfo, &ueRecfg->lcCfgMod[lcIdx], MAX_NUM_LC); } } return ROK; @@ -2038,7 +2372,52 @@ uint8_t fillMacUeCb(MacUeCb *ueCb, MacUeCfg *ueCfg, uint8_t cellIdx) { DU_LOG("\nERROR --> MAC: Failed while filing MAC LC List at fillMacUeCb()"); } - ueCb->transmissionAction = ueCfg->transmissionAction; + return ret; +} + +/******************************************************************* + * + * @brief Fills MAC UE Cb Cfg + * + * @details + * + * Function : updateMacUeCb + * + * Functionality: updateMacUeCbs MAC UE Cb Cfg + * + * @params[in] MAC UE Cb Recfg , MAC UE Configuration + * cellIdx + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t updateMacUeCb(MacUeCb *ueCb, MacUeRecfg *ueRecfg, uint8_t cellIdx) +{ + uint8_t ret = ROK; + + ueCb->ueId = ueRecfg->ueId; + ueCb->crnti = ueRecfg->crnti; + ueCb->cellCb = macCb.macCell[cellIdx]; + if(ueRecfg->spCellRecfgPres) + { + ueCb->dlInfo.dlHarqEnt.numHarqProcs = \ + ueRecfg->spCellRecfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch; + } + + /*TODO: To check the bsr value during implementation */ + if(ueRecfg->macCellGrpRecfgPres) + { + ueCb->bsrTmrCfg.periodicTimer = ueRecfg->macCellGrpRecfg.bsrTmrCfg.periodicTimer; + ueCb->bsrTmrCfg.retxTimer = ueRecfg->macCellGrpRecfg.bsrTmrCfg.retxTimer; + ueCb->bsrTmrCfg.srDelayTimer = ueRecfg->macCellGrpRecfg.bsrTmrCfg.srDelayTimer; + } + ret = updateMacLcCfgList(ueCb, ueRecfg); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> MAC: Failed while filing MAC LC List at updateMacUeCb()"); + } + ueCb->transmissionAction = ueRecfg->transmissionAction; return ret; } @@ -2181,15 +2560,15 @@ uint8_t createUeCb(uint8_t cellIdx, MacUeCb *ueCb, MacUeCfg *ueCfg) * RFAILED - failure * * ****************************************************************/ -uint8_t modifyUeCb(uint8_t cellIdx, MacUeCb *ueCb, MacUeCfg *ueCfg) +uint8_t modifyUeCb(uint8_t cellIdx, MacUeCb *ueCb, MacUeRecfg *ueRecfg) { uint8_t ret = ROK; - if((ueCb->ueId == ueCfg->ueId) && (ueCb->crnti == ueCfg->crnti)\ + if((ueCb->ueId == ueRecfg->ueId) && (ueCb->crnti == ueRecfg->crnti)\ &&(ueCb->state == UE_STATE_ACTIVE)) { - DU_LOG("\nINFO --> MAC : Modifying Ue config Req for CRNTI %d ", ueCfg->crnti); - ret = fillMacUeCb(ueCb, ueCfg, cellIdx); + DU_LOG("\nINFO --> MAC : Modifying Ue config Req for CRNTI %d ", ueRecfg->crnti); + ret = updateMacUeCb(ueCb, ueRecfg, cellIdx); if(ret != ROK) { DU_LOG("\nERROR --> MAC : Failed to modify MacUeCb at modifyUeCb()"); @@ -2220,19 +2599,30 @@ uint8_t modifyUeCb(uint8_t cellIdx, MacUeCb *ueCb, MacUeCfg *ueCfg) * * ****************************************************************/ -uint8_t procMacUeCfgData(Pst *pst, MacUeCfg *ueCfg) +uint8_t procMacUeCfgData(Pst *pst, MacUeCfg *ueCfg, MacUeRecfg *ueRecfg) { - uint8_t ret = ROK; - uint16_t cellIdx; + uint8_t ret = ROK, ueId = 0; + uint16_t cellIdx, cellId; MacUeCb *ueCb = NULLP; + if(ueCfg != NULLP) + { + cellId = ueCfg->cellId; + ueId = ueCfg->ueId; + } + else if(ueRecfg != NULLP) + { + cellId = ueRecfg->cellId; + ueId = ueRecfg->ueId; + } + - GET_CELL_IDX(ueCfg->cellId, cellIdx); + GET_CELL_IDX(cellId, cellIdx); /* Validate cell id */ - if(macCb.macCell[cellIdx]->cellId != ueCfg->cellId) + if(macCb.macCell[cellIdx]->cellId != cellId) { - DU_LOG("\nERROR --> MAC : Cell Id %d not configured", ueCfg->cellId); + DU_LOG("\nERROR --> MAC : Cell Id %d not configured", cellId); return RFAILED; } @@ -2244,7 +2634,7 @@ uint8_t procMacUeCfgData(Pst *pst, MacUeCfg *ueCfg) } /* Check if UE already configured */ - ueCb = &macCb.macCell[cellIdx]->ueCb[ueCfg->ueId -1]; + ueCb = &macCb.macCell[cellIdx]->ueCb[ueId -1]; switch(pst->event) { @@ -2258,7 +2648,7 @@ uint8_t procMacUeCfgData(Pst *pst, MacUeCfg *ueCfg) case EVENT_UE_RECONFIG_RSP_TO_MAC: { - ret = modifyUeCb(cellIdx, ueCb, ueCfg); + ret = modifyUeCb(cellIdx, ueCb, ueRecfg); if(ret != ROK) DU_LOG("\nERROR --> MAC: ModifyUeConfigReq for cellIdx :%d failed at procMacUeCfgData()", cellIdx); break; @@ -2287,20 +2677,38 @@ uint8_t procMacUeCfgData(Pst *pst, MacUeCfg *ueCfg) * * ****************************************************************/ -uint8_t copyToTmpData(MacUeCfg *ueCfg) +uint8_t copyToTmpData(MacUeCfg *ueCfg, MacUeRecfg *ueRecfg) { uint8_t cellIdx; - MacUeCfg *tmpData = NULLP; - MAC_ALLOC(tmpData, sizeof(MacUeCfg)); - if(!tmpData) + if(ueCfg != NULLP) { - DU_LOG("\nERROR --> MAC: Memory Alloc Failed at copyToTmpData()"); - return RFAILED; + MacUeCfg *tmpData = NULLP; + + MAC_ALLOC(tmpData, sizeof(MacUeCfg)); + if(!tmpData) + { + DU_LOG("\nERROR --> MAC: Memory Alloc Failed at copyToTmpData()"); + return RFAILED; + } + memcpy(tmpData, ueCfg, sizeof(MacUeCfg)); + GET_CELL_IDX(ueCfg->cellId, cellIdx); + macCb.macCell[cellIdx]->ueCfgTmpData[ueCfg->ueId-1] = tmpData; + } + else if(ueRecfg != NULLP) + { + MacUeRecfg *tmpData = NULLP; + + MAC_ALLOC(tmpData, sizeof(MacUeRecfg)); + if(!tmpData) + { + DU_LOG("\nERROR --> MAC: Memory Alloc Failed at copyToTmpData()"); + return RFAILED; + } + memcpy(tmpData, ueRecfg, sizeof(MacUeRecfg)); + GET_CELL_IDX(ueRecfg->cellId, cellIdx); + macCb.macCell[cellIdx]->ueRecfgTmpData[ueRecfg->ueId-1] = tmpData; } - memcpy(tmpData, ueCfg, sizeof(MacUeCfg)); - GET_CELL_IDX(ueCfg->cellId, cellIdx); - macCb.macCell[cellIdx]->ueCfgTmpData[ueCfg->ueId-1] = tmpData; return ROK; } @@ -2322,8 +2730,8 @@ uint8_t copyToTmpData(MacUeCfg *ueCfg) uint8_t MacProcUeCreateReq(Pst *pst, MacUeCfg *ueCfg) { uint8_t ret = ROK; - SchUeCfg schUeCfg; - memset(&schUeCfg, 0, sizeof(SchUeCfg)); + SchUeCfgReq schUeCfg; + memset(&schUeCfg, 0, sizeof(SchUeCfgReq)); DU_LOG("\nINFO --> MAC : UE Create Request for CRNTI[%d]", ueCfg->crnti); @@ -2337,11 +2745,11 @@ uint8_t MacProcUeCreateReq(Pst *pst, MacUeCfg *ueCfg) } /*Storing received ueCfg in ueCfgTmpData */ - ret = copyToTmpData(ueCfg); + ret = copyToTmpData(ueCfg, NULLP); if(ret == ROK) { /*Sending Cfg Req to SCH */ - ret = fillSchUeCfg(pst, &schUeCfg, ueCfg); + ret = fillSchUeCfg(&schUeCfg, ueCfg); if(ret != ROK) DU_LOG("\nERROR --> MAC : Failed to fill Sch Ue Cfg at MacProcUeCreateReq()"); else @@ -2424,28 +2832,28 @@ uint8_t MacSendUeCreateRsp(MacRsp result, SchUeCfgRsp *schCfgRsp) * RFAILED - failure * * ****************************************************************/ -uint8_t MacSendUeReconfigRsp(MacRsp result, SchUeCfgRsp *schCfgRsp) +uint8_t MacSendUeReconfigRsp(MacRsp result, SchUeRecfgRsp *schCfgRsp) { - MacUeCfgRsp *cfgRsp; + MacUeRecfgRsp *recfgRsp; Pst rspPst; - MAC_ALLOC_SHRABL_BUF(cfgRsp, sizeof(MacUeCfgRsp)); - if(!cfgRsp) + MAC_ALLOC_SHRABL_BUF(recfgRsp, sizeof(MacUeRecfgRsp)); + if(!recfgRsp) { DU_LOG("\nERROR --> MAC: Memory allocation for UE Reconfig response failed"); return RFAILED; } /* Filling UE Config response */ - memset(cfgRsp, 0, sizeof(MacUeCfgRsp)); - cfgRsp->cellId = schCfgRsp->cellId; - cfgRsp->ueId = schCfgRsp->ueId; - cfgRsp->result = result; + memset(recfgRsp, 0, sizeof(MacUeRecfgRsp)); + recfgRsp->cellId = schCfgRsp->cellId; + recfgRsp->ueId = schCfgRsp->ueId; + recfgRsp->result = result; /* Fill Post structure and send UE Create response*/ memset(&rspPst, 0, sizeof(Pst)); FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_RECONFIG_RSP); - return (*macDuUeCfgRspOpts[rspPst.selector])(&rspPst, cfgRsp); + return (*macDuUeRecfgRspOpts[rspPst.selector])(&rspPst, recfgRsp); } /******************************************************************* @@ -2480,6 +2888,38 @@ MacUeCfg *getMacUeCfg(uint16_t cellIdx, uint8_t ueId) return ueCfg; } +/******************************************************************* + * + * @brief Function to return Mac Ue Recfg pointer + * + * @details + * + * Function : getMacUeRecfg + * + * Functionality: + * Function to return Mac Ue Recfg pointer + * + * @params[in] cellIdx, ueId + * + * @return MacUeRecfg pointer - success + * NULLP - failure + * + * ****************************************************************/ + +MacUeRecfg *getMacUeRecfg(uint16_t cellIdx, uint8_t ueId) +{ + MacUeRecfg *ueRecfg = NULLP; + if(macCb.macCell[cellIdx]) + { + ueRecfg = macCb.macCell[cellIdx]->ueRecfgTmpData[ueId-1]; + } + else + { + DU_LOG("\nERROR --> MAC: Failed to get macCellCb in getMacUeRecfg()"); + } + return ueRecfg; +} + /******************************************************************* * * @brief Processes UE create response from scheduler @@ -2519,7 +2959,7 @@ uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *schCfgRsp) break; } #endif - + GET_CELL_IDX(schCfgRsp->cellId, cellIdx); ueCfg = getMacUeCfg(cellIdx, schCfgRsp->ueId); if(ueCfg == NULLP) @@ -2528,57 +2968,95 @@ uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *schCfgRsp) ret = RFAILED; } - switch(pst->event) + if(schCfgRsp->rsp != RSP_NOK) { - case EVENT_UE_CONFIG_RSP_TO_MAC: + DU_LOG("\nINFO --> MAC: SCH UeConfigRsp for CRNTI[%d] is success in MacProcSchUeCfgRsp()", schCfgRsp->crnti); + if(ret == ROK) + { + ret = procMacUeCfgData(pst, ueCfg, NULLP); + if(ret == ROK) { - if(schCfgRsp->rsp != RSP_NOK) - { - DU_LOG("\nINFO --> MAC: SCH UeConfigRsp for CRNTI[%d] is success in MacProcSchUeCfgRsp()", schCfgRsp->crnti); - if(ret == ROK) - { - ret = procMacUeCfgData(pst, ueCfg); - if(ret == ROK) - { - result = MAC_DU_APP_RSP_OK; - } - } - } - else - { - DU_LOG("\nERROR --> MAC: SCH UeConfigRsp for CRNTI[%d] is failed in MacProcSchUeCfgRsp()", schCfgRsp->crnti); - } - ret = MacSendUeCreateRsp(result, schCfgRsp); + result = MAC_DU_APP_RSP_OK; } - break; + } + } + else + { + DU_LOG("\nERROR --> MAC: SCH UeConfigRsp for CRNTI[%d] is failed in MacProcSchUeCfgRsp()", schCfgRsp->crnti); + } + ret = MacSendUeCreateRsp(result, schCfgRsp); + MAC_FREE(ueCfg, sizeof(MacUeCfg)); + ueCfg = NULLP; + return ret; +} + +/******************************************************************* + * + * @brief Processes UE create response from scheduler + * + * @details + * + * Function : MacProcSchUeRecfgRsp + * + * Functionality: + * Processes UE ReConfig response from scheduler + * Sends UE Reconfig response to DU APP + * + * @params[in] Pst : Post structure + * schRecfgRsp : Scheduler UE Recfg response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacProcSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *schRecfgRsp) +{ + uint8_t result = MAC_DU_APP_RSP_NOK; + uint8_t ret = ROK; + uint16_t cellIdx; + MacUeRecfg *ueRecfg = NULLP; +#ifdef CALL_FLOW_DEBUG_LOG + switch(pst->event) + { case EVENT_UE_RECONFIG_RSP_TO_MAC: - { + DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_UE_RECONFIG_RSP_TO_MAC\n"); + break; + default: + DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : Invalid Event\n"); + break; + } +#endif - if(schCfgRsp->rsp != RSP_NOK) - { - DU_LOG("\nINFO --> MAC: SCH UeReconfigRsp for CRNTI[%d] is success in MacProcSchUeCfgRsp()",\ - schCfgRsp->crnti); - if(ret == ROK) - { - ret = procMacUeCfgData(pst, ueCfg); - if(ret == ROK) - { - result = MAC_DU_APP_RSP_OK; - } - } - } - else - { - DU_LOG("\nERROR --> MAC: SCH UeReconfigRsp for CRNTI[%d] is failed in MacProcSchUeCfgRsp()",\ - schCfgRsp->crnti); - } - ret = MacSendUeReconfigRsp(result, schCfgRsp); + GET_CELL_IDX(schRecfgRsp->cellId, cellIdx); + ueRecfg = getMacUeRecfg(cellIdx, schRecfgRsp->ueId); + if(ueRecfg == NULLP) + { + DU_LOG("\nERROR --> MAC : Failed to find the Mac Ue Cfg for event [%d] in MacProcSchUeCfgRsp()", pst->event); + ret = RFAILED; + } + + + if(schRecfgRsp->rsp != RSP_NOK) + { + DU_LOG("\nINFO --> MAC: SCH UeReconfigRsp for CRNTI[%d] is success in MacProcSchUeCfgRsp()",\ + schRecfgRsp->crnti); + if(ret == ROK) + { + ret = procMacUeCfgData(pst, NULLP, ueRecfg); + if(ret == ROK) + { + result = MAC_DU_APP_RSP_OK; } - break; + } } - MAC_FREE(ueCfg, sizeof(MacUeCfg)); - ueCfg = NULLP; + else + { + DU_LOG("\nERROR --> MAC: SCH UeReconfigRsp for CRNTI[%d] is failed in MacProcSchUeCfgRsp()",\ + schRecfgRsp->crnti); + } + ret = MacSendUeReconfigRsp(result, schRecfgRsp); + MAC_FREE(ueRecfg, sizeof(MacUeRecfg)); + ueRecfg = NULLP; return ret; } @@ -2597,28 +3075,28 @@ uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *schCfgRsp) * RFAILED - failure * * ****************************************************************/ -uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) +uint8_t MacProcUeReconfigReq(Pst *pst, MacUeRecfg *ueRecfg) { uint8_t ret = ROK; - SchUeCfg schUeCfg; - memset(&schUeCfg, 0, sizeof(SchUeCfg)); + SchUeRecfgReq schUeRecfg; + memset(&schUeRecfg, 0, sizeof(SchUeRecfgReq)); - DU_LOG("\nINFO --> MAC : UE Reconfig Request for CRNTI[%d]", ueCfg->crnti); + DU_LOG("\nINFO --> MAC : UE Reconfig Request for CRNTI[%d]", ueRecfg->crnti); - if(ueCfg) + if(ueRecfg) { - /*Storing received ueCfg in ueCfgTmpData */ - ret = copyToTmpData(ueCfg); + /*Storing received ueRecfg in ueCfgTmpData */ + ret = copyToTmpData(NULLP, ueRecfg); if(ret == ROK) { /*Sending Cfg Req to SCH */ - ret = fillSchUeCfg(pst, &schUeCfg, ueCfg); + ret = fillSchUeRecfg(&schUeRecfg, ueRecfg); 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); + /* Fill event and send UE Reconfiguration request to SCH */ + ret = sendUeReqToSch(pst, &schUeRecfg); if(ret != ROK) DU_LOG("\nERROR --> MAC : Failed to send UE Reconfig Request to SCH"); } @@ -2630,11 +3108,11 @@ uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) } else { - DU_LOG("\nERROR --> MAC : MAC UE Create request processing failed"); + DU_LOG("\nERROR --> MAC : MAC UE Reconfiguration request processing failed"); ret = RFAILED; } /* FREE shared memory */ - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(MacUeCfg)); + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueRecfg, sizeof(MacUeRecfg)); return ROK; } diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 7309e304b..968bc9f87 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -395,7 +395,7 @@ typedef struct schUeCfgCb bool phyCellGrpCfgPres; SchPhyCellGrpCfg phyCellGrpCfg; bool spCellCfgPres; - SchSpCellCfg spCellCfg; + SchSpCellRecfg spCellCfg; SchAmbrCfg *ambrCfg; SchModulationInfo dlModInfo; SchModulationInfo ulModInfo; diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index f98610a76..c8a6cca95 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -428,11 +428,11 @@ uint16_t fillPucchResourceInfo(SchPucchInfo *schPucchInfo, Inst inst, SlotTiming return RFAILED; } #endif - if(cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfgPres) + if(cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfgPres) { /* fill pucch dedicated cfg */ ret = fillUlSchedPucchDedicatedCfg(cell,\ - &cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg, &slotInfo, schPucchInfo); + &cell->ueCb[ueIdx].ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg, &slotInfo, schPucchInfo); if(ret == RFAILED) { memset(schPucchInfo, 0, sizeof(SchPucchInfo)); @@ -816,8 +816,8 @@ uint8_t schDlRsrcAllocDlMsg(SchCellCb *cell, SlotTimingInfo slotTime, uint16_t c GET_UE_ID(crnti, ueId); ueCb = cell->ueCb[ueId-1]; - coreset1 = ueCb.ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0]; - pdschCfg = ueCb.ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg; + coreset1 = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0]; + pdschCfg = ueCb.ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg; /* fill BWP */ bwp->freqAlloc.numPrb = MAX_NUM_RB; @@ -2039,8 +2039,8 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId if(schGetSlotSymbFrmt(dciTime.slot, cell->slotFrmtBitMap) == DL_SLOT) #endif { - if(ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.k2TblPrsnt) - k2InfoTbl = &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.k2InfoTbl; + if(ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2TblPrsnt) + k2InfoTbl = &ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2InfoTbl; else k2InfoTbl = &cell->cellCfg.schInitialUlBwp.k2InfoTbl; @@ -2048,7 +2048,7 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId { k2Index = k2InfoTbl->k2TimingInfo[dciTime.slot].k2Indexes[k2TblIdx]; - if(!ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.k2TblPrsnt) + if(!ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2TblPrsnt) { k2Val = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].k2; startSymb = cell->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].startSymbol; @@ -2056,9 +2056,9 @@ bool schProcessSrOrBsrReq(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId } else { - k2Val = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[k2Index].k2; - startSymb = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[k2Index].startSymbol; - symbLen = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList[k2Index].symbolLength; + k2Val = ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.puschCfg.timeDomRsrcAllocList[k2Index].k2; + startSymb = ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.puschCfg.timeDomRsrcAllocList[k2Index].startSymbol; + symbLen = ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.puschCfg.timeDomRsrcAllocList[k2Index].symbolLength; } /* Check for number of Symbol of PUSCH should be same as original in case of transmisson*/ /* Calculating time frame to send PUSCH for SR */ diff --git a/src/5gnrsch/sch_rach.c b/src/5gnrsch/sch_rach.c index 315ac6e27..ed2612ca6 100644 --- a/src/5gnrsch/sch_rach.c +++ b/src/5gnrsch/sch_rach.c @@ -610,9 +610,9 @@ bool schProcessRaReq(Inst schInst, SchCellCb *cell, SlotTimingInfo currTime, uin for(k1TblIdx = 0; k1TblIdx < numK1; k1TblIdx++) { k1Index = k0K1InfoTbl->k0k1TimingInfo[dciTime.slot].k0Indexes[k0TblIdx].k1TimingInfo.k1Indexes[k1TblIdx]; - if(cell->raReq[ueId-1]->ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck) + if(cell->raReq[ueId-1]->ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck) { - k1 = cell->raReq[ueId-1]->ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck->\ + k1 = cell->raReq[ueId-1]->ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck->\ dlDataToUlAckList[k1Index]; } else diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index d3e28fd03..61992eb90 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -272,7 +272,7 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, if(dedMsg == true) { ueCb = &cell->ueCb[ueId-1]; - k0K1InfoTbl = &ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.k0K1InfoTbl; + k0K1InfoTbl = &ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1InfoTbl; } else { @@ -291,11 +291,11 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, } else { - if(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0 != NULLP) + if(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0 != NULLP) { - k0Val = *(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0); - *pdschStartSymbol = ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].startSymbol; - *pdschSymblLen = ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].symbolLength; + k0Val = *(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].k0); + *pdschStartSymbol = ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].startSymbol; + *pdschSymblLen = ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[k0Index].symbolLength; } } @@ -321,9 +321,9 @@ bool findValidK0K1Value(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId, } else { - if(ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck) + if(ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck) { - k1Val = ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck->dlDataToUlAckList[k1Index]; + k1Val = ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck->dlDataToUlAckList[k1Index]; } } ADD_DELTA_TO_TIME((*pdschTime),(*pucchTime), k1Val, cell->numSlots); @@ -397,7 +397,7 @@ bool schFillBoGrantDlSchedInfo(SchCellCb *cell, SlotTimingInfo currTime, uint8_t } } - if(findValidK0K1Value(cell, currTime, ueId, ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.k0K1TblPrsnt,\ + if(findValidK0K1Value(cell, currTime, ueId, ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1TblPrsnt,\ &pdschStartSymbol, &pdschNumSymbols, &pdcchTime, &pdschTime, &pucchTime, isRetx, *hqP) != true ) { /* If a valid combination of slots to scheduled PDCCH, PDSCH and PUCCH is diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index 3e94b75dc..ec07c685b 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -40,6 +40,13 @@ SchUeCfgRspFunc SchUeCfgRspOpts[] = packSchUeCfgRsp /* LWLC */ }; +SchUeRecfgRspFunc SchUeRecfgRspOpts[] = +{ + packSchUeRecfgRsp, /* LC */ + MacProcSchUeRecfgRsp, /* TC */ + packSchUeRecfgRsp /* LWLC */ +}; + SchUeDeleteRspFunc SchUeDeleteRspOpts[] = { packSchUeDeleteRsp, /* LC */ @@ -69,7 +76,7 @@ SchCellDeleteRspFunc SchCellDeleteRspOpts[]= * RFAILED - failure * * ****************************************************************/ -void SchSendUeCfgRspToMac(uint16_t event, SchUeCfg *ueCfg, Inst inst,\ +void SchSendUeCfgRspToMac(SchUeCfgReq *ueCfg, Inst inst,\ SchMacRsp result, SchUeCfgRsp *cfgRsp) { Pst rspPst; @@ -82,19 +89,44 @@ void SchSendUeCfgRspToMac(uint16_t event, SchUeCfg *ueCfg, Inst inst,\ /* Filling response post */ memset(&rspPst, 0, sizeof(Pst)); FILL_PST_SCH_TO_MAC(rspPst, inst); - if(event == EVENT_ADD_UE_CONFIG_REQ_TO_SCH) - { - rspPst.event = EVENT_UE_CONFIG_RSP_TO_MAC; - DU_LOG("\nINFO --> SCH : Sending UE Config response to MAC"); - } - else if(event == EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH) - { - rspPst.event = EVENT_UE_RECONFIG_RSP_TO_MAC; - DU_LOG("\nINFO --> SCH : Sending UE Reconfig response to MAC"); - } + rspPst.event = EVENT_UE_CONFIG_RSP_TO_MAC; + DU_LOG("\nINFO --> SCH : Sending UE Config response to MAC"); SchUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp); } +/******************************************************************* + * + * @brief Fill and send UE Recfg response to MAC + * + * @details + * + * Function : SchSendUeRecfgRspToMac + * + * Functionality: Fill and send UE Recfg response to MAC + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void SchSendUeRecfgRspToMac(SchUeRecfgReq *ueRecfgReq, Inst inst,\ + SchMacRsp result, SchUeRecfgRsp *reCfgRsp) +{ + Pst rspPst; + + reCfgRsp->cellId = ueRecfgReq->cellId; + reCfgRsp->ueId = ueRecfgReq->ueId; + reCfgRsp->crnti = ueRecfgReq->crnti; + reCfgRsp->rsp = result; + + /* Filling response post */ + memset(&rspPst, 0, sizeof(Pst)); + FILL_PST_SCH_TO_MAC(rspPst, inst); + rspPst.event = EVENT_UE_RECONFIG_RSP_TO_MAC; + DU_LOG("\nINFO --> SCH : Sending UE Reconfig response to MAC"); + SchUeRecfgRspOpts[rspPst.selector](&rspPst, reCfgRsp); +} + /******************************************************************* * @@ -227,11 +259,54 @@ uint8_t updateDedLcInfo(Inst inst, Snssai *snssai, uint16_t *rsvdDedicatedPRB, b /******************************************************************* * - * @brief Function to fill SchUeCb + * @brief Function to fill SpCellCfg in SchUeCb From SchUeCfg Req * * @details * - * Function : fillSchUeCb + * Function : fillSpCellInSchCb + * + * Functionality: Function to fill SpCellCfg in SchUeCb + * + * @params[in] Scheduler instance, + * SchUeCb pointer, + * SchUeCfg pointer + * @return ROK/RFAILED + * + * ****************************************************************/ + +void fillSpCellInSchCb(SchSpCellRecfg *destSpCellCfg, SchSpCellCfg *srcSpCellCfg) +{ + destSpCellCfg->servCellIdx = srcSpCellCfg->servCellIdx; + memcpy(&destSpCellCfg->servCellRecfg.initDlBwp, &srcSpCellCfg->servCellCfg.initDlBwp, sizeof(SchInitalDlBwp)); + destSpCellCfg->servCellRecfg.numDlBwpToAddOrMod = srcSpCellCfg->servCellCfg.numDlBwpToAdd; + if(destSpCellCfg->servCellRecfg.numDlBwpToAddOrMod > 0) + { + memcpy(destSpCellCfg->servCellRecfg.dlBwpToAddOrModList, srcSpCellCfg->servCellCfg.dlBwpToAddList,\ + (sizeof(SchDlBwpInfo) * srcSpCellCfg->servCellCfg.numDlBwpToAdd)); + } + destSpCellCfg->servCellRecfg.firstActvDlBwpId = srcSpCellCfg->servCellCfg.firstActvDlBwpId; + destSpCellCfg->servCellRecfg.defaultDlBwpId = srcSpCellCfg->servCellCfg.defaultDlBwpId; + destSpCellCfg->servCellRecfg.bwpInactivityTmr = srcSpCellCfg->servCellCfg.bwpInactivityTmr; + memcpy(&destSpCellCfg->servCellRecfg.pdschServCellCfg, &srcSpCellCfg->servCellCfg.pdschServCellCfg, sizeof(SchPdschServCellCfg)); + memcpy(&destSpCellCfg->servCellRecfg.initUlBwp, &srcSpCellCfg->servCellCfg.initUlBwp, sizeof(SchInitialUlBwp)); + + destSpCellCfg->servCellRecfg.numDlBwpToAddOrMod = srcSpCellCfg->servCellCfg.numDlBwpToAdd; + if(destSpCellCfg->servCellRecfg.numDlBwpToAddOrMod > 0) + { + memcpy(destSpCellCfg->servCellRecfg.ulBwpToAddOrModList, srcSpCellCfg->servCellCfg.ulBwpToAddList,\ + (sizeof(SchUlBwpInfo) * srcSpCellCfg->servCellCfg.numUlBwpToAdd)); + } + destSpCellCfg->servCellRecfg.firstActvUlBwpId = srcSpCellCfg->servCellCfg.firstActvUlBwpId; + return; +} + +/******************************************************************* + * + * @brief Function to fill SchUeCb From UeCfg Req + * + * @details + * + * Function : fillSchUeCbFrmCfgReq * * Functionality: Function to fill SchUeCb * @@ -242,7 +317,7 @@ uint8_t updateDedLcInfo(Inst inst, Snssai *snssai, uint16_t *rsvdDedicatedPRB, b * * ****************************************************************/ -uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) +uint8_t fillSchUeCbFrmCfgReq(Inst inst, SchUeCb *ueCb, SchUeCfgReq *ueCfg) { uint8_t lcIdx, ueLcIdx, idx; uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0}; @@ -254,7 +329,6 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) ueCb->ueCfg.cellId = ueCfg->cellId; ueCb->ueCfg.ueId = ueCfg->ueId; ueCb->ueCfg.crnti = ueCfg->crnti; - ueCb->ueCfg.dataTransmissionAction = ueCfg->dataTransmissionInfo; if(ueCfg->macCellGrpCfgPres == true) { memcpy(&ueCb->ueCfg.macCellGrpCfg , &ueCfg->macCellGrpCfg, sizeof(SchMacCellGrpCfg)); @@ -267,7 +341,7 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) ueCb->ueDrxInfoPres = true; /* intialize the drxUeCb */ schInitDrxUeCb(ueCb); - + /* intialize the Dl drxHarqCb */ for(idx =0; idxdlHqEnt.numHqPrcs; idx++) { @@ -298,17 +372,6 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) #endif } -#ifdef NR_DRX - if(ueCfg->drxConfigIndicatorRelease == true) - { - if(ueCb->ueDrxInfoPres == true) - { - schDeleteUeDrxInfo(ueCb->cellCb, ueCb); - ueCb->ueDrxInfoPres = false; - } - } -#endif - if(ueCfg->phyCellGrpCfgPres == true) { memcpy(&ueCb->ueCfg.phyCellGrpCfg , &ueCfg->phyCellGrpCfg, sizeof(SchPhyCellGrpCfg)); @@ -319,23 +382,23 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) { if(ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfgPres == true) { - if(ueCb->ueCfg.spCellCfgPres && ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfgPres == true) + if(ueCb->ueCfg.spCellCfgPres && ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfgPres == true) { for(idx = 0; idx < ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc; idx++) { - if(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0 && ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0) + if(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0 && ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0) { - SCH_FREE(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0, sizeof(uint8_t)); + SCH_FREE(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0, sizeof(uint8_t)); } } } } - memcpy(&ueCb->ueCfg.spCellCfg , &ueCfg->spCellCfg, sizeof(SchSpCellCfg)); + fillSpCellInSchCb(&ueCb->ueCfg.spCellCfg, &ueCfg->spCellCfg); - covertFreqDomRsrcMapToIAPIFormat(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc,\ + covertFreqDomRsrcMapToIAPIFormat(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc,\ freqDomainResource); - memset(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, 0, FREQ_DOM_RSRC_SIZE); - memcpy(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, freqDomainResource, FREQ_DOM_RSRC_SIZE); + memset(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, 0, FREQ_DOM_RSRC_SIZE); + memcpy(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, freqDomainResource, FREQ_DOM_RSRC_SIZE); ueCb->ueCfg.spCellCfgPres = true; dlDataToUlAck = ueCfg->spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck; @@ -343,14 +406,14 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) { if(dlDataToUlAck) { - BuildK0K1Table(ueCb->cellCb, &ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.k0K1InfoTbl, false, pdschCfg,\ + BuildK0K1Table(ueCb->cellCb, &ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1InfoTbl, false, pdschCfg,\ ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, dlDataToUlAck->dlDataToUlAckListCount,\ dlDataToUlAck->dlDataToUlAckList); - ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.k0K1TblPrsnt = true; + ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1TblPrsnt = true; BuildK2InfoTable(ueCb->cellCb, ueCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList,\ ueCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\ - NULLP, &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.k2InfoTbl); - ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.k2TblPrsnt = true; + NULLP, &ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2InfoTbl); + ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2TblPrsnt = true; } } } @@ -363,7 +426,7 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) 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++) + for(lcIdx = 0; lcIdx < ueCfg->numLcsToAdd; lcIdx++) { isLcIdValid = FALSE; /*Re-Initializing*/ @@ -374,101 +437,280 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) DU_LOG("ERROR --> SCH: LCID:%d is not Valid",ueLcIdx); continue; } - if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_ADD) + fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); + fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); + + /*Checking whether this LC belong to Dedicated S-NSSAI + * and Create the Dedicated LC List & Update the Reserve PRB number*/ + if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai != NULLP) + { + retDL = updateDedLcInfo(inst, ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].rsvdDedicatedPRB),\ + &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].isDedicated)); + } + if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai != NULLP) + { + retUL = updateDedLcInfo(inst, ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].rsvdDedicatedPRB),\ + &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].isDedicated)); + } + + if(retUL == RFAILED || retDL == RFAILED)/*FATAL error*/ { - fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); - fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); + DU_LOG("\nERROR --> SCH : Failure in updateDedLcInfo"); + return RFAILED; + } + SCH_FREE(ueCfg->schLcCfg[lcIdx].drbQos, sizeof(SchDrbQosInfo)); + SCH_FREE(ueCfg->schLcCfg[lcIdx].snssai, sizeof(Snssai)); - /*Checking whether this LC belong to Dedicated S-NSSAI - * and Create the Dedicated LC List & Update the Reserve PRB number*/ - if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai != NULLP) + }/* End of outer for loop */ + return ROK; +} + +/******************************************************************* + * + * @brief Function to fill SchUeCb From UeReconfig Req + * + * @details + * + * Function : fillSchUeCbFrmRecfgReq + * + * Functionality: Function to fill SchUeCb + * + * @params[in] Scheduler instance, + * SchUeCb pointer, + * SchUeCfg pointer + * @return ROK/RFAILED + * + * ****************************************************************/ + +uint8_t fillSchUeCbFrmRecfgReq(Inst inst, SchUeCb *ueCb, SchUeRecfgReq *ueRecfg) +{ + uint8_t lcIdx, ueLcIdx, idx; + uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0}; + SchPdschCfgCmn pdschCfg; + SchPucchDlDataToUlAck *dlDataToUlAck; + uint8_t retDL = ROK, retUL = ROK; + bool isLcIdValid = FALSE; + + + ueCb->ueCfg.cellId = ueRecfg->cellId; + ueCb->ueCfg.ueId = ueRecfg->ueId; + ueCb->ueCfg.crnti = ueRecfg->crnti; + ueCb->ueCfg.dataTransmissionAction = ueRecfg->dataTransmissionInfo; + if(ueRecfg->macCellGrpRecfgPres == true) + { + memcpy(&ueCb->ueCfg.macCellGrpCfg , &ueRecfg->macCellGrpRecfg, sizeof(SchMacCellGrpCfg)); + ueCb->ueCfg.macCellGrpCfgPres = true; +#ifdef NR_DRX + if(ueRecfg->macCellGrpRecfg.drxCfgPresent == true) + { + if(ueCb->ueDrxInfoPres == false) { - retDL = updateDedLcInfo(inst, ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].rsvdDedicatedPRB),\ - &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].isDedicated)); + ueCb->ueDrxInfoPres = true; + /* intialize the drxUeCb */ + schInitDrxUeCb(ueCb); + + /* intialize the Dl drxHarqCb */ + for(idx =0; idxdlHqEnt.numHqPrcs; idx++) + { + schInitDrxHarqCb(&ueCb->dlHqEnt.procs[idx].dlDrxHarqCb); + } + /* intialize the Ul drxHarqCb */ + for(idx =0; idxulHqEnt.numHqPrcs; idx++) + { + schInitDrxHarqCb(&ueCb->ulHqEnt.procs[idx].ulDrxHarqCb); + } + /* convert all the drx configuration recived in ms/subms into number of slots and store into the drxUeCb */ + schFillDrxUeCb(ueCb->cellCb->cellCfg.numerology, ueRecfg->macCellGrpRecfg.drxCfg, &ueCb->drxUeCb); + /* Calculate the onduration timer and short cycle timer (if shortcycle configuration is present) as soon as we + * recived ueCfg request */ + schAddUeInOndurationList(ueCb->cellCb, ueCb, 0); + } - if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai != NULLP) + else { - retUL = updateDedLcInfo(inst, ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].rsvdDedicatedPRB),\ - &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].isDedicated)); - } + /* convert all the drx configuration recived in ms/subms into number + * of slots and store into the drxUeCb */ + schFillDrxUeCb(ueCb->cellCb->cellCfg.numerology, ueRecfg->macCellGrpRecfg.drxCfg, &ueCb->drxUeCb); - if(retUL == RFAILED || retDL == RFAILED)/*FATAL error*/ - { - DU_LOG("\nERROR --> SCH : Failure in updateDedLcInfo"); - return RFAILED; + /* Recalculate/Restart timer based on their presence */ + schDrxUeReCfgTimer(ueCb->cellCb, ueCb); } } - else +#endif + } + +#ifdef NR_DRX + if(ueRecfg->drxConfigIndicatorRelease == true) + { + if(ueCb->ueDrxInfoPres == true) { - if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId) + schDeleteUeDrxInfo(ueCb->cellCb, ueCb); + ueCb->ueDrxInfoPres = false; + } + } +#endif + + if(ueRecfg->phyCellGrpRecfgPres == true) + { + memcpy(&ueCb->ueCfg.phyCellGrpCfg , &ueRecfg->phyCellGrpRecfg, sizeof(SchPhyCellGrpCfg)); + ueCb->ueCfg.phyCellGrpCfgPres = true; + } + + if(ueRecfg->spCellRecfgPres == true) + { + if(ueRecfg->spCellRecfg.servCellRecfg.initDlBwp.pdschCfgPres == true) + { + if(ueCb->ueCfg.spCellCfgPres && ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfgPres == true) { - if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD) + for(idx = 0; idx < ueRecfg->spCellRecfg.servCellRecfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc; idx++) { - fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); - /*Updating the RRM reserved pool PRB count*/ - if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai != NULLP) + if(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0 && ueRecfg->spCellRecfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0) { - retUL = updateDedLcInfo(inst, ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].rsvdDedicatedPRB),\ - &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].isDedicated)); - } - if(retUL == RFAILED) - { - DU_LOG("\nERROR --> SCH : Failed in updating Ded Lc info"); - return RFAILED; + SCH_FREE(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg.timeDomRsrcAllociList[idx].k0, sizeof(uint8_t)); } } - if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_DEL) - { - /*Delete the LC node from the UL LC List*/ - if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].isDedicated) - { - /*Remove from HARQ Transmission or retransmission*/ - } - else/*Default LC list*/ - { + } + } + memcpy(&ueCb->ueCfg.spCellCfg , &ueRecfg->spCellRecfg, sizeof(SchSpCellRecfg)); - } - SCH_FREE(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, sizeof(Snssai)); - memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt)); - } - }/*End of UL LC Ctxt*/ + covertFreqDomRsrcMapToIAPIFormat(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc,\ + freqDomainResource); + memset(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, 0, FREQ_DOM_RSRC_SIZE); + memcpy(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, freqDomainResource, FREQ_DOM_RSRC_SIZE); - if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId) + ueCb->ueCfg.spCellCfgPres = true; + dlDataToUlAck = ueRecfg->spCellRecfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck; + if(ueCb->cellCb) + { + if(dlDataToUlAck) { - if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD) - { - fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); - /*Updating the RRM policy*/ - if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai != NULLP) - { - retDL = updateDedLcInfo(inst, ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].rsvdDedicatedPRB), \ - &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].isDedicated)); - } - if(retDL == RFAILED) - { - DU_LOG("\nERROR --> SCH : Failed in updating Ded Lc info"); - return RFAILED; - } - } - if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_DEL) - { - /*Delete the LC node from the DL LC List*/ - if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].isDedicated) - { - /*Remove from HARQ Transmission or retransmission*/ - } - else - { - } - SCH_FREE(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, sizeof(Snssai)); - memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt)); - } - }/*End of DL LC ctxt*/ + BuildK0K1Table(ueCb->cellCb, &ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1InfoTbl, false, pdschCfg,\ + ueRecfg->spCellRecfg.servCellRecfg.initDlBwp.pdschCfg, dlDataToUlAck->dlDataToUlAckListCount,\ + dlDataToUlAck->dlDataToUlAckList); + ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.k0K1TblPrsnt = true; + BuildK2InfoTable(ueCb->cellCb, ueRecfg->spCellRecfg.servCellRecfg.initUlBwp.puschCfg.timeDomRsrcAllocList,\ + ueRecfg->spCellRecfg.servCellRecfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\ + NULLP, &ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2InfoTbl); + ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.k2TblPrsnt = true; + } } + } - SCH_FREE(ueCfg->schLcCfg[lcIdx].drbQos, sizeof(SchDrbQosInfo)); - SCH_FREE(ueCfg->schLcCfg[lcIdx].snssai, sizeof(Snssai)); + if(ueRecfg->ambrRecfg) + { + SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg)); + ueCb->ueCfg.ambrCfg = ueRecfg->ambrRecfg; + } + memcpy(&ueCb->ueCfg.dlModInfo, &ueRecfg->dlModInfo , sizeof(SchModulationInfo)); + memcpy(&ueCb->ueCfg.ulModInfo, &ueRecfg->ulModInfo , sizeof(SchModulationInfo)); + //Updating Num of LC to ADD SchUlCb and SchDlCb DB in SchUeCb + for(lcIdx = 0; lcIdx < ueRecfg->numLcsToAdd; lcIdx++) + { + isLcIdValid = FALSE; /*Re-Initializing*/ + + ueLcIdx = ueRecfg->schLcCfgAdd[lcIdx].lcId; + CHECK_LCID(ueLcIdx, isLcIdValid); + if(isLcIdValid == FALSE) + { + DU_LOG("ERROR --> SCH: LCID:%d is not Valid",ueLcIdx); + continue; + } + fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueRecfg->schLcCfgAdd[lcIdx]); + fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueRecfg->schLcCfgAdd[lcIdx]); + + /*Checking whether this LC belong to Dedicated S-NSSAI + * and Create the Dedicated LC List & Update the Reserve PRB number*/ + if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai != NULLP) + { + retDL = updateDedLcInfo(inst, ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].rsvdDedicatedPRB),\ + &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].isDedicated)); + } + if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai != NULLP) + { + retUL = updateDedLcInfo(inst, ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].rsvdDedicatedPRB),\ + &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].isDedicated)); + } + if(retUL == RFAILED || retDL == RFAILED)/*FATAL error*/ + { + DU_LOG("\nERROR --> SCH : Failure in updateDedLcInfo"); + return RFAILED; + } + SCH_FREE(ueRecfg->schLcCfgAdd[lcIdx].drbQos, sizeof(SchDrbQosInfo)); + SCH_FREE(ueRecfg->schLcCfgAdd[lcIdx].snssai, sizeof(Snssai)); + } + //Updating Num of LC to DEL SchUlCb and SchDlCb DB in SchUeCb + for(lcIdx = 0; lcIdx < ueRecfg->numLcsToDel; lcIdx++) + { + ueLcIdx = ueRecfg->lcIdToDel[lcIdx]; + + if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].lcId == ueRecfg->lcIdToDel[lcIdx]) + { + /*Delete the LC node from the DL LC List*/ + if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].isDedicated) + { + /*Remove from HARQ Transmission or retransmission*/ + } + else + { + } + SCH_FREE(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, sizeof(Snssai)); + memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt)); + } + if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].lcId == ueRecfg->lcIdToDel[lcIdx]) + { + /*Delete the LC node from the UL LC List*/ + if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].isDedicated) + { + /*Remove from HARQ Transmission or retransmission*/ + } + else/*Default LC list*/ + { + + } + SCH_FREE(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, sizeof(Snssai)); + memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt)); + } + } + //Updating Num of LC to DEL SchUlCb and SchDlCb DB in SchUeCb + for(lcIdx = 0; lcIdx < ueRecfg->numLcsToMod; lcIdx++) + { + ueLcIdx = ueRecfg->schLcCfgMod[lcIdx].lcId; + + if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].lcId == ueRecfg->schLcCfgMod[lcIdx].lcId) + { + fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueRecfg->schLcCfgMod[lcIdx]); + /*Updating the RRM reserved pool PRB count*/ + if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai != NULLP) + { + retUL = updateDedLcInfo(inst, ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].rsvdDedicatedPRB),\ + &(ueCb->ulInfo.ulLcCtxt[ueLcIdx].isDedicated)); + } + if(retUL == RFAILED) + { + DU_LOG("\nERROR --> SCH : Failed in updating Ded Lc info"); + return RFAILED; + } + }/*End of UL LC Ctxt*/ + + if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].lcId == ueRecfg->schLcCfgMod[lcIdx].lcId) + { + fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueRecfg->schLcCfgMod[lcIdx]); + /*Updating the RRM policy*/ + if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai != NULLP) + { + retDL = updateDedLcInfo(inst, ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].rsvdDedicatedPRB), \ + &(ueCb->dlInfo.dlLcCtxt[ueLcIdx].isDedicated)); + } + if(retDL == RFAILED) + { + DU_LOG("\nERROR --> SCH : Failed in updating Ded Lc info"); + return RFAILED; + } + }/*End of DL LC ctxt*/ + + SCH_FREE(ueRecfg->schLcCfgMod[lcIdx].drbQos, sizeof(SchDrbQosInfo)); + SCH_FREE(ueRecfg->schLcCfgMod[lcIdx].snssai, sizeof(Snssai)); }/* End of outer for loop */ return ROK; } @@ -489,24 +731,21 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) * * ****************************************************************/ -SchCellCb *getSchCellCb(uint16_t srcEvent, Inst inst, SchUeCfg *ueCfg) +SchCellCb *getSchCellCb(uint16_t srcEvent, Inst inst, uint16_t cellId) { - uint8_t idx; + uint8_t idx = 0; SchCellCb *cellCb = NULLP; - SchUeCfgRsp cfgRsp; - memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); /* Search of cell cb */ for(idx = 0; idx < MAX_NUM_CELL; idx++) { cellCb = schCb[inst].cells[idx]; - if(cellCb->cellId == ueCfg->cellId) - break; + if((cellCb != NULLP) && (cellCb->cellId == cellId)) + break; } - if(idx == MAX_NUM_CELL) + if((idx == MAX_NUM_CELL) || (cellCb == NULLP)) { - DU_LOG("\nERROR --> SCH : Ue create request failed. Invalid cell id %d", ueCfg->cellId); - SchSendUeCfgRspToMac(srcEvent, ueCfg, inst, RSP_NOK, &cfgRsp); + DU_LOG("\nERROR --> SCH : Ue create request failed. Invalid cell id %d", cellId); return NULLP; } @@ -514,7 +753,6 @@ SchCellCb *getSchCellCb(uint16_t srcEvent, Inst inst, SchUeCfg *ueCfg) if(cellCb->numActvUe > MAX_NUM_UE) { DU_LOG("\nERROR --> SCH : Max number of UE [%d] already configured", MAX_NUM_UE); - SchSendUeCfgRspToMac(srcEvent, ueCfg, inst, RSP_NOK, &cfgRsp); return NULLP; } return cellCb; @@ -536,7 +774,7 @@ SchCellCb *getSchCellCb(uint16_t srcEvent, Inst inst, SchUeCfg *ueCfg) * RFAILED - failure * * ****************************************************************/ -uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfg) +uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfg) { uint8_t lcIdx = 0, ret = ROK, idx = 0; SchCellCb *cellCb = NULLP; @@ -555,15 +793,20 @@ uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfg) return RFAILED; } DU_LOG("\nDEBUG --> SCH : Adding UE Config Request for CRNTI[%d]", ueCfg->crnti); - cellCb = getSchCellCb(pst->event, inst, ueCfg); + cellCb = getSchCellCb(pst->event, inst, ueCfg->cellId); + if(cellCb == NULLP) + { + SchSendUeCfgRspToMac(ueCfg, inst, RSP_NOK, &cfgRsp); + return RFAILED; + } /* Search if UE already configured */ ueCb = &cellCb->ueCb[ueCfg->ueId - 1]; if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE)) { DU_LOG("\nDEBUG --> SCH : CRNTI %d already configured ", ueCfg->crnti); - SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp); + SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp); return ROK; } @@ -596,7 +839,7 @@ uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfg) cmLListInit(&ueCb->hqDlmap[idx]->hqList); cmLListInit(&ueCb->hqUlmap[idx]->hqList); } - ret = fillSchUeCb(inst, ueCb, ueCfg); + ret = fillSchUeCbFrmCfgReq(inst, ueCb, ueCfg); if(ret == ROK) { @@ -620,7 +863,7 @@ uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfg) for(lcIdx=0; lcIdxbsrInfo[lcIdx].dataVol = 0; - SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp); + SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp); } return ret; } @@ -861,7 +1104,7 @@ uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo *puschInfo, DciInfo *dciInfo, b memset(&coreset1, 0, sizeof(SchControlRsrcSet)); if(ueCb->ueCfg.spCellCfgPres == true) { - coreset1 = ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0]; + coreset1 = ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0]; } dciInfo->cellId = cellCb->cellId; @@ -941,41 +1184,47 @@ uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo *puschInfo, DciInfo *dciInfo, b * RFAILED - failure * * ****************************************************************/ -uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) +uint8_t MacSchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg) { uint8_t ueId, lcIdx, ret = ROK; SchCellCb *cellCb = NULLP; SchUeCb *ueCb = NULLP; - SchUeCfgRsp cfgRsp; + SchUeRecfgRsp recfgRsp; Inst inst = pst->dstInst - SCH_INST_START; - memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); + memset(&recfgRsp, 0, sizeof(SchUeRecfgRsp)); #ifdef CALL_FLOW_DEBUG_LOG DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH\n"); #endif - if(!ueCfg) + if(!ueRecfg) { DU_LOG("\nERROR --> SCH : Modifying Ue Config request failed at MacSchModUeConfigReq()"); return RFAILED; } - DU_LOG("\nDEBUG --> SCH : Modifying Ue Config Request for CRNTI[%d]", ueCfg->crnti); - cellCb = getSchCellCb(pst->event, inst, ueCfg); + DU_LOG("\nDEBUG --> SCH : Modifying Ue Config Request for CRNTI[%d]", ueRecfg->crnti); + cellCb = getSchCellCb(pst->event, inst, ueRecfg->cellId); + + if(cellCb == NULLP) + { + SchSendUeRecfgRspToMac(ueRecfg, inst, RSP_NOK, &recfgRsp); + return RFAILED; + } /* Search if UE already configured */ - GET_UE_ID(ueCfg->crnti, ueId); + GET_UE_ID(ueRecfg->crnti, ueId); ueCb = &cellCb->ueCb[ueId -1]; if(!ueCb) { DU_LOG("\nERROR --> SCH : SchUeCb not found at MacSchModUeConfigReq() "); - SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_NOK, &cfgRsp); + SchSendUeRecfgRspToMac(ueRecfg, inst, RSP_NOK, &recfgRsp); return RFAILED; } - if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE)) + if((ueCb->crnti == ueRecfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE)) { /* Found the UeCb to Reconfig */ - ret = fillSchUeCb(inst, ueCb, ueCfg); + ret = fillSchUeCbFrmRecfgReq(inst, ueCb, ueRecfg); if(ret == ROK) { ueCb->cellCb = cellCb; @@ -984,7 +1233,7 @@ uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) for(lcIdx=0; lcIdxbsrInfo[lcIdx].dataVol = 0; - SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp); + SchSendUeRecfgRspToMac(ueRecfg, inst, RSP_OK, &recfgRsp); } } return ret; @@ -1155,16 +1404,16 @@ void deleteSchUeCb(SchUeCb *ueCb) SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg)); if(ueCb->ueCfg.spCellCfgPres) { - if(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfgPres == true) + if(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfgPres == true) { - pdschCfg = &ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg; + pdschCfg = &ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdschCfg; for(timeDomRsrcIdx = 0; timeDomRsrcIdx < pdschCfg->numTimeDomRsrcAlloc; timeDomRsrcIdx++) SCH_FREE(pdschCfg->timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t)); } - if(ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfgPres == true) + if(ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfgPres == true) { - pucchCfg = &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg; + pucchCfg = &ueCb->ueCfg.spCellCfg.servCellRecfg.initUlBwp.pucchCfg; SCH_FREE(pucchCfg->resrcSet,sizeof(SchPucchResrcSetCfg)); if(pucchCfg->resrc) { @@ -1181,8 +1430,8 @@ void deleteSchUeCb(SchUeCb *ueCb) SCH_FREE(pucchCfg->dlDataToUlAck, sizeof(SchPucchDlDataToUlAck)); SCH_FREE(pucchCfg->powerControl,sizeof(SchPucchPowerControl)); } - SCH_FREE(ueCb->ueCfg.spCellCfg.servCellCfg.bwpInactivityTmr, sizeof(uint8_t)); - deleteSchPdschServCellCfg(&ueCb->ueCfg.spCellCfg.servCellCfg.pdschServCellCfg); + SCH_FREE(ueCb->ueCfg.spCellCfg.servCellRecfg.bwpInactivityTmr, sizeof(uint8_t)); + deleteSchPdschServCellCfg(&ueCb->ueCfg.spCellCfg.servCellRecfg.pdschServCellCfg); } /*Need to Free the memory allocated for S-NSSAI*/ for(ueLcIdx = 0; ueLcIdx < MAX_NUM_LC; ueLcIdx++) diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 2d1c625ad..c72636c4d 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -284,8 +284,8 @@ uint8_t packMacCellStop(Pst *pst, CellStopInfo *cellStop) if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { - DU_LOG("\nERROR --> DU APP : Memory allocation failed for cell stop req pack"); - return RFAILED; + DU_LOG("\nERROR --> DU APP : Memory allocation failed for cell stop req pack"); + return RFAILED; } /* pack the address of the structure */ @@ -841,7 +841,7 @@ uint8_t unpackDuMacUeCfgRsp(MacDuUeCfgRspFunc func, Pst *pst, Buffer *mBuf) * RFAILED - failure * * ****************************************************************/ -uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) +uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeRecfg *ueCfg) { Buffer *mBuf = NULLP; @@ -886,12 +886,12 @@ uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf) { if(pst->selector == ODU_SELECTOR_LWLC) { - MacUeCfg *ueCfg; + MacUeRecfg *ueRecfg; /* unpack the address of the structure */ - CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf); + CMCHKUNPK(oduUnpackPointer, (PTR *)&ueRecfg, mBuf); ODU_PUT_MSG_BUF(mBuf); - return (*func)(pst, ueCfg); + return (*func)(pst, ueRecfg); } else { @@ -903,6 +903,76 @@ uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf) return RFAILED; } +/******************************************************************* + * + * @brief Pack and send UE Reconfig response from MAC to DU APP + * + * @details + * + * Function : packDuMacUeRecfgRsp + * + * Functionality: + * Pack and send UE Reconfig response from MAC to DU APP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDuMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *recfgRsp) +{ + 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 packDuMacUeRecfgRsp"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer,(PTR)recfgRsp, mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacUeRecfgRsp"); + return RFAILED; + } + + return ODU_POST_TASK(pst,mBuf); +} + +/******************************************************************* + * + * @brief Unpack UE ReConfig Response from MAC to DU APP + * + * @details + * + * Function :unpackDuMacUeRecfgRsp + * + * Functionality: Unpack UE ReConfig Response from MAC to DU APP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackDuMacUeRecfgRsp(MacDuUeRecfgRspFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacUeRecfgRsp *recfgRsp = NULLP; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&recfgRsp, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, recfgRsp); + } + + ODU_PUT_MSG_BUF(mBuf); + return RFAILED; +} + /******************************************************************* * * @brief Packs and Sends RACH Resource request from DUAPP to MAC diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 06515e639..24bbacbc0 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -1179,14 +1179,14 @@ typedef struct servCellCfgInfo { InitialDlBwp initDlBwp; uint8_t numDlBwpToAdd; - DlBwpInfo DlBwpToAddList[MAX_NUM_BWP]; + DlBwpInfo dlBwpToAddList[MAX_NUM_BWP]; uint8_t firstActvDlBwpId; uint8_t defaultDlBwpId; uint8_t *bwpInactivityTmr; PdschServCellCfg pdschServCellCfg; InitialUlBwp initUlBwp; uint8_t numUlBwpToAdd; - UlBwpInfo UlBwpToAddList[MAX_NUM_BWP]; + UlBwpInfo ulBwpToAddList[MAX_NUM_BWP]; uint8_t firstActvUlBwpId; }ServCellCfgInfo; @@ -1197,6 +1197,33 @@ typedef struct spCellCfg ServCellCfgInfo servCellCfg; }SpCellCfg; +/* Serving cell Re-configuration */ +typedef struct servCellRecfgInfo +{ + InitialDlBwp initDlBwp; + uint8_t numDlBwpToAddOrMod; + DlBwpInfo dlBwpToAddOrModList[MAX_NUM_BWP]; + uint8_t numDlBwpToRel; + DlBwpInfo dlBwpToRelList[MAX_NUM_BWP]; + uint8_t firstActvDlBwpId; + uint8_t defaultDlBwpId; + uint8_t *bwpInactivityTmr; + PdschServCellCfg pdschServCellCfg; + InitialUlBwp initUlBwp; + uint8_t numUlBwpToAddOrMod; + UlBwpInfo ulBwpToAddOrModList[MAX_NUM_BWP]; + uint8_t numUlBwpToRel; + UlBwpInfo ulBwpToRelList[MAX_NUM_BWP]; + uint8_t firstActvUlBwpId; +}ServCellRecfgInfo; + +/* Special cell Re-configuration */ +typedef struct spCellRecfg +{ + uint8_t servCellIdx; + ServCellRecfgInfo servCellCfg; +}SpCellRecfg; + typedef struct ambrCfg { uint32_t ulBr; /* UL Bit rate */ @@ -1260,17 +1287,16 @@ typedef struct ulLcCfg BucketSizeDur bsd; // bucketSizeDuration }UlLcCfg; -typedef struct duLcCfg +typedef struct dlLcCfg { LcPriority lcp; // logical Channel Prioritization }DlLcCfg; typedef struct lcCfg { - ConfigType configType; uint8_t lcId; - DrbQosInfo *drbQos; Snssai *snssai; + DrbQosInfo *drbQos; bool ulLcCfgPres; UlLcCfg ulLcCfg; DlLcCfg dlLcCfg; @@ -1285,26 +1311,49 @@ typedef struct modulationInfo typedef struct macUeCfg { - uint16_t cellId; - uint8_t ueId; - uint16_t crnti; - bool macCellGrpCfgPres; - MacCellGrpCfg macCellGrpCfg; - bool phyCellGrpCfgPres; - PhyCellGrpCfg phyCellGrpCfg; - bool spCellCfgPres; - SpCellCfg spCellCfg; - AmbrCfg *ambrCfg; - ModulationInfo dlModInfo; /* DL modulation info */ - ModulationInfo ulModInfo; /* UL modulation info */ - uint8_t numLcs; - LcCfg lcCfgList[MAX_NUM_LC]; - UeCfgState macUeCfgState; /* InActive / Completed */ + uint16_t cellId; + uint8_t ueId; + uint16_t crnti; + bool macCellGrpCfgPres; + MacCellGrpCfg macCellGrpCfg; + bool phyCellGrpCfgPres; + PhyCellGrpCfg phyCellGrpCfg; + bool spCellCfgPres; + SpCellCfg spCellCfg; + AmbrCfg *ambrCfg; + ModulationInfo dlModInfo; /* DL modulation info */ + ModulationInfo ulModInfo; /* UL modulation info */ + uint8_t numLcs; + LcCfg lcCfgList[MAX_NUM_LC]; +}MacUeCfg; + +/* UE Re-configuration */ +typedef struct macUeRecfg +{ + uint16_t cellId; + uint8_t ueId; + uint8_t beamIdx; + uint16_t crnti; + bool macCellGrpRecfgPres; + MacCellGrpCfg macCellGrpRecfg; + bool phyCellGrpRecfgPres; + PhyCellGrpCfg phyCellGrpRecfg; + bool spCellRecfgPres; + SpCellRecfg spCellRecfg; + AmbrCfg *ambrRecfg; + ModulationInfo dlModInfo; + ModulationInfo ulModInfo; + uint8_t numLcsToAdd; + LcCfg lcCfgAdd[MAX_NUM_LC]; + uint8_t numLcsToDel; + uint8_t lcIdToDel[MAX_NUM_LC]; + uint8_t numLcsToMod; + LcCfg lcCfgMod[MAX_NUM_LC]; DataTransmissionAction transmissionAction; #ifdef NR_DRX - bool drxConfigIndicatorRelease; + bool drxConfigIndicatorRelease; #endif -}MacUeCfg; +}MacUeRecfg; typedef struct nrcgi { @@ -1341,8 +1390,12 @@ typedef struct ueCfgRsp DRBFailInfo *failedDRBlist; uint8_t numSCellFailed; /* valid values : 0 to MAX_NUM_SCELL */ SCellFailInfo *failedSCellList; + uint8_t numDRBModFailed; /* valid values : 0 to MAX_NUM_DRB */ + DRBFailInfo *failedDRBModlist; }MacUeCfgRsp; +typedef struct ueCfgRsp MacUeRecfgRsp; + typedef struct rachRsrcReq { uint16_t cellId; @@ -1523,7 +1576,12 @@ typedef uint8_t (*MacDuUeCfgRspFunc) ARGS(( /* UE Reconfig Request from DU APP to MAC */ typedef uint8_t (*DuMacUeReconfigReq) ARGS(( Pst *pst, - MacUeCfg *ueCfg )); + MacUeRecfg *ueCfg )); + +/* UE Reconfig Response from MAC to DU APP */ +typedef uint8_t (*MacDuUeRecfgRspFunc) ARGS(( + Pst *pst, + MacUeRecfgRsp *cfgRsp)); /* RACH Resource Request from DU APP to MAC */ typedef uint8_t (*DuMacRachRsrcReq) ARGS(( @@ -1618,9 +1676,12 @@ uint8_t sendStopIndMacToDuApp(uint16_t cellId); uint8_t packDuMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp); uint8_t unpackDuMacUeCfgRsp(MacDuUeCfgRspFunc func, Pst *pst, Buffer *mBuf); uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp); -uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg); +uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeRecfg *ueRecfg); uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf); -uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg); +uint8_t MacProcUeReconfigReq(Pst *pst, MacUeRecfg *ueRecfg); +uint8_t packDuMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *recfgRsp); +uint8_t unpackDuMacUeRecfgRsp(MacDuUeRecfgRspFunc func, Pst *pst, Buffer *mBuf); +uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *recfgRsp); uint8_t packDuMacRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq); uint8_t unpackMacRachRsrcReq(DuMacRachRsrcReq func, Pst *pst, Buffer *mBuf); uint8_t MacProcRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq); diff --git a/src/cm/mac_sch_interface.c b/src/cm/mac_sch_interface.c index d1a61409a..956a65068 100644 --- a/src/cm/mac_sch_interface.c +++ b/src/cm/mac_sch_interface.c @@ -233,7 +233,7 @@ uint8_t packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm) * RFAILED - failure * * ****************************************************************/ -uint8_t packMacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfg) +uint8_t packMacSchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfg) { if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LC)) { @@ -268,6 +268,29 @@ uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp) { return ROK; } + +/******************************************************************* + * + * @brief Packs and send UE reconfig response + * + * @details + * + * Function : packSchUeRecfgRsp + * + * Functionality: + * Packs and send UE reconfig response + * + * @params[in] Post structure + * UE re-config response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *recfgRsp) +{ + return ROK; +} + /******************************************************************* * * @brief Pack and Send BSR from MAC to SCH @@ -372,7 +395,7 @@ uint8_t packMacSchDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd) * RFAILED - failure * * ****************************************************************/ -uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) +uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfg) { if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LC)) { diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 0466468d4..f6eae3336 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -1526,19 +1526,39 @@ typedef struct schUlBwpInfo uint8_t bwpId; }SchUlBwpInfo; +/* Serving cell configuration */ +typedef struct schServCellRecfgInfo +{ + SchInitalDlBwp initDlBwp; + uint8_t numDlBwpToAddOrMod; + SchDlBwpInfo dlBwpToAddOrModList[MAX_NUM_BWP]; + uint8_t numDlBwpToRel; + SchDlBwpInfo dlBwpToRelList[MAX_NUM_BWP]; + uint8_t firstActvDlBwpId; + uint8_t defaultDlBwpId; + uint8_t *bwpInactivityTmr; + SchPdschServCellCfg pdschServCellCfg; + SchInitialUlBwp initUlBwp; + uint8_t numUlBwpToAddOrMod; + SchUlBwpInfo ulBwpToAddOrModList[MAX_NUM_BWP]; + uint8_t numUlBwpToRel; + SchUlBwpInfo ulBwpToRelList[MAX_NUM_BWP]; + uint8_t firstActvUlBwpId; +}SchServCellRecfgInfo; + /* Serving cell configuration */ typedef struct schServCellCfgInfo { SchInitalDlBwp initDlBwp; uint8_t numDlBwpToAdd; - SchDlBwpInfo DlBwpToAddList[MAX_NUM_BWP]; + SchDlBwpInfo dlBwpToAddList[MAX_NUM_BWP]; uint8_t firstActvDlBwpId; uint8_t defaultDlBwpId; uint8_t *bwpInactivityTmr; SchPdschServCellCfg pdschServCellCfg; SchInitialUlBwp initUlBwp; uint8_t numUlBwpToAdd; - SchUlBwpInfo UlBwpToAddList[MAX_NUM_BWP]; + SchUlBwpInfo ulBwpToAddList[MAX_NUM_BWP]; uint8_t firstActvUlBwpId; }SchServCellCfgInfo; @@ -1599,6 +1619,13 @@ typedef struct schSpCellCfg SchServCellCfgInfo servCellCfg; }SchSpCellCfg; +/* Special cell Reconfiguration */ +typedef struct schSpCellRecfg +{ + uint8_t servCellIdx; + SchServCellRecfgInfo servCellRecfg; +}SchSpCellRecfg; + /* Uplink logical channel configuration */ typedef struct SchUlLcCfg { @@ -1618,10 +1645,9 @@ typedef struct schDlLcCfg /* Logical Channel configuration */ typedef struct schLcCfg { - ConfigType configType; uint8_t lcId; - SchDrbQosInfo *drbQos; Snssai *snssai; + SchDrbQosInfo *drbQos; SchDlLcCfg dlLcCfg; SchUlLcCfg ulLcCfg; }SchLcCfg; @@ -1640,10 +1666,11 @@ typedef struct schModulationInfo }SchModulationInfo; /* UE configuration */ -typedef struct schUeCfg +typedef struct schUeCfgReq { uint16_t cellId; uint8_t ueId; + uint8_t beamIdx; uint16_t crnti; bool macCellGrpCfgPres; SchMacCellGrpCfg macCellGrpCfg; @@ -1654,23 +1681,51 @@ typedef struct schUeCfg SchAmbrCfg *ambrCfg; SchModulationInfo dlModInfo; SchModulationInfo ulModInfo; - uint8_t numLcs; + uint8_t numLcsToAdd; SchLcCfg schLcCfg[MAX_NUM_LC]; +}SchUeCfgReq; + +/* UE Re-configuration */ +typedef struct schUeRecfgReq +{ + uint16_t cellId; + uint8_t ueId; + uint8_t beamIdx; + uint16_t crnti; + bool macCellGrpRecfgPres; + SchMacCellGrpCfg macCellGrpRecfg; + bool phyCellGrpRecfgPres; + SchPhyCellGrpCfg phyCellGrpRecfg; + bool spCellRecfgPres; + SchSpCellRecfg spCellRecfg; + SchAmbrCfg *ambrRecfg; + SchModulationInfo dlModInfo; + SchModulationInfo ulModInfo; + uint8_t numLcsToAdd; + SchLcCfg schLcCfgAdd[MAX_NUM_LC]; + uint8_t numLcsToDel; + uint8_t lcIdToDel[MAX_NUM_LC]; + uint8_t numLcsToMod; + SchLcCfg schLcCfgMod[MAX_NUM_LC]; SchDataTransmission dataTransmissionInfo; #ifdef NR_DRX bool drxConfigIndicatorRelease; #endif -}SchUeCfg; +}SchUeRecfgReq; typedef struct schUeCfgRsp { uint16_t cellId; + uint8_t beamIdx; uint16_t ueId; uint16_t crnti; SchMacRsp rsp; SchFailureCause cause; }SchUeCfgRsp; +/*As per WG8, UE ReCFG and UECFG have same structure definition*/ +typedef struct schUeCfgRsp SchUeRecfgRsp; + typedef struct schRachRsrcReq { SlotTimingInfo slotInd; @@ -1800,7 +1855,7 @@ typedef struct schSliceCfgRsp SliceRsp **listOfSliceCfgRsp; }SchSliceCfgRsp; -/*As per ORAN-WG8, Slice Cfg and ReCfg are same structures*/ +/*As per ORAN-WG8, Slice Cfg and Recfg are same structures*/ typedef struct schSliceCfgReq SchSliceRecfgReq; typedef struct schSliceCfgRsp SchSliceRecfgRsp; @@ -1866,7 +1921,7 @@ typedef uint8_t (*MacSchDlRlcBoInfoFunc) ARGS(( typedef uint8_t (*MacSchAddUeConfigReqFunc) ARGS(( Pst *pst, /* Post structure */ - SchUeCfg *ueCfgToSch)); /* Scheduler UE Cfg */ + SchUeCfgReq *ueCfgToSch)); /* Scheduler UE Cfg */ typedef uint8_t (*SchUeCfgRspFunc) ARGS(( Pst *pst, /* Post structure */ @@ -1891,11 +1946,11 @@ typedef uint8_t (*MacSchSrUciIndFunc) ARGS(( typedef uint8_t (*MacSchModUeConfigReqFunc) ARGS(( Pst *pst, /* Post structure */ - SchUeCfg *ueCfgToSch)); /* Scheduler UE Cfg */ + SchUeRecfgReq *ueRecfgToSch)); /* Scheduler UE Recfg */ -typedef uint8_t (*SchUeReCfgRspFunc) ARGS(( +typedef uint8_t (*SchUeRecfgRspFunc) ARGS(( Pst *pst, /* Post structure */ - SchUeCfgRsp *cfgRsp)); /* Scheduler UE Cfg response */ + SchUeRecfgRsp *recfgRsp)); /* Scheduler UE Cfg response */ typedef uint8_t (*MacSchRachRsrcReqFunc) ARGS(( Pst *pst, /* Post structure */ @@ -1936,11 +1991,11 @@ typedef uint8_t (*SchSliceCfgRspFunc) ARGS(( typedef uint8_t (*MacSchSliceRecfgReqFunc) ARGS(( Pst *pst, /* Post structure */ - SchSliceRecfgReq *schSliceRecfgReq)); /* Scheduler Slice ReCfg Req */ + SchSliceRecfgReq *schSliceRecfgReq)); /* Scheduler Slice Recfg Req */ typedef uint8_t (*SchSliceRecfgRspFunc) ARGS(( Pst *pst, /* Post Structure */ - SchSliceRecfgRsp *schSliceRecfgRsp /* Cell ReCfg Cfm */ + SchSliceRecfgRsp *schSliceRecfgRsp /* Cell Recfg Cfm */ )); typedef uint8_t (*MacSchPagingIndFunc) ARGS(( @@ -1969,10 +2024,12 @@ uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd); uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd); uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo); uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo); -uint8_t packMacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch); -uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch); +uint8_t packMacSchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfgToSch); +uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfgToSch); uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp); uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp); +uint8_t packSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *cfgRsp); +uint8_t MacProcSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *reCfgRsp); uint8_t MacSchSlotInd ARGS((Pst * pst, SlotTimingInfo * slotInd)); uint8_t packMacSchSlotInd(Pst * pst, SlotTimingInfo * slotInd); uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer *mBuf); @@ -1982,10 +2039,10 @@ uint8_t packMacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd); uint8_t packMacSchDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd); uint8_t MacSchDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd); uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd); -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 packMacSchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfgToSch); +uint8_t MacSchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfgToSch); +uint8_t packSchUeReconfigRsp(Pst *pst, SchUeRecfgRsp *recfgRsp); +uint8_t MacProcSchUeReconfigRsp(Pst *pst, SchUeRecfgRsp *recfgRsp); uint8_t packMacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq); uint8_t MacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq); uint8_t packSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp); diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c index c510a5878..c4b60e72d 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.c +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -10732,6 +10732,95 @@ uint8_t BuildDrbToBeModifiedList(uint32_t duId, CuUeCb *ueCb, DRBs_ToBeModified_ return ret; } +/******************************************************************* +* +* @brief Builds the DRB to be released Item IE +* +* @details +* +* Function : FillDrbToBeRelItemList +* +* Functionality: Constructs the DRB to be modified Mod Item Ies +* +* @params[in] struct DRBs_ToBeReleased_ItemIEs *drbItemIe +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t FillDrbToBeRelItemList(uint32_t duId, CuUeCb *ueCb, uint8_t arrIdx, struct DRBs_ToBeReleased_ItemIEs *drbItemIe) +{ + uint8_t drbIdx; + + drbItemIe->id = ProtocolIE_ID_id_DRBs_ToBeReleased_Item; + drbItemIe->criticality = Criticality_reject; + drbItemIe->value.present = DRBs_ToBeReleased_ItemIEs__value_PR_DRBs_ToBeReleased_Item; + drbItemIe->value.choice.DRBs_ToBeReleased_Item.dRBID = DRB1 + arrIdx; + + for(drbIdx = 0; drbIdx < ueCb->numDrb; drbIdx++) + { + if(ueCb->drbList[drbIdx].drbId == drbItemIe->value.choice.DRBs_ToBeReleased_Item.dRBID) + { + deleteEgtpTunnel(duId, ueCb->drbList[drbIdx].dlUpTnlInfo.teId); + CU_FREE(ueCb->drbList[drbIdx].snssai, sizeof(Snssai)); + break; + } + } + return ROK; +} + +/******************************************************************* +* +* @brief Builds the DRB to be released list +* +* @details +* +* Function : BuildDrbToBeReleasedList +* +* Functionality: Constructs the DRB to be released list +* +* @params[in] DRBs_ToBeReleased_List_t *drbSet +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t BuildDrbToBeReleasedList(uint32_t duId, CuUeCb *ueCb, DRBs_ToBeReleased_List_t *drbSet) +{ + uint8_t ret = ROK; + uint8_t arrIdx =0; + uint8_t drbCnt =0; + + drbCnt = MAX_DRB_MODIFIED_UE_MOD_REQ; + drbSet->list.count = drbCnt; + drbSet->list.size = drbCnt * sizeof(DRBs_ToBeReleased_ItemIEs_t *); + CU_ALLOC(drbSet->list.array, drbSet->list.size); + if(drbSet->list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeReleasedList"); + return RFAILED; + } + for(arrIdx=0; arrIdxlist.array[arrIdx], sizeof(DRBs_ToBeReleased_ItemIEs_t)); + if(drbSet->list.array[arrIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeReleasedList"); + return RFAILED; + } + + ret = FillDrbToBeRelItemList(duId, ueCb, arrIdx, (DRBs_ToBeReleased_ItemIEs_t *)drbSet->list.array[arrIdx]); + if(ret != ROK) + { + DU_LOG("\nERROR --> F1AP : FillDrbToBeRelItemList failed"); + } + } + + return ret; +} + /******************************************************************* * * @brief freeing the DRB item @@ -10853,6 +10942,40 @@ void FreeDrbToBeModifiedList(DRBs_ToBeModified_List_t *drbSet) } +/******************************************************************* +* +* @brief free the DRB to be modfified list +* +* @details +* +* Function : FreeDrbToBeReleasedList +* +* Functionality: free the DRB to be Release list +* +* @params[in] FreeDrbToBeReleasedList_t *drbSet +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +void FreeDrbToBeReleasedList(DRBs_ToBeReleased_List_t *drbSet) +{ + uint8_t arrIdx =0; + struct DRBs_ToBeReleased_ItemIEs *drbItemIe; + + if(drbSet->list.array) + { + for(arrIdx=0; arrIdxlist.count ; arrIdx++) + { + if(drbSet->list.array[arrIdx] != NULLP) + { + CU_FREE(drbSet->list.array[arrIdx], sizeof(DRBs_ToBeReleased_ItemIEs_t)); + } + } + CU_FREE(drbSet->list.array, drbSet->list.size); + } +} + /******************************************************************* * * @brief free the UeContextModification Request @@ -10904,6 +11027,12 @@ void FreeUeContextModicationRequest(F1AP_PDU_t *f1apMsg) choice.DRBs_ToBeModified_List); break; } + case ProtocolIE_ID_id_DRBs_ToBeReleased_List: + { + FreeDrbToBeReleasedList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.\ + choice.DRBs_ToBeReleased_List); + break; + } case ProtocolIE_ID_id_TransmissionActionIndicator: break; case ProtocolIE_ID_id_RRCContainer: @@ -10976,7 +11105,7 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt ueContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest; if(action == MODIFY_UE) - elementCnt = 4; + elementCnt = 5; else if(action == QUERY_CONFIG) elementCnt = 3; else if(action == RRC_RECONFIG_COMPLETE_IND) @@ -11043,15 +11172,26 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt ret = BuildDrbToBeModifiedList(duId, ueCb, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\ value.choice.DRBs_ToBeModified_List)); - /* TODO: DRB to be release list */ - if(ret != ROK) { DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextModificationReq(): Failed to build drb to be modified list"); break; } - /* TODO: fill the RRC reconfiguration information in RRC Contaiiner ie in case of MODIFY_UE */ + /* DRB to be released list */ + ieIdx++; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_ToBeReleased_List; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present =\ + UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List; + ret = BuildDrbToBeReleasedList(duId, ueCb, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\ + value.choice.DRBs_ToBeReleased_List)); + + if(ret != ROK) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextModificationReq(): Failed to build drb to be deleted list"); + break; + } } else if(action == QUERY_CONFIG) { @@ -11776,6 +11916,11 @@ uint8_t procUeContextModificationResponse(uint32_t duId, F1AP_PDU_t *f1apMsg) break; } + case ProtocolIE_ID_id_DRBs_Modified_List: + { + DU_LOG("\nINFO --> Received DRBs Modified List"); + break; + } case ProtocolIE_ID_id_SRBs_SetupMod_List: { procSrbSetupModList(ueCb, &ueCtxtModRsp->protocolIEs.list.array[idx]->value.choice.SRBs_SetupMod_List); diff --git a/src/cu_stub/cu_stub.c b/src/cu_stub/cu_stub.c index c518951dd..a131ce55f 100644 --- a/src/cu_stub/cu_stub.c +++ b/src/cu_stub/cu_stub.c @@ -426,6 +426,23 @@ void *cuConsoleHandler(void *args) } continue; } + else if(ch == 'm') + { + uint8_t ueId = 1; + uint8_t duId = 1; + uint8_t duIdx = 0; + + DU_LOG("\nINFO --> CU_STUB: UE Context Mod for ueId [%d] at DU ID [%d]", \ + ueId, duId ); + DuDb *duDb = NULLP; + CuUeCb *ueCb = NULLP; + + SEARCH_DU_DB(duIdx, duId, duDb); + if(duDb) + ueCb = &duDb->ueCb[ueId-1]; + BuildAndSendUeContextModificationReq(duId, ueCb, MODIFY_UE); + + } } } /********************************************************************** diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 4b43b0766..344566641 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -2763,7 +2763,7 @@ uint8_t BuildTagConfig(DuUeCb *ueCb, struct TAG_Config *tagConfig) if(ueCb == NULLP) elementCnt = ODU_VALUE_ONE; else - elementCnt = ueCb->macUeCfg.macCellGrpCfg.tagCfg.addModListCount; + elementCnt = ueCb->duMacUeCfg.macCellGrpCfg.tagCfg.addModListCount; tagList = tagConfig->tag_ToAddModList; tagList->list.count = elementCnt; @@ -2798,8 +2798,8 @@ uint8_t BuildTagConfig(DuUeCb *ueCb, struct TAG_Config *tagConfig) { for(idx=0; idxlist.count; idx++) { - tagList->list.array[idx]->tag_Id = ueCb->macUeCfg.macCellGrpCfg.tagCfg.addModList[idx].tagId; - tagList->list.array[idx]->timeAlignmentTimer = ueCb->macUeCfg.macCellGrpCfg.tagCfg.addModList[idx].timeAlignTimer; + tagList->list.array[idx]->tag_Id = ueCb->duMacUeCfg.macCellGrpCfg.tagCfg.addModList[idx].tagId; + tagList->list.array[idx]->timeAlignmentTimer = ueCb->duMacUeCfg.macCellGrpCfg.tagCfg.addModList[idx].timeAlignTimer; } } @@ -2846,13 +2846,13 @@ uint8_t BuildPhrConfig(DuUeCb *ueCb, struct MAC_CellGroupConfig__phr_Config *phr } else { - phrConfig->choice.setup->phr_PeriodicTimer = ueCb->macUeCfg.macCellGrpCfg.phrCfg.periodicTimer; - phrConfig->choice.setup->phr_ProhibitTimer = ueCb->macUeCfg.macCellGrpCfg.phrCfg.prohibitTimer; - phrConfig->choice.setup->phr_Tx_PowerFactorChange = ueCb->macUeCfg.macCellGrpCfg.phrCfg.txPowerFactor; - phrConfig->choice.setup->multiplePHR = ueCb->macUeCfg.macCellGrpCfg.phrCfg.multiplePHR; - phrConfig->choice.setup->dummy = ueCb->macUeCfg.macCellGrpCfg.phrCfg.dummy; - phrConfig->choice.setup->phr_Type2OtherCell = ueCb->macUeCfg.macCellGrpCfg.phrCfg.phrType2OtherCell; - phrConfig->choice.setup->phr_ModeOtherCG = ueCb->macUeCfg.macCellGrpCfg.phrCfg.phrOtherCG; + phrConfig->choice.setup->phr_PeriodicTimer = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.periodicTimer; + phrConfig->choice.setup->phr_ProhibitTimer = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.prohibitTimer; + phrConfig->choice.setup->phr_Tx_PowerFactorChange = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.txPowerFactor; + phrConfig->choice.setup->multiplePHR = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.multiplePHR; + phrConfig->choice.setup->dummy = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.dummy; + phrConfig->choice.setup->phr_Type2OtherCell = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.phrType2OtherCell; + phrConfig->choice.setup->phr_ModeOtherCG = ueCb->duMacUeCfg.macCellGrpCfg.phrCfg.phrOtherCG; } return ROK; @@ -2884,8 +2884,8 @@ uint8_t BuildBsrConfig(DuUeCb *ueCb, struct BSR_Config *bsrConfig) } else { - bsrConfig->periodicBSR_Timer = convertBsrPeriodicTmrValueToEnum(ueCb->macUeCfg.macCellGrpCfg.bsrTmrCfg.periodicTimer); - bsrConfig->retxBSR_Timer = convertBsrRetxTmrValueToEnum(ueCb->macUeCfg.macCellGrpCfg.bsrTmrCfg.retxTimer); + bsrConfig->periodicBSR_Timer = convertBsrPeriodicTmrValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.bsrTmrCfg.periodicTimer); + bsrConfig->retxBSR_Timer = convertBsrRetxTmrValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.bsrTmrCfg.retxTimer); bsrConfig->logicalChannelSR_DelayTimer = NULLP; DU_ALLOC(bsrConfig->logicalChannelSR_DelayTimer, sizeof(long)); @@ -2894,7 +2894,7 @@ uint8_t BuildBsrConfig(DuUeCb *ueCb, struct BSR_Config *bsrConfig) DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildBsrConfig"); return RFAILED; } - *(bsrConfig->logicalChannelSR_DelayTimer) = convertLcSrDelayTmrValueToEnum(ueCb->macUeCfg.macCellGrpCfg.bsrTmrCfg.srDelayTimer); + *(bsrConfig->logicalChannelSR_DelayTimer) = convertLcSrDelayTmrValueToEnum(ueCb->duMacUeCfg.macCellGrpCfg.bsrTmrCfg.srDelayTimer); } return ROK; @@ -2933,7 +2933,7 @@ uint8_t BuildSchedulingReqConfig(DuUeCb *ueCb, struct SchedulingRequestConfig *s if(ueCb == NULLP) elementCnt = ODU_VALUE_ONE; else - elementCnt = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModListCount; + elementCnt = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModListCount; schReqList = schedulingRequestConfig->schedulingRequestToAddModList; schReqList->list.count = elementCnt; @@ -2977,7 +2977,7 @@ uint8_t BuildSchedulingReqConfig(DuUeCb *ueCb, struct SchedulingRequestConfig *s { for(idx=0; idxlist.count; idx++) { - schReqList->list.array[idx]->schedulingRequestId = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].schedReqId; + schReqList->list.array[idx]->schedulingRequestId = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].schedReqId; schReqList->list.array[idx]->sr_ProhibitTimer = NULLP; DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long)); @@ -2986,8 +2986,8 @@ uint8_t BuildSchedulingReqConfig(DuUeCb *ueCb, struct SchedulingRequestConfig *s DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig"); return RFAILED; } - *(schReqList->list.array[idx]->sr_ProhibitTimer) = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srProhibitTmr; - schReqList->list.array[idx]->sr_TransMax = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srTransMax; + *(schReqList->list.array[idx]->sr_ProhibitTimer) = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srProhibitTmr; + schReqList->list.array[idx]->sr_TransMax = ueCb->duMacUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srTransMax; } } @@ -3508,11 +3508,11 @@ uint8_t BuildRlcBearerToAddModList(DuUeCb *ueCb, struct CellGroupConfigRrc__rlc_ DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildRlcBearerToAddModList"); return RFAILED; } - for(macLcIdx = 0; macLcIdx < ueCb->macUeCfg.numLcs; macLcIdx++) + for(macLcIdx = 0; macLcIdx < ueCb->duMacUeCfg.numLcs; macLcIdx++) { - if(ueCb->macUeCfg.lcCfgList[macLcIdx].lcId == ueCb->rlcUeCfg.rlcLcCfg[lcIdx].lcId) + if(ueCb->duMacUeCfg.lcCfgList[macLcIdx].lcConfig.lcId == ueCb->rlcUeCfg.rlcLcCfg[lcIdx].lcId) { - if(BuildMacLCConfig(&ueCb->macUeCfg.lcCfgList[macLcIdx], rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK) + if(BuildMacLCConfig(&ueCb->duMacUeCfg.lcCfgList[macLcIdx].lcConfig, rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK) { DU_LOG("\nERROR --> F1AP : BuildMacLCConfig failed"); return RFAILED; @@ -5856,13 +5856,13 @@ uint8_t BuildInitialUlBWP(InitialUlBwp *initUlBwp, BWP_UplinkDedicated_t *ulBwp) * RFAILED - failure * * ****************************************************************/ -uint8_t BuildUlCfg(ServCellCfgInfo *servCellCfg, UplinkConfig_t *ulCfg) +uint8_t BuildUlCfg(ServCellRecfgInfo *servCellRecfg, UplinkConfig_t *ulCfg) { InitialUlBwp *initUlBwp = NULLP; - if(servCellCfg) + if(servCellRecfg) { - initUlBwp = &servCellCfg->initUlBwp; + initUlBwp = &servCellRecfg->initUlBwp; } ulCfg->initialUplinkBWP = NULLP; @@ -5887,10 +5887,10 @@ uint8_t BuildUlCfg(ServCellCfgInfo *servCellCfg, UplinkConfig_t *ulCfg) DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg"); return RFAILED; } - if(servCellCfg == NULLP) + if(servCellRecfg == NULLP) *(ulCfg->firstActiveUplinkBWP_Id) = ACTIVE_UL_BWP_ID; else - *(ulCfg->firstActiveUplinkBWP_Id) = servCellCfg->firstActvUlBwpId; + *(ulCfg->firstActiveUplinkBWP_Id) = servCellRecfg->firstActvUlBwpId; ulCfg->pusch_ServingCellConfig = NULLP; DU_ALLOC(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig)); @@ -6044,18 +6044,18 @@ uint8_t BuildCsiMeasCfg(struct ServingCellConfig__csi_MeasConfig *csiMeasCfg) * * Functionality: Builds DL BWP to add/modify list * - * @params[in] ServCellCfgInfo *servCellCfg, + * @params[in] ServCellRecfgInfo *servCellRecfg, * struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildDlBwpToAddModList(ServCellCfgInfo *servCellCfg, struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList) +uint8_t BuildDlBwpToAddModList(ServCellRecfgInfo *servCellRecfg, struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList) { uint8_t elementCnt, idx; - elementCnt = servCellCfg->numDlBwpToAdd; + elementCnt = servCellRecfg->numDlBwpToAddOrMod; dlBwpAddModList->list.count = elementCnt; dlBwpAddModList->list.size = elementCnt * sizeof(struct BWP_Downlink *); dlBwpAddModList->list.array = NULLP; @@ -6078,7 +6078,7 @@ uint8_t BuildDlBwpToAddModList(ServCellCfgInfo *servCellCfg, struct ServingCellC for(idx=0; idxlist.count; idx++) { - dlBwpAddModList->list.array[idx]->bwp_Id = servCellCfg->DlBwpToAddList[idx].bwpId; + dlBwpAddModList->list.array[idx]->bwp_Id = servCellRecfg->dlBwpToAddOrModList[idx].bwpId; dlBwpAddModList->list.array[idx]->bwp_Common = NULLP; dlBwpAddModList->list.array[idx]->bwp_Dedicated = NULLP; } @@ -6102,15 +6102,15 @@ uint8_t BuildDlBwpToAddModList(ServCellCfgInfo *servCellCfg, struct ServingCellC * ****************************************************************/ uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg) { - ServCellCfgInfo *servCellCfg = NULLP; + ServCellRecfgInfo *servCellRecfg = NULLP; InitialDlBwp *initDlBwp = NULLP; PdschServCellCfg *pdschServCellDb = NULLP; if(ueCb) { - servCellCfg = &ueCb->macUeCfg.spCellCfg.servCellCfg; - initDlBwp = &servCellCfg->initDlBwp; - pdschServCellDb = &servCellCfg->pdschServCellCfg; + servCellRecfg = &ueCb->duMacUeCfg.spCellCfg.servCellCfg; + initDlBwp = &servCellRecfg->initDlBwp; + pdschServCellDb = &servCellRecfg->pdschServCellCfg; } srvCellCfg->tdd_UL_DL_ConfigurationDedicated = NULLP; @@ -6132,7 +6132,7 @@ uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg) srvCellCfg->downlinkBWP_ToReleaseList = NULLP; srvCellCfg->downlinkBWP_ToAddModList = NULLP; - if(ueCb && ueCb->macUeCfg.spCellCfg.servCellCfg.numDlBwpToAdd) + if(ueCb && ueCb->duMacUeCfg.spCellCfg.servCellCfg.numDlBwpToAddOrMod) { DU_ALLOC(srvCellCfg->downlinkBWP_ToAddModList, sizeof(struct ServingCellConfig__downlinkBWP_ToAddModList)); if(srvCellCfg->downlinkBWP_ToAddModList == NULLP) @@ -6141,7 +6141,7 @@ uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg) return RFAILED; } - if(BuildDlBwpToAddModList(&ueCb->macUeCfg.spCellCfg.servCellCfg, srvCellCfg->downlinkBWP_ToAddModList) != ROK) + if(BuildDlBwpToAddModList(&ueCb->duMacUeCfg.spCellCfg.servCellCfg, srvCellCfg->downlinkBWP_ToAddModList) != ROK) { DU_LOG("\nERROR --> F1AP : BuildInitialDlBWP failed"); return RFAILED; @@ -6158,7 +6158,7 @@ uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg) if(ueCb == NULLP) *(srvCellCfg->firstActiveDownlinkBWP_Id) = ACTIVE_DL_BWP_ID; else - *(srvCellCfg->firstActiveDownlinkBWP_Id) = ueCb->macUeCfg.spCellCfg.servCellCfg.firstActvDlBwpId; + *(srvCellCfg->firstActiveDownlinkBWP_Id) = ueCb->duMacUeCfg.spCellCfg.servCellCfg.firstActvDlBwpId; srvCellCfg->bwp_InactivityTimer = NULLP; @@ -6172,7 +6172,7 @@ uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg) if(ueCb == NULLP) *(srvCellCfg->defaultDownlinkBWP_Id) = ACTIVE_DL_BWP_ID; else - *(srvCellCfg->defaultDownlinkBWP_Id) = ueCb->macUeCfg.spCellCfg.servCellCfg.defaultDlBwpId; + *(srvCellCfg->defaultDownlinkBWP_Id) = ueCb->duMacUeCfg.spCellCfg.servCellCfg.defaultDlBwpId; srvCellCfg->uplinkConfig = NULLP; DU_ALLOC(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t)); @@ -6182,7 +6182,7 @@ uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg) return RFAILED; } - if(BuildUlCfg(servCellCfg, srvCellCfg->uplinkConfig) != ROK) + if(BuildUlCfg(servCellRecfg, srvCellCfg->uplinkConfig) != ROK) { DU_LOG("\nERROR --> F1AP : BuildUlCfg failed"); return RFAILED; @@ -6940,7 +6940,7 @@ uint8_t BuildSpCellCfg(DuUeCb *ueCb, SpCellConfig_t *spCellCfg) if(ueCb == NULLP) *(spCellCfg->servCellIndex) = SERV_CELL_IDX; else - *(spCellCfg->servCellIndex) = ueCb->macUeCfg.spCellCfg.servCellIdx; + *(spCellCfg->servCellIndex) = ueCb->duMacUeCfg.spCellCfg.servCellIdx; spCellCfg->reconfigurationWithSync = NULLP; if(ueCb && (ueCb->ueState == UE_HANDIN_IN_PROGRESS)) @@ -7022,8 +7022,8 @@ uint8_t BuildPhyCellGrpCfg(DuUeCb *ueCb, PhysicalCellGroupConfig_t *phyCellGrpCf } else { - *(phyCellGrpCfg->p_NR_FR1) = ueCb->macUeCfg.phyCellGrpCfg.pNrFr1; - phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = ueCb->macUeCfg.phyCellGrpCfg.pdschHarqAckCodebook; + *(phyCellGrpCfg->p_NR_FR1) = ueCb->duMacUeCfg.phyCellGrpCfg.pNrFr1; + phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = ueCb->duMacUeCfg.phyCellGrpCfg.pdschHarqAckCodebook; } phyCellGrpCfg->tpc_SRS_RNTI = NULLP; @@ -7190,10 +7190,10 @@ uint8_t BuildDrxConfigRrc(DuUeCb *ueCb, struct MAC_CellGroupConfig__drx_ConfigRr DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDrxConfigRrc"); return RFAILED; } - if(ueCb->macUeCfg.macCellGrpCfg.drxCfg.drxOnDurationTimer.onDurationTimerValInMs) + if(ueCb->duMacUeCfg.macCellGrpCfg.drxCfg.drxOnDurationTimer.onDurationTimerValInMs) { drxCfg->choice.setup->drx_onDurationTimer.present = DRX_ConfigRrc__drx_onDurationTimer_PR_milliSeconds; - drxCfg->choice.setup->drx_onDurationTimer.choice.milliSeconds = convertOnDurationTimerMilliSecondsValueToEnum(ueCb->macUeCfg.\ + drxCfg->choice.setup->drx_onDurationTimer.choice.milliSeconds = convertOnDurationTimerMilliSecondsValueToEnum(ueCb->duMacUeCfg.\ macCellGrpCfg.drxCfg.drxOnDurationTimer.onDurationtimerValue.milliSeconds); } else @@ -8932,32 +8932,6 @@ uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti /***** UE SETUP REQUEST *****/ -/******************************************************************* - * - * @brief Free Qos And Snssai Drb Info - * - * @details - * - * Function : freeDrbQosAndSnssaiInfo - * - * Functionality: Free Qos And Snssai Drb Info - * - * @params[in] LcCfg *lcCfg, - * @return void - * - * ****************************************************************/ -void freeDrbQosAndSnssaiInfo(LcCfg *lcCfg) -{ - if(lcCfg->snssai) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai)); - } - if(lcCfg->drbQos) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo)); - } -} - /****************************************************************** * * @brief Function to delete the RLC Lc cfg from UE APP DB @@ -9017,7 +8991,7 @@ void freeRlcLcCfg(RlcBearerCfg *lcCfg) * * ****************************************************************/ -void freeMacLcCfg(LcCfg *lcCfg) +void freeMacLcCfg(LcCfg *lcCfg) { /* Deleting DRBQOS */ if(lcCfg->drbQos) @@ -9768,7 +9742,7 @@ void freeDuUeCfg(UeCtxtActionType actionType, DuUeCfg *ueCfg) for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++) { - freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]); + freeMacLcCfg(&ueCfg->macLcCfg[lcIdx].lcConfig); } for(lcIdx = 0; lcIdx < ueCfg->numDrb; lcIdx++) @@ -10340,7 +10314,7 @@ uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd ) * * ****************************************************************/ uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\ -DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo) +DRBs_ToBeModified_Item_t *drbModItem, DuLcCfg *lcCfgToAdd, UpTnlCfg *upTnlInfo) { DRB_Information_t *drbInfo = NULLP; @@ -10356,7 +10330,7 @@ DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo) if(drbItem->qoSInformation.choice.choice_extension->value.present == QoSInformation_ExtIEs__value_PR_DRB_Information) { drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information; - if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK) + if(extractDrbQosCfg(drbInfo , &lcCfgToAdd->lcConfig) != ROK) { DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()"); return RFAILED; @@ -10378,7 +10352,7 @@ DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo) QoSInformation_ExtIEs__value_PR_DRB_Information) { drbInfo = &drbSetupModItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information; - if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK) + if(extractDrbQosCfg(drbInfo , &lcCfgToAdd->lcConfig) != ROK) { DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()"); return RFAILED; @@ -10403,7 +10377,7 @@ DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo) QoSInformation_ExtIEs__value_PR_DRB_Information) { drbInfo = &drbModItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information; - if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK) + if(extractDrbQosCfg(drbInfo , &lcCfgToAdd->lcConfig) != ROK) { DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()"); return RFAILED; @@ -10432,7 +10406,7 @@ DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo) * ****************************************************************/ uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\ -DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo) +DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, DuLcCfg *lcCfg, UpTnlCfg *upTnlInfo) { if(drbCfg != NULLP) { @@ -10460,20 +10434,21 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, } else { - lcCfg->drbQos = NULLP; - lcCfg->snssai = NULLP; - if(lcCfg->lcId == SRB2_LCID) - lcCfg->dlLcCfg.lcp = LC_PRIORITY_3; + lcCfg->lcConfig.drbQos = NULLP; + lcCfg->lcConfig.snssai = NULLP; + if(lcCfg->lcConfig.lcId == SRB2_LCID) + lcCfg->lcConfig.dlLcCfg.lcp = LC_PRIORITY_3; else - lcCfg->dlLcCfg.lcp = LC_PRIORITY_1; + lcCfg->lcConfig.dlLcCfg.lcp = LC_PRIORITY_1; + } if(ulLcCfg) { - lcCfg->ulLcCfgPres = true; - extractUlLcCfg(&lcCfg->ulLcCfg, ulLcCfg); + lcCfg->lcConfig.ulLcCfgPres = true; + extractUlLcCfg(&lcCfg->lcConfig.ulLcCfg, ulLcCfg); } else - lcCfg->ulLcCfgPres = false; + lcCfg->lcConfig.ulLcCfgPres = false; return ROK; } @@ -10494,17 +10469,17 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType, DRBs_ToBeSetup_Item_t *drbItem,\ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LogicalChannelConfig_t *ulLcCfg,\ -LcCfg *lcCfg, UpTnlCfg *upTnlInfo) +DuLcCfg *lcCfg, UpTnlCfg *upTnlInfo) { uint8_t ret = ROK; - lcCfg->lcId = lcId; + lcCfg->lcConfig.lcId = lcId; lcCfg->configType = configType; if(rbType == RB_TYPE_SRB) { ret = extractMacRbCfg(lcId, NULL, NULL, NULL, ulLcCfg, lcCfg, NULL); } - else if(rbType == RB_TYPE_DRB) + else if(rbType == RB_TYPE_DRB && upTnlInfo != NULLP) { if(drbItem != NULL) ret = extractMacRbCfg(lcId, drbItem, NULL, NULL, ulLcCfg, lcCfg, upTnlInfo); @@ -10580,7 +10555,7 @@ uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList } /* Filling RLC/MAC Config*/ - memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg)); + memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(DuLcCfg)); memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg)); procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]), NULLP); if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK) @@ -10646,7 +10621,7 @@ void freeMacPdschServCellInfo(PdschServCellCfg *pdsch) * @return void * * ****************************************************************/ -void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg) +void freeMacServingCellInfo(ServCellRecfgInfo *srvCellCfg) { uint8_t timeDomRsrcIdx; @@ -10677,16 +10652,16 @@ void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg) * * @details * - * Function : freeUeReCfgCellGrpInfo + * Function : freeUeRecfgCellGrpInfo * * Functionality: Free cell Grp Cfg Info * - * @params[in] MacUeCfg* duUeCfg + * @params[in] DuMacUeCfg* duUeCfg * @return void * * ****************************************************************/ -void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg) +void freeUeRecfgCellGrpInfo(DuMacUeCfg *macUeCfg) { freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg); } @@ -11884,8 +11859,8 @@ PucchCfg *storedPucchCfg) * @return ROK/RFAILD * * ****************************************************************/ -uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg,\ -ServCellCfgInfo *storedSrvCellCfg) +uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellRecfgInfo *macSrvCellCfg,\ +ServCellRecfgInfo *storedSrvCellCfg) { uint8_t ret = ROK; BWP_DownlinkDedicated_t *dlBwp = NULLP; @@ -12239,23 +12214,23 @@ void extractDrxConfiguration(struct MAC_CellGroupConfig__drx_ConfigRrc *cuMacCel * * @details * - * Function : extractUeReCfgCellInfo + * Function : extractUeRecfgCellInfo * * Functionality: Fills Reconfig Cell group Info received by CU * * @params[in] CellGroupConfigRrc_t *cellGrp = CellGroupConfigRrc_t information which * is send by CU, which we have stored in F1UeContextSetupDb - * MacUeCfg *MacUeCfg = Used to Store the information, + * DuMacUeCfg *MacUeCfg = Used to Store the information, * which needs to send in other layer, as well as this can be * the variable which stores the information in DuCb, - * MacUeCfg *storedMacUeCfg = Null in case of sending the + * DuMacUeCfg *storedMacUeCfg = Null in case of sending the * information to other layer else it will have copyOfmacUeCfg * which we have stored in F1UeContextSetupDb. * * @return ROK/RFAILED * * ****************************************************************/ -uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg, MacUeCfg *storedMacUeCfg) +uint8_t extractUeRecfgCellInfo(CellGroupConfigRrc_t *cellGrp, DuMacUeCfg *macUeCfg, DuMacUeCfg *storedMacUeCfg) { uint8_t ret = ROK; MAC_CellGroupConfig_t *macCellGroup = NULLP; @@ -12746,14 +12721,14 @@ void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet) * * @details * - * Function : procUeReCfgCellInfo + * Function : procUeRecfgCellInfo * * Functionality: builds Mac Cell Cfg * - * @params[in] MacUeCfg *macUeCfgToSend = Used to Store the information which + * @params[in] DuMacUeCfg *macUeCfgToSend = Used to Store the information which * needs to send in other layer, as well as this can be * the variable which stores the information in DuCb. - * MacUeCfg *storedMacUeCfg = Null in case of sending the + * DuMacUeCfg *storedMacUeCfg = Null in case of sending the * information to other layer else it will have copyOfmacUeCfg * which we have stored in F1UeContextSetupDb * void *cellInfo = CellGroupConfigRrc_t information which is send @@ -12762,7 +12737,7 @@ void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet) * @return void * * ****************************************************************/ -uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend, MacUeCfg *storedMacUeCfg, void *cellInfo) +uint8_t procUeRecfgCellInfo(DuMacUeCfg *macUeCfgToSend, DuMacUeCfg *storedMacUeCfg, void *cellInfo) { uint8_t ret = ROK; CellGroupConfigRrc_t *cellGrp = NULLP; @@ -12770,13 +12745,13 @@ uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend, MacUeCfg *storedMacUeCfg, if(cellInfo) { cellGrp = (CellGroupConfigRrc_t *)cellInfo; - ret = extractUeReCfgCellInfo(cellGrp, macUeCfgToSend, storedMacUeCfg); + ret = extractUeRecfgCellInfo(cellGrp, macUeCfgToSend, storedMacUeCfg); if(ret == RFAILED) - DU_LOG("\nERROR --> F1AP : Failed at procUeReCfgCellInfo()"); + DU_LOG("\nERROR --> F1AP : Failed at procUeRecfgCellInfo()"); } if(ret == RFAILED) { - freeUeReCfgCellGrpInfo(macUeCfgToSend); + freeUeRecfgCellGrpInfo(macUeCfgToSend); } return ret; } @@ -12798,7 +12773,7 @@ uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend, MacUeCfg *storedMacUeCfg, * RFAILED - failure * * ****************************************************************/ -void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap) +void duFillModulationDetails(DuMacUeCfg *ueCfg, DuMacUeCfg *oldUeCfg, void *ueCap) { UE_NR_Capability_t *ueNrCap=NULLP; @@ -12984,19 +12959,19 @@ uint8_t extractCuToDuRrcInfoExt(ProtocolExtensionContainer_4624P16_t *protocolIe * Functionality: Fills Srb List received by CU * * @params[in] SRBs_ToBeSetup_Item_t *cuSrbItem - * LcCfg pointer + * DuLcCfg pointer * RlcBearerCfg pointer * @return void * * ****************************************************************/ -uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd) +uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, DuLcCfg *duMacLcToAdd, RlcBearerCfg *rlcLcToAdd) { /* Filling RLC INFO */ procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd, NULL); /* Filling MAC INFO */ - if(procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, macLcToAdd, NULL) != ROK) + if(procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, duMacLcToAdd, NULL) != ROK) { DU_LOG("\nERROR --> F1AP : Failed at MAC LC Cfg in procSrbListToSetup()"); return RFAILED; @@ -13028,7 +13003,7 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb) { uint8_t ret = ROK, srbIdx = 0, rlcLcIdx = 0; SRBs_ToBeSetup_Item_t *srbItem = NULLP; - LcCfg *macLcCtxt = NULLP; + DuLcCfg *macLcCtxt = NULLP; RlcBearerCfg *rlcLcCtxt = NULLP; if(srbCfg) @@ -13063,7 +13038,7 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb) } if(!macLcCtxt) { - memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg)); + memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(DuLcCfg)); macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs]; ueCfgDb->numMacLcs++; } @@ -13103,14 +13078,14 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb) * for both MAC and RLC * * @params[in] DRBs_ToBeSetup_Item_t , DRBs_ToBeSetupMod_Item_t, - * DRBs_ToBeModified_Item_t , lcId, LcCfg pointer, + * DRBs_ToBeModified_Item_t , lcId, DuLcCfg pointer, * RlcBearerCfg , UpTnlCfg, RlcUeCfg * @return void * * ****************************************************************/ uint8_t procDrbListToSetupMod(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\ -DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo, RlcUeCfg *storedRlcUeCfg) +DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, DuLcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo, RlcUeCfg *storedRlcUeCfg) { uint8_t cfgIdx = 0; RlcMode rlcModeInfo; @@ -13191,7 +13166,7 @@ uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMo DRBs_ToBeSetup_Item_t *drbItem = NULLP; DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP; DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP; - LcCfg *macLcCtxt = NULLP; + DuLcCfg *macLcCtxt = NULLP; RlcBearerCfg *rlcLcCtxt = NULLP; ret = ROK; @@ -13239,7 +13214,7 @@ uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMo } if(!macLcCtxt) { - memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg)); + memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(DuLcCfg)); macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs]; ueCfgDb->numMacLcs++; } @@ -13265,6 +13240,7 @@ uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMo DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for Modified List"); break; } + ueCfgDb->numDrbModified++; } else { @@ -13314,6 +13290,120 @@ uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMo return ret; } +/******************************************************************* + * + * @brief extract Drb List received from CU + * + * @details + * + * Function : extractDrbListToRelease + * + * Functionality: extract Drb List received from CU + * for both MAC and RLC + * + * @params[in] DRBs_ToBeReleased_Item_t pointer + * DuUeCfg pointer + * @return ROK/RFAIED + * + * ****************************************************************/ + +uint8_t extractDrbListToRelease(uint8_t ueId, DRBs_ToBeReleased_List_t *drbToRel, uint8_t drbCount, DuUeCfg *ueCfgDb, RlcUeCfg *rlcUeCfg) +{ + uint8_t ret = ROK, teIdx = 0; + uint8_t drbIdx = 0, rlcLcIdx = 0; + uint8_t drbId = 0, lcId = 0; + DRBs_ToBeReleased_ItemIEs_t *drbRelItem = NULLP; + DuLcCfg *macLcCtxt = NULLP; + RlcBearerCfg *rlcLcCtxt = NULLP; + + ret = ROK; + if(drbCount > 0) + { + for(drbIdx = 0; drbIdx < drbCount; drbIdx++) + { + macLcCtxt = NULL; + rlcLcCtxt = NULL; + + if(drbToRel != NULLP) + { + drbRelItem = (DRBs_ToBeReleased_ItemIEs_t *) drbToRel->list.array[drbIdx]; + drbId = drbRelItem->value.choice.DRBs_ToBeReleased_Item.dRBID; + } + else + { + DU_LOG("ERROR --> DU APP : DrbToRelease pointer is NULL in extractDrbListToRelease"); + return RFAILED; + } + + for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numRlcLcs; rlcLcIdx++) + { + if(ueCfgDb->rlcLcCfg[rlcLcIdx].rbId == drbId && ueCfgDb->rlcLcCfg[rlcLcIdx].rbType == RB_TYPE_DRB) + { + macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx]; + rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx]; + break; + } + } + + if(!macLcCtxt) + { + memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(DuLcCfg)); + macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs]; + ueCfgDb->numMacLcs++; + } + if(!rlcLcCtxt) + { + memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg)); + rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]; + ueCfgDb->numRlcLcs++; + } + lcId = fetchLcId(drbId); + if(lcId < MIN_DRB_LCID) + { + DU_LOG("\nERROR --> F1AP : Failed fetching LCID %d in extractDrbListToRelease() for Modified List", lcId); + break; + } + + /* Filling RLC INFO */ + procRlcLcCfg(drbId, lcId, RB_TYPE_DRB, rlcLcCtxt->rlcMode, CONFIG_DEL, NULL, rlcLcCtxt, NULLP); + /* Filling MAC INFO */ + if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_DEL, NULL, NULL, NULL, NULL, macLcCtxt, NULLP) != ROK) + { + DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in extractDrbListToRelease()"); + return RFAILED; + } + ueCfgDb->upTnlInfo[ueCfgDb->numDrb].configType = CONFIG_DEL; + ueCfgDb->upTnlInfo[ueCfgDb->numDrb].drbId = drbId; + ueCfgDb->upTnlInfo[ueCfgDb->numDrb].ueId = ueId; + + for(teIdx = 0; teIdx < duCb.numTeId; teIdx++) + { + if((duCb.upTnlCfg[teIdx]->ueId == ueCfgDb->upTnlInfo[ueCfgDb->numDrb].ueId) && \ + (duCb.upTnlCfg[teIdx]->drbId == ueCfgDb->upTnlInfo[ueCfgDb->numDrb].drbId)) + { + DU_ALLOC(ueCfgDb->upTnlInfo[ueCfgDb->numDrb].tnlCfg1, sizeof(GtpTnlCfg)); + memcpy(ueCfgDb->upTnlInfo[ueCfgDb->numDrb].tnlCfg1, duCb.upTnlCfg[teIdx]->tnlCfg1, sizeof(GtpTnlCfg)); + break; + } + } + + ueCfgDb->numDrb++; + if(ret == RFAILED) + { + DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToRelease() for Modified List"); + break; + } + + DU_LOG("\nDEBUG --> DUAPP: extractDrbListToRelease():lcId:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\ + lcId,ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb); + } + } + else + ret = RFAILED; + + return ret; +} + /******************************************************************* * * @brief Function to extract Dl RRC Msg received from CU @@ -14343,6 +14433,7 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueId) FreeUeContextSetupRsp(f1apMsg); return ret; }/* End of BuildAndSendUeContextSetupRsp */ + /******************************************************************* * * @brief Build And Send Ue Context Rsp @@ -15657,12 +15748,6 @@ uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg) drbCnt = ueCfg->numDrbSetupMod; - if(!drbCnt) - { - DU_LOG("\nINFO --> F1AP : BuildDrbToBeSetupModList(): No DRB information to avaialble to add"); - return ROK; - } - drbSet->list.count = drbCnt; drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *); DU_ALLOC(drbSet->list.array, drbSet->list.size); @@ -15724,6 +15809,107 @@ void FreeDrbSetupModList(DRBs_SetupMod_List_t *drbSetupList) DU_FREE(drbSetupList->list.array, drbSetupList->list.size); } +/******************************************************************* +* +* @brief Builds the DRB to be Mod list +* +* @details +* +* Function : +* +* Functionality: Constructs the DRB to be Mod list +* +* @params[in] DRBs_Modified_List_t *drbModList +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t BuildDrbModList(DRBs_Modified_List_t *drbModList, DuUeCfg *ueCfg) +{ + uint8_t arrIdx =0, drbIdx = 0; + uint8_t drbCnt =0; + struct DRBs_Modified_ItemIEs *drbItemIe; + + /*VS: Below for loop is for debug purpose, to remove in final patch*/ + for(arrIdx = 0; arrIdx < ueCfg->numDrb; arrIdx++) + { + if(ueCfg->upTnlInfo[arrIdx].configType == CONFIG_MOD) + { + drbCnt++; + } + } + + drbCnt = ueCfg->numDrbModified; + + drbModList->list.count = drbCnt; + drbModList->list.size = drbCnt * sizeof(DRBs_Modified_ItemIEs_t *); + DU_ALLOC(drbModList->list.array, drbModList->list.size); + if(drbModList->list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbModList()"); + return RFAILED; + } + + drbIdx = 0; + for(arrIdx = 0; arrIdx < ueCfg->numMacLcs; arrIdx++) + { + if(ueCfg->macLcCfg[arrIdx].configType == CONFIG_MOD) + { + DU_ALLOC(drbModList->list.array[drbIdx], sizeof(DRBs_Modified_ItemIEs_t)); + if(drbModList->list.array[drbIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbModList"); + return RFAILED; + } + + drbItemIe = (struct DRBs_Modified_ItemIEs *)drbModList->list.array[drbIdx]; + drbItemIe->id = ProtocolIE_ID_id_DRBs_Modified_Item; + drbItemIe->criticality = Criticality_reject; + drbItemIe->value.present = DRBs_Modified_ItemIEs__value_PR_DRBs_Modified_Item; + drbItemIe->value.choice.DRBs_Modified_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId; + if(fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Modified_Item.dLUPTNLInformation_ToBeSetup_List,\ + &ueCfg->upTnlInfo[arrIdx])!= ROK) + { + DU_LOG("\nERROR --> F1AP : Failed to fill DlTnl SetupList in BuildDrbModList"); + return RFAILED; + } + drbIdx++; + } + } + + return ROK; +} + +/******************************************************************* +* @brief Free the memory allocated for DRB Mod List +* +* @details +* +* Function : FreeDrbModList +* +* Functionality: +* Free the memory allocated for DRB modified list +* +* @params[in] DRBs_Modified_List_t * +* @return void +* +* ****************************************************************/ +void FreeDrbModList(DRBs_Modified_List_t *drbModList) +{ + uint8_t arrIdx = 0; + DRBs_Modified_ItemIEs_t *drbItemIe = NULLP; + + for(arrIdx = 0; arrIdx < drbModList->list.count; arrIdx++) + { + drbItemIe = ((DRBs_Modified_ItemIEs_t *)drbModList->list.array[arrIdx]); + freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Modified_Item.dLUPTNLInformation_ToBeSetup_List); + DU_FREE(drbModList->list.array[arrIdx], sizeof(DRBs_Modified_ItemIEs_t)); + } + DU_FREE(drbModList->list.array, drbModList->list.size); +} + /******************************************************************* * @brief Free the memory allocated for SRB setup List * @@ -15789,6 +15975,12 @@ void FreeUeContextModResp(F1AP_PDU_t *f1apMsg) value.choice.DRBs_SetupMod_List)); break; } + case ProtocolIE_ID_id_DRBs_Modified_List: + { + FreeDrbModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\ + value.choice.DRBs_Modified_List)); + break; + } case ProtocolIE_ID_id_SRBs_SetupMod_List: { FreeSrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.\ @@ -15860,13 +16052,16 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb) if(ueCb->f1UeDb->actionType == UE_CTXT_MOD) { + elementCnt = 2; if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod) - elementCnt =3; - else - elementCnt =2; + elementCnt++; + if(ueCb->f1UeDb->duUeCfg.numDrbModified) + elementCnt++; } if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) + { elementCnt = 5; + } if(ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE) elementCnt = 2; ueContextModifyRes->protocolIEs.list.count = elementCnt; @@ -15914,7 +16109,8 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb) BuildCellGroupConfigRrc(ueCb, &ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCInformation.cellGroupConfig); } - if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || ((ueCb->f1UeDb->actionType == UE_CTXT_MOD) && (ueCb->f1UeDb->duUeCfg.numDrbSetupMod))) + if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || \ + ((ueCb->f1UeDb->actionType == UE_CTXT_MOD) && (ueCb->f1UeDb->duUeCfg.numDrbSetupMod))) { ieIdx++; ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List; @@ -15940,6 +16136,22 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb) } } + if((ueCb->f1UeDb->actionType == UE_CTXT_MOD) && (ueCb->f1UeDb->duUeCfg.numDrbModified)) + { + ieIdx++; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_Modified_List; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\ + UEContextModificationResponseIEs__value_PR_DRBs_Modified_List; + ret = BuildDrbModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\ + value.choice.DRBs_Modified_List) , &ueCb->f1UeDb->duUeCfg); + if(ret != ROK) + { + DU_LOG( "\nERROR --> F1AP : Failed to build DRB Modified List "); + break; + } + } + if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) { ieIdx++; @@ -15977,7 +16189,7 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb) /* Encode results */ if(encRetVal.encoded == ENCODE_FAIL) { - DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\ + DU_LOG( "\nERROR --> F1AP : Could not encode UE Modification Response structure (at %s)\n",\ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); ret = RFAILED; break; @@ -15994,9 +16206,9 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb) } /* Sending msg */ - if(sendF1APMsg() != ROK) + if(sendF1APMsg() != ROK && (ret == ROK)) { - DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Res Failed"); + DU_LOG("\nERROR --> F1AP : Sending UE Modification Res Failed"); ret = RFAILED; break; } @@ -16007,6 +16219,7 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb) FreeUeContextModResp(f1apMsg); return ret; } + /******************************************************************* * * @brief Deallocating the memory allocated by the aper decoder @@ -16085,6 +16298,7 @@ void freeAperDecodeUlTnlInfoforDrbSetupMod(ULUPTNLInformation_ToBeSetup_List_t * free(ulInfo->list.array); } } + /******************************************************************* * * @brief Deallocating the memory allocated by the aper decoder @@ -16208,6 +16422,169 @@ void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet) free(drbSet->list.array); } +} + +/******************************************************************* + * + * @brief Deallocating the memory allocated by the aper decoder + * for DrbSetupModItem + * + * @details + * + * Function : freeAperDecodeDrbModifiedItem + * + * Functionality: Deallocating memory allocated for DrbModifedItem + * + * @params[in] DRBs_ToBeModified_Item_t *drbItem + * + * @return void + * + * ****************************************************************/ + +void freeAperDecodeDrbModifiedItem(DRBs_ToBeModified_Item_t *drbItem) +{ + uint8_t arrIdx =0; + SNSSAI_t *snssai =NULLP; + Flows_Mapped_To_DRB_List_t *flowMap = NULLP; + + if(drbItem->qoSInformation != NULLP) + { + drbItem->qoSInformation->present = QoSInformation_PR_choice_extension; + switch(drbItem->qoSInformation->present) + { + case QoSInformation_PR_NOTHING: + break; + case QoSInformation_PR_eUTRANQoS: + { + if(drbItem->qoSInformation->choice.eUTRANQoS) + { + free(drbItem->qoSInformation->choice.eUTRANQoS); + } + break; + } + case QoSInformation_PR_choice_extension: + { + if(drbItem->qoSInformation->choice.choice_extension) + { + freeAperDecodeQosInfo(&drbItem->qoSInformation->choice.choice_extension->value.choice.\ + DRB_Information.dRB_QoS); + snssai = &drbItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information.sNSSAI; + if(snssai->sST.buf) + { + free(snssai->sST.buf); + } + if(snssai->sD) + { + if(snssai->sD->buf) + { + free(snssai->sD->buf); + } + free(snssai->sD); + } + + flowMap = &drbItem->qoSInformation->choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List; + if(flowMap->list.array) + { + for(arrIdx=0; arrIdxlist.count; arrIdx++) + { + if(flowMap->list.array[arrIdx] ) + { + freeAperDecodeQosInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters); + free(flowMap->list.array[arrIdx]); + } + } + free(flowMap->list.array); + } + + free(drbItem->qoSInformation->choice.choice_extension); + } + break; + } + } + free(drbItem->qoSInformation); + } + freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List); + if(drbItem->uLConfiguration) + { + free(drbItem->uLConfiguration); + } +} + +/******************************************************************* + * + * @brief Deallocating the memory allocated by the aper decoder + * for DrbToBeSetupModList + * + * @details + * + * Function : freeAperDecodeDrbToBeModifiedList + * + * Functionality: Deallocating memory allocated for DrbToBeModifiedList + * + * @params[in] DRBs_ToBeModified_List_t *drbSet + * + * @return void + * + * ****************************************************************/ + +void freeAperDecodeDrbToBeModifiedList(DRBs_ToBeModified_List_t *drbSet) +{ + uint8_t arrIdx =0; + struct DRBs_ToBeModified_ItemIEs *drbItemIe; + + if(drbSet->list.array) + { + for(arrIdx=0; arrIdxlist.count ; arrIdx++) + { + if(drbSet->list.array[arrIdx] != NULLP) + { + if(arrIdx == 0) + { + drbItemIe = (DRBs_ToBeModified_ItemIEs_t *)drbSet->list.array[arrIdx]; + freeAperDecodeDrbModifiedItem(&(drbItemIe->value.choice.DRBs_ToBeModified_Item)); + } + free(drbSet->list.array[arrIdx]); + } + } + free(drbSet->list.array); + } + +} + +/******************************************************************* + * + * @brief Deallocating the memory allocated by the aper decoder + * for DrbToBeSetupModList + * + * @details + * + * Function : freeAperDecodeDrbToBeReleasedList + * + * Functionality: Deallocating memory allocated for DrbToBeReleasedList + * + * @params[in] DRBs_ToBeReleased_List_t *drbSet + * + * @return void + * + * ****************************************************************/ + +void freeAperDecodeDrbToBeReleasedList(DRBs_ToBeReleased_List_t *drbSet) +{ + uint8_t arrIdx =0; + + if(drbSet->list.array) + { + for(arrIdx=0; arrIdxlist.count ; arrIdx++) + { + if(drbSet->list.array[arrIdx] != NULLP) + { + free(drbSet->list.array[arrIdx]); + } + } + free(drbSet->list.array); + } + } /******************************************************************* * @@ -16249,6 +16626,18 @@ void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *u value.choice.DRBs_ToBeSetupMod_List); break; } + case ProtocolIE_ID_id_DRBs_ToBeModified_List: + { + freeAperDecodeDrbToBeModifiedList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\ + value.choice.DRBs_ToBeModified_List); + break; + } + case ProtocolIE_ID_id_DRBs_ToBeReleased_List: + { + freeAperDecodeDrbToBeReleasedList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\ + value.choice.DRBs_ToBeReleased_List); + break; + } case ProtocolIE_ID_id_TransmissionActionIndicator: break; case ProtocolIE_ID_id_RRCContainer: @@ -16281,8 +16670,9 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) UEContextModificationRequest_t *ueContextModifyReq = NULLP; uint8_t ret = ROK, ieIdx = 0, cellIdx=0; DuUeCb *duUeCb = NULLP; - DRBs_ToBeSetupMod_List_t *drbSetupModCfg; - DRBs_ToBeModified_List_t *drbModifiedCfg; + DRBs_ToBeSetupMod_List_t *drbSetupModCfg = NULLP; + DRBs_ToBeModified_List_t *drbModifiedCfg = NULLP; + DRBs_ToBeReleased_List_t *drbToRelease = NULLP; uint32_t gnbCuUeF1apId, gnbDuUeF1apId; ueContextModifyReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest; @@ -16348,9 +16738,11 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List: case ProtocolIE_ID_id_DRBs_ToBeModified_List: + case ProtocolIE_ID_id_DRBs_ToBeReleased_List: { if(duUeCb->f1UeDb) { + /*DRBs to be Added*/ if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\ UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List) { @@ -16365,6 +16757,7 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) } } + /*DRBs to be Modified*/ if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \ UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List) @@ -16378,6 +16771,20 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) ret = RFAILED; } } + /*DRBs to be Released*/ + if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \ + UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List) + + { + drbToRelease = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\ + choice.DRBs_ToBeReleased_List; + if(extractDrbListToRelease(gnbDuUeF1apId, drbToRelease, drbToRelease->list.count,\ + &duUeCb->f1UeDb->duUeCfg, &duUeCb->rlcUeCfg)) + { + DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList"); + ret = RFAILED; + } + } } break; } diff --git a/src/du_app/du_f1ap_msg_hdl.h b/src/du_app/du_f1ap_msg_hdl.h index baaf6170c..432f6ec80 100644 --- a/src/du_app/du_f1ap_msg_hdl.h +++ b/src/du_app/du_f1ap_msg_hdl.h @@ -33,8 +33,8 @@ uint8_t BuildAndSendDUConfigUpdate(); uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti, uint16_t rrcContSize, uint8_t *rrcContainer); uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb *ueCb, uint8_t lcId, uint16_t msgLen, uint8_t *rrcMsg); -uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, MacUeCfg *storedMacUeCfg, void *cellGrp); -void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg); +uint8_t procUeRecfgCellInfo(DuMacUeCfg *macUeCfg, DuMacUeCfg *storedMacUeCfg, void *cellGrp); +void freeUeRecfgCellGrpInfo(DuMacUeCfg *macUeCfg); uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueId); uint8_t getDrbLcId(uint32_t *drbBitMap); void freeMacLcCfg(LcCfg *lcCfg); @@ -43,7 +43,7 @@ uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1 uint8_t sctpSend(Buffer *mBuf, uint8_t itfType); uint8_t duProcDlRrcMsg(F1DlRrcMsg *dlRrcMsg); uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb); -void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap); +void duFillModulationDetails(DuMacUeCfg *ueCfg, DuMacUeCfg *oldUeCfg, void *ueCap); int8_t getReAsmblTmr(uint8_t reAsmblTmrCfg); int16_t getStatProhTmr(uint8_t statProhTmrCfg); uint8_t duProcUeContextModReq(DuUeCb *ueCb); diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index e7345f58d..a51c30a1f 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -140,6 +140,35 @@ typedef struct drxCycle }DrxCycle; #endif +typedef struct duLcCfg +{ + ConfigType configType; + LcCfg lcConfig; +}DuLcCfg; + +typedef struct duMacUeCfg +{ + uint16_t cellId; + uint8_t ueId; + uint16_t crnti; + bool macCellGrpCfgPres; + MacCellGrpCfg macCellGrpCfg; + bool phyCellGrpCfgPres; + PhyCellGrpCfg phyCellGrpCfg; + bool spCellCfgPres; + SpCellRecfg spCellCfg; + AmbrCfg *ambrCfg; + ModulationInfo dlModInfo; /* DL modulation info */ //TBD + ModulationInfo ulModInfo; /* UL modulation info */ //TBD + uint8_t numLcs; + DuLcCfg lcCfgList[MAX_NUM_LC]; + UeCfgState macUeCfgState; /* InActive / Completed */ //TBD + DataTransmissionAction transmissionAction; //TBD +#ifdef NR_DRX + bool drxConfigIndicatorRelease; +#endif +}DuMacUeCfg; + typedef struct duUeCfg { void *cellGrpCfg; @@ -147,12 +176,13 @@ typedef struct duUeCfg uint8_t numRlcLcs; /* Rlc Ue Cfg */ RlcBearerCfg rlcLcCfg[MAX_NUM_LC]; uint8_t numMacLcs; /* Mac Ue Cfg */ - LcCfg macLcCfg[MAX_NUM_LC]; + DuLcCfg macLcCfg[MAX_NUM_LC]; AmbrCfg *ambrCfg; uint8_t numDrb; UpTnlCfg upTnlInfo[MAX_NUM_DRB]; /* User plane TNL Info*/ uint8_t numDrbSetupMod; /*No. of DRB Added during Modification*/ - MacUeCfg copyOfmacUeCfg; + uint8_t numDrbModified; /*No. of DRB Modified during Modification*/ + DuMacUeCfg copyOfmacUeCfg; DataTransmissionAction dataTransmissionAction; #ifdef NR_DRX bool drxCyclePres; @@ -188,7 +218,7 @@ typedef struct duUeCb 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 */ + DuMacUeCfg duMacUeCfg; /* 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 866244bb6..df6db7bf5 100644 --- a/src/du_app/du_mgr_msg_router.c +++ b/src/du_app/du_mgr_msg_router.c @@ -538,7 +538,7 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) } case EVENT_MAC_UE_RECONFIG_RSP: { - ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf); + ret = unpackDuMacUeRecfgRsp(DuProcMacUeRecfgRsp, pst, mBuf); break; } case EVENT_MAC_UE_DELETE_RSP: diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index d55defdc5..d009614f9 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -735,31 +735,31 @@ void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp) if(initUlBwp->puschPresent) { initUlBwp->puschCfg.dataScramblingId = SCRAMBLING_ID; - initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0; - initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \ - scramblingId0 = SCRAMBLING_ID; - initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1; - initUlBwp->puschCfg.numTimeDomRsrcAlloc = 2; - idx = 0; - if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC) - { - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2_CFG1; - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\ - MAPPING_TYPEA; - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL; - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL; - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\ - calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL); - - idx++; - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2_CFG2; - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType = MAPPING_TYPEA; - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL; - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL; - initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\ - calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL); - } - initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED; + initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0; + initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \ + scramblingId0 = SCRAMBLING_ID; + initUlBwp->puschCfg.resourceAllocType = RESOURCEALLOCATION_TYPE1; + initUlBwp->puschCfg.numTimeDomRsrcAlloc = 2; + idx = 0; + if(initUlBwp->puschCfg.numTimeDomRsrcAlloc <= MAX_NUM_UL_ALLOC) + { + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2_CFG1; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType =\ + MAPPING_TYPEA; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\ + calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL); + + idx++; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].k2 = PUSCH_K2_CFG2; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].mappingType = MAPPING_TYPEA; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbol = PUSCH_START_SYMBOL; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].symbolLength = PUSCH_LENGTH_SYMBOL; + initUlBwp->puschCfg.timeDomRsrcAllocList[idx].startSymbolAndLength =\ + calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL); + } + initUlBwp->puschCfg.transformPrecoder = TRANSFORM_PRECODER_DISABLED; } } else @@ -778,14 +778,14 @@ void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp) * * Functionality: Fills Sp Cell Group Info * - * @params[in] MacUeCfg *macUeCfg + * @params[in] DuMacUeCfg *macUeCfg * @return ROK - Success * RFAILED - Failure * *****************************************************************/ -uint8_t fillDefaultSpCellGrpInfo(MacUeCfg *macUeCfg) +uint8_t fillDefaultSpCellGrpInfo(DuMacUeCfg *macUeCfg) { - SpCellCfg *spCell = NULL; + SpCellRecfg *spCell = NULL; if(macUeCfg) spCell = &macUeCfg->spCellCfg; @@ -802,7 +802,8 @@ uint8_t fillDefaultSpCellGrpInfo(MacUeCfg *macUeCfg) return RFAILED; } - spCell->servCellCfg.numDlBwpToAdd = 0; + spCell->servCellCfg.numDlBwpToAddOrMod = 0; + spCell->servCellCfg.numDlBwpToRel = 0; spCell->servCellCfg.firstActvDlBwpId = ACTIVE_DL_BWP_ID; spCell->servCellCfg.defaultDlBwpId = ACTIVE_DL_BWP_ID; spCell->servCellCfg.bwpInactivityTmr = NULLP; @@ -814,8 +815,9 @@ uint8_t fillDefaultSpCellGrpInfo(MacUeCfg *macUeCfg) /* Filling Initial UL Bwp*/ fillDefaultInitUlBwp(&spCell->servCellCfg.initUlBwp); - spCell->servCellCfg.numUlBwpToAdd = 0; - spCell->servCellCfg.firstActvUlBwpId = ACTIVE_DL_BWP_ID; + spCell->servCellCfg.numUlBwpToAddOrMod = 0; + spCell->servCellCfg.numUlBwpToRel = 0; + spCell->servCellCfg.firstActvUlBwpId = ACTIVE_DL_BWP_ID; } else { @@ -835,11 +837,11 @@ uint8_t fillDefaultSpCellGrpInfo(MacUeCfg *macUeCfg) * * Functionality: Fills Physical Cell Group Info * - * @params[in] MacUeCfg *macUeCfg + * @params[in] DuMacUeCfg *macUeCfg * @return void * *****************************************************************/ -void fillDefaultPhyCellGrpInfo(MacUeCfg *macUeCfg) +void fillDefaultPhyCellGrpInfo(DuMacUeCfg *macUeCfg) { PhyCellGrpCfg *cellGrp = NULL; @@ -868,11 +870,11 @@ void fillDefaultPhyCellGrpInfo(MacUeCfg *macUeCfg) * * Functionality: Fills Mac Cell Group Info * - * @params[in] MacUeCfg *macUeCfg + * @params[in] DuMacUeCfg *macUeCfg * @return void * *****************************************************************/ -void fillDefaultMacCellGrpInfo(MacUeCfg *macUeCfg) +void fillDefaultMacCellGrpInfo(DuMacUeCfg *macUeCfg) { uint8_t idx; MacCellGrpCfg *cellGrp = NULL; @@ -971,7 +973,7 @@ void fillDefaultMacCellGrpInfo(MacUeCfg *macUeCfg) * RFAILED - failure * * ****************************************************************/ -void fillDefaultModulation(MacUeCfg *ueCfg) +void fillDefaultModulation(DuMacUeCfg *ueCfg) { ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK; ueCfg->dlModInfo.mcsIndex = DEFAULT_MCS; @@ -996,14 +998,14 @@ void fillDefaultModulation(MacUeCfg *ueCfg) * @return void *****************************************************************/ -void fillMacSrb1LcCfg(LcCfg *macLcCfg) +void fillMacSrb1LcCfg(DuLcCfg *macLcCfg) { - macLcCfg->lcId = SRB1_LCID; + macLcCfg->lcConfig.lcId = SRB1_LCID; macLcCfg->configType = CONFIG_ADD; - macLcCfg->drbQos = NULLP; - macLcCfg->snssai = NULLP; - macLcCfg->ulLcCfgPres = true; - fillDefaultUlLcCfg(&macLcCfg->ulLcCfg); + macLcCfg->lcConfig.drbQos = NULLP; + macLcCfg->lcConfig.snssai = NULLP; + macLcCfg->lcConfig.ulLcCfgPres = true; + fillDefaultUlLcCfg(&macLcCfg->lcConfig.ulLcCfg); } /****************************************************************** @@ -1021,71 +1023,71 @@ void fillMacSrb1LcCfg(LcCfg *macLcCfg) * *****************************************************************/ -uint8_t fillMacLcCfgToAddMod(LcCfg *macLcCfgToSend, LcCfg *ueLcCfgDb, LcCfg *oldLcCfg, Bool toUpdate) +uint8_t fillMacLcCfgToAddMod(DuLcCfg *macLcCfgToSend, DuLcCfg *ueLcCfgDb, DuLcCfg *oldLcCfg, Bool toUpdate) { if(!toUpdate) { if(macLcCfgToSend) { - macLcCfgToSend->lcId = ueLcCfgDb->lcId; + macLcCfgToSend->lcConfig.lcId = ueLcCfgDb->lcConfig.lcId; macLcCfgToSend->configType = ueLcCfgDb->configType; - if(ueLcCfgDb->drbQos) - macLcCfgToSend->drbQos = ueLcCfgDb->drbQos; + if(ueLcCfgDb->lcConfig.drbQos) + macLcCfgToSend->lcConfig.drbQos = ueLcCfgDb->lcConfig.drbQos; else if(oldLcCfg) - macLcCfgToSend->drbQos = oldLcCfg->drbQos; + macLcCfgToSend->lcConfig.drbQos = oldLcCfg->lcConfig.drbQos; else - macLcCfgToSend->drbQos = NULL; + macLcCfgToSend->lcConfig.drbQos = NULL; - if(ueLcCfgDb->snssai) - macLcCfgToSend->snssai = ueLcCfgDb->snssai; + if(ueLcCfgDb->lcConfig.snssai) + macLcCfgToSend->lcConfig.snssai = ueLcCfgDb->lcConfig.snssai; else if(oldLcCfg) - macLcCfgToSend->snssai = oldLcCfg->snssai; + macLcCfgToSend->lcConfig.snssai = oldLcCfg->lcConfig.snssai; else - macLcCfgToSend->snssai = NULL; + macLcCfgToSend->lcConfig.snssai = NULL; - macLcCfgToSend->ulLcCfgPres = ueLcCfgDb->ulLcCfgPres; - memcpy(&macLcCfgToSend->ulLcCfg, &ueLcCfgDb->ulLcCfg, sizeof(UlLcCfg)); - memcpy(&macLcCfgToSend->dlLcCfg, &ueLcCfgDb->dlLcCfg, sizeof(DlLcCfg)); + macLcCfgToSend->lcConfig.ulLcCfgPres = ueLcCfgDb->lcConfig.ulLcCfgPres; + memcpy(&macLcCfgToSend->lcConfig.ulLcCfg, &ueLcCfgDb->lcConfig.ulLcCfg, sizeof(UlLcCfg)); + memcpy(&macLcCfgToSend->lcConfig.dlLcCfg, &ueLcCfgDb->lcConfig.dlLcCfg, sizeof(DlLcCfg)); } } else { - oldLcCfg->lcId = ueLcCfgDb->lcId; + oldLcCfg->lcConfig.lcId = ueLcCfgDb->lcConfig.lcId; oldLcCfg->configType = ueLcCfgDb->configType; - if(ueLcCfgDb->drbQos) + if(ueLcCfgDb->lcConfig.drbQos) { - if(oldLcCfg->drbQos) - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->drbQos, sizeof(DrbQosInfo)); + if(oldLcCfg->lcConfig.drbQos) + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->lcConfig.drbQos, sizeof(DrbQosInfo)); - DU_ALLOC_SHRABL_BUF(oldLcCfg->drbQos, sizeof(DrbQosInfo)); - if(oldLcCfg->drbQos == NULL) + DU_ALLOC_SHRABL_BUF(oldLcCfg->lcConfig.drbQos, sizeof(DrbQosInfo)); + if(oldLcCfg->lcConfig.drbQos == NULL) { DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillMacLcCfgToAddMod()"); return RFAILED; } - memcpy(oldLcCfg->drbQos, ueLcCfgDb->drbQos, sizeof(DrbQosInfo)); + memcpy(oldLcCfg->lcConfig.drbQos, ueLcCfgDb->lcConfig.drbQos, sizeof(DrbQosInfo)); } - if(ueLcCfgDb->snssai) + if(ueLcCfgDb->lcConfig.snssai) { - if(oldLcCfg->snssai) - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->snssai, sizeof(Snssai)); + if(oldLcCfg->lcConfig.snssai) + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->lcConfig.snssai, sizeof(Snssai)); - DU_ALLOC_SHRABL_BUF(oldLcCfg->snssai, sizeof(Snssai)); - if(oldLcCfg->snssai == NULL) + DU_ALLOC_SHRABL_BUF(oldLcCfg->lcConfig.snssai, sizeof(Snssai)); + if(oldLcCfg->lcConfig.snssai == NULL) { DU_LOG("\nERROR --> DU APP : Memory Alloc Failed at fillMacLcCfgToAddMod()"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->drbQos, sizeof(DrbQosInfo)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, oldLcCfg->lcConfig.drbQos, sizeof(DrbQosInfo)); return RFAILED; } - memcpy(oldLcCfg->snssai, ueLcCfgDb->snssai, sizeof(Snssai)); + memcpy(oldLcCfg->lcConfig.snssai, ueLcCfgDb->lcConfig.snssai, sizeof(Snssai)); } - oldLcCfg->ulLcCfgPres = ueLcCfgDb->ulLcCfgPres; - memcpy(&oldLcCfg->ulLcCfg, &ueLcCfgDb->ulLcCfg, sizeof(UlLcCfg)); - memcpy(&oldLcCfg->dlLcCfg, &ueLcCfgDb->dlLcCfg, sizeof(DlLcCfg)); + oldLcCfg->lcConfig.ulLcCfgPres = ueLcCfgDb->lcConfig.ulLcCfgPres; + memcpy(&oldLcCfg->lcConfig.ulLcCfg, &ueLcCfgDb->lcConfig.ulLcCfg, sizeof(UlLcCfg)); + memcpy(&oldLcCfg->lcConfig.dlLcCfg, &ueLcCfgDb->lcConfig.dlLcCfg, sizeof(DlLcCfg)); } return ROK; } @@ -1147,38 +1149,38 @@ uint8_t fillAmbr(AmbrCfg **macAmbrCfgToSend, AmbrCfg *ueDbAmbr, AmbrCfg **oldMac * * @details * - * Function : sendUeReCfgReqToMac + * Function : sendUeRecfgReqToMac * * Functionality: Builds and Send UE ReConfig Request to MAC * - * @Params[in] MacUeCfg pointer + * @Params[in] MacUeRecfg pointer * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t sendUeReCfgReqToMac(MacUeCfg *macUeCfg) +uint8_t sendUeRecfgReqToMac(MacUeRecfg *macUeRecfg) { uint8_t ret = ROK; Pst pst; - + /* Fill Pst */ FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RECONFIG_REQ); - - if(macUeCfg) + + if(macUeRecfg) { /* Processing one Ue at a time to MAC */ DU_LOG("\nDEBUG --> DU_APP: Sending Ue Reconfig Request to MAC"); - ret = (*packMacUeReconfigReqOpts[pst.selector])(&pst, macUeCfg); + ret = (*packMacUeReconfigReqOpts[pst.selector])(&pst, macUeRecfg); if(ret == RFAILED) { - DU_LOG("\nERROR --> DU APP : Failed to send Reconfig Request to MAC at sendUeReCfgReqToMac()"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg)); + DU_LOG("\nERROR --> DU APP : Failed to send Reconfig Request to MAC at sendUeRecfgReqToMac()"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeRecfg, sizeof(MacUeRecfg)); } } else { - DU_LOG("\nERROR --> DU_APP: Received macUeCfg is NULLP at sendUeReCfgReqToMac()"); + DU_LOG("\nERROR --> DU_APP: Received macUeRecfg is NULLP at sendUeRecfgReqToMac()"); ret = RFAILED; } return ret; @@ -1188,57 +1190,57 @@ uint8_t sendUeReCfgReqToMac(MacUeCfg *macUeCfg) /****************************************************************** * - * @brief Fills MacUeCfg structure + * @brief update DuMacUeCfg structure * * @details * - * Function : fillMacUeCfg + * Function : updateDuMacUeCfg * - * Functionality: Fills MacUeCfg + * Functionality: Fills DuMacUeCfg * * @params[in] cellId, ueId, crnti, * DuUeCfg pointer, - * MacUeCfg pointer + * DuMacUeCfg pointer * @return ROK/RFAILED * *****************************************************************/ -uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *macUeCfg) +uint8_t updateDuMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuUeCfg *ueCfgDb, DuMacUeCfg *duMacUeCfg) { uint8_t ret = ROK, dbIdx = 0, lcIdx = 0, cellIdx = 0; bool lcIdFound = false; - MacUeCfg *duMacDb = NULLP; + DuMacUeCfg *duMacDb = NULLP; - macUeCfg->cellId = cellId; - macUeCfg->ueId = gnbDuUef1apId; - macUeCfg->crnti = crnti; + duMacUeCfg->cellId = cellId; + duMacUeCfg->ueId = gnbDuUef1apId; + duMacUeCfg->crnti = crnti; if(!ueCfgDb) { - fillDefaultMacCellGrpInfo(macUeCfg); - fillDefaultPhyCellGrpInfo(macUeCfg); + fillDefaultMacCellGrpInfo(duMacUeCfg); + fillDefaultPhyCellGrpInfo(duMacUeCfg); - if((fillDefaultSpCellGrpInfo(macUeCfg)) != ROK) + if((fillDefaultSpCellGrpInfo(duMacUeCfg)) != ROK) { DU_LOG("\nERROR --> DUAPP : Failed in fillDefaultSpCellGrpInfo"); return RFAILED; } - macUeCfg->ambrCfg = NULLP; - fillDefaultModulation(macUeCfg); - fillMacSrb1LcCfg(&macUeCfg->lcCfgList[0]); - macUeCfg->numLcs++; + duMacUeCfg->ambrCfg = NULLP; + fillDefaultModulation(duMacUeCfg); + fillMacSrb1LcCfg(&duMacUeCfg->lcCfgList[0]); + duMacUeCfg->numLcs++; } else { if(ueCfgDb->dataTransmissionAction == STOP_TRANSMISSION) { - macUeCfg->transmissionAction = ueCfgDb->dataTransmissionAction; + duMacUeCfg->transmissionAction = ueCfgDb->dataTransmissionAction; return ROK; } GET_CELL_IDX(cellId, cellIdx); if(duCb.actvCellLst[cellIdx]) - duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[macUeCfg->ueId-1].macUeCfg; + duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[duMacUeCfg->ueId-1].duMacUeCfg; else { DU_LOG("\nERROR --> DU APP : Cell Id [%d] does not exist", cellId); @@ -1248,56 +1250,56 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuU if(ueCfgDb->cellGrpCfg) { - ret = procUeReCfgCellInfo(macUeCfg, duMacDb, ueCfgDb->cellGrpCfg); + ret = procUeRecfgCellInfo(duMacUeCfg, duMacDb, ueCfgDb->cellGrpCfg); if(ret == ROK) { - if(macUeCfg->spCellCfgPres == true) + if(duMacUeCfg->spCellCfgPres == true) { - if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent) + if(duMacUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent) { - fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\ - &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL); + fillStartSymbolAndLen(duMacUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\ + &duMacUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL); } - if(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent) + if(duMacUeCfg->spCellCfg.servCellCfg.initUlBwp.puschPresent) { - fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\ - NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg); + fillStartSymbolAndLen(duMacUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\ + NULL, &duMacUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg); } } if(duMacDb) - ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg , &duMacDb->ambrCfg, FALSE); + ret = fillAmbr(&duMacUeCfg->ambrCfg, ueCfgDb->ambrCfg , &duMacDb->ambrCfg, FALSE); else - ret = fillAmbr(&macUeCfg->ambrCfg, ueCfgDb->ambrCfg , NULL, FALSE); + ret = fillAmbr(&duMacUeCfg->ambrCfg, ueCfgDb->ambrCfg , NULL, FALSE); - duFillModulationDetails(macUeCfg, duMacDb, ueCfgDb->ueNrCapability); + duFillModulationDetails(duMacUeCfg, duMacDb, ueCfgDb->ueNrCapability); } } else { - fillDefaultMacCellGrpInfo(macUeCfg); - fillDefaultPhyCellGrpInfo(macUeCfg); - fillDefaultSpCellGrpInfo(macUeCfg); - fillDefaultModulation(macUeCfg); - macUeCfg->ambrCfg = NULLP; + fillDefaultMacCellGrpInfo(duMacUeCfg); + fillDefaultPhyCellGrpInfo(duMacUeCfg); + fillDefaultSpCellGrpInfo(duMacUeCfg); + fillDefaultModulation(duMacUeCfg); + duMacUeCfg->ambrCfg = NULLP; } #ifdef NR_DRX - macUeCfg->drxConfigIndicatorRelease = ueCfgDb->drxConfigIndicatorRelease; + duMacUeCfg->drxConfigIndicatorRelease = ueCfgDb->drxConfigIndicatorRelease; if(ueCfgDb->drxCyclePres) { - macUeCfg->macCellGrpCfg.drxCfg.drxLongCycleStartOffset.drxLongCycleStartOffsetChoice = ueCfgDb->drxCycle.drxLongCycleLength; + duMacUeCfg->macCellGrpCfg.drxCfg.drxLongCycleStartOffset.drxLongCycleStartOffsetChoice = ueCfgDb->drxCycle.drxLongCycleLength; if(ueCfgDb->drxCycle.shortDrxCyclePres) { - macUeCfg->macCellGrpCfg.drxCfg.shortDrxPres = true; - macUeCfg->macCellGrpCfg.drxCfg.shortDrx.drxShortCycle = ueCfgDb->drxCycle.shortDrxCycle.drxShortCycle; - macUeCfg->macCellGrpCfg.drxCfg.shortDrx.drxShortCycleTimer = ueCfgDb->drxCycle.shortDrxCycle.drxShortCycleTimer; + duMacUeCfg->macCellGrpCfg.drxCfg.shortDrxPres = true; + duMacUeCfg->macCellGrpCfg.drxCfg.shortDrx.drxShortCycle = ueCfgDb->drxCycle.shortDrxCycle.drxShortCycle; + duMacUeCfg->macCellGrpCfg.drxCfg.shortDrx.drxShortCycleTimer = ueCfgDb->drxCycle.shortDrxCycle.drxShortCycleTimer; } else { - macUeCfg->macCellGrpCfg.drxCfg.shortDrxPres = false; + duMacUeCfg->macCellGrpCfg.drxCfg.shortDrxPres = false; } } #endif @@ -1305,25 +1307,25 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuU /* Filling LC Context */ for(dbIdx = 0; (dbIdx < ueCfgDb->numMacLcs && ret == ROK); dbIdx++) { - if(!ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres) + if(!ueCfgDb->macLcCfg[dbIdx].lcConfig.ulLcCfgPres) { /* Filling default UL LC config in MAC if not present */ - ueCfgDb->macLcCfg[dbIdx].ulLcCfgPres = true; - fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].ulLcCfg); + ueCfgDb->macLcCfg[dbIdx].lcConfig.ulLcCfgPres = true; + fillDefaultUlLcCfg(&ueCfgDb->macLcCfg[dbIdx].lcConfig.ulLcCfg); } if(duMacDb) { for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++) { - if(ueCfgDb->macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId) + if(ueCfgDb->macLcCfg[dbIdx].lcConfig.lcId == duMacDb->lcCfgList[lcIdx].lcConfig.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],\ + ret = fillMacLcCfgToAddMod(&duMacUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx],\ &duMacDb->lcCfgList[lcIdx], FALSE); } } @@ -1335,19 +1337,19 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuU if(!lcIdFound) { /* ADD/DEL CONFIG */ - ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx], NULL, FALSE); + ret = fillMacLcCfgToAddMod(&duMacUeCfg->lcCfgList[dbIdx], &ueCfgDb->macLcCfg[dbIdx], NULL, FALSE); } if(ret == ROK) { - macUeCfg->numLcs++; + duMacUeCfg->numLcs++; } else { - DU_LOG("\nERROR --> DU APP : Failed to add Lc at Idx %d in fillMacUeCfg()", dbIdx); + DU_LOG("\nERROR --> DU APP : Failed to add Lc at Idx %d in updateDuMacUeCfg()", dbIdx); break; } }/*End of Outer FOR loop */ - memcpy(&ueCfgDb->copyOfmacUeCfg, macUeCfg, sizeof(MacUeCfg)); + memcpy(&ueCfgDb->copyOfmacUeCfg, duMacUeCfg, sizeof(DuMacUeCfg)); } return ret; } @@ -1576,7 +1578,7 @@ uint8_t fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg) * * @details * - * Function : sendUeReCfgReqToRlc + * Function : sendUeRecfgReqToRlc * * Functionality: * Processes UE Reconfig Req to RLC UL @@ -1587,7 +1589,7 @@ uint8_t fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg) * *****************************************************************/ -uint8_t sendUeReCfgReqToRlc(RlcUeCfg *rlcUeCfg) +uint8_t sendUeRecfgReqToRlc(RlcUeCfg *rlcUeCfg) { uint8_t ret; Pst pst; @@ -1600,13 +1602,13 @@ uint8_t sendUeReCfgReqToRlc(RlcUeCfg *rlcUeCfg) ret = (*packRlcUeReconfigReqOpts[pst.selector])(&pst, rlcUeCfg); if(ret == RFAILED) { - DU_LOG("\nERROR --> DU_APP : Failed to send Ue Reconfig Req to RLC at sendUeReCfgReqToRlc()"); + DU_LOG("\nERROR --> DU_APP : Failed to send Ue Reconfig Req to RLC at sendUeRecfgReqToRlc()"); DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg)); } } else { - DU_LOG("\nERROR --> DU_APP: Received RlcUeCfg is NULL at sendUeReCfgReqToRlc()"); + DU_LOG("\nERROR --> DU_APP: Received RlcUeCfg is NULL at sendUeRecfgReqToRlc()"); ret = RFAILED; } return ret; @@ -1778,9 +1780,9 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId) duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState = UE_ACTIVE; /* Filling Mac Ue Config */ - memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg, 0, sizeof(MacUeCfg)); + memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duMacUeCfg, 0, sizeof(DuMacUeCfg)); ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueCcchCtxt->gnbDuUeF1apId, ueCcchCtxt->crnti, NULL, - &duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg); + &duCb.actvCellLst[cellIdx]->ueCb[ueIdx].duMacUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC"); @@ -1799,6 +1801,84 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId) return ret; } +/********************************************************************************** + * + * @brief Fills Ue Cfg from DU DB to MacUeCfg + * + * @details + * + * Function : fillMacUeCfg + * + * Functionality: fills ue Cfg to be sent to MAC + * + * @params[in] DuMacUeCfg Pointer + * MacUeCfg Pointer + * + * @return ROK - success + * RFAILED - failure + * *******************************************************************************/ +void fillMacUeCfg(DuMacUeCfg *duMacUeCfg, MacUeCfg *macUeCfg) +{ + uint8_t lcIdx = 0; + + macUeCfg->cellId = duMacUeCfg->cellId; + macUeCfg->ueId = duMacUeCfg->ueId; + macUeCfg->crnti = duMacUeCfg->crnti; + macUeCfg->macCellGrpCfgPres = duMacUeCfg->macCellGrpCfgPres; + if(macUeCfg->macCellGrpCfgPres) + { + memcpy(&macUeCfg->macCellGrpCfg, &duMacUeCfg->macCellGrpCfg, sizeof(MacCellGrpCfg)); + } + macUeCfg->phyCellGrpCfgPres = duMacUeCfg->phyCellGrpCfgPres; + if(macUeCfg->phyCellGrpCfgPres) + { + memcpy(&macUeCfg->phyCellGrpCfg, &duMacUeCfg->phyCellGrpCfg, sizeof(PhyCellGrpCfg)); + } + macUeCfg->spCellCfgPres = duMacUeCfg->spCellCfgPres; + if(macUeCfg->spCellCfgPres) + { + macUeCfg->spCellCfg.servCellIdx = duMacUeCfg->spCellCfg.servCellIdx; + macUeCfg->spCellCfg.servCellCfg.initDlBwp = duMacUeCfg->spCellCfg.servCellCfg.initDlBwp; + macUeCfg->spCellCfg.servCellCfg.numDlBwpToAdd = duMacUeCfg->spCellCfg.servCellCfg.numDlBwpToAddOrMod; + if(macUeCfg->spCellCfg.servCellCfg.numDlBwpToAdd > 0) + { + memcpy(macUeCfg->spCellCfg.servCellCfg.dlBwpToAddList, duMacUeCfg->spCellCfg.servCellCfg.dlBwpToAddOrModList, \ + (sizeof(DlBwpInfo) * MAX_NUM_BWP)); + } + macUeCfg->spCellCfg.servCellCfg.firstActvDlBwpId = duMacUeCfg->spCellCfg.servCellCfg.firstActvDlBwpId; + macUeCfg->spCellCfg.servCellCfg.defaultDlBwpId = duMacUeCfg->spCellCfg.servCellCfg.defaultDlBwpId; + macUeCfg->spCellCfg.servCellCfg.bwpInactivityTmr = duMacUeCfg->spCellCfg.servCellCfg.bwpInactivityTmr; + memcpy(&macUeCfg->spCellCfg.servCellCfg.pdschServCellCfg, &duMacUeCfg->spCellCfg.servCellCfg.pdschServCellCfg, sizeof(PdschServCellCfg)); + memcpy(&macUeCfg->spCellCfg.servCellCfg.initUlBwp, &duMacUeCfg->spCellCfg.servCellCfg.initUlBwp, sizeof(InitialUlBwp)); + macUeCfg->spCellCfg.servCellCfg.numUlBwpToAdd = duMacUeCfg->spCellCfg.servCellCfg.numUlBwpToAddOrMod; + if(macUeCfg->spCellCfg.servCellCfg.numUlBwpToAdd > 0) + { + memcpy(macUeCfg->spCellCfg.servCellCfg.ulBwpToAddList, duMacUeCfg->spCellCfg.servCellCfg.ulBwpToAddOrModList,\ + (sizeof(UlBwpInfo) * MAX_NUM_BWP)); + } + macUeCfg->spCellCfg.servCellCfg.firstActvUlBwpId = duMacUeCfg->spCellCfg.servCellCfg.firstActvUlBwpId; + } + if(duMacUeCfg->ambrCfg != NULLP) + { + memcpy(macUeCfg->ambrCfg, duMacUeCfg->ambrCfg, sizeof(AmbrCfg)); + } + memcpy(&macUeCfg->dlModInfo, &duMacUeCfg->dlModInfo, sizeof(ModulationInfo)); + memcpy(&macUeCfg->ulModInfo, &duMacUeCfg->ulModInfo, sizeof(ModulationInfo)); + if(duMacUeCfg->numLcs > 0) + { + macUeCfg->numLcs = 0; + for(lcIdx = 0; lcIdx < duMacUeCfg->numLcs; lcIdx++) + { + if(duMacUeCfg->lcCfgList[lcIdx].configType == CONFIG_ADD) + { + //VS: To thoroughly check + memcpy(&macUeCfg->lcCfgList[macUeCfg->numLcs], &duMacUeCfg->lcCfgList[lcIdx].lcConfig, sizeof(LcCfg)); + macUeCfg->numLcs++; + } + } + } +} + /****************************************************************** * * @brief Builds and Send UE Create Request to MAC @@ -1819,7 +1899,7 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId) * * ****************************************************************/ -uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *duMacUeCfg) +uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, DuMacUeCfg *duMacUeCfg) { uint8_t ret = ROK; MacUeCfg *macUeCfg = NULLP; @@ -1827,7 +1907,7 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, u memset(&pst, 0, sizeof(Pst)); - ret = fillMacUeCfg(cellId, gnbDuUeF1apId, crnti, ueCfgDb, duMacUeCfg); + ret = updateDuMacUeCfg(cellId, gnbDuUeF1apId, crnti, ueCfgDb, duMacUeCfg); if(ret == RFAILED) { DU_LOG("\nERROR --> DU APP : Failed to fill MacUeCfg at duBuildAndSendUeCreateReqToMac()"); @@ -1842,7 +1922,7 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, u if(macUeCfg) { memset(macUeCfg, 0, sizeof(MacUeCfg)); - memcpy(macUeCfg, duMacUeCfg, sizeof(MacUeCfg)); + fillMacUeCfg(duMacUeCfg, macUeCfg); DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to MAC"); /* Processing one Ue at a time to MAC */ @@ -2000,22 +2080,22 @@ uint8_t DuProcMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp) * RFAILED - failure * * ****************************************************************/ -uint8_t duUpdateMacCfg(MacUeCfg *macUeCfg, F1UeContextSetupDb *f1UeDb) +uint8_t duUpdateMacCfg(DuMacUeCfg *macUeCfg, F1UeContextSetupDb *f1UeDb) { uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx, cellIdx; - MacUeCfg *oldMacUeCfg; + DuMacUeCfg *oldMacUeCfg; ret = ROK; - + GET_CELL_IDX(macUeCfg->cellId, cellIdx); if(duCb.actvCellLst[cellIdx] == NULLP) { DU_LOG("\nERROR --> DU APP: CellId[%d] not found", macUeCfg->cellId); return RFAILED; } - oldMacUeCfg = &duCb.actvCellLst[cellIdx]->ueCb[macUeCfg->ueId-1].macUeCfg; + oldMacUeCfg = &duCb.actvCellLst[cellIdx]->ueCb[macUeCfg->ueId-1].duMacUeCfg; /*Filling Cell Group Cfg*/ - ret = procUeReCfgCellInfo(macUeCfg, &f1UeDb->duUeCfg.copyOfmacUeCfg, f1UeDb->duUeCfg.cellGrpCfg); + ret = procUeRecfgCellInfo(macUeCfg, &f1UeDb->duUeCfg.copyOfmacUeCfg, f1UeDb->duUeCfg.cellGrpCfg); #ifdef NR_DRX memcpy(&macUeCfg->macCellGrpCfg.drxCfg, &f1UeDb->duUeCfg.copyOfmacUeCfg.macCellGrpCfg.drxCfg, sizeof(DrxCfg)); #endif @@ -2024,12 +2104,12 @@ uint8_t duUpdateMacCfg(MacUeCfg *macUeCfg, F1UeContextSetupDb *f1UeDb) if(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschPresent) { fillStartSymbolAndLen(macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg.numTimeDomRsrcAlloc,\ - &macUeCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, NULL); + &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); + NULL, &macUeCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg); } ret = fillAmbr(NULL, f1UeDb->duUeCfg.ambrCfg, &oldMacUeCfg->ambrCfg, true); duFillModulationDetails(macUeCfg, oldMacUeCfg, f1UeDb->duUeCfg.ueNrCapability); @@ -2041,42 +2121,42 @@ uint8_t duUpdateMacCfg(MacUeCfg *macUeCfg, F1UeContextSetupDb *f1UeDb) numLcs = macUeCfg->numLcs; for(lcIdx = 0; lcIdx < numLcs; lcIdx++) { - if(f1UeDb->duUeCfg.macLcCfg[dbIdx].lcId == macUeCfg->lcCfgList[lcIdx].lcId) - { - if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_MOD) - { - ret = fillMacLcCfgToAddMod(NULL, &f1UeDb->duUeCfg.macLcCfg[dbIdx], &macUeCfg->lcCfgList[lcIdx], true); - } - else if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_DEL) - { - /* Free memory at matched lcIdx index */ - freeMacLcCfg(&macUeCfg->lcCfgList[lcIdx]); - macUeCfg->numLcs--; - for(lcDelIdx = lcIdx; lcDelIdx < macUeCfg->numLcs; lcDelIdx++) - { - /* moving all elements one index ahead */ - ret = fillMacLcCfgToAddMod(NULL, &macUeCfg->lcCfgList[lcDelIdx+1], &macUeCfg->lcCfgList[lcDelIdx], true); - freeMacLcCfg(&macUeCfg->lcCfgList[lcDelIdx+1]); - if(ret == RFAILED) - { + if(f1UeDb->duUeCfg.macLcCfg[dbIdx].lcConfig.lcId == macUeCfg->lcCfgList[lcIdx].lcConfig.lcId) + { + if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_MOD) + { + ret = fillMacLcCfgToAddMod(NULL, &f1UeDb->duUeCfg.macLcCfg[dbIdx], &macUeCfg->lcCfgList[lcIdx], true); + } + else if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_DEL) + { + /* Free memory at matched lcIdx index */ + freeMacLcCfg(&macUeCfg->lcCfgList[lcIdx].lcConfig); + macUeCfg->numLcs--; + for(lcDelIdx = lcIdx; lcDelIdx < macUeCfg->numLcs; lcDelIdx++) + { + /* moving all elements one index ahead */ + ret = fillMacLcCfgToAddMod(NULL, &macUeCfg->lcCfgList[lcDelIdx+1], &macUeCfg->lcCfgList[lcDelIdx], true); + freeMacLcCfg(&macUeCfg->lcCfgList[lcDelIdx+1].lcConfig); + if(ret == RFAILED) + { DU_LOG("\nERROR --> DU APP : Failed to delete LC at Idx %d in duUpdateMacCfg()", lcDelIdx); - break; - } - } - } - } + break; + } + } + } + } } if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_ADD) { - ret = fillMacLcCfgToAddMod(NULL, &f1UeDb->duUeCfg.macLcCfg[dbIdx], &macUeCfg->lcCfgList[numLcs], true); - if(ret == RFAILED) - { - DU_LOG("\nERROR --> DU APP : Failed to add LC at Idx %d in duUpdateMacCfg()", numLcs); - break; - } - macUeCfg->numLcs++; + ret = fillMacLcCfgToAddMod(NULL, &f1UeDb->duUeCfg.macLcCfg[dbIdx], &macUeCfg->lcCfgList[numLcs], true); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU APP : Failed to add LC at Idx %d in duUpdateMacCfg()", numLcs); + break; + } + macUeCfg->numLcs++; } - + } return ret; } @@ -2433,8 +2513,6 @@ uint8_t duUpdateTunnelCfgDb(uint8_t ueId, uint8_t cellId, DuUeCfg *duUeCfg) break; } } - else - break; } return ret; } @@ -2472,10 +2550,10 @@ uint8_t duUpdateDuUeCbCfg(uint8_t ueId, uint8_t cellId) { /*Filling MAC Ue Cfg */ GET_CRNTI(crnti, ueId); - ueCb->macUeCfg.cellId = cellId; - ueCb->macUeCfg.ueId = ueId; - ueCb->macUeCfg.crnti = crnti; - ret = duUpdateMacCfg(&ueCb->macUeCfg, ueCb->f1UeDb); + ueCb->duMacUeCfg.cellId = cellId; + ueCb->duMacUeCfg.ueId = ueId; + ueCb->duMacUeCfg.crnti = crnti; + ret = duUpdateMacCfg(&ueCb->duMacUeCfg, ueCb->f1UeDb); if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed while updating MAC LC Config at duUpdateDuUeCbCfg()"); else @@ -2523,10 +2601,10 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].gnbDuUeF1apId == cfgRsp->ueId)) { - duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState = UE_CREATE_COMPLETE; + duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].duMacUeCfg.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].duMacUeCfg.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) @@ -2549,29 +2627,70 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) } } } - else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP) + } + else + { + DU_LOG("\nERROR --> DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [DU UE F1AP ID : %d]", pst->event, cfgRsp->ueId); + ret = RFAILED; + } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); + } + else + { + DU_LOG("\nERROR --> DU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCfgRsp()"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* + * + * @brief Handle UE Reconfig response from MAC + * + * @details + * + * Function : DuProcMacUeRecfgRsp + * + * Functionality: Handle UE ReConfig response from MAC + * + * @params[in] Pointer to MacUeRecfgRsp and Pst + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *reCfgRsp) +{ + uint8_t ret = ROK; + uint16_t cellIdx; + + if(reCfgRsp) + { + GET_CELL_IDX(reCfgRsp->cellId, cellIdx); + if(reCfgRsp->result == MAC_DU_APP_RSP_OK) + { + if(pst->event == EVENT_MAC_UE_RECONFIG_RSP) { - DU_LOG("\nINFO --> DU APP : MAC UE Reconfig Response : SUCCESS [DU UE F1AP ID : %d]", cfgRsp->ueId); + DU_LOG("\nINFO --> DU APP : MAC UE Reconfig Response : SUCCESS [DU UE F1AP ID : %d]", reCfgRsp->ueId); if(duCb.actvCellLst[cellIdx] && - (duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].gnbDuUeF1apId == cfgRsp->ueId)) + (duCb.actvCellLst[cellIdx]->ueCb[reCfgRsp->ueId -1].gnbDuUeF1apId == reCfgRsp->ueId)) { - duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState = UE_RECFG_COMPLETE; - if((duCb.actvCellLst[cellIdx]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState == UE_RECFG_COMPLETE) && - (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].rlcUeCfg.rlcUeCfgState == UE_RECFG_COMPLETE)) + duCb.actvCellLst[cellIdx]->ueCb[reCfgRsp->ueId -1].duMacUeCfg.macUeCfgState = UE_RECFG_COMPLETE; + if((duCb.actvCellLst[cellIdx]->ueCb[reCfgRsp->ueId -1].duMacUeCfg.macUeCfgState == UE_RECFG_COMPLETE) && + (duCb.actvCellLst[reCfgRsp->cellId -1]->ueCb[reCfgRsp->ueId -1].rlcUeCfg.rlcUeCfgState == UE_RECFG_COMPLETE)) { - if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK) + if((ret = duUpdateDuUeCbCfg(reCfgRsp->ueId, reCfgRsp->cellId)) == ROK) { - if((BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId)) != ROK) + if((BuildAndSendUeCtxtRsp(reCfgRsp->cellId, reCfgRsp->ueId)) != ROK) { DU_LOG("\nERROR -> DU APP : Failure in BuildAndSendUeCtxtRsp()"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, reCfgRsp, sizeof(MacUeRecfgRsp)); 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)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, reCfgRsp, sizeof(MacUeRecfgRsp)); return RFAILED; } } @@ -2580,24 +2699,23 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) } else { - DU_LOG("\nERROR --> DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [DU UE F1AP ID : %d]", pst->event, cfgRsp->ueId); + DU_LOG("\nERROR --> DU APP : MAC UE RECFG Response for EVENT[%d]: FAILURE [DU UE F1AP ID : %d]", pst->event, reCfgRsp->ueId); 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)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, reCfgRsp, sizeof(MacUeRecfgRsp)); } else { - DU_LOG("\nERROR --> DU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCfgRsp()"); + DU_LOG("\nERROR --> DU APP : Received MAC Ue ReConfig Response is NULL at DuProcMacUeRecfgRsp()"); ret = RFAILED; } return ret; } - /******************************************************************* * * @brief Processes UE create Req to RLC UL @@ -2687,7 +2805,7 @@ 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].duMacUeCfg.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) @@ -2715,7 +2833,7 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) DU_LOG("\nINFO --> DU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueId); duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE; - if((duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].macUeCfg.macUeCfgState == UE_RECFG_COMPLETE) && + if((duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].duMacUeCfg.macUeCfgState == UE_RECFG_COMPLETE) && (duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueId -1].rlcUeCfg.rlcUeCfgState == UE_RECFG_COMPLETE)) { if((ret = duUpdateDuUeCbCfg(cfgRsp->ueId, cfgRsp->cellId)) == ROK) @@ -2762,7 +2880,7 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) * * @details * - * Function : duBuildAndSendUeReCfgReqToRLC + * Function : duBuildAndSendUeRecfgReqToRLC * * Functionality: Builds and Send Ue Reconfig Req to RLC * @@ -2774,7 +2892,7 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) * * ****************************************************************/ -uint8_t duBuildAndSendUeReCfgReqToRlc(uint8_t cellId, uint8_t gnbDuUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb) +uint8_t duBuildAndSendUeRecfgReqToRlc(uint8_t cellId, uint8_t gnbDuUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb) { uint8_t ret = ROK; RlcUeCfg *rlcUeCfg = NULLP; @@ -2785,56 +2903,139 @@ uint8_t duBuildAndSendUeReCfgReqToRlc(uint8_t cellId, uint8_t gnbDuUeF1apId, uin memset(rlcUeCfg, 0, sizeof(RlcUeCfg)); ret = fillRlcUeCfg(cellId, gnbDuUeF1apId, ueCfgDb, rlcUeCfg); if(ret == RFAILED) - DU_LOG("\nERROR --> DU APP : Failed at duBuildAndSendUeReCfgReqToRlc()"); + DU_LOG("\nERROR --> DU APP : Failed at duBuildAndSendUeRecfgReqToRlc()"); else - ret = sendUeReCfgReqToRlc(rlcUeCfg); + ret = sendUeRecfgReqToRlc(rlcUeCfg); } else { - DU_LOG("\nERROR --> DU APP : Memory Alloc failed at duBuildAndSendUeReCfgReqToRlc()"); + DU_LOG("\nERROR --> DU APP : Memory Alloc failed at duBuildAndSendUeRecfgReqToRlc()"); ret = RFAILED; } return ret; } +/********************************************************************************** + * + * @brief Fills Ue ReCfg from DU DB to MacUeRecfg + * + * @details + * + * Function : fillMacUeRecfg + * + * Functionality: fills ue ReCfg to be sent to MAC + * + * @params[in] DuMacUeCfg Pointer + * MacUeRecfg Pointer + * + * @return void + * *******************************************************************************/ +void fillMacUeRecfg(DuMacUeCfg *duMacUeCfg, MacUeRecfg *macUeRecfg) +{ + uint8_t lcIdx = 0; + + macUeRecfg->cellId = duMacUeCfg->cellId; + macUeRecfg->ueId = duMacUeCfg->ueId; + macUeRecfg->crnti = duMacUeCfg->crnti; + macUeRecfg->macCellGrpRecfgPres = duMacUeCfg->macCellGrpCfgPres; + if(macUeRecfg->macCellGrpRecfgPres) + { + memcpy(&macUeRecfg->macCellGrpRecfg, &duMacUeCfg->macCellGrpCfg, sizeof(MacCellGrpCfg)); + } + macUeRecfg->phyCellGrpRecfgPres = duMacUeCfg->phyCellGrpCfgPres; + if(macUeRecfg->phyCellGrpRecfgPres) + { + memcpy(&macUeRecfg->phyCellGrpRecfg, &duMacUeCfg->phyCellGrpCfg, sizeof(PhyCellGrpCfg)); + } + macUeRecfg->spCellRecfgPres = duMacUeCfg->spCellCfgPres; + if(macUeRecfg->spCellRecfgPres) + { + memcpy(&macUeRecfg->spCellRecfg, &duMacUeCfg->spCellCfg, sizeof(SpCellRecfg)); + } + if(duMacUeCfg->ambrCfg != NULLP) + { + DU_ALLOC_SHRABL_BUF(macUeRecfg->ambrRecfg, sizeof(AmbrCfg)); + memcpy(macUeRecfg->ambrRecfg, duMacUeCfg->ambrCfg, sizeof(AmbrCfg)); + } + memcpy(&macUeRecfg->dlModInfo, &duMacUeCfg->dlModInfo, sizeof(ModulationInfo)); + memcpy(&macUeRecfg->ulModInfo, &duMacUeCfg->ulModInfo, sizeof(ModulationInfo)); + if(duMacUeCfg->numLcs > 0) + { + macUeRecfg->numLcsToAdd = 0; + macUeRecfg->numLcsToDel = 0; + macUeRecfg->numLcsToMod = 0; + + for(lcIdx = 0; lcIdx < duMacUeCfg->numLcs; lcIdx++) + { + if(duMacUeCfg->lcCfgList[lcIdx].configType == CONFIG_ADD) + { + /*VS: To thoroughly check*/ + memcpy(&macUeRecfg->lcCfgAdd[macUeRecfg->numLcsToAdd], &duMacUeCfg->lcCfgList[lcIdx].lcConfig, sizeof(LcCfg)); + macUeRecfg->numLcsToAdd++; + } + if(duMacUeCfg->lcCfgList[lcIdx].configType == CONFIG_DEL) + { + /*VS: To thoroughly check*/ + macUeRecfg->lcIdToDel[macUeRecfg->numLcsToDel] = duMacUeCfg->lcCfgList[lcIdx].lcConfig.lcId; + macUeRecfg->numLcsToDel++; + } + if(duMacUeCfg->lcCfgList[lcIdx].configType == CONFIG_MOD) + { + /*VS: To thoroughly check*/ + memcpy(&macUeRecfg->lcCfgMod[macUeRecfg->numLcsToMod], &duMacUeCfg->lcCfgList[lcIdx].lcConfig, sizeof(LcCfg)); + macUeRecfg->numLcsToMod++; + } + } + } + macUeRecfg->transmissionAction = duMacUeCfg->transmissionAction; +#ifdef NR_DRX + macUeRecfg->drxConfigIndicatorRelease = duMacUeCfg->drxConfigIndicatorRelease; +#endif +} + /******************************************************************* * * @brief Builds and Send Ue Reconfig Req to MAC * * @details * - * Function : duBuildAndSendUeReCfgReqToMac + * Function : duBuildAndSendUeRecfgReqToMac * * Functionality: Builds and Send Ue Reconfig Req to MAC * * @params[in] CellGroupConfigRrc_t *macCellGrpCfg * DuUeCfg *ueCfgDb - * MacUeCfg *macUeCfg * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t duUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb) +uint8_t duBuildAndSendUeRecfgReqToMac(uint8_t cellId, uint8_t duUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb) { uint8_t ret = ROK; - MacUeCfg *macUeCfg = NULLP; + DuMacUeCfg *duMacUeCfg = NULLP; + MacUeRecfg *macUeRecfg = NULLP; - DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg)); - if(macUeCfg) + DU_ALLOC(duMacUeCfg, sizeof(DuMacUeCfg)); + DU_ALLOC_SHRABL_BUF(macUeRecfg, sizeof(MacUeRecfg)); + if(macUeRecfg && duMacUeCfg) { - memset(macUeCfg, 0, sizeof(MacUeCfg)); - ret = fillMacUeCfg(cellId, duUeF1apId, crnti, ueCfgDb, macUeCfg); + memset(duMacUeCfg, 0, sizeof(DuMacUeCfg)); + memset(macUeRecfg, 0, sizeof(MacUeRecfg)); + ret = updateDuMacUeCfg(cellId, duUeF1apId, crnti, ueCfgDb, duMacUeCfg); + fillMacUeRecfg(duMacUeCfg, macUeRecfg); if(ret == RFAILED) - DU_LOG("\nERROR --> DU APP : Failed to fill Mac Ue Cfg at duBuildAndSendUeReCfgReqToMac()"); + DU_LOG("\nERROR --> DU APP : Failed to fill Mac Ue Cfg at duBuildAndSendUeRecfgReqToMac()"); else - ret = sendUeReCfgReqToMac(macUeCfg); + ret = sendUeRecfgReqToMac(macUeRecfg); } else { - DU_LOG("\nERROR --> DU APP : Memory alloc failed for macUeCfg at duBuildAndSendUeReCfgReqToMac()"); + DU_LOG("\nERROR --> DU APP : Memory alloc failed for macUeCfg at duBuildAndSendUeRecfgReqToMac()"); ret = RFAILED; } + DU_FREE(duMacUeCfg, sizeof(DuMacUeCfg)); + return ret; } @@ -2881,10 +3082,10 @@ uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, DuUeCb *ueCb) if(ueCb->ueState == UE_HANDIN_IN_PROGRESS) { /* Filling MAC UE Config */ - memset(&ueCb->macUeCfg, 0, sizeof(MacUeCfg)); + memset(&ueCb->duMacUeCfg, 0, sizeof(DuMacUeCfg)); /* Since UE attach has not yet happened, crnti is unknow. Hence passing 0 */ - ret = duBuildAndSendUeCreateReqToMac(cellId, ueCb->gnbDuUeF1apId, 0, duUeCfg, &ueCb->macUeCfg); + ret = duBuildAndSendUeCreateReqToMac(cellId, ueCb->gnbDuUeF1apId, 0, duUeCfg, &ueCb->duMacUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed to send UE create request to MAC"); @@ -2896,12 +3097,12 @@ uint8_t duBuildAndSendUeContextSetupReq(uint16_t cellId, DuUeCb *ueCb) else { /* Filling RLC UE Reconfig */ - ret = duBuildAndSendUeReCfgReqToRlc(cellId, ueCb->gnbDuUeF1apId, crnti, duUeCfg); + ret = duBuildAndSendUeRecfgReqToRlc(cellId, ueCb->gnbDuUeF1apId, crnti, duUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed to build ctxt setup req for RLC at duBuildAndSendUeContextSetupReq()"); /* Filling MAC UE Reconfig */ - ret = duBuildAndSendUeReCfgReqToMac(cellId, ueCb->gnbDuUeF1apId, crnti, duUeCfg); + ret = duBuildAndSendUeRecfgReqToMac(cellId, ueCb->gnbDuUeF1apId, crnti, duUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextSetupReq()"); } @@ -3057,12 +3258,12 @@ uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint8_t gnbDuUeF1apId, ui DU_LOG("\nDEBUG --> DU_APP: Processing Ue Context Mod Request for cellId [%d]", cellId); /* Filling RLC Ue Reconfig */ - ret = duBuildAndSendUeReCfgReqToRlc(cellId, gnbDuUeF1apId, crnti, duUeCfg); + ret = duBuildAndSendUeRecfgReqToRlc(cellId, gnbDuUeF1apId, 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, gnbDuUeF1apId, crnti, duUeCfg); + ret = duBuildAndSendUeRecfgReqToMac(cellId, gnbDuUeF1apId, crnti, duUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> DU APP : Failed at build ctxt setup req for MAC at duBuildAndSendUeContextModReq()"); @@ -3188,34 +3389,37 @@ uint8_t duBuildAndSendRachRsrcRelToMac(uint16_t cellId, DuUeCb *ueCb) /******************************************************************* * -* @brief delete MacUeCfg from duCb +* @brief delete DuMacUeCfg from duCb * * @details * * Function : deleteMacUeCfg * -* Functionality: delete MacUeCfg from duCb +* Functionality: delete DuMacUeCfg from duCb * -* @params[in] Pointer to MacUeCfg +* @params[in] Pointer to DuMacUeCfg * @return ROK - success * RFAILED - failure * *******************************************************************/ -void deleteMacUeCfg(MacUeCfg *ueCfg) +void deleteMacUeCfg(DuMacUeCfg *ueCfg) { uint8_t lcCfgIdx=0; - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->ambrCfg, sizeof(AmbrCfg)); if(ueCfg->spCellCfgPres) { - freeUeReCfgCellGrpInfo(ueCfg); + freeUeRecfgCellGrpInfo(ueCfg); + } + if(ueCfg->ambrCfg) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->ambrCfg, sizeof(AmbrCfg)); } for(lcCfgIdx=0; lcCfgIdx< ueCfg->numLcs; lcCfgIdx++) { - freeMacLcCfg(&ueCfg->lcCfgList[lcCfgIdx]); + freeMacLcCfg(&ueCfg->lcCfgList[lcCfgIdx].lcConfig); } - memset(ueCfg, 0, sizeof(MacUeCfg)); + memset(ueCfg, 0, sizeof(DuMacUeCfg)); } /******************************************************************* @@ -3242,11 +3446,11 @@ uint8_t deleteUeCfg(uint16_t cellId, uint8_t ueId) GET_CELL_IDX(cellId, cellIdx); if(duCb.actvCellLst[cellIdx] != NULLP) { - if((duCb.actvCellLst[cellIdx]->ueCb[ueId-1].macUeCfg.macUeCfgState == UE_DELETE_COMPLETE)\ + if((duCb.actvCellLst[cellIdx]->ueCb[ueId-1].duMacUeCfg.macUeCfgState == UE_DELETE_COMPLETE)\ &&(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].rlcUeCfg.rlcUeCfgState == UE_DELETE_COMPLETE)) { ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1]; - deleteMacUeCfg(&ueCb->macUeCfg); + deleteMacUeCfg(&ueCb->duMacUeCfg); deleteRlcUeCfg(&ueCb->rlcUeCfg); if(ueCb->f1UeDb !=NULLP) { @@ -3310,7 +3514,7 @@ uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp) GET_CELL_IDX(deleteRsp->cellId, cellIdx); if(duCb.actvCellLst[cellIdx]) { - duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueId -1].macUeCfg.macUeCfgState = UE_DELETE_COMPLETE; + duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueId -1].duMacUeCfg.macUeCfgState = UE_DELETE_COMPLETE; ueId = deleteRsp->ueId; gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId; gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId; diff --git a/src/du_app/du_ue_mgr.h b/src/du_app/du_ue_mgr.h index 3b741949f..0f446250b 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, uint16_t crnti, DuUeCfg *ueCfgDb, MacUeCfg *duMacUeCfg); +uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t duUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, DuMacUeCfg *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);