X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_ue_mgr.c;h=a7e3b2972d29e4bfde7d269761a2aaf04802024b;hb=1616921700a3c7541f1df6dd2678f9ee4d8e933b;hp=8fa1ae366afddae0186c8fe018538e9b19480f39;hpb=4e803fe4bcf3a446b7082675d25d35ad102f16f6;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index 8fa1ae366..a7e3b2972 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -20,29 +20,34 @@ /* header include files (.h) */ #include "common_def.h" -#include "tfu.h" #include "lrg.h" - -#include "tfu.x" #include "lrg.x" - #include "du_app_mac_inf.h" +#include "mac_sch_interface.h" +#include "lwr_mac_upr_inf.h" #include "mac.h" -#include "du_log.h" +#include "mac_utils.h" /* function pointers for packing slot ind from mac to sch */ MacSchUeCreateReqFunc macSchUeCreateReqOpts[] = { packMacSchUeCreateReq, /* packing for loosely coupled */ - macSchUeCreateReq, /* packing for tightly coupled */ + MacSchUeCreateReq, /* packing for tightly coupled */ packMacSchUeCreateReq /* packing for light weight loosely coupled */ }; -DuMacUeCreateRspFunc DuMacUeCreateRspOpts[] = +MacDuUeCfgRspFunc MacDuUeCfgRspOpts[] = +{ + packDuMacUeCfgRsp, /* packing for loosely coupled */ + DuProcMacUeCfgRsp, /* packing for tightly coupled */ + packDuMacUeCfgRsp /* packing for light weight loosly coupled */ +}; + +MacSchUeReconfigReqFunc macSchUeReconfigReqOpts[] = { - packDuMacUeCreateRsp, /* packing for loosely coupled */ - duHandleMacUeCreateRsp, /* packing for tightly coupled */ - packDuMacUeCreateRsp, /* packing for light weight loosly coupled */ + packMacSchUeReconfigReq, /* packing for loosely coupled */ + MacSchUeReconfigReq, /* packing for tightly coupled */ + packMacSchUeReconfigReq /* packing for light weight loosely coupled */ }; /******************************************************************* @@ -162,31 +167,79 @@ uint8_t fillPhyCellGroupCfg(PhyCellGrpCfg macUeCfg, SchPhyCellGrpCfg *schPhyCell * ****************************************************************/ uint8_t fillPdschServCellCfg(PdschServCellCfg macPdschCfg, SchPdschServCellCfg *schPdschCfg) { - schPdschCfg->maxMimoLayers = NULL; if(macPdschCfg.maxMimoLayers) { - /* TODO : Optional parameter */ + if(!schPdschCfg->maxMimoLayers) + { + MAC_ALLOC_SHRABL_BUF(schPdschCfg->maxMimoLayers, sizeof(uint8_t)); + if(!schPdschCfg->maxMimoLayers) + { + DU_LOG("\nMAC :Memory Alloc MimoLayers Failed at fillPdschServCellCfg()"); + return RFAILED; + } + } + *schPdschCfg->maxMimoLayers = *macPdschCfg.maxMimoLayers; + } + else + { + schPdschCfg->maxMimoLayers = NULLP; } schPdschCfg->numHarqProcForPdsch = \ macPdschCfg.numHarqProcForPdsch; - schPdschCfg->maxCodeBlkGrpPerTb = NULL; if(macPdschCfg.maxCodeBlkGrpPerTb) { - /* TODO : Optional parameter */ + if(!schPdschCfg->maxCodeBlkGrpPerTb) + { + MAC_ALLOC_SHRABL_BUF(schPdschCfg->maxCodeBlkGrpPerTb, sizeof(SchMaxCodeBlkGrpPerTB)); + if(!schPdschCfg->maxCodeBlkGrpPerTb) + { + DU_LOG("\nMAC :Memory Alloc for code Block Failed at fillPdschServCellCfg()"); + return RFAILED; + } + } + *schPdschCfg->maxCodeBlkGrpPerTb = *macPdschCfg.maxCodeBlkGrpPerTb; + } + else + { + schPdschCfg->maxCodeBlkGrpPerTb = NULLP; } - schPdschCfg->codeBlkGrpFlushInd = NULL; if(macPdschCfg.codeBlkGrpFlushInd) { - /* TODO : Optional parameter */ + if(!schPdschCfg->codeBlkGrpFlushInd) + { + MAC_ALLOC_SHRABL_BUF(schPdschCfg->codeBlkGrpFlushInd, sizeof(bool)); + if(!schPdschCfg->codeBlkGrpFlushInd) + { + DU_LOG("\nMAC :Memory Alloc for Flush Ind Failed at fillPdschServCellCfg()"); + return RFAILED; + } + } + *schPdschCfg->codeBlkGrpFlushInd = *macPdschCfg.codeBlkGrpFlushInd; + } + else + { + schPdschCfg->codeBlkGrpFlushInd = NULLP; } - schPdschCfg->xOverhead = NULL; if(macPdschCfg.xOverhead) { - /* TODO : Optional parameter */ + if(!schPdschCfg->xOverhead) + { + MAC_ALLOC_SHRABL_BUF(schPdschCfg->xOverhead, sizeof(SchPdschXOverhead)); + if(!schPdschCfg->xOverhead) + { + DU_LOG("\nMAC :Memory Alloc for xOverHead Failed at fillPdschServCellCfg()"); + return RFAILED; + } + } + *schPdschCfg->xOverhead = *macPdschCfg.xOverhead; + } + else + { + schPdschCfg->xOverhead = NULLP; } return ROK; @@ -213,6 +266,7 @@ uint8_t fillInitalUlBwpPuschCfg(PuschCfg macPuschCfg, SchPuschCfg *schPuschCfg) { uint8_t idx; + schPuschCfg->dataScramblingId = macPuschCfg.dataScramblingId; schPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos = \ macPuschCfg.dmrsUlCfgForPuschMapTypeA.addPos; schPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \ @@ -432,7 +486,15 @@ uint8_t fillInitDlBwpPdschCfg(PdschConfig macPdschCfg, SchPdschConfig *schPdschC schPdschCfg->rbgSize = macPdschCfg.rbgSize; schPdschCfg->numCodeWordsSchByDci = macPdschCfg.numCodeWordsSchByDci; schPdschCfg->bundlingType = macPdschCfg.bundlingType; - + if(schPdschCfg->bundlingType == STATIC_BUNDLING_TYPE) + { + schPdschCfg->bundlingInfo.SchStaticBundling.size = macPdschCfg.bundlingInfo.StaticBundling.size; + } + else if(schPdschCfg->bundlingType == DYNAMIC_BUNDLING_TYPE) + { + schPdschCfg->bundlingInfo.SchDynamicBundling.sizeSet1 = macPdschCfg.bundlingInfo.DynamicBundling.sizeSet1; + schPdschCfg->bundlingInfo.SchDynamicBundling.sizeSet2 = macPdschCfg.bundlingInfo.DynamicBundling.sizeSet2; + } return ROK; } @@ -560,6 +622,112 @@ uint8_t fillSpCellCfg(SpCellCfg macSpCellCfg, SchSpCellCfg *schSpCellCfg) return ROK; } +/******************************************************************* + * + * @brief Sends UE configuration to Scheduler + * + * @details + * + * Function : sendUeReqToSch + * + * Functionality: sends UE configuration to Scheduler + * + * @params[in] Pst and Ue configuration + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t sendUeReqToSch(Pst *pst, SchUeCfg *schUeCfg) +{ + Pst schPst; + switch(pst->event) + { + case EVENT_MAC_UE_CREATE_REQ: + FILL_PST_MAC_TO_SCH(schPst, EVENT_UE_CREATE_REQ_TO_SCH); + return(*macSchUeCreateReqOpts[schPst.selector])(&schPst, schUeCfg); + + case EVENT_MAC_UE_RECONFIG_REQ: + FILL_PST_MAC_TO_SCH(schPst, EVENT_UE_RECONFIG_REQ_TO_SCH); + return(*macSchUeReconfigReqOpts[schPst.selector])(&schPst,schUeCfg); + default: + DU_LOG("\n Invalid Pst received %d", pst->event); + return RFAILED; + } +} + +/******************************************************************* + * + * @brief Fills Sch Drb Qos Information + * + * @details + * + * Function : fillSchDrbQosInfo + * + * Functionality: Fills Sch Drb Qos Information + * + * @params[in] macLcCfg : Logical channel Cfg at MAC + * schLcCfg : LC cfg to fill at scheduler + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void fillSchDrbQosInfo(DrbQosInfo *macDrbQos, SchDrbQosInfo *schDrbQos) +{ + schDrbQos->fiveQiType = macDrbQos->fiveQiType; + if(schDrbQos->fiveQiType == SCH_QOS_NON_DYNAMIC) + { + schDrbQos->u.nonDyn5Qi.fiveQi = macDrbQos->u.nonDyn5Qi.fiveQi; + schDrbQos->u.nonDyn5Qi.avgWindow = macDrbQos->u.nonDyn5Qi.avgWindow; + schDrbQos->u.nonDyn5Qi.maxDataBurstVol = macDrbQos->u.nonDyn5Qi.maxDataBurstVol; + schDrbQos->u.nonDyn5Qi.priorLevel = macDrbQos->u.nonDyn5Qi.priorLevel; + } + else if(schDrbQos->fiveQiType == SCH_QOS_DYNAMIC) + { + schDrbQos->u.dyn5Qi.priorLevel = macDrbQos->u.dyn5Qi.priorLevel; + schDrbQos->u.dyn5Qi.packetDelayBudget = macDrbQos->u.dyn5Qi.packetDelayBudget; + schDrbQos->u.dyn5Qi.packetErrRateScalar= macDrbQos->u.dyn5Qi.packetErrRateScalar; + schDrbQos->u.dyn5Qi.packetErrRateExp = macDrbQos->u.dyn5Qi.packetErrRateExp; + schDrbQos->u.dyn5Qi.fiveQi = macDrbQos->u.dyn5Qi.fiveQi; + schDrbQos->u.dyn5Qi.delayCritical = macDrbQos->u.dyn5Qi.delayCritical; + schDrbQos->u.dyn5Qi.avgWindow = macDrbQos->u.dyn5Qi.avgWindow; + schDrbQos->u.dyn5Qi.maxDataBurstVol = macDrbQos->u.dyn5Qi.maxDataBurstVol; + } + schDrbQos->ngRanRetPri.priorityLevel = macDrbQos->ngRanRetPri.priorityLevel; + schDrbQos->ngRanRetPri.preEmptionCap = macDrbQos->ngRanRetPri.preEmptionCap; + schDrbQos->ngRanRetPri.preEmptionVul = macDrbQos->ngRanRetPri.preEmptionVul; + schDrbQos->grbQosFlowInfo.maxFlowBitRateDl = macDrbQos->grbQosInfo.maxFlowBitRateDl; + schDrbQos->grbQosFlowInfo.maxFlowBitRateUl = macDrbQos->grbQosInfo.maxFlowBitRateUl; + schDrbQos->grbQosFlowInfo.guarFlowBitRateDl= macDrbQos->grbQosInfo.guarFlowBitRateDl; + schDrbQos->grbQosFlowInfo.guarFlowBitRateUl= macDrbQos->grbQosInfo.guarFlowBitRateUl; + schDrbQos->pduSessionId = macDrbQos->pduSessionId; + schDrbQos->ulPduSessAggMaxBitRate = macDrbQos->ulPduSessAggMaxBitRate; +} + +/******************************************************************* + * + * @brief Fill SCH UL logical channel configuration + * + * @details + * + * Function : fillSchUlLcCfg + * + * Functionality: Fills Sch Ul Lc configuration + * + * @params[in] macLcCfg : Logical channel Cfg at MAC + * schLcCfg : LC cfg to fill at scheduler + * @return void + * + * ****************************************************************/ + +void fillSchUlLcCfg(SchUlLcCfg *schUlLcCfg, UlLcCfg *macUlLcCfg) +{ + schUlLcCfg->priority= macUlLcCfg->priority; + schUlLcCfg->lcGroup = macUlLcCfg->lcGroup; + schUlLcCfg->schReqId= macUlLcCfg->schReqId; + schUlLcCfg->pbr = macUlLcCfg->pbr; + schUlLcCfg->bsd = macUlLcCfg->bsd; +} /******************************************************************* * @@ -577,29 +745,109 @@ uint8_t fillSpCellCfg(SpCellCfg macSpCellCfg, SchSpCellCfg *schSpCellCfg) * RFAILED - failure * * ****************************************************************/ -uint8_t fillLogicalChannelCfg(LcCfg macLcCfg, SchLcCfg *schLcCfg) +uint8_t fillLogicalChannelCfg(SchLcCfg *schLcCfg, LcCfg *macLcCfg) { - schLcCfg->lcId = macLcCfg.lcId; - schLcCfg->dlLcCfg.lcp = macLcCfg.dlLcCfg.lcp; + 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); - schLcCfg->drbQos = NULL; - if(macLcCfg.drbQos) + if(macLcCfg->drbQos) { - /* TODO : Optional Parameter */ - } - - schLcCfg->snssai = NULL; - if(macLcCfg.snssai) + if(!schLcCfg->drbQos) + { + MAC_ALLOC(schLcCfg->drbQos, sizeof(SchDrbQosInfo)); + if(!schLcCfg->drbQos) + { + DU_LOG("\nMAC : Memory alloc failed at drbQos at fillLogicalChannelCfg()"); + ret = RFAILED; + } + } + if(ret == ROK) + { + fillSchDrbQosInfo(macLcCfg->drbQos, schLcCfg->drbQos); + } + else + return ret; + } + else { - /* TODO : Optional Parameter */ + schLcCfg->drbQos = NULLP; } - schLcCfg->ulLcCfg = NULL; - if(macLcCfg.ulLcCfg) + if(ret == ROK) { - /* TODO : Optional Parameter */ + if(macLcCfg->snssai) + { + if(!schLcCfg->snssai) + { + MAC_ALLOC(schLcCfg->snssai, sizeof(SchSnssai)); + if(!schLcCfg->snssai) + { + DU_LOG("\nMAC : Memory alloc failed at snssai at fillLogicalChannelCfg()"); + ret = RFAILED; + } + } + if(ret == ROK) + { + schLcCfg->snssai->sst = macLcCfg->snssai->sst; + for(sdIdx = 0; sdIdx < SD_SIZE; sdIdx++) + { + schLcCfg->snssai->sd[sdIdx] = macLcCfg->snssai->sd[sdIdx]; + } + } + else + { + schLcCfg->snssai = NULLP; + /*Freeing the previously allocated buffer in case of failure */ + if(schLcCfg->drbQos) + { + MAC_FREE(schLcCfg->drbQos, sizeof(SchDrbQosInfo)); + schLcCfg->drbQos = NULLP; + } + return ret; + } + } + else + { + schLcCfg->snssai = NULLP; + } } + return ret; +} + +/******************************************************************* + * + * @brief Fills Logical channel Cfg List to Add/Mod/Del + * + * @details + * + * Function : fillSchLcCfgList + * + * 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 fillSchLcCfgList(SchUeCfg *schUeCfg, MacUeCfg *ueCfg) +{ + uint8_t lcIdx; + + for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++) + { + if(fillLogicalChannelCfg(&schUeCfg->schLcCfg[lcIdx], &ueCfg->lcCfgList[lcIdx]) != ROK) + { + DU_LOG("\nMAC : fillLogicalChannelCfg() failed for lc Idx[%d]", lcIdx); + return RFAILED; + } + schUeCfg->numLcs++; + } return ROK; } @@ -609,7 +857,7 @@ uint8_t fillLogicalChannelCfg(LcCfg macLcCfg, SchLcCfg *schLcCfg) * * @details * - * Function : sendAddUeCreateReqToSch + * Function : fillSchUeCfg * * Functionality: Fills and sends UE configuration to Scheduler * @@ -618,277 +866,465 @@ uint8_t fillLogicalChannelCfg(LcCfg macLcCfg, SchLcCfg *schLcCfg) * RFAILED - failure * * ****************************************************************/ -uint8_t sendAddUeCreateReqToSch(MacUeCfg *ueCfg) +uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg) { - Pst pst; - uint8_t idx; - SchUeCfg schUeCfg; + uint8_t ret = ROK; - schUeCfg.cellId = ueCfg->cellId; - schUeCfg.crnti = ueCfg->crnti; + schUeCfg->cellId = ueCfg->cellId; + schUeCfg->crnti = ueCfg->crnti; /* Copy MAC cell group config */ - memset(&schUeCfg.macCellGrpCfg, 0, sizeof(SchMacCellGrpCfg)); - if(fillMacCellGroupCfg(ueCfg->macCellGrpCfg, &schUeCfg.macCellGrpCfg) != ROK) + memset(&schUeCfg->macCellGrpCfg, 0, sizeof(SchMacCellGrpCfg)); + if(fillMacCellGroupCfg(ueCfg->macCellGrpCfg, &schUeCfg->macCellGrpCfg) != ROK) { DU_LOG("\nMAC : fillMacCellGroupCfg() failed"); return RFAILED; } /* Copy Physical cell group config */ - memset(&schUeCfg.phyCellGrpCfg, 0,sizeof(SchPhyCellGrpCfg)); - if(fillPhyCellGroupCfg(ueCfg->phyCellGrpCfg, &schUeCfg.phyCellGrpCfg) != ROK) + memset(&schUeCfg->phyCellGrpCfg, 0,sizeof(SchPhyCellGrpCfg)); + if(fillPhyCellGroupCfg(ueCfg->phyCellGrpCfg, &schUeCfg->phyCellGrpCfg) != ROK) { DU_LOG("\nMAC : fillPhyCellGroupCfg() failed"); return RFAILED; } /* Copy sp cell config */ - memset(&schUeCfg.spCellCfg, 0, sizeof(SchSpCellCfg)); - if(fillSpCellCfg(ueCfg->spCellCfg, &schUeCfg.spCellCfg) != ROK) + memset(&schUeCfg->spCellCfg, 0, sizeof(SchSpCellCfg)); + if(fillSpCellCfg(ueCfg->spCellCfg, &schUeCfg->spCellCfg) != ROK) { DU_LOG("\nMAC : fillSpCellCfg() failed"); return RFAILED; } - schUeCfg.aggrMaxBitRate = NULL; + schUeCfg->aggrMaxBitRate = NULL; if(ueCfg->maxAggrBitRate != NULL) { - - MAC_ALLOC(schUeCfg.aggrMaxBitRate, sizeof(SchAggrMaxBitRate)); - if(!schUeCfg.aggrMaxBitRate) + MAC_ALLOC(schUeCfg->aggrMaxBitRate, sizeof(SchAggrMaxBitRate)); + if(!schUeCfg->aggrMaxBitRate) { - DU_LOG("\nMAC : Memory allocation failed in sendAddUeCreateReqToSch"); + DU_LOG("\nMAC : Memory allocation failed in sendReconfigReqToSch"); return RFAILED; } - schUeCfg.aggrMaxBitRate->ulBitRate = ueCfg->maxAggrBitRate->ulBits; - schUeCfg.aggrMaxBitRate->dlBitRate = ueCfg->maxAggrBitRate->dlBits; + schUeCfg->aggrMaxBitRate->ulBitRate = ueCfg->maxAggrBitRate->ulBits; + schUeCfg->aggrMaxBitRate->dlBitRate = ueCfg->maxAggrBitRate->dlBits; } - schUeCfg.numLc = ueCfg->numLcs; - if(schUeCfg.numLc > MAX_NUM_LOGICAL_CHANNELS) + /* Fill sch Lc Cfg to Add/ Mod/ Del */ + ret = fillSchLcCfgList(schUeCfg, ueCfg); + if(ret == RFAILED) { - DU_LOG("\nMAC : Number of Logical channels %d exceeds max limit %d",\ - schUeCfg.numLc, MAX_NUM_LOGICAL_CHANNELS); - } - for(idx = 0; idx < schUeCfg.numLc; idx++) + DU_LOG("\nMAC : Failed to copy LCs at fillSchUeCfg()"); + return ret; + } + return ret; +} + +/******************************************************************* + * + * @brief Update UeUlCb Lc List + * + * @details + * + * Function : updateMacUlCb + * + * Functionality: Update UeUlCb Lc List + * + * @params[in] delIdx, UeUlCb pointer + * @return void + * + * ****************************************************************/ + +void updateMacUlCb(uint8_t delIdx, UeUlCb *ulCb) +{ + uint8_t lcIdx = 0; + + for(lcIdx = delIdx; lcIdx < ulCb->numUlLc; lcIdx++) { - if(fillLogicalChannelCfg(ueCfg->lcCfgList[idx], &schUeCfg.lcCfgList[idx]) != ROK) - { - DU_LOG("\nMAC : fillLogicalChannelCfg() failed"); - return RFAILED; - } + /* Moving the array element to one step ahead */ + memcpy(&ulCb->lcCb[lcIdx], &ulCb->lcCb[lcIdx+1], sizeof(UlLcCb)); + memset(&ulCb->lcCb[lcIdx+1], 0, sizeof(UlLcCb)); } +} + +/******************************************************************* + * + * @brief Update UeDlCb Lc List + * + * @details + * + * Function : updateMacDlCb + * + * Functionality: Update UeDlCb Lc List + * + * @params[in] delIdx, UeDlCb pointer + * @return void + * + * ****************************************************************/ - fillMacToSchPst(&pst); - pst.event = EVENT_UE_CREATE_REQ_TO_SCH; +void updateMacDlCb(uint8_t delIdx, UeDlCb *dlCb) +{ + uint8_t lcIdx = 0; - return(*macSchUeCreateReqOpts[pst.selector])(&pst, &schUeCfg); + for(lcIdx = delIdx; lcIdx < dlCb->numDlLc; lcIdx++) + { + /* Moving the array element to one step ahead */ + memcpy(&dlCb->lcCb[lcIdx], &dlCb->lcCb[lcIdx+1], sizeof(DlLcCb)); + memset(&dlCb->lcCb[lcIdx+1], 0, sizeof(DlLcCb)); + } } /******************************************************************* * - * @brief Creates UE Cb and fills ueCfg + * @brief Fills Logical channel Cfg List to Add/Mod/Del * * @details * - * Function : createUeCb + * Function : fillMacLcCfgList * - * Functionality: Creates UE Cb and fills ueCfg + * Functionality: Fills Logical channel Cfg List to Add/Mod/Del * - * @params[in] MAC UE Configuration + * @params[in] MAC UE Cb Cfg , MAC UE Configuration * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t createUeCb(MacUeCfg *ueCfg) + +uint8_t fillMacLcCfgList(MacUeCb *ueCb, MacUeCfg *ueCfg) { - uint16_t ueIdx, lcIdx; - MacUeCb *ueCb; + uint8_t lcIdx, ueLcIdx; - /* Validate cell id */ - if(macCb.macCell->cellId != ueCfg->cellId) + for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++) { - DU_LOG("\nMAC : Cell Id %d not configured", ueCfg->cellId); - return RFAILED; + if(ueCb->dlInfo.numDlLc < MAX_NUM_LC) + { + if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_ADD) + { + /*Filling DL LC CB */ + ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcId = ueCfg->lcCfgList[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 = ueCfg->lcCfgList[lcIdx].lcId; + 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 + { + //searching for Lc to be Mod + for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++) + { + if(ueCb->ulInfo.lcCb[ueLcIdx].lcId == ueCfg->lcCfgList[lcIdx].lcId) + { + if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_MOD) + { + /*Nothing to Modify in DL LC CB */ + /*Modify UL LC CB */ + ueCb->ulInfo.lcCb[ueLcIdx].lcGrpId = ueCfg->lcCfgList[lcIdx].ulLcCfg.lcGroup; + DU_LOG("\nMAC: Successfully Modified LC context for lcId[%d]", ueCfg->lcCfgList[lcIdx].lcId); + break; + } + if(ueCfg->lcCfgList[lcIdx].configType == CONFIG_DEL) + { + memset(&ueCb->dlInfo.lcCb[ueLcIdx], 0, sizeof(DlLcCb)); + (ueCb->dlInfo.numDlLc)--; + updateMacDlCb(ueLcIdx, &ueCb->dlInfo); + + memset(&ueCb->ulInfo.lcCb[ueLcIdx], 0, sizeof(UlLcCb)); + (ueCb->ulInfo.numUlLc)--; + updateMacUlCb(ueLcIdx, &ueCb->ulInfo); + DU_LOG("\nMAC: Successfully Deleted LC context for lcId[%d]", ueCfg->lcCfgList[lcIdx].lcId); + break; + } + } + } + }/*End of Mod Config */ + } } + return ROK; +} - /* Check if max number of UE configured */ - if(macCb.macCell->numActvUe > MAX_UE) +/******************************************************************* + * + * @brief Fills MAC UE Cb Cfg + * + * @details + * + * Function : fillMacUeCb + * + * Functionality: Fills MAC UE Cb Cfg + * + * @params[in] MAC UE Cb Cfg , MAC UE Configuration + * cellIdx + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t fillMacUeCb(MacUeCb *ueCb, MacUeCfg *ueCfg, uint8_t cellIdx) +{ + uint8_t ret = ROK; + + ueCb->ueIdx = ueCfg->ueIdx; + ueCb->crnti = ueCfg->crnti; + ueCb->cellCb = macCb.macCell[cellIdx]; + ueCb->dlInfo.dlHarqEnt.numHarqProcs = \ + ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch; + ueCb->state = UE_STATE_ACTIVE; + /*TODO: To check the bsr value during implementation */ + ueCb->bsrTmrCfg.periodicTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer; + ueCb->bsrTmrCfg.retxTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer; + ueCb->bsrTmrCfg.srDelayTimer = ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer; + ret = fillMacLcCfgList(ueCb, ueCfg); + if(ret == RFAILED) { - DU_LOG("MAC : Max number of UE [%d] already configured", MAX_UE); - return RFAILED; + DU_LOG("\nMAC: Failed while filing MAC LC List at fillMacUeCb()"); } + return ret; +} - /* Check if UE already configured */ - ueCb = &macCb.macCell->ueCb[ueCfg->ueIdx]; - if(ueCb) +/******************************************************************* + * + * @brief Function to update Mac Ra Cb + * + * @details + * + * Function : updateMacRaCb + * + * Functionality: Function to update Mac Ra Cb + * + * @params[in] cellIdx, Mac Ue Cb + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t updateMacRaCb(uint16_t cellIdx, MacUeCb *ueCb) +{ + uint8_t ueIdx; + /* Copy RA Cb */ + for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) { - if((ueCb->ueIdx == ueCfg->ueIdx) && (ueCb->crnti == ueCfg->crnti) &&\ - (ueCb->state == UE_STATE_ACTIVE)) + if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == ueCb->crnti) { - DU_LOG("\n MAC : CRNTI %d already configured ", ueCfg->crnti); - return ROKDUP; + ueCb->raCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx]; + break; } } + return ROK; +} - /* Fill received Ue Configuration in UeCb */ - memset(ueCb, 0, sizeof(MacUeCb)); +/******************************************************************* + * + * @brief Function to delete Mac Ra Cb + * + * @details + * + * Function : deleteMacRaCb + * + * Functionality: Function to delete Mac Ra Cb + * + * @params[in] cellIdx, Mac Ue Cb + * @return void + * + * ****************************************************************/ - ueCb->crnti = ueCfg->crnti; - ueCb->cellCb = macCb.macCell; - ueCb->dlInfo.dlHarqEnt.numHarqProcs = \ - ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch; - ueCb->state = UE_STATE_ACTIVE; +void deleteMacRaCb(uint16_t cellIdx, MacUeCb *ueCb) +{ + uint8_t ueIdx; - /* Fill BSR info */ - switch(ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer) + for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) { - case 0: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_1MS; - break; - case 1: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_5MS; - break; - case 2: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_10MS; - break; - case 3: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_16MS; - break; - case 4: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_20MS; - break; - case 5: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_32MS; - break; - case 6: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_40MS; - break; - case 7: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_60MS; - break; - case 8: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_80MS; - break; - case 9: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_128MS; - break; - case 10: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_160MS; - break; - case 11: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_320MS; - break; - case 12: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_640MS; - break; - case 13: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_1280MS; - break; - case 14: - ueCb->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR_2560MS; - break; - default: - DU_LOG("\nMAC : Invalid BSR Periodic Timer"); - return RFAILED; + if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == ueCb->crnti) + { + if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu) + { + MAC_FREE(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu, \ + macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen); + } + if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu) + { + MAC_FREE(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TxPdu, \ + macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4TbSize); + } + memset(&macCb.macCell[cellIdx]->macRaCb[ueIdx], 0, sizeof(MacRaCbInfo)); + break; + } } + +} + +/******************************************************************* + * + * @brief Creates UE Cb + * + * @details + * + * Function : createUeCb + * + * Functionality: Creates UE Cb + * + * @params[in] MAC UE Configuration + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t createUeCb(uint8_t cellIdx, MacUeCb *ueCb, MacUeCfg *ueCfg) +{ + uint8_t ret =ROK; + + if((ueCb->ueIdx == ueCfg->ueIdx) && (ueCb->crnti == ueCfg->crnti)\ + &&(ueCb->state == UE_STATE_ACTIVE)) + { + DU_LOG("\n MAC : CRNTI %d already configured ", ueCfg->crnti); + return ROKDUP; + } + else + { + memset(ueCb, 0, sizeof(MacUeCb)); + ret = fillMacUeCb(ueCb, ueCfg, cellIdx); + if(ret != ROK) + { + DU_LOG("\nMAC : Failed to create Ue Cb at createUeCb()"); + return ret; + } + else + { + macCb.macCell[cellIdx]->numActvUe++; + updateMacRaCb(cellIdx, ueCb); + return ROK; + } - switch(ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer) - { - case 0: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_10MS; - break; - case 1: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_20MS; - break; - case 2: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_40MS; - break; - case 3: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_80MS; - break; - case 4: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_160MS; - break; - case 5: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_320MS; - break; - case 6: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_640MS; - break; - case 7: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_1280MS; - break; - case 8: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_2560MS; - break; - case 9: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_5120MS; - break; - case 10: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_10240MS; - break; - default: - DU_LOG("\nMAC : Invalid BSR retransmission timer"); - break; } - switch(ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer) +} + +/******************************************************************* + * + * @brief Modify UE Cb Cfg + * + * @details + * + * Function : modifyUeCb + * + * Functionality: modify UE Cb + * + * @params[in] MAC UE Configuration + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t modifyUeCb(uint8_t cellIdx, MacUeCb *ueCb, MacUeCfg *ueCfg) +{ + uint8_t ret = ROK; + + if((ueCb->ueIdx == ueCfg->ueIdx) && (ueCb->crnti == ueCfg->crnti)\ + &&(ueCb->state == UE_STATE_ACTIVE)) { - case 0: - ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_20MS; - break; - case 1: - ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_40MS; - break; - case 2: - ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_64MS; - break; - case 3: - ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_128MS; - break; - case 4: - ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_512MS; - break; - case 5: - ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_1024MS; - break; - case 6: - ueCb->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR_2560MS; - break; - default: - DU_LOG("\nMAC : Invalid SR delay timer"); - return RFAILED; + DU_LOG("\n MAC : Reconfig Req received for CRNTI %d ", ueCfg->crnti); + ret = fillMacUeCb(ueCb, ueCfg, cellIdx); + if(ret != ROK) + { + DU_LOG("\nMAC : Failed to modify Ue Cb at modifyUeCb()"); + return ret; + } + else + { + deleteMacRaCb(cellIdx, ueCb); + return ROK; + } } + return RFAILED; +} + + +/******************************************************************* + * + * @brief Creates UE Cb and fills ueCfg + * + * @details + * + * Function : procMacUeCfgData + * + * Functionality: Creates UE Cb and fills ueCfg + * + * @params[in] MAC UE Configuration + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t procMacUeCfgData(Pst *pst, MacUeCfg *ueCfg) +{ + uint8_t ret = ROK; + uint16_t cellIdx; + MacUeCb *ueCb = NULLP; + - /* Fill SRB1 info */ - if(ueCfg->numLcs > MAX_NUM_LOGICAL_CHANNELS) + GET_CELL_IDX(ueCfg->cellId, cellIdx); + + /* Validate cell id */ + if(macCb.macCell[cellIdx]->cellId != ueCfg->cellId) { - DU_LOG("\nMAC : Number of LC to configure[%d] exceeds limit[%d]",\ - ueCfg->numLcs, MAX_NUM_LOGICAL_CHANNELS); + DU_LOG("\nMAC : Cell Id %d not configured", ueCfg->cellId); return RFAILED; } - for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++) + /* Check if max number of UE configured */ + if(macCb.macCell[cellIdx]->numActvUe > MAX_NUM_UE) { - ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcId = ueCfg->lcCfgList[lcIdx].lcId; - ueCb->dlInfo.lcCb[ueCb->dlInfo.numDlLc].lcState = LC_STATE_ACTIVE; - ueCb->dlInfo.numDlLc++; + DU_LOG("MAC : Max number of UE [%d] already configured", MAX_NUM_UE); + return RFAILED; } - /* Copy RA Cb */ - for(ueIdx = 0; ueIdx < MAX_UE; ueIdx++) + /* Check if UE already configured */ + ueCb = &macCb.macCell[cellIdx]->ueCb[ueCfg->ueIdx -1]; + switch(pst->event) { - if(macCb.macCell->macRaCb[ueIdx].crnti == ueCb->crnti) - { - ueCb->raCb = &macCb.macCell->macRaCb[ueIdx]; + case EVENT_UE_CREATE_RSP_TO_MAC: + ret = createUeCb(cellIdx, ueCb, ueCfg); + break; + case EVENT_UE_RECONFIG_RSP_TO_MAC: + ret = modifyUeCb(cellIdx, ueCb, ueCfg); + break; + default: break; - } } - macCb.macCell->numActvUe++; + return ret; +} +/******************************************************************* + * + * @brief Function to store the UeCfg Data + * + * @details + * + * Function : copyToTmpData + * + * Functionality: Function to store the UeCfg Data + * + * @params[in] MacUeCfg pointer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t copyToTmpData(MacUeCfg *ueCfg) +{ + uint8_t cellIdx; + MacUeCfg *tmpData = NULLP; + + MAC_ALLOC(tmpData, sizeof(MacUeCfg)); + if(!tmpData) + { + DU_LOG("\nMAC: Memory Alloc Failed at copyToTmpData()"); + return RFAILED; + } + memcpy(tmpData, ueCfg, sizeof(MacUeCfg)); + GET_CELL_IDX(ueCfg->cellId, cellIdx); + macCb.macCell[cellIdx]->ueCfgTmpData[ueCfg->ueIdx-1] = tmpData; return ROK; } @@ -898,7 +1334,7 @@ uint8_t createUeCb(MacUeCfg *ueCfg) * * @details * - * Function : MacHdlUeCreateReq + * Function : MacProcUeCreateReq * * Functionality: Handles UE create requst from DU APP * @@ -907,26 +1343,35 @@ uint8_t createUeCb(MacUeCfg *ueCfg) * RFAILED - failure * * ****************************************************************/ -uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg) +uint8_t MacProcUeCreateReq(Pst *pst, MacUeCfg *ueCfg) { - uint8_t ret; + uint8_t ret = ROK; + SchUeCfg schUeCfg; + memset(&schUeCfg, 0, sizeof(SchUeCfg)); DU_LOG("\nMAC : UE Create Request for CRNTI[%d]", ueCfg->crnti); if(ueCfg) { - ret = createUeCb(ueCfg); + /*Storing received ueCfg in ueCfgTmpData */ + ret = copyToTmpData(ueCfg); if(ret == ROK) { - ret = sendAddUeCreateReqToSch(ueCfg); + /*Sending Cfg Req to SCH */ + ret = fillSchUeCfg(pst, &schUeCfg, ueCfg); if(ret != ROK) + DU_LOG("\nMAC : Failed to fill Sch Ue Cfg at MacProcUeCreateReq()"); + else { - DU_LOG("\nMAC : Failed to send UE Create request to scheduler"); + /* Fill event and send UE create request to SCH */ + ret = sendUeReqToSch(pst, &schUeCfg); + if(ret != ROK) + DU_LOG("\nMAC : Failed to send UE Create request to SCH"); } } else { - DU_LOG("\nMAC : Failed to create MAC UE Cb "); + DU_LOG("\nMAC : Failed to store MAC UE CFG "); } } else @@ -940,6 +1385,22 @@ uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg) return ret; } +/******************************************************************* + * + * @brief Fill and Send UE create response from MAC to DU APP + * + * @details + * + * Function : MacSendUeCreateRsp + * + * Functionality: Fill and Send UE create response from MAC to DUAPP + * + * @params[in] MAC UE create result + * SCH UE create response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ uint8_t MacSendUeCreateRsp(MacRsp result, SchUeCfgRsp *schCfgRsp) { MacUeCfgRsp *cfgRsp; @@ -958,23 +1419,83 @@ uint8_t MacSendUeCreateRsp(MacRsp result, SchUeCfgRsp *schCfgRsp) cfgRsp->ueIdx = schCfgRsp->ueIdx; cfgRsp->result = result; - /* Filling Post structure */ + /* Fill Post structure and send UE Create response*/ memset(&rspPst, 0, sizeof(Pst)); - rspPst.selector = ODU_SELECTOR_LWLC; - rspPst.srcEnt = ENTRG; - rspPst.dstEnt = ENTDUAPP; - rspPst.dstInst = 0; - rspPst.srcInst = macCb.macInst; - rspPst.dstProcId = macCb.procId; - rspPst.srcProcId = macCb.procId; - rspPst.region = MAC_MEM_REGION; - rspPst.pool = MAC_POOL; - rspPst.event = EVENT_MAC_UE_CREATE_RSP; - - return DuMacUeCreateRspOpts[rspPst.selector](&rspPst, cfgRsp); + FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_CREATE_RSP); + return MacDuUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp); +} + +/******************************************************************* + * + * @brief Fill and Send UE Reconfig response from MAC to DU APP + * + * @details + * + * Function : MacSendUeReconfigRsp + * + * Functionality: Fill and Send UE Reconfig response from MAC to DUAPP + * + * @params[in] MAC UE create result + * SCH UE create response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacSendUeReconfigRsp(MacRsp result, SchUeCfgRsp *schCfgRsp) +{ + MacUeCfgRsp *cfgRsp; + Pst rspPst; + + MAC_ALLOC_SHRABL_BUF(cfgRsp, sizeof(MacUeCfgRsp)); + if(!cfgRsp) + { + DU_LOG("\nMAC: Memory allocation for UE Reconfig response failed"); + return RFAILED; + } + /* Filling UE Config response */ + memset(cfgRsp, 0, sizeof(MacUeCfgRsp)); + cfgRsp->cellId = schCfgRsp->cellId; + cfgRsp->ueIdx = schCfgRsp->ueIdx; + cfgRsp->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); } +/******************************************************************* + * + * @brief Function to return Mac Ue Cfg pointer + * + * @details + * + * Function : getMacUeCfg + * + * Functionality: + * Function to return Mac Ue Cfg pointer + * + * @params[in] cellIdx, ueIdx + * + * @return MacUeCfg pointer - success + * NULLP - failure + * + * ****************************************************************/ + +MacUeCfg *getMacUeCfg(uint16_t cellIdx, uint8_t ueIdx) +{ + MacUeCfg *ueCfg = NULLP; + if(macCb.macCell[cellIdx]) + { + ueCfg = macCb.macCell[cellIdx]->ueCfgTmpData[ueIdx-1]; + } + else + { + DU_LOG("\nMAC: Failed to get macCellCb in getMacUeCfg()"); + } + return ueCfg; +} /******************************************************************* * @@ -998,23 +1519,98 @@ uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *schCfgRsp) { uint8_t result = MAC_DU_APP_RSP_NOK; uint8_t ret = ROK; + uint16_t cellIdx; + MacUeCfg *ueCfg = NULLP; + + GET_CELL_IDX(schCfgRsp->cellId, cellIdx); + ueCfg = getMacUeCfg(cellIdx, schCfgRsp->ueIdx); - if(schCfgRsp->rsp == RSP_NOK) + if(ueCfg) + { + if(schCfgRsp->rsp == RSP_NOK) + { + DU_LOG("\nMAC : SCH UE Config Response : FAILURE [CRNTI %d] for event %d", schCfgRsp->crnti, pst->event); + } + else + { + DU_LOG("\nMAC : SCH UE Config Response : SUCCESS [CRNTI %d]", schCfgRsp->crnti); + ret = procMacUeCfgData(pst, ueCfg); + if(ret == ROK) + { + result = MAC_DU_APP_RSP_OK; + } + } + MAC_FREE(ueCfg, sizeof(MacUeCfg)); + ueCfg = NULLP; + } + if(pst->event == EVENT_UE_CREATE_RSP_TO_MAC) { - DU_LOG("\nMAC : SCH UE Create Response : FAILURE [CRNTI %d]", schCfgRsp->crnti); - memset(&macCb.macCell->ueCb[schCfgRsp->ueIdx], 0, sizeof(MacUeCb)); - macCb.macCell->numActvUe--; - result = MAC_DU_APP_RSP_NOK; + ret = MacSendUeCreateRsp(result, schCfgRsp); } - else + if(pst->event == EVENT_UE_RECONFIG_RSP_TO_MAC) { - DU_LOG("\nMAC : SCH UE Create Response : SUCCESS [CRNTI %d]", schCfgRsp->crnti); - result = MAC_DU_APP_RSP_OK; + ret = MacSendUeReconfigRsp(result, schCfgRsp); } - ret = MacSendUeCreateRsp(result, schCfgRsp); + return ret; } +/******************************************************************* + * + * @brief Handles UE Reconfig requst from DU APP + * + * @details + * + * Function : MacProcUeReconfigReq + * + * Functionality: Handles UE Reconfig requst from DU APP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) +{ + uint8_t ret = ROK; + SchUeCfg schUeCfg; + memset(&schUeCfg, 0, sizeof(SchUeCfg)); + + DU_LOG("\nMAC : UE Reconfig Request for CRNTI[%d]", ueCfg->crnti); + + if(ueCfg) + { + /*Storing received ueCfg in ueCfgTmpData */ + ret = copyToTmpData(ueCfg); + if(ret == ROK) + { + /*Sending Cfg Req to SCH */ + ret = fillSchUeCfg(pst, &schUeCfg, ueCfg); + if(ret != ROK) + DU_LOG("\nMAC : Failed to fill sch Ue Cfg at MacProcUeReconfigReq()"); + else + { + /* Fill event and send UE create request to SCH */ + ret = sendUeReqToSch(pst, &schUeCfg); + if(ret != ROK) + DU_LOG("\nMAC : Failed to send UE Reconfig Request to SCH"); + } + } + else + { + DU_LOG("\nMAC : Failed to store MAC UE Cb "); + } + } + else + { + DU_LOG("\nMAC : MAC UE Create request processing failed"); + ret = RFAILED; + } + /* FREE shared memory */ + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(MacUeCfg)); + return ROK; +} + /********************************************************************** End of file