+*
+* @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; arrIdx<timeDomAllocList_t->choice.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; arrIdx<rlcBearerList->list.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;arrIdx<schReqList->list.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; arrIdx<tagList->list.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("\nERROR --> DUAPP: 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("\nERROR --> 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("\nERROR --> 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("ERROR --> 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("\nERROR --> 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("\nERROR --> DUAPP: 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("\nERROR --> DU APP : 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)