From: lal.harshita Date: Fri, 23 Oct 2020 11:24:57 +0000 (+0530) Subject: [JIRA ID: ODUHIGH-232]: RB config for MAC and SCH X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=1616921700a3c7541f1df6dd2678f9ee4d8e933b;p=o-du%2Fl2.git [JIRA ID: ODUHIGH-232]: RB config for MAC and SCH Change-Id: I0678d6b2be48f1dcd3dad116eabca792ca31a189 Signed-off-by: sphoorthi --- diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index 947fbcc25..54a543890 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -30,42 +30,6 @@ #define SI_RNTI 0xFFFF #define P_RNTI 0xFFFE -#define PERIODIC_BSR_TMR_1MS 1 -#define PERIODIC_BSR_TMR_5MS 5 -#define PERIODIC_BSR_TMR_10MS 10 -#define PERIODIC_BSR_TMR_16MS 16 -#define PERIODIC_BSR_TMR_20MS 20 -#define PERIODIC_BSR_TMR_32MS 32 -#define PERIODIC_BSR_TMR_40MS 40 -#define PERIODIC_BSR_TMR_60MS 60 -#define PERIODIC_BSR_TMR_80MS 80 -#define PERIODIC_BSR_TMR_128MS 128 -#define PERIODIC_BSR_TMR_160MS 160 -#define PERIODIC_BSR_TMR_320MS 320 -#define PERIODIC_BSR_TMR_640MS 640 -#define PERIODIC_BSR_TMR_1280MS 1280 -#define PERIODIC_BSR_TMR_2560MS 2560 - -#define RETX_BSR_TMR_10MS 10 -#define RETX_BSR_TMR_20MS 20 -#define RETX_BSR_TMR_40MS 40 -#define RETX_BSR_TMR_80MS 80 -#define RETX_BSR_TMR_160MS 160 -#define RETX_BSR_TMR_320MS 320 -#define RETX_BSR_TMR_640MS 640 -#define RETX_BSR_TMR_1280MS 1280 -#define RETX_BSR_TMR_2560MS 2560 -#define RETX_BSR_TMR_5120MS 5120 -#define RETX_BSR_TMR_10240MS 10240 - -#define SR_DELAY_TMR_20MS 20 -#define SR_DELAY_TMR_40MS 40 -#define SR_DELAY_TMR_64MS 64 -#define SR_DELAY_TMR_128MS 128 -#define SR_DELAY_TMR_512MS 512 -#define SR_DELAY_TMR_1024MS 1024 -#define SR_DELAY_TMR_2560MS 2560 - #define MAC_LCID_CCCH 0 #define MAC_LCID_MIN 1 #define MAC_LCID_MAX 32 @@ -219,6 +183,7 @@ struct macCellCb MacDlSlot dlSlot[MAX_SLOT_SUPPORTED]; MacUlSlot ulSlot[MAX_SLOT_SUPPORTED]; uint16_t numActvUe; + MacUeCfg *ueCfgTmpData[MAX_NUM_UE]; MacUeCb ueCb[MAX_NUM_UE]; MacCellCfg macCellCfg; SlotIndInfo currTime; diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index 108cc0315..a7e3b2972 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -622,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; +} /******************************************************************* * @@ -639,23 +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 */ - } + 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 + { + schLcCfg->drbQos = NULLP; + } - schLcCfg->snssai = NULL; - if(macLcCfg.snssai) + 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; } @@ -665,7 +857,7 @@ uint8_t fillLogicalChannelCfg(LcCfg macLcCfg, SchLcCfg *schLcCfg) * * @details * - * Function : sendAddUeCreateReqToSch + * Function : fillSchUeCfg * * Functionality: Fills and sends UE configuration to Scheduler * @@ -674,81 +866,387 @@ 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_LC) + /* 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_LC); - } - 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) + /* 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 + * + * ****************************************************************/ + +void updateMacDlCb(uint8_t delIdx, UeDlCb *dlCb) +{ + uint8_t lcIdx = 0; + + 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 Fills Logical channel Cfg List to Add/Mod/Del + * + * @details + * + * Function : fillMacLcCfgList + * + * 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 fillMacLcCfgList(MacUeCb *ueCb, MacUeCfg *ueCfg) +{ + uint8_t lcIdx, ueLcIdx; + + for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++) + { + if(ueCb->dlInfo.numDlLc < MAX_NUM_LC) { - DU_LOG("\nMAC : fillLogicalChannelCfg() failed"); - return RFAILED; + 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; +} + +/******************************************************************* + * + * @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("\nMAC: Failed while filing MAC LC List at fillMacUeCb()"); + } + return ret; +} + +/******************************************************************* + * + * @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(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == ueCb->crnti) + { + ueCb->raCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx]; + break; } } + return ROK; +} + +/******************************************************************* + * + * @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 + * + * ****************************************************************/ - /* Fill event and send UE create request to SCH */ - FILL_PST_MAC_TO_SCH(pst, EVENT_UE_CONFIG_REQ_TO_SCH); - return(*macSchUeCreateReqOpts[pst.selector])(&pst, &schUeCfg); +void deleteMacRaCb(uint16_t cellIdx, MacUeCb *ueCb) +{ + uint8_t ueIdx; + + for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) + { + 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 and fills ueCfg + * @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; + } + + } + +} + +/******************************************************************* + * + * @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)) + { + 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 @@ -756,10 +1254,13 @@ uint8_t sendAddUeCreateReqToSch(MacUeCfg *ueCfg) * RFAILED - failure * * ****************************************************************/ -uint8_t createUeCb(MacUeCfg *ueCfg) + +uint8_t procMacUeCfgData(Pst *pst, MacUeCfg *ueCfg) { - uint16_t ueIdx, lcIdx, cellIdx; - MacUeCb *ueCb; + uint8_t ret = ROK; + uint16_t cellIdx; + MacUeCb *ueCb = NULLP; + GET_CELL_IDX(ueCfg->cellId, cellIdx); @@ -779,173 +1280,51 @@ uint8_t createUeCb(MacUeCfg *ueCfg) /* Check if UE already configured */ ueCb = &macCb.macCell[cellIdx]->ueCb[ueCfg->ueIdx -1]; - if(ueCb) + switch(pst->event) { - 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; - } - } - - /* Fill received Ue Configuration in UeCb */ - memset(ueCb, 0, sizeof(MacUeCb)); - - ueCb->crnti = ueCfg->crnti; - ueCb->cellCb = macCb.macCell[cellIdx]; - ueCb->dlInfo.dlHarqEnt.numHarqProcs = \ - ueCfg->spCellCfg.servCellCfg.pdschServCellCfg.numHarqProcForPdsch; - ueCb->state = UE_STATE_ACTIVE; - - /* Fill BSR info */ - switch(ueCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer) - { - 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; - } - - switch(ueCfg->macCellGrpCfg.bsrTmrCfg.retxTimer) - { - case 0: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_10MS; - break; - case 1: - ueCb->bsrTmrCfg.retxTimer = RETX_BSR_TMR_20MS; + case EVENT_UE_CREATE_RSP_TO_MAC: + ret = createUeCb(cellIdx, ueCb, ueCfg); 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; + case EVENT_UE_RECONFIG_RSP_TO_MAC: + ret = modifyUeCb(cellIdx, ueCb, ueCfg); break; default: - DU_LOG("\nMAC : Invalid BSR retransmission timer"); break; } - switch(ueCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer) - { - 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; - } + return ret; +} - /* Fill SRB1 info */ - if(ueCfg->numLcs > MAX_NUM_LC) - { - DU_LOG("\nMAC : Number of LC to configure[%d] exceeds limit[%d]",\ - ueCfg->numLcs, MAX_NUM_LC); - return RFAILED; - } +/******************************************************************* + * + * @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 + * + * ****************************************************************/ - for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++) - { - 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++; - } +uint8_t copyToTmpData(MacUeCfg *ueCfg) +{ + uint8_t cellIdx; + MacUeCfg *tmpData = NULLP; - /* Copy RA Cb */ - for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) + MAC_ALLOC(tmpData, sizeof(MacUeCfg)); + if(!tmpData) { - if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == ueCb->crnti) - { - ueCb->raCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx]; - break; - } + DU_LOG("\nMAC: Memory Alloc Failed at copyToTmpData()"); + return RFAILED; } - - macCb.macCell[cellIdx]->numActvUe++; - + memcpy(tmpData, ueCfg, sizeof(MacUeCfg)); + GET_CELL_IDX(ueCfg->cellId, cellIdx); + macCb.macCell[cellIdx]->ueCfgTmpData[ueCfg->ueIdx-1] = tmpData; return ROK; } @@ -966,24 +1345,33 @@ uint8_t createUeCb(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 @@ -1033,10 +1421,81 @@ uint8_t MacSendUeCreateRsp(MacRsp result, SchUeCfgRsp *schCfgRsp) /* Fill Post structure and send UE Create response*/ memset(&rspPst, 0, sizeof(Pst)); - FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_CONFIG_RSP); + 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; +} /******************************************************************* * @@ -1061,22 +1520,38 @@ 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[cellIdx]->ueCb[schCfgRsp->ueIdx -1], 0, sizeof(MacUeCb)); - macCb.macCell[cellIdx]->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; } @@ -1097,7 +1572,42 @@ uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *schCfgRsp) * ****************************************************************/ uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg) { - //TODO: + 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; } diff --git a/src/5gnrmac/rg_ex_ms.c b/src/5gnrmac/rg_ex_ms.c index 7bad72df5..c74220936 100755 --- a/src/5gnrmac/rg_ex_ms.c +++ b/src/5gnrmac/rg_ex_ms.c @@ -113,25 +113,25 @@ Buffer *mBuf; /* message buffer */ unpackDuMacCellCfg(MacProcCellCfgReq, pst, mBuf); break; case EVENT_MAC_CELL_START_REQ: - /* Process MAC cell start request */ - unpackMacCellStartReq(MacProcCellStartReq, pst, mBuf); - break; - case EVENT_MAC_CELL_STOP_REQ: - /* Process MAC cell stop request */ - unpackMacCellStopReq(MacProcCellStopReq, pst, mBuf); - break; - case EVENT_MAC_DL_CCCH_IND: - /* Process DL CCCH Ind */ - unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf); - break; - case EVENT_MAC_UE_CONFIG_REQ: - /* Process Ue Create Request */ - unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf); - break; - case EVENT_MAC_UE_RECONFIG_REQ: - /* Process Ue Reconfig Request */ - unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf); - break; + /* Process MAC cell start request */ + unpackMacCellStartReq(MacProcCellStartReq, pst, mBuf); + break; + case EVENT_MAC_CELL_STOP_REQ: + /* Process MAC cell stop request */ + unpackMacCellStopReq(MacProcCellStopReq, pst, mBuf); + break; + case EVENT_MAC_DL_CCCH_IND: + /* Process DL CCCH Ind */ + unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf); + break; + case EVENT_MAC_UE_CREATE_REQ: + /* Process Ue Create Request */ + unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf); + break; + case EVENT_MAC_UE_RECONFIG_REQ: + /* Process Ue Reconfig Request */ + unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf); + break; default: RG_FREE_MSG(mBuf); break; diff --git a/src/5gnrrlc/kw_udx_ul.c b/src/5gnrrlc/kw_udx_ul.c index 3aecc73a5..3f502bf1b 100755 --- a/src/5gnrrlc/kw_udx_ul.c +++ b/src/5gnrrlc/kw_udx_ul.c @@ -282,9 +282,9 @@ RlcCfgCfmInfo *cfmInfo; } #endif /* ERRCLASS & ERRCLS_ADD_RES */ rlcHdlCrlcUlCfgReq(tRlcCb,cfgTmpData, cfmInfo, cfgCfm); - if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_CONFIG_REQ) + if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_CREATE_REQ) { - FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_CONFIG_RSP); + FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_CREATE_RSP); } else if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_RECONFIG_REQ) { diff --git a/src/5gnrrlc/kw_ul_ex_ms.c b/src/5gnrrlc/kw_ul_ex_ms.c index 64b3e3f4a..fea94dea6 100755 --- a/src/5gnrrlc/kw_ul_ex_ms.c +++ b/src/5gnrrlc/kw_ul_ex_ms.c @@ -237,12 +237,12 @@ Buffer *mBuf; /* message buffer */ break; } - case EVENT_RLC_UE_CONFIG_REQ: /* UE Create Request */ + case EVENT_RLC_UE_CREATE_REQ: /* UE Create Request */ { ret = unpackRlcUeCreateReq(RlcProcUeCreateReq, pst, mBuf); break; } - case EVENT_RLC_UE_RECONFIG_REQ: /* UE Reconfig Request */ + case EVENT_RLC_UE_RECONFIG_REQ: /* UE Reconfig Request */ { ret = unpackRlcUeReconfigReq(RlcProcUeReconfigReq, pst, mBuf); break; diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index b89b6f0b4..cd1e8552f 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -682,7 +682,7 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) (lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID)) { SET_ONE_BIT(ueIdx, cell->boIndBitMap); - ueCb->dlLcCtxt[lcId].bo = dlBoInfo->dataVolume; + ueCb->dlInfo.dlLcCtxt[lcId].bo = dlBoInfo->dataVolume; } else if(lcId != SRB0_LCID) { diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 216951954..3621feeeb 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -127,14 +127,22 @@ typedef struct bsrInfo typedef struct schLcCtxt { + uint8_t lcId; // logical Channel ID uint8_t lcp; // logical Channel Prioritization SchLcState lcState; uint16_t bo; }SchDlLcCtxt; +typedef struct schDlCb +{ + uint8_t numDlLc; + SchDlLcCtxt dlLcCtxt[MAX_NUM_LC]; +}SchDlCb; + typedef struct schUlLcCtxt { - SchLcState lcState; + SchLcState lcState; + uint8_t lcId; uint8_t priority; uint8_t lcGroup; uint8_t schReqId; @@ -142,6 +150,12 @@ typedef struct schUlLcCtxt uint8_t bsd; // bucketSizeDuration }SchUlLcCtxt; +typedef struct schUlCb +{ + uint8_t numUlLc; + SchUlLcCtxt ulLcCtxt[MAX_NUM_LC]; +}SchUlCb; + /** * @brief * UE control block @@ -155,10 +169,8 @@ typedef struct schUeCb SchCellCb *cellCb; bool srRcvd; BsrInfo bsrInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS]; - uint8_t numUlLc; - SchUlLcCtxt ulLcCtxt[MAX_NUM_LC]; - uint8_t numDlLc; - SchDlLcCtxt dlLcCtxt[MAX_NUM_LC]; + SchUlCb ulInfo; + SchDlCb dlInfo; }SchUeCb; /** diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 6769eeb31..98647013c 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -170,17 +170,17 @@ uint8_t schFillBoGrantDlSchedInfo(SchCellCb *cell, DlSchedInfo *dlSchedInfo, DlM dlMsgAlloc->numLc = 0; for(lcIdx = 0; lcIdx < MAX_NUM_LC; lcIdx++) { - if(ueCb->dlLcCtxt[lcIdx].bo) + if(ueCb->dlInfo.dlLcCtxt[lcIdx].bo) { dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].lcId = lcIdx; /* calculation for BO includse RLC and MAC header size */ dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes = \ - ueCb->dlLcCtxt[lcIdx].bo + RLC_HDR_SIZE + MAC_HDR_SIZE; + ueCb->dlInfo.dlLcCtxt[lcIdx].bo + RLC_HDR_SIZE + MAC_HDR_SIZE; accumalatedSize += dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes; dlMsgAlloc->numLc++; } - ueCb->dlLcCtxt[lcIdx].bo = 0; + ueCb->dlInfo.dlLcCtxt[lcIdx].bo = 0; } /* pdcch and pdsch data is filled */ diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index d5b93fbaf..e4612afd0 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -53,7 +53,7 @@ SchUeCfgRspFunc SchUeCfgRspOpts[] = * RFAILED - failure * * ****************************************************************/ -void SchSendUeCfgRspToMac(SchUeCfg *ueCfg, Inst inst,\ +void SchSendUeCfgRspToMac(uint16_t event, SchUeCfg *ueCfg, Inst inst,\ SchMacRsp result, SchUeCfgRsp *cfgRsp) { Pst rspPst; @@ -68,46 +68,203 @@ void SchSendUeCfgRspToMac(SchUeCfg *ueCfg, Inst inst,\ /* Filling response post */ memset(&rspPst, 0, sizeof(Pst)); FILL_PST_SCH_TO_MAC(rspPst, inst); - rspPst.event = EVENT_UE_CONFIG_RSP_TO_MAC; - + if(event == EVENT_UE_CREATE_REQ_TO_SCH) + { + rspPst.event = EVENT_UE_CREATE_RSP_TO_MAC; + } + else if(event == EVENT_UE_RECONFIG_REQ_TO_SCH) + { + rspPst.event = EVENT_UE_RECONFIG_RSP_TO_MAC; + } SchUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp); } /******************************************************************* * - * @brief Hanles Ue create request from MAC + * @brief Function to fill Dl Lc Context in SCH Ue Cb * * @details * - * Function : MacSchUeCreateReq + * Function : fillSchDlLcCtxt * - * Functionality: Hanles Ue create request from MAC + * Functionality: Function to fill Dl Lc Context in SCH Ue Cb * - * @params[in] - * @return ROK - success - * RFAILED - failure + * @params[in] SchDlLcCtxt pointer, + * SchLcCfg pointer + * @return void * * ****************************************************************/ -uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg) + +void fillSchDlLcCtxt(SchDlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg) { - uint8_t idx; - uint8_t lcId; - uint8_t lcIdx; - uint16_t ueIdx; - SchCellCb *cellCb; - SchUeCb *ueCb; - SchUeCfgRsp cfgRsp; - Inst inst = pst->dstInst - 1; + ueCbLcCfg->lcId = lcCfg->lcId; + ueCbLcCfg->lcp = lcCfg->dlLcCfg.lcp; + ueCbLcCfg->lcState = SCH_LC_STATE_ACTIVE; + ueCbLcCfg->bo = 0; +} - DU_LOG("\nSCH : UE Create Request for CRNTI[%d]", ueCfg->crnti); +/******************************************************************* + * + * @brief Function to fill Ul Lc Context in SCH Ue Cb + * + * @details + * + * Function : fillSchUlLcCtxt + * + * Functionality: Function to fill Ul Lc Context in SCH Ue Cb + * + * @params[in] SchUlLcCtxt pointer, + * SchLcCfg pointer + * @return void + * + * ****************************************************************/ - memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); +void fillSchUlLcCtxt(SchUlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg) +{ + ueCbLcCfg->lcId = lcCfg->lcId; + ueCbLcCfg->lcState = SCH_LC_STATE_ACTIVE; + ueCbLcCfg->priority = lcCfg->ulLcCfg.priority; + ueCbLcCfg->lcGroup = lcCfg->ulLcCfg.lcGroup; + ueCbLcCfg->schReqId = lcCfg->ulLcCfg.schReqId; + ueCbLcCfg->pbr = lcCfg->ulLcCfg.pbr; + ueCbLcCfg->bsd = lcCfg->ulLcCfg.bsd; - if(!ueCfg) +} + +/******************************************************************* + * + * @brief Function to update Sch Ul Lc Cb + * + * @details + * + * Function : updateSchUlCb + * + * Functionality: Function to update SCH Ul Lc Cb + * + * @returns void + * + * ****************************************************************/ + +void updateSchUlCb(uint8_t delIdx, SchUlCb *ulInfo) +{ + uint8_t lcIdx = 0; + + for(lcIdx = delIdx; lcIdx < ulInfo->numUlLc; lcIdx++) { - DU_LOG("\nSCH : UE create request failed"); - return RFAILED; + memcpy(&ulInfo->ulLcCtxt[lcIdx], &ulInfo->ulLcCtxt[lcIdx+1], sizeof(SchUlLcCtxt)); + memset(&ulInfo->ulLcCtxt[lcIdx+1], 0, sizeof(SchUlLcCtxt)); } +} + +/******************************************************************* + * + * @brief Function to update SCH Dl Lc Cb + * + * @details + * + * Function : updateSchDlCb + * + * Functionality: Function to update SCH DL Lc Cb + * + * @returns void + * + * ****************************************************************/ + +void updateSchDlCb(uint8_t delIdx, SchDlCb *dlInfo) +{ + uint8_t lcIdx = 0; + + for(lcIdx = delIdx; lcIdx < dlInfo->numDlLc; lcIdx++) + { + memcpy(&dlInfo->dlLcCtxt[lcIdx], &dlInfo->dlLcCtxt[lcIdx+1], sizeof(SchDlLcCtxt)); + memset(&dlInfo->dlLcCtxt[lcIdx+1], 0, sizeof(SchDlLcCtxt)); + } +} + +/******************************************************************* + * + * @brief Function to fill SchUeCb + * + * @details + * + * Function : fillSchUeCb + * + * Functionality: Function to fill SchUeCb + * + * @params[in] SchUeCb pointer, + * SchUeCfg pointer + * @return ROK/RFAILED + * + * ****************************************************************/ + +uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) +{ + uint8_t lcIdx, ueLcIdx; + + memset(&ueCb->ueCfg, 0, sizeof(SchUeCfg)); + memcpy(&ueCb->ueCfg, ueCfg, sizeof(SchUeCfg)); + ueCb->state = SCH_UE_STATE_ACTIVE; + + for(lcIdx = 0; lcIdx < ueCfg->numLcs; lcIdx++) + { + if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_ADD) + { + fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueCb->ulInfo.numUlLc], &ueCfg->schLcCfg[lcIdx]); + ueCb->ulInfo.numUlLc++; + fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueCb->dlInfo.numDlLc], &ueCfg->schLcCfg[lcIdx]); + ueCb->dlInfo.numDlLc++; + } + else + { + for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++) //searching for Lc to be Mod + { + if(ueCb->ulInfo.ulLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId) + { + if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD) + { + fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); + fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); + break; + } + if(ueCfg->schLcCfg[ueLcIdx].configType == CONFIG_DEL) + { + memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt)); + ueCb->ulInfo.numUlLc--; + updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead + memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt)); + ueCb->dlInfo.numDlLc--; + updateSchDlCb(ueLcIdx, &ueCb->dlInfo); //moving arr elements one idx ahead + break; + } + } + }/*End of inner for loop */ + } + }/* End of outer for loop */ + return ROK; +} + +/******************************************************************* + * + * @brief Function to get SCH Cell Cb + * + * @details + * + * Function : getSchCellCb + * + * Functionality: Function to get SCH Cell Cb + * + * @params[in] event, SchUeCfg pointer + * @return schUeCb pointer - success + * NULLP - failure + * + * ****************************************************************/ + +SchCellCb *getSchCellCb(uint16_t srcEvent, Inst inst, SchUeCfg *ueCfg) +{ + uint8_t idx; + SchCellCb *cellCb = NULLP; + SchUeCfgRsp cfgRsp; + memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); /* Search of cell cb */ for(idx = 0; idx < MAX_NUM_CELL; idx++) @@ -119,17 +276,52 @@ uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg) if(idx == MAX_NUM_CELL) { DU_LOG("\nSCH : Ue create request failed. Invalid cell id %d", ueCfg->cellId); - SchSendUeCfgRspToMac(ueCfg, inst, RSP_NOK, &cfgRsp); - return ROK; + SchSendUeCfgRspToMac(srcEvent, ueCfg, inst, RSP_NOK, &cfgRsp); + return NULLP; } /* Check if max number of UE configured */ if(cellCb->numActvUe > MAX_NUM_UE) { DU_LOG("SCH : Max number of UE [%d] already configured", MAX_NUM_UE); - SchSendUeCfgRspToMac(ueCfg, inst, RSP_NOK, &cfgRsp); - return ROK; + SchSendUeCfgRspToMac(srcEvent, ueCfg, inst, RSP_NOK, &cfgRsp); + return NULLP; } + return cellCb; +} + + +/******************************************************************* + * + * @brief Hanles Ue create request from MAC + * + * @details + * + * Function : MacSchUeCreateReq + * + * Functionality: Hanles Ue create request from MAC + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg) +{ + uint8_t ueIdx, lcIdx, ret = ROK; + SchCellCb *cellCb = NULLP; + SchUeCb *ueCb = NULLP; + SchUeCfgRsp cfgRsp; + Inst inst = pst->dstInst - 1; + memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); + + if(!ueCfg) + { + DU_LOG("\nSCH : UE create request failed at MacSchUeCreateReq()"); + return RFAILED; + } + DU_LOG("\nSCH : UE Create Request for CRNTI[%d]", ueCfg->crnti); + cellCb = getSchCellCb(pst->event, inst, ueCfg); /* Search if UE already configured */ GET_UE_IDX(ueCfg->crnti, ueIdx); @@ -139,38 +331,36 @@ uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg) if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE)) { DU_LOG("\n SCH : CRNTI %d already configured ", ueCfg->crnti); - SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp); + SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp); return ROK; } } + else + { + DU_LOG("\n SCH : SchUeCb not found at MacSchUeCreateReq() "); + SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_NOK, &cfgRsp); + return RFAILED; + } /* Fill received Ue Configuration in UeCb */ memset(ueCb, 0, sizeof(SchUeCb)); + GET_UE_IDX(ueCfg->crnti, ueIdx); ueCb->ueIdx = ueIdx; ueCb->crnti = ueCfg->crnti; - memcpy(&ueCb->ueCfg, ueCfg, sizeof(SchUeCfg)); ueCb->state = SCH_UE_STATE_ACTIVE; - - /* Fill SRB1 info */ - for(lcIdx = 0; lcIdx < ueCfg->numLc; lcIdx++) + ret = fillSchUeCb(ueCb, ueCfg); + if(ret == ROK) { - lcId = ueCfg->lcCfgList[lcIdx].lcId; - ueCb->dlLcCtxt[lcId].lcp = ueCfg->lcCfgList[lcIdx].dlLcCfg.lcp; - ueCb->dlLcCtxt[lcId].lcState = SCH_LC_STATE_ACTIVE; - ueCb->dlLcCtxt[lcId].bo = 0; - ueCb->numDlLc++; + cellCb->numActvUe++; + SET_ONE_BIT(ueCb->ueIdx, cellCb->actvUeBitMap); + ueCb->cellCb = cellCb; + ueCb->srRcvd = false; + for(lcIdx=0; lcIdxbsrInfo[lcIdx].dataVol = 0; + + SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp); } - - cellCb->numActvUe++; - SET_ONE_BIT(ueCb->ueIdx, cellCb->actvUeBitMap); - - ueCb->cellCb = cellCb; - ueCb->srRcvd = false; - for(idx=0; idxbsrInfo[idx].dataVol = 0; - - SchSendUeCfgRspToMac(ueCfg, inst, RSP_OK, &cfgRsp); - return ROK; + return ret; } /******************************************************************* @@ -329,7 +519,6 @@ uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo puschInfo, DciInfo *dciInfo) return ROK; } - /******************************************************************* * * @brief Hanles Ue Reconfig request from MAC @@ -347,9 +536,48 @@ uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo puschInfo, DciInfo *dciInfo) * ****************************************************************/ uint8_t MacSchUeReconfigReq(Pst *pst, SchUeCfg *ueCfg) { - //TODO: - return ROK; + uint8_t ueIdx, lcIdx, ret = ROK; + SchCellCb *cellCb = NULLP; + SchUeCb *ueCb = NULLP; + SchUeCfgRsp cfgRsp; + Inst inst = pst->dstInst - 1; + memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); + + if(!ueCfg) + { + DU_LOG("\nSCH : Reconfig request failed at MacSchUeReconfigReq()"); + return RFAILED; + } + DU_LOG("\nSCH : Reconfig Request for CRNTI[%d]", ueCfg->crnti); + cellCb = getSchCellCb(pst->event, inst, ueCfg); + + /* Search if UE already configured */ + GET_UE_IDX(ueCfg->crnti, ueIdx); + ueCb = &cellCb->ueCb[ueIdx -1]; + + if(!ueCb) + { + DU_LOG("\n SCH : SchUeCb not found at MacSchUeReconfigReq() "); + SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_NOK, &cfgRsp); + return RFAILED; + } + if((ueCb->crnti == ueCfg->crnti) && (ueCb->state == SCH_UE_STATE_ACTIVE)) + { + /* Found the UeCb to Reconfig */ + ret = fillSchUeCb(ueCb, ueCfg); + if(ret == ROK) + { + ueCb->cellCb = cellCb; + ueCb->srRcvd = false; + for(lcIdx=0; lcIdxbsrInfo[lcIdx].dataVol = 0; + + SchSendUeCfgRspToMac(pst->event, ueCfg, inst, RSP_OK, &cfgRsp); + } + } + return ret; } + /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 9f4fc7caf..f4e194ed8 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -166,7 +166,7 @@ typedef struct PlmnIdentity typedef enum { UE_CFG_INACTIVE, - UE_CONFIG_COMPLETE, + UE_CREATE_COMPLETE, UE_RECFG_COMPLETE }UeCfgState; diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 84625f133..c190aa659 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -821,7 +821,7 @@ uint8_t unpackDuMacUeCfgRsp(MacDuUeCfgRspFunc func, Pst *pst, Buffer *mBuf) { if(pst->selector == ODU_SELECTOR_LWLC) { - MacUeCfgRsp *cfgRsp; + MacUeCfgRsp *cfgRsp = NULLP; /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf); diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 6d30e3e0e..6d5986435 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -66,11 +66,15 @@ #define EVENT_MAC_STOP_IND 205 #define EVENT_MAC_UL_CCCH_IND 206 #define EVENT_MAC_DL_CCCH_IND 207 -#define EVENT_MAC_UE_CONFIG_REQ 208 -#define EVENT_MAC_UE_CONFIG_RSP 209 +#define EVENT_MAC_UE_CREATE_REQ 208 +#define EVENT_MAC_UE_CREATE_RSP 209 #define EVENT_MAC_UE_RECONFIG_REQ 210 #define EVENT_MAC_UE_RECONFIG_RSP 211 +#define BSR_PERIODIC_TIMER_SF_10 10 +#define BSR_RETX_TIMER_SF_320 320 +#define BSR_SR_DELAY_TMR_2560 2560 + typedef enum { MAC_DU_APP_RSP_NOK, @@ -190,57 +194,6 @@ typedef enum TIME_ALIGNMENT_TIMER_INFINITY }TimeAlignmentTimer; -typedef enum -{ - BSR_PERIODIC_TIMER_SF_1, - BSR_PERIODIC_TIMER_SF_5, - BSR_PERIODIC_TIMER_SF_10, - BSR_PERIODIC_TIMER_SF_16, - BSR_PERIODIC_TIMER_SF_20, - BSR_PERIODIC_TIMER_SF_32, - BSR_PERIODIC_TIMER_SF_40, - BSR_PERIODIC_TIMER_SF_64, - BSR_PERIODIC_TIMER_SF_80, - BSR_PERIODIC_TIMER_SF_128, - BSR_PERIODIC_TIMER_SF_160, - BSR_PERIODIC_TIMER_SF_320, - BSR_PERIODIC_TIMER_SF_640, - BSR_PERIODIC_TIMER_SF_1280, - BSR_PERIODIC_TIMER_SF_2560, - BSR_PERIODIC_TIMER_INFINITY -}BsrPeriodicTimer; - -typedef enum -{ - BSR_RETX_TIMER_SF_10, - BSR_RETX_TIMER_SF_20, - BSR_RETX_TIMER_SF_40, - BSR_RETX_TIMER_SF_80, - BSR_RETX_TIMER_SF_160, - BSR_RETX_TIMER_SF_320, - BSR_RETX_TIMER_SF_640, - BSR_RETX_TIMER_SF_1280, - BSR_RETX_TIMER_SF_2560, - BSR_RETX_TIMER_SF_5120, - BSR_RETX_TIMER_SF_10240, - BSR_RETX_TIMER_SPARE_5, - BSR_RETX_TIMER_SPARE_4, - BSR_RETX_TIMER_SPARE_3, - BSR_RETX_TIMER_SPARE_2, - BSR_RETX_TIMER_SPARE_1 -}BsrReTxTimer; - -typedef enum -{ - BSR_SR_DELAY_TMR_20, - BSR_SR_DELAY_TMR_40, - BSR_SR_DELAY_TMR_64, - BSR_SR_DELAY_TMR_128, - BSR_SR_DELAY_TMR_512, - BSR_SR_DELAY_TMR_1024, - BSR_SR_DELAY_TMR_2560, - BSR_SR_DELAY_TMR_SPARE_1 -}BsrSrDelayTimer; typedef enum { PHR_PERIODIC_TIMER_SF_10, @@ -739,9 +692,9 @@ typedef struct dlCcchInd typedef struct bsrTmrCfg { - BsrPeriodicTimer periodicTimer; - BsrReTxTimer retxTimer; - BsrSrDelayTimer srDelayTimer; + uint16_t periodicTimer; + uint16_t retxTimer; + uint16_t srDelayTimer; }BsrTmrCfg; diff --git a/src/cm/du_app_rlc_inf.c b/src/cm/du_app_rlc_inf.c index 41e1c0b99..19391a8dd 100644 --- a/src/cm/du_app_rlc_inf.c +++ b/src/cm/du_app_rlc_inf.c @@ -161,7 +161,7 @@ uint8_t unpackRlcUeCfgRsp(RlcDuUeCfgRsp func, Pst *pst, Buffer *mBuf) { if(pst->selector == ODU_SELECTOR_LWLC) { - RlcUeCfgRsp *cfgRsp; + RlcUeCfgRsp *cfgRsp = NULLP; /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf); ODU_PUT_MSG_BUF(mBuf); diff --git a/src/cm/du_app_rlc_inf.h b/src/cm/du_app_rlc_inf.h index 41f99c596..761e163f3 100644 --- a/src/cm/du_app_rlc_inf.h +++ b/src/cm/du_app_rlc_inf.h @@ -21,8 +21,8 @@ #define __RLC_INF_H__ /* Events */ -#define EVENT_RLC_UE_CONFIG_REQ 210 -#define EVENT_RLC_UE_CONFIG_RSP 211 /*!< Config Confirm */ +#define EVENT_RLC_UE_CREATE_REQ 210 +#define EVENT_RLC_UE_CREATE_RSP 211 /*!< Config Confirm */ #define EVENT_UL_RRC_MSG_TRANS_TO_DU 212 #define EVENT_DL_RRC_MSG_TRANS_TO_RLC 213 #define EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU 214 diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 2783f0e18..95801bb22 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -24,8 +24,8 @@ #define EVENT_RACH_IND_TO_SCH 5 #define EVENT_CRC_IND_TO_SCH 6 #define EVENT_DL_RLC_BO_INFO_TO_SCH 7 -#define EVENT_UE_CONFIG_REQ_TO_SCH 8 -#define EVENT_UE_CONFIG_RSP_TO_MAC 9 +#define EVENT_UE_CREATE_REQ_TO_SCH 8 +#define EVENT_UE_CREATE_RSP_TO_MAC 9 #define EVENT_SLOT_IND_TO_SCH 10 #define EVENT_SHORT_BSR 11 #define EVENT_UCI_IND_TO_SCH 12 @@ -1214,6 +1214,7 @@ typedef struct schDlLcCfg /* Logical Channel configuration */ typedef struct schLcCfg { + ConfigType configType; uint8_t lcId; SchDrbQosInfo *drbQos; SchSnssai *snssai; @@ -1237,8 +1238,8 @@ typedef struct schUeCfg SchPhyCellGrpCfg phyCellGrpCfg; SchSpCellCfg spCellCfg; SchAggrMaxBitRate *aggrMaxBitRate; - uint8_t numLc; - SchLcCfg lcCfgList[MAX_NUM_LC]; + uint8_t numLcs; + SchLcCfg schLcCfg[MAX_NUM_LC]; }SchUeCfg; typedef struct schUeCfgRsp @@ -1369,6 +1370,8 @@ uint8_t packMacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd); uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd); uint8_t packMacSchUeReconfigReq(Pst *pst, SchUeCfg *ueCfgToSch); uint8_t MacSchUeReconfigReq(Pst *pst, SchUeCfg *ueCfgToSch); +uint8_t packSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp); +uint8_t MacProcSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp); /********************************************************************** End of file diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 5840050e6..b015d7284 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -6687,6 +6687,42 @@ uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg { extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg); } + if(macCellGroup->bsr_Config) + { + macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer; + macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer; + if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer) + { + macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\ + *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer); + } + } + if(macCellGroup->phr_Config) + { + if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup) + { + macUeCfg->macCellGrpCfg.phrCfgSetupPres = true; + if(macCellGroup->phr_Config->choice.setup) + { + macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \ + macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer; + macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \ + macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer; + macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \ + macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange; + macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \ + macCellGroup->phr_Config->choice.setup->multiplePHR; + macUeCfg->macCellGrpCfg.phrCfg.dummy = \ + macCellGroup->phr_Config->choice.setup->dummy; + macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \ + macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell; + macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \ + macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG; + } + } + + + } } /* Fill Physical Cell Group Reconfig */ if(cellGrp->physicalCellGroupConfig) @@ -7987,8 +8023,8 @@ void freeRrcDeliveryReport(F1AP_PDU_t *f1apMsg ) * RFAILED - failure * * ****************************************************************/ -uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId, RrcDeliveryReport -*rrcDelivery) +uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \ + uint32_t gnbDuUeF1apId, RrcDeliveryReport *rrcDelivery) { uint8_t ret = RFAILED; uint8_t idx = 0; @@ -8059,9 +8095,9 @@ uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1 rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCDeliveryStatus; rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore; rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_RRCDeliveryStatus; - rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status = + rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status =\ rrcDelivery->rrcDeliveryStatus.deliveryStatus; - rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message = + rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message =\ rrcDelivery->rrcDeliveryStatus.triggeringMessage; /* SRB ID */ diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index 1ba3f7793..c82904527 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -168,7 +168,7 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) { break; } - case EVENT_RLC_UE_CONFIG_RSP: + case EVENT_RLC_UE_CREATE_RSP: { ret = unpackRlcUeCfgRsp(DuProcRlcUeCfgRsp, pst, mBuf); break; @@ -242,7 +242,7 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf); break; } - case EVENT_MAC_UE_CONFIG_RSP: + case EVENT_MAC_UE_CREATE_RSP: { ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf); break; @@ -252,7 +252,6 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf); break; } - default: { DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTMAC"); diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 3545e6e6c..495f457eb 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -504,7 +504,8 @@ uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo) * * Functionality: Fills Default UL LC Cfg * - * + * @params[in] UlLcCfg *ulLcCfg + * @return void *****************************************************************/ void fillDefaultUlLcCfg(UlLcCfg *ulLcCfg) { @@ -525,6 +526,8 @@ void fillDefaultUlLcCfg(UlLcCfg *ulLcCfg) * * Functionality: Fills Initial DL Bandwidth Part * + * @params[in] InitialDlBwp *initDlBwp + * @return void * *****************************************************************/ void fillDefaultInitDlBwp(InitialDlBwp *initDlBwp) @@ -632,6 +635,8 @@ void fillDefaultInitDlBwp(InitialDlBwp *initDlBwp) * * Functionality: Fills Initial UL Bandwidth Part * + * @params[in] InitialUlBwp *initUlBwp + * @return void * *****************************************************************/ void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp) @@ -681,6 +686,8 @@ void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp) * * Functionality: Fills Sp Cell Group Info * + * @params[in] SpCellCfg *spCell + * @return void * *****************************************************************/ void fillDefaultSpCellGrpInfo(SpCellCfg *spCell) @@ -722,6 +729,8 @@ void fillDefaultSpCellGrpInfo(SpCellCfg *spCell) * * Functionality: Fills Physical Cell Group Info * + * @params[in] PhyCellGrpCfg *cellGrp + * @return void * *****************************************************************/ void fillDefaultPhyCellGrpInfo(PhyCellGrpCfg *cellGrp) @@ -747,6 +756,8 @@ void fillDefaultPhyCellGrpInfo(PhyCellGrpCfg *cellGrp) * * Functionality: Fills Mac Cell Group Info * + * @params[in] MacCellGrpCfg *cellGrp + * @return void * *****************************************************************/ void fillDefaultMacCellGrpInfo(MacCellGrpCfg *cellGrp) @@ -802,7 +813,19 @@ void fillDefaultMacCellGrpInfo(MacCellGrpCfg *cellGrp) } } - +/****************************************************************** + * + * @brief Function to fill Mac Lc Cfg for SRB1 + * + * @details + * + * Function : fillMacSrb1LcCfg + * + * Functionality: Function to fill Mac Lc cfg for SRB1 + * + * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb + * @return void + *****************************************************************/ void fillMacSrb1LcCfg(LcCfg *macLcCfg) { @@ -824,6 +847,8 @@ void fillMacSrb1LcCfg(LcCfg *macLcCfg) * * Functionality: Function to fill the Lc cfg from ueSetupReqDb * + * @params[in] LcCfg *lcCfg, LcCfg *ueSetReqDb + * @return ROK/RFAILED * *****************************************************************/ @@ -841,7 +866,7 @@ uint8_t fillMacLcCfgToAddMod(LcCfg *lcCfg, LcCfg *ueSetReqDb) if(!lcCfg->drbQos) { DU_LOG("\nDU APP: Memory Alloc failed at drQos at fillMacLcCfgToAddMod()"); - ret = RFAILED; + return RFAILED; } } if(ret == ROK) @@ -854,31 +879,37 @@ uint8_t fillMacLcCfgToAddMod(LcCfg *lcCfg, LcCfg *ueSetReqDb) lcCfg->drbQos = NULLP; } - /* Filling SNSSAI */ - if(ueSetReqDb->snssai && ret == ROK) + if(ret == ROK) { - if(!lcCfg->snssai) + if(ueSetReqDb->snssai) { - DU_ALLOC_SHRABL_BUF(lcCfg->snssai, sizeof(Snssai)); if(!lcCfg->snssai) { - DU_LOG("\nDU APP: Memory Alloc failed at snnsai at fillMacLcCfgToAddMod()"); - ret = RFAILED; + DU_ALLOC_SHRABL_BUF(lcCfg->snssai, sizeof(Snssai)); + if(!lcCfg->snssai) + { + DU_LOG("\nDU APP: Memory Alloc failed at snnsai at fillMacLcCfgToAddMod()"); + ret = RFAILED; + } } + if(ret == ROK) + { + /* Filling SNSSAI */ + memcpy(lcCfg->snssai, ueSetReqDb->snssai, sizeof(Snssai)); + } + else + { + lcCfg->snssai = NULLP; + if(lcCfg->drbQos) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo)); + lcCfg->drbQos = NULLP; + } + return ret; + } } - if(ret == ROK) - { - memcpy(lcCfg->snssai, ueSetReqDb->snssai, sizeof(Snssai)); - } - } - else - { - lcCfg->snssai = NULLP; - if(lcCfg->drbQos) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo)); - lcCfg->drbQos = NULLP; - } + else + lcCfg->snssai = NULLP; } lcCfg->ulLcCfgPres = ueSetReqDb->ulLcCfgPres; memcpy(&lcCfg->ulLcCfg, &ueSetReqDb->ulLcCfg, sizeof(UlLcCfg)); @@ -896,6 +927,8 @@ uint8_t fillMacLcCfgToAddMod(LcCfg *lcCfg, LcCfg *ueSetReqDb) * * Functionality: Function to copy bit Rate from ueSetupReqDb * + * @params[in] MaxAggrBitRate *macBitRate, MaxAggrBitRate *ueDbBitRate + * @return ROK/RFAILED * *****************************************************************/ @@ -931,7 +964,7 @@ uint8_t getMaxAggrBitRate(MaxAggrBitRate *macBitRate, MaxAggrBitRate *ueDbBitRat * * Functionality: Builds and Send UE ReConfig Request to MAC * - * @Params[in] MacUeCfg * + * @Params[in] MacUeCfg pointer * @return ROK - success * RFAILED - failure * @@ -974,7 +1007,7 @@ uint8_t sendUeReCfgReqToMac(MacUeCfg *macUeCfg) * * Functionality: Function to return Drb LcId * - *Returns: lcId - SUCCESS + * Returns: lcId - SUCCESS * RFAILED - FAILURE *****************************************************************/ @@ -1009,6 +1042,10 @@ uint8_t getDrbLcId(uint32_t *drbBitMap) * * Functionality: Fills MacUeCfg * + * @params[in] cellId, ueIdx, crnti, + * UeContextSetupDb pointer, + * MacUeCfg pointer + * @return ROK/RFAILED * *****************************************************************/ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \ @@ -1100,6 +1137,8 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \ * * Functionality: Fills Rlc AM Information * + * @params[in] AmBearerCfg *amCfg + * @return void * *****************************************************************/ void fillDefaultAmInfo(AmBearerCfg *amCfg) @@ -1127,6 +1166,8 @@ void fillDefaultAmInfo(AmBearerCfg *amCfg) * * Functionality: Fills RLC UM Bi Directional Information * + * @params[in] UmBiDirBearerCfg *umBiDirCfg + * @return void * *****************************************************************/ void fillDefaultUmBiInfo(UmBiDirBearerCfg *umBiDirCfg) @@ -1149,6 +1190,8 @@ void fillDefaultUmBiInfo(UmBiDirBearerCfg *umBiDirCfg) * * Functionality: Fills RLC UM Uni Directional Info * + * @params[in] UmUniDirUlBearerCfg *UmUlCfg + * @return void * *****************************************************************/ void fillDefaultUmUlInfo(UmUniDirUlBearerCfg *UmUlCfg) @@ -1167,6 +1210,8 @@ void fillDefaultUmUlInfo(UmUniDirUlBearerCfg *UmUlCfg) * * Functionality: Fills RLC UM Uni Directional DL Info * + * @params[in] UmUniDirDlBearerCfg *UmDlCfg + * @return void * *****************************************************************/ void fillDefaultUmDlInfo(UmUniDirDlBearerCfg *UmDlCfg) @@ -1184,11 +1229,14 @@ void fillDefaultUmDlInfo(UmUniDirDlBearerCfg *UmDlCfg) * * Functionality: Builds Rlc Mode Default Configuration * + * @params[in] rlcMode, RlcBearerCfg *lcCfg + * @return ROK/RFAILED * *****************************************************************/ uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg) { + if(lcCfg) { switch(rlcMode) @@ -1200,6 +1248,11 @@ uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg) DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg)); if(lcCfg->u.amCfg) fillDefaultAmInfo(lcCfg->u.amCfg); + else + { + DU_LOG("\n DU_APP: Memory Alloc failed at AmCfg at fillDefaultRlcModeCfg()"); + return RFAILED; + } } break; } @@ -1210,6 +1263,11 @@ uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg) DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg)); if(lcCfg->u.umBiDirCfg) fillDefaultUmBiInfo(lcCfg->u.umBiDirCfg); + else + { + DU_LOG("\n DU_APP: Memory Alloc failed at UmBiDirCfg at fillDefaultRlcModeCfg()"); + return RFAILED; + } } break; } @@ -1220,6 +1278,11 @@ uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg) DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg)); if(lcCfg->u.umUniDirUlCfg) fillDefaultUmUlInfo(lcCfg->u.umUniDirUlCfg); + else + { + DU_LOG("\n DU_APP: Memory Alloc failed at UmUniDirUlCfg at fillDefaultRlcModeCfg()"); + return RFAILED; + } } break; } @@ -1230,6 +1293,11 @@ uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg) DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg)); if(lcCfg->u.umUniDirDlCfg) fillDefaultUmDlInfo(lcCfg->u.umUniDirDlCfg); + else + { + DU_LOG("\n DU_APP: Memory Alloc failed at UmUniDirDlCfg at fillDefaultRlcModeCfg()"); + return RFAILED; + } } break; } @@ -1246,15 +1314,35 @@ uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg) } return ROK; } -void fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg) + +/******************************************************************* + * + * @brief Function to fill Rlc Lc Cfg for SRB1 + * + * @details + * + * Function : fillRlcSrb1LcCfg + * + * Functionality: + * Function to fill Rlc Lc Cfg for SRB1 + * + * @params[in] Pointer to RlcBearerCfg + * @return ROK/RFAILED + * + *****************************************************************/ + +uint8_t fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg) { + uint8_t ret = ROK; + rlcLcCfg->rbId = SRB1_LCID; rlcLcCfg->rbType = RB_TYPE_SRB; rlcLcCfg->lcId = SRB1_LCID; rlcLcCfg->lcType = LCH_DCCH; rlcLcCfg->rlcMode = RLC_AM; rlcLcCfg->configType = CONFIG_ADD; - fillDefaultRlcModeCfg(rlcLcCfg->rlcMode, rlcLcCfg); + ret = fillDefaultRlcModeCfg(rlcLcCfg->rlcMode, rlcLcCfg); + return ret; } /******************************************************************* @@ -1324,8 +1412,11 @@ uint8_t fillRlcUeCfg(uint16_t cellId, uint8_t ueIdx,\ /* Initial RB being Added */ rlcUeCfg->cellId = cellId; rlcUeCfg->ueIdx = ueIdx; - fillRlcSrb1LcCfg(&rlcUeCfg->rlcLcCfg[0]); - rlcUeCfg->numLcs++; + ret = fillRlcSrb1LcCfg(&rlcUeCfg->rlcLcCfg[0]); + if(ret == ROK) + rlcUeCfg->numLcs++; + else + memset(rlcUeCfg, 0, sizeof(RlcUeCfg)); } else { @@ -1335,9 +1426,15 @@ uint8_t fillRlcUeCfg(uint16_t cellId, uint8_t ueIdx,\ /*Filling RlcUeCfg */ rlcUeCfg->cellId = cellId; rlcUeCfg->ueIdx = ueIdx; - for(dbIdx = 0; dbIdx < ueCfgDb->numRlcLcs; dbIdx++) + for(dbIdx = 0; (dbIdx < ueCfgDb->numRlcLcs && ret == ROK); dbIdx++) { - fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]); + ret = fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]); + if(ret == RFAILED) + { + DU_LOG("\n DU_APP: Failed to fill Rlc Mode at fillRlcUeCfg()"); + memset(rlcUeCfg, 0, sizeof(RlcUeCfg)); + return ret; + } /* Fill Rlc Ue Cfg List for ADD/MOD/DEL */ for(lcIdx = 0; lcIdx < duRlcDb->numLcs; lcIdx++) { @@ -1454,7 +1551,7 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\ return RFAILED; } /* Fill Pst */ - FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CONFIG_REQ); + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ); /* Copying ueCb to a sharable buffer */ DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg)); @@ -1775,24 +1872,22 @@ uint8_t duUpdateDuUeCbCfg(uint8_t ueIdx, uint8_t cellId) uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) { uint8_t ret = ROK; - uint8_t ueIdx, cellIdx; if(cfgRsp) { if(cfgRsp->result == MAC_DU_APP_RSP_OK) { - cellIdx = (cfgRsp->cellId -1); - ueIdx = (cfgRsp->ueIdx -1); - - if(pst->event == EVENT_MAC_UE_CONFIG_RSP) + if(pst->event == EVENT_MAC_UE_CREATE_RSP) { DU_LOG("\nDU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx); - duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.macUeCfgState = UE_CONFIG_COMPLETE; + duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ + macUeCfg.macUeCfgState = UE_CREATE_COMPLETE; } else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP) { DU_LOG("\nDU APP : MAC UE Reconfig Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx); - duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.macUeCfgState = UE_RECFG_COMPLETE; + duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ + macUeCfg.macUeCfgState = UE_RECFG_COMPLETE; if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK) BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId); } @@ -1806,6 +1901,7 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) } ret = RFAILED; } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); } else { @@ -1815,6 +1911,7 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) return ret; } + /******************************************************************* * * @brief Processes UE create Req to RLC UL @@ -1841,9 +1938,14 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx,\ RlcUeCfg *rlcUeCfg = NULLP; Pst pst; - fillRlcUeCfg(cellId, ueIdx, NULL, duRlcUeCfg); - FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CONFIG_REQ); + ret = fillRlcUeCfg(cellId, ueIdx, NULL, duRlcUeCfg); + if(ret == RFAILED) + { + DU_LOG("\nDU_APP: Failed to fill Rlc Ue Cfg at duBuildAndSendUeCreateReqToRlc()"); + return ret; + } + FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CREATE_REQ); /* Copying ueCfg to a sharable buffer */ DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg)); if(rlcUeCfg) @@ -1889,24 +1991,22 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx,\ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) { uint8_t ret = ROK; - uint8_t ueIdx, cellIdx; if(cfgRsp) { if(cfgRsp->result == RLC_DU_APP_RSP_OK) { - cellIdx = (cfgRsp->cellId -1); - ueIdx = (cfgRsp->ueIdx -1); - - if(pst->event == EVENT_RLC_UE_CONFIG_RSP) + if(pst->event == EVENT_RLC_UE_CREATE_RSP) { DU_LOG("\nDU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx); - duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcUeCfgState = UE_CONFIG_COMPLETE; + duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ + rlcUeCfg.rlcUeCfgState = UE_CREATE_COMPLETE; } else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP) { DU_LOG("\nDU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx); - duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE; + duCb.actvCellLst[cfgRsp->cellId -1]->ueCb[cfgRsp->ueIdx -1].\ + rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE; if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK) BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId); @@ -2005,7 +2105,9 @@ uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t crnti, UeContextSe { memset(macUeCfg, 0, sizeof(MacUeCfg)); ret = fillMacUeCfg(cellId, ueIdx, crnti, ueCfgDb, macUeCfg); - if(ret == ROK) + if(ret == RFAILED) + DU_LOG("\nDU_APP: Failed to fill Mac Ue Cfg at duBuildAndSendUeReCfgReqToMac()"); + else ret = sendUeReCfgReqToMac(macUeCfg); } else