X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_f1ap_msg_hdl.c;h=37a0aef4f8a5ee54194c4511f53c7f427cc0e82a;hb=d62d6a2c96903363a6d7a2f1b23658bfef3590c9;hp=4c2911e3f024b27a8f461ab17c0c508648b24cf3;hpb=37f19c79962b15d20faa1c8eada1dea28bc5e2a4;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 4c2911e3f..37a0aef4f 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -103,12 +103,55 @@ #include "GTPTunnel.h" #ifdef O1_ENABLE -#include "ConfigInterface.h" +#include "CmInterface.h" extern StartupConfig g_cfg; #endif DuCfgParams duCfgParam; +/****************************************************************** + * + * @brief Function to fetch lcId based on DRB Id + * + * @details + * + * Function : fetchLcId + * + * @params[in] drbId + * + * Functionality: Function to fetch lcId based on DRB Id + * + * Returns: lcId - SUCCESS + * RFAILED - FAILURE + *****************************************************************/ + +uint8_t fetchLcId(uint8_t drbId) +{ + uint8_t cellIdx = 0, ueIdx = 0, lcIdx = 0, numLcs = 0, lcId = 0; + + for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++) + { + for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) + { + if(duCb.actvCellLst[cellIdx] != NULLP) + { + numLcs = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.numLcs; + for(lcIdx = 0; lcIdx < numLcs; lcIdx++) + { + if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbId == drbId && \ + duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbType == RB_TYPE_DRB) + { + lcId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].lcId; + return lcId; + } + } + } + } + } + DU_LOG("\nERROR --> DU_APP: fetchLcId() failed for drbId %d", drbId); + return RFAILED; +} + /************************************************************************ * * @brief Converts enum values into actual value of Poll retransmit timer @@ -804,7 +847,7 @@ uint8_t BuildDLNRInfo(NRFreqInfo_t *dlnrfreq) S16 BuildNrCellId(BIT_STRING_t *nrcell) { memset(nrcell->buf, 0, nrcell->size); - nrcell->buf[4] = 16; + nrcell->buf[4] = duCfgParam.sib1Params.cellIdentity; nrcell->bits_unused = 4; return ROK; } @@ -956,95 +999,107 @@ uint8_t BuildNrMode(NR_Mode_Info_t *mode) * ****************************************************************/ uint8_t BuildExtensions(ProtocolExtensionContainer_4624P3_t **ieExtend) { - uint8_t idx; - uint8_t plmnidx; - uint8_t extensionCnt=1; - uint8_t sliceId=0; - uint8_t sdId; + uint8_t idx=0, plmnidx=0, sliceLstIdx=0; + uint8_t elementCnt=0, extensionCnt=0; + + extensionCnt=IE_EXTENSION_LIST_COUNT; DU_ALLOC(*ieExtend,sizeof(ProtocolExtensionContainer_4624P3_t)); if((*ieExtend) == NULLP) { + DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed"); return RFAILED; } (*ieExtend)->list.count = extensionCnt; (*ieExtend)->list.size = \ - extensionCnt * sizeof(ServedPLMNs_ItemExtIEs_t *); + extensionCnt * sizeof(ServedPLMNs_ItemExtIEs_t *); DU_ALLOC((*ieExtend)->list.array,(*ieExtend)->list.size); if((*ieExtend)->list.array == NULLP) { + DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed"); return RFAILED; } for(plmnidx=0;plmnidxlist.array[plmnidx],\ - sizeof(ServedPLMNs_ItemExtIEs_t)); + sizeof(ServedPLMNs_ItemExtIEs_t)); if((*ieExtend)->list.array[plmnidx] == NULLP) { - return RFAILED; + DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed"); + return RFAILED; } } + + elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices; idx = 0; (*ieExtend)->list.array[idx]->id = ProtocolIE_ID_id_TAISliceSupportList; (*ieExtend)->list.array[idx]->criticality = Criticality_ignore; (*ieExtend)->list.array[idx]->extensionValue.present = \ - ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList; - (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.count = 1; - (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.size = sizeof(SliceSupportItem_t *); - DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array,sizeof(SliceSupportItem_t *)); - if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array == NULLP) - { - return RFAILED; - } - DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId],sizeof(SliceSupportItem_t)); - if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId] == NULLP) - { - return RFAILED; - } + ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList; (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sST.size = sizeof(uint8_t); - DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\ - .list.array[sliceId]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\ - extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sST.size); - if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\ - .list.array[sliceId]->sNSSAI.sST.buf == NULLP) - { - return RFAILED; - } + list.count = elementCnt; (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sST.buf[0] = 3; + list.size = (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.count * sizeof(SliceSupportItem_t *); + DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + list.array, elementCnt * sizeof(SliceSupportItem_t *)); if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sD == NULLP) + list.array == NULLP) { + DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed"); return RFAILED; } - (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sD->size = 3*sizeof(uint8_t); - DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sD->buf,(*ieExtend)->list.array[idx]->extensionValue.choice.\ - SliceSupportList.list.array[sliceId]->sNSSAI.sD->size); - if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sD->buf == NULLP) + + for(sliceLstIdx =0; sliceLstIdxlist.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx],sizeof(SliceSupportItem_t)); + if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx] == NULLP) + { + DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed"); + return RFAILED; + } + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t); + DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\ + .list.array[sliceLstIdx]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\ + extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sST.size); + if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\ + .list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP) + { + DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed"); + return RFAILED; + } + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sST.buf[0] = duCfgParam.srvdCellLst[0].duCellInfo.\ + cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sst; + + DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD == NULLP) + { + DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed"); + return RFAILED; + } + (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t); + DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->buf, (*ieExtend)->list.array[idx]->extensionValue.choice.\ + SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size); + if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP) + { + DU_LOG("ERROR --> DU_APP : BuildExtensions(): Memory allocation failed"); + return RFAILED; + } + memcpy((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[0].duCellInfo.\ + cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sd, (*ieExtend)->list.array[idx]->\ + extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size); } - sdId = 0; - (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sD->buf[sdId] = 3; - sdId++; - (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sD->buf[sdId] = 6; - sdId++; - (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sD->buf[sdId] = 9; return ROK; } /******************************************************************* @@ -1406,10 +1461,9 @@ void FreeRrcVer(RRC_Version_t *rrcVer) * ****************************************************************/ void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell) { - uint8_t plmnCnt=1; - uint8_t sliceId=0; - uint8_t extensionCnt=1; - uint8_t plmnIdx=0; + uint8_t plmnCnt=MAX_PLMN; + uint8_t extensionCnt=IE_EXTENSION_LIST_COUNT; + uint8_t plmnIdx=0, sliceIdx=0; GNB_DU_Served_Cells_Item_t *srvCellItem; ServedPLMNs_Item_t *servedPlmnItem; SliceSupportItem_t *sliceSupportItem; @@ -1437,7 +1491,7 @@ void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell) if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx] != NULLP) { servedPlmnItem = srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx]; - DU_FREE(servedPlmnItem->pLMN_Identity.buf, servedPlmnItem->pLMN_Identity.size * sizeof(uint8_t)); + DU_FREE(servedPlmnItem->pLMN_Identity.buf, servedPlmnItem->pLMN_Identity.size); if(servedPlmnItem->iE_Extensions != NULLP) { @@ -1445,38 +1499,48 @@ void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell) { if(servedPlmnItem->iE_Extensions->list.array[0] != NULLP) { - if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.list.\ - array != NULLP) + if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\ + SliceSupportList.list.array != NULLP) { - if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.list.\ - array[sliceId] != NULLP) + for(sliceIdx =0; sliceIdxiE_Extensions->list.array[0]->\ + extensionValue.choice.SliceSupportList.list.count; sliceIdx++) { - sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\ - SliceSupportList.list.array[sliceId]; + if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\ + SliceSupportList.list.array[sliceIdx] != NULLP) + { + sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[0]->\ + extensionValue.choice.SliceSupportList.list.array[sliceIdx]; - DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sizeof(uint8_t)); + DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sizeof(uint8_t)); - if(sliceSupportItem->sNSSAI.sD != NULLP) - { - DU_FREE(sliceSupportItem->sNSSAI.sD->buf, sliceSupportItem->sNSSAI.sD->size); - DU_FREE(sliceSupportItem->sNSSAI.sD, sizeof(OCTET_STRING_t)); - } + if(sliceSupportItem->sNSSAI.sD != NULLP) + { + DU_FREE(sliceSupportItem->sNSSAI.sD->buf,\ + sliceSupportItem->sNSSAI.sD->size); + DU_FREE(sliceSupportItem->sNSSAI.sD, sizeof(OCTET_STRING_t)); + } - DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId], sizeof(SliceSupportItem_t)); + DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.\ + choice.SliceSupportList.list.array[sliceIdx], sizeof(SliceSupportItem_t)); + } } - DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array, sizeof(SliceSupportItem_t*)); + DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\ + SliceSupportList.list.array, servedPlmnItem->iE_Extensions->list.array[0]->\ + extensionValue.choice.SliceSupportList.list.size); } - DU_FREE(servedPlmnItem->iE_Extensions->list.array[0], sizeof(ServedPLMNs_ItemExtIEs_t)); + DU_FREE(servedPlmnItem->iE_Extensions->list.array[0],\ + sizeof(ServedPLMNs_ItemExtIEs_t)); } - DU_FREE(servedPlmnItem->iE_Extensions->list.array, extensionCnt*sizeof(ServedPLMNs_ItemExtIEs_t*)); + DU_FREE(servedPlmnItem->iE_Extensions->list.array,\ + extensionCnt*sizeof(ServedPLMNs_ItemExtIEs_t*)); } DU_FREE(servedPlmnItem->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P3_t)); } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx], sizeof(ServedPLMNs_Item_t)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx],\ + sizeof(ServedPLMNs_Item_t)); } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array, sizeof(ServedPLMNs_Item_t *)); + DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\ + sizeof(ServedPLMNs_Item_t *)); } if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD != NULLP) @@ -1484,10 +1548,10 @@ void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell) if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.\ freqBandListNr.list.array != NULLP) { - DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.freqBandListNr.\ - list.array[0],sizeof(FreqBandNrItem_t)); - DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.freqBandListNr.\ - list.array,sizeof(FreqBandNrItem_t*)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.array[0],sizeof(FreqBandNrItem_t)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->\ + uL_NRFreqInfo.freqBandListNr.list.array,sizeof(FreqBandNrItem_t*)); } if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ @@ -1796,7 +1860,7 @@ uint8_t BuildAndSendF1SetupReq() void freeCellsToModifyItem(Served_Cells_To_Modify_Item_t *modifyItem) { - uint8_t arrIdx=0,i=0; + uint8_t arrIdx=0, servedPlmnIdx=0, sliceLstIdx=0; ServedPLMNs_Item_t *servedPlmnItem = NULLP; SliceSupportItem_t *sliceSupportItem = NULLP; @@ -1822,41 +1886,50 @@ void freeCellsToModifyItem(Served_Cells_To_Modify_Item_t *modifyItem) { if(servedPlmnItem->iE_Extensions->list.array[arrIdx] != NULLP) { - if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.list.array != NULLP) + if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\ + list.array != NULLP) { - if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.list.array[arrIdx] != NULLP) + for(sliceLstIdx =0; sliceLstIdxiE_Extensions->list.array[arrIdx]->\ + extensionValue.choice.SliceSupportList.list.count; sliceLstIdx++) { - sliceSupportItem = modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->iE_Extensions->\ - list.array[arrIdx]->extensionValue.choice.SliceSupportList.list.array[arrIdx]; - - DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sliceSupportItem->sNSSAI.sST.size); - if(sliceSupportItem->sNSSAI.sD != NULLP) + if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx] != NULLP) { - DU_FREE(sliceSupportItem->sNSSAI.sD->buf, sliceSupportItem->sNSSAI.sD->size); - DU_FREE(sliceSupportItem->sNSSAI.sD,sizeof(OCTET_STRING_t)); + + sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\ + SliceSupportList.list.array[sliceLstIdx]; + + DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sliceSupportItem->sNSSAI.sST.size); + if(sliceSupportItem->sNSSAI.sD != NULLP) + { + DU_FREE(sliceSupportItem->sNSSAI.sD->buf, sliceSupportItem->sNSSAI.sD->size); + DU_FREE(sliceSupportItem->sNSSAI.sD,sizeof(OCTET_STRING_t)); + } + DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\ + SliceSupportList.list.array[sliceLstIdx], sizeof(SliceSupportItem_t)); } - DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\ - list.array[arrIdx], sizeof(SliceSupportItem_t)); } - DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.list.array, - servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.list.size); + DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.\ + choice.SliceSupportList.list.array,\ + servedPlmnItem->iE_Extensions->list.array[arrIdx]->\ + extensionValue.choice.SliceSupportList.list.size); } } - for(i=0; i < servedPlmnItem->iE_Extensions->list.count ; i++) + for(servedPlmnIdx=0; servedPlmnIdx< servedPlmnItem->iE_Extensions->list.count ; servedPlmnIdx++) { - DU_FREE(servedPlmnItem->iE_Extensions->list.array[i], sizeof(ServedPLMNs_ItemExtIEs_t )); + DU_FREE(servedPlmnItem->iE_Extensions->list.array[servedPlmnIdx], sizeof(ServedPLMNs_ItemExtIEs_t )); } DU_FREE(servedPlmnItem->iE_Extensions->list.array, servedPlmnItem->iE_Extensions->list.size); } DU_FREE(servedPlmnItem->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t)); } } - for(i=0;iserved_Cell_Information.servedPLMNs.list.count;i++) + for(servedPlmnIdx=0; servedPlmnIdxserved_Cell_Information.servedPLMNs.list.count; servedPlmnIdx++) { - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[i], sizeof(ServedPLMNs_Item_t)); + DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[servedPlmnIdx], sizeof(ServedPLMNs_Item_t)); } DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ - modifyItem->served_Cell_Information.servedPLMNs.list.size); + modifyItem->served_Cell_Information.servedPLMNs.list.size); } if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD != NULLP) @@ -2006,119 +2079,135 @@ void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg) uint8_t fillServedPlmns(ServedPLMNs_List_t *servedPlmn) { - uint8_t ieIdx, ieListCnt; + uint8_t ieIdx=0, arrayIdx=0, ieListCnt=0, elementCnt=0, sliceLstIdx=0; - servedPlmn->list.array[0]->pLMN_Identity.size = 3*sizeof(uint8_t); - DU_ALLOC(servedPlmn->list.array[0]->pLMN_Identity.buf, servedPlmn->list.\ - array[0]->pLMN_Identity.size); - if(servedPlmn->list.array[0]->pLMN_Identity.buf == NULLP) + servedPlmn->list.array[arrayIdx]->pLMN_Identity.size = 3*sizeof(uint8_t); + DU_ALLOC(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf, servedPlmn->list.\ + array[arrayIdx]->pLMN_Identity.size); + if(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf == NULLP) { + DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed"); return RFAILED; } - buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.plmn[0],\ - servedPlmn->list.array[0]->pLMN_Identity.buf); - DU_ALLOC(servedPlmn->list.array[0]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t)); - if(servedPlmn->list.array[0]->iE_Extensions == NULLP) + buildPlmnId(duCfgParam.srvdCellLst[arrayIdx].duCellInfo.cellInfo.srvdPlmn[arrayIdx].plmn,\ + servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf); + DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t)); + if(servedPlmn->list.array[arrayIdx]->iE_Extensions == NULLP) { + DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed"); return RFAILED; } ieListCnt=1; - servedPlmn->list.array[0]->iE_Extensions->list.count = ieListCnt; - servedPlmn->list.array[0]->iE_Extensions->list.size = ieListCnt *sizeof(ServedPLMNs_ItemExtIEs_t *); - DU_ALLOC(servedPlmn->list.array[0]->iE_Extensions->list.array,servedPlmn->list.array[0]->\ - iE_Extensions->list.size); - if(servedPlmn->list.array[0]->iE_Extensions->list.array == NULLP) + servedPlmn->list.array[arrayIdx]->iE_Extensions->list.count = ieListCnt; + servedPlmn->list.array[arrayIdx]->iE_Extensions->list.size = ieListCnt *sizeof(ServedPLMNs_ItemExtIEs_t *); + DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array,servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.size); + if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array == NULLP) { + DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed"); return RFAILED; } - for(ieIdx=0;ieIdxlist.array[0]->iE_Extensions->list.array[ieIdx],\ - sizeof(ServedPLMNs_ItemExtIEs_t)); - if(servedPlmn->list.array[0]->iE_Extensions->list.array[ieIdx] == NULLP) + DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx],\ + sizeof(ServedPLMNs_ItemExtIEs_t)); + if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx] == NULLP) { - return RFAILED; + DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed"); + return RFAILED; + } + } + + ieIdx = 0; + elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices; + servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->id =ProtocolIE_ID_id_TAISliceSupportList; + servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->criticality = Criticality_ignore; + servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.present = \ + ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList; + servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.count = elementCnt; + servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.size = elementCnt * sizeof(SliceSupportItem_t *); + DU_ALLOC(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array,servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.size); + if(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array == NULLP) + { + DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed"); + return RFAILED; + } + + for(sliceLstIdx =0; sliceLstIdx< elementCnt; sliceLstIdx++) + { + DU_ALLOC(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx],sizeof( SliceSupportItem_t)); + if(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx] == NULLP) + { + DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed"); + return RFAILED; + } + + servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t); + DU_ALLOC(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sST.buf,servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->\ + sNSSAI.sST.size); + + if(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP) + { + DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed"); + return RFAILED; } + servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sST.buf[arrayIdx] = duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\ + cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sst; + + DU_ALLOC(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t)); + if(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD == NULLP) + { + DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed"); + return RFAILED; + } + servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t); + DU_ALLOC(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->buf,servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->size); + if(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP) + { + DU_LOG("ERROR --> DU_APP : fillServedPlmns(): Memory allocation failed"); + return RFAILED; + } + memcpy(servedPlmn->list.array[arrayIdx]->\ + iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\ + cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sd,\ + servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx]->sNSSAI.sD->size); } - //plmnIeExt = servedPlmn->list.array[0]->iE_Extensions; - servedPlmn->list.array[0]->iE_Extensions->list.array[0]->id =ProtocolIE_ID_id_TAISliceSupportList; - servedPlmn->list.array[0]->iE_Extensions->list.array[0]->criticality = Criticality_ignore; - servedPlmn->list.array[0]->iE_Extensions->list.array[0]->extensionValue.present = \ - ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList; - servedPlmn->list.array[0]->iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.count = 1; - servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.size = sizeof(SliceSupportItem_t *); - DU_ALLOC(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array,servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.list.size); - if(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array == NULLP) - { - return RFAILED; - } - - DU_ALLOC(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0],sizeof( SliceSupportItem_t)); - if(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0] == NULLP) - { - return RFAILED; - } - servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sST.size = sizeof(uint8_t); - DU_ALLOC(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sST.buf,servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.list.array[0]->sNSSAI.sST.size); - if(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sST.buf == NULLP) - { - return RFAILED; - } - servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sST.buf[0] = 3; - DU_ALLOC(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t)); - if(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sD == NULLP) - { - return RFAILED; - } - servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sD->size = 3*sizeof(uint8_t); - DU_ALLOC(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sD->buf,servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sD->size); - if(servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sD->buf == NULLP) - { - return RFAILED; - } - servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sD->buf[0] = 3; - servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sD->buf[1] = 6; - servedPlmn->list.array[0]->\ - iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\ - list.array[0]->sNSSAI.sD->buf[2] = 9; return ROK; } @@ -2238,7 +2327,7 @@ uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo) { srvCellInfo->nRCGI.nRCellIdentity.buf[tmp] = 0; } - srvCellInfo->nRCGI.nRCellIdentity.buf[4] = 16; + srvCellInfo->nRCGI.nRCellIdentity.buf[4] = duCfgParam.sib1Params.cellIdentity; srvCellInfo->nRCGI.nRCellIdentity.bits_unused =4; /*nRPCI*/ @@ -2336,7 +2425,7 @@ uint8_t fillServCellToModItem(Served_Cells_To_Modify_Item_t *modifyItem) { modifyItem->oldNRCGI.nRCellIdentity.buf[ieIdx] = 0; } - modifyItem->oldNRCGI.nRCellIdentity.buf[4] = 16; + modifyItem->oldNRCGI.nRCellIdentity.buf[4] = duCfgParam.sib1Params.cellIdentity; modifyItem->oldNRCGI.nRCellIdentity.bits_unused = 4; if(fillServedCellInfo(&modifyItem->served_Cell_Information)) @@ -2445,7 +2534,7 @@ uint8_t fillCellToDeleteItem(struct Served_Cells_To_Delete_ItemIEs *deleteItemIe { deleteItem->oldNRCGI.nRCellIdentity.buf[arrIdx] = 0; } - deleteItem->oldNRCGI.nRCellIdentity.buf[4] = 16; + deleteItem->oldNRCGI.nRCellIdentity.buf[4] = duCfgParam.sib1Params.cellIdentity; deleteItem->oldNRCGI.nRCellIdentity.bits_unused = 4; return ROK; } @@ -3366,7 +3455,7 @@ uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddMod coreset1StartPrb = coreset0EndPrb + 6; coreset1NumPrb = CORESET1_NUM_PRB; /* calculate the PRBs */ - freqDomRscAllocType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource); + fillCoresetFeqDomAllocMap(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource); memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE); controlRSet->frequencyDomainResources.bits_unused = bitsUnused; @@ -4110,7 +4199,7 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp) return RFAILED; } - elementCnt = 1; + elementCnt = 2; timeDomAllocList->choice.setup->list.count = elementCnt; timeDomAllocList->choice.setup->list.size = \ elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *); @@ -4143,9 +4232,22 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp) DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList"); return RFAILED; } - *(timeDomAlloc->k2) = PUSCH_K2; + *(timeDomAlloc->k2) = PUSCH_K2_CFG1; timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A; timeDomAlloc->startSymbolAndLength = calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL); + + idx++; + timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx]; + DU_ALLOC(timeDomAlloc->k2, sizeof(long)); + if(!timeDomAlloc->k2) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschTimeDomAllocList"); + return RFAILED; + } + *(timeDomAlloc->k2) = PUSCH_K2_CFG2; + timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A; + timeDomAlloc->startSymbolAndLength = calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL); + return ROK; } @@ -4253,7 +4355,124 @@ uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg) uint8_t BuildBWPUlDedPucchCfg(PUCCH_Config_t *pucchCfg) { uint8_t arrIdx, elementCnt; + uint8_t rsrcIdx, rsrcSetIdx; + PUCCH_ResourceSet_t *rsrcSet = NULLP; + PUCCH_Resource_t *rsrc = NULLP; + + //RESOURCE SET + elementCnt = 1; + DU_ALLOC(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList)); + if(pucchCfg->resourceSetToAddModList == NULL) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + + pucchCfg->resourceSetToAddModList->list.count = elementCnt; + pucchCfg->resourceSetToAddModList->list.size = elementCnt * sizeof(PUCCH_ResourceSet_t *); + DU_ALLOC(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size); + if(pucchCfg->resourceSetToAddModList->list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++) + { + DU_ALLOC(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t)); + if(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + } + rsrcSetIdx = 0; + rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx]; + rsrcSet->pucch_ResourceSetId = 1; + elementCnt = 1; + rsrcSet->resourceList.list.count = elementCnt; + rsrcSet->resourceList.list.size = elementCnt * sizeof(PUCCH_ResourceId_t *); + DU_ALLOC(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size); + if(rsrcSet->resourceList.list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++) + { + DU_ALLOC(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t)); + if(rsrcSet->resourceList.list.array[rsrcIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + } + rsrcIdx = 0; + *(rsrcSet->resourceList.list.array[rsrcIdx]) = 1; + + //RESOURCE + elementCnt = 1; + DU_ALLOC(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList)); + if(pucchCfg->resourceToAddModList == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + pucchCfg->resourceToAddModList->list.count = elementCnt; + pucchCfg->resourceToAddModList->list.size = elementCnt * sizeof(PUCCH_Resource_t *); + DU_ALLOC(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size); + if(pucchCfg->resourceToAddModList->list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++) + { + DU_ALLOC(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t)); + if(pucchCfg->resourceToAddModList->list.array[rsrcIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + } + rsrcIdx = 0; + rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx]; + rsrc->pucch_ResourceId = 1; + rsrc->startingPRB = 0; + rsrc->format.present = PUCCH_Resource__format_PR_format1; + DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t)); + if(rsrc->format.choice.format1 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + rsrc->format.choice.format1->initialCyclicShift = 0; + rsrc->format.choice.format1->nrofSymbols = 4; + rsrc->format.choice.format1->startingSymbolIndex = 0; + rsrc->format.choice.format1->timeDomainOCC = 0; + + //PUCCH Format 1 + DU_ALLOC(pucchCfg->format1, sizeof(struct PUCCH_Config__format1)); + if(pucchCfg->format1 == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + pucchCfg->format1->present = PUCCH_Config__format1_PR_setup; + DU_ALLOC(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t)); + if(pucchCfg->format1->choice.setup == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + DU_ALLOC(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long)); + if(pucchCfg->format1->choice.setup->nrofSlots == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + *(pucchCfg->format1->choice.setup->nrofSlots) = PUCCH_FormatConfig__nrofSlots_n4; + //DL DATA TO UL ACK DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK)); if(pucchCfg->dl_DataToUL_ACK == NULLP) { @@ -5227,8 +5446,7 @@ void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationL * ****************************************************************/ void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg) { - uint8_t idx1=0; - uint8_t idx2=0; + uint8_t rsrcListIdx=0; struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP; if(puschCfg->pusch_TimeDomainAllocationList) @@ -5236,26 +5454,125 @@ void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg) timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList; if(timeDomAllocList_t->choice.setup) { - if(timeDomAllocList_t->choice.setup->list.array) - { - DU_FREE(timeDomAllocList_t->choice.setup->list.array[idx2]->k2, sizeof(long)); - for(idx1 = 0; idx1choice.setup->list.count; idx1++) - { - DU_FREE(timeDomAllocList_t->choice.setup->list.array[idx1],\ - sizeof(PUSCH_TimeDomainResourceAllocation_t)); - } - DU_FREE(timeDomAllocList_t->choice.setup->list.array, \ - timeDomAllocList_t->choice.setup->list.size); - } - DU_FREE(timeDomAllocList_t->choice.setup, \ - sizeof(struct PUSCH_TimeDomainResourceAllocationList)); + if(timeDomAllocList_t->choice.setup->list.array) + { + for(rsrcListIdx = 0; rsrcListIdxchoice.setup->list.count; rsrcListIdx++) + { + DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx]->k2, sizeof(long)); + DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx],\ + sizeof(PUSCH_TimeDomainResourceAllocation_t)); + } + DU_FREE(timeDomAllocList_t->choice.setup->list.array, \ + timeDomAllocList_t->choice.setup->list.size); + } + DU_FREE(timeDomAllocList_t->choice.setup, \ + sizeof(struct PUSCH_TimeDomainResourceAllocationList)); } DU_FREE(puschCfg->transformPrecoder, sizeof(long)); DU_FREE(puschCfg->pusch_TimeDomainAllocationList, \ - sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList)); + sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList)); } } + +/******************************************************************* + * + * @brief Frees memory allocated for Dedicated PUCCH config + * + * @details + * + * Function : FreeBWPUlDedPucchCfg + * + * Functionality: Deallocating memory of Dedicated PUCCH cfg + * + * @params[in] BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg + * + * @return void + * + * ****************************************************************/ +void FreeBWPUlDedPucchCfg(struct BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg) +{ + uint8_t k1Idx, rsrcIdx, rsrcSetIdx; + PUCCH_Config_t *pucchCfg = NULLP; + PUCCH_ResourceSet_t *rsrcSet = NULLP; + PUCCH_Resource_t *rsrc = NULLP; + + if(ulBwpPucchCfg) + { + if(ulBwpPucchCfg->choice.setup) + { + pucchCfg = ulBwpPucchCfg->choice.setup; + + //Free resource set list + if(pucchCfg->resourceSetToAddModList) + { + if(pucchCfg->resourceSetToAddModList->list.array) + { + for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++) + { + rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx]; + if(rsrcSet->resourceList.list.array) + { + for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++) + { + DU_FREE(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t)); + } + DU_FREE(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size); + } + DU_FREE(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t)); + } + DU_FREE(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size); + } + DU_FREE(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList)); + } + + //Free resource list + if(pucchCfg->resourceToAddModList) + { + if(pucchCfg->resourceToAddModList->list.array) + { + for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++) + { + rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx]; + DU_FREE(rsrc->format.choice.format1, sizeof(PUCCH_format1_t)); + DU_FREE(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t)); + } + DU_FREE(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size); + } + DU_FREE(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList)); + } + + //PUCCH Format 1 + if(pucchCfg->format1) + { + if(pucchCfg->format1->choice.setup) + { + DU_FREE(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long)); + DU_FREE(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t)); + } + DU_FREE(pucchCfg->format1, sizeof(struct PUCCH_Config__format1)); + } + + //DL DATA TO UL ACK + if(pucchCfg->dl_DataToUL_ACK) + { + if(pucchCfg->dl_DataToUL_ACK->list.array) + { + for(k1Idx = 0; k1Idx < pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++) + { + DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long)); + } + DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size); + } + DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK)); + } + + DU_FREE(ulBwpPucchCfg->choice.setup, sizeof(PUCCH_Config_t)); + } + DU_FREE(ulBwpPucchCfg, sizeof(struct BWP_UplinkDedicated__pucch_Config)); + } +} + /******************************************************************* * * @brief Frees memory allocated for InitialUlBWP @@ -5273,36 +5590,15 @@ void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg) * ****************************************************************/ void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp) { - uint8_t rSetIdx, rsrcIdx, k1Idx; + uint8_t rSetIdx, rsrcIdx; SRS_Config_t *srsCfg = NULLP; PUSCH_Config_t *puschCfg = NULLP; - PUCCH_Config_t *pucchCfg = 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->pucch_Config) - { - if(ulBwp->pucch_Config->choice.setup) - { - pucchCfg = ulBwp->pucch_Config->choice.setup; - if(pucchCfg->dl_DataToUL_ACK) - { - if(pucchCfg->dl_DataToUL_ACK->list.array) - { - for(k1Idx = 0; k1Idx < pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++) - { - DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long)); - } - DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size); - } - DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK)); - } - DU_FREE(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t)); - } - DU_FREE(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config)); - } + FreeBWPUlDedPucchCfg(ulBwp->pucch_Config); if(ulBwp->pusch_Config) { @@ -6272,6 +6568,7 @@ void freeRlcLcCfg(RlcBearerCfg *lcCfg) DU_LOG("\nERROR --> DU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode); break; } + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai)); } /******************************************************************* @@ -7316,25 +7613,68 @@ void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg) } /******************************************************************* - * - * @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) -{ - +* +* @brief Function to extract Snssai Cfg Info from CU +* +* @details +* +* Function : extractDrbSnssaiCfg +* +* Functionality: Function to extract Drb Snssai Cfg Info from CU +* +* @params[in] DRB_Information_t *drbInfo, Snssai *snssai +* @return ROK/RFAILED +* +* ****************************************************************/ + +uint8_t extractDrbSnssaiCfg(SNSSAI_t *RecvSnssai, Snssai **snssaiToBeShared) +{ + if(!(*snssaiToBeShared)) + { + DU_ALLOC_SHRABL_BUF((*snssaiToBeShared), sizeof(Snssai)); + if(snssaiToBeShared == NULLP) + { + DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Memory failed at allocating for SNSSAI "); + return RFAILED; + } + } + if(RecvSnssai) + { + memcpy(&(*snssaiToBeShared)->sst, RecvSnssai->sST.buf, RecvSnssai->sST.size); + if(RecvSnssai->sD) + { + memcpy((*snssaiToBeShared)->sd, RecvSnssai->sD->buf, RecvSnssai->sD->size); + } + else + { + DU_LOG("\nERROR --> DUAPP : extractDrbSnssaiCfg(): Received Null pointer of Snssai->SD"); + return RFAILED; + } + } + return ROK; +} + +/******************************************************************* + * + * @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, QoSInformation_t *qoSInformation) +{ + DRB_Information_t *drbInfo; + lcCfg->rbId = rbId; lcCfg->configType = configType; @@ -7356,10 +7696,24 @@ void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\ { extractRlcModeCfg(lcCfg->rlcMode, lcCfg, f1RlcCfg); } + if(qoSInformation != NULLP) + { + if(qoSInformation->present == QoSInformation_PR_choice_extension) + { + if(qoSInformation->choice.choice_extension->value.present ==\ + QoSInformation_ExtIEs__value_PR_DRB_Information) + { + drbInfo = &qoSInformation->choice.choice_extension->value.choice.DRB_Information; + if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &lcCfg->snssai) != ROK) + { + DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at procRlcLcCfg()"); + return RFAILED; + } + } + } + } } - - /******************************************************************* * * @brief Fills DrbQos Info received by CU @@ -7378,43 +7732,59 @@ void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\ void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg) { + uint8_t qosCntIdx = 0; + ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP; + qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present; qosToAdd->u.nonDyn5Qi.fiveQi =\ - qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->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); + *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); } qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \ - *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); + *(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); + *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel); } qosToAdd->ngRanRetPri.priorityLevel = \ - qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; + qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; qosToAdd->ngRanRetPri.preEmptionCap = \ - qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability; + qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability; qosToAdd->ngRanRetPri.preEmptionVul = \ - qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability; + 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); + 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); + 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); + 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); + qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \ + qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size); + } + /*Extracting PDU_SESSION_ID*/ + qosIeExt = (ProtocolExtensionContainer_4624P74_t *)qosFlowCfg->iE_Extensions; + if(qosIeExt) + { + for(qosCntIdx = 0; qosCntIdx < qosIeExt->list.count; qosCntIdx++) + { + if(qosIeExt->list.array[qosCntIdx]->extensionValue.present == \ + QoSFlowLevelQoSParameters_ExtIEs__extensionValue_PR_PDUSessionID) + { + qosToAdd->pduSessionId = qosIeExt->list.array[qosCntIdx]->extensionValue.choice.PDUSessionID; + DU_LOG("\nDEBUG --> DU_F1AP : extractQosInfo: PDU SessionID:%d",qosToAdd->pduSessionId); + } + } } - qosToAdd->pduSessionId = 0; qosToAdd->ulPduSessAggMaxBitRate = 0; } @@ -7473,6 +7843,7 @@ uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\ } return ROK; } + /******************************************************************* * * @brief Function to extract Drb Qos Cfg Info from CU @@ -7495,7 +7866,7 @@ uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd ) DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo)); if(macLcToAdd->drbQos == NULLP) { - DU_LOG("\nERROR --> DUAPP:Memory failed at allocating DrbQos at extractDrbCfg()"); + DU_LOG("\nERROR --> DUAPP:Memory failed at allocating DrbQos at extractDrbQosCfg()"); return RFAILED; } @@ -7505,21 +7876,10 @@ uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd ) extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS); macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel; } - if(!macLcToAdd->snssai) + if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &macLcToAdd->snssai) != ROK) { - 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); + DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at extractDrbQosCfg()"); + return RFAILED; } return ROK; } @@ -7537,8 +7897,8 @@ uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd ) * @return void * * ****************************************************************/ -uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem,DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\ -LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo) +uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\ +DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo) { DRB_Information_t *drbInfo = NULLP; @@ -7585,7 +7945,32 @@ LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo) } } } + else if(drbModItem != NULLP) + { + if(extractUpTnlInfo(drbModItem->dRBID, CONFIG_MOD, &drbModItem->uLUPTNLInformation_ToBeSetup_List,\ + upTnlInfo) != ROK) + { + DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()"); + return RFAILED; + } + if(drbModItem->qoSInformation != NULLP) + { + if(drbModItem->qoSInformation->present == QoSInformation_PR_choice_extension) + { + if(drbModItem->qoSInformation->choice.choice_extension->value.present ==\ + QoSInformation_ExtIEs__value_PR_DRB_Information) + { + drbInfo = &drbModItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information; + if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK) + { + DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()"); + return RFAILED; + } + } + } + } + } return ROK; } @@ -7605,11 +7990,11 @@ LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo) * ****************************************************************/ uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\ -DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo) +DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo) { if(drbCfg != NULLP) { - if(extractDrbCfg(drbCfg, NULL, lcCfg, upTnlInfo) != ROK) + if(extractDrbCfg(drbCfg, NULL, NULL, lcCfg, upTnlInfo) != ROK) { DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()"); return RFAILED; @@ -7617,7 +8002,15 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, LogicalChannelConfig_t *ulLcCfg, LcCf } else if(drbSetupModCfg != NULLP) { - if(extractDrbCfg(NULL, drbSetupModCfg, lcCfg, upTnlInfo) != ROK) + if(extractDrbCfg(NULL, drbSetupModCfg, NULL, lcCfg, upTnlInfo) != ROK) + { + DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()"); + return RFAILED; + } + } + else if(drbModCfg != NULLP) + { + if(extractDrbCfg(NULL, NULL, drbModCfg, lcCfg, upTnlInfo) != ROK) { DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()"); return RFAILED; @@ -7657,8 +8050,8 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, LogicalChannelConfig_t *ulLcCfg, LcCf * * ****************************************************************/ -uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\ -DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LogicalChannelConfig_t *ulLcCfg,\ +uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType, DRBs_ToBeSetup_Item_t *drbItem,\ +DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LogicalChannelConfig_t *ulLcCfg,\ LcCfg *lcCfg, UpTnlCfg *upTnlInfo) { uint8_t ret = ROK; @@ -7667,14 +8060,16 @@ LcCfg *lcCfg, UpTnlCfg *upTnlInfo) lcCfg->configType = configType; if(rbType == RB_TYPE_SRB) { - ret = extractMacRbCfg(lcId, NULL,NULL, ulLcCfg, lcCfg, NULL); + ret = extractMacRbCfg(lcId, NULL, NULL, NULL, ulLcCfg, lcCfg, NULL); } else if(rbType == RB_TYPE_DRB) { if(drbItem != NULL) - ret = extractMacRbCfg(lcId, drbItem, NULL, ulLcCfg, lcCfg, upTnlInfo); + ret = extractMacRbCfg(lcId, drbItem, NULL, NULL, ulLcCfg, lcCfg, upTnlInfo); else if(drbSetupModItem != NULL) - ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, ulLcCfg, lcCfg, upTnlInfo); + ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, NULL, ulLcCfg, lcCfg, upTnlInfo); + else if(drbModItem != NULL) + ret = extractMacRbCfg(lcId, NULL, NULL, drbModItem, ulLcCfg, lcCfg, upTnlInfo); } return ret; } @@ -7745,14 +8140,16 @@ uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList /* 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])); - if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK) + procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]), NULLP); + if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK) { DU_LOG("\nERROR --> DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()"); return RFAILED; } (ueCfgDb->numRlcLcs)++; (ueCfgDb->numMacLcs)++; + DU_LOG("\nDEBUG -> DUAPP: extractRlcCfgToAddMod:RBType:%d, DrbID: %d,lcId:%d, [RLC,MAC,NumDrb]:[%x,%x,%x]",\ + rbType, rbId, lcId, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb); } //TODO: To send the failure cause in UeContextSetupRsp return ROK; @@ -7994,31 +8391,34 @@ void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg) if(cRsetToAddModList->list.count) { 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); + for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++) + { + macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \ + cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId; + //freqDomRsrcBitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\ + macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc); + memcpy(macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc, \ + cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.buf, + cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.size); + macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \ - cRsetToAddModList->list.array[cRsetIdx]->duration; + cRsetToAddModList->list.array[cRsetIdx]->duration; - macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \ - cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present; + 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 + { + //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); - } + 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) @@ -8027,10 +8427,10 @@ void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg) if(cRsetToRelList->list.count) { macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count; - for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++) - { + for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++) + { macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]); - } + } } } @@ -8041,49 +8441,49 @@ void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg) if(srchSpcToAddModList->list.count) { macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count; - for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++) - { + for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++) + { macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\ - srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId; + srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId; macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\ - *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId); - if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset) - { + *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId); + if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset) + { macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\ - srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present; + srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present; } if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot) { - bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\ - macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot); + bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\ + macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot); } - if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates) + 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; - } + 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; - } - - } - } + { + 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; + } + + } + } } } /* Search space To Rel List */ @@ -8093,11 +8493,11 @@ void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg) if(srchSpcToRelList->list.count) { macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count; - for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++) - { + for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++) + { macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\ - *(srchSpcToRelList->list.array[srchSpcIdx]); - } + *(srchSpcToRelList->list.array[srchSpcIdx]); + } } } } @@ -8112,13 +8512,19 @@ void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg) * * Functionality: Fills PdschCfg received by CU * - * @params[in] PDSCH_Config_t *cuPdschCfg, - * PdschConfig *macPdschCfg + * @params[in] PDSCH_Config_t *cuPdschCfg = Information which is send by CU, + * which we have stored in F1UeContextSetupDb, + * PdschConfig *macPdschCfg = Used to Store the information which + * needs to send in other layer, as well as this can be the variable + * which stores the information in DuCb, + * PdschConfig *storedPdschCfg = Null in case of sending the + * information to other layer else it will have stored pdsch + * configuration in copyOfmacUeCfg. * @return void * * ****************************************************************/ -void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg) +void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg, PdschConfig *storedPdschCfg) { uint8_t timeDomIdx; struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP; @@ -8152,7 +8558,22 @@ void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg) { if(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 == NULL) { - DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t)); + if(storedPdschCfg) + { + if(storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) + { + macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 =\ + storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0; + } + else + { + DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t)); + } + } + else + { + DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t)); + } if(!macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) { DU_LOG("\nERROR --> DU APP : Memory allocation failed for k0 at extractPdschCfg()"); @@ -8160,7 +8581,7 @@ void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg) } } *(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) = \ - *(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0); + *(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0); } macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \ timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType; @@ -8474,8 +8895,16 @@ void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_ macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\ *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx]; } - macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\ - *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1; + + if(cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1) + { + macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\ + *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1; + } + else + { + macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize = 0; + } } }/* End of extractResrcSetToAddModList */ @@ -8806,13 +9235,20 @@ void extractSchedReqCfgToAddMod(PucchSchedReqCfg *macSchedReqCfg, struct PUCCH_C * * Functionality: Fills PucchCfg received by CU * - * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg, - * PucchCfg *macPucchCfg + * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg = Information which + * is send by CU, which we have stored in F1UeContextSetupDb, + * PucchCfg *macPucchCfg = Used to Store the information which + * needs to send in other layer, as well as this can be the variable + * which stores the information in DuCb, + * PucchCfg *storedPucchCfg = Null in case of sending the + * information to other layer else it will have Pucch Cfg which + * we have stored in copyOfmacUeCfg. * @return ROK/RFAILED * * ****************************************************************/ -uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg) +uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg,\ +PucchCfg *storedPucchCfg) { uint8_t arrIdx; @@ -8938,20 +9374,34 @@ uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, Pu /* Dl_DataToUL_ACK */ if(cuPucchCfg->choice.setup->dl_DataToUL_ACK) - { + { + if(storedPucchCfg) + { + if(storedPucchCfg->dlDataToUlAck) + { + macPucchCfg->dlDataToUlAck = storedPucchCfg->dlDataToUlAck; + } + else + { 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]; - } + } + } + else + { + 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 */ @@ -8981,12 +9431,19 @@ uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, Pu * * Functionality: Fills ServingCellReconfig received by CU * - * @params[in] ServingCellConfig_t *cuSrvCellCfg - * ServCellCfgInfo *macSrvCellCfg + * @params[in] ServingCellConfig_t *cuSrvCellCfg = Information which is send by + * CU, which we have stored in F1UeContextSetupDb, + * ServCellCfgInfo *macSrvCellCfg = Used to Store the information + * which needs to send in other layer, as well as this can be the + * variable which stores the information in DuCb, + * ServCellCfgInfo *storedSrvCellCfg = Null in case of sending the + * information to other layer else it will have ServCellCfgInfo which + * we have stored in copyOfmacUeCfg. * @return ROK/RFAILD * * ****************************************************************/ -uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg) +uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg,\ +ServCellCfgInfo *storedSrvCellCfg) { uint8_t ret = ROK; BWP_DownlinkDedicated_t *dlBwp = NULLP; @@ -8998,18 +9455,48 @@ uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfg if(dlBwp->pdcch_Config) { if(dlBwp->pdcch_Config->choice.setup) - { - macSrvCellCfg->initDlBwp.pdcchPresent = true; - extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg); - } + { + macSrvCellCfg->initDlBwp.pdcchPresent = true; + if(storedSrvCellCfg) + { + if(!storedSrvCellCfg->initDlBwp.pdcchPresent) + { + extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg); + } + else + { + extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg); + } + } + else + { + 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); - } + { + macSrvCellCfg->initDlBwp.pdschPresent = true; + + if(storedSrvCellCfg) + { + if(!storedSrvCellCfg->initDlBwp.pdschPresent) + { + extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL); + } + else + { + extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg,\ + &storedSrvCellCfg->initDlBwp.pdschCfg); + } + } + else + { + extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL); + } + } } } if(cuSrvCellCfg->firstActiveDownlinkBWP_Id) @@ -9026,15 +9513,15 @@ uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfg { macSrvCellCfg->bwpInactivityTmr = NULLP; DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t)); - if(macSrvCellCfg->bwpInactivityTmr) - { + 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; - } + } + else + { + DU_LOG("\nERROR --> F1AP : Memory Alloc failed for bwpInactivityTmr at extractSpCellDedicatedCfg()"); + return RFAILED; + } } } if(cuSrvCellCfg->pdsch_ServingCellConfig) @@ -9043,31 +9530,42 @@ uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfg { ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg); if(ret == RFAILED) - { - DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()"); - return RFAILED; - } + { + DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()"); + return RFAILED; + } } } if(cuSrvCellCfg->uplinkConfig) { - 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; - 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); + 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; + memset(&macSrvCellCfg->initUlBwp.pucchCfg, 0, sizeof(PucchCfg)); + if(storedSrvCellCfg) + { + if(!storedSrvCellCfg->initUlBwp.pucchPresent) + extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL); + else + extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg,\ + &storedSrvCellCfg->initUlBwp.pucchCfg); + } + else + { + extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL); + } + } + } + if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id) + macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id); } return ret; } @@ -9080,13 +9578,20 @@ uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfg * Function : extractUeReCfgCellInfo * * Functionality: Fills Reconfig Cell group Info received by CU + * + * @params[in] CellGroupConfigRrc_t *cellGrp = CellGroupConfigRrc_t information which + * is send by CU, which we have stored in F1UeContextSetupDb + * MacUeCfg *MacUeCfg = Used to Store the information, + * which needs to send in other layer, as well as this can be + * the variable which stores the information in DuCb, + * MacUeCfg *storedMacUeCfg = Null in case of sending the + * information to other layer else it will have copyOfmacUeCfg + * which we have stored in F1UeContextSetupDb. * - * @params[in] CellGroupConfigRrc_t *macCellGrpCfg - * MacUeCfg* macUeCfg * @return ROK/RFAILED * * ****************************************************************/ -uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg) +uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg, MacUeCfg *storedMacUeCfg) { uint8_t ret = ROK; MAC_CellGroupConfig_t *macCellGroup = NULLP; @@ -9169,7 +9674,18 @@ uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg if(cellGrp->spCellConfig->spCellConfigDedicated) { servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated)); - ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg); + if(storedMacUeCfg) + { + if(!storedMacUeCfg->spCellCfgPres) + ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL); + else + ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg,\ + &storedMacUeCfg->spCellCfg.servCellCfg); + } + else + { + ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL); + } if(ret == RFAILED) { DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()"); @@ -9548,13 +10064,19 @@ void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet) * * Functionality: builds Mac Cell Cfg * - * @params[in] MacUeCfg pointer - * void pointer + * @params[in] MacUeCfg *macUeCfgToSend = Used to Store the information which + * needs to send in other layer, as well as this can be + * the variable which stores the information in DuCb. + * MacUeCfg *storedMacUeCfg = Null in case of sending the + * information to other layer else it will have copyOfmacUeCfg + * which we have stored in F1UeContextSetupDb + * void *cellInfo = CellGroupConfigRrc_t information which is send + * by CU, which we have stored in F1UeContextSetupDb * * @return void * * ****************************************************************/ -uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend, void *cellInfo) +uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend,MacUeCfg *storedMacUeCfg, void *cellInfo) { uint8_t ret = ROK; CellGroupConfigRrc_t *cellGrp = NULLP; @@ -9562,7 +10084,7 @@ uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend, void *cellInfo) if(cellInfo) { cellGrp = (CellGroupConfigRrc_t *)cellInfo; - ret = extractUeReCfgCellInfo(cellGrp, macUeCfgToSend); + ret = extractUeReCfgCellInfo(cellGrp, macUeCfgToSend, storedMacUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> F1AP : Failed at procUeReCfgCellInfo()"); } @@ -9773,19 +10295,18 @@ CellGroupConfigRrc_t *extractCellGrpInfo(ProtocolExtensionContainer_4624P16_t *p * ****************************************************************/ uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd) { - uint8_t ret = ROK; /* Filling RLC INFO */ - procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd); + procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd, NULL); /* Filling MAC INFO */ - ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, macLcToAdd, NULL); - if(ret == RFAILED) + if(procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, macLcToAdd, NULL) != ROK) { DU_LOG("\nERROR --> F1AP : Failed at MAC LC Cfg in procSrbListToSetup()"); - return ret; + return RFAILED; } - return ret; + + return ROK; } @@ -9835,6 +10356,8 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb) &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]); ueCfgDb->numRlcLcs++; ueCfgDb->numMacLcs++; + DU_LOG("\nDEBUG --> DUAPP: extractSrbListToSetup: SRBID: %d [RLC,MAC,NumDrb]:[%x,%x,%x]",\ + srbItem->sRBID, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb); if(ret == RFAILED) { DU_LOG("\nERROR --> F1AP: Failed at extractSrbListToSetup()"); @@ -9854,41 +10377,68 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb) * * @details * - * Function : procDrbListToSetup + * Function : procDrbListToSetupMod * * Functionality: Fills Drb List received by CU * for both MAC and RLC * - * @params[in] SRBs_ToBeSetup_Item_t pointer - * LcCfg pointer, - * RlcBearerCfg pointer + * @params[in] DRBs_ToBeSetup_Item_t , DRBs_ToBeSetupMod_Item_t, + * DRBs_ToBeModified_Item_t , lcId, LcCfg pointer, + * RlcBearerCfg , UpTnlCfg, RlcUeCfg * @return void * * ****************************************************************/ -uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\ -DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo) +uint8_t procDrbListToSetupMod(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\ +DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo, RlcUeCfg *storedRlcUeCfg) { + uint8_t cfgIdx = 0; + RlcMode rlcModeInfo; if(drbItem != NULLP) { /* Filling RLC INFO */ - procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd); + procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, &drbItem->\ + qoSInformation); /* Filling MAC INFO */ - if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK) + if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, NULL, macLcToAdd, upTnlInfo) != ROK) { - DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetup()"); + DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()"); return RFAILED; } } else if(drbSetupModItem != NULLP) { - procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd); + procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, + &drbSetupModItem->qoSInformation); - if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, macLcToAdd, upTnlInfo) != ROK) + if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK) { - DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetup()"); + DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()"); + return RFAILED; + } + } + else if(drbModItem != NULLP) + { + /* Drb to Mod IEs doesnot have rlcMode to be modified + * in ASN. Hence no change in RLC configurations */ + if(storedRlcUeCfg != NULLP) + { + for(cfgIdx = 0; cfgIdx < storedRlcUeCfg->numLcs; cfgIdx++) + { + if(storedRlcUeCfg->rlcLcCfg[cfgIdx].lcId == lcId) + { + rlcModeInfo = storedRlcUeCfg->rlcLcCfg[cfgIdx].rlcMode; + break; + } + } + } + + procRlcLcCfg(drbModItem->dRBID, lcId, RB_TYPE_DRB, rlcModeInfo, CONFIG_MOD, NULL, rlcLcToAdd, drbModItem->qoSInformation); + if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_MOD, NULL, NULL, drbModItem, NULL, macLcToAdd, upTnlInfo) != ROK) + { + DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()"); return RFAILED; } } @@ -9901,7 +10451,7 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcL * * @details * - * Function : extractDrbListToSetup + * Function : extractDrbListToSetupMod * * Functionality: extract Drb List received by CU * for both MAC and RLC @@ -9912,12 +10462,13 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcL * * ****************************************************************/ -uint8_t extractDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_List_t *drbCfg,DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\ -uint8_t drbCount, DuUeCfg *ueCfgDb) +uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\ + DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap, RlcUeCfg *rlcUeCfg) { - uint8_t ret, drbIdx; + uint8_t ret, drbIdx, lcId = 0; DRBs_ToBeSetup_Item_t *drbItem = NULLP; DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP; + DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP; ret = ROK; if(drbCount > 0) @@ -9926,48 +10477,80 @@ uint8_t drbCount, DuUeCfg *ueCfgDb) { if(ueCfgDb->numMacLcs > MAX_NUM_LC) { - DU_LOG("\nERROR --> F1AP : MAX LC Reached in MAC at extractDrbListToSetup()"); + DU_LOG("\nERROR --> F1AP : MAX LC Reached in MAC at extractDrbListToSetupMod()"); ret = RFAILED; break; } if(ueCfgDb->numRlcLcs > MAX_NUM_LC) { - DU_LOG("\nERROR --> F1AP : MAX LC Reached in RLC at extractDrbListToSetup()"); + DU_LOG("\nERROR --> F1AP : MAX LC Reached in RLC at extractDrbListToSetupMod()"); ret = RFAILED; break; } memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg)); memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg)); - - if(drbCfg != NULL) + + if(drbModCfg != NULLP) { - drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item; - ret = procDrbListToSetup(lcId, drbItem, NULL, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\ - &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]); + drbModItem = (DRBs_ToBeModified_ItemIEs_t *) drbModCfg->list.array[drbIdx]; + lcId = fetchLcId(drbModItem->value.choice.DRBs_ToBeModified_Item.dRBID); + if(lcId < MIN_DRB_LCID) + { + DU_LOG("\nERROR --> F1AP : Failed fetching LCID %d in extractDrbListToSetupMod() for Modified List", lcId); + break; + } + ret = procDrbListToSetupMod(lcId, NULL, NULL, &(drbModItem->value.choice.DRBs_ToBeModified_Item),\ + &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\ + &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg); if(ret == RFAILED) { - DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetup()"); + DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for Modified List"); break; } + } - else if(drbSetupModCfg != NULL) + else { - drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx]; - ret = procDrbListToSetup(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item) ,\ - &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\ - &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]); - if(ret == RFAILED) + lcId = getDrbLcId(drbBitMap); + if(lcId == RFAILED) { - DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetup()"); + DU_LOG("\nERROR --> F1AP : InCorrect LCID extractDrbListToSetupMod()"); + ret = RFAILED; break; } + if(drbCfg != NULL) + { + drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item; + ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\ + &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetup List"); + break; + } + } + else if(drbSetupModCfg != NULL) + { + drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx]; + ret = procDrbListToSetupMod(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item), NULL,\ + &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\ + &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetupMod List"); + break; + } + } } ueCfgDb->numRlcLcs++; ueCfgDb->numMacLcs++; ueCfgDb->numDrb++; + + DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetupMod:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\ + lcId,*drbBitMap, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb); if(ret == RFAILED) { - DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetup()"); + DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetupMod()"); break; } } @@ -10198,7 +10781,7 @@ void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t *ueSetReq) * ****************************************************************/ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) { - uint8_t ret=0, ieIdx=0, ueIdx=0, lcId=0, cellIdx=0; + uint8_t ret=0, ieIdx=0, ueIdx=0, cellIdx=0; bool ueCbFound = false; uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0; DuUeCb *duUeCb = NULL; @@ -10244,6 +10827,7 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) DU_LOG("\nERROR --> F1AP: Memory Alloc Failed at procF1UeContextSetupReq()"); ret = RFAILED; } + break; } else ueCbFound = false; @@ -10299,19 +10883,14 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) } case ProtocolIE_ID_id_DRBs_ToBeSetup_List: { - lcId = getDrbLcId(&duUeCb->drbBitMap); - if(lcId != RFAILED) - { drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List; - if(extractDrbListToSetup(lcId, drbCfg, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg)) + + if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP)) { - DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetup()"); + DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod()"); //TODO: Update the failure cause in ue context Setup Response ret = RFAILED; } - } - else - ret = RFAILED; break; } case ProtocolIE_ID_id_RRCContainer: @@ -11818,7 +12397,7 @@ void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck) uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId) { uint8_t ieIdx=0, arrIdx=0,ret=ROK; - uint8_t ueId =0 , ueIdx =0; + uint8_t ueId =0 , ueIdx =0, totalActiveUe = 0; uint16_t cellId =0, cellIdx =0, crnti=0; CmLList *f1apPduNode = NULLP; ReservedF1apPduInfo *f1apPduInfo =NULLP; @@ -11870,28 +12449,38 @@ uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId) ret = duSendCellDeletReq(cellId); if(ret == RFAILED) { - DU_LOG("ERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\ + DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\ request for cellId[%d]", cellId); } } else { - for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++) + totalActiveUe = duCb.actvCellLst[cellIdx]->numActvUes; + while(totalActiveUe) { + if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState != UE_ACTIVE) + { + ueIdx++; + continue; + } + crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti; GET_UE_IDX(crnti,ueId); + /* Sending Ue Context release request only for maximum supporting UEs */ ret = BuildAndSendUeContextReleaseReq(cellId, ueId); if(ret == RFAILED) { - DU_LOG("ERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\ + DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\ request for cellId[%d]", cellId); } + ueIdx++; + totalActiveUe--; } } } else { - DU_LOG("ERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId); + DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId); ret = RFAILED; } break; @@ -12665,9 +13254,10 @@ void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *U uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) { UEContextModificationRequest_t *ueContextModifyReq = NULLP; - uint8_t ret = ROK, ieIdx = 0, lcId =0,cellIdx=0, ueIdx=0; + uint8_t ret = ROK, ieIdx = 0, cellIdx=0, ueIdx=0; DuUeCb *duUeCb = NULLP; DRBs_ToBeSetupMod_List_t *drbSetupModCfg; + DRBs_ToBeModified_List_t *drbModifiedCfg; uint32_t gnbCuUeF1apId, gnbDuUeF1apId; ueContextModifyReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest; @@ -12686,6 +13276,7 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) break; } case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List: + case ProtocolIE_ID_id_DRBs_ToBeModified_List: { for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++) { @@ -12696,29 +13287,48 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) { duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx]; - lcId = getDrbLcId(&duUeCb->drbBitMap); - if(lcId != RFAILED) + if(duUeCb->f1UeDb == NULLP) { DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb)); - if(duUeCb->f1UeDb) + } + if(duUeCb->f1UeDb) + { + duUeCb->f1UeDb->actionType = UE_CTXT_MOD; + if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\ + UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List) { - duUeCb->f1UeDb->actionType = UE_CTXT_MOD; drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\ choice.DRBs_ToBeSetupMod_List; - if(extractDrbListToSetup(lcId, NULL, drbSetupModCfg ,drbSetupModCfg->list.count, \ - &duUeCb->f1UeDb->duUeCfg)) + + if(extractDrbListToSetupMod(NULL, drbSetupModCfg, NULL, drbSetupModCfg->list.count,\ + &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULL)) + { + DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbSetupModList"); + ret = RFAILED; + } + } + + if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \ + UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List) + + { + drbModifiedCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\ + choice.DRBs_ToBeModified_List; + if(extractDrbListToSetupMod(NULL, NULL, drbModifiedCfg, drbSetupModCfg->list.count,\ + &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, &duUeCb->rlcUeCfg)) { - DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetup()"); + DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList"); ret = RFAILED; } } } + break; } - else - { - DU_LOG("\nERROR --> DU APP : wrong values of gnbCuUeF1apId and gnbDuUeF1apId "); - ret = RFAILED; - } + } + if(ueIdx >= duCb.actvCellLst[cellIdx]->numActvUes) + { + DU_LOG("\nERROR --> DU APP : wrong values of gnbCuUeF1apId and gnbDuUeF1apId "); + ret = RFAILED; } } break; @@ -13081,7 +13691,7 @@ uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1 break; }while(true); - if(ret == ROK) + if(ret == ROK && (duCb.actvCellLst[cellId-1]->numActvUes == 0)) { duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS; ret = duSendCellDeletReq(cellId); @@ -13206,7 +13816,7 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg) { for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++) { - for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++) + for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) { if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\ (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)) @@ -13255,7 +13865,7 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg) } if(!ueIdxFound) { - DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextSetupReq()"); + DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextReleaseCommand()"); ret = RFAILED; }