X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_f1ap_msg_hdl.c;h=ec001ea91e22825d08e93e2fe57dc66a5203f525;hb=ba2574ac618b40905509604da8d3a2b1b9e39664;hp=2d8a8a9cdfdd8b19526fe7a236b41bda1315cee6;hpb=95fc4329bde1b6a06b00f94bd0eeab8bc5ba7295;p=o-du%2Fl2.git diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 2d8a8a9cd..ec001ea91 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -27,6 +27,13 @@ #include "du_app_rlc_inf.h" #include "du_mgr_main.h" #include "du_utils.h" +#include "RAT-Type.h" +#include "FeatureSetUplinkPerCC.h" +#include "FeatureSetDownlinkPerCC.h" +#include "FeatureSets.h" +#include "UE-NR-Capability.h" +#include "UE-CapabilityRAT-Container.h" +#include "UE-CapabilityRAT-ContainerListRRC.h" #include "GNB-DU-System-Information.h" #include "CellGroupConfigRrc.h" #include "MAC-CellGroupConfig.h" @@ -69,6 +76,19 @@ #include "DUtoCURRCContainer.h" #include "GBR-QoSFlowInformation.h" #include "QoSFlowLevelQoSParameters.h" +#include "PUCCH-Config.h" +#include "PUCCH-ResourceSet.h" +#include "PUCCH-Resource.h" +#include "PUCCH-PowerControl.h" +#include "P0-PUCCH.h" +#include "PUCCH-PathlossReferenceRS.h" +#include "PUCCH-format0.h" +#include "PUCCH-format1.h" +#include "PUCCH-format2.h" +#include "PUCCH-format3.h" +#include "PUCCH-format4.h" +#include "PUCCH-FormatConfig.h" +#include "SchedulingRequestResourceConfig.h" #include #include "ProtocolExtensionField.h" #include "F1AP-PDU.h" @@ -695,20 +715,20 @@ uint8_t BuildRrcVer(RRC_Version_t *rrcVer) * ****************************************************************/ uint8_t SendF1APMsg(Region region, Pool pool) { - Buffer *mBuf; - + Buffer *mBuf = NULLP; + if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK) { if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK) { - ODU_PRINT_MSG(mBuf, 0,0); + ODU_PRINT_MSG(mBuf, 0,0); - if(sctpSend(mBuf, F1_INTERFACE) != ROK) - { - DU_LOG("\nF1AP : SCTP Send failed"); - ODU_PUT_MSG_BUF(mBuf); - return RFAILED; - } + if(sctpSend(mBuf, F1_INTERFACE) != ROK) + { + DU_LOG("\nF1AP : SCTP Send failed"); + ODU_PUT_MSG_BUF(mBuf); + return RFAILED; + } } else { @@ -2061,13 +2081,16 @@ void FreeULRRCMessageTransfer( F1AP_PDU_t *f1apMsg) uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb ueCb, uint8_t lcId, \ uint16_t msgLen, uint8_t *rrcMsg) { - uint8_t elementCnt; - uint8_t idx1; - uint8_t idx; - F1AP_PDU_t *f1apMsg = NULL; - ULRRCMessageTransfer_t *ulRRCMsg; + uint8_t elementCnt =0; + uint8_t idx1 =0; + uint8_t idx =0; + F1AP_PDU_t *f1apMsg = NULLP; + ULRRCMessageTransfer_t *ulRRCMsg = NULLP; asn_enc_rval_t encRetVal; /* Encoder return value */ uint8_t ret =RFAILED; + + memset(&encRetVal, 0, sizeof(asn_enc_rval_t)); + while(true) { DU_LOG("\n F1AP : Building UL RRC Message Transfer Message\n"); @@ -2078,7 +2101,6 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb ueCb, uint8_t lcId, \ DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); break; } - f1apMsg->present = F1AP_PDU_PR_initiatingMessage; DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); if(f1apMsg->choice.initiatingMessage == NULLP) @@ -2147,11 +2169,12 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb ueCb, uint8_t lcId, \ ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size = msgLen; DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size) - if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf) - { - DU_LOG(" F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed"); - break; - } + if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf) + { + DU_LOG(" F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed"); + break; + } + memset(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, 0, msgLen); memcpy(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, \ rrcMsg, ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size); @@ -4445,7 +4468,7 @@ void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationL * * @return void * - 4221 * ****************************************************************/ + * ****************************************************************/ void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg) { uint8_t idx1=0; @@ -5507,1434 +5530,3181 @@ void freeMacLcCfg(LcCfg *lcCfg) } memset(lcCfg, 0, sizeof(LcCfg)); } - /******************************************************************* * - * @brief Function to free DuUeCfg + * @brief Free UE NR Capability received in UE Context setup request * * @details * - * Function : freeDuUeCfg + * Function : freeAperDecodeUeNrCapability * - * Functionality: Function to free DuUeCfg + * Functionality: + * Free UE NR Capability received in UE Context setup request * - * @params[in] DuUeCfg *ueCfg - * @return void + * @params[in] + * @return ROK - success + * RFAILED - failure * * ****************************************************************/ -void freeDuUeCfg(DuUeCfg *ueCfg) +void freeAperDecodeUeNrCapability(void *ueNrCapability) { - uint8_t lcIdx; + uint8_t arrIdx =0; + FeatureSets_t *featureSets =NULLP; + UE_NR_Capability_t *ueNrCap = (UE_NR_Capability_t *)ueNrCapability; - if(ueCfg->cellGrpCfg) - { - DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t)); - ueCfg->cellGrpCfg = NULLP; - } - if(ueCfg->maxAggrBitRate) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->maxAggrBitRate, sizeof(MaxAggrBitRate)); - } - for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++) - { - freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx]); - } - for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++) + if(ueNrCap->rf_Parameters.supportedBandListNR.list.array) { - freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]); + for(arrIdx = 0; arrIdx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; arrIdx++) + { + if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx]) + free(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx]); + } + free(ueNrCap->rf_Parameters.supportedBandListNR.list.array); } -} - -/******************************************************************* - * - * @brief Function to free UecontextSetupDb - * - * @details - * - * Function : freeF1UeDb - * - * Functionality: Function to free UecontextSetupDb - * - * @params[in] UecontextSetupDb * - * @return void - * - * ****************************************************************/ -void freeF1UeDb(F1UeContextSetupDb *f1UeDb) -{ - - if(f1UeDb->dlRrcMsg) + if(ueNrCap->featureSets) { - if(f1UeDb->dlRrcMsg->rrcMsgPdu) + featureSets = ueNrCap->featureSets; + if(featureSets->featureSetsDownlinkPerCC) { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\ - f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize); + if(featureSets->featureSetsDownlinkPerCC->list.array) + { + for(arrIdx = 0; arrIdx < featureSets->featureSetsDownlinkPerCC->list.count; arrIdx++) + { + if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]) + { + if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL) + free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL); + free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]); + } + } + free(featureSets->featureSetsDownlinkPerCC->list.array); + } + free(featureSets->featureSetsDownlinkPerCC); } - memset(f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg)); - } - freeDuUeCfg(&f1UeDb->duUeCfg); - memset(f1UeDb, 0, sizeof(F1UeContextSetupDb)); + if(featureSets->featureSetsUplinkPerCC) + { + if(featureSets->featureSetsUplinkPerCC->list.array) + { + for(arrIdx = 0; arrIdx < featureSets->featureSetsUplinkPerCC->list.count; arrIdx++) + { + if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]) + { + if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL) + free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL); + free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]); + } + } + free(featureSets->featureSetsUplinkPerCC->list.array); + } + free(featureSets->featureSetsUplinkPerCC); + } + free(ueNrCap->featureSets); + } } /******************************************************************* - * - * @brief Function to build Am cfg Info - * - * @details - * - * Function : extractRlcAmCfg - * - * Functionality: Function to build Am cfg Info - * - * @params[in] AmBearerCfg * - * void * - * - * @return ROK/RFAILED - * - * ****************************************************************/ +* +* @brief Function to free PdcchSearchSpcToAddModList + where memory allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodePdcchSearchSpcToAddModList +* +* Functionality: Function to free PdcchSearchSpcToAddModList +* +* @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList +* @return void +* +* ****************************************************************/ -void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg) +void freeAperDecodePdcchSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList) { - if(rlcAmCfg) + uint8_t searchSpcArrIdx=0; + uint8_t searchSpcArrIdx1=0; + struct SearchSpace *searchSpc=NULLP; + + + if(searchSpcList->list.array) { - /* UL AM */ - if(rlcAmCfg->dl_AM_RLC.sn_FieldLength) + if(searchSpcList->list.array[searchSpcArrIdx1]) { - amCfgToSet->ulAmCfg.snLenUl = *(rlcAmCfg->dl_AM_RLC.sn_FieldLength); - amCfgToSet->ulAmCfg.reAssemTmr = rlcAmCfg->dl_AM_RLC.t_Reassembly; - amCfgToSet->ulAmCfg.statProhTmr = rlcAmCfg->dl_AM_RLC.t_StatusProhibit; + searchSpc = searchSpcList->list.array[searchSpcArrIdx1]; + if(searchSpc->controlResourceSetId) + { + if(searchSpc->monitoringSlotPeriodicityAndOffset) + { + if(searchSpc->monitoringSymbolsWithinSlot) + { + if(searchSpc->monitoringSymbolsWithinSlot->buf) + { + if(searchSpc->nrofCandidates) + { + if(searchSpc->searchSpaceType) + { + free(searchSpc->searchSpaceType->choice.ue_Specific); + free(searchSpc->searchSpaceType); + } + free(searchSpc->nrofCandidates); + } + free(searchSpc->monitoringSymbolsWithinSlot->buf); + } + free(searchSpc->monitoringSymbolsWithinSlot); + } + free(searchSpc->monitoringSlotPeriodicityAndOffset); + } + free(searchSpc->controlResourceSetId); + } } - - /* DL AM */ - if(rlcAmCfg->ul_AM_RLC.sn_FieldLength) + for(searchSpcArrIdx = 0; searchSpcArrIdx < searchSpcList->list.count; searchSpcArrIdx++) { - amCfgToSet->dlAmCfg.snLenDl = *(rlcAmCfg->ul_AM_RLC.sn_FieldLength); - amCfgToSet->dlAmCfg.pollRetxTmr = rlcAmCfg->ul_AM_RLC.t_PollRetransmit; - amCfgToSet->dlAmCfg.pollPdu = rlcAmCfg->ul_AM_RLC.pollPDU; - amCfgToSet->dlAmCfg.pollByte = rlcAmCfg->ul_AM_RLC.pollByte; - amCfgToSet->dlAmCfg.maxRetxTh = rlcAmCfg->ul_AM_RLC.maxRetxThreshold; + free(searchSpcList->list.array[searchSpcArrIdx]); } + free(searchSpcList->list.array); } } - /******************************************************************* - * - * @brief Function to build Um Bi Info - * - * @details - * - * Function : extractRlcUmBiCfg - * - * Functionality: Function to build Um Bi Info - * - * @params[in] UmBiDirBearerCfg * - * void * - * - * @return ROK/RFAILED - * - * ****************************************************************/ +* +* @brief Function for free part for the memory allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodeBWPDlDedPdcchConfig +* +* Functionality: Function to free BWPDlDedPdcchConfig +* +* @params[in] +* @return void +* +* ****************************************************************/ -void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg) + +void freeAperDecodeBWPDlDedPdcchConfig(BWP_DownlinkDedicated_t *dlBwp) { - if(rlcBiCfg) + uint8_t arrIdx1=0; + uint8_t arrIdx2=0; + struct PDCCH_Config *pdcchCfg=NULLP; + struct ControlResourceSet *controlRSet=NULLP; + struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP; + + if(dlBwp->pdcch_Config->choice.setup) { - /* UL UM BI DIR Cfg */ - if(rlcBiCfg->dl_UM_RLC.sn_FieldLength) + pdcchCfg=dlBwp->pdcch_Config->choice.setup; + if(pdcchCfg->controlResourceSetToAddModList) { - umBiCfgToSet->ulUmCfg.snLenUlUm = *(rlcBiCfg->dl_UM_RLC.sn_FieldLength); - umBiCfgToSet->ulUmCfg.reAssemTmr = rlcBiCfg->dl_UM_RLC.t_Reassembly; + controlRSetList = pdcchCfg->controlResourceSetToAddModList; + if(controlRSetList->list.array) + { + controlRSet = controlRSetList->list.array[arrIdx2]; + if(controlRSet) + { + if(controlRSet->frequencyDomainResources.buf) + { + if(controlRSet->pdcch_DMRS_ScramblingID) + { + if(pdcchCfg->searchSpacesToAddModList) + { + freeAperDecodePdcchSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList); + free(pdcchCfg->searchSpacesToAddModList); + } + free(controlRSet->pdcch_DMRS_ScramblingID); + } + free(controlRSet->frequencyDomainResources.buf); + } + } + for(arrIdx1 = 0; arrIdx1 list.count; arrIdx1++) + { + free(controlRSetList->list.array[arrIdx1]); + } + free(controlRSetList->list.array); + } + free(pdcchCfg->controlResourceSetToAddModList); } - - /* DL UM BI DIR Cfg */ - if(rlcBiCfg->ul_UM_RLC.sn_FieldLength) - umBiCfgToSet->dlUmCfg.snLenDlUm = *(rlcBiCfg->ul_UM_RLC.sn_FieldLength); + free(dlBwp->pdcch_Config->choice.setup); } } - /******************************************************************* - * - * @brief Function to build Um Ul Info - * - * @details - * - * Function : extractRlcUmUlCfg - * - * Functionality: Function to build Um Ul Info - * - * @params[in] UmUniDirUlBearerCfg * - * void * - * - * @return ROK/RFAILED - * - * ****************************************************************/ +* +* @brief Function to free PdschTimeDomAllocationList +* where the memory allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodePdschTimeDomAllocationList +* +* Functionality: Function to free PdschTimeDomAllocationList +* +* @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList +* @return void +* +* ****************************************************************/ -void extractRlcUmUlCfg(UmUniDirUlBearerCfg *umUlCfgToSet, struct RLC_Config__um_Uni_Directional_DL *umUlCfg) + +void freeAperDecodePdschTimeDomAllocationList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList) { - if(umUlCfg) + uint8_t arrIdx=0; + + if(timeDomAllocList->choice.setup) { - if(umUlCfg->dl_UM_RLC.sn_FieldLength) + if(timeDomAllocList->choice.setup->list.array) { - umUlCfgToSet->ulUmCfg.snLenUlUm = *(umUlCfg->dl_UM_RLC.sn_FieldLength); - umUlCfgToSet->ulUmCfg.reAssemTmr = umUlCfg->dl_UM_RLC.t_Reassembly; + for(arrIdx = 0; arrIdx choice.setup->list.count ; arrIdx++) + { + free(timeDomAllocList->choice.setup->list.array[arrIdx]); + } + free(timeDomAllocList->choice.setup->list.array); } + free(timeDomAllocList->choice.setup); } } /******************************************************************* - * - * @brief Function to build Um Uni Dl Info - * - * @details - * - * Function : extractRlcUmDlCfg - * - * Functionality: Function to build Um Uni Dl Info - * - * @params[in] UmUniDirDlBearerCfg * - * void * - * - * @return ROK/RFAILED - * - * ****************************************************************/ -void extractRlcUmDlCfg(UmUniDirDlBearerCfg *umDlCfgToSet, struct RLC_Config__um_Uni_Directional_UL *umDlCfg) -{ - if(umDlCfg) +* +* @brief Function to free BWPDlDedPdschConfig +* where the memory allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodeBWPDlDedPdschConfig +* +* Functionality: Function to free BWPDlDedPdschConfig +* +* @params[in] BWP_DownlinkDedicated_t *dlBwp +* @return void +* +* ****************************************************************/ + + +void freeAperDecodeBWPDlDedPdschConfig(BWP_DownlinkDedicated_t *dlBwp) +{ + struct PDSCH_Config *pdschCfg=NULLP; + struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP; + struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP; + struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP; + + if(dlBwp->pdsch_Config->choice.setup) + { + pdschCfg=dlBwp->pdsch_Config->choice.setup; + if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) + { + if(pdschCfg->pdsch_TimeDomainAllocationList) + { + timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList; + if(pdschCfg->maxNrofCodeWordsScheduledByDCI) + { + prbBndlType=&pdschCfg->prb_BundlingType; + free(prbBndlType->choice.staticBundling); + free(pdschCfg->maxNrofCodeWordsScheduledByDCI); + } + freeAperDecodePdschTimeDomAllocationList(timeDomAllocList); + free(pdschCfg->pdsch_TimeDomainAllocationList); + } + dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA; + if(dmrsDlCfg->choice.setup) + { + free(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition); + free(dmrsDlCfg->choice.setup); + } + free(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA); + } + free(dlBwp->pdsch_Config->choice.setup); + } +} +/******************************************************************* +* +* @brief Function to free PuschTimeDomAllocListCfg + where the memory allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodePuschTimeDomAllocListCfg +* +* Functionality: Function to free PuschTimeDomAllocListCfg +* +* @params[in] PUSCH_Config_t *puschCfg +* @return void +* +* ****************************************************************/ + + +void freeAperDecodePuschTimeDomAllocListCfg(PUSCH_Config_t *puschCfg) +{ + uint8_t arrIdx=0; + uint8_t arrIdx1=0; + struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP; + + if(puschCfg->pusch_TimeDomainAllocationList) + { + timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList; + if(timeDomAllocList_t->choice.setup) + { + if(timeDomAllocList_t->choice.setup->list.array) + { + free(timeDomAllocList_t->choice.setup->list.array[arrIdx1]->k2); + for(arrIdx = 0; arrIdxchoice.setup->list.count; arrIdx++) + { + free(timeDomAllocList_t->choice.setup->list.array[arrIdx]); + } + free(timeDomAllocList_t->choice.setup->list.array); + } + free(timeDomAllocList_t->choice.setup); + } + free(puschCfg->transformPrecoder); + free(puschCfg->pusch_TimeDomainAllocationList); + } +} +/******************************************************************* +* +* @brief Function to free InitialUlBWPConfig where memory allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodeInitialUlBWPConfig +* +* Functionality: Function to free InitialUlBWPConfig +* +* @params[in] BWP_UplinkDedicated_t *ulBwp +* @return void +* +* ****************************************************************/ + + +void freeAperDecodeInitialUlBWPConfig(BWP_UplinkDedicated_t *ulBwp) +{ + uint8_t rSetIdx =0; + uint8_t rsrcIdx =0; + SRS_Config_t *srsCfg = NULLP; + PUSCH_Config_t *puschCfg = NULLP; + struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP; + struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP; + struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP; + struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP; + + if(ulBwp->pusch_Config) + { + if(ulBwp->pusch_Config->choice.setup) + { + puschCfg=ulBwp->pusch_Config->choice.setup; + if(puschCfg->dataScramblingIdentityPUSCH) + { + if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) + { + freeAperDecodePuschTimeDomAllocListCfg(puschCfg); + dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA; + if(dmrsUlCfg->choice.setup) + { + if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) + { + if(dmrsUlCfg->choice.setup->transformPrecodingDisabled) + { + free(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0); + free(dmrsUlCfg->choice.setup->transformPrecodingDisabled); + } + free(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition); + } + free(dmrsUlCfg->choice.setup); + } + free(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA); + } + free(puschCfg->dataScramblingIdentityPUSCH); + } + free(ulBwp->pusch_Config->choice.setup); + } + free(ulBwp->pusch_Config); + + /* Free SRS-Config */ + if(ulBwp->srs_Config) + { + if(ulBwp->srs_Config->choice.setup) + { + srsCfg = ulBwp->srs_Config->choice.setup; + + /* Free Resource Set to add/mod list */ + if(srsCfg->srs_ResourceSetToAddModList) + { + rsrcSetList = srsCfg->srs_ResourceSetToAddModList; + if(rsrcSetList->list.array) + { + rSetIdx = 0; + + /* Free SRS resource Id list in this SRS resource set */ + if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList) + { + rsrcIdList = + rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList; + + if(rsrcIdList->list.array) + { + for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; + rsrcIdx++) + { + free(rsrcIdList->list.array[rsrcIdx]); + } + free(rsrcIdList->list.array); + } + free(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList); + } + + /* Free resource type info for this SRS resource set */ + + free(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic); + + /* Free memory for each resource set */ + for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++) + { + free(rsrcSetList->list.array[rSetIdx]); + } + free(rsrcSetList->list.array); + } + free(srsCfg->srs_ResourceSetToAddModList); + } + + /* Free resource to add/modd list */ + if(srsCfg->srs_ResourceToAddModList) + { + resourceList = srsCfg->srs_ResourceToAddModList; + if(resourceList->list.array) + { + rsrcIdx = 0; + + free(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2); + free(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic); + + for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++) + { + free(resourceList->list.array[rsrcIdx]); + } + free(resourceList->list.array); + } + free(srsCfg->srs_ResourceToAddModList); + } + + free(ulBwp->srs_Config->choice.setup); + } + free(ulBwp->srs_Config); + } + } +} +/******************************************************************* +* +* @brief Function to free initialUplinkBWPConfig where memory allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodeinitialUplinkBWPConfig +* +* Functionality: Function to free initialUplinkBWPConfig +* +* @params[in] UplinkConfig_t *ulCfg +* @return void +* +* ****************************************************************/ + + +void freeAperDecodeinitialUplinkBWPConfig(UplinkConfig_t *ulCfg) +{ + BWP_UplinkDedicated_t *ulBwp=NULLP; + struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP; + + if(ulCfg->initialUplinkBWP) + { + ulBwp=ulCfg->initialUplinkBWP; + if(ulCfg->firstActiveUplinkBWP_Id) + { + if(ulCfg->pusch_ServingCellConfig) + { + puschCfg=ulCfg->pusch_ServingCellConfig; + if(puschCfg->choice.setup) + { + if(puschCfg->choice.setup->ext1) + { + free(puschCfg->choice.setup->ext1->processingType2Enabled); + free(puschCfg->choice.setup->ext1->maxMIMO_Layers); + free(puschCfg->choice.setup->ext1); + } + free(puschCfg->choice.setup); + } + free(ulCfg->pusch_ServingCellConfig); + } + free(ulCfg->firstActiveUplinkBWP_Id); + } + freeAperDecodeInitialUlBWPConfig(ulBwp); + free(ulCfg->initialUplinkBWP); + } +} + +/******************************************************************* + * + * @brief Function to free DuUeCfg + * + * @details + * + * Function : freeDuUeCfg + * + * Functionality: Function to free DuUeCfg + * + * @params[in] DuUeCfg *ueCfg + * @return void + * + * ****************************************************************/ +void freeDuUeCfg(DuUeCfg *ueCfg) +{ + uint8_t lcIdx = 0; + uint8_t arrIdx = 0; + SpCellConfig_t *spCellCfg = NULLP; + ServingCellConfig_t *srvCellCfg = NULLP; + BWP_DownlinkDedicated_t *dlBwp = NULLP; + MAC_CellGroupConfig_t *macCellGrpCfg = NULLP; + PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP; + struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList = NULLP; + struct RLC_Config *rlcConfig = NULLP; + struct LogicalChannelConfig *macLcConfig = NULLP; + struct SchedulingRequestConfig *schedulingRequestConfig = NULLP; + struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList = NULLP; + struct TAG_Config *tagConfig = NULLP; + struct TAG_Config__tag_ToAddModList *tagList = NULLP; + struct MAC_CellGroupConfig__phr_Config *phrConfig = NULLP; + struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg = NULLP; + CellGroupConfigRrc_t *cellGrpCfg = ueCfg->cellGrpCfg; + + if(ueCfg->ueNrCapability) + { + freeAperDecodeUeNrCapability(ueCfg->ueNrCapability); + DU_FREE(ueCfg->ueNrCapability, sizeof(UE_NR_Capability_t)); + ueCfg->ueNrCapability = NULLP; + } + + if(ueCfg->cellGrpCfg) + { + + rlcBearerList = cellGrpCfg->rlc_BearerToAddModList; + if(rlcBearerList) + { + if(rlcBearerList->list.array) + { + for(arrIdx=0; arrIdxlist.count; arrIdx++) + { + if(rlcBearerList->list.array[arrIdx]) + { + rlcConfig = rlcBearerList->list.array[arrIdx]->rlc_Config; + macLcConfig = rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig; + + if(rlcBearerList->list.array[arrIdx]->servedRadioBearer) + { + free(rlcBearerList->list.array[arrIdx]->servedRadioBearer); + } + if(rlcConfig) + { + if(rlcConfig->choice.am) + { + free(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength); + free(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength); + free(rlcConfig->choice.am); + } + free(rlcBearerList->list.array[arrIdx]->rlc_Config); + } + if(macLcConfig) + { + if(macLcConfig->ul_SpecificParameters) + { + free(macLcConfig->ul_SpecificParameters->schedulingRequestID); + free(macLcConfig->ul_SpecificParameters->logicalChannelGroup); + free(macLcConfig->ul_SpecificParameters); + } + free(rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig); + } + free(rlcBearerList->list.array[arrIdx]); + } + } + free(rlcBearerList->list.array); + } + free(cellGrpCfg->rlc_BearerToAddModList); + } + + macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig; + if(macCellGrpCfg) + { + schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig; + if(schedulingRequestConfig) + { + schReqList = schedulingRequestConfig->schedulingRequestToAddModList; + if(schReqList) + { + if(schReqList->list.array) + { + for(arrIdx=0;arrIdxlist.count; arrIdx++) + { + if(schReqList->list.array[arrIdx]) + { + free(schReqList->list.array[arrIdx]->sr_ProhibitTimer); + free(schReqList->list.array[arrIdx]); + } + } + free(schReqList->list.array); + } + free(schedulingRequestConfig->schedulingRequestToAddModList); + } + free(macCellGrpCfg->schedulingRequestConfig); + } + if(macCellGrpCfg->bsr_Config) + { + free(macCellGrpCfg->bsr_Config); + } + tagConfig = macCellGrpCfg->tag_Config; + if(tagConfig) + { + tagList = tagConfig->tag_ToAddModList; + if(tagList) + { + if(tagList->list.array) + { + for(arrIdx=0; arrIdxlist.count; arrIdx++) + { + free(tagList->list.array[arrIdx]); + } + free(tagList->list.array); + } + free(tagConfig->tag_ToAddModList); + } + free(tagConfig); + } + + phrConfig = macCellGrpCfg->phr_Config; + if(phrConfig) + { + free(phrConfig->choice.setup); + free(phrConfig); + } + + free(macCellGrpCfg); + } + + phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig; + if(phyCellGrpCfg) + { + free(phyCellGrpCfg->p_NR_FR1); + free(phyCellGrpCfg); + } + + spCellCfg = cellGrpCfg->spCellConfig; + if(spCellCfg) + { + if(spCellCfg->servCellIndex) + { + if(spCellCfg->rlmInSyncOutOfSyncThreshold) + { + if(spCellCfg->spCellConfigDedicated) + { + srvCellCfg = spCellCfg->spCellConfigDedicated; + if(srvCellCfg->initialDownlinkBWP) + { + dlBwp = srvCellCfg->initialDownlinkBWP; + if(srvCellCfg->firstActiveDownlinkBWP_Id) + { + if(srvCellCfg->defaultDownlinkBWP_Id) + { + if(srvCellCfg->uplinkConfig) + { + + if(srvCellCfg->pdsch_ServingCellConfig) + { + pdschCfg= + srvCellCfg->pdsch_ServingCellConfig; + if(pdschCfg->choice.setup) + { + + free(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH); + free(pdschCfg->choice.setup); + } + + free(srvCellCfg->pdsch_ServingCellConfig); + } + + freeAperDecodeinitialUplinkBWPConfig(srvCellCfg->uplinkConfig); + free(srvCellCfg->uplinkConfig); + } + free(srvCellCfg->defaultDownlinkBWP_Id); + } + + free(srvCellCfg->firstActiveDownlinkBWP_Id); + } + if(dlBwp->pdcch_Config) + { + if(dlBwp->pdsch_Config) + { + freeAperDecodeBWPDlDedPdschConfig(dlBwp); + free(dlBwp->pdsch_Config); + } + freeAperDecodeBWPDlDedPdcchConfig(dlBwp); + free(dlBwp->pdcch_Config); + } + free(srvCellCfg->initialDownlinkBWP); + } + + free(spCellCfg->spCellConfigDedicated); + } + free(spCellCfg->rlmInSyncOutOfSyncThreshold); + } + free(spCellCfg->servCellIndex); + } + free(spCellCfg); + } + DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t)); + ueCfg->cellGrpCfg = NULLP; + } + if(ueCfg->ambrCfg) + { + memset(ueCfg->ambrCfg, 0, sizeof(AmbrCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg)); + } + for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++) + { + freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx]); + } + for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++) + { + freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]); + } +} + +/******************************************************************* + * + * @brief Function to free UecontextSetupDb + * + * @details + * + * Function : freeF1UeDb + * + * Functionality: Function to free UecontextSetupDb + * + * @params[in] UecontextSetupDb * + * @return void + * + * ****************************************************************/ + +void freeF1UeDb(F1UeContextSetupDb *f1UeDb) +{ + + if(f1UeDb->dlRrcMsg) + { + if(f1UeDb->dlRrcMsg->rrcMsgPdu) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\ + f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize); + } + memset(f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg)); + } + freeDuUeCfg(&f1UeDb->duUeCfg); + memset(f1UeDb, 0, sizeof(F1UeContextSetupDb)); + DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb)); +} + +/******************************************************************* + * + * @brief Function to build Am cfg Info + * + * @details + * + * Function : extractRlcAmCfg + * + * Functionality: Function to build Am cfg Info + * + * @params[in] AmBearerCfg * + * void * + * + * @return ROK/RFAILED + * + * ****************************************************************/ + +void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg) +{ + if(rlcAmCfg) + { + /* UL AM */ + if(rlcAmCfg->dl_AM_RLC.sn_FieldLength) + { + amCfgToSet->ulAmCfg.snLenUl = *(rlcAmCfg->dl_AM_RLC.sn_FieldLength); + amCfgToSet->ulAmCfg.reAssemTmr = rlcAmCfg->dl_AM_RLC.t_Reassembly; + amCfgToSet->ulAmCfg.statProhTmr = rlcAmCfg->dl_AM_RLC.t_StatusProhibit; + } + + /* DL AM */ + if(rlcAmCfg->ul_AM_RLC.sn_FieldLength) + { + amCfgToSet->dlAmCfg.snLenDl = *(rlcAmCfg->ul_AM_RLC.sn_FieldLength); + amCfgToSet->dlAmCfg.pollRetxTmr = rlcAmCfg->ul_AM_RLC.t_PollRetransmit; + amCfgToSet->dlAmCfg.pollPdu = rlcAmCfg->ul_AM_RLC.pollPDU; + amCfgToSet->dlAmCfg.pollByte = rlcAmCfg->ul_AM_RLC.pollByte; + amCfgToSet->dlAmCfg.maxRetxTh = rlcAmCfg->ul_AM_RLC.maxRetxThreshold; + } + } +} + +/******************************************************************* + * + * @brief Function to build Um Bi Info + * + * @details + * + * Function : extractRlcUmBiCfg + * + * Functionality: Function to build Um Bi Info + * + * @params[in] UmBiDirBearerCfg * + * void * + * + * @return ROK/RFAILED + * + * ****************************************************************/ + +void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg) +{ + if(rlcBiCfg) + { + /* UL UM BI DIR Cfg */ + if(rlcBiCfg->dl_UM_RLC.sn_FieldLength) + { + umBiCfgToSet->ulUmCfg.snLenUlUm = *(rlcBiCfg->dl_UM_RLC.sn_FieldLength); + umBiCfgToSet->ulUmCfg.reAssemTmr = rlcBiCfg->dl_UM_RLC.t_Reassembly; + } + + /* DL UM BI DIR Cfg */ + if(rlcBiCfg->ul_UM_RLC.sn_FieldLength) + umBiCfgToSet->dlUmCfg.snLenDlUm = *(rlcBiCfg->ul_UM_RLC.sn_FieldLength); + } +} + +/******************************************************************* + * + * @brief Function to build Um Ul Info + * + * @details + * + * Function : extractRlcUmUlCfg + * + * Functionality: Function to build Um Ul Info + * + * @params[in] UmUniDirUlBearerCfg * + * void * + * + * @return ROK/RFAILED + * + * ****************************************************************/ + +void extractRlcUmUlCfg(UmUniDirUlBearerCfg *umUlCfgToSet, struct RLC_Config__um_Uni_Directional_DL *umUlCfg) +{ + if(umUlCfg) + { + if(umUlCfg->dl_UM_RLC.sn_FieldLength) + { + umUlCfgToSet->ulUmCfg.snLenUlUm = *(umUlCfg->dl_UM_RLC.sn_FieldLength); + umUlCfgToSet->ulUmCfg.reAssemTmr = umUlCfg->dl_UM_RLC.t_Reassembly; + } + } +} + +/******************************************************************* + * + * @brief Function to build Um Uni Dl Info + * + * @details + * + * Function : extractRlcUmDlCfg + * + * Functionality: Function to build Um Uni Dl Info + * + * @params[in] UmUniDirDlBearerCfg * + * void * + * + * @return ROK/RFAILED + * + * ****************************************************************/ +void extractRlcUmDlCfg(UmUniDirDlBearerCfg *umDlCfgToSet, struct RLC_Config__um_Uni_Directional_UL *umDlCfg) +{ + if(umDlCfg) + { + if(umDlCfg->ul_UM_RLC.sn_FieldLength) + umDlCfgToSet->dlUmCfg.snLenDlUm = *(umDlCfg->ul_UM_RLC.sn_FieldLength); + } +} + +/******************************************************************* + * + * @brief Function to extractRlcModeCfg + * + * @details + * + * Function : extractRlcModeCfg + * + * Functionality: Function to extractRlcModeCfg + * + * @params[in] RLC_Config_t * + * RlcBearerCfg * + * void * + * @return ROK/RFAILED + * + * ****************************************************************/ +void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lcCfg) +{ + if(lcCfg) + { + switch(rlcMode) + { + case RLC_AM : + { + if(lcCfg->choice.am) + { + DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg)); + if(rlcDbCfg->u.amCfg) + extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am); + } + break; + } + case RLC_UM_BI_DIRECTIONAL : + { + if(lcCfg->choice.um_Bi_Directional) + { + DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg)); + if(rlcDbCfg->u.umBiDirCfg) + extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional); + } + break; + } + case RLC_UM_UNI_DIRECTIONAL_UL : + { + if(lcCfg->choice.um_Uni_Directional_DL) + { + DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg)); + if(rlcDbCfg->u.umUniDirUlCfg) + extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL); + } + break; + } + case RLC_UM_UNI_DIRECTIONAL_DL : + { + if(lcCfg->choice.um_Uni_Directional_UL) + { + DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg)); + if(rlcDbCfg->u.umUniDirDlCfg) + extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL); + } + break; + } + default: + DU_LOG("\nDUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode); + break; + } + } +} + +/******************************************************************* + * + * @brief Function to extract extractUlLcCfg + * + * @details + * + * Function : extractUlLcCfg + * + * Functionality: Function to extract extractUlLcCfg + * + * @params[in] UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg + * @return void + * + * ****************************************************************/ + +void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg) +{ + if(ulLcCfg) + { + if(ulLcCfg->ul_SpecificParameters) + { + f1UlLcCfg->priority = \ + ulLcCfg->ul_SpecificParameters->priority; + if(ulLcCfg->ul_SpecificParameters->logicalChannelGroup) + { + f1UlLcCfg->lcGroup = \ + *(ulLcCfg->ul_SpecificParameters->logicalChannelGroup); + } + if(ulLcCfg->ul_SpecificParameters->schedulingRequestID) + { + f1UlLcCfg->schReqId = \ + *(ulLcCfg->ul_SpecificParameters->schedulingRequestID); + } + f1UlLcCfg->pbr = \ + ulLcCfg->ul_SpecificParameters->prioritisedBitRate; + f1UlLcCfg->bsd = \ + ulLcCfg->ul_SpecificParameters->bucketSizeDuration; + } + } +} + +/******************************************************************* + * + * @brief Function to procRlcLcCfg + * + * @details + * + * Function : procRlcLcCfg + * + * Functionality: Function to procRlcLcCfg + * + * @params[in] rbId, lcId, rbType, rlcMod + * RLC_Config_t *, RlcBearerCfg * , + * @return void + * + * ****************************************************************/ + +void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\ + uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg) +{ + + lcCfg->rbId = rbId; + lcCfg->configType = configType; + + if(rbType == RB_TYPE_SRB) + { + lcCfg->rbType = RB_TYPE_SRB; + lcCfg->lcId = rbId; + lcCfg->lcType = LCH_DCCH; + lcCfg->rlcMode = RLC_AM; + } + else if(rbType == RB_TYPE_DRB) + { + lcCfg->rbType = RB_TYPE_DRB; + lcCfg->lcId = lcId; + lcCfg->lcType = LCH_DTCH; + lcCfg->rlcMode = rlcMode; + } + if(f1RlcCfg) /* rlc mode config recived */ + { + extractRlcModeCfg(lcCfg->rlcMode, lcCfg, f1RlcCfg); + } +} + + + +/******************************************************************* + * + * @brief Fills DrbQos Info received by CU + * + * @details + * + * Function : extractQosInfo + * + * Functionality: Fills DrbQos Info received by CU + * + * @params[in] DrbQosInfo *qosToAdd, + * QoSFlowLevelQoSParameters_t *qosFlowCfg + * @return void + * + * ****************************************************************/ + +void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg) +{ + qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present; + qosToAdd->u.nonDyn5Qi.fiveQi =\ + qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI; + if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow) + { + qosToAdd->u.nonDyn5Qi.avgWindow = \ + *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); + } + qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \ + *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); + if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel) + { + qosToAdd->u.nonDyn5Qi.priorLevel = \ + *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel); + } + qosToAdd->ngRanRetPri.priorityLevel = \ + qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; + qosToAdd->ngRanRetPri.preEmptionCap = \ + qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability; + qosToAdd->ngRanRetPri.preEmptionVul = \ + qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability; + if(qosFlowCfg->gBR_QoS_Flow_Information) + { + memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \ + qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \ + qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size); + memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \ + qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \ + qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size); + memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\ + qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \ + qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size); + memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\ + qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \ + qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size); + } + qosToAdd->pduSessionId = 0; + qosToAdd->ulPduSessAggMaxBitRate = 0; +} + +uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd) +{ + DRB_Information_t *drbInfo = NULLP; + + if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension) + { + if(drbItem->qoSInformation.choice.choice_extension->value.present == + QoSInformation_ExtIEs__value_PR_DRB_Information) + { + drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information; + + if(!macLcToAdd->drbQos) + { + DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo)); + if(macLcToAdd->drbQos == NULLP) + { + DU_LOG("\n DUAPP:Memory failed at allocating DrbQos at extractDrbCfg()"); + return RFAILED; + } + + } + if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI) + { + extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS); + macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel; + } + if(!macLcToAdd->snssai) + { + DU_ALLOC_SHRABL_BUF(macLcToAdd->snssai, sizeof(Snssai)); + if(macLcToAdd->snssai == NULLP) + { + DU_LOG("\n DUAPP:Memory failed at allocating SNSSAI at extractDrbCfg()"); + return RFAILED; + } + } + memcpy(&macLcToAdd->snssai->sst, drbInfo->sNSSAI.sST.buf, \ + drbInfo->sNSSAI.sST.size); + if(drbInfo->sNSSAI.sD) + { + memcpy(macLcToAdd->snssai->sd, drbInfo->sNSSAI.sD->buf, \ + drbInfo->sNSSAI.sD->size); + } + }/*End of DRB Info*/ + } + return ROK; +} + +uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg) +{ + uint8_t ret = ROK; + + if(drbCfg) + { + ret = extractDrbCfg(drbCfg, lcCfg); + if(ret == RFAILED) + { + DU_LOG("F1AP: Failed to build Drb Qos at extractMacRbCfg()"); + return ret; + } + } + else + { + lcCfg->drbQos = NULLP; + lcCfg->snssai = NULLP; + if(lcCfg->lcId == SRB2_LCID) + lcCfg->dlLcCfg.lcp = LC_PRIORITY_3; + else + lcCfg->dlLcCfg.lcp = LC_PRIORITY_1; + } + if(ulLcCfg) + { + lcCfg->ulLcCfgPres = true; + extractUlLcCfg(&lcCfg->ulLcCfg, ulLcCfg); + } + else + lcCfg->ulLcCfgPres = false; + return ret; +} + +uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\ + DRBs_ToBeSetup_Item_t *drbItem, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg) +{ + uint8_t ret = ROK; + + lcCfg->lcId = lcId; + lcCfg->configType = configType; + if(rbType == RB_TYPE_SRB) + { + ret = extractMacRbCfg(lcId, NULL, ulLcCfg, lcCfg); + } + else if(rbType == RB_TYPE_DRB) + { + ret = extractMacRbCfg(lcId, drbItem, ulLcCfg, lcCfg); + } + return ret; +} + +/******************************************************************* + * + * @brief Function to extract Rlc cfg To Add/Mod in CellGrp Info + * + * @details + * + * Function : extractRlcCfgToAddMod + * + * Functionality: Function to extract Rlc cfg To Add/Mod in CellGrp Info + * + * @params[in] CellGroupConfigRrc__rlc_BearerTo pointer + * DuUeCfg Pointer + * @return ROK/RFAILED + * + * ****************************************************************/ + +uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, \ + DuUeCfg *ueCfgDb) +{ + uint8_t ret, idx, rbId, lcId, rlcMode, rbType; + RLC_Config_t *f1RlcCfg = NULLP; + LogicalChannelConfig_t *macUlLcCfg = NULLP; + + for(idx = 0; idx < lcCfg->list.count; idx++) + { + lcId = lcCfg->list.array[idx]->logicalChannelIdentity; + if(lcCfg->list.array[idx]->servedRadioBearer) + { + /* RadioBearer for SRB/DRB */ + if(lcCfg->list.array[idx]->servedRadioBearer->present ==\ + RLC_BearerConfig__servedRadioBearer_PR_srb_Identity) + { + rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.srb_Identity; + rbType = RB_TYPE_SRB; + } + else if(lcCfg->list.array[idx]->servedRadioBearer->present ==\ + RLC_BearerConfig__servedRadioBearer_PR_drb_Identity) + { + rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.drb_Identity; + rbType = RB_TYPE_DRB; + } + else + { + DU_LOG("\n No components present in Bearer config to ADD/MOD"); + return RFAILED; + } + /* MAC UL LC Config */ + if(lcCfg->list.array[idx]->mac_LogicalChannelConfig) + { + macUlLcCfg = lcCfg->list.array[idx]->mac_LogicalChannelConfig; + } + } + else + { + DU_LOG("\nDUAPP: Received RadioBearer config is NULL"); + return RFAILED; + } + /* RLC Mode Config */ + if(lcCfg->list.array[idx]->rlc_Config) + { + rlcMode = lcCfg->list.array[idx]->rlc_Config->present; + f1RlcCfg = lcCfg->list.array[idx]->rlc_Config; + } + + /* Filling RLC/MAC Config*/ + memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg)); + memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg)); + procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx])); + ret = procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx]); + if(ret == RFAILED) + { + DU_LOG("\nDUAPP: Failed while filling MAC LC config at extractRlcCfgToAddMod()"); + return ret; + } + (ueCfgDb->numRlcLcs)++; + (ueCfgDb->numMacLcs)++; + } + //TODO: To send the failure cause in UeContextSetupRsp + return ret; +} + +/******************************************************************* + * + * @brief DeAlloc pdsch serv cell config info + * + * @details + * + * Function : freeMacPdschServCellInfo + * + * Functionality: DeAlloc pdsch serv cell config info + * + * @params[in] PdschServCellCfg pointer + * @return void + * + * ****************************************************************/ + +void freeMacPdschServCellInfo(PdschServCellCfg *pdsch) +{ + if(pdsch->xOverhead) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(uint8_t)); + } + if(pdsch->codeBlkGrpFlushInd) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->codeBlkGrpFlushInd, sizeof(bool)); + } + if(pdsch->maxCodeBlkGrpPerTb) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(uint8_t)); + } + if(pdsch->maxMimoLayers) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxMimoLayers, sizeof(uint8_t)); + } +} + +/******************************************************************* + * + * @brief Free Serving cell Info + * + * @details + * + * Function : freeMacServingCellInfo + * + * Functionality: Free Serving cell Info + * + * @params[in] ServCellCfgInfo *srvCellCfg + * @return void + * + * ****************************************************************/ +void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg) +{ + freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg); + if(srvCellCfg->bwpInactivityTmr) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t)); + } +} + +/******************************************************************* + * + * @brief Free cell Grp Cfg Info + * + * @details + * + * Function : freeUeReCfgCellGrpInfo + * + * Functionality: Free cell Grp Cfg Info + * + * @params[in] MacUeCfg* duUeCfg + * @return void + * + * ****************************************************************/ + +void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg) +{ + freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg); +} + +/******************************************************************* + * + * @brief Fills Reconfig SchReqReConfig + * + * @details + * + * Function : extractSchReqReConfig + * + * Functionality: Fills Reconfig SchReqReConfig + * + * @params[in] SchedulingRequestConfig_t *cuSchedReq + * SchedReqCfg* macSchedReq + * @return void + * + * ****************************************************************/ +void extractSchReqReConfig(SchedulingRequestConfig_t *cuSchedReq, SchedReqCfg *macSchedReq) +{ + uint8_t schReqIdx = 0; + struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqListToAdd = NULLP; + struct SchedulingRequestConfig__schedulingRequestToReleaseList *schReqListToRel = NULLP; + + if(cuSchedReq->schedulingRequestToAddModList) { - if(umDlCfg->ul_UM_RLC.sn_FieldLength) - umDlCfgToSet->dlUmCfg.snLenDlUm = *(umDlCfg->ul_UM_RLC.sn_FieldLength); + schReqListToAdd = cuSchedReq->schedulingRequestToAddModList; + if(schReqListToAdd->list.count) + { + macSchedReq->addModListCount = schReqListToAdd->list.count; + for(schReqIdx = 0; schReqIdx < schReqListToAdd->list.count; schReqIdx++) + { + macSchedReq->addModList[schReqIdx].schedReqId = \ + schReqListToAdd->list.array[schReqIdx]->schedulingRequestId; + macSchedReq->addModList[schReqIdx].srProhibitTmr = \ + *(schReqListToAdd->list.array[schReqIdx]->sr_ProhibitTimer); + macSchedReq->addModList[schReqIdx].srTransMax =\ + schReqListToAdd->list.array[schReqIdx]->sr_TransMax; + } + } + } + /* Scheduling Req To release */ + if(cuSchedReq->schedulingRequestToReleaseList) + { + schReqListToRel = cuSchedReq->schedulingRequestToReleaseList; + if(schReqListToRel->list.count) + { + macSchedReq->relListCount = schReqListToRel->list.count; + for(schReqIdx = 0; schReqIdx < schReqListToRel->list.count; schReqIdx++) + { + macSchedReq->relList[schReqIdx] = \ + *schReqListToRel->list.array[schReqIdx]; + } + } } } /******************************************************************* * - * @brief Function to extractRlcModeCfg + * @brief Fills TagReconfig * * @details * - * Function : extractRlcModeCfg + * Function : extractTagReconfig * - * Functionality: Function to extractRlcModeCfg + * Functionality: Fills extractTagReconfig * - * @params[in] RLC_Config_t * - * RlcBearerCfg * - * void * - * @return ROK/RFAILED + * @params[in] TAG_Config_t *cuTagCfg + * TagCfg *macTagCfg + * @return void * * ****************************************************************/ -void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lcCfg) + +void extractTagReconfig(TAG_Config_t *cuTagCfg, TagCfg *macTagCfg) { - if(lcCfg) + uint8_t tagIdx = 0; + struct TAG_Config__tag_ToAddModList *tagListToAddMod = NULLP; + struct TAG_Config__tag_ToReleaseList *tagListToRel = NULLP; + + /* Tag config to AddMod */ + if(cuTagCfg->tag_ToAddModList) + { + tagListToAddMod = cuTagCfg->tag_ToAddModList; + if(tagListToAddMod->list.count) + { + macTagCfg->addModListCount = tagListToAddMod->list.count; + for(tagIdx = 0; tagIdx < tagListToAddMod->list.count; tagIdx++) + { + macTagCfg->addModList[tagIdx].tagId =\ + tagListToAddMod->list.array[tagIdx]->tag_Id; + macTagCfg->addModList[tagIdx].timeAlignTimer = \ + + tagListToAddMod->list.array[tagIdx]->timeAlignmentTimer; + } + } + } + /* Tag config to release */ + if(cuTagCfg->tag_ToReleaseList) + { + tagListToRel = cuTagCfg->tag_ToReleaseList; + if(tagListToRel->list.count) + { + macTagCfg->relListCount = tagListToRel->list.count; + for(tagIdx = 0; tagIdx < tagListToRel->list.count; tagIdx++) + { + macTagCfg->relList[tagIdx] = *tagListToRel->list.array[tagIdx]; + } + } + } +} + +/******************************************************************* + * + * @brief Fills PdcchCfg received by CU + * + * @details + * + * Function : extractPdcchCfg + * + * Functionality: Fills PdcchCfg received by CU + * + * @params[in] PDCCH_Config_t *cuPdcchCfg, + * PdcchConfig *duPdcchCfg + * @return void + * + * ****************************************************************/ + +void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg) +{ + uint8_t cRsetIdx = 0; + uint8_t srchSpcIdx = 0; + + struct PDCCH_Config__controlResourceSetToAddModList *cRsetToAddModList = NULLP; + struct PDCCH_Config__controlResourceSetToReleaseList *cRsetToRelList = NULLP; + struct PDCCH_Config__searchSpacesToAddModList *srchSpcToAddModList = NULLP; + struct PDCCH_Config__searchSpacesToReleaseList *srchSpcToRelList = NULLP; + + + /* Control Resource Set To Add/Mod List */ + if(cuPdcchCfg->controlResourceSetToAddModList) { - switch(rlcMode) + cRsetToAddModList = cuPdcchCfg->controlResourceSetToAddModList; + if(cRsetToAddModList->list.count) { - case RLC_AM : - { - if(lcCfg->choice.am) - { - DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg)); - if(rlcDbCfg->u.amCfg) - extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am); - } - break; + macPdcchCfg->numCRsetToAddMod = cRsetToAddModList->list.count; + for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++) + { + macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \ + cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId; + bitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\ + macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc); + macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \ + cRsetToAddModList->list.array[cRsetIdx]->duration; + + macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \ + cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present; + if(macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType == CCE_REG_MAPPINGTYPE_PR_INTERLEAVED) + { + //TODO: handle the case for Interleaved } - case RLC_UM_BI_DIRECTIONAL : - { - if(lcCfg->choice.um_Bi_Directional) - { - DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg)); - if(rlcDbCfg->u.umBiDirCfg) - extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional); - } - break; + macPdcchCfg->cRSetToAddModList[cRsetIdx].precoderGranularity = \ + cRsetToAddModList->list.array[cRsetIdx]->precoderGranularity; + if(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID) + { + macPdcchCfg->cRSetToAddModList[cRsetIdx].dmrsScramblingId= \ + *(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID); + } + } + } + + } + /* Control Resource Set To Release List */ + if(cuPdcchCfg->controlResourceSetToReleaseList) + { + cRsetToRelList = cuPdcchCfg->controlResourceSetToReleaseList; + if(cRsetToRelList->list.count) + { + macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count; + for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++) + { + macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]); + } + } + } + + /* Search space To Add/Mod List */ + if(cuPdcchCfg->searchSpacesToAddModList) + { + srchSpcToAddModList = cuPdcchCfg->searchSpacesToAddModList; + if(srchSpcToAddModList->list.count) + { + macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count; + for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++) + { + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\ + srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId; + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\ + *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId); + if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset) + { + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\ + srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present; } - case RLC_UM_UNI_DIRECTIONAL_UL : + if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot) { - if(lcCfg->choice.um_Uni_Directional_DL) - { - DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg)); - if(rlcDbCfg->u.umUniDirUlCfg) - extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL); - } - break; + bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\ + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot); } - case RLC_UM_UNI_DIRECTIONAL_DL : + if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates) { - if(lcCfg->choice.um_Uni_Directional_UL) - { - DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg)); - if(rlcDbCfg->u.umUniDirDlCfg) - extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL); + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel1 = \ + srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel1; + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel2 = \ + srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel2; + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel4 = \ + srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel4; + + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel8 = \ + srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel8; + + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel16 = \ + srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel16; + } + if(srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType) + { + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType =\ + srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->present; + if(macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType == SEARCHSPACETYPE_PR_UE_SPECIFIC) + { + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].ueSpecificDciFormat =\ + srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->choice.ue_Specific->dci_Formats; } - break; - } - default: - DU_LOG("\nDUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode); - break; + + } + } + } + } + /* Search space To Rel List */ + if(cuPdcchCfg->searchSpacesToReleaseList) + { + srchSpcToRelList = cuPdcchCfg->searchSpacesToReleaseList; + if(srchSpcToRelList->list.count) + { + macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count; + for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++) + { + macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\ + *(srchSpcToRelList->list.array[srchSpcIdx]); + } } } } /******************************************************************* * - * @brief Function to extract extractUlLcCfg + * @brief Fills PdschCfg received by CU * * @details * - * Function : extractUlLcCfg + * Function : extractPdschCfg * - * Functionality: Function to extract extractUlLcCfg + * Functionality: Fills PdschCfg received by CU * - * @params[in] UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg + * @params[in] PDSCH_Config_t *cuPdschCfg, + * PdschConfig *macPdschCfg * @return void * * ****************************************************************/ -void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg) +void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg) { - if(ulLcCfg) + uint8_t timeDomIdx; + struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP; + + if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) { - if(ulLcCfg->ul_SpecificParameters) - { - f1UlLcCfg->priority = \ - ulLcCfg->ul_SpecificParameters->priority; - if(ulLcCfg->ul_SpecificParameters->logicalChannelGroup) + if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \ + PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup) { - f1UlLcCfg->lcGroup = \ - *(ulLcCfg->ul_SpecificParameters->logicalChannelGroup); + if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup) + { + macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \ + *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition); + } } - if(ulLcCfg->ul_SpecificParameters->schedulingRequestID) + } + macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation; + if(cuPdschCfg->pdsch_TimeDomainAllocationList) + { + timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList; + if(timeDomAlloc->present ==\ + PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup) { - f1UlLcCfg->schReqId = \ - *(ulLcCfg->ul_SpecificParameters->schedulingRequestID); + if(timeDomAlloc->choice.setup) + { + macPdschCfg->numTimeDomRsrcAlloc = timeDomAlloc->choice.setup->list.count; + for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++) + { + macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \ + timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType; + macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \ + timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength; + } + } } - f1UlLcCfg->pbr = \ - ulLcCfg->ul_SpecificParameters->prioritisedBitRate; - f1UlLcCfg->bsd = \ - ulLcCfg->ul_SpecificParameters->bucketSizeDuration; + } + macPdschCfg->rbgSize = cuPdschCfg->rbg_Size; + if(cuPdschCfg->maxNrofCodeWordsScheduledByDCI) + macPdschCfg->numCodeWordsSchByDci = *(cuPdschCfg->maxNrofCodeWordsScheduledByDCI); + if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_staticBundling) + { + macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present; + if(cuPdschCfg->prb_BundlingType.choice.staticBundling) + { + if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize) + { + macPdschCfg->bundlingInfo.StaticBundling.size = \ + *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize); + } } } + else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling) + { + macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present; + } + } /******************************************************************* * - * @brief Function to procRlcLcCfg + * @brief Fills PdschServingCellCfg received by CU * * @details * - * Function : procRlcLcCfg + * Function : extractPdschServingCellCfg * - * Functionality: Function to procRlcLcCfg + * Functionality: Fills PdschCfg received by CU * - * @params[in] rbId, lcId, rbType, rlcMod - * RLC_Config_t *, RlcBearerCfg * , - * @return void + * @params[in] PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, + * PdschServCellCfg *macUePdschSrvCellCfg + * @return ROK/RFAILED * * ****************************************************************/ -void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\ - uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg) +uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, PdschServCellCfg *macUePdschSrvCellCfg) { - - lcCfg->rbId = rbId; - lcCfg->configType = configType; - - if(rbType == RB_TYPE_SRB) + if(cuPdschSrvCellCfg->codeBlockGroupTransmission) { - lcCfg->rbType = RB_TYPE_SRB; - lcCfg->lcId = rbId; - lcCfg->lcType = LCH_DCCH; - lcCfg->rlcMode = RLC_AM; + if(cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup) + { + if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) + { + *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \ + cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock; + } + else + { + DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(uint8_t)); + if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) + { + *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \ + cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock; + } + else + { + DU_LOG("\nDUAPP: Memory allocation failed for maxCodeBlkGrpPerTb at extractPdschServingCellCfg()"); + return RFAILED; + } + } + if(macUePdschSrvCellCfg->codeBlkGrpFlushInd) + { + *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \ + cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator; + } + else + { + DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(bool)); + if(macUePdschSrvCellCfg->codeBlkGrpFlushInd) + { + *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \ + cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator; + } + else + { + DU_LOG("\nDUAPP: Memory allocation failed for codeBlkGrpFlushInd at extractPdschServingCellCfg()"); + return RFAILED; + } + } + } } - else if(rbType == RB_TYPE_DRB) + if(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH) { - lcCfg->rbType = RB_TYPE_DRB; - lcCfg->lcId = lcId; - lcCfg->lcType = LCH_DTCH; - lcCfg->rlcMode = rlcMode; + macUePdschSrvCellCfg->numHarqProcForPdsch = *(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH); } - if(f1RlcCfg) /* rlc mode config recived */ + if(cuPdschSrvCellCfg->ext1) { - extractRlcModeCfg(lcCfg->rlcMode, lcCfg, f1RlcCfg); + if(cuPdschSrvCellCfg->ext1->maxMIMO_Layers) + { + if(macUePdschSrvCellCfg->maxMimoLayers) + { + *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers); + } + else + { + DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxMimoLayers, sizeof(uint8_t)); + if(macUePdschSrvCellCfg->maxMimoLayers) + { + *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers); + } + else + { + DU_LOG("\nDUAPP: Memory allocation failed for maxMimoLayers at extractPdschServingCellCfg()"); + return RFAILED; + } + } + } + } + if(cuPdschSrvCellCfg->xOverhead) + { + if(macUePdschSrvCellCfg->xOverhead) + { + *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead); + } + else + { + DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(uint8_t)); + if(macUePdschSrvCellCfg->xOverhead) + { + *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead); + } + else + { + DU_LOG("\nDUAPP: Memory allocation failed for xOverhead at extractPdschServingCellCfg()"); + return RFAILED; + } + } } + return ROK; } - - /******************************************************************* * - * @brief Fills DrbQos Info received by CU + * @brief Fills PuschCfg received by CU * * @details * - * Function : extractQosInfo + * Function : extractPuschCfg * - * Functionality: Fills DrbQos Info received by CU + * Functionality: Fills PuschCfg received by CU * - * @params[in] DrbQosInfo *qosToAdd, - * QoSFlowLevelQoSParameters_t *qosFlowCfg + * @params[in] BWP_UplinkDedicated__pusch_Config *cuPuschCfg, + * PuschCfg *macPuschCfg * @return void * * ****************************************************************/ -void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg) -{ - qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present; - qosToAdd->u.nonDyn5Qi.fiveQi =\ - qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI; - if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow) - { - qosToAdd->u.nonDyn5Qi.avgWindow = \ - *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); - } - qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \ - *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); - if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel) - { - qosToAdd->u.nonDyn5Qi.priorLevel = \ - *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel); - } - qosToAdd->ngRanRetPri.priorityLevel = \ - qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; - qosToAdd->ngRanRetPri.preEmptionCap = \ - qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability; - qosToAdd->ngRanRetPri.preEmptionVul = \ - qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability; - if(qosFlowCfg->gBR_QoS_Flow_Information) - { - memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \ - qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \ - qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size); - memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \ - qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \ - qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size); - memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\ - qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \ - qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size); - memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\ - qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \ - qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size); - } - qosToAdd->pduSessionId = 0; - qosToAdd->ulPduSessAggMaxBitRate = 0; -} - -uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd) +void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, PuschCfg *macPuschCfg) { - DRB_Information_t *drbInfo = NULLP; + uint8_t timeDomIdx = 0; + DMRS_UplinkConfig_t *dmrsUlCfg = NULLP; + struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList = NULLP; - if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension) + if(cuPuschCfg->present == BWP_UplinkDedicated__pusch_Config_PR_setup) { - if(drbItem->qoSInformation.choice.choice_extension->value.present == - QoSInformation_ExtIEs__value_PR_DRB_Information) + if(cuPuschCfg->choice.setup) { - drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information; - - if(!macLcToAdd->drbQos) + if(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH) + { + macPuschCfg->dataScramblingId = \ + *(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH); + } + if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA) { - DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo)); - if(macLcToAdd->drbQos == NULLP) + if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->present == PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup) { - DU_LOG("\n DUAPP:Memory failed at allocating DrbQos at extractDrbCfg()"); - return RFAILED; + if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup) + { + dmrsUlCfg = (cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup); + if(dmrsUlCfg->dmrs_AdditionalPosition) + { + macPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos =\ + *(dmrsUlCfg->dmrs_AdditionalPosition); + } + if(dmrsUlCfg->transformPrecodingDisabled) + { + if(dmrsUlCfg->transformPrecodingDisabled->scramblingID0) + { + macPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \ + *(dmrsUlCfg->transformPrecodingDisabled->scramblingID0); + } + } + } } - } - if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI) + /*Res Alloc Type for UL */ + if(cuPuschCfg->choice.setup->resourceAllocation) { - extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS); - macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel; + macPuschCfg->resourceAllocType = \ + cuPuschCfg->choice.setup->resourceAllocation; } - if(!macLcToAdd->snssai) + if(cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList) { - DU_ALLOC_SHRABL_BUF(macLcToAdd->snssai, sizeof(Snssai)); - if(macLcToAdd->snssai == NULLP) + timeDomAllocList = cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList; + if(timeDomAllocList->present == PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup) { - DU_LOG("\n DUAPP:Memory failed at allocating SNSSAI at extractDrbCfg()"); - return RFAILED; + if(timeDomAllocList->choice.setup) + { + macPuschCfg->numTimeDomRsrcAlloc = timeDomAllocList->choice.setup->list.count; + for(timeDomIdx = 0; timeDomIdx choice.setup->list.count; timeDomIdx++) + { + macPuschCfg->timeDomRsrcAllocList[timeDomIdx].k2 = \ + *(timeDomAllocList->choice.setup->list.array[timeDomIdx]->k2); + macPuschCfg->timeDomRsrcAllocList[timeDomIdx].mappingType = \ + timeDomAllocList->choice.setup->list.array[timeDomIdx]->mappingType; + macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength = \ + timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbolAndLength; + } + } } } - memcpy(&macLcToAdd->snssai->sst, drbInfo->sNSSAI.sST.buf, \ - drbInfo->sNSSAI.sST.size); - if(drbInfo->sNSSAI.sD) - { - memcpy(macLcToAdd->snssai->sd, drbInfo->sNSSAI.sD->buf, \ - drbInfo->sNSSAI.sD->size); - } - }/*End of DRB Info*/ + if(cuPuschCfg->choice.setup->transformPrecoder) + macPuschCfg->transformPrecoder = *(cuPuschCfg->choice.setup->transformPrecoder); + } } - return ROK; } -uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg) +/******************************************************************* + * + * @brief Function to fill pucch Power Control + * + * @details + * + * Function : extractPucchPowerControl + * + * Functionality: Function to fill pucch Power Control + * + * @params[in] PucchPowerControl *pwrCtrl, + * struct PUCCH_PowerControl *cuPwrCtrlCfg + * @return void + * + * ****************************************************************/ + +void extractPucchPowerControl(PucchPowerControl *pwrCtrl, struct PUCCH_PowerControl *cuPwrCtrlCfg) { - uint8_t ret = ROK; + uint8_t arrIdx; - if(drbCfg) + if(cuPwrCtrlCfg->deltaF_PUCCH_f0) + pwrCtrl->deltaF_Format0 = *cuPwrCtrlCfg->deltaF_PUCCH_f0; + if(cuPwrCtrlCfg->deltaF_PUCCH_f1) + pwrCtrl->deltaF_Format1 = *cuPwrCtrlCfg->deltaF_PUCCH_f1; + if(cuPwrCtrlCfg->deltaF_PUCCH_f2) + pwrCtrl->deltaF_Format2 = *cuPwrCtrlCfg->deltaF_PUCCH_f2; + if(cuPwrCtrlCfg->deltaF_PUCCH_f3) + pwrCtrl->deltaF_Format3 = *cuPwrCtrlCfg->deltaF_PUCCH_f3; + if(cuPwrCtrlCfg->deltaF_PUCCH_f4) + pwrCtrl->deltaF_Format4 = *cuPwrCtrlCfg->deltaF_PUCCH_f4; + if(cuPwrCtrlCfg->p0_Set) { - ret = extractDrbCfg(drbCfg, lcCfg); - if(ret == RFAILED) + pwrCtrl->p0SetCount = cuPwrCtrlCfg->p0_Set->list.count; + for(arrIdx=0; arrIdx < pwrCtrl->p0SetCount; arrIdx++) { - DU_LOG("F1AP: Failed to build Drb Qos at extractMacRbCfg()"); - return ret; + pwrCtrl->p0Set[arrIdx].p0PucchId =\ + cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Id; + pwrCtrl->p0Set[arrIdx].p0PucchVal =\ + cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Value; } } - else - { - lcCfg->drbQos = NULLP; - lcCfg->snssai = NULLP; - if(lcCfg->lcId == SRB2_LCID) - lcCfg->dlLcCfg.lcp = LC_PRIORITY_3; - else - lcCfg->dlLcCfg.lcp = LC_PRIORITY_1; - } - if(ulLcCfg) - { - lcCfg->ulLcCfgPres = true; - extractUlLcCfg(&lcCfg->ulLcCfg, ulLcCfg); - } - else - lcCfg->ulLcCfgPres = false; - return ret; -} - -uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\ - DRBs_ToBeSetup_Item_t *drbItem, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg) -{ - uint8_t ret = ROK; - - lcCfg->lcId = lcId; - lcCfg->configType = configType; - if(rbType == RB_TYPE_SRB) - { - ret = extractMacRbCfg(lcId, NULL, ulLcCfg, lcCfg); - } - else if(rbType == RB_TYPE_DRB) + if(cuPwrCtrlCfg->pathlossReferenceRSs) { - ret = extractMacRbCfg(lcId, drbItem, ulLcCfg, lcCfg); + pwrCtrl->pathLossRefRSListCount = cuPwrCtrlCfg->pathlossReferenceRSs->list.count; + for(arrIdx = 0; arrIdx < pwrCtrl->pathLossRefRSListCount; arrIdx++) + { + pwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId =\ + cuPwrCtrlCfg->pathlossReferenceRSs->list.array[arrIdx]->pucch_PathlossReferenceRS_Id; + } } - return ret; } - -/******************************************************************* + + /******************************************************************* * - * @brief Function to extract Rlc cfg To Add/Mod in CellGrp Info + * @brief Function to extractResrcSetToAddModList sent by CU * * @details * - * Function : extractRlcCfgToAddMod + * Function : extractResrcSetToAddModList * - * Functionality: Function to extract Rlc cfg To Add/Mod in CellGrp Info + * Functionality: Fucntion to extractResrcSetToAddModList * - * @params[in] CellGroupConfigRrc__rlc_BearerTo pointer - * DuUeCfg Pointer - * @return ROK/RFAILED + * @params[in] PucchResrcSetCfg pointer, + * struct PUCCH_Config__resourceSetToAddModList pointer + * @return void * * ****************************************************************/ -uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, \ - DuUeCfg *ueCfgDb) +void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_Config__resourceSetToAddModList *cuRsrcSetList) { - uint8_t ret, idx, rbId, lcId, rlcMode, rbType; - RLC_Config_t *f1RlcCfg = NULLP; - LogicalChannelConfig_t *macUlLcCfg = NULLP; + uint8_t arrIdx, rsrcListIdx; - for(idx = 0; idx < lcCfg->list.count; idx++) - { - lcId = lcCfg->list.array[idx]->logicalChannelIdentity; - if(lcCfg->list.array[idx]->servedRadioBearer) - { - /* RadioBearer for SRB/DRB */ - if(lcCfg->list.array[idx]->servedRadioBearer->present ==\ - RLC_BearerConfig__servedRadioBearer_PR_srb_Identity) - { - rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.srb_Identity; - rbType = RB_TYPE_SRB; - } - else if(lcCfg->list.array[idx]->servedRadioBearer->present ==\ - RLC_BearerConfig__servedRadioBearer_PR_drb_Identity) - { - rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.drb_Identity; - rbType = RB_TYPE_DRB; - } - else - { - DU_LOG("\n No components present in Bearer config to ADD/MOD"); - return RFAILED; - } - /* MAC UL LC Config */ - if(lcCfg->list.array[idx]->mac_LogicalChannelConfig) - { - macUlLcCfg = lcCfg->list.array[idx]->mac_LogicalChannelConfig; - } - } - else - { - DU_LOG("\nDUAPP: Received RadioBearer config is NULL"); - return RFAILED; - } - /* RLC Mode Config */ - if(lcCfg->list.array[idx]->rlc_Config) - { - rlcMode = lcCfg->list.array[idx]->rlc_Config->present; - f1RlcCfg = lcCfg->list.array[idx]->rlc_Config; - } - - /* Filling RLC/MAC Config*/ - memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg)); - memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg)); - procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx])); - ret = procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx]); - if(ret == RFAILED) - { - DU_LOG("\nDUAPP: Failed while filling MAC LC config at extractRlcCfgToAddMod()"); - return ret; - } - (ueCfgDb->numRlcLcs)++; - (ueCfgDb->numMacLcs)++; - } - //TODO: To send the failure cause in UeContextSetupRsp - return ret; -} + macRsrcSetList->resrcSetToAddModListCount = cuRsrcSetList->list.count; + for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToAddModListCount; arrIdx++) + { + macRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId =\ + cuRsrcSetList->list.array[arrIdx]->pucch_ResourceSetId; + macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount =\ + cuRsrcSetList->list.array[arrIdx]->resourceList.list.count; + for(rsrcListIdx = 0; rsrcListIdx < macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount; rsrcListIdx++) + { + macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\ + *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx]; + } + macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\ + *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1; + } +}/* End of extractResrcSetToAddModList */ /******************************************************************* * - * @brief DeAlloc pdsch serv cell config info + * @brief Fills extractResrcToAddModList sent by CU * * @details * - * Function : freeMacPdschServCellInfo + * Function : extractResrcToAddModList * - * Functionality: DeAlloc pdsch serv cell config info + * Functionality: Fills extractResrcToAddModList * - * @params[in] PdschServCellCfg pointer - * @return void + * @params[in] PucchResrcCfg pointer, + * struct PUCCH_Config__resourceToAddModList pointer + * @return ROk/RFAILED * * ****************************************************************/ -void freeMacPdschServCellInfo(PdschServCellCfg *pdsch) +uint8_t extractResrcToAddModList(PucchResrcCfg *macResrcList, struct PUCCH_Config__resourceToAddModList *cuResrcList) { - if(pdsch->xOverhead) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(uint8_t)); - } - if(pdsch->codeBlkGrpFlushInd) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->codeBlkGrpFlushInd, sizeof(bool)); - } - if(pdsch->maxCodeBlkGrpPerTb) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(uint8_t)); - } - if(pdsch->maxMimoLayers) + uint8_t arrIdx; + + macResrcList->resrcToAddModListCount = cuResrcList->list.count; + for(arrIdx = 0; arrIdx < macResrcList->resrcToAddModListCount; arrIdx++) { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxMimoLayers, sizeof(uint8_t)); + macResrcList->resrcToAddModList[arrIdx].resrcId =\ + cuResrcList->list.array[arrIdx]->pucch_ResourceId; + macResrcList->resrcToAddModList[arrIdx].startPrb =\ + cuResrcList->list.array[arrIdx]->startingPRB; + if(cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping) + { + macResrcList->resrcToAddModList[arrIdx].intraFreqHop =\ + *cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping; + } + if(cuResrcList->list.array[arrIdx]->secondHopPRB) + { + macResrcList->resrcToAddModList[arrIdx].secondPrbHop =\ + *cuResrcList->list.array[arrIdx]->secondHopPRB; + } + /* PUCCH RSRC FORMAT */ + if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format0) + { + macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_0; + if(cuResrcList->list.array[arrIdx]->format.choice.format0) + { + DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0, sizeof(PucchFormat0)); + if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format0 in extractResrcToAddModList()"); + return RFAILED; + } + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->initialCyclicShift =\ + cuResrcList->list.array[arrIdx]->format.choice.format0->initialCyclicShift; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->numSymbols =\ + cuResrcList->list.array[arrIdx]->format.choice.format0->nrofSymbols; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->startSymbolIdx =\ + cuResrcList->list.array[arrIdx]->format.choice.format0->startingSymbolIndex; + } + } + else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format1) + { + macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_1; + if(cuResrcList->list.array[arrIdx]->format.choice.format1) + { + DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1, sizeof(PucchFormat1)); + if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format1 in extractResrcToAddModList()"); + return RFAILED; + } + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->initialCyclicShift =\ + cuResrcList->list.array[arrIdx]->format.choice.format1->initialCyclicShift; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->numSymbols =\ + cuResrcList->list.array[arrIdx]->format.choice.format1->nrofSymbols; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->startSymbolIdx =\ + cuResrcList->list.array[arrIdx]->format.choice.format1->startingSymbolIndex; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->timeDomOCC =\ + cuResrcList->list.array[arrIdx]->format.choice.format1->timeDomainOCC; + } + } + else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format2) + { + macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_2; + if(cuResrcList->list.array[arrIdx]->format.choice.format2) + { + DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2, sizeof(PucchFormat2_3)); + if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format2 in extractResrcToAddModList()"); + return RFAILED; + } + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numPrbs =\ + cuResrcList->list.array[arrIdx]->format.choice.format2->nrofPRBs; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numSymbols =\ + cuResrcList->list.array[arrIdx]->format.choice.format2->nrofSymbols; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->startSymbolIdx =\ + cuResrcList->list.array[arrIdx]->format.choice.format2->startingSymbolIndex; + } + } + else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format3) + { + macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_3; + if(cuResrcList->list.array[arrIdx]->format.choice.format3) + { + DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3, sizeof(PucchFormat2_3)); + if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format3 in extractResrcToAddModList()"); + return RFAILED; + } + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numPrbs =\ + cuResrcList->list.array[arrIdx]->format.choice.format3->nrofPRBs; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numSymbols =\ + cuResrcList->list.array[arrIdx]->format.choice.format3->nrofSymbols; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->startSymbolIdx =\ + cuResrcList->list.array[arrIdx]->format.choice.format3->startingSymbolIndex; + } + } + else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format4) + { + macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_4; + if(cuResrcList->list.array[arrIdx]->format.choice.format4) + { + DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4, sizeof(PucchFormat4)); + if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Format4 in extractResrcToAddModList()"); + return RFAILED; + } + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->numSymbols =\ + cuResrcList->list.array[arrIdx]->format.choice.format4->nrofSymbols; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occLen =\ + cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Length; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occIdx =\ + cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Index; + macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->startSymbolIdx =\ + cuResrcList->list.array[arrIdx]->format.choice.format4->startingSymbolIndex; + } + } } -} + return ROK; + +}/* End of extractResrcToAddModList */ /******************************************************************* * - * @brief Free Serving cell Info + * @brief Fills fillPucchSchedReqPeriodAndOffset sent by CU * * @details * - * Function : freeMacServingCellInfo + * Function : fillPucchSchedReqPeriodAndOffset * - * Functionality: Free Serving cell Info + * Functionality: To fillPucchSchedReqPeriodAndOffset * - * @params[in] ServCellCfgInfo *srvCellCfg + * @params[in] macPeriodicty, + * SchedulingRequestResourceConfig__periodicityAndOffset pointer * @return void * * ****************************************************************/ -void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg) + +void fillPucchSchedReqPeriodAndOffset(uint8_t macPeriodicty, uint16_t macOffset,\ + struct SchedulingRequestResourceConfig__periodicityAndOffset *cuPeriodicty) { - freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg); - if(srvCellCfg->bwpInactivityTmr) + macPeriodicty = cuPeriodicty->present; + switch(macPeriodicty) { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t)); + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2: + { + macOffset = cuPeriodicty->choice.sym2; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7: + { + macOffset = cuPeriodicty->choice.sym6or7; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1: + { + macOffset = cuPeriodicty->choice.sl1; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2: + { + macOffset = cuPeriodicty->choice.sl2; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4: + { + macOffset = cuPeriodicty->choice.sl4; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5: + { + macOffset = cuPeriodicty->choice.sl5; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8: + { + macOffset = cuPeriodicty->choice.sl8; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10: + { + macOffset = cuPeriodicty->choice.sl10; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16: + { + macOffset = cuPeriodicty->choice.sl16; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20: + { + macOffset = cuPeriodicty->choice.sl20; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40: + { + macOffset = cuPeriodicty->choice.sl40; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80: + { + macOffset = cuPeriodicty->choice.sl80; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160: + { + macOffset = cuPeriodicty->choice.sl160; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320: + { + macOffset = cuPeriodicty->choice.sl320; + break; + } + case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640: + { + macOffset = cuPeriodicty->choice.sl640; + break; + } + default : + DU_LOG("\nERROR --> F1AP : Invalid periodicity %d", macPeriodicty); } } /******************************************************************* * - * @brief Free cell Grp Cfg Info + * @brief Function to extractPucchFormatCfg sent by CU * * @details * - * Function : freeUeReCfgCellGrpInfo + * Function : extractPucchFormatCfg * - * Functionality: Free cell Grp Cfg Info + * Functionality: Function to extractPucchFormatCfg * - * @params[in] MacUeCfg* duUeCfg + * @params[in] PucchFormatCfg pointer, + * PUCCH_FormatConfig_t pointer * @return void * * ****************************************************************/ -void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg) -{ - freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg); -} +void extractPucchFormatCfg(PucchFormatCfg *macFormatCfg, PUCCH_FormatConfig_t *cuFormatCfg) + { + if(cuFormatCfg->interslotFrequencyHopping) + macFormatCfg->interSlotFreqHop = *cuFormatCfg->interslotFrequencyHopping; + if(cuFormatCfg->additionalDMRS) + macFormatCfg->addDmrs = *cuFormatCfg->additionalDMRS; + if(cuFormatCfg->maxCodeRate) + macFormatCfg->maxCodeRate = *cuFormatCfg->maxCodeRate; + if(cuFormatCfg->nrofSlots) + macFormatCfg->numSlots = *cuFormatCfg->nrofSlots; + if(cuFormatCfg->pi2BPSK) + macFormatCfg->pi2BPSK = *cuFormatCfg->pi2BPSK; + if(cuFormatCfg->simultaneousHARQ_ACK_CSI) + macFormatCfg->harqAckCSI = *cuFormatCfg->simultaneousHARQ_ACK_CSI; + }/* End of extractPucchFormatCfg */ /******************************************************************* * - * @brief Fills Reconfig SchReqReConfig + * @brief Function to extractSchedReqCfgToAddMod sent by CU * * @details * - * Function : extractSchReqReConfig + * Function : extractSchedReqCfgToAddMod * - * Functionality: Fills Reconfig SchReqReConfig + * Functionality: Function to extractSchedReqCfgToAddMod * - * @params[in] SchedulingRequestConfig_t *cuSchedReq - * SchedReqCfg* macSchedReq + * @params[in] PucchSchedReqCfg pointer, + * PUCCH_Config__schedulingRequestResourceToAddModList pointer * @return void * * ****************************************************************/ -void extractSchReqReConfig(SchedulingRequestConfig_t *cuSchedReq, SchedReqCfg *macSchedReq) + +void extractSchedReqCfgToAddMod(PucchSchedReqCfg *macSchedReqCfg, struct PUCCH_Config__schedulingRequestResourceToAddModList *cuSchedReqList) { - uint8_t schReqIdx = 0; - struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqListToAdd = NULLP; - struct SchedulingRequestConfig__schedulingRequestToReleaseList *schReqListToRel = NULLP; + uint8_t arrIdx; - if(cuSchedReq->schedulingRequestToAddModList) + macSchedReqCfg->schedAddModListCount = cuSchedReqList->list.count; + for(arrIdx = 0; arrIdx < macSchedReqCfg->schedAddModListCount; arrIdx++) { - schReqListToAdd = cuSchedReq->schedulingRequestToAddModList; - if(schReqListToAdd->list.count) + macSchedReqCfg->schedAddModList[arrIdx].resrcId =\ + cuSchedReqList->list.array[arrIdx]->schedulingRequestResourceId; + macSchedReqCfg->schedAddModList[arrIdx].requestId =\ + cuSchedReqList->list.array[arrIdx]->schedulingRequestID; + if(cuSchedReqList->list.array[arrIdx]->periodicityAndOffset) { - macSchedReq->addModListCount = schReqListToAdd->list.count; - for(schReqIdx = 0; schReqIdx < schReqListToAdd->list.count; schReqIdx++) - { - macSchedReq->addModList[schReqIdx].schedReqId = \ - schReqListToAdd->list.array[schReqIdx]->schedulingRequestId; - macSchedReq->addModList[schReqIdx].srProhibitTmr = \ - *(schReqListToAdd->list.array[schReqIdx]->sr_ProhibitTimer); - macSchedReq->addModList[schReqIdx].srTransMax =\ - schReqListToAdd->list.array[schReqIdx]->sr_TransMax; - } + fillPucchSchedReqPeriodAndOffset(macSchedReqCfg->schedAddModList[arrIdx].periodicity,\ + macSchedReqCfg->schedAddModList[arrIdx].offset, cuSchedReqList->list.array[arrIdx]->periodicityAndOffset); + } + if(cuSchedReqList->list.array[arrIdx]->resource) + { + macSchedReqCfg->schedAddModList[arrIdx].resrc =\ + *cuSchedReqList->list.array[arrIdx]->resource; } } - /* Scheduling Req To release */ - if(cuSchedReq->schedulingRequestToReleaseList) + +}/* End of extractSchedReqCfgToAddMod */ + + /******************************************************************* + * + * @brief Fills PucchCfg received by CU + * + * @details + * + * Function : extractPucchCfg + * + * Functionality: Fills PucchCfg received by CU + * + * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg, + * PucchCfg *macPucchCfg + * @return ROK/RFAILED + * + * ****************************************************************/ + +uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg) +{ + uint8_t arrIdx; + + if(cuPucchCfg->present == BWP_UplinkDedicated__pucch_Config_PR_setup) { - schReqListToRel = cuSchedReq->schedulingRequestToReleaseList; - if(schReqListToRel->list.count) + if(cuPucchCfg->choice.setup) { - macSchedReq->relListCount = schReqListToRel->list.count; - for(schReqIdx = 0; schReqIdx < schReqListToRel->list.count; schReqIdx++) + /* Resource Set Cfg */ + if(cuPucchCfg->choice.setup->resourceSetToAddModList) { - macSchedReq->relList[schReqIdx] = \ - *schReqListToRel->list.array[schReqIdx]; + DU_ALLOC_SHRABL_BUF(macPucchCfg->resrcSet, sizeof(PucchResrcSetCfg)); + if(macPucchCfg->resrcSet == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract Resrc set List in extractPucchCfg()"); + return RFAILED; + } + memset(macPucchCfg->resrcSet, 0, sizeof(PucchResrcSetCfg)); + extractResrcSetToAddModList(macPucchCfg->resrcSet, cuPucchCfg->choice.setup->resourceSetToAddModList); + } + + /* Resource Cfg */ + if(cuPucchCfg->choice.setup->resourceToAddModList) + { + DU_ALLOC_SHRABL_BUF(macPucchCfg->resrc, sizeof(PucchResrcCfg)); + if(macPucchCfg->resrc == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract Resrc List in extractPucchCfg()"); + return RFAILED; + } + memset(macPucchCfg->resrc, 0, sizeof(PucchResrcCfg)); + extractResrcToAddModList(macPucchCfg->resrc, cuPucchCfg->choice.setup->resourceToAddModList); + } + + /* Format 1 Cfg */ + if(cuPucchCfg->choice.setup->format1) + { + DU_ALLOC_SHRABL_BUF(macPucchCfg->format1, sizeof(PucchFormatCfg)); + if(macPucchCfg->format1 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract format 1 Cfg in extractPucchCfg()"); + return RFAILED; + } + memset(macPucchCfg->format1, 0, sizeof(PucchFormatCfg)); + extractPucchFormatCfg(macPucchCfg->format1,\ + cuPucchCfg->choice.setup->format1->choice.setup); + } + + /* Format 2 Cfg */ + if(cuPucchCfg->choice.setup->format2) + { + DU_ALLOC_SHRABL_BUF(macPucchCfg->format2, sizeof(PucchFormatCfg)); + if(macPucchCfg->format2 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract format 2 Cfg in extractPucchCfg()"); + return RFAILED; + } + memset(macPucchCfg->format2, 0, sizeof(PucchFormatCfg)); + extractPucchFormatCfg(macPucchCfg->format2,\ + cuPucchCfg->choice.setup->format2->choice.setup); + } + + /* Format 3 Cfg */ + if(cuPucchCfg->choice.setup->format3) + { + DU_ALLOC_SHRABL_BUF(macPucchCfg->format3, sizeof(PucchFormatCfg)); + if(macPucchCfg->format3 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract format 3 Cfg in extractPucchCfg()"); + return RFAILED; + } + memset(macPucchCfg->format3, 0, sizeof(PucchFormatCfg)); + extractPucchFormatCfg(macPucchCfg->format3,\ + cuPucchCfg->choice.setup->format3->choice.setup); + } + + /* Format 4 Cfg */ + if(cuPucchCfg->choice.setup->format4) + { + DU_ALLOC_SHRABL_BUF(macPucchCfg->format4, sizeof(PucchFormatCfg)); + if(macPucchCfg->format4 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract format 4 Cfg in extractPucchCfg()"); + return RFAILED; + } + memset(macPucchCfg->format4, 0, sizeof(PucchFormatCfg)); + extractPucchFormatCfg(macPucchCfg->format4,\ + cuPucchCfg->choice.setup->format4->choice.setup); + } + + /* Sched Req List */ + if(cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList) + { + DU_ALLOC_SHRABL_BUF(macPucchCfg->schedReq, sizeof(PucchSchedReqCfg)); + if(macPucchCfg->schedReq == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract schedReqCfg in extractPucchCfg()"); + return RFAILED; + } + memset(macPucchCfg->schedReq, 0, sizeof(PucchSchedReqCfg)); + extractSchedReqCfgToAddMod(macPucchCfg->schedReq,\ + cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList); + } + + /*TODO: Add support for Spatial Info */ + + /* MultiCsiCfg */ + if(cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList) + { + DU_ALLOC_SHRABL_BUF(macPucchCfg->multiCsiCfg, sizeof(PucchMultiCsiCfg)); + if(macPucchCfg->multiCsiCfg == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract multiCsiCfg in extractPucchCfg()"); + return RFAILED; + } + memset(macPucchCfg->multiCsiCfg, 0, sizeof(PucchMultiCsiCfg)); + macPucchCfg->multiCsiCfg->multiCsiResrcListCount = cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.count; + for(arrIdx =0; arrIdx < macPucchCfg->multiCsiCfg->multiCsiResrcListCount; arrIdx++) + { + macPucchCfg->multiCsiCfg->multiCsiResrcList[arrIdx] =\ + *cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.array[arrIdx]; + } + } + + /* Dl_DataToUL_ACK */ + if(cuPucchCfg->choice.setup->dl_DataToUL_ACK) + { + DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck)); + if(macPucchCfg->dlDataToUlAck == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract Dl_DataToUL_ACK in extractPucchCfg()"); + return RFAILED; + } + memset(macPucchCfg->dlDataToUlAck, 0, sizeof(PucchDlDataToUlAck)); + macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount = cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.count; + for(arrIdx = 0; arrIdx < macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount; arrIdx++) + { + macPucchCfg->dlDataToUlAck->dlDataToUlAckList[arrIdx] =\ + *cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.array[arrIdx]; + } + } + + /* Power Control */ + if(cuPucchCfg->choice.setup->pucch_PowerControl) + { + DU_ALLOC_SHRABL_BUF(macPucchCfg->powerControl, sizeof(PucchPowerControl)); + if(macPucchCfg->powerControl == NULLP) + { + DU_LOG("\nERROR --> F1AP : Failed to extract power control in extractPucchCfg()"); + return RFAILED; + } + extractPucchPowerControl(macPucchCfg->powerControl,\ + cuPucchCfg->choice.setup->pucch_PowerControl); } } } + return ROK; } /******************************************************************* * - * @brief Fills TagReconfig + * @brief Fills ServingCellReconfig received by CU * * @details * - * Function : extractTagReconfig + * Function : extractSpCellDedicatedCfg * - * Functionality: Fills extractTagReconfig + * Functionality: Fills ServingCellReconfig received by CU * - * @params[in] TAG_Config_t *cuTagCfg - * TagCfg *macTagCfg - * @return void + * @params[in] ServingCellConfig_t *cuSrvCellCfg + * ServCellCfgInfo *macSrvCellCfg + * @return ROK/RFAILD * * ****************************************************************/ - -void extractTagReconfig(TAG_Config_t *cuTagCfg, TagCfg *macTagCfg) +uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg) { - uint8_t tagIdx = 0; - struct TAG_Config__tag_ToAddModList *tagListToAddMod = NULLP; - struct TAG_Config__tag_ToReleaseList *tagListToRel = NULLP; + uint8_t ret = ROK; + BWP_DownlinkDedicated_t *dlBwp = NULLP; + BWP_UplinkDedicated_t *ulBwp = NULLP; - /* Tag config to AddMod */ - if(cuTagCfg->tag_ToAddModList) - { - tagListToAddMod = cuTagCfg->tag_ToAddModList; - if(tagListToAddMod->list.count) + if(cuSrvCellCfg->initialDownlinkBWP) + { + dlBwp = ((BWP_DownlinkDedicated_t *)(cuSrvCellCfg->initialDownlinkBWP)); + if(dlBwp->pdcch_Config) + { + if(dlBwp->pdcch_Config->choice.setup) + { + macSrvCellCfg->initDlBwp.pdcchPresent = true; + extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg); + } + } + if(dlBwp->pdsch_Config) + { + if(dlBwp->pdsch_Config->choice.setup) + { + macSrvCellCfg->initDlBwp.pdschPresent = true; + extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg); + } + } + } + if(cuSrvCellCfg->firstActiveDownlinkBWP_Id) + macSrvCellCfg->firstActvDlBwpId = *(cuSrvCellCfg->firstActiveDownlinkBWP_Id); + if(cuSrvCellCfg->defaultDownlinkBWP_Id) + macSrvCellCfg->defaultDlBwpId = *(cuSrvCellCfg->defaultDownlinkBWP_Id); + if(cuSrvCellCfg->bwp_InactivityTimer) + { + if(macSrvCellCfg->bwpInactivityTmr) + { + memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t)); + } + else + { + macSrvCellCfg->bwpInactivityTmr = NULLP; + DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t)); + if(macSrvCellCfg->bwpInactivityTmr) + { + memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t)); + } + else + { + DU_LOG("\nERROR --> F1AP : Memory Alloc failed for bwpInactivityTmr at extractSpCellDedicatedCfg()"); + return RFAILED; + } + } + } + if(cuSrvCellCfg->pdsch_ServingCellConfig) + { + if(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup) + { + ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()"); + return RFAILED; + } + } + } + if(cuSrvCellCfg->uplinkConfig) + { + if(cuSrvCellCfg->uplinkConfig->initialUplinkBWP) { - macTagCfg->addModListCount = tagListToAddMod->list.count; - for(tagIdx = 0; tagIdx < tagListToAddMod->list.count; tagIdx++) + ulBwp = ((BWP_UplinkDedicated_t *)(cuSrvCellCfg->uplinkConfig->initialUplinkBWP)); + if(ulBwp->pusch_Config) { - macTagCfg->addModList[tagIdx].tagId =\ - tagListToAddMod->list.array[tagIdx]->tag_Id; - macTagCfg->addModList[tagIdx].timeAlignTimer = \ - - tagListToAddMod->list.array[tagIdx]->timeAlignmentTimer; + macSrvCellCfg->initUlBwp.puschPresent = true; + extractPuschCfg(ulBwp->pusch_Config, &macSrvCellCfg->initUlBwp.puschCfg); } - } - } - /* Tag config to release */ - if(cuTagCfg->tag_ToReleaseList) - { - tagListToRel = cuTagCfg->tag_ToReleaseList; - if(tagListToRel->list.count) - { - macTagCfg->relListCount = tagListToRel->list.count; - for(tagIdx = 0; tagIdx < tagListToRel->list.count; tagIdx++) + if(ulBwp->pucch_Config) { - macTagCfg->relList[tagIdx] = *tagListToRel->list.array[tagIdx]; + macSrvCellCfg->initUlBwp.pucchPresent = true; + memset(&macSrvCellCfg->initUlBwp.pucchCfg, 0, sizeof(PucchCfg)); + extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg); } } - } + if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id) + macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id); + } + return ret; } - /******************************************************************* * - * @brief Fills PdcchCfg received by CU + * @brief Fills Reconfig Cell group Info received by CU * * @details * - * Function : extractPdcchCfg + * Function : extractUeReCfgCellInfo * - * Functionality: Fills PdcchCfg received by CU + * Functionality: Fills Reconfig Cell group Info received by CU * - * @params[in] PDCCH_Config_t *cuPdcchCfg, - * PdcchConfig *duPdcchCfg - * @return void + * @params[in] CellGroupConfigRrc_t *macCellGrpCfg + * MacUeCfg* macUeCfg + * @return ROK/RFAILED * * ****************************************************************/ - -void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg) +uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg) { - uint8_t cRsetIdx = 0; - uint8_t srchSpcIdx = 0; - - struct PDCCH_Config__controlResourceSetToAddModList *cRsetToAddModList = NULLP; - struct PDCCH_Config__controlResourceSetToReleaseList *cRsetToRelList = NULLP; - struct PDCCH_Config__searchSpacesToAddModList *srchSpcToAddModList = NULLP; - struct PDCCH_Config__searchSpacesToReleaseList *srchSpcToRelList = NULLP; - + uint8_t ret = ROK; + MAC_CellGroupConfig_t *macCellGroup = NULLP; + PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP; + SpCellConfig_t *spcellCfg = NULLP; + ServingCellConfig_t *servCellCfg = NULLP; - /* Control Resource Set To Add/Mod List */ - if(cuPdcchCfg->controlResourceSetToAddModList) + if(cellGrp) { - cRsetToAddModList = cuPdcchCfg->controlResourceSetToAddModList; - if(cRsetToAddModList->list.count) + /* Fill MacCell Group Reconfig */ + if(cellGrp->mac_CellGroupConfig) { - macPdcchCfg->numCRsetToAddMod = cRsetToAddModList->list.count; - for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++) + macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig)); + if(macCellGroup->schedulingRequestConfig) { - macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \ - cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId; - bitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\ - macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc); - macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \ - cRsetToAddModList->list.array[cRsetIdx]->duration; - - macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \ - cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present; - if(macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType == CCE_REG_MAPPINGTYPE_PR_INTERLEAVED) - { - //TODO: handle the case for Interleaved - } - macPdcchCfg->cRSetToAddModList[cRsetIdx].precoderGranularity = \ - cRsetToAddModList->list.array[cRsetIdx]->precoderGranularity; - if(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID) - { - macPdcchCfg->cRSetToAddModList[cRsetIdx].dmrsScramblingId= \ - *(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID); - } - } - } - - } - /* Control Resource Set To Release List */ - if(cuPdcchCfg->controlResourceSetToReleaseList) - { - cRsetToRelList = cuPdcchCfg->controlResourceSetToReleaseList; - if(cRsetToRelList->list.count) - { - macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count; - for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++) + extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg); + } + if(macCellGroup->tag_Config) { - macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]); + extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg); } - } - } - - /* Search space To Add/Mod List */ - if(cuPdcchCfg->searchSpacesToAddModList) - { - srchSpcToAddModList = cuPdcchCfg->searchSpacesToAddModList; - if(srchSpcToAddModList->list.count) - { - macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count; - for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++) + if(macCellGroup->bsr_Config) { - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\ - srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId; - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\ - *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId); - if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset) + macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer; + macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer; + if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer) { - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\ - srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present; - } - if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot) - { - bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\ - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot); - } - if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates) - { - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel1 = \ - srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel1; - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel2 = \ - srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel2; - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel4 = \ - srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel4; - - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel8 = \ - srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel8; - - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel16 = \ - srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel16; + macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\ + *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer); } - if(srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType) + } + if(macCellGroup->phr_Config) + { + if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup) { - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType =\ - srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->present; - if(macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType == SEARCHSPACETYPE_PR_UE_SPECIFIC) + macUeCfg->macCellGrpCfg.phrCfgSetupPres = true; + if(macCellGroup->phr_Config->choice.setup) { - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].ueSpecificDciFormat =\ - srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->choice.ue_Specific->dci_Formats; + 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; } - } } } - } - /* Search space To Rel List */ - if(cuPdcchCfg->searchSpacesToReleaseList) - { - srchSpcToRelList = cuPdcchCfg->searchSpacesToReleaseList; - if(srchSpcToRelList->list.count) + /* Fill Physical Cell Group Reconfig */ + if(cellGrp->physicalCellGroupConfig) { - macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count; - for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++) + phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig)); + if(phyCellGrpCfg->p_NR_FR1) { - macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\ - *(srchSpcToRelList->list.array[srchSpcIdx]); + if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1) + macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1); + } + macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook; + } + /* Fill SpCell Reconfig */ + if(cellGrp->spCellConfig) + { + spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig)); + if(spcellCfg->servCellIndex) + { + macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex); + } + /* Fill Serving cell Reconfig info */ + if(cellGrp->spCellConfig->spCellConfigDedicated) + { + servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated)); + ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()"); + } } } } + return ret; } - /******************************************************************* - * - * @brief Fills PdschCfg received by CU - * - * @details - * - * Function : extractPdschCfg - * - * Functionality: Fills PdschCfg received by CU - * - * @params[in] PDSCH_Config_t *cuPdschCfg, - * PdschConfig *macPdschCfg - * @return void - * - * ****************************************************************/ +* +* @brief free the memory allocated by decoder +* +* @details +* +* Function : freeAperDecodeNrcgi +* +* Functionality: Free Nrcgi values +* +* @params[in] NRCGI_t *nrcgi +* @return void +* +* ****************************************************************/ -void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg) -{ - uint8_t timeDomIdx; - struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP; - if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) - { - if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \ - PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup) - { - if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup) - { - macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \ - *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition); - } - } +void freeAperDecodeNrcgi(NRCGI_t *nrcgi) +{ + if(nrcgi->pLMN_Identity.buf != NULLP) + { + free(nrcgi->pLMN_Identity.buf); + } + if(nrcgi->nRCellIdentity.buf != NULLP) + { + free(nrcgi->nRCellIdentity.buf); + } +} +/******************************************************************* +* +* @brief free the memory allocated by decoder +* +* @details +* +* Function : freeAperDecodeCuToDuInfo +* +* Functionality: Free Cu To Du Information +* +* @params[in] CUtoDURRCInformation_t *rrcMsg +* @return void +* +* ****************************************************************/ + + +void freeAperDecodeCuToDuInfo(CUtoDURRCInformation_t *rrcMsg) +{ + uint8_t ieIdx =0; + uint8_t arrIdx =0; + + if(rrcMsg->uE_CapabilityRAT_ContainerList) + { + if(rrcMsg->uE_CapabilityRAT_ContainerList->buf) + free(rrcMsg->uE_CapabilityRAT_ContainerList->buf); + free(rrcMsg->uE_CapabilityRAT_ContainerList); } - macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation; - if(cuPdschCfg->pdsch_TimeDomainAllocationList) + + if(rrcMsg->iE_Extensions) { - timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList; - if(timeDomAlloc->present ==\ - PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup) + if(rrcMsg->iE_Extensions->list.array) { - if(timeDomAlloc->choice.setup) + for(ieIdx= 0; ieIdx < rrcMsg->iE_Extensions->list.count; ieIdx++) { - macPdschCfg->numTimeDomRsrcAlloc = timeDomAlloc->choice.setup->list.count; - for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++) - { - macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \ - timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType; - macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \ - timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength; + if(rrcMsg->iE_Extensions->list.array[ieIdx]) + { + switch(rrcMsg->iE_Extensions->list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_CellGroupConfig: + if(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf != NULLP) + { + free(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf); + } + break; + default: + DU_LOG("\nF1AP:Invalid Event type %ld at FreeCuToDuInfo()", \ + rrcMsg->iE_Extensions->list.array[ieIdx]->id); + break; + } } } - } - } - macPdschCfg->rbgSize = cuPdschCfg->rbg_Size; - if(cuPdschCfg->maxNrofCodeWordsScheduledByDCI) - macPdschCfg->numCodeWordsSchByDci = *(cuPdschCfg->maxNrofCodeWordsScheduledByDCI); - if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_staticBundling) - { - macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present; - if(cuPdschCfg->prb_BundlingType.choice.staticBundling) - { - if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize) + for(arrIdx = 0; arrIdx < ieIdx; arrIdx++) { - macPdschCfg->bundlingInfo.StaticBundling.size = \ - *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize); + free(rrcMsg->iE_Extensions->list.array[arrIdx]); } + free(rrcMsg->iE_Extensions->list.array); + } + + free(rrcMsg->iE_Extensions); } - else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling) - { - macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present; - } +} +/******************************************************************* +* +* @brief free the memory allocated by decoder +* +* @details +* +* Function : freeAperDecodeSplCellList +* +* Functionality: Free Spl Cell List + where memory allocated by aper_decoder +* +* @params[in] SCell_ToBeSetup_List_t *spCellLst +* @return void +* +* ****************************************************************/ + + +void freeAperDecodeSplCellList(SCell_ToBeSetup_List_t *spCellLst) +{ + uint8_t cellIdx =0; + + if(spCellLst->list.array != NULLP) + { + for(cellIdx=0; cellIdxlist.count; cellIdx++) + { + if(cellIdx==0&&spCellLst->list.array[cellIdx]!=NULLP) + { + freeAperDecodeNrcgi(&spCellLst->list.array[cellIdx]->value.choice.SCell_ToBeSetup_Item.sCell_ID); + } + if(spCellLst->list.array[cellIdx]!=NULLP) + { + free(spCellLst->list.array[cellIdx]); + } + } + free(spCellLst->list.array); + } +} +/******************************************************************* +* +* @brief free the memory allocated by decoder +* +* @details +* +* Function : freeAperDecodeSRBSetup +* +* Functionality: added free part for the memory allocated by aper_decoder +* +* @params[in] SRBs_ToBeSetup_List_t *srbSet +* @return void +* +****************************************************************/ + +void freeAperDecodeSRBSetup(SRBs_ToBeSetup_List_t *srbSet) +{ + uint8_t srbIdx =0; + if(srbSet->list.array != NULLP) + { + for(srbIdx=0; srbIdxlist.count; srbIdx++) + { + if(srbSet->list.array[srbIdx]!=NULLP) + { + free(srbSet->list.array[srbIdx]); + } + } + free(srbSet->list.array); + } } /******************************************************************* - * - * @brief Fills PdschServingCellCfg received by CU - * - * @details - * - * Function : extractPdschServingCellCfg - * - * Functionality: Fills PdschCfg received by CU - * - * @params[in] PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, - * PdschServCellCfg *macUePdschSrvCellCfg - * @return ROK/RFAILED - * - * ****************************************************************/ +* +* @brief free the memory allocated by decoder +* +* @details +* +* Function : freeAperDecodeULTnlInfo +* +* Functionality: added free part for the memory allocated by aper_decoder +* +* @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo +* @return void +* +* ****************************************************************/ -uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, PdschServCellCfg *macUePdschSrvCellCfg) + +void freeAperDecodeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo) { - if(cuPdschSrvCellCfg->codeBlockGroupTransmission) + uint8_t ulIdx=0; + if(ulInfo->list.array != NULLP) { - if(cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup) + for(ulIdx=0; ulIdxlist.count; ulIdx++) { - if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) - { - *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \ - cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock; - } - else + if(ulIdx==0&&ulInfo->list.array[ulIdx]!=NULLP) { - DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(uint8_t)); - if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) - { - *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \ - cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock; - } - else + if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP) { - DU_LOG("\nDUAPP: Memory allocation failed for maxCodeBlkGrpPerTb at extractPdschServingCellCfg()"); - return RFAILED; + if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf != NULLP) + { + if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\ + !=NULLP) + { + free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf); + } + free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf); + } + free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel); } } - if(macUePdschSrvCellCfg->codeBlkGrpFlushInd) - { - *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \ - cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator; - } - else + if(ulInfo->list.array[ulIdx]!=NULLP) { - DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(bool)); - if(macUePdschSrvCellCfg->codeBlkGrpFlushInd) - { - *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \ - cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator; - } - else - { - DU_LOG("\nDUAPP: Memory allocation failed for codeBlkGrpFlushInd at extractPdschServingCellCfg()"); - return RFAILED; - } + free(ulInfo->list.array[ulIdx]); } } + free(ulInfo->list.array); } - if(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH) - { - macUePdschSrvCellCfg->numHarqProcForPdsch = *(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH); - } - if(cuPdschSrvCellCfg->ext1) - { - if(cuPdschSrvCellCfg->ext1->maxMIMO_Layers) - { - if(macUePdschSrvCellCfg->maxMimoLayers) - { - *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers); - } - else - { - DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxMimoLayers, sizeof(uint8_t)); - if(macUePdschSrvCellCfg->maxMimoLayers) - { - *(macUePdschSrvCellCfg->maxMimoLayers) = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers); - } - else - { - DU_LOG("\nDUAPP: Memory allocation failed for maxMimoLayers at extractPdschServingCellCfg()"); - return RFAILED; - } - } - } - } - if(cuPdschSrvCellCfg->xOverhead) - { - if(macUePdschSrvCellCfg->xOverhead) - { - *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead); - } - else - { - DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(uint8_t)); - if(macUePdschSrvCellCfg->xOverhead) - { - *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead); - } - else - { - DU_LOG("\nDUAPP: Memory allocation failed for xOverhead at extractPdschServingCellCfg()"); - return RFAILED; - } - } - } - return ROK; } - /******************************************************************* - * - * @brief Fills PuschCfg received by CU - * - * @details - * - * Function : extractPuschCfg - * - * Functionality: Fills PuschCfg received by CU - * - * @params[in] BWP_UplinkDedicated__pusch_Config *cuPuschCfg, - * PuschCfg *macPuschCfg - * @return void - * - * ****************************************************************/ +* +* @brief free the memory allocated by decoder +* +* @details +* +* Function : freeAperDecodeDRBSetup +* +* Functionality: free DRBSetup which is allocated by decoder +* +* @params[in] DRBs_ToBeSetup_List_t *drbSet +* @return void +* +* ****************************************************************/ -void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, PuschCfg *macPuschCfg) +void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet) { - uint8_t timeDomIdx = 0; - DMRS_UplinkConfig_t *dmrsUlCfg = NULLP; - struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList = NULLP; - - if(cuPuschCfg->present == BWP_UplinkDedicated__pusch_Config_PR_setup) + DRBs_ToBeSetup_Item_t *drbSetItem = NULLP; + uint8_t flowIdx =0; + uint8_t drbIdx =0; + + if(drbSet->list.array != NULLP) { - if(cuPuschCfg->choice.setup) + for(drbIdx=0; drbIdxlist.count; drbIdx++) { - if(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH) - { - macPuschCfg->dataScramblingId = \ - *(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH); - } - if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA) + if(drbIdx==0&&drbSet->list.array[drbIdx] != NULLP) { - if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->present == PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup) + drbSetItem =&drbSet->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item; + if(drbSetItem->qoSInformation.choice.choice_extension != NULLP) { - if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup) + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP) { - dmrsUlCfg = (cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup); - if(dmrsUlCfg->dmrs_AdditionalPosition) - { - macPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos =\ - *(dmrsUlCfg->dmrs_AdditionalPosition); - } - if(dmrsUlCfg->transformPrecodingDisabled) - { - if(dmrsUlCfg->transformPrecodingDisabled->scramblingID0) - { - macPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \ - *(dmrsUlCfg->transformPrecodingDisabled->scramblingID0); - } - } + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) + { + + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP) + { + + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP) + { + + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->\ + buf!=NULLP) + { + + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.array != NULLP) + { + + for(flowIdx=0;flowIdxqoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.count; flowIdx++) + { + + if(flowIdx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) + { + + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) + { + freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); + free(drbSetItem->uLConfiguration); + + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI); + } + } + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP) + { + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]); + } + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.sNSSAI.sD->buf); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf); + + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI); } + free(drbSetItem->qoSInformation.choice.choice_extension); } } - /*Res Alloc Type for UL */ - if(cuPuschCfg->choice.setup->resourceAllocation) - { - macPuschCfg->resourceAllocType = \ - cuPuschCfg->choice.setup->resourceAllocation; - } - if(cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList) + if(drbSet->list.array[drbIdx]!=NULLP) { - timeDomAllocList = cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList; - if(timeDomAllocList->present == PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup) - { - if(timeDomAllocList->choice.setup) - { - macPuschCfg->numTimeDomRsrcAlloc = timeDomAllocList->choice.setup->list.count; - for(timeDomIdx = 0; timeDomIdx choice.setup->list.count; timeDomIdx++) - { - macPuschCfg->timeDomRsrcAllocList[timeDomIdx].k2 = \ - *(timeDomAllocList->choice.setup->list.array[timeDomIdx]->k2); - macPuschCfg->timeDomRsrcAllocList[timeDomIdx].mappingType = \ - timeDomAllocList->choice.setup->list.array[timeDomIdx]->mappingType; - macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength = \ - timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbolAndLength; - } - } - } + free(drbSet->list.array[drbIdx]); } - if(cuPuschCfg->choice.setup->transformPrecoder) - macPuschCfg->transformPrecoder = *(cuPuschCfg->choice.setup->transformPrecoder); } + free(drbSet->list.array); } } + + /******************************************************************* * - * @brief Fills ServingCellReconfig received by CU + * @brief builds Mac Cell Cfg * * @details * - * Function : extractServingCellReconfig + * Function : procUeReCfgCellInfo * - * Functionality: Fills ServingCellReconfig received by CU + * Functionality: builds Mac Cell Cfg * - * @params[in] ServingCellConfig_t *cuSrvCellCfg - * ServCellCfgInfo *macSrvCellCfg - * @return ROK/RFAILD + * @params[in] MacUeCfg pointer + * void pointer + * + * @return void * * ****************************************************************/ -uint8_t extractServingCellReconfig(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg) +uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo) { uint8_t ret = ROK; - BWP_DownlinkDedicated_t *dlBwp = NULLP; - BWP_UplinkDedicated_t *ulBwp = NULLP; + CellGroupConfigRrc_t *cellGrp = NULLP; - if(cuSrvCellCfg->initialDownlinkBWP) - { - dlBwp = ((BWP_DownlinkDedicated_t *)(cuSrvCellCfg->initialDownlinkBWP)); - if(dlBwp->pdcch_Config) - { - if(dlBwp->pdcch_Config->choice.setup) - { - extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg); - } - } - if(dlBwp->pdsch_Config) - { - if(dlBwp->pdsch_Config->choice.setup) - { - extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg); - } - } - } - if(cuSrvCellCfg->firstActiveDownlinkBWP_Id) - macSrvCellCfg->firstActvDlBwpId = *(cuSrvCellCfg->firstActiveDownlinkBWP_Id); - if(cuSrvCellCfg->defaultDownlinkBWP_Id) - macSrvCellCfg->defaultDlBwpId = *(cuSrvCellCfg->defaultDownlinkBWP_Id); - if(cuSrvCellCfg->bwp_InactivityTimer) - { - if(macSrvCellCfg->bwpInactivityTmr) - { - memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t)); - } - else - { - macSrvCellCfg->bwpInactivityTmr = NULLP; - DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t)); - if(macSrvCellCfg->bwpInactivityTmr) - { - memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t)); - } - else - { - DU_LOG("\nMemory Alloc failed for bwpInactivityTmr at extractServingCellReconfig()"); - return RFAILED; - } - } - } - if(cuSrvCellCfg->pdsch_ServingCellConfig) + if(cellInfo) { - if(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup) - { - ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg); - if(ret == RFAILED) - { - DU_LOG("\nFailed at extractPdschServingCellCfg()"); - return RFAILED; - } - } + cellGrp = (CellGroupConfigRrc_t *)cellInfo; + ret = extractUeReCfgCellInfo(cellGrp, macUeCfg); + if(ret == RFAILED) + DU_LOG("\nF1AP: Failed at procUeReCfgCellInfo()"); } - if(cuSrvCellCfg->uplinkConfig) + if(ret == RFAILED) { - if(cuSrvCellCfg->uplinkConfig->initialUplinkBWP) - { - ulBwp = ((BWP_UplinkDedicated_t *)(cuSrvCellCfg->uplinkConfig->initialUplinkBWP)); - if(ulBwp->pusch_Config) - { - macSrvCellCfg->initUlBwp.puschPresent = true; - extractPuschCfg(ulBwp->pusch_Config, &macSrvCellCfg->initUlBwp.puschCfg); - } - if(ulBwp->pucch_Config) - { - macSrvCellCfg->initUlBwp.pucchPresent = true; - //extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg); - } - } - if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id) - macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id); - + freeUeReCfgCellGrpInfo(macUeCfg); } return ret; } + /******************************************************************* * - * @brief Fills Reconfig Cell group Info received by CU + * @brief Filling modulation info in mac ue cfg * * @details * - * Function : extractUeReCfgCellInfo + * Function : duFillModulationDetails * - * Functionality: Fills Reconfig Cell group Info received by CU + * Functionality: Filling modulation info in mac ue cfg * - * @params[in] CellGroupConfigRrc_t *macCellGrpCfg - * MacUeCfg* macUeCfg - * @return ROK/RFAILED + * @params[in] MAC UE Config to be updated + * Current UE configuration + * UE NR capability from CU + * @return ROK - success + * RFAILED - failure * * ****************************************************************/ -uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg) +void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap) { - uint8_t ret = ROK; - MAC_CellGroupConfig_t *macCellGroup = NULLP; - PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP; - SpCellConfig_t *spcellCfg = NULLP; - ServingCellConfig_t *servCellCfg = NULLP; + UE_NR_Capability_t *ueNrCap; - if(cellGrp) + if(ueCap) + ueNrCap = (UE_NR_Capability_t *)ueCap; + + /* Filling DL modulation info */ + if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \ + ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \ + ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL) { - /* Fill MacCell Group Reconfig */ - if(cellGrp->mac_CellGroupConfig) + switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)) { - macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig)); - if(macCellGroup->schedulingRequestConfig) - { - extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg); - } - if(macCellGroup->tag_Config) - { - extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg); - } - if(macCellGroup->bsr_Config) - { - macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer; - macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer; - if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer) + case ModulationOrder_qpsk: { - macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\ - *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer); + ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK; + break; } - } - if(macCellGroup->phr_Config) - { - if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup) + case ModulationOrder_qam16: { - 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; - } + ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16; + break; + } + case ModulationOrder_qam64: + { + ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64; + ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX; + ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64; + break; + } + case ModulationOrder_qam256: + { + ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256; + break; + } + default: + { + DU_LOG("\nDU APP: Incorrect downlink modulation order received. Reatining old modulation configuration"); + memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo)); + break; } - - - } - } - /* Fill Physical Cell Group Reconfig */ - if(cellGrp->physicalCellGroupConfig) - { - phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig)); - if(phyCellGrpCfg->p_NR_FR1) - { - if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1) - macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1); - } - macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook; } - /* Fill SpCell Reconfig */ - if(cellGrp->spCellConfig) + } + else + { + memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo)); + } + + /* Filling UL modulation info */ + if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \ + ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \ + ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL) + { + switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)) { - spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig)); - if(spcellCfg->servCellIndex) - { - macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex); - } - /* Fill Serving cell Reconfig info */ - if(cellGrp->spCellConfig->spCellConfigDedicated) - { - servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated)); - ret = extractServingCellReconfig(servCellCfg, &macUeCfg->spCellCfg.servCellCfg); - if(ret == RFAILED) + case ModulationOrder_qpsk: + { + ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK; + break; + } + case ModulationOrder_qam16: + { + ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16; + ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX; + ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64; + break; + } + case ModulationOrder_qam64: + { + ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64; + break; + } + case ModulationOrder_qam256: + { + ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256; + break; + } + default: { - DU_LOG("\n Failed at extractServingCellReconfig()"); + DU_LOG("\nDU APP: Incorrect uplink modulation order received. Reatining old modulation configuration"); + memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo)); + break; } - } } } - return ret; -} - -/******************************************************************* - * - * @brief builds Mac Cell Cfg - * - * @details - * - * Function : procUeReCfgCellInfo - * - * Functionality: builds Mac Cell Cfg - * - * @params[in] MacUeCfg pointer - * void pointer - * - * @return void - * - * ****************************************************************/ -uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo) -{ - uint8_t ret = ROK; - CellGroupConfigRrc_t *cellGrp = NULLP; - - if(cellInfo) - { - cellGrp = (CellGroupConfigRrc_t *)cellInfo; - ret = extractUeReCfgCellInfo(cellGrp, macUeCfg); - if(ret == RFAILED) - DU_LOG("\nF1AP: Failed at procUeReCfgCellInfo()"); - } - if(ret == RFAILED) + else { - freeUeReCfgCellGrpInfo(macUeCfg); + memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo)); } - return ret; } /******************************************************************* @@ -6957,9 +8727,9 @@ uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo) CellGroupConfigRrc_t *extractCellGrpInfo(ProtocolExtensionContainer_4624P16_t *protocolIeExtn,\ DuUeCfg *ueCfgDb) { - uint8_t idx2; - uint16_t id; - uint16_t recvBufLen; + uint8_t idx2 =0; + uint16_t id =0; + uint16_t recvBufLen =0; CellGroupConfigRrc_t *cellGrpCfg = NULLP; CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP; asn_dec_rval_t rval; /* Decoder return value */ @@ -7231,6 +9001,169 @@ uint8_t extractDlRrcMsg(uint32_t gnbDuUeF1apId, uint32_t gnbCuUeF1apId, \ return ret; } +/******************************************************************* + * + * @brief Extract UE capability info + * + * @details + * + * Function : extractUeCapability + * + * Functionality: Extract UE capability info and stores in ue Cb + * + * @params[in] Octet string of UE capability RAT container list + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapablityListBuf, DuUeCb *ueCb) +{ + uint8_t idx; + uint16_t recvBufLen; + asn_dec_rval_t rval; + UE_NR_Capability_t *ueNrCap = NULLP; + UE_CapabilityRAT_ContainerListRRC_t *ueCapRatContList = NULLP; + + /* Decoding UE Capability RAT Container List */ + recvBufLen = ueCapablityListBuf->size; + DU_ALLOC(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t)); + if(!ueCapRatContList) + { + DU_LOG("\nF1AP : Memory allocation failed in extractUeCapability"); + return NULLP; + } + memset(ueCapRatContList, 0, sizeof(UE_CapabilityRAT_ContainerListRRC_t)); + memset(&rval, 0, sizeof(asn_dec_rval_t)); + rval = aper_decode(0, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, (void **)&ueCapRatContList, + ueCapablityListBuf->buf, recvBufLen, 0, 0); + if(rval.code == RC_FAIL || rval.code == RC_WMORE) + { + DU_LOG("\nF1AP : ASN decode failed at decodeCellGrpCfg()"); + return NULLP; + } + xer_fprint(stdout, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, ueCapRatContList); + + /* Free encoded buffer after decoding */ + + for(idx = 0; idx < ueCapRatContList->list.count; idx++) + { + if(ueCapRatContList->list.array[idx]->rat_Type == RAT_Type_nr) + { + /* Decoding UE NR Capability */ + recvBufLen = ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.size; + DU_ALLOC(ueNrCap, sizeof(UE_NR_Capability_t)); + if(!ueNrCap) + { + DU_LOG("\nF1AP : Memory allocation failed in extractUeCapability"); + DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t)); + return NULLP; + } + memset(ueNrCap, 0, sizeof(UE_NR_Capability_t)); + memset(&rval, 0, sizeof(asn_dec_rval_t)); + rval = aper_decode(0, &asn_DEF_UE_NR_Capability, (void **)&ueNrCap, + ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf, recvBufLen, 0, 0); + if(rval.code == RC_FAIL || rval.code == RC_WMORE) + { + DU_LOG("\nF1AP : ASN decode failed at decodeCellGrpCfg()"); + return NULLP; + } + xer_fprint(stdout, &asn_DEF_UE_NR_Capability, ueNrCap); + + /* Free encoded buffer after decoding */ + free(ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf); + } + free(ueCapRatContList->list.array[idx]); + } + + /* Free Memory*/ + free(ueCapRatContList->list.array); + DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t)); + return ueNrCap; +} + +/******************************************************************* +* +* @brief free UE context setup request from CU +* +* @details +* +* Function : freeAperDecodeF1UeContextSetupReq +* +* Functionality: freeing part for the memory allocated by aper_decoder +* +* @params[in] F1AP message +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t *ueSetReq) +{ + uint8_t ieIdx = 0; + + if(ueSetReq->protocolIEs.list.array != NULLP) + { + for(ieIdx = 0; ieIdx < ueSetReq->protocolIEs.list.count; ieIdx++) + { + if(ueSetReq->protocolIEs.list.array[ieIdx]) + { + switch(ueSetReq->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_SpCell_ID: + freeAperDecodeNrcgi(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI); + break; + case ProtocolIE_ID_id_ServCellIndex: + break; + case ProtocolIE_ID_id_SpCellULConfigured: + break; + case ProtocolIE_ID_id_CUtoDURRCInformation: + + freeAperDecodeCuToDuInfo(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation); + break; + case ProtocolIE_ID_id_SCell_ToBeSetup_List: + + freeAperDecodeSplCellList(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SCell_ToBeSetup_List); + break; + case ProtocolIE_ID_id_SRBs_ToBeSetup_List: + + freeAperDecodeSRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List); + break; + case ProtocolIE_ID_id_DRBs_ToBeSetup_List: + + freeAperDecodeDRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List); + break; + case ProtocolIE_ID_id_RRCContainer: + { + + if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf != NULLP) + { + + free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf); + } + break; + } + case ProtocolIE_ID_id_RRCDeliveryStatusRequest: + break; + case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL: + { + if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf) + { + free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf); + } + break; + } + default: + printf("\nF1AP: Invalid event type %ld",ueSetReq->protocolIEs.list.array[ieIdx]->id); + } + free(ueSetReq->protocolIEs.list.array[ieIdx]); + } + } + free(ueSetReq->protocolIEs.list.array); + } +} /******************************************************************* * * @brief Process UE context setup request from CU @@ -7248,9 +9181,9 @@ uint8_t extractDlRrcMsg(uint32_t gnbDuUeF1apId, uint32_t gnbCuUeF1apId, \ * ****************************************************************/ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) { - uint8_t ret, ieIdx, ueIdx, lcId, cellIdx; + uint8_t ret, ieIdx, ueIdx, lcId, cellIdx; bool ueCbFound = false; - uint32_t gnbCuUeF1apId, gnbDuUeF1apId; + uint32_t gnbCuUeF1apId, gnbDuUeF1apId, bitRateSize; DuUeCb *duUeCb = NULLP; UEContextSetupRequest_t *ueSetReq = NULLP; @@ -7311,6 +9244,12 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) break; case ProtocolIE_ID_id_CUtoDURRCInformation: { + if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList) + { + duUeCb->f1UeDb->duUeCfg.ueNrCapability = \ + extractUeCapability(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.\ + uE_CapabilityRAT_ContainerList, duUeCb); + } if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.iE_Extensions) { duUeCb->f1UeDb->duUeCfg.cellGrpCfg = extractCellGrpInfo(ueSetReq->protocolIEs.list.array[ieIdx]->\ @@ -7387,32 +9326,30 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) } break; } - //TODO: To handle maxAggrBitRate case, - // Dependency: The protocolIE is not specified in ASN -#if 0 - case ProtocolIE_ID_id_ULPDUSessionAggregateMaximumBitRate: { + case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL: + { /* MaximumBitRate Uplink */ bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size; if(bitRateSize > 0) { - DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.maxAggrBitRate, bitRateSize); - if(!duUeCb->f1UeDb->duUeCfg.maxAggrBitRate) + DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.ambrCfg, bitRateSize); + if(!duUeCb->f1UeDb->duUeCfg.ambrCfg) { DU_LOG("\nDU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq"); ret = RFAILED; } else { - duUeCb->f1UeDb->duUeCfg.maxAggrBitRate->ulBits =\ - *ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf; - duUeCb->f1UeDb->duUeCfg.maxAggrBitRate->dlBits = 0; + memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg)); + memcpy(&duUeCb->f1UeDb->duUeCfg.ambrCfg->ulBr, + ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize); + duUeCb->f1UeDb->duUeCfg.ambrCfg->dlBr = 0; } } else ret = RFAILED; break; } -#endif default: { break; @@ -7427,7 +9364,8 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) } else ret = duProcUeContextSetupRequest(duUeCb); - + + freeAperDecodeF1UeContextSetupReq(ueSetReq); return ret; } @@ -7674,6 +9612,7 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) choice.DUtoCURRCInformation.cellGroupConfig, cellGrpCfg); /* Free UeContext Db created during Ue context Req */ freeF1UeDb(ueCb->f1UeDb); + ueCb->f1UeDb = NULLP; } } else @@ -7720,8 +9659,21 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) FreeUeContextSetupRsp(f1apMsg); return ret; }/* End of BuildAndSendUeContextSetupRsp */ +/******************************************************************* +* +* @brief Build And Send Ue Context Rsp +* +* @details +* +* Function : BuildAndSendUeCtxtRsp +* +* Functionality : Build And Send Ue Context Rsp - +* @params[in] +* @return sucess = ROK +* failure = RFAILED +* +* ****************************************************************/ uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId) { uint8_t cellIdx = 0, actionType = 0; @@ -8064,6 +10016,36 @@ uint8_t BuildAndSendF1ResetAck() FreeF1ResetAck(f1apMsg); return ret; } +/****************************************************************** +* +* @brief free F1 reset msg allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodeF1ResetMsg +* +* Functionality: free F1 reset msg allocated by aper_decoder +* +* @params[in] Reset_t *f1ResetMsg +* @return void +* +* ****************************************************************/ + +void freeAperDecodeF1ResetMsg(Reset_t *f1ResetMsg) +{ + uint8_t ieIdx =0; + if(f1ResetMsg->protocolIEs.list.array) + { + for(ieIdx=0 ;ieIdx < f1ResetMsg->protocolIEs.list.count ; ieIdx++) + { + if(f1ResetMsg->protocolIEs.list.array[ieIdx]) + { + free(f1ResetMsg->protocolIEs.list.array[ieIdx]); + } + } + free(f1ResetMsg->protocolIEs.list.array); + } +} /****************************************************************** * @@ -8083,16 +10065,16 @@ uint8_t BuildAndSendF1ResetAck() uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg) { /* we are currently not supporting Ue release. right now we are supporting only init case of fireset */ - uint8_t idx = 0; + uint8_t ieIdx = 0; uint8_t ret = ROK; Reset_t *f1ResetMsg = NULLP; DU_LOG("\nProcessing F1 reset request"); f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset; - for(idx=0; idxprotocolIEs.list.count; idx++) + for(ieIdx=0; ieIdxprotocolIEs.list.count; ieIdx++) { - switch(f1ResetMsg->protocolIEs.list.array[idx]->id) + switch(f1ResetMsg->protocolIEs.list.array[ieIdx]->id) { case ProtocolIE_ID_id_TransactionID: break; @@ -8112,6 +10094,9 @@ uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg) } ret = BuildAndSendF1ResetAck(); DU_LOG("\nUE release is not supported for now"); + + freeAperDecodeF1ResetMsg(f1ResetMsg); + return ret; } @@ -8337,7 +10322,116 @@ uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate) } return ret; } +/****************************************************************** +* +* @brief Processes F1 Setup Response allocated by aper_decoder +* +* @details +* +* Function : freeF1SetupRsp +* +* Functionality: free F1 Setup Response allocated by aper_decoder +* +* @params[in] F1SetupResponse_t *f1SetRspMsg +* @return void +* +* ****************************************************************/ + +void freeAperDecodeF1SetupRsp(F1SetupResponse_t *f1SetRspMsg) +{ + uint8_t ieIdx =0; + uint8_t arrIdx =0; + Cells_to_be_Activated_List_t *cellToActivate =NULLP; + RRC_Version_t *rrcVer =NULLP; + + if(f1SetRspMsg->protocolIEs.list.array) + { + for(ieIdx=0; ieIdxprotocolIEs.list.count; ieIdx++) + { + if(f1SetRspMsg->protocolIEs.list.array[ieIdx]) + { + switch(f1SetRspMsg->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_Cells_to_be_Activated_List: + { + cellToActivate = + &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.Cells_to_be_Activated_List; + if(cellToActivate->list.array) + { + for(arrIdx=0; arrIdxlist.count ; arrIdx++) + { + if(cellToActivate->list.array[arrIdx]) + { + + if(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.nRCGI.\ + pLMN_Identity.buf) + { + if(cellToActivate->list.array[0]->value.choice.\ + Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf) + { + free(cellToActivate->list.array[0]->value.choice.\ + Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf); + } + + free(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\ + nRCGI.pLMN_Identity.buf); + } + free(cellToActivate->list.array[arrIdx]); + } + } + free(cellToActivate->list.array); + } + break; + } + case ProtocolIE_ID_id_TransactionID: + { + break; + } + case ProtocolIE_ID_id_gNB_CU_Name: + { + free(f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_Name.buf); + break; + } + case ProtocolIE_ID_id_GNB_CU_RRC_Version: + { + rrcVer = &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version; + if(rrcVer->latest_RRC_Version.buf) + { + if(rrcVer->iE_Extensions) + { + if(rrcVer->iE_Extensions->list.array) + { + if(rrcVer->iE_Extensions->list.array[0]) + { + if(rrcVer->iE_Extensions->list.\ + array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf) + { + free(rrcVer->iE_Extensions->list.\ + array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf); + } + free(rrcVer->iE_Extensions->list.array[0]); + } + free(rrcVer->iE_Extensions->list.array); + } + free(rrcVer->iE_Extensions); + } + free(rrcVer->latest_RRC_Version.buf); + } + break; + } + default: + { + DU_LOG("\nDU_APP : Invalid IE received in F1SetupRsp:%ld", + f1SetRspMsg->protocolIEs.list.array[ieIdx]->id); + } + } + free(f1SetRspMsg->protocolIEs.list.array[ieIdx]); + } + } + free(f1SetRspMsg->protocolIEs.list.array); + } +} /****************************************************************** * * @brief Processes F1 Setup Response sent by CU @@ -8356,11 +10450,12 @@ uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate) uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg) { uint8_t ret = ROK; - uint16_t idx; + uint16_t idx =0; F1SetupResponse_t *f1SetRspMsg = NULLP; GNB_CU_Name_t *cuName = NULLP; - RRC_Version_t *rrc_Ver = NULLP; F1SetupRsp f1SetRspDb; + RRC_Version_t *rrcVer =NULLP; + memset(&f1SetRspDb, 0, sizeof(F1SetupRsp)); DU_LOG("\nF1AP : F1 Setup Response received"); @@ -8391,10 +10486,9 @@ uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg) } case ProtocolIE_ID_id_GNB_CU_RRC_Version: { - rrc_Ver = &f1SetRspMsg->protocolIEs.list.array[idx]->\ - value.choice.RRC_Version; + rrcVer = &f1SetRspMsg->protocolIEs.list.array[idx]->value.choice.RRC_Version; strcpy(f1SetRspDb.rrcVersion.rrcVer, - (const char*)rrc_Ver->latest_RRC_Version.buf); + (const char*)rrcVer->latest_RRC_Version.buf); break; } default: @@ -8403,24 +10497,57 @@ uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg) } duProcF1SetupRsp(); } + + freeAperDecodeF1SetupRsp(f1SetRspMsg); return ret; } +/******************************************************************* +* +* @brief free GNB DU config update ack +* +* @details +* +* Function : freeAperDecodeGnbDuAck +* +* Functionality: Processes GNB DU config update ack And +* added free part for the memory allocated by aper_decoder +* +* @params[in] F1AP_PDU_t ASN decoded F1AP message +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck) +{ + uint8_t ieIdx = 0; + if(gnbDuAck->protocolIEs.list.array) + { + for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++) + { + if(gnbDuAck->protocolIEs.list.array[ieIdx]) + { + free(gnbDuAck->protocolIEs.list.array[ieIdx]); + } + } + free(gnbDuAck->protocolIEs.list.array); + } +} /******************************************************************* - * - * @brief Processes GNB DU config update ack - * - * @details - * - * Function : procF1GNBDUCfgUpdAck - * - * Functionality: Processes GNB DU config update ack - * - * @params[in] F1AP_PDU_t ASN decoded F1AP message - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ +* +* @brief Processes GNB DU config update ack +* +* @details +* +* Function : procF1GNBDUCfgUpdAck +* +* Functionality: added free part for the memory allocated by aper_decoder +* +* @params[in] F1AP_PDU_t *f1apMsg +* @return void +* +* ****************************************************************/ uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg) { uint8_t ieIdx, transId; @@ -8452,9 +10579,62 @@ uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg) return RFAILED; } #endif + + freeAperDecodeGnbDuAck(gnbDuAck); return ROK; } +/****************************************************************** +* +* @brief free DL RRC Message Transfer allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodef1DlRrcMsg +* +* Functionality: free DL RRC Message Transfer allocated by aper_decoder +* +* @params[in] DLRRCMessageTransfer_t *f1DlRrcMsg +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +void freeAperDecodef1DlRrcMsg(DLRRCMessageTransfer_t *f1DlRrcMsg) +{ + uint8_t ieIdx =0; + RRCContainer_t *rrcContainer = NULLP; + if(f1DlRrcMsg->protocolIEs.list.array) + { + for(ieIdx=0; ieIdxprotocolIEs.list.count; ieIdx++) + { + if(f1DlRrcMsg->protocolIEs.list.array[ieIdx]) + { + switch(f1DlRrcMsg->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_SRBID: + break; + case ProtocolIE_ID_id_RRCContainer: + { + rrcContainer =&f1DlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer; + free(rrcContainer->buf); + } + case ProtocolIE_ID_id_ExecuteDuplication: + break; + case ProtocolIE_ID_id_RRCDeliveryStatusRequest: + break; + break; + } + free(f1DlRrcMsg->protocolIEs.list.array[ieIdx]); + } + } + free(f1DlRrcMsg->protocolIEs.list.array); + } +} /****************************************************************** * * @brief Processes DL RRC Message Transfer sent by CU @@ -8542,6 +10722,8 @@ uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg) } ret = duProcDlRrcMsg(&dlMsg); + + freeAperDecodef1DlRrcMsg(f1DlRrcMsg); return ret; } @@ -8564,14 +10746,13 @@ uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg) * ****************************************************************/ void F1APMsgHdlr(Buffer *mBuf) { - int i; - char *recvBuf; - MsgLen copyCnt; - MsgLen recvBufLen; - F1AP_PDU_t *f1apMsg; + int i =0; + char *recvBuf =NULLP; + MsgLen copyCnt =0; + MsgLen recvBufLen =0; + F1AP_PDU_t *f1apMsg =NULLP; asn_dec_rval_t rval; /* Decoder return value */ F1AP_PDU_t f1apasnmsg ; - DU_LOG("\nF1AP : Received F1AP message buffer"); ODU_PRINT_MSG(mBuf, 0,0); @@ -8642,6 +10823,7 @@ void F1APMsgHdlr(Buffer *mBuf) return; } }/* End of switch(successfulOutcome) */ + free(f1apMsg->choice.successfulOutcome); break; } case F1AP_PDU_PR_initiatingMessage: @@ -8672,6 +10854,7 @@ void F1APMsgHdlr(Buffer *mBuf) return; } }/* End of switch(initiatingMessage) */ + free(f1apMsg->choice.initiatingMessage); break; } @@ -8680,6 +10863,7 @@ void F1APMsgHdlr(Buffer *mBuf) DU_LOG("\nF1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present); return; } + free(f1apMsg); }/* End of switch(f1apMsg->present) */