X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_ue_mgr.c;h=86f4b7e168e8fb419991c3228ee65e49eb2beb06;hb=2413e14540477c9cf427915adf9342b45f9958b2;hp=974f6e6e84ef04534fcfb8e3b8697109d6d154e1;hpb=913519063008692a8245dd502002676cf1ee9290;p=o-du%2Fl2.git diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 974f6e6e8..86f4b7e16 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -18,6 +18,7 @@ /* This file contains UE management handling functionality for DU APP */ #include "common_def.h" #include "lrg.h" +#include "du_tmr.h" #include "lrg.x" #include "ckw.h" #include "ckw.x" @@ -28,6 +29,7 @@ #include "legtp.h" #include "du_app_mac_inf.h" #include "du_app_rlc_inf.h" +#include "du_e2ap_mgr.h" #include "du_cfg.h" #include "du_mgr.h" #include "du_utils.h" @@ -39,6 +41,13 @@ #include "CmInterface.h" #endif +DuRlcUeReestablishReq packRlcUeReestablishReqOpts[] = +{ + packDuRlcUeReestablishReq, /* Loose coupling */ + RlcProcUeReestablishReq, /* TIght coupling */ + packDuRlcUeReestablishReq /* Light weight-loose coupling */ +}; + DuMacDlCcchInd packMacDlCcchIndOpts[] = { packMacDlCcchInd, /* Loose coupling */ @@ -116,6 +125,61 @@ DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] = packDuRlcUeDeleteReq /* Light weight-loose coupling */ }; +DuMacUeResetReq packMacUeResetReqOpts[] = +{ + packDuMacUeResetReq, /* Loose coupling */ + MacProcUeResetReq, /* TIght coupling */ + packDuMacUeResetReq /* Light weight-loose coupling */ +}; + +/******************************************************************* + * + * @brief Processes UE's max retransmission information received from RLC + * + * @details + * + * Function : DuProcRlcMaxRetransInd + * + * Functionality: + * Processes max retransmission reached information received from RLC + * + * @params[in] Post structure + * Pointer to RlcMaxRetransInfo + * @return ROK - success + * RFAILED - failure + * + * *****************************************************************/ + +uint8_t DuProcRlcMaxRetransInd(Pst *pst, RlcMaxRetransInfo *maxRetransInfo) +{ + uint8_t ueId = 0, ret = RFAILED; + uint16_t cellIdx = 0,crnti=0; + + if(maxRetransInfo) + { + GET_CELL_IDX(maxRetransInfo->cellId, cellIdx); + + if(duCb.actvCellLst[cellIdx]!=NULLP) + { + ueId = maxRetransInfo->ueId; + GET_CRNTI(crnti, ueId); + if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti == crnti) + { + /*TODO: complete the processing of max retransmission */ + ret = ROK; + } + else + DU_LOG("\nERROR --> DU APP : DuProcRlcMaxRetransInd(): CRNTI [%d] not found", crnti); + } + else + DU_LOG("\nERROR --> DU APP : DuProcRlcMaxRetransInd(): Cell Id[%d] is not found", maxRetransInfo->cellId); + + DU_FREE_SHRABL_BUF(pst->region, pst->pool, maxRetransInfo, sizeof(RlcMaxRetransInfo)); + + } + return ret; +} + /****************************************************************** * * @brief Function to return Drb LcId @@ -673,7 +737,9 @@ uint8_t fillDefaultInitDlBwp(InitialDlBwp *initDlBwp) { initDlBwp->pdcchCfg.searchSpcToAddModList[idx].searchSpaceId = PDCCH_SRCH_SPC_TWO_ID; initDlBwp->pdcchCfg.searchSpcToAddModList[idx].cRSetId = PDCCH_CTRL_RSRC_SET_ONE_ID; - initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSlotPeriodicityAndOffset = SLOTPERIODICITYANDOFFSET_PR_SL1; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSlotPeriodicityAndOffset.mSlotPeriodicity\ + = SLOTPERIODICITY_PR_SL1; + initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSlotPeriodicityAndOffset.mSlotOffset = 0; memset(initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, 0, MONITORING_SYMB_WITHIN_SLOT_SIZE); initDlBwp->pdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot[idx] = PDCCH_SYMBOL_WITHIN_SLOT; initDlBwp->pdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1 = AGGREGATIONLEVEL_N8; @@ -1602,7 +1668,7 @@ uint8_t fillRlcSrb1LcCfg(DuRlcBearerCfg *rlcLcCfg) * Functionality: * Processes UE Reconfig Req to RLC UL * - * @params[in] Pointer to RlcUeCfg + * @params[in] Pointer to RlcUeRecfg * @return ROK - success * RFAILED - failure * @@ -1627,7 +1693,7 @@ uint8_t sendUeRecfgReqToRlc(RlcUeRecfg *rlcUeRecfg) } else { - DU_LOG("\nERROR --> DU_APP: Received RlcUeCfg is NULL at sendUeRecfgReqToRlc()"); + DU_LOG("\nERROR --> DU_APP: Received RlcUeRecfg is NULL at sendUeRecfgReqToRlc()"); ret = RFAILED; } return ret; @@ -1822,7 +1888,7 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId) /********************************************************************************** * - * @brief Fills Ue Cfg from DU DB to MacUeCfg + * @brief Fills Ue Cfg from DU DB to MacUeCreateReq * * @details * @@ -1831,12 +1897,12 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId) * Functionality: fills ue Cfg to be sent to MAC * * @params[in] DuMacUeCfg Pointer - * MacUeCfg Pointer + * MacUeCreateReq Pointer * * @return ROK - success * RFAILED - failure * *******************************************************************************/ -void fillMacUeCfg(DuMacUeCfg *duMacUeCfg, MacUeCfg *macUeCfg) +void fillMacUeCfg(DuMacUeCfg *duMacUeCfg, MacUeCreateReq *macUeCfg) { uint8_t lcIdx = 0; @@ -1909,12 +1975,12 @@ void fillMacUeCfg(DuMacUeCfg *duMacUeCfg, MacUeCfg *macUeCfg) * Functionality: fills ue Cfg to be sent to RLC * * @params[in] DuRlcUeCfg Pointer - * RlcUeCfg Pointer + * RlcUeCreate Pointer * * @return ROK - success * RFAILED - failure * *******************************************************************************/ -void fillRlcUeCfg(DuRlcUeCfg *duRlcUeCfg, RlcUeCfg *rlcUeCfg) +void fillRlcUeCfg(DuRlcUeCfg *duRlcUeCfg, RlcUeCreate *rlcUeCfg) { uint8_t lcIdx = 0; @@ -1956,7 +2022,7 @@ void fillRlcUeCfg(DuRlcUeCfg *duRlcUeCfg, RlcUeCfg *rlcUeCfg) uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb, DuMacUeCfg *duMacUeCfg) { uint8_t ret = ROK; - MacUeCfg *macUeCfg = NULLP; + MacUeCreateReq *macUeCfg = NULLP; Pst pst; memset(&pst, 0, sizeof(Pst)); @@ -1972,10 +2038,10 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, u FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ); /* Copying ueCb to a sharable buffer */ - DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg)); + DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCreateReq)); if(macUeCfg) { - memset(macUeCfg, 0, sizeof(MacUeCfg)); + memset(macUeCfg, 0, sizeof(MacUeCreateReq)); fillMacUeCfg(duMacUeCfg, macUeCfg); DU_LOG("\nDEBUG --> DU_APP: Sending UE create request to MAC"); @@ -1984,7 +2050,7 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t gnbDuUeF1apId, u if(ret == RFAILED) { DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCreateReq)); } } else @@ -2638,7 +2704,8 @@ uint8_t duUpdateTunnelCfgDb(uint8_t ueId, uint8_t cellId, DuUeCfg *duUeCfg) uint8_t duUpdateDuUeCbCfg(uint8_t ueId, uint8_t cellId) { - uint8_t ret = ROK, cellIdx = 0, crnti=0; + uint8_t ret = ROK; + uint16_t cellIdx = 0, crnti=0; DuUeCb *ueCb = NULLP; GET_CELL_IDX(cellId, cellIdx); @@ -2674,20 +2741,20 @@ uint8_t duUpdateDuUeCbCfg(uint8_t ueId, uint8_t cellId) /******************************************************************* * - * @brief Handle UE config response from MAC + * @brief Handle UE create response from MAC * * @details * - * Function : DuProcMacUeCfgRsp + * Function : DuProcMacUeCreateRsp * - * Functionality: Handle UE Config response from MAC + * Functionality: Handle UE Create response from MAC * - * @params[in] Pointer to MacUeCfgRsp and Pst + * @params[in] Pointer to MacUeCreateRsp and Pst * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) +uint8_t DuProcMacUeCreateRsp(Pst *pst, MacUeCreateRsp *cfgRsp) { uint8_t ret = ROK; uint16_t cellIdx; @@ -2716,14 +2783,14 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) if((duBuildAndSendRachRsrcReqToMac(cfgRsp->cellId, cfgRsp->ueId)) != ROK) { DU_LOG("\nERROR --> DU APP : Failed to send RACH Resource Request to MAC"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCreateRsp)); return RFAILED; } } else { DU_LOG("\nERROR -> DU APP : Failure in updating DU UE CB"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCreateRsp)); return RFAILED; } } @@ -2735,11 +2802,11 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp) DU_LOG("\nERROR --> DU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [DU UE F1AP ID : %d]", pst->event, cfgRsp->ueId); ret = RFAILED; } - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCreateRsp)); } else { - DU_LOG("\nERROR --> DU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCfgRsp()"); + DU_LOG("\nERROR --> DU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCreateRsp()"); ret = RFAILED; } return ret; @@ -2831,7 +2898,7 @@ uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *reCfgRsp) * * @params[in] cellId, * ueId, - * Pointer to RlcUeCfg + * Pointer to RlcUeCreate * @return ROK - success * RFAILED - failure * @@ -2840,7 +2907,7 @@ uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *reCfgRsp) uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, DuUeCfg *ueCfgDb, DuRlcUeCfg *duRlcUeCfg) { uint8_t ret = ROK; - RlcUeCfg *rlcUeCfg = NULLP; + RlcUeCreate *rlcUeCfg = NULLP; Pst pst; ret = updateRlcUeCfg(cellId, gnbDuUeF1apId, ueCfgDb, duRlcUeCfg); @@ -2852,10 +2919,10 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, D 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)); + DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCreate)); if(rlcUeCfg) { - memset(rlcUeCfg, 0, sizeof(RlcUeCfg)); + memset(rlcUeCfg, 0, sizeof(RlcUeCreate)); fillRlcUeCfg(duRlcUeCfg, rlcUeCfg); /* Processing one Ue at a time to RLC */ @@ -2864,7 +2931,7 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, D if(ret == RFAILED) { DU_LOG("\nERROR --> DU_APP : Failure in sending Ue Create Req to RLC"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCreate)); ret = RFAILED; } } @@ -2883,7 +2950,7 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, D * @details * - * Function : DuProcRlcUeCfgRsp + * Function : DuProcRlcUeCreateRsp * * Functionality: * Processes UE create Rsp received from RLC UL @@ -2894,7 +2961,7 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, D * RFAILED - failure * *****************************************************************/ -uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) +uint8_t DuProcRlcUeCreateRsp(Pst *pst, RlcUeCreateRsp *cfgRsp) { uint8_t ret = ROK; @@ -2918,20 +2985,62 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) if((duBuildAndSendRachRsrcReqToMac(cfgRsp->cellId, cfgRsp->ueId)) != ROK) { DU_LOG("\nERROR --> DU APP : Failed to send RACH Resource Request to MAC"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacUeCfgRsp)); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCreateRsp)); return RFAILED; } } else { DU_LOG("\nERROR --> DU APP : Failure in updating DU UE CB"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCreateRsp)); return RFAILED; } } } - else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP) + } + else + { + DU_LOG("\nERROR --> DU_APP: RLC UE CREATE Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\ + pst->event, cfgRsp->ueId, cfgRsp->reason); + ret = RFAILED; + } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCreateRsp)); + } + else + { + DU_LOG("\nERROR --> DU_APP: Received RLC Ue Create Response is NULL at DuProcRlcUeCreateRsp()"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* + * + * @brief Processes UE reconfig Rsp received from RLC UL + * + * @details + * + + * Function : DuProcRlcUeReconfigRsp + * + * Functionality: + * Processes UE reconfig Rsp received from RLC UL + * + * @params[in] Post structure + * Pointer to RlcCfgCfm + * @return ROK - success + * RFAILED - failure + * + *****************************************************************/ +uint8_t DuProcRlcUeReconfigRsp(Pst *pst, RlcUeReconfigRsp *cfgRsp) +{ + uint8_t ret = ROK; + + if(cfgRsp) + { + if(cfgRsp->result == RLC_DU_APP_RSP_OK) + { + if(pst->event == EVENT_RLC_UE_RECONFIG_RSP) { DU_LOG("\nINFO --> DU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueId); @@ -2944,14 +3053,14 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) if((BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueId)) != ROK) { DU_LOG("\nERROR --> DU APP : Failure in BuildAndSendUeCtxtRsp"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeReconfigRsp)); return RFAILED; } } else { DU_LOG("\nERROR --> DU APP : Failure in updating DU UE CB"); - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeReconfigRsp)); return RFAILED; } } @@ -2959,7 +3068,7 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) } else { - DU_LOG("\nERROR --> DU_APP: RLC UE CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\ + DU_LOG("\nERROR --> DU_APP: RLC UE RE-CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\ pst->event, cfgRsp->ueId, cfgRsp->reason); if((pst->event == EVENT_RLC_UE_RECONFIG_RSP)) { @@ -2967,16 +3076,15 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp) } ret = RFAILED; } - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeReconfigRsp)); } else { - DU_LOG("\nERROR --> DU_APP: Received RLC Ue Config Response is NULL at DuProcRlcUeCfgRsp()"); + DU_LOG("\nERROR --> DU_APP: Received RLC Ue ReConfig Response is NULL at DuProcRlcUeReconfigRsp()"); ret = RFAILED; } return ret; } - /********************************************************************************** * * @brief Fills Ue ReCfg from DU DB to RlcUeRecfg @@ -3038,15 +3146,17 @@ void fillRlcUeRecfg(DuRlcUeCfg *duRlcUeCfg, RlcUeRecfg *rlcUeRecfg) * * Functionality: Builds and Send Ue Reconfig Req to RLC * - * @params[in] cellId, crnti + * @params[in] uint16_t cellId, + * uint6_t crnti #AS per 38.473 V15.3.0, Section 9.3.1.32 crnti + * value range is b/w 0..65535# * DuUeCfg *ueCfgDb - * RlcUeCfg *rlcUeCfg + * RlcUeCreate *rlcUeCfg * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t duBuildAndSendUeRecfgReqToRlc(uint8_t cellId, uint8_t gnbDuUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb) +uint8_t duBuildAndSendUeRecfgReqToRlc(uint16_t cellId, uint8_t gnbDuUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb) { uint8_t ret = ROK; DuRlcUeCfg *duRlcUeCfg = NULLP; @@ -3166,14 +3276,17 @@ void fillMacUeRecfg(DuMacUeCfg *duMacUeCfg, MacUeRecfg *macUeRecfg) * * Functionality: Builds and Send Ue Reconfig Req to MAC * - * @params[in] CellGroupConfigRrc_t *macCellGrpCfg + * @params[in] uint16_t cellId, + * uint6_t crnti #AS per 38.473 V15.3.0, Section 9.3.1.32 crnti + * value range is b/w 0..65535# + * CellGroupConfigRrc_t *macCellGrpCfg * DuUeCfg *ueCfgDb * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t duBuildAndSendUeRecfgReqToMac(uint8_t cellId, uint8_t duUeF1apId, uint8_t crnti, DuUeCfg *ueCfgDb) +uint8_t duBuildAndSendUeRecfgReqToMac(uint16_t cellId, uint8_t duUeF1apId, uint16_t crnti, DuUeCfg *ueCfgDb) { uint8_t ret = ROK; DuMacUeCfg *duMacUeCfg = NULLP; @@ -3674,7 +3787,7 @@ uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp) if(deleteRsp) { - if(deleteRsp->result == DEL_SUCCESSFUL) + if(deleteRsp->status == SUCCESSFUL) { DU_LOG("\nINFO --> DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueId); GET_CELL_IDX(deleteRsp->cellId, cellIdx); @@ -3739,7 +3852,7 @@ uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp) ueId = delRsp->ueId; GET_CELL_IDX(delRsp->cellId, cellIdx); - if(delRsp->result == SUCCESSFUL) + if(delRsp->status == SUCCESSFUL) { DU_LOG("\nINFO --> DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueId); if(duCb.actvCellLst[cellIdx]!=NULLP) @@ -3909,16 +4022,16 @@ uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId, uint16_t crnti) /******************************************************************* * - * @brief delete RlcUeCfg from duCb + * @brief delete RlcUeCreate from duCb * * @details * * Function : deleteRlcUeCfg * * Functionality: - * delete RlcUeCfg from duCb + * delete RlcUeCreate from duCb * - * @params[in] RlcUeCfg *ueCfg + * @params[in] RlcUeCreate *ueCfg * * @return ROK - success * RFAILED - failure @@ -3959,7 +4072,7 @@ void deleteRlcUeCfg(DuRlcUeCfg *ueCfg) } DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai)); } - memset(ueCfg, 0, sizeof(RlcUeCfg)); + memset(ueCfg, 0, sizeof(DuRlcUeCfg)); } } @@ -4019,6 +4132,374 @@ uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb) return ret; } +/******************************************************************* + * + * @brief Sending UE Reset Req To Mac +* +* @details +* +* Function : sendUeResetReqToMac +* +* Functionality: +* sending UE Reset Req To Mac +* +* @params[in] cellId, ueId, crnti +* @return ROK - success +* RFAILED - failure +* +*****************************************************************/ + +uint8_t sendUeResetReqToMac(uint16_t cellId, uint8_t ueId) +{ + Pst pst; + uint8_t ret=ROK; + MacUeResetReq *ueReset = NULLP; + + DU_ALLOC_SHRABL_BUF(ueReset, sizeof(MacUeResetReq)); + if(ueReset) + { + ueReset->cellId = cellId; + ueReset->ueId = ueId; + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RESET_REQ); + + DU_LOG("\nDEBUG --> DU_APP: Sending UE Reset Request to MAC "); + ret = (*packMacUeResetReqOpts[pst.selector])(&pst, ueReset); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU_APP: sendUeResetReqToMac(): Failed to send UE Reset Req to MAC"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueReset, sizeof(MacUeResetReq)); + } + } + else + { + DU_LOG("\nERROR --> DU_APP: sendUeResetReqToMac(): Failed to allocate memory"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* + * + * @brief DU processes UE reset req and send it to MAC + * + * @details + * + * Function : duBuildAndSendUeResetReq + * + * Functionality: DU processes UE reset req and send to MAC + * + * + * @params[in] cellId, crnti + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t duBuildAndSendUeResetReq(uint16_t cellId, uint16_t crnti) +{ + uint8_t ueId =0; + uint16_t cellIdx = 0; + + DU_LOG("\nDEBUG --> DU_APP : Building UE reset request"); + GET_CELL_IDX(cellId, cellIdx); + GET_UE_ID(crnti, ueId); + + if(duCb.actvCellLst[cellIdx] != NULLP) + { + if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti) + { + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeResetReq(): CRNTI [%d] not found", crnti); + return RFAILED; + } + + duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].ueState = UE_RESET_IN_PROGRESS; + if(sendUeResetReqToMac(cellId, ueId) == RFAILED) + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeResetRsp(): Failed to build UE reset req for MAC "); + return RFAILED; + } + } + else + { + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeResetReq(): Cell Id %d not found", cellId); + return RFAILED; + } + + return ROK; +} + +/******************************************************************* +* +* @brief Handle UE reset response from MAC +* +* @details +* +* Function : DuProcMacUeResetRsp +* +* Functionality: Handle UE reset response from MAC +* +* @params[in] Pointer to MacUeResetRsp and Pst +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t DuProcMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp) +{ + uint8_t ret =ROK; + uint16_t cellIdx=0; + + if(resetRsp) + { + if(resetRsp->status == SUCCESSFUL) + { + DU_LOG("\nINFO --> DU APP : MAC UE Reset Response : SUCCESS [UE IDX : %d]", resetRsp->ueId); + GET_CELL_IDX(resetRsp->cellId, cellIdx); + if(duCb.actvCellLst[cellIdx]) + { + duCb.actvCellLst[cellIdx]->ueCb[resetRsp->ueId -1].duMacUeCfg.macUeCfgState = UE_RESET_COMPLETE; + /*TODO - Complete the processing after receiving successfully reset rsp*/ + } + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeResetRsp(): MAC UE Reset Response : FAILURE [UE IDX : %d]",resetRsp->ueId); + ret = RFAILED; + } + DU_FREE_SHRABL_BUF(pst->region, pst->pool, resetRsp, sizeof(MacUeResetRsp)); + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeResetRsp(): MAC UE Reset Response is null"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* +* +* @brief Handle UE sync status indication from MAC +* +* @details +* +* Function : DuProcMacUeSyncStatusInd +* +* Functionality: Handle UE sync status indication from MAC +* +* @params[in] Pointer to MacUeSyncStatusInd and Pst +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t DuProcMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd) +{ + uint8_t ret =RFAILED; + uint16_t cellIdx=0, crnti = 0; + char *status; + + if(ueSyncStatusInd) + { + GET_CELL_IDX(ueSyncStatusInd->cellId, cellIdx); + if(duCb.actvCellLst[cellIdx]) + { + GET_CRNTI(crnti, ueSyncStatusInd->ueId); + if(duCb.actvCellLst[cellIdx]->ueCb[ueSyncStatusInd->ueId-1].crnti == crnti) + { + switch(ueSyncStatusInd->status) + { + case IN_SYNC: + status = "IN_SYNC"; + break; + + case OUT_OF_SYNC: + status = "OUT_OF_SYNC"; + break; + + case OUT_OF_SUNC_MAX_RETRIES: + status = "OUT_OF_SUNC_MAX_RETRIES"; + break; + + default: + status = "INVALID"; + break; + + } + DU_LOG("\nINFO --> DU APP : MAC UE sync status for received UeId %d is %s", ueSyncStatusInd->ueId,status); + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication : Ue Id [%d] not found",ueSyncStatusInd->cellId); + } + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication : Cell Id [%d] not found",ueSyncStatusInd->cellId); + } + DU_FREE_SHRABL_BUF(pst->region, pst->pool, ueSyncStatusInd, sizeof(MacUeSyncStatusInd)); + } + else + { + DU_LOG("\nERROR --> DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication is null"); + } + return ret; +} + +/******************************************************************* + * + * @brief Sending UE Reestablishment Req To Rlc + * + * @details + * + * Function : sendUeReestablishReqToRlc + * + * Functionality: + * Sending UE Reestablishment Req To Rlc + * + * @params[in] cellId, ueId + * @return ROK - success + * RFAILED - failure + * + *****************************************************************/ + +uint8_t sendUeReestablishReqToRlc(uint16_t cellId, uint8_t ueId, uint8_t numLcToReestablish, uint8_t *lcId) +{ + uint8_t ret=ROK,idx=0; + Pst pst; + RlcUeReestablishReq *ueReestablish; + + DU_ALLOC_SHRABL_BUF(ueReestablish, sizeof(RlcUeReestablishReq)); + if(ueReestablish !=NULLP) + { + ueReestablish->cellId = cellId; + ueReestablish->ueId = ueId; + ueReestablish->numLcsToReestablish = numLcToReestablish; + + for(idx = 0;idxlcToReestablish[idx]= lcId[idx]; + } + FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_REESTABLISH_REQ); + + ret = (*packRlcUeReestablishReqOpts[pst.selector])(&pst, ueReestablish); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU_APP : sendUeReestablishReqToRlc():Failed to send UE Reestablishment Req to RLC"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueReestablish, sizeof(RlcUeReestablishReq)); + } + } + else + { + DU_LOG("\nERROR --> DU_APP: sendUeReestablishReqToRlc():Memory allocation failed"); + ret = RFAILED; + } + return ret; +} + +/******************************************************************* + * + * @brief DU processes UE reestablishment req and sends to MAC and RLC + * + * @details + * + * Function : duBuildAndSendUeReestablishReq + * + * Functionality: DU processes UE reestablishment req and sends to MAC + * and RLC + * + * @params[in] cellId, crnti, numLcToReestablish, ListOflcid + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t duBuildAndSendUeReestablishReq(uint16_t cellId, uint16_t crnti, uint8_t numLcToReestablish, uint8_t *lcId) +{ + uint8_t ueId =0; + uint16_t cellIdx = 0; + + DU_LOG("\nDEBUG --> DU_APP: Building UE Reestablishment Request "); + GET_CELL_IDX(cellId, cellIdx); + GET_UE_ID(crnti, ueId); + + if(duCb.actvCellLst[cellIdx] != NULLP) + { + if(crnti != duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].crnti) + { + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishReq(): CRNTI [%d] not found", crnti); + return RFAILED; + } + + if(sendUeReestablishReqToRlc(cellId, ueId, numLcToReestablish, lcId) == RFAILED) + { + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishReq(): Failed to send UE reestablishment req for RLC "); + return RFAILED; + } + } + else + { + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishReq(): Cell Id %d is not found", cellId); + return RFAILED; + } + + return ROK; +} + +/******************************************************************* + * + * @brief Processes UE Reestablishment Rsp received from RLC + * + * @details + * + * Function : DuProcRlcUeReestablishRsp + * + * Functionality: + * Processes UE Reestablishment Rsp received from RLC + * + * @params[in] Post structure + * Pointer to RlcUeReestablishRsp + * @return ROK - success + * RFAILED - failure + * + * *****************************************************************/ + +uint8_t DuProcRlcUeReestablishRsp(Pst *pst, RlcUeReestablishRsp *ueReestablishRsp) +{ + uint8_t ueId = 0, ret = RFAILED; + uint16_t cellIdx = 0,crnti=0; + + if(ueReestablishRsp) + { + ueId = ueReestablishRsp->ueId; + GET_CELL_IDX(ueReestablishRsp->cellId, cellIdx); + + if(ueReestablishRsp->status == SUCCESSFUL) + { + if(duCb.actvCellLst[cellIdx]!=NULLP) + { + GET_CRNTI(crnti, ueId); + if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti == crnti) + { + /*TODO: complete the processing of UE Reestablishment Response */ + DU_LOG("\nINFO --> DU_APP: RLC UE Reestablishment Response : SUCCESS [UE IDX:%d]", ueId); + ret = ROK; + } + else + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishRsp(): CRNTI [%d] not found", crnti); + } + else + DU_LOG("\nERROR --> DU APP : duBuildAndSendUeReestablishRsp(): Cell Id[%d] is not found", ueReestablishRsp->cellId); + + } + else + { + DU_LOG("\nERROR --> DU_APP: RLC UE Reestablishment Response : FAILED [UE IDX:%d]", ueId); + } + DU_FREE_SHRABL_BUF(pst->region, pst->pool, ueReestablishRsp, sizeof(RlcUeReestablishRsp)); + + } + return ret; +} /********************************************************************** End of file ***********************************************************************/