X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_f1ap_msg_hdl.c;h=cec32a3cdaa7d5f00ea85857277387a9c07a8d2b;hb=0b405462775bb65021e41dc4494ed38ce3a9c4f4;hp=bd6fa081757ddab5b94cec688f0bfea5987a5cad;hpb=438594773b3c93b5bbe8d1cb1d16626a02238b8b;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 bd6fa0817..cec32a3cd 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -22,6 +22,7 @@ #include "legtp.h" #include "lkw.x" #include "lrg.x" +#include "F1AP-PDU.h" #include "du_app_mac_inf.h" #include "du_cfg.h" #include "du_app_rlc_inf.h" @@ -91,14 +92,66 @@ #include "SchedulingRequestResourceConfig.h" #include #include "ProtocolExtensionField.h" -#include "F1AP-PDU.h" #include "odu_common_codec.h" #include "du_mgr.h" #include "du_cell_mgr.h" #include "du_f1ap_msg_hdl.h" +#include "DRBs-Setup-Item.h" +#include "DLUPTNLInformation-ToBeSetup-List.h" +#include "DLUPTNLInformation-ToBeSetup-Item.h" +#include "UPTransportLayerInformation.h" +#include "GTPTunnel.h" + +#ifdef O1_ENABLE +#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 @@ -114,6 +167,7 @@ DuCfgParams duCfgParam; * @return Actual value of pollPdu * * **********************************************************************/ + uint16_t getPollRetxTmr(uint8_t pollRetxTmrCfg) { uint16_t pollRetxTmr; @@ -168,9 +222,9 @@ uint16_t getPollRetxTmr(uint8_t pollRetxTmrCfg) * @return Actual value of pollPdu * * ****************************************************************/ -int16_t getPollPdu(uint8_t pollPduCfg) +int32_t getPollPdu(uint8_t pollPduCfg) { - int16_t pollPdu; + int32_t pollPdu; switch(pollPduCfg) { case PollPDU_p4: @@ -461,6 +515,235 @@ uint8_t getMaxRetx(uint8_t maxRetxCfg) return maxRetx; } +/******************************************************************* + * @brief Converts enum values into actual value of reassembly timer + * + * @details + * + * Function : getReAsmblTmr + * + * Functionality: Converts enum values into actual value of reassembly + * timer + * + * @params[in] Enum value of reassembly timer + * @return Actual value of reassembly timer + * + * **********************************************************************/ + +int8_t getReAsmblTmr(uint8_t reAsmblTmrCfg) +{ + int8_t reAsmblTmr = 0; + + if(reAsmblTmrCfg == T_Reassembly_ms0) + { + reAsmblTmr = 0; + } + else if(reAsmblTmrCfg >= T_Reassembly_ms5 || reAsmblTmrCfg <= T_Reassembly_ms100) + { + /* All values of re assembly timer are at interval of 5ms. + * This is valid upto 100ms + * Hence converting the enum value to actual value by multiplying it to 5 + */ + reAsmblTmr = reAsmblTmrCfg * 5; + } + else if(reAsmblTmrCfg >= T_Reassembly_ms110 || reAsmblTmrCfg <= T_Reassembly_ms200) + { + /* All values of re assembly timer are at interval of 10ms. + * This is valid upto 200ms + * since enum value starts from 20 for 100ms, subtracting 10 and + * converting the enum value to actual value by multiplying it to 10 + */ + reAsmblTmr = ((reAsmblTmrCfg-10) * 10); + } + else + { + DU_LOG("\nERROR --> F1AP : Invalid value of Re Assembly timer %d", reAsmblTmrCfg); + reAsmblTmr = -1; + } + return reAsmblTmr; +} + +/************************************************************************ + * + * @brief Converts enum values into actual value of status prohibit timer + * + * @details + * + * Function : getStatProhTmr + * + * Functionality: Converts enum values into actual value of status prohibit + * timer + * + * @params[in] Enum value of status prohibit timer + * @return Actual value of status prohibit timer + * + * **********************************************************************/ + +int16_t getStatProhTmr(uint8_t statProhTmrCfg) +{ + int16_t statProhTmr =0; + + if(statProhTmrCfg == T_StatusProhibit_ms0) + { + statProhTmr = 0; + } + else if(statProhTmrCfg >= T_StatusProhibit_ms5 || statProhTmrCfg <= T_StatusProhibit_ms250) + { + /* All values of re assembly timer are at interval of 5ms. + * This is valid upto 250ms + * Hence converting the enum value to actual value by multiplying it to 5 + */ + statProhTmr = statProhTmrCfg * 5; + } + else + { + switch(statProhTmrCfg) + { + case T_StatusProhibit_ms300: + statProhTmr = 300; + break; + case T_StatusProhibit_ms350: + statProhTmr = 350; + break; + case T_StatusProhibit_ms400: + statProhTmr = 400; + break; + case T_StatusProhibit_ms450: + statProhTmr = 450; + break; + case T_StatusProhibit_ms500: + statProhTmr = 500; + break; + case T_StatusProhibit_ms800: + statProhTmr = 800; + break; + case T_StatusProhibit_ms1000: + statProhTmr = 1000; + break; + case T_StatusProhibit_ms1200: + statProhTmr = 1200; + break; + case T_StatusProhibit_ms1600: + statProhTmr = 1600; + break; + case T_StatusProhibit_ms2000: + statProhTmr = 2000; + break; + case T_StatusProhibit_ms2400: + statProhTmr = 2400; + break; + default: + DU_LOG("\nInvalid value of Status Prohibit timer %d", statProhTmrCfg); + statProhTmr = -1; + break; + } + } + return statProhTmr; +} + +/******************************************************************* +* +* @brief Adding F1AP pdu to reserved pdu list +* +* @details +* +* Function : addToReservedF1apPduList +* +* Functionality: Adding F1AP pdu to reserved pdu list. +* These pdu are awaiting aknowledgment from CU +* +* @params[in] uint8_t transId, F1AP_PDU_t *f1apMsg +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +void addToReservedF1apPduList(uint8_t transId, F1AP_PDU_t *f1apPdu) +{ + CmLList *node = NULLP; + ReservedF1apPduInfo *pduInfo = NULLP; + DU_ALLOC(pduInfo, sizeof(ReservedF1apPduInfo)); + if(pduInfo) + { + DU_ALLOC(node, sizeof(CmLList)); + if(node) + { + pduInfo->transId = transId; + pduInfo->f1apMsg = (void*) f1apPdu; + + node->node = (PTR)pduInfo; + cmLListAdd2Tail(&duCb.reservedF1apPduList, node); + } + } +} + +/******************************************************************* +* +* @brief searching for F1AP pdu from ReservedF1apPduList +* +* @details +* +* Function : searchFromReservedF1apPduList +* +* Functionality: searching for F1AP pdu information +* +* @params[in] uint8_t transId +* +* @return pointer to F1AP_PDU_t +* +* ****************************************************************/ + +CmLList *searchFromReservedF1apPduList(uint8_t transId) +{ + CmLList *node; + ReservedF1apPduInfo *f1apPdu; + if(duCb.reservedF1apPduList.count) + { + CM_LLIST_FIRST_NODE(&duCb.reservedF1apPduList, node); + while(node) + { + f1apPdu = (ReservedF1apPduInfo*)node->node; + if(f1apPdu->transId == transId) + { + return node; + } + node = node->next; + } + } + return NULL; +} + +/******************************************************************* +* +* @brief deleting F1AP pdu information from ReservedF1apPduList +* +* @details +* +* Function : deleteFromReservedF1apPduList +* +* Functionality: deleting pdu information from ReservedF1apPduList +* +* @params[in] CmLList *node +* +* @return void +* +* ****************************************************************/ + +void deleteFromReservedF1apPduList(CmLList *node) +{ + ReservedF1apPduInfo *f1apPdu; + + if(node != NULL) + { + f1apPdu = (ReservedF1apPduInfo *)node->node; + cmLListDelFrm(&duCb.reservedF1apPduList, node); + DU_FREE(f1apPdu, sizeof(ReservedF1apPduInfo)); + DU_FREE(node, sizeof(CmLList)); + node = NULL; + } +} + /******************************************************************* * * @brief Builds Uplink Info for NR @@ -564,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; } @@ -716,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; } /******************************************************************* @@ -959,16 +1254,15 @@ uint8_t BuildServedCellList(GNB_DU_Served_Cells_List_t *duServedCell) return RFAILED; } /* MIB */ - srvCellItem->gNB_DU_System_Information->mIB_message.size =\ - strlen(( char *)duCfgParam.srvdCellLst[0].duSysInfo.mibMsg); + srvCellItem->gNB_DU_System_Information->mIB_message.size = duCfgParam.srvdCellLst[0].duSysInfo.mibLen; DU_ALLOC(srvCellItem->gNB_DU_System_Information->mIB_message.buf, srvCellItem->gNB_DU_System_Information->mIB_message.size); if(!srvCellItem->gNB_DU_System_Information->mIB_message.buf) { return RFAILED; } - strcpy((char *)srvCellItem->gNB_DU_System_Information->mIB_message.buf, - (char *)duCfgParam.srvdCellLst[0].duSysInfo.mibMsg); + memcpy(srvCellItem->gNB_DU_System_Information->mIB_message.buf, duCfgParam.srvdCellLst[0].duSysInfo.mibMsg, \ + srvCellItem->gNB_DU_System_Information->mIB_message.size); /* SIB1 */ srvCellItem->gNB_DU_System_Information->sIB1_message.size =\ @@ -1065,7 +1359,7 @@ uint8_t BuildRrcVer(RRC_Version_t *rrcVer) * * @details * - * Function : SendF1APMsg + * Function : sendF1APMsg * * Functionality: Sends F1 msg over SCTP * @@ -1075,11 +1369,11 @@ uint8_t BuildRrcVer(RRC_Version_t *rrcVer) * RFAILED - failure * * ****************************************************************/ -uint8_t SendF1APMsg(Region region, Pool pool) +uint8_t sendF1APMsg() { Buffer *mBuf = NULLP; - if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK) + if(ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK) { if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK) { @@ -1106,7 +1400,7 @@ uint8_t SendF1APMsg(Region region, Pool pool) return RFAILED; } return ROK; -} /* SendF1APMsg */ +} /* sendF1APMsg */ /******************************************************************* * @@ -1167,161 +1461,136 @@ void FreeRrcVer(RRC_Version_t *rrcVer) * ****************************************************************/ void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell) { - uint8_t plmnCnt=1; - uint8_t servId=0; - uint8_t sliceId=0; - uint8_t ieId=0; - uint8_t extensionCnt=1; - uint8_t plmnidx=0; - GNB_DU_Served_Cells_Item_t *srvCellItem= &duServedCell->list.array[0]->value.choice.GNB_DU_Served_Cells_Item; + 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; + if(duServedCell->list.array!=NULLP) { if(duServedCell->list.array[0]!=NULLP) { - if(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf!=NULLP) - { - if(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf !=NULLP) - { - if(srvCellItem->served_Cell_Information.fiveGS_TAC!=NULLP) - { - if(srvCellItem->served_Cell_Information.fiveGS_TAC->buf!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[0]!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->pLMN_Identity.buf!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\ - extensionValue.choice.SliceSupportList.list.array!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\ - extensionValue.choice.SliceSupportList.list.array[sliceId]!= NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\ - extensionValue.choice.SliceSupportList.list.array[sliceId]->sNSSAI.sST.buf!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\ - extensionValue.choice.SliceSupportList.list.array[sliceId]->sNSSAI.sD!=NULLP) - { - if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->\ - list.array[0]->extensionValue.choice.SliceSupportList.list.array[sliceId]->sNSSAI.sD->buf!=NULLP) - { - if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD!=NULLP) - { - if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.\ - freqBandListNr.list.array!=NULLP) - { - if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.\ - freqBandListNr.list.array[0]!=NULLP) - { - if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ - freqBandListNr.list.array) - { - if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ - freqBandListNr.list.array[0]!=NULLP) - { - if(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf!=NULLP) - { - if(!srvCellItem->gNB_DU_System_Information) - { - if(srvCellItem->gNB_DU_System_Information->mIB_message.buf!=NULLP) - { - if(srvCellItem->gNB_DU_System_Information->sIB1_message.buf!=NULLP) - { - DU_FREE(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,\ - srvCellItem->gNB_DU_System_Information->sIB1_message.size); - DU_FREE(duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg,\ - srvCellItem->gNB_DU_System_Information->sIB1_message.size); - } - DU_FREE(srvCellItem->gNB_DU_System_Information->mIB_message.buf,\ - srvCellItem->gNB_DU_System_Information->mIB_message.size); - DU_FREE(duCfgParam.srvdCellLst[0].duSysInfo.mibMsg,\ - strlen((char*)duCfgParam.srvdCellLst[0].duSysInfo.mibMsg)); - } - DU_FREE(srvCellItem->gNB_DU_System_Information,sizeof(GNB_DU_System_Information_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf,\ - srvCellItem->served_Cell_Information.measurementTimingConfiguration.size); - } - DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ - freqBandListNr.list.array[0],sizeof(FreqBandNrItem_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_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*)); - } - DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD,sizeof(FDD_Info_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ - iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.list.array[sliceId]->\ - sNSSAI.sD->buf,srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions-> - list.array[ieId]->extensionValue.choice.SliceSupportList.list.array[sliceId]->sNSSAI.sD->size); - } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ - iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\ - list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\ - iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.list.array[sliceId]->\ - sNSSAI.sST.buf,sizeof(uint8_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\ - extensionValue.choice.SliceSupportList.list.array[sliceId],sizeof(SliceSupportItem_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\ - extensionValue.choice.SliceSupportList.list.array,sizeof(SliceSupportItem_t*)); - } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ - array[servId]->iE_Extensions->list.array[plmnidx],sizeof(ServedPLMNs_ItemExtIEs_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ - array[servId]->iE_Extensions->list.array,\ - extensionCnt*sizeof(ServedPLMNs_ItemExtIEs_t*)); - } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ - array[servId]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\ - array[servId]->pLMN_Identity.buf,srvCellItem->served_Cell_Information.\ - servedPLMNs.list.array[servId]->pLMN_Identity.size - * sizeof(uint8_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.fiveGS_TAC->buf,\ - sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size)); - } - DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,sizeof(FiveGS_TAC_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ - srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * - sizeof(uint8_t)); - } - DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ - srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * - sizeof(uint8_t)); - } - DU_FREE(duServedCell->list.array[plmnidx],sizeof(GNB_DU_Served_Cells_ItemIEs_t)); + srvCellItem= &duServedCell->list.array[0]->value.choice.GNB_DU_Served_Cells_Item; + + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(uint8_t)); + DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(uint8_t)); + + if(srvCellItem->served_Cell_Information.fiveGS_TAC!=NULLP) + { + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\ + sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size)); + DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,sizeof(FiveGS_TAC_t)); + } + + if(srvCellItem->served_Cell_Information.servedPLMNs.list.array!=NULLP) + { + 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); + + if(servedPlmnItem->iE_Extensions != NULLP) + { + if(servedPlmnItem->iE_Extensions->list.array != NULLP) + { + if(servedPlmnItem->iE_Extensions->list.array[0] != NULLP) + { + if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\ + SliceSupportList.list.array != NULLP) + { + for(sliceIdx =0; sliceIdxiE_Extensions->list.array[0]->\ + extensionValue.choice.SliceSupportList.list.count; sliceIdx++) + { + 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)); + + 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[sliceIdx], 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,\ + 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,\ + sizeof(ServedPLMNs_Item_t *)); + } + + if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD != NULLP) + { + 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*)); + } + + if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ + freqBandListNr.list.array) + { + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ + freqBandListNr.list.array[0],sizeof(FreqBandNrItem_t)); + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\ + freqBandListNr.list.array,sizeof(FreqBandNrItem_t *)); + } + DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD, sizeof(FDD_Info_t)); + } + + DU_FREE(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf,\ + srvCellItem->served_Cell_Information.measurementTimingConfiguration.size); + + if(srvCellItem->gNB_DU_System_Information != NULLP) + { + if(srvCellItem->gNB_DU_System_Information->mIB_message.buf != NULLP) + { + DU_FREE(srvCellItem->gNB_DU_System_Information->mIB_message.buf,\ + srvCellItem->gNB_DU_System_Information->mIB_message.size); + } + + if(srvCellItem->gNB_DU_System_Information->sIB1_message.buf != NULLP) + { + DU_FREE(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,\ + srvCellItem->gNB_DU_System_Information->sIB1_message.size); + } + + DU_FREE(srvCellItem->gNB_DU_System_Information, sizeof(GNB_DU_System_Information_t)); + } + + DU_FREE(duServedCell->list.array[0], sizeof(GNB_DU_Served_Cells_ItemIEs_t)); } - DU_FREE(duServedCell->list.array,plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t*)); + DU_FREE(duServedCell->list.array, plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t*)); } } + /******************************************************************* * * @brief deallocating the memory of function BuildAndSendF1SetupReq() @@ -1377,7 +1646,6 @@ void FreeF1SetupReq(F1AP_PDU_t *f1apMsg) break; } } - break; } for(ieIdx2=0; ieIdx2< ieIdx; ieIdx2++) { @@ -1558,7 +1826,7 @@ uint8_t BuildAndSendF1SetupReq() } /* Sending msg */ - if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK) + if(sendF1APMsg() != ROK) { DU_LOG("\nERROR --> F1AP : Sending F1 Setup request failed"); break; @@ -1575,247 +1843,218 @@ uint8_t BuildAndSendF1SetupReq() /******************************************************************* * - * @brief Deallocating memory of BuildAndSendDUConfigUpdate + * @brief Deallocating memory allocated for Served_Cells_To_Modify_Item_t * * @details * - * Function : FreeDUConfigUpdate + * Function : freeCellsToModifyItem * * Functionality: Deallocating memory of variables allocated in * BuildAndSendDUConfigUpdate function * - * @params[in] F1AP_PDU_t *f1apDuCfg + * @params[in] Served_Cells_To_Modify_Item_t *modifyItem * * @return ROK - void * * ****************************************************************/ -void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg) + +void freeCellsToModifyItem(Served_Cells_To_Modify_Item_t *modifyItem) { - uint8_t i; - uint8_t idx; - GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP; - Served_Cells_To_Modify_List_t *cellsToModify; - Served_Cells_To_Modify_Item_t *modifyItem; - idx=0; - i=1; - if(f1apDuCfg != NULLP) + uint8_t arrIdx=0, servedPlmnIdx=0, sliceLstIdx=0; + ServedPLMNs_Item_t *servedPlmnItem = NULLP; + SliceSupportItem_t *sliceSupportItem = NULLP; + + DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf, modifyItem->oldNRCGI.pLMN_Identity.size); + DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf, modifyItem->oldNRCGI.nRCellIdentity.size); + + DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ + modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.size); + DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ + modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size); + + if(modifyItem->served_Cell_Information.servedPLMNs.list.array != NULLP) { - if(f1apDuCfg->choice.initiatingMessage != NULLP) + if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx] != NULLP) { - duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->\ - value.choice.GNBDUConfigurationUpdate; - if(duCfgUpdate->protocolIEs.list.array != NULLP) - { - if(duCfgUpdate->protocolIEs.list.array[i] != NULLP) - { - cellsToModify = &duCfgUpdate->protocolIEs.list.array[i]->\ - value.choice.Served_Cells_To_Modify_List; - if(cellsToModify->list.array != NULLP) - { - if(cellsToModify->list.array[idx] != NULLP) - { - modifyItem=&cellsToModify->list.array[idx]->value.choice.\ - Served_Cells_To_Modify_Item; - if(modifyItem->oldNRCGI.pLMN_Identity.buf != NULLP) - { - if(modifyItem->oldNRCGI.nRCellIdentity.buf != NULLP) - { - if(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf != NULLP) - { - if(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf - != NULLP) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.array\ - != NULLP) - { - if(!modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->pLMN_Identity.buf != NULLP) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->iE_Extensions!= NULLP) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->iE_Extensions->list.array != NULLP) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->iE_Extensions->list.array[idx]) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array !=NULLP) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[idx]!=NULLP) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[idx]->sNSSAI.sST.buf!=NULLP) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[idx]->sNSSAI.sD != NULLP) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[idx]->sNSSAI.sD->buf!=NULLP) - { - if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD - !=NULLP) - { - if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ - fDD->uL_NRFreqInfo.freqBandListNr.list.array!=NULLP) - { - if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ - fDD->uL_NRFreqInfo.freqBandListNr.list.array[idx]!=NULLP) - { - if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ - fDD->dL_NRFreqInfo.freqBandListNr.list.array !=NULLP) - { - if(modifyItem->served_Cell_Information.nR_Mode_Info.\ - choice.fDD->dL_NRFreqInfo.freqBandListNr.list.\ - array[idx]!= NULLP) - { - if(modifyItem->served_Cell_Information.\ - measurementTimingConfiguration.buf !=NULLP) - { - idx=2; - if(duCfgUpdate->protocolIEs.list.array[idx]->value.\ - choice.GNB_DU_ID.buf!=NULLP) - { - DU_FREE(duCfgUpdate->protocolIEs.list.\ - array[idx]->value.choice.GNB_DU_ID.buf,\ - duCfgUpdate->protocolIEs.list.array[idx]->\ - value.choice.GNB_DU_ID.size); - } - idx=0; - DU_FREE(modifyItem->served_Cell_Information.\ - measurementTimingConfiguration.\ - buf,modifyItem->served_Cell_Information.\ - measurementTimingConfiguration.size); - } - DU_FREE(modifyItem->served_Cell_Information.\ - nR_Mode_Info.choice.fDD->dL_NRFreqInfo.freqBandListNr.\ - list.array[idx],sizeof(FreqBandNrItem_t)); - } - DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info\ - .choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array,\ - modifyItem->served_Cell_Information.nR_Mode_Info.\ - choice.fDD->dL_NRFreqInfo.freqBandListNr.list.size); - } - DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.\ - choice.fDD->uL_NRFreqInfo.freqBandListNr.list.\ - array[idx],sizeof(FreqBandNrItem_t)); - } - DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.\ - choice.\ - fDD->uL_NRFreqInfo.freqBandListNr.list.\ - array,modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ - fDD->uL_NRFreqInfo.freqBandListNr.list.size); - } - DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\ - fDD,sizeof(FDD_Info_t)); - } - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->iE_Extensions->list.array[idx]->extensionValue.choice.\ - SliceSupportList.\ - list.array[idx]->sNSSAI.sD->buf,modifyItem->served_Cell_Information.\ - servedPLMNs.list.array[idx]->iE_Extensions->list.array[idx]->\ - extensionValue.choice.SliceSupportList.list.array[idx]->\ - sNSSAI.sD->size); - - } - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[idx]->sNSSAI.sD,sizeof(OCTET_STRING_t)); - } - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[idx]->sNSSAI.sST.buf,modifyItem->served_Cell_Information.\ - servedPLMNs.\ - list.array[idx]->iE_Extensions->list.array[idx]->extensionValue.choice.\ - SliceSupportList.list.array[idx]->sNSSAI.sST.size); - } - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array[idx],sizeof(SliceSupportItem_t)); - } - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\ - list.array,\ - modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\ - iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.list.size); - } - } - for(i=0;iserved_Cell_Information.servedPLMNs.list.\ - array[idx]->iE_Extensions->list.count;i++) - { - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->iE_Extensions->list.array[i],\ - sizeof(ServedPLMNs_ItemExtIEs_t )); - } - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->iE_Extensions->list.array,modifyItem->served_Cell_Information.servedPLMNs. - list.array[idx]->iE_Extensions->list.size); - } - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t)); - } - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\ - array[idx]->pLMN_Identity.buf, - modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->pLMN_Identity.size); - } - } - for(i=0;iserved_Cell_Information.servedPLMNs.list.count;i++) - { - if(modifyItem->served_Cell_Information.servedPLMNs.list.array[i] - != NULLP) - { - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[i],\ - sizeof(ServedPLMNs_Item_t)); - } - } - DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\ - modifyItem->served_Cell_Information.servedPLMNs.list.size); - } - DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\ - modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size); - } - DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\ - modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.size); - } - DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\ - modifyItem->oldNRCGI.nRCellIdentity.size); - } - DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,\ - modifyItem->oldNRCGI.pLMN_Identity.size); - } - } - for(i=0; ilist.count ;i++) - { - if(cellsToModify->list.array[i] != NULLP) - { - DU_FREE(cellsToModify->list.array[i],\ - sizeof(Served_Cells_To_Modify_ItemIEs_t)); - } - } - DU_FREE(cellsToModify->list.array,cellsToModify->list.size); - } - } - for(i=0;iprotocolIEs.list.count;i++) - { - if(duCfgUpdate->protocolIEs.list.array[i] !=NULLP) - { - DU_FREE(duCfgUpdate->protocolIEs.list.array[i],\ - sizeof(GNBDUConfigurationUpdateIEs_t)); - } - } - DU_FREE(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size); - } - DU_FREE(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); + servedPlmnItem = modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]; + + DU_FREE(servedPlmnItem->pLMN_Identity.buf,servedPlmnItem->pLMN_Identity.size); + + if(servedPlmnItem->iE_Extensions != NULLP) + { + if(servedPlmnItem->iE_Extensions->list.array != NULLP) + { + if(servedPlmnItem->iE_Extensions->list.array[arrIdx] != NULLP) + { + if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\ + list.array != NULLP) + { + for(sliceLstIdx =0; sliceLstIdxiE_Extensions->list.array[arrIdx]->\ + extensionValue.choice.SliceSupportList.list.count; sliceLstIdx++) + { + if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\ + list.array[sliceLstIdx] != NULLP) + { + + 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,\ + servedPlmnItem->iE_Extensions->list.array[arrIdx]->\ + extensionValue.choice.SliceSupportList.list.size); + } + } + for(servedPlmnIdx=0; servedPlmnIdx< servedPlmnItem->iE_Extensions->list.count ; servedPlmnIdx++) + { + 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(servedPlmnIdx=0; servedPlmnIdxserved_Cell_Information.servedPLMNs.list.count; servedPlmnIdx++) + { + 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); + } + + if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD != NULLP) + { + if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.freqBandListNr.list.array != NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.freqBandListNr.list.\ + array[arrIdx], sizeof(FreqBandNrItem_t)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.freqBandListNr.list.array, \ + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.freqBandListNr.list.size); + } + + if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array != NULLP) + { + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.freqBandListNr.list.\ + array[arrIdx], sizeof(FreqBandNrItem_t)); + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array,\ + modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.freqBandListNr.list.size); + } + DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD,sizeof(FDD_Info_t)); + } + + DU_FREE(modifyItem->served_Cell_Information.measurementTimingConfiguration.buf,\ + modifyItem->served_Cell_Information.measurementTimingConfiguration.size); +} + +/******************************************************************* + * + * @brief Deallocating memory of BuildAndSendDUConfigUpdate + * + * @details + * + * Function : FreeDUConfigUpdate + * + * Functionality: Deallocating memory of variables allocated in + * BuildAndSendDUConfigUpdate function + * + * @params[in] F1AP_PDU_t *f1apDuCfg + * + * @return ROK - void + * + * ****************************************************************/ +void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg) +{ + uint8_t ieIdx=0, cellModifyIdx=0, cellDeleteIdx=0; + GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP; + Served_Cells_To_Modify_List_t *cellsToModify=NULLP; + Served_Cells_To_Delete_List_t *cellsToDelete=NULLP; + Served_Cells_To_Delete_Item_t *deleteItem = NULLP; + Served_Cells_To_Delete_ItemIEs_t *deleteItemIe = NULLP; + + if(f1apDuCfg != NULLP) + { + if(f1apDuCfg->choice.initiatingMessage != NULLP) + { + duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->\ + value.choice.GNBDUConfigurationUpdate; + if(duCfgUpdate->protocolIEs.list.array != NULLP) + { + for(ieIdx=0; ieIdxprotocolIEs.list.count; ieIdx++) + { + if(duCfgUpdate->protocolIEs.list.array[ieIdx] != NULLP) + { + switch(duCfgUpdate->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_Served_Cells_To_Modify_List: + { + cellsToModify = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\ + value.choice.Served_Cells_To_Modify_List; + if(cellsToModify->list.array != NULLP) + { + for(cellModifyIdx=0; cellModifyIdxlist.count ;cellModifyIdx++) + { + if(cellsToModify->list.array[cellModifyIdx] != NULLP) + { + freeCellsToModifyItem(&cellsToModify->list.array[cellModifyIdx]->value.choice.\ + Served_Cells_To_Modify_Item); + DU_FREE(cellsToModify->list.array[cellModifyIdx],\ + sizeof(Served_Cells_To_Modify_ItemIEs_t)); + } + } + DU_FREE(cellsToModify->list.array,cellsToModify->list.size); + } + break; + } + case ProtocolIE_ID_id_Served_Cells_To_Delete_List: + { + cellsToDelete = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\ + value.choice.Served_Cells_To_Delete_List; + if(cellsToDelete->list.array != NULLP) + { + for(cellDeleteIdx=0; cellDeleteIdxlist.count ;cellDeleteIdx++) + { + if(cellsToDelete->list.array[cellDeleteIdx] != NULLP) + { + deleteItemIe = ((Served_Cells_To_Delete_ItemIEs_t*)\ + cellsToDelete->list.array[cellDeleteIdx]); + deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item; + DU_FREE(deleteItem->oldNRCGI.pLMN_Identity.buf,\ + deleteItem->oldNRCGI.pLMN_Identity.size); + DU_FREE(deleteItem->oldNRCGI.nRCellIdentity.buf,\ + deleteItem->oldNRCGI.nRCellIdentity.size); + DU_FREE(cellsToDelete->list.array[cellDeleteIdx],\ + sizeof(Served_Cells_To_Delete_ItemIEs_t)); + } + } + DU_FREE(cellsToDelete->list.array,cellsToDelete->list.size); + } + + break; + } + case ProtocolIE_ID_id_gNB_DU_ID: + { + DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\ + duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size); + break; + } + } + DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx],\ + sizeof(GNBDUConfigurationUpdateIEs_t)); + } + } + DU_FREE(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size); + } + DU_FREE(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); } DU_FREE(f1apDuCfg, (Size)sizeof(F1AP_PDU_t)); } @@ -1840,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; } } - //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; + + 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); + } return ROK; } @@ -2072,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*/ @@ -2170,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)) @@ -2228,6 +2483,111 @@ uint8_t buildServCellToModList(Served_Cells_To_Modify_List_t *cellsToModify) else return ROK; } +/******************************************************************* + * + * @brief filling the DeleteItemList + * + * @details + * + * Function : fillCellToDeleteItem + * + * Functionality: Filling the DeleteItemIe + * + * @params[in] Pointer to Served_Cells_To_Delete_ItemIEs_t + * + * @return ROK - success + * RFAILED - failure + * + *****************************************************************/ +uint8_t fillCellToDeleteItem(struct Served_Cells_To_Delete_ItemIEs *deleteItemIe) +{ + uint8_t arrIdx; + Served_Cells_To_Delete_Item_t *deleteItem=NULLP; + + deleteItemIe->id = ProtocolIE_ID_id_Served_Cells_To_Delete_Item; + deleteItemIe->criticality = Criticality_reject; + deleteItemIe->value.present =\ + Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item; + deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item; + + /*pLMN_Identity*/ + deleteItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t); + DU_ALLOC(deleteItem->oldNRCGI.pLMN_Identity.buf,deleteItem->oldNRCGI.pLMN_Identity.size); + if(deleteItem->oldNRCGI.pLMN_Identity.buf == NULLP) + { + DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory"); + return RFAILED; + } + buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\ + deleteItem->oldNRCGI.pLMN_Identity.buf); + + /*nRCellIdentity*/ + deleteItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t); + DU_ALLOC(deleteItem->oldNRCGI.nRCellIdentity.buf,\ + deleteItem->oldNRCGI.nRCellIdentity.size); + if(deleteItem->oldNRCGI.nRCellIdentity.buf == NULLP) + { + DU_LOG("ERROR --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory"); + return RFAILED; + } + for(arrIdx = 0; arrIdx < deleteItem->oldNRCGI.nRCellIdentity.size-1; arrIdx++) + { + deleteItem->oldNRCGI.nRCellIdentity.buf[arrIdx] = 0; + } + deleteItem->oldNRCGI.nRCellIdentity.buf[4] = duCfgParam.sib1Params.cellIdentity; + deleteItem->oldNRCGI.nRCellIdentity.bits_unused = 4; + return ROK; +} +/******************************************************************* + * + * @brief Builds ServCellToDeleteList + * + * @details + * + * Function : buildServCellToDeleteList + * + * Functionality: Builds the serv cell to delete List + * + * @params[in] Pointer to Served_Cells_To_Delete_List_t * + * + * @return ROK - success + * RFAILED - failure + * + *****************************************************************/ + +uint8_t buildServCellToDeleteList(Served_Cells_To_Delete_List_t *cellsToDelete) +{ + uint8_t ieListCnt, arrIdx; + + ieListCnt = 1; + cellsToDelete->list.count = ieListCnt; + cellsToDelete->list.size = ieListCnt*sizeof(Served_Cells_To_Delete_ItemIEs_t *); + + DU_ALLOC(cellsToDelete->list.array,cellsToDelete->list.size); + if(cellsToDelete->list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed"); + return RFAILED; + } + + for(arrIdx=0; arrIdx< ieListCnt; arrIdx++) + { + DU_ALLOC(cellsToDelete->list.array[arrIdx],sizeof(Served_Cells_To_Delete_ItemIEs_t)); + if(cellsToDelete->list.array[arrIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : buildServCellToDeleteList(): Memory allocation failed"); + return RFAILED; + } + } + + arrIdx=0; + if(fillCellToDeleteItem((Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx]) !=ROK) + { + DU_LOG("\nERROR --> F1AP: buildServCellToDeleteList(): failed to fill Served_Cells_To_Delete_ItemIEs"); + return RFAILED; + } + return ROK; +} /******************************************************************* * @@ -2247,12 +2607,14 @@ uint8_t buildServCellToModList(Served_Cells_To_Modify_List_t *cellsToModify) * RFAILED - failure * * ****************************************************************/ -uint8_t BuildAndSendDUConfigUpdate() +uint8_t BuildAndSendDUConfigUpdate(ServCellAction servCellAction) { - uint8_t ret, ieIdx, elementCnt; + uint8_t ret =0, ieIdx=0, elementCnt=0; + bool memAlloctionFailure = false; F1AP_PDU_t *f1apDuCfg = NULLP; GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP; asn_enc_rval_t encRetVal; /* Encoder return value */ + memset(&encRetVal, 0, sizeof(asn_enc_rval_t)); ret= RFAILED; @@ -2263,78 +2625,106 @@ uint8_t BuildAndSendDUConfigUpdate() DU_ALLOC(f1apDuCfg, sizeof(F1AP_PDU_t)); if(f1apDuCfg == NULLP) { - DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed"); - break; + DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed"); + break; } f1apDuCfg->present = F1AP_PDU_PR_initiatingMessage; DU_ALLOC(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); if(f1apDuCfg->choice.initiatingMessage == NULLP) { - DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed"); - break; + DU_LOG("\nERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed"); + break; } f1apDuCfg->choice.initiatingMessage->procedureCode = \ - ProcedureCode_id_gNBDUConfigurationUpdate; + ProcedureCode_id_gNBDUConfigurationUpdate; f1apDuCfg->choice.initiatingMessage->criticality = Criticality_reject; f1apDuCfg->choice.initiatingMessage->value.present = \ - InitiatingMessage__value_PR_GNBDUConfigurationUpdate; + InitiatingMessage__value_PR_GNBDUConfigurationUpdate; duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->value.\ - choice.GNBDUConfigurationUpdate; + choice.GNBDUConfigurationUpdate; elementCnt = 3; duCfgUpdate->protocolIEs.list.count = elementCnt; duCfgUpdate->protocolIEs.list.size = \ - elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t*); + elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t*); /* Initialize the F1Setup members */ DU_ALLOC(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size); if(duCfgUpdate->protocolIEs.list.array == NULLP) { - DU_LOG("ERROR --> F1AP : Memory allocation for F1RequestIEs failed"); - break; + DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed"); + break; } for(ieIdx=0; ieIdxprotocolIEs.list.array[ieIdx],sizeof(GNBDUConfigurationUpdateIEs_t)); - if(duCfgUpdate->protocolIEs.list.array[ieIdx] == NULLP) - { - break; - } + DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx],sizeof(GNBDUConfigurationUpdateIEs_t)); + if(duCfgUpdate->protocolIEs.list.array[ieIdx] == NULLP) + { + DU_LOG("ERROR --> F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed"); + memAlloctionFailure = true; + break; + } + } + + if(memAlloctionFailure == true) + { + break; } - /*TransactionID*/ ieIdx = 0; duCfgUpdate->protocolIEs.list.array[ieIdx]->id=ProtocolIE_ID_id_TransactionID; duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject; duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \ - GNBDUConfigurationUpdateIEs__value_PR_TransactionID; + GNBDUConfigurationUpdateIEs__value_PR_TransactionID; duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = TRANS_ID; - - /*Served Cell to Modify */ + ieIdx++; - duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \ - ProtocolIE_ID_id_Served_Cells_To_Modify_List; - duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject; - duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \ - GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List; - if(buildServCellToModList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\ - Served_Cells_To_Modify_List)) - break; - + if(servCellAction == SERV_CELL_TO_MODIFY) + { + /*Served Cell to Modify */ + duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \ + ProtocolIE_ID_id_Served_Cells_To_Modify_List; + duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject; + duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \ + GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List; + if(buildServCellToModList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\ + Served_Cells_To_Modify_List)) + { + DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToModList"); + break; + } + } + else + { + /*Served Cell to Delete */ + duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \ + ProtocolIE_ID_id_Served_Cells_To_Delete_List; + duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject; + duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \ + GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List; + if(buildServCellToDeleteList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\ + Served_Cells_To_Delete_List)!=ROK) + { + DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToDeleteList"); + break; + } + + } // NOTE :GNB DU SYS INFO:MIB AND SIB1 INFORMATION TO BE BUILT AND FILLED HERE /*GNB DU ID */ ieIdx++; duCfgUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID; duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \ - GNBDUConfigurationUpdateIEs__value_PR_GNB_DU_ID; + GNBDUConfigurationUpdateIEs__value_PR_GNB_DU_ID; duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size = sizeof(uint8_t); DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\ - duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size); + duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size); if(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == NULLP) { - break; + DU_LOG("ERROR --> DU APP : BuildAndSendDUConfigUpdate(): Memory allocation failed for GNB_DU_ID"); + break; } duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] = duCfgParam.duId; @@ -2348,30 +2738,30 @@ uint8_t BuildAndSendDUConfigUpdate() /* Checking encode results */ if(encRetVal.encoded == ENCODE_FAIL) { - DU_LOG("ERROR --> F1AP : Could not encode DUConfigUpdate structure (at %s)\n",\ - encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); - break; + DU_LOG("ERROR --> F1AP : Could not encode DUConfigUpdate structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + break; } else { - DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DUConfigUpdate\n"); - for(ieIdx =0; ieIdx < encBufSize; ieIdx++) - { - printf("%x",encBuf[ieIdx]); - } + DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DUConfigUpdate\n"); + for(ieIdx =0; ieIdx < encBufSize; ieIdx++) + { + printf("%x",encBuf[ieIdx]); + } } /* Sending msg */ - if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK) + if(sendF1APMsg() != ROK) { - DU_LOG("\nERROR --> F1AP : Sending GNB-DU Config Update failed"); - break; + DU_LOG("\nERROR --> F1AP : Sending GNB-DU Config Update failed"); + break; } ret = ROK; break; } - FreeDUConfigUpdate(f1apDuCfg); - + + addToReservedF1apPduList(TRANS_ID,f1apDuCfg); return ret; } @@ -2565,7 +2955,7 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb ueCb, uint8_t lcId, \ } /* Sending msg */ - if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK) + if(sendF1APMsg() != ROK) { DU_LOG("\nERROR --> F1AP : Sending UL RRC Message Transfer Failed"); break; @@ -3065,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; @@ -3451,7 +3841,7 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList * return RFAILED; } - elementCnt = 1; + elementCnt = 2; timeDomAllocList->choice.setup->list.count = elementCnt; timeDomAllocList->choice.setup->list.size = \ elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *); @@ -3479,12 +3869,29 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList * idx = 0; timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx]; - - timeDomAlloc->k0 = NULLP; + DU_ALLOC(timeDomAlloc->k0, sizeof(long)); + if(!timeDomAlloc->k0) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList"); + return RFAILED; + } + *(timeDomAlloc->k0) = 0; timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A; timeDomAlloc->startSymbolAndLength = \ calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL); + idx++; + timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx]; + DU_ALLOC(timeDomAlloc->k0, sizeof(long)); + if(!timeDomAlloc->k0) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschTimeDomAllocList"); + return RFAILED; + } + *(timeDomAlloc->k0) = 1; + timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A; + timeDomAlloc->startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL); + return ROK; } @@ -3792,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 *); @@ -3825,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; } @@ -3915,6 +4335,60 @@ uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg) return ROK; } +/******************************************************************* + * + * @brief Builds BWP UL dedicated PUCCH Config + * + * @details + * + * Function : BuildBWPUlDedPucchCfg + * + * Functionality: + * Builds BWP UL dedicated PUCCH Config + * + * @params[in] : PUCCH_Config_t *pucchCfg + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildBWPUlDedPucchCfg(PUCCH_Config_t *pucchCfg) +{ + uint8_t arrIdx, elementCnt; + + DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK)); + if(pucchCfg->dl_DataToUL_ACK == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + + elementCnt = 2; + pucchCfg->dl_DataToUL_ACK->list.count = elementCnt; + pucchCfg->dl_DataToUL_ACK->list.size = elementCnt * sizeof(long *); + DU_ALLOC(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size); + if(pucchCfg->dl_DataToUL_ACK->list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + + for(arrIdx = 0; arrIdx < pucchCfg->dl_DataToUL_ACK->list.count; arrIdx++) + { + DU_ALLOC(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx], sizeof(long)); + if(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg"); + return RFAILED; + } + } + + arrIdx = 0; + *(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx++]) = 1; + *(pucchCfg->dl_DataToUL_ACK->list.array[arrIdx]) = 2; + return ROK; +} + /******************************************************************* * * @brief Fills SRS resource to add/modify list @@ -4249,31 +4723,51 @@ uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *pusch uint8_t BuildInitialUlBWP(BWP_UplinkDedicated_t *ulBwp) { ulBwp->pucch_Config = NULLP; - - /* Fill BWP UL dedicated PUSCH config */ - ulBwp->pusch_Config = NULLP; - DU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config)); - if(!ulBwp->pusch_Config) + DU_ALLOC(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config)); + if(!ulBwp->pucch_Config) { DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP"); return RFAILED; } - ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup; - ulBwp->pusch_Config->choice.setup = NULLP; - DU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t)); - if(!ulBwp->pusch_Config->choice.setup) + ulBwp->pucch_Config->present = BWP_UplinkDedicated__pucch_Config_PR_setup; + ulBwp->pucch_Config->choice.setup = NULLP; + DU_ALLOC(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t)); + if(!ulBwp->pucch_Config->choice.setup) { DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP"); return RFAILED; } - if(BuildBWPUlDedPuschCfg(ulBwp->pusch_Config->choice.setup) != ROK) + if(BuildBWPUlDedPucchCfg(ulBwp->pucch_Config->choice.setup) != ROK) { return RFAILED; } - ulBwp->configuredGrantConfig = NULLP; + /* Fill BWP UL dedicated PUSCH config */ + ulBwp->pusch_Config = NULLP; + DU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config)); + if(!ulBwp->pusch_Config) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP"); + return RFAILED; + } + + ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup; + ulBwp->pusch_Config->choice.setup = NULLP; + DU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t)); + if(!ulBwp->pusch_Config->choice.setup) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP"); + return RFAILED; + } + + if(BuildBWPUlDedPuschCfg(ulBwp->pusch_Config->choice.setup) != ROK) + { + return RFAILED; + } + + ulBwp->configuredGrantConfig = NULLP; /* Fill BPW UL dedicated SRS config */ ulBwp->srs_Config = NULLP; @@ -4796,7 +5290,7 @@ void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *se * * @return void * - 4221 * ****************************************************************/ + * ****************************************************************/ void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList) { uint8_t idx1=0; @@ -4805,16 +5299,17 @@ void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationL { if(timeDomAllocList->choice.setup->list.array) { - for(idx1 = 0; idx1 choice.setup->list.count ; idx1++) - { - DU_FREE(timeDomAllocList->choice.setup->list.array[idx1], - sizeof(struct PDSCH_TimeDomainResourceAllocation)); - } - DU_FREE(timeDomAllocList->choice.setup->list.array, \ - timeDomAllocList->choice.setup->list.size); + for(idx1 = 0; idx1 choice.setup->list.count ; idx1++) + { + DU_FREE(timeDomAllocList->choice.setup->list.array[idx1]->k0, sizeof(long)); + DU_FREE(timeDomAllocList->choice.setup->list.array[idx1], + sizeof(struct PDSCH_TimeDomainResourceAllocation)); + } + DU_FREE(timeDomAllocList->choice.setup->list.array, \ + timeDomAllocList->choice.setup->list.size); } DU_FREE(timeDomAllocList->choice.setup,\ - sizeof(struct PDSCH_TimeDomainResourceAllocationList)); + sizeof(struct PDSCH_TimeDomainResourceAllocationList)); } } /******************************************************************* @@ -4834,8 +5329,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) @@ -4843,23 +5337,23 @@ 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)); } } @@ -4880,122 +5374,145 @@ void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg) * ****************************************************************/ void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp) { - uint8_t rSetIdx, rsrcIdx; + uint8_t rSetIdx, rsrcIdx, k1Idx; 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)); + } + if(ulBwp->pusch_Config) { if(ulBwp->pusch_Config->choice.setup) { - puschCfg=ulBwp->pusch_Config->choice.setup; - if(puschCfg->dataScramblingIdentityPUSCH) - { - if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) - { - FreePuschTimeDomAllocList(puschCfg); - dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA; - if(dmrsUlCfg->choice.setup) - { - if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) - { - if(dmrsUlCfg->choice.setup->transformPrecodingDisabled) - { - DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\ - sizeof(long)); - DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled, - sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled)); - } - DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition, - sizeof(long)); - } - DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t)); - } - DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \ - sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA)); - } - DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long)); - } - DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t)); + puschCfg=ulBwp->pusch_Config->choice.setup; + if(puschCfg->dataScramblingIdentityPUSCH) + { + if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) + { + FreePuschTimeDomAllocList(puschCfg); + dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA; + if(dmrsUlCfg->choice.setup) + { + if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) + { + if(dmrsUlCfg->choice.setup->transformPrecodingDisabled) + { + DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\ + sizeof(long)); + DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled, + sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled)); + } + DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition, + sizeof(long)); + } + DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t)); + } + DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \ + sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA)); + } + DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long)); + } + DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t)); } DU_FREE(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config)); /* Free SRS-Config */ if(ulBwp->srs_Config) { - if(ulBwp->srs_Config->choice.setup) - { - srsCfg = ulBwp->srs_Config->choice.setup; + if(ulBwp->srs_Config->choice.setup) + { + srsCfg = ulBwp->srs_Config->choice.setup; - /* Free Resource Set to add/mod list */ - if(srsCfg->srs_ResourceSetToAddModList) - { - rsrcSetList = srsCfg->srs_ResourceSetToAddModList; - if(rsrcSetList->list.array) - { - rSetIdx = 0; + /* Free Resource Set to add/mod list */ + if(srsCfg->srs_ResourceSetToAddModList) + { + rsrcSetList = srsCfg->srs_ResourceSetToAddModList; + if(rsrcSetList->list.array) + { + rSetIdx = 0; - /* Free SRS resource Id list in this SRS resource set */ - if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList) - { - rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList; + /* Free SRS resource Id list in this SRS resource set */ + if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList) + { + rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList; - if(rsrcIdList->list.array) - { - for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++) - { - DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t)); - } - DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size); - } - DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\ - sizeof(struct SRS_ResourceSet__srs_ResourceIdList)); - } + if(rsrcIdList->list.array) + { + for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++) + { + DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t)); + } + DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size); + } + DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\ + sizeof(struct SRS_ResourceSet__srs_ResourceIdList)); + } - /* Free resource type info for this SRS resource set */ - DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \ - sizeof(struct SRS_ResourceSet__resourceType__aperiodic)); + /* Free resource type info for this SRS resource set */ + DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \ + sizeof(struct SRS_ResourceSet__resourceType__aperiodic)); - /* Free memory for each resource set */ - for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++) - { - DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t)); - } - DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size); - } - DU_FREE(srsCfg->srs_ResourceSetToAddModList, \ - sizeof(struct SRS_Config__srs_ResourceSetToAddModList)); - } + /* Free memory for each resource set */ + for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++) + { + DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t)); + } + DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size); + } + DU_FREE(srsCfg->srs_ResourceSetToAddModList, \ + sizeof(struct SRS_Config__srs_ResourceSetToAddModList)); + } - /* Free resource to add/modd list */ - if(srsCfg->srs_ResourceToAddModList) - { - resourceList = srsCfg->srs_ResourceToAddModList; - if(resourceList->list.array) - { - rsrcIdx = 0; - DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\ - sizeof(struct SRS_Resource__transmissionComb__n2)); - DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\ - sizeof(struct SRS_Resource__resourceType__aperiodic)); + /* Free resource to add/modd list */ + if(srsCfg->srs_ResourceToAddModList) + { + resourceList = srsCfg->srs_ResourceToAddModList; + if(resourceList->list.array) + { + rsrcIdx = 0; + DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\ + sizeof(struct SRS_Resource__transmissionComb__n2)); + DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\ + sizeof(struct SRS_Resource__resourceType__aperiodic)); - for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++) - { - DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t)); - } - DU_FREE(resourceList->list.array, resourceList->list.size); - } - DU_FREE(srsCfg->srs_ResourceToAddModList, \ - sizeof(struct SRS_Config__srs_ResourceToAddModList)); - } + for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++) + { + DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t)); + } + DU_FREE(resourceList->list.array, resourceList->list.size); + } + DU_FREE(srsCfg->srs_ResourceToAddModList, \ + sizeof(struct SRS_Config__srs_ResourceToAddModList)); + } - DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t)); - } - DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config)); + DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t)); + } + DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config)); } } } @@ -5207,37 +5724,37 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg) { if(rlcBearerList->list.array) { - for(idx=0; idxlist.count; idx++) - { - if(rlcBearerList->list.array[idx]) - { - rlcConfig = rlcBearerList->list.array[idx]->rlc_Config; - macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig; - if(rlcConfig) - { - if(rlcConfig->choice.am) - { - DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); - DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); - DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am)); - } - DU_FREE(rlcConfig, sizeof(struct RLC_Config)); - } - DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer)); - if(macLcConfig) - { - if(macLcConfig->ul_SpecificParameters) - { - DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t)); - DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long)); - DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters)); - } - DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig)); - } - DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig)); - } - } - DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size); + for(idx=0; idxlist.count; idx++) + { + if(rlcBearerList->list.array[idx]) + { + rlcConfig = rlcBearerList->list.array[idx]->rlc_Config; + macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig; + if(rlcConfig) + { + if(rlcConfig->choice.am) + { + DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); + DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); + DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am)); + } + DU_FREE(rlcConfig, sizeof(struct RLC_Config)); + } + DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer)); + if(macLcConfig) + { + if(macLcConfig->ul_SpecificParameters) + { + DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID, sizeof(SchedulingRequestId_t)); + DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup, sizeof(long)); + DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters)); + } + DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig)); + } + DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig)); + } + } + DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size); } DU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList)); } @@ -5248,53 +5765,53 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg) schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig; if(schedulingRequestConfig) { - schReqList = schedulingRequestConfig->schedulingRequestToAddModList; - if(schReqList) - { - if(schReqList->list.array) - { - for(idx=0;idxlist.count; idx++) - { - if(schReqList->list.array[idx]) - { - DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long)); - DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod)); - } - } - DU_FREE(schReqList->list.array, schReqList->list.size); - } - DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\ - sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList)); } - DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig)); + schReqList = schedulingRequestConfig->schedulingRequestToAddModList; + if(schReqList) + { + if(schReqList->list.array) + { + for(idx=0;idxlist.count; idx++) + { + if(schReqList->list.array[idx]) + { + DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long)); + DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod)); + } + } + DU_FREE(schReqList->list.array, schReqList->list.size); + } + DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\ + sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList)); } + DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig)); } if(macCellGrpCfg->bsr_Config) { - DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config)); + DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config)); } tagConfig = macCellGrpCfg->tag_Config; if(tagConfig) { - tagList = tagConfig->tag_ToAddModList; - if(tagList) - { - if(tagList->list.array) - { - for(idx=0; idxlist.count; idx++) - { - DU_FREE(tagList->list.array[idx], sizeof(struct TAG)); - } - DU_FREE(tagList->list.array, tagList->list.size); - } - DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList)); - } - DU_FREE(tagConfig, sizeof(struct TAG_Config)); + tagList = tagConfig->tag_ToAddModList; + if(tagList) + { + if(tagList->list.array) + { + for(idx=0; idxlist.count; idx++) + { + DU_FREE(tagList->list.array[idx], sizeof(struct TAG)); + } + DU_FREE(tagList->list.array, tagList->list.size); + } + DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList)); + } + DU_FREE(tagConfig, sizeof(struct TAG_Config)); } phrConfig = macCellGrpCfg->phr_Config; if(phrConfig) { - DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config)); - DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config)); + DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config)); + DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config)); } DU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t)); @@ -5312,59 +5829,59 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg) { if(spCellCfg->servCellIndex) { - if(spCellCfg->rlmInSyncOutOfSyncThreshold) - { - if(spCellCfg->spCellConfigDedicated) - { - srvCellCfg = spCellCfg->spCellConfigDedicated; - if(srvCellCfg->tdd_UL_DL_ConfigurationDedicated) - { - if(srvCellCfg->initialDownlinkBWP) - { - dlBwp = srvCellCfg->initialDownlinkBWP; - if(srvCellCfg->firstActiveDownlinkBWP_Id) - { - if(srvCellCfg->defaultDownlinkBWP_Id) - { - if(srvCellCfg->uplinkConfig) - { - if(srvCellCfg->pdsch_ServingCellConfig) - { - pdschCfg= srvCellCfg->pdsch_ServingCellConfig; - if(pdschCfg->choice.setup) - { - DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long)); - DU_FREE(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig)); - } - DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct - ServingCellConfig__pdsch_ServingCellConfig)); - } - FreeinitialUplinkBWP(srvCellCfg->uplinkConfig); - DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t)); - } - DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long)); - } - DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long)); - } - if(dlBwp->pdcch_Config) - { - if(dlBwp->pdsch_Config) - { - FreeBWPDlDedPdschCfg(dlBwp); - DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config)); - } - FreeBWPDlDedPdcchCfg(dlBwp); - DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config)); - } - DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t)); - } - DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t)); - } - DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t)); - } - DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long)); - } - DU_FREE(spCellCfg->servCellIndex, sizeof(long)); + if(spCellCfg->rlmInSyncOutOfSyncThreshold) + { + if(spCellCfg->spCellConfigDedicated) + { + srvCellCfg = spCellCfg->spCellConfigDedicated; + if(srvCellCfg->tdd_UL_DL_ConfigurationDedicated) + { + if(srvCellCfg->initialDownlinkBWP) + { + dlBwp = srvCellCfg->initialDownlinkBWP; + if(srvCellCfg->firstActiveDownlinkBWP_Id) + { + if(srvCellCfg->defaultDownlinkBWP_Id) + { + if(srvCellCfg->uplinkConfig) + { + if(srvCellCfg->pdsch_ServingCellConfig) + { + pdschCfg= srvCellCfg->pdsch_ServingCellConfig; + if(pdschCfg->choice.setup) + { + DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long)); + DU_FREE(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig)); + } + DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct + ServingCellConfig__pdsch_ServingCellConfig)); + } + FreeinitialUplinkBWP(srvCellCfg->uplinkConfig); + DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t)); + } + DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long)); + } + DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long)); + } + if(dlBwp->pdcch_Config) + { + if(dlBwp->pdsch_Config) + { + FreeBWPDlDedPdschCfg(dlBwp); + DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config)); + } + FreeBWPDlDedPdcchCfg(dlBwp); + DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config)); + } + DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t)); + } + DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t)); + } + DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t)); + } + DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long)); + } + DU_FREE(spCellCfg->servCellIndex, sizeof(long)); } DU_FREE(spCellCfg,sizeof(SpCellConfig_t)); } @@ -5762,7 +6279,7 @@ uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti } } /* Sending msg */ - if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK) + if(sendF1APMsg() != ROK) { DU_LOG("\nERROR --> F1AP : Sending Initial UL RRC Message Transfer Failed"); ret = RFAILED; @@ -5820,48 +6337,45 @@ void freeRlcLcCfg(RlcBearerCfg *lcCfg) switch(lcCfg->rlcMode) { case RLC_AM : - { - if(lcCfg->u.amCfg) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg)); - lcCfg->u.amCfg = NULLP; - } - break; - } + { + if(lcCfg->u.amCfg) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg)); + } + break; + } case RLC_UM_BI_DIRECTIONAL : - { - if(lcCfg->u.umBiDirCfg) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg)); - lcCfg->u.umBiDirCfg = NULLP; + { + if(lcCfg->u.umBiDirCfg) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg)); + } + break; } - break; - } case RLC_UM_UNI_DIRECTIONAL_UL : - { - if(lcCfg->u.umUniDirUlCfg) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg)); - lcCfg->u.umUniDirUlCfg = NULLP; - } - break; + { + if(lcCfg->u.umUniDirUlCfg) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg)); + } + break; - } + } case RLC_UM_UNI_DIRECTIONAL_DL : - { - if(lcCfg->u.umUniDirDlCfg) - { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg)); - lcCfg->u.umUniDirDlCfg = NULLP; + { + if(lcCfg->u.umUniDirDlCfg) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg)); + } + break; } - break; - } default: DU_LOG("\nERROR --> DU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode); - break; + break; } - memset(lcCfg, 0, sizeof(LcCfg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai)); } + /******************************************************************* * * @brief Function to free MacLcCfg @@ -5883,15 +6397,12 @@ void freeMacLcCfg(LcCfg *lcCfg) if(lcCfg->drbQos) { DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo)); - lcCfg->drbQos = NULLP; } /* Deleting SNSSAI */ if(lcCfg->snssai) { DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai)); - lcCfg->snssai = NULLP; } - memset(lcCfg, 0, sizeof(LcCfg)); } /******************************************************************* * @@ -6618,7 +7129,6 @@ void freeDuUeCfg(DuUeCfg *ueCfg) } if(ueCfg->ambrCfg) { - memset(ueCfg->ambrCfg, 0, sizeof(AmbrCfg)); DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg)); } for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++) @@ -6629,6 +7139,10 @@ void freeDuUeCfg(DuUeCfg *ueCfg) { freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]); } + for(lcIdx = 0; lcIdx < ueCfg->numDrb; lcIdx++) + { + DU_FREE(ueCfg->upTnlInfo[lcIdx].tnlCfg1, sizeof(GtpTnlCfg)); + } } /******************************************************************* @@ -6653,10 +7167,10 @@ void freeF1UeDb(F1UeContextSetupDb *f1UeDb) { if(f1UeDb->dlRrcMsg->rrcMsgPdu) { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\ - f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize); + //DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\ + f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize); } - memset(f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg)); } freeDuUeCfg(&f1UeDb->duUeCfg); memset(f1UeDb, 0, sizeof(F1UeContextSetupDb)); @@ -6688,7 +7202,8 @@ void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg) if(rlcAmCfg->dl_AM_RLC.sn_FieldLength) { amCfgToSet->ulAmCfg.snLenUl = *(rlcAmCfg->dl_AM_RLC.sn_FieldLength); - amCfgToSet->ulAmCfg.reAssemTmr = rlcAmCfg->dl_AM_RLC.t_Reassembly; + /*TODO: Check the timer value when sent by real CU */ + amCfgToSet->ulAmCfg.reAssemTmr = rlcAmCfg->dl_AM_RLC.t_Reassembly; amCfgToSet->ulAmCfg.statProhTmr = rlcAmCfg->dl_AM_RLC.t_StatusProhibit; } @@ -6817,21 +7332,21 @@ void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lc case RLC_AM : { if(lcCfg->choice.am) - { + { DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg)); - if(rlcDbCfg->u.amCfg) - extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am); - } + if(rlcDbCfg->u.amCfg) + extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am); + } break; } case RLC_UM_BI_DIRECTIONAL : { if(lcCfg->choice.um_Bi_Directional) - { + { DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg)); - if(rlcDbCfg->u.umBiDirCfg) + if(rlcDbCfg->u.umBiDirCfg) extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional); - } + } break; } case RLC_UM_UNI_DIRECTIONAL_UL : @@ -6839,9 +7354,9 @@ void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lc if(lcCfg->choice.um_Uni_Directional_DL) { DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg)); - if(rlcDbCfg->u.umUniDirUlCfg) + if(rlcDbCfg->u.umUniDirUlCfg) extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL); - } + } break; } case RLC_UM_UNI_DIRECTIONAL_DL : @@ -6849,9 +7364,9 @@ void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lc if(lcCfg->choice.um_Uni_Directional_UL) { DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg)); - if(rlcDbCfg->u.umUniDirDlCfg) + if(rlcDbCfg->u.umUniDirDlCfg) extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL); - } + } break; } default: @@ -6902,6 +7417,48 @@ void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg) } } +/******************************************************************* +* +* @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 @@ -6919,8 +7476,9 @@ void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg) * ****************************************************************/ void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\ - uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg) + uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg, QoSInformation_t *qoSInformation) { + DRB_Information_t *drbInfo; lcCfg->rbId = rbId; lcCfg->configType = configType; @@ -6943,10 +7501,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 @@ -6965,104 +7537,288 @@ 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; } -uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd) +/******************************************************************* + * + * @brief Function to extract GTP Tunnel Info from CU + * + * @details + * + * Function : extractUpTnlInfo + * + * Functionality: Function to extract GTP Tunnel Info from CU + * + * @params[in] F1AP message + * @return ROK/RFAILED + * + * ****************************************************************/ + +uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\ + ULUPTNLInformation_ToBeSetup_List_t *tnlInfo, UpTnlCfg *upTnlInfo) { - DRB_Information_t *drbInfo = NULLP; + uint8_t tnlIdx; + uint32_t ipv4_du = 0; + GTPTunnel_t *gtpTunnel = NULLP; + + upTnlInfo->drbId = drbId; + upTnlInfo->configType = configType; +#ifdef O1_ENABLE + cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du); +#else + cmInetAddr((char *)DU_IP_V4_ADDR, &ipv4_du); +#endif - if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension) + for(tnlIdx=0; tnlIdx < tnlInfo->list.count; tnlIdx++) { - if(drbItem->qoSInformation.choice.choice_extension->value.present == - QoSInformation_ExtIEs__value_PR_DRB_Information) + if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.present == UPTransportLayerInformation_PR_gTPTunnel) { - drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information; - - if(!macLcToAdd->drbQos) + if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel) { - DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo)); - if(macLcToAdd->drbQos == NULLP) + gtpTunnel = tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel; + DU_ALLOC(upTnlInfo->tnlCfg1, sizeof(GtpTnlCfg)); + if(upTnlInfo->tnlCfg1 == NULLP) { - DU_LOG("\nERROR --> DUAPP:Memory failed at allocating DrbQos at extractDrbCfg()"); - return RFAILED; + DU_LOG("\nERROR --> F1AP : extractUpTnlInfo: Failed to allocate mmeory for tunnel cfg 1"); + return RFAILED; } - - } - if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI) - { - extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS); - macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel; - } - if(!macLcToAdd->snssai) - { - DU_ALLOC_SHRABL_BUF(macLcToAdd->snssai, sizeof(Snssai)); - if(macLcToAdd->snssai == NULLP) + bitStringToInt(>pTunnel->transportLayerAddress, &upTnlInfo->tnlCfg1->ulTnlAddress); + upTnlInfo->tnlCfg1->dlTnlAddress = ipv4_du; + if(gtpTunnel->gTP_TEID.size > 0) { - DU_LOG("\nERROR --> DUAPP : Memory failed at allocating SNSSAI at extractDrbCfg()"); - return RFAILED; + teIdStringToInt(gtpTunnel->gTP_TEID.buf, &upTnlInfo->tnlCfg1->teId); } } - memcpy(&macLcToAdd->snssai->sst, drbInfo->sNSSAI.sST.buf, \ - drbInfo->sNSSAI.sST.size); - if(drbInfo->sNSSAI.sD) - { - memcpy(macLcToAdd->snssai->sd, drbInfo->sNSSAI.sD->buf, \ - drbInfo->sNSSAI.sD->size); - } - }/*End of DRB Info*/ + break; + } } return ROK; } -uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg) +/******************************************************************* +* +* @brief Function to extract Drb Qos Cfg Info from CU +* +* @details +* +* Function : extractDrbQosCfg +* +* Functionality: Function to extract Drb Qos Cfg Info from CU +* +* @params[in] DRB_Information_t *drbInfo, LcCfg *macLcToAdd +* @return ROK/RFAILED +* +* ****************************************************************/ + +uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd ) { - uint8_t ret = ROK; + if(!macLcToAdd->drbQos) + { + DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo)); + if(macLcToAdd->drbQos == NULLP) + { + DU_LOG("\nERROR --> DUAPP:Memory failed at allocating DrbQos at extractDrbQosCfg()"); + return RFAILED; + } - if(drbCfg) + } + if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI) { - ret = extractDrbCfg(drbCfg, lcCfg); - if(ret == RFAILED) + extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS); + macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel; + } + if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &macLcToAdd->snssai) != ROK) + { + DU_LOG("\nERROR --> DUAPP: Unable to extract Snssai information at extractDrbQosCfg()"); + return RFAILED; + } + return ROK; +} +/******************************************************************* + * + * @brief Function to extract DRB info received from CU + * + * @details + * + * Function : extractDrbCfg + * + * Functionality: Function to extract DRB info received from CU + * + * @params[in] F1AP message + * @return void + * + * ****************************************************************/ +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; + + if(drbItem != NULLP) + { + if(extractUpTnlInfo(drbItem->dRBID, CONFIG_ADD, &drbItem->uLUPTNLInformation_ToBeSetup_List, upTnlInfo) != ROK) + { + DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()"); + return RFAILED; + } + if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension) + { + if(drbItem->qoSInformation.choice.choice_extension->value.present == QoSInformation_ExtIEs__value_PR_DRB_Information) + { + drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information; + if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK) + { + DU_LOG("\nERROR --> DUAPP : Failed to extract qos Cfg at extractDrbCfg()"); + return RFAILED; + } + } + } + } + else if(drbSetupModItem != NULLP) + { + if(extractUpTnlInfo(drbSetupModItem->dRBID, CONFIG_ADD, &drbSetupModItem->uLUPTNLInformation_ToBeSetup_List,\ + upTnlInfo) != ROK) + { + DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()"); + return RFAILED; + } + if(drbSetupModItem->qoSInformation.present == QoSInformation_PR_choice_extension) + { + if(drbSetupModItem->qoSInformation.choice.choice_extension->value.present ==\ + QoSInformation_ExtIEs__value_PR_DRB_Information) + { + drbInfo = &drbSetupModItem->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; + } + + } + } + } + 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; +} + +/******************************************************************* + * + * @brief Function to extract RB info received from CU + * + * @details + * + * Function : extractMacRbCfg + * + * Functionality: Function to extract RB info received from CU + * + * @params[in] F1AP message + * @return ROK/RFAILED + * + * ****************************************************************/ + +uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\ +DRBs_ToBeSetupMod_Item_t *drbSetupModCfg, DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo) +{ + if(drbCfg != NULLP) + { + if(extractDrbCfg(drbCfg, NULL, NULL, lcCfg, upTnlInfo) != ROK) + { + DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()"); + return RFAILED; + } + } + else if(drbSetupModCfg != NULLP) + { + 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 ret; + return RFAILED; } } else @@ -7081,11 +7837,27 @@ uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg, LogicalChan } else lcCfg->ulLcCfgPres = false; - return ret; + return ROK; } -uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\ - DRBs_ToBeSetup_Item_t *drbItem, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg) +/******************************************************************* + * + * @brief Function processing LC config info received from CU + * + * @details + * + * Function : procMacLcCfg + * + * Functionality: Function processing LC config info received from CU + * + * @params[in] F1AP message + * @return ROK/RFAILED + * + * ****************************************************************/ + +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; @@ -7093,11 +7865,16 @@ uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\ lcCfg->configType = configType; if(rbType == RB_TYPE_SRB) { - ret = extractMacRbCfg(lcId, NULL, ulLcCfg, lcCfg); + ret = extractMacRbCfg(lcId, NULL, NULL, NULL, ulLcCfg, lcCfg, NULL); } else if(rbType == RB_TYPE_DRB) { - ret = extractMacRbCfg(lcId, drbItem, ulLcCfg, lcCfg); + if(drbItem != NULL) + ret = extractMacRbCfg(lcId, drbItem, NULL, NULL, ulLcCfg, lcCfg, upTnlInfo); + else if(drbSetupModItem != NULL) + ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, NULL, ulLcCfg, lcCfg, upTnlInfo); + else if(drbModItem != NULL) + ret = extractMacRbCfg(lcId, NULL, NULL, drbModItem, ulLcCfg, lcCfg, upTnlInfo); } return ret; } @@ -7118,10 +7895,9 @@ uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\ * * ****************************************************************/ -uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, \ - DuUeCfg *ueCfgDb) +uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, DuUeCfg *ueCfgDb) { - uint8_t ret, idx, rbId, lcId, rlcMode, rbType; + uint8_t idx, rbId, lcId, rlcMode, rbType; RLC_Config_t *f1RlcCfg = NULLP; LogicalChannelConfig_t *macUlLcCfg = NULLP; @@ -7169,18 +7945,19 @@ 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])); - ret = procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx]); - if(ret == RFAILED) + 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 ret; + 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 ret; + return ROK; } /******************************************************************* @@ -7202,7 +7979,7 @@ void freeMacPdschServCellInfo(PdschServCellCfg *pdsch) { if(pdsch->xOverhead) { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(uint8_t)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(PdschXOverhead)); } if(pdsch->codeBlkGrpFlushInd) { @@ -7210,7 +7987,7 @@ void freeMacPdschServCellInfo(PdschServCellCfg *pdsch) } if(pdsch->maxCodeBlkGrpPerTb) { - DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(uint8_t)); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB)); } if(pdsch->maxMimoLayers) { @@ -7234,11 +8011,27 @@ void freeMacPdschServCellInfo(PdschServCellCfg *pdsch) * ****************************************************************/ void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg) { + uint8_t timeDomRsrcIdx; + + if(srvCellCfg->initDlBwp.pdschPresent) + { + for(timeDomRsrcIdx = 0; timeDomRsrcIdx < srvCellCfg->initDlBwp.pdschCfg.numTimeDomRsrcAlloc; timeDomRsrcIdx++) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \ + srvCellCfg->initDlBwp.pdschCfg.timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t)); + } + } + freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg); if(srvCellCfg->bwpInactivityTmr) { DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t)); } + + if(srvCellCfg->initUlBwp.pucchPresent) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->initUlBwp.pucchCfg.dlDataToUlAck, sizeof(PucchDlDataToUlAck)); + } } /******************************************************************* @@ -7403,31 +8196,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) @@ -7436,10 +8232,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]); - } + } } } @@ -7450,49 +8246,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 */ @@ -7502,11 +8298,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]); + } } } } @@ -7521,13 +8317,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; @@ -7535,13 +8337,13 @@ void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg) if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) { if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \ - PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup) + PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup) { if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup) - { + { macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \ - *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition); - } + *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition); + } } } macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation; @@ -7549,19 +8351,49 @@ void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg) { timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList; if(timeDomAlloc->present ==\ - PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup) + PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup) { if(timeDomAlloc->choice.setup) - { - macPdschCfg->numTimeDomRsrcAlloc = timeDomAlloc->choice.setup->list.count; + { + macPdschCfg->numTimeDomRsrcAlloc = timeDomAlloc->choice.setup->list.count; for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++) { - macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \ - timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType; - macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \ - timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength; - } - } + macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 = NULLP; + if(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0) + { + if(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 == NULL) + { + 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()"); + return RFAILED; + } + } + *(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) = \ + *(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0); + } + macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \ + timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType; + macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \ + timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength; + } + } } } macPdschCfg->rbgSize = cuPdschCfg->rbg_Size; @@ -7573,10 +8405,10 @@ void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg) if(cuPdschCfg->prb_BundlingType.choice.staticBundling) { if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize) - { + { macPdschCfg->bundlingInfo.StaticBundling.size = \ - *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize); - } + *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize); + } } } else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling) @@ -7615,7 +8447,7 @@ uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, } else { - DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(uint8_t)); + DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB)); if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) { *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb) = \ @@ -7634,7 +8466,7 @@ uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, } else { - DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(bool)); + DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->codeBlkGrpFlushInd , sizeof(bool)); if(macUePdschSrvCellCfg->codeBlkGrpFlushInd) { *(macUePdschSrvCellCfg->codeBlkGrpFlushInd) = \ @@ -7683,7 +8515,7 @@ uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, } else { - DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(uint8_t)); + DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(PdschXOverhead)); if(macUePdschSrvCellCfg->xOverhead) { *(macUePdschSrvCellCfg->xOverhead) = *(cuPdschSrvCellCfg->xOverhead); @@ -8200,13 +9032,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; @@ -8332,20 +9171,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 */ @@ -8375,12 +9228,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; @@ -8392,18 +9252,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) @@ -8420,15 +9310,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) @@ -8437,31 +9327,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; } @@ -8474,13 +9375,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; @@ -8493,79 +9401,93 @@ uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg /* Fill MacCell Group Reconfig */ if(cellGrp->mac_CellGroupConfig) { + macUeCfg->macCellGrpCfgPres = true; macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig)); if(macCellGroup->schedulingRequestConfig) - { + { extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg); - } + } if(macCellGroup->tag_Config) - { + { extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg); - } - if(macCellGroup->bsr_Config) - { + } + if(macCellGroup->bsr_Config) + { macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer; macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer = macCellGroup->bsr_Config->retxBSR_Timer; - if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer) - { + if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer) + { macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer =\ - *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer); - } - } - if(macCellGroup->phr_Config) - { - if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup) - { + *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer); + } + } + if(macCellGroup->phr_Config) + { + if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup) + { macUeCfg->macCellGrpCfg.phrCfgSetupPres = true; if(macCellGroup->phr_Config->choice.setup) - { - macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \ - macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer; - macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \ - macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer; - macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \ - macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange; - macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \ - macCellGroup->phr_Config->choice.setup->multiplePHR; - macUeCfg->macCellGrpCfg.phrCfg.dummy = \ - macCellGroup->phr_Config->choice.setup->dummy; - macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \ - macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell; - macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \ - macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG; - } - } - } + { + macUeCfg->macCellGrpCfg.phrCfg.periodicTimer = \ + macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer; + macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer = \ + macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer; + macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor = \ + macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange; + macUeCfg->macCellGrpCfg.phrCfg.multiplePHR = \ + macCellGroup->phr_Config->choice.setup->multiplePHR; + macUeCfg->macCellGrpCfg.phrCfg.dummy = \ + macCellGroup->phr_Config->choice.setup->dummy; + macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \ + macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell; + macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG = \ + macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG; + } + } + } } /* Fill Physical Cell Group Reconfig */ if(cellGrp->physicalCellGroupConfig) { + macUeCfg->phyCellGrpCfgPres = true; phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig)); if(phyCellGrpCfg->p_NR_FR1) - { - if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1) + { + if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1) macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1); - } + } macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook; } /* Fill SpCell Reconfig */ if(cellGrp->spCellConfig) { + macUeCfg->spCellCfgPres = true; spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig)); if(spcellCfg->servCellIndex) - { + { macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex); - } + } /* Fill Serving cell Reconfig info */ - if(cellGrp->spCellConfig->spCellConfigDedicated) - { - servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated)); - ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg); - if(ret == RFAILED) - { - DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()"); - } - } + if(cellGrp->spCellConfig->spCellConfigDedicated) + { + servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated)); + 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()"); + } + } } } return ret; @@ -8797,129 +9719,132 @@ void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet) DRBs_ToBeSetup_Item_t *drbSetItem = NULLP; uint8_t flowIdx =0; uint8_t drbIdx =0; - + if(drbSet->list.array != NULLP) { for(drbIdx=0; drbIdxlist.count; drbIdx++) { - if(drbIdx==0&&drbSet->list.array[drbIdx] != NULLP) - { - drbSetItem =&drbSet->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item; - if(drbSetItem->qoSInformation.choice.choice_extension != NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) - { - - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP) - { - - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP) - { - - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->\ - buf!=NULLP) - { - - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\ - flows_Mapped_To_DRB_List.list.array != NULLP) - { - - for(flowIdx=0;flowIdxqoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.count; flowIdx++) - { - - if(flowIdx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ - qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ - qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) - { - - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ - qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) - { - freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); - free(drbSetItem->uLConfiguration); - - - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ - qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); - } - - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ - qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); - } - - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ - qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI); - } - } - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP) - { - - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]); - } - } - - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array); - } - - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.sNSSAI.sD->buf); - } - - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD); - } - - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf); - - } - - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + if(drbIdx==0&&drbSet->list.array[drbIdx] != NULLP) + { + drbSetItem =&drbSet->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item; + if(drbSetItem->qoSInformation.choice.choice_extension != NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) + { - qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); - } + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP) + { + + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP) + { + + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->\ + buf!=NULLP) + { + + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.array != NULLP) + { + + for(flowIdx=0;flowIdxqoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.count; flowIdx++) + { + + if(flowIdx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) + { + + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) + { + + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\ + qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI); + } + } + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP) + { + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]); + } + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.sNSSAI.sD->buf); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD); + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf); + + } + + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); + } - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); - } + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); + } - free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI); - } - free(drbSetItem->qoSInformation.choice.choice_extension); - } - } - if(drbSet->list.array[drbIdx]!=NULLP) - { - free(drbSet->list.array[drbIdx]); - } + free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI); + } + free(drbSetItem->qoSInformation.choice.choice_extension); + } + freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); + if(drbSetItem->uLConfiguration) + { + free(drbSetItem->uLConfiguration); + } + } + if(drbSet->list.array[drbIdx]!=NULLP) + { + free(drbSet->list.array[drbIdx]); + } } free(drbSet->list.array); } @@ -8936,13 +9861,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 *macUeCfg, void *cellInfo) +uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend,MacUeCfg *storedMacUeCfg, void *cellInfo) { uint8_t ret = ROK; CellGroupConfigRrc_t *cellGrp = NULLP; @@ -8950,13 +9881,13 @@ uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo) if(cellInfo) { cellGrp = (CellGroupConfigRrc_t *)cellInfo; - ret = extractUeReCfgCellInfo(cellGrp, macUeCfg); + ret = extractUeReCfgCellInfo(cellGrp, macUeCfgToSend, storedMacUeCfg); if(ret == RFAILED) DU_LOG("\nERROR --> F1AP : Failed at procUeReCfgCellInfo()"); } if(ret == RFAILED) { - freeUeReCfgCellGrpInfo(macUeCfg); + freeUeReCfgCellGrpInfo(macUeCfgToSend); } return ret; } @@ -8980,93 +9911,100 @@ uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo) * ****************************************************************/ void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap) { - UE_NR_Capability_t *ueNrCap; - - if(ueCap) - ueNrCap = (UE_NR_Capability_t *)ueCap; + UE_NR_Capability_t *ueNrCap=NULLP; - /* Filling DL modulation info */ - if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \ - ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \ - ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL) + if(!ueCap) { - switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)) - { - case ModulationOrder_qpsk: - { - ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK; - break; - } - case ModulationOrder_qam16: - { - ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16; - break; - } - case ModulationOrder_qam64: - { - ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64; - ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX; - ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64; - break; - } - case ModulationOrder_qam256: - { - ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256; - break; - } - default: - { - DU_LOG("\nERROR --> DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration"); - memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo)); - break; - } - } + memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo)); + memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo)); } else { - memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo)); - } + ueNrCap = (UE_NR_Capability_t *)ueCap; - /* Filling UL modulation info */ - if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \ - ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \ - ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL) - { - switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)) + /* Filling DL modulation info */ + if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \ + ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \ + ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL) { - case ModulationOrder_qpsk: - { - ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK; - break; - } - case ModulationOrder_qam16: - { - ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16; - ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX; - ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64; - break; - } - case ModulationOrder_qam64: - { - ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64; - break; - } - case ModulationOrder_qam256: - { - ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256; - break; - } - default: - { - DU_LOG("\nERROR --> DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration"); - memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo)); - break; - } + switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)) + { + case ModulationOrder_qpsk: + { + ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK; + break; + } + case ModulationOrder_qam16: + { + ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16; + break; + } + case ModulationOrder_qam64: + { + ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64; + ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX; + ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64; + break; + } + case ModulationOrder_qam256: + { + ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256; + break; + } + default: + { + DU_LOG("\nERROR --> DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration"); + memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo)); + break; + } + } + } + else + { + memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo)); + } + + /* Filling UL modulation info */ + if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \ + ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \ + ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL) + { + switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)) + { + case ModulationOrder_qpsk: + { + ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK; + break; + } + case ModulationOrder_qam16: + { + ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16; + ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX; + ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64; + break; + } + case ModulationOrder_qam64: + { + ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64; + break; + } + case ModulationOrder_qam256: + { + ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256; + break; + } + default: + { + DU_LOG("\nERROR --> DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration"); + memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo)); + break; + } + } + } + else + { + memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo)); } - } - else - { - memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo)); } } @@ -9088,7 +10026,7 @@ void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap) * ****************************************************************/ CellGroupConfigRrc_t *extractCellGrpInfo(ProtocolExtensionContainer_4624P16_t *protocolIeExtn,\ - DuUeCfg *ueCfgDb) + DuUeCfg *ueCfgDb) { uint8_t idx2 =0; uint16_t id =0; @@ -9154,19 +10092,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, macLcToAdd); - 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; } @@ -9216,6 +10153,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()"); @@ -9235,34 +10174,72 @@ 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, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd) +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 ret = ROK; + uint8_t cfgIdx = 0; + RlcMode rlcModeInfo; - /* Filling RLC INFO */ - procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd); + if(drbItem != NULLP) + { + /* Filling RLC INFO */ + procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, &drbItem->\ + qoSInformation); - /* Filling MAC INFO */ - ret = procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, macLcToAdd); - if(ret == RFAILED) - { - DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in extractDrbListToSetup()"); - return ret; + /* Filling MAC INFO */ + 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 procDrbListToSetupMod()"); + return RFAILED; + } } + else if(drbSetupModItem != NULLP) + { + procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, + &drbSetupModItem->qoSInformation); - return ret; + 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 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; + } + } + return ROK; } /******************************************************************* @@ -9271,7 +10248,7 @@ uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem, LcCfg * * * @details * - * Function : extractDrbListToSetup + * Function : extractDrbListToSetupMod * * Functionality: extract Drb List received by CU * for both MAC and RLC @@ -9282,40 +10259,97 @@ uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem, LcCfg * * * ****************************************************************/ -uint8_t extractDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_List_t *drbCfg, 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(drbCfg) + if(drbCount > 0) { - for(drbIdx = 0; drbIdx < drbCfg->list.count; drbIdx++) + for(drbIdx = 0; drbIdx < drbCount; drbIdx++) { - drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item; - if(ueCfgDb->numMacLcs > MAX_NUM_LC) - { - DU_LOG("\nERROR --> F1AP: MAX LC Reached in MAC "); - ret = RFAILED; - break; - } - if(ueCfgDb->numRlcLcs > MAX_NUM_LC) - { - DU_LOG("\nERROR --> F1AP: MAX LC Reached in RLC"); - ret = RFAILED; - break; - } - memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg)); - memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg)); - ret = procDrbListToSetup(lcId, drbItem, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\ - &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]); - ueCfgDb->numRlcLcs++; - ueCfgDb->numMacLcs++; - if(ret == RFAILED) - { - DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetup()"); - break; - } + if(ueCfgDb->numMacLcs > MAX_NUM_LC) + { + 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 extractDrbListToSetupMod()"); + ret = RFAILED; + break; + } + memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg)); + memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg)); + + if(drbModCfg != NULLP) + { + 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 extractDrbListToSetupMod() for Modified List"); + break; + } + + } + else + { + lcId = getDrbLcId(drbBitMap); + if(lcId == RFAILED) + { + 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 extractDrbListToSetupMod()"); + break; + } } } else @@ -9350,7 +10384,7 @@ uint8_t extractDlRrcMsg(uint32_t gnbDuUeF1apId, uint32_t gnbCuUeF1apId, \ DU_ALLOC_SHRABL_BUF(dlRrcMsg->rrcMsgPdu, dlRrcMsg->rrcMsgSize); if(!dlRrcMsg->rrcMsgPdu) { - DU_LOG("\nERROR --> DU APP : Memory allocation failed for RRC Msg in procUeCtxtSetupReq"); + DU_LOG("\nERROR --> DU APP : Memory allocation failed for RRC Msg in extractDlRrcMsg()"); ret = RFAILED; } else @@ -9544,227 +10578,285 @@ void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t *ueSetReq) * ****************************************************************/ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) { - uint8_t ret, ieIdx, ueIdx, lcId, cellIdx; + uint8_t ret=0, ieIdx=0, ueIdx=0, cellIdx=0; bool ueCbFound = false; - uint32_t gnbCuUeF1apId, gnbDuUeF1apId, bitRateSize; - DuUeCb *duUeCb = NULLP; - UEContextSetupRequest_t *ueSetReq = NULLP; - + uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0; + DuUeCb *duUeCb = NULL; + UEContextSetupRequest_t *ueSetReq = NULL; + DRBs_ToBeSetup_List_t *drbCfg = NULL; + ret = ROK; - + ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest; for(ieIdx=0; (ieIdx < ueSetReq->protocolIEs.list.count && ret == ROK); ieIdx++) { switch(ueSetReq->protocolIEs.list.array[ieIdx]->id) { - case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - { - gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID; - break; - } - case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - { - gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID; - break; - } - case ProtocolIE_ID_id_ServCellIndex: - { - cellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex; + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + { + gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID; + break; + } + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + { + gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID; + break; + } + case ProtocolIE_ID_id_ServCellIndex: + { + cellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex; for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) - { - if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\ - (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)) - { - ueCbFound = true; + { + if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\ + (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)) + { + ueCbFound = true; duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx]; DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb)); if(duUeCb->f1UeDb) { memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb)); - duUeCb->f1UeDb->actionType = UE_CTXT_SETUP; - duUeCb->f1UeDb->cellIdx = cellIdx; - } - else - { + duUeCb->f1UeDb->actionType = UE_CTXT_SETUP; + duUeCb->f1UeDb->cellIdx = cellIdx; + } + else + { DU_LOG("\nERROR --> F1AP: Memory Alloc Failed at procF1UeContextSetupReq()"); ret = RFAILED; - } - } - else - ueCbFound = false; - - } - if(!ueCbFound) - { + } + break; + } + else + ueCbFound = false; + + } + if(!ueCbFound) + { DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextSetupReq()"); ret = RFAILED; - } - break; - } + } + break; + } case ProtocolIE_ID_id_SpCellULConfigured: - /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL, - UL, SUL or UL+SUL for the indicated cell for the UE */ - break; + /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL, + UL, SUL or UL+SUL for the indicated cell for the UE */ + break; case ProtocolIE_ID_id_CUtoDURRCInformation: - { + { if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList) { duUeCb->f1UeDb->duUeCfg.ueNrCapability = \ - extractUeCapability(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.\ - uE_CapabilityRAT_ContainerList, duUeCb); + extractUeCapability(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.\ + uE_CapabilityRAT_ContainerList, duUeCb); } - if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.iE_Extensions) - { + if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.iE_Extensions) + { duUeCb->f1UeDb->duUeCfg.cellGrpCfg = extractCellGrpInfo(ueSetReq->protocolIEs.list.array[ieIdx]->\ - value.choice.CUtoDURRCInformation.iE_Extensions, &duUeCb->f1UeDb->duUeCfg); - if(!duUeCb->f1UeDb->duUeCfg.cellGrpCfg) - { - DU_LOG("\nERROR --> F1AP: Failed to extract cell Grp Info"); - //TODO: Update the failure cause in ue context Setup Response - ret = RFAILED; - } - } + value.choice.CUtoDURRCInformation.iE_Extensions, &duUeCb->f1UeDb->duUeCfg); + if(!duUeCb->f1UeDb->duUeCfg.cellGrpCfg) + { + DU_LOG("\nERROR --> F1AP: Failed to extract cell Grp Info"); + //TODO: Update the failure cause in ue context Setup Response + ret = RFAILED; + } + } break; } case ProtocolIE_ID_id_SCell_ToBeSetup_List: - { - DU_LOG("\nINFO --> DU_APP: Received SCell_ToBeSetup_List but Not processing the list"); - break; - } + { + DU_LOG("\nINFO --> DU_APP: Received SCell_ToBeSetup_List but Not processing the list"); + break; + } case ProtocolIE_ID_id_SRBs_ToBeSetup_List: - { - if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\ - &duUeCb->f1UeDb->duUeCfg)) - { - DU_LOG("\nERROR --> DU APP : Failed at extractSrbListToSetup()"); - //TODO: Update the failure cause in ue context Setup Response - ret = RFAILED; - } - break; - } + { + if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\ + &duUeCb->f1UeDb->duUeCfg)) + { + DU_LOG("\nERROR --> DU APP : Failed at extractSrbListToSetup()"); + //TODO: Update the failure cause in ue context Setup Response + ret = RFAILED; + } + break; + } case ProtocolIE_ID_id_DRBs_ToBeSetup_List: - { - lcId = getDrbLcId(&duUeCb->drbBitMap); - if(lcId != RFAILED) - { - if(extractDrbListToSetup(lcId, &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List,\ - &duUeCb->f1UeDb->duUeCfg)) - { - DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetup()"); - //TODO: Update the failure cause in ue context Setup Response - ret = RFAILED; - } - } - else - ret = RFAILED; + { + drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List; + + if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP)) + { + DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetupMod()"); + //TODO: Update the failure cause in ue context Setup Response + ret = RFAILED; + } break; - } - case ProtocolIE_ID_id_RRCContainer: - { - /* Filling Dl RRC Msg Info */ - DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg)); - if(!duUeCb->f1UeDb->dlRrcMsg) - { - DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL RRC Msg in procUeCtxtSetupReq()"); - ret = RFAILED; - } - else - { - memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg)); - ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\ - &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer); - } - break; - } - case ProtocolIE_ID_id_RRCDeliveryStatusRequest: - { - if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu) - { - duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true; - } - else - { - DU_LOG("\nERROR --> Ignoring delivery report, since rrcContainer is not present"); - } - break; - } - case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL: - { + } + case ProtocolIE_ID_id_RRCContainer: + { + /* Filling Dl RRC Msg Info */ + DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg)); + if(!duUeCb->f1UeDb->dlRrcMsg) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for DL RRC Msg in procUeCtxtSetupReq()"); + ret = RFAILED; + } + else + { + duUeCb->f1UeDb->dlRrcMsgPres = true; + memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg)); + ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\ + &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer); + } + break; + } + case ProtocolIE_ID_id_RRCDeliveryStatusRequest: + { + if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu) + { + duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true; + } + else + { + DU_LOG("\nERROR --> Ignoring delivery report, since rrcContainer is not present"); + } + break; + } + case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL: + { /* MaximumBitRate Uplink */ - bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size; - if(bitRateSize > 0) - { + bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size; + if(bitRateSize > 0) + { DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.ambrCfg, bitRateSize); - if(!duUeCb->f1UeDb->duUeCfg.ambrCfg) - { - DU_LOG("\nERROR --> DU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq"); - ret = RFAILED; - } - else - { - memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg)); + if(!duUeCb->f1UeDb->duUeCfg.ambrCfg) + { + DU_LOG("\nERROR --> DU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq"); + ret = RFAILED; + } + else + { + memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg)); memcpy(&duUeCb->f1UeDb->duUeCfg.ambrCfg->ulBr, - ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize); - duUeCb->f1UeDb->duUeCfg.ambrCfg->dlBr = 0; - } - } - else - ret = RFAILED; - break; - } - default: - { - break; - } + ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize); + } + } + else + ret = RFAILED; + break; + } + default: + { + break; + } } } if(ret == RFAILED) { /*TODO : Negative case*/ - // BuildAndSendUeContextSetupRsp(ueIdx, cellId); + // BuildAndSendUeContextSetupRsp(cellId,ueIdx); DU_LOG("\nERROR --> F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()"); } else ret = duProcUeContextSetupRequest(duUeCb); - + freeAperDecodeF1UeContextSetupReq(ueSetReq); return ret; } - /******************************************************************* - * @brief Free the memory allocated for UE Setup response + * @brief Free the memory allocated for Dl Tunnel Info * * @details * - * Function : FreeUeContextSetupRsp + * Function : freeDlTnlInfo * * Functionality: - * Free the memory allocated for UE Setup response + * Free the memory allocated for Dl Tunnel Info * - * @params[in] F1AP PDU for UE setup response - * @return ROK - success - * RFAILED - failure + * @params[in] DLUPTNLInformation_ToBeSetup_List_t * + * @return void * * ****************************************************************/ -void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg) + +void freeDlTnlInfo(DLUPTNLInformation_ToBeSetup_List_t *tnlInfo) { - uint8_t idx; - UEContextSetupResponse_t *ueSetRsp = NULLP; + uint8_t arrIdx = 0; - if(f1apMsg) + if(tnlInfo) { - if(f1apMsg->choice.successfulOutcome) + for(arrIdx=0; arrIdx < tnlInfo->list.count; arrIdx++) { - ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\ - UEContextSetupResponse; - if(ueSetRsp->protocolIEs.list.array) - { - for(idx = 0; idx < ueSetRsp->protocolIEs.list.count; idx++) - { - if(ueSetRsp->protocolIEs.list.array[idx]) - { - switch(ueSetRsp->protocolIEs.list.array[idx]->id) + DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf,\ + tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size); + DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf,\ + tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size); + DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t)); + DU_FREE(tnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t)); + } + DU_FREE(tnlInfo->list.array, tnlInfo->list.size); + } +} + +/******************************************************************* + * @brief Free the memory allocated for DRB setup List + * + * @details + * + * Function : freeDrbSetupList + * + * Functionality: + * Free the memory allocated for DRB setup list + * + * @params[in] DRBs_Setup_List_t * + * @return void + * + * ****************************************************************/ +void freeDrbSetupList(DRBs_Setup_List_t *drbSetupList) +{ + uint8_t arrIdx = 0; + DRBs_Setup_ItemIEs_t *drbItemIe = NULLP; + + for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++) + { + drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]); + freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List); + DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t)); + } + DU_FREE(drbSetupList->list.array, drbSetupList->list.size); +} + +/******************************************************************* + * @brief Free the memory allocated for UE Setup response + * + * @details + * + * Function : FreeUeContextSetupRsp + * + * Functionality: + * Free the memory allocated for UE Setup response + * + * @params[in] F1AP PDU for UE setup response + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg) +{ + uint8_t idx; + UEContextSetupResponse_t *ueSetRsp = NULLP; + + if(f1apMsg) + { + if(f1apMsg->choice.successfulOutcome) + { + ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\ + UEContextSetupResponse; + if(ueSetRsp->protocolIEs.list.array) + { + for(idx = 0; idx < ueSetRsp->protocolIEs.list.count; idx++) + { + if(ueSetRsp->protocolIEs.list.array[idx]) + { + switch(ueSetRsp->protocolIEs.list.array[idx]->id) { case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: break; @@ -9782,6 +10874,11 @@ void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg) } break; } + case ProtocolIE_ID_id_DRBs_Setup_List: + { + freeDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List); + break; + } default: DU_LOG("\nERROR --> DUAPP: Invalid Id %ld at FreeUeContextSetupRsp()",\ ueSetRsp->protocolIEs.list.array[idx]->id); @@ -9850,6 +10947,158 @@ uint8_t EncodeUeCntxtDuToCuInfo(CellGroupConfig_t *duToCuCellGrp, CellGroupConfi return ROK; } +/******************************************************************* + * + * @brief Fills Dl Gtp tunnel Info + * + * @details + * + * Function : fillGtpTunnelforDl + * + * Functionality: Fills Dl Gtp tunnel Info + * + * @params[in] + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t fillGtpTunnelforDl(GTPTunnel_t *gtpDl, GtpTnlCfg *gtpUeCfg) +{ + uint8_t bufSize = 0; + + gtpDl->transportLayerAddress.size = 4*sizeof(uint8_t); + DU_ALLOC(gtpDl->transportLayerAddress.buf, gtpDl->transportLayerAddress.size); + if(gtpDl->transportLayerAddress.buf == NULLP) + { + return RFAILED; + } + memcpy(gtpDl->transportLayerAddress.buf, >pUeCfg->dlTnlAddress, gtpDl->transportLayerAddress.size); + + /*GTP TEID*/ + gtpDl->gTP_TEID.size = 4 * sizeof(uint8_t); + DU_ALLOC(gtpDl->gTP_TEID.buf, gtpDl->gTP_TEID.size); + if(gtpDl->gTP_TEID.buf == NULLP) + { + return RFAILED; + } + bufSize = 3; /*forming an Octect String*/ + fillTeIdString(bufSize, gtpUeCfg->teId, gtpDl->gTP_TEID.buf); + + return ROK; +} + +/******************************************************************* + * + * @brief Fills DL Tunnel Setup List + * + * @details + * + * Function : fillDlTnlSetupList + * + * Functionality: Fills the DL Tunnel Setup List + * + * @params[in] + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t fillDlTnlSetupList(DLUPTNLInformation_ToBeSetup_List_t *dlTnlInfo, UpTnlCfg *tnlCfg) +{ + uint8_t ret = ROK, arrIdx = 0, eleCount = 0; + + eleCount = 1; + dlTnlInfo->list.count = eleCount; + dlTnlInfo->list.size = (eleCount * sizeof(DLUPTNLInformation_ToBeSetup_Item_t *)); + + /* Initialize the DL Tnl Setup List Members */ + DU_ALLOC(dlTnlInfo->list.array, dlTnlInfo->list.size); + if(dlTnlInfo->list.array == NULLP) + { + DU_LOG(" ERROR --> F1AP : Memory allocation for DL Tnl Setup List in fillDlTnlSetupList()"); + ret = RFAILED; + } + for(arrIdx=0; arrIdx < eleCount; arrIdx++) + { + DU_ALLOC(dlTnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t)); + if(dlTnlInfo->list.array[arrIdx] == NULLP) + { + DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDlTnlSetupList()", arrIdx); + return RFAILED; + } + dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.present = UPTransportLayerInformation_PR_gTPTunnel; + DU_ALLOC(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t)); + if(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel == NULLP) + { + DU_LOG(" ERROR --> F1AP : Memory allocation for DL tunnel info in fillDlTnlSetupList()"); + return RFAILED; + } + ret = fillGtpTunnelforDl(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel,\ + tnlCfg->tnlCfg1); + if(ret != ROK) + break; + } + return ret; +} + +/******************************************************************* + * + * @brief Fills the Drb Setup List for Ue Context Setup Response + * + * @details + * + * Function : fillDrbSetupList + * + * Functionality: Fills the Drb Setup List for Ue Context Setup Response + * + * @params[in] + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg) +{ + uint8_t ret = ROK, arrIdx = 0, eleCount = 0; + DRBs_Setup_ItemIEs_t *drbItemIe = NULLP; + + eleCount = ueCfg->numDrb; + drbSetupList->list.count = eleCount; + drbSetupList->list.size = \ + (eleCount * sizeof(DRBs_Setup_Item_t *)); + + /* Initialize the Drb Setup List Members */ + DU_ALLOC(drbSetupList->list.array, drbSetupList->list.size); + if(drbSetupList->list.array == NULLP) + { + DU_LOG(" ERROR --> F1AP : Memory allocation for DRB Setup List in fillDrbSetupList()"); + ret = RFAILED; + } + + for(arrIdx=0; arrIdx < eleCount; arrIdx++) + { + DU_ALLOC(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t)); + if(drbSetupList->list.array[arrIdx] == NULLP) + { + DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDrbSetupList()", arrIdx); + return RFAILED; + } + drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]); + drbItemIe->id = ProtocolIE_ID_id_DRBs_Setup_Item; + drbItemIe->criticality = Criticality_reject; + drbItemIe->value.present = DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item; + drbItemIe->value.choice.DRBs_Setup_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId; + ret = fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List,\ + &ueCfg->upTnlInfo[arrIdx]); + if(ret != ROK) + break; + } + return ret; +} + /******************************************************************* * * @brief Builds and sends the UE Setup Response @@ -9861,13 +11110,13 @@ uint8_t EncodeUeCntxtDuToCuInfo(CellGroupConfig_t *duToCuCellGrp, CellGroupConfi * Functionality: Constructs the UE Setup Response and sends * it to the DU through SCTP. * - * @params[in] + * @params[in] uint8_t cellId,uint8_t ueIdx * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) +uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueIdx) { uint8_t idx, ret, cellIdx, elementCnt; uint32_t gnbCuUeF1apId; /* gNB-CU UE F1AP Id */ @@ -9908,7 +11157,7 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse; - elementCnt = 3; + elementCnt = 4; ueSetRsp->protocolIEs.list.count = elementCnt; ueSetRsp->protocolIEs.list.size = \ elementCnt * sizeof(UEContextSetupResponse_t *); @@ -9973,19 +11222,44 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) cellGrpCfg = (CellGroupConfigRrc_t*)ueCb->f1UeDb->duUeCfg.cellGrpCfg; ret = EncodeUeCntxtDuToCuInfo(&ueSetRsp->protocolIEs.list.array[idx]->value.\ choice.DUtoCURRCInformation.cellGroupConfig, cellGrpCfg); - /* Free UeContext Db created during Ue context Req */ - freeF1UeDb(ueCb->f1UeDb); - ueCb->f1UeDb = NULLP; + if(ret == RFAILED) + { + DU_LOG("\nERROR --> F1AP : Failed to EncodeUeCntxtDuToCuInfo in BuildAndSendUeContextSetupRsp()"); + freeF1UeDb(ueCb->f1UeDb); + ueCb->f1UeDb = NULLP; + break; + } } } else { - DU_LOG("\nERROR --> F1AP: Failed to form DUtoCU RRCInfo at BuildAndSendUeContextSetupRsp()"); + DU_LOG("\nERROR --> F1AP : Failed to form DUtoCU RRCInfo at BuildAndSendUeContextSetupRsp()"); ret = RFAILED; + break; } + + /* Drb Setup List */ + idx++; + ueSetRsp->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_DRBs_Setup_List; + ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetRsp->protocolIEs.list.array[idx]->value.present =\ + UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; + ret = fillDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List,\ + &ueCb->f1UeDb->duUeCfg); if(ret == RFAILED) + { + DU_LOG("\nERROR --> F1AP : Failed to fillDrbSetupList in BuildAndSendUeContextSetupRsp()"); + freeF1UeDb(ueCb->f1UeDb); + ueCb->f1UeDb = NULLP; break; + } + + /* Free UeContext Db created during Ue context Req */ + freeF1UeDb(ueCb->f1UeDb); + ueCb->f1UeDb = NULLP; + /* TODO: To send Drb list */ xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); /* Encode the UE context setup response type as APER */ @@ -9996,14 +11270,14 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) /* Encode results */ if(encRetVal.encoded == ENCODE_FAIL) { - DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\ + DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Response structure (at %s)\n",\ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); ret = RFAILED; break; } else { - DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Setup Request\n"); + DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Setup Response\n"); for(int i=0; i< encBufSize; i++) { printf("%x",encBuf[i]); @@ -10011,9 +11285,9 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) } /* Sending msg */ - if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK) + if(sendF1APMsg() != ROK) { - DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Request Failed"); + DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Response failed"); ret = RFAILED; break; } @@ -10037,7 +11311,7 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId) * failure = RFAILED * * ****************************************************************/ -uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId) +uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueIdx) { uint8_t cellIdx = 0, actionType = 0; @@ -10047,11 +11321,15 @@ uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId) switch(actionType) { case UE_CTXT_SETUP: - BuildAndSendUeContextSetupRsp(ueIdx, cellId); - break; + { + BuildAndSendUeContextSetupRsp(cellId,ueIdx); + break; + } case UE_CTXT_MOD: - //TODO: Build Ue context Modification Rsp - break; + { + BuildAndSendUeContextModRsp(cellId, ueIdx); + break; + } default: DU_LOG("ERROR --> F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType); break; @@ -10213,7 +11491,7 @@ uint8_t BuildAndSendF1ResetReq() } } - if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK) + if(sendF1APMsg() != ROK) { DU_LOG("\nERROR --> F1AP : Sending F1 Reset request failed"); break; @@ -10366,7 +11644,7 @@ uint8_t BuildAndSendF1ResetAck() } } /* Sending msg */ - if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK) + if(sendF1APMsg() != ROK) { DU_LOG("\nERROR --> F1AP : Sending F1 Reset Acknowledgement failed"); break; @@ -10633,7 +11911,7 @@ uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \ } /* Sending msg */ - if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK) + if(sendF1APMsg() != ROK) { DU_LOG("\nERROR --> F1AP : Sending RRC delivery msg request failed"); break; @@ -10896,6 +12174,127 @@ void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck) free(gnbDuAck->protocolIEs.list.array); } } + +/******************************************************************* +* +* @brief Building result of gnb-du config update ack output +* +* @details +* +* Function : duProcGnbDuCfgUpdAckMsg +* +* Functionality: +* Building output of gnb-du config update ack +* +* @params[in] transId +* @return void +* +* ****************************************************************/ + +uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId) +{ + uint8_t ieIdx=0, arrIdx=0,ret=ROK; + uint8_t ueId =0 , ueIdx =0, totalActiveUe = 0; + uint16_t cellId =0, cellIdx =0, crnti=0; + CmLList *f1apPduNode = NULLP; + ReservedF1apPduInfo *f1apPduInfo =NULLP; + F1AP_PDU_t *f1apMsgPdu = NULLP; + GNBDUConfigurationUpdate_t *gnbDuConfigUpdate = NULLP; + BIT_STRING_t *cellIdentity=NULLP; + struct Served_Cells_To_Delete_ItemIEs *deleteItemIe=NULLP; + Served_Cells_To_Delete_List_t *cellsToDelete=NULLP; + Served_Cells_To_Delete_Item_t *deleteItem=NULLP; + + DU_LOG("\nINFO --> DU APP: GNB-DU config update Ack received "); + f1apPduNode = searchFromReservedF1apPduList(transId); + f1apPduInfo = (ReservedF1apPduInfo *)f1apPduNode->node; + f1apMsgPdu = (F1AP_PDU_t *)f1apPduInfo->f1apMsg; + + if(f1apMsgPdu) + { + if(f1apMsgPdu->choice.initiatingMessage) + { + gnbDuConfigUpdate = &f1apMsgPdu->choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate; + for(ieIdx=0; ieIdx < gnbDuConfigUpdate->protocolIEs.list.count; ieIdx++) + { + switch(gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_Served_Cells_To_Delete_List: + { + cellsToDelete = &gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->value.choice.\ + Served_Cells_To_Delete_List; + if(cellsToDelete->list.array) + { + if(cellsToDelete->list.array[arrIdx]) + { + deleteItemIe = (Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx]; + deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item; + if(deleteItem->oldNRCGI.nRCellIdentity.buf) + { + cellIdentity = &deleteItem->oldNRCGI.nRCellIdentity; + bitStringToInt(cellIdentity, &cellId); + } + } + } + + GET_CELL_IDX(cellId, cellIdx); + if(duCb.actvCellLst[cellIdx] != NULLP) + { + if(duCb.actvCellLst[cellIdx]->numActvUes == 0) + { + duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS; + ret = duSendCellDeletReq(cellId); + if(ret == RFAILED) + { + DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\ + request for cellId[%d]", cellId); + } + } + else + { + 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("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\ + request for cellId[%d]", cellId); + } + ueIdx++; + totalActiveUe--; + } + } + } + else + { + DU_LOG("\nERROR --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId); + ret = RFAILED; + } + break; + } + + default: + break; + } + } + } + } + + FreeDUConfigUpdate(f1apMsgPdu); + deleteFromReservedF1apPduList(f1apPduNode); + return ret; +} + /******************************************************************* * * @brief Processes GNB DU config update ack @@ -10912,28 +12311,40 @@ void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck) * ****************************************************************/ uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg) { - uint8_t ieIdx; + uint8_t ieIdx=0,transId=0; GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck = NULLP; - + DU_LOG("\nINFO --> F1AP : GNB-DU config update acknowledgment"); gnbDuAck = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge; - + for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++) { switch(gnbDuAck->protocolIEs.list.array[ieIdx]->id) { case ProtocolIE_ID_id_TransactionID: - break; + { + transId = gnbDuAck->protocolIEs.list.array[ieIdx]->value.choice.TransactionID; + break; + } case ProtocolIE_ID_id_Cells_to_be_Activated_List: - break; + { + break; + } default : - DU_LOG("\nERROR --> F1AP: Invalid IE Received: %ld, at procF1GNBDUCfgUpdAck()", \ - gnbDuAck->protocolIEs.list.array[ieIdx]->id); - break; + { + DU_LOG("\nERROR --> F1AP: procF1GNBDUCfgUpdAck(): Invalid IE Received: %ld", \ + gnbDuAck->protocolIEs.list.array[ieIdx]->id); + break; + } } } - duProcGnbDuCfgUpdAckMsg(); + + duProcGnbDuCfgUpdAckMsg(transId); + #if 0 + /* presently we are not supporting F1 Reset from DU to CU , we are only + * supporting F1 Reset from CU to DU */ + if(BuildAndSendF1ResetReq() != ROK) { return RFAILED; @@ -11050,7 +12461,7 @@ uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg) if(f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0) { dlMsg.rrcMsgSize = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size; - DU_ALLOC(dlMsg.rrcMsgPdu, dlMsg.rrcMsgSize); + DU_ALLOC_SHRABL_BUF(dlMsg.rrcMsgPdu, dlMsg.rrcMsgSize); if(dlMsg.rrcMsgPdu) { memcpy(dlMsg.rrcMsgPdu, f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\ @@ -11086,27 +12497,1213 @@ uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg) freeAperDecodef1DlRrcMsg(f1DlRrcMsg); return ret; } - -/*****************************************************************i - * - * @brief Handles received F1AP message and sends back response - * - * @details - * - * Function : F1APMsgHdlr - * - * Functionality: - * - Decodes received F1AP control message - * - Prepares response message, encodes and sends to SCTP - * - * @params[in] - * @return ROK - success - * RFAILED - failure +/******************************************************************* * - * ****************************************************************/ -void F1APMsgHdlr(Buffer *mBuf) +* @brief Builds the DRB to be Setup Mod list +* +* @details +* +* Function : +* +* Functionality: Constructs the DRB to be Setup Mod list +* +* @params[in] DRBs_SetupMod_List_t *drbSet +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ + +uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg) { - int i =0; + uint8_t arrIdx =0; + uint8_t drbCnt =0; + struct DRBs_SetupMod_ItemIEs *drbItemIe; + + drbCnt = 1; + drbSet->list.count = drbCnt; + drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *); + DU_ALLOC(drbSet->list.array, drbSet->list.size); + if(drbSet->list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList"); + return RFAILED; + } + for(arrIdx=0; arrIdxlist.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t)); + if(drbSet->list.array[arrIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupModList"); + return RFAILED; + } + + drbItemIe = (struct DRBs_SetupMod_ItemIEs *)drbSet->list.array[arrIdx]; + drbItemIe->id = ProtocolIE_ID_id_DRBs_SetupMod_Item; + drbItemIe->criticality = Criticality_reject; + drbItemIe->value.present = DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item; + drbItemIe->value.choice.DRBs_SetupMod_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId; + if(fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List,\ + &ueCfg->upTnlInfo[arrIdx])!= ROK) + { + DU_LOG("\nERROR --> F1AP : Failed to fill DlTnl SetupList in BuildDrbToBeSetupModList"); + return RFAILED; + } + + } + + return ROK; +} +/******************************************************************* +* @brief Free the memory allocated for DRB setup List +* +* @details +* +* Function : FreeDrbSetupModList +* +* Functionality: +* Free the memory allocated for DRB setup list +* +* @params[in] DRBs_Setup_List_t * +* @return void +* +* ****************************************************************/ +void FreeDrbSetupModList(DRBs_SetupMod_List_t *drbSetupList) +{ + uint8_t arrIdx = 0; + DRBs_SetupMod_ItemIEs_t *drbItemIe = NULLP; + + for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++) + { + drbItemIe = ((DRBs_SetupMod_ItemIEs_t *)drbSetupList->list.array[arrIdx]); + freeDlTnlInfo(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List); + DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t)); + } + DU_FREE(drbSetupList->list.array, drbSetupList->list.size); +} +/******************************************************************* +* @brief Free the memory allocated for UE Context Mod Response +* +* @details +* +* Function : FreeUeContextModResp +* +* Functionality: +* Free the memory allocated for UE Context Mod Response +* +* @params[in] F1AP_PDU_t *f1apMsg +* @return void +* +* ****************************************************************/ + +void FreeUeContextModResp(F1AP_PDU_t *f1apMsg) +{ + uint8_t ieIdx; + UEContextModificationResponse_t *ueContextModifyRes = NULLP; + if(f1apMsg) + { + if(f1apMsg->choice.successfulOutcome) + { + ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse; + if(ueContextModifyRes->protocolIEs.list.array) + { + for(ieIdx=0 ; ieIdxprotocolIEs.list.count; ieIdx++) + { + if(ueContextModifyRes->protocolIEs.list.array[ieIdx]) + { + switch(ueContextModifyRes->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_DRBs_SetupMod_List: + { + FreeDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\ + value.choice.DRBs_SetupMod_List)); + break; + } + } + DU_FREE(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t)); + } + + } + DU_FREE(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size); + } + DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + } + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + } +} + +/*****************************************************************i +* +* @brief Creating the ue context modifcation response and sending +* +* @details +* +* Function : BuildAndSendUeContextModRsp +* +* Functionality: +* - Creating the ue context modifcation response +* +* @params[in] uint8_t cellId,uint8_t ueIdx +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t BuildAndSendUeContextModRsp(uint8_t cellId,uint8_t ueIdx) +{ + uint8_t ieIdx = 0; + uint8_t cellIdx =0; + uint8_t elementCnt = 0; + uint8_t ret = RFAILED; + uint32_t gnbCuUeF1apId; /* gNB-CU UE F1AP Id */ + uint32_t gnbDuUeF1apId; /* gNB-DU UE F1AP Id */ + F1AP_PDU_t *f1apMsg = NULLP; + asn_enc_rval_t encRetVal; + UEContextModificationResponse_t *ueContextModifyRes = NULLP; + DuUeCb *ueCb = NULLP; + + DU_LOG("\nINFO --> F1AP : Building Ue context modification response\n"); + + while(1) + { + DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification"); + break; + } + + f1apMsg->present = F1AP_PDU_PR_successfulOutcome; + + DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + if(f1apMsg->choice.successfulOutcome == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification"); + break; + } + f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextModification; + f1apMsg->choice.successfulOutcome->criticality = Criticality_reject; + f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_UEContextModificationResponse; + + ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse; + + elementCnt = 3; + ueContextModifyRes->protocolIEs.list.count = elementCnt; + ueContextModifyRes->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationResponse_t*); + + /* Initialize the UE context modification members */ + DU_ALLOC(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size); + if(ueContextModifyRes->protocolIEs.list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed"); + break; + } + + for(ieIdx=0 ; ieIdxprotocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t)); + if(ueContextModifyRes->protocolIEs.list.array[ieIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed"); + break; + } + } + + /* Fetching Ue Cb Info*/ + GET_CELL_IDX(cellId, cellIdx); + gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId; + gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId; + ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1]; + + ieIdx=0; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\ + UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId; + + ieIdx++; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present=\ + UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId; + + ieIdx++; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; + ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\ + UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List; + if(ueCb->f1UeDb) + { + ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\ + value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg); + if(ret != ROK) + { + DU_LOG( "\nERROR --> F1AP : Failed to build drb setupmod List "); + break; + } + freeF1UeDb(ueCb->f1UeDb); + ueCb->f1UeDb = NULLP; + } + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as APER */ + memset(encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,encBuf); + + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + ret = RFAILED; + break; + } + else + { + DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Modification Response\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(sendF1APMsg() != ROK) + { + DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Res Failed"); + ret = RFAILED; + break; + } + break; + } + FreeUeContextModResp(f1apMsg); + return ret; +} +/******************************************************************* + * + * @brief Deallocating the memory allocated by the aper decoder + * for QOSInfo + * + * @details + * + * Function : freeAperDecodeQosInfo + * + * Functionality: Deallocating the memory allocated for QOSInfo + * + * @params[in] QoSFlowLevelQoSParameters_t *drbQos + * + * @return void + * + * ****************************************************************/ + +void freeAperDecodeQosInfo(QoSFlowLevelQoSParameters_t *drbQos) +{ + if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP) + { + if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) + { + if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) + { + free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume); + } + free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow); + } + free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI); + } +} +/******************************************************************* + * + * @brief Deallocating the memory allocated by the aper decoder + * for UlTnlInfoforDrb + * + * @details + * + * Function : freeAperDecodeUlTnlInfoforDrbSetupMod + * + * Functionality: Deallocating memory allocated for UlTnlInfoforDrb + * + * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo + * + * @return void + * + * ****************************************************************/ +void freeAperDecodeUlTnlInfoforDrbSetupMod(ULUPTNLInformation_ToBeSetup_List_t *ulInfo) +{ + uint8_t arrIdx =0; + + if(ulInfo->list.array) + { + for(arrIdx=0; arrIdxlist.count ; arrIdx++) + { + if(ulInfo->list.array[arrIdx]) + { + if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel ) + { + if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf) + { + if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf) + { + free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf); + } + free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf); + } + free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel); + } + free(ulInfo->list.array[arrIdx]); + } + } + free(ulInfo->list.array); + } +} +/******************************************************************* + * + * @brief Deallocating the memory allocated by the aper decoder + * for DrbSetupModItem + * + * @details + * + * Function : freeAperDecodeDrbSetupModItem + * + * Functionality: Deallocating memory allocated for DrbSetupModItem + * + * @params[in] DRBs_ToBeSetupMod_Item_t *drbItem + * + * @return void + * + * ****************************************************************/ + +void freeAperDecodeDrbSetupModItem(DRBs_ToBeSetupMod_Item_t *drbItem) +{ + uint8_t arrIdx =0; + SNSSAI_t *snssai =NULLP; + Flows_Mapped_To_DRB_List_t *flowMap = NULLP; + + drbItem->qoSInformation.present = QoSInformation_PR_choice_extension; + switch(drbItem->qoSInformation.present) + { + case QoSInformation_PR_NOTHING: + break; + case QoSInformation_PR_eUTRANQoS: + { + if(drbItem->qoSInformation.choice.eUTRANQoS) + { + free(drbItem->qoSInformation.choice.eUTRANQoS); + } + break; + } + case QoSInformation_PR_choice_extension: + { + if(drbItem->qoSInformation.choice.choice_extension) + { + freeAperDecodeQosInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.dRB_QoS); + snssai = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI; + if(snssai->sST.buf) + { + free(snssai->sST.buf); + } + if(snssai->sD) + { + if(snssai->sD->buf) + { + free(snssai->sD->buf); + } + free(snssai->sD); + } + + flowMap = &drbItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List; + if(flowMap->list.array) + { + for(arrIdx=0; arrIdxlist.count; arrIdx++) + { + if(flowMap->list.array[arrIdx] ) + { + freeAperDecodeQosInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters); + free(flowMap->list.array[arrIdx]); + } + } + free(flowMap->list.array); + } + + free(drbItem->qoSInformation.choice.choice_extension); + } + break; + } + + } + freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List); + if(drbItem->uLConfiguration) + { + free(drbItem->uLConfiguration); + } +} + +/******************************************************************* + * + * @brief Deallocating the memory allocated by the aper decoder + * for DrbToBeSetupModList + * + * @details + * + * Function : freeAperDecodeDrbToBeSetupModList + * + * Functionality: Deallocating memory allocated for DrbToBeSetupModList + * + * @params[in] DRBs_ToBeSetupMod_List_t *drbSet + * + * @return void + * + * ****************************************************************/ + +void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet) +{ + uint8_t arrIdx =0; + struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe; + + if(drbSet->list.array) + { + for(arrIdx=0; arrIdxlist.count ; arrIdx++) + { + if(drbSet->list.array[arrIdx] != NULLP) + { + if(arrIdx == 0) + { + drbItemIe = (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx]; + freeAperDecodeDrbSetupModItem(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item)); + } + free(drbSet->list.array[arrIdx]); + } + } + free(drbSet->list.array); + } + +} +/******************************************************************* + * + * @brief Deallocating the memory allocated by the aper decoder + * for UeContextModificationReqMsg + * + * @details + * + * Function : freeAperDecodeUeContextModificationReqMsg + * + * Functionality: Deallocating memory allocated for + * UeContextModificationReqMsg + * + * @params[in] UEContextModificationRequest_t *UeContextModifyReq + * + * @return void + * + * ****************************************************************/ +void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *UeContextModifyReq ) +{ + uint8_t arrIdx, ieId; + + if(UeContextModifyReq->protocolIEs.list.array) + { + for( arrIdx = 0 ; arrIdxprotocolIEs.list.count ; arrIdx++) + { + if(UeContextModifyReq->protocolIEs.list.array[arrIdx]) + { + ieId = UeContextModifyReq->protocolIEs.list.array[arrIdx]->id; + switch(ieId) + { + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List: + { + freeAperDecodeDrbToBeSetupModList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->\ + value.choice.DRBs_ToBeSetupMod_List); + break; + } + } + free(UeContextModifyReq->protocolIEs.list.array[arrIdx]); + } + } + free(UeContextModifyReq->protocolIEs.list.array); + } +} +/******************************************************************* + * + * @brief processing the F1 UeContextModificationReq + * + * @details + * + * Function : procF1UeContextModificationReq + * + * Functionality: processing the F1 UeContextModificationReq + * + * @params[in] F1AP_PDU_t *f1apMsg + * + * @return + * ****************************************************************/ +uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) +{ + UEContextModificationRequest_t *ueContextModifyReq = NULLP; + 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; + for(ieIdx=0; (ieIdx < ueContextModifyReq->protocolIEs.list.count && ret == ROK); ieIdx++) + { + switch(ueContextModifyReq->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + { + gnbCuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID; + break; + } + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + { + gnbDuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID; + break; + } + case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List: + case ProtocolIE_ID_id_DRBs_ToBeModified_List: + { + for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++) + { + for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++) + { + if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\ + (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)) + { + + duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx]; + if(duUeCb->f1UeDb == NULLP) + { + DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb)); + } + if(duUeCb->f1UeDb) + { + duUeCb->f1UeDb->actionType = UE_CTXT_MOD; + if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\ + UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List) + { + drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\ + choice.DRBs_ToBeSetupMod_List; + + 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 extractDrbListToSetupMod() for DrbModifiedList"); + ret = RFAILED; + } + } + } + break; + } + } + if(ueIdx >= duCb.actvCellLst[cellIdx]->numActvUes) + { + DU_LOG("\nERROR --> DU APP : wrong values of gnbCuUeF1apId and gnbDuUeF1apId "); + ret = RFAILED; + } + } + break; + } + } + } + if(ret != RFAILED) + { + ret = duProcUeContextModReq(duUeCb); + } + freeAperDecodeUeContextModificationReqMsg(ueContextModifyReq); + return ret; +} +/*****************************************************************i +* +* @brief Free memory allocated for UE Context Release Request +* +* @details +* +* Function : FreeUeContextReleaseReq +* +* Functionality: +* - Free memory allocated for UE Context Release Request +* +* @params[in] F1AP_PDU_t *f1apMsg +* @return void +* +* *************************************************************/ +void FreeUeContextReleaseReq(F1AP_PDU_t *f1apMsg) +{ + uint8_t ieIdx; + UEContextReleaseRequest_t *ueReleaseReq = NULLP; + + if(f1apMsg) + { + if(f1apMsg->choice.initiatingMessage) + { + ueReleaseReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest; + if(ueReleaseReq->protocolIEs.list.array) + { + for(ieIdx=0 ; ieIdxprotocolIEs.list.count; ieIdx++) + { + DU_FREE(ueReleaseReq->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseRequest_t)); + } + DU_FREE(ueReleaseReq->protocolIEs.list.array, ueReleaseReq->protocolIEs.list.size); + } + DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); + } + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + } + +} +/*****************************************************************i +* +* @brief Build and Send UE Context Release Request +* +* @details +* +* Function : BuildAndSendUeContextReleaseReq +* +* Functionality: +* - Build and Send UE Context Release Request +* +* @params[in] +* @return ROK - success +* RFAILED - failure +* +* *************************************************************/ +uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueIdx) +{ + bool memAllocFail = false; + uint8_t ieIdx =0; + uint8_t ret = RFAILED; + uint16_t cellIdx =0; + uint16_t crnti = 0; + uint8_t elementCnt = 0; + uint32_t gnbCuUeF1apId =0; /* gNB-CU UE F1AP Id */ + uint32_t gnbDuUeF1apId =0; /* gNB-DU UE F1AP Id */ + asn_enc_rval_t encRetVal; + F1AP_PDU_t *f1apMsg = NULLP; + UEContextReleaseRequest_t *ueReleaseReq = NULLP; + + DU_LOG("\nINFO --> Building the UE Context Release Request"); + do + { + DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for f1apMsg"); + break; + } + + f1apMsg->present = F1AP_PDU_PR_initiatingMessage; + DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); + if(f1apMsg->choice.initiatingMessage == NULLP) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for\ + initiatingMessage"); + break; + } + f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextReleaseRequest; + f1apMsg->choice.initiatingMessage->criticality = Criticality_reject; + f1apMsg->choice.initiatingMessage->value.present = \ + InitiatingMessage__value_PR_UEContextReleaseRequest; + + ueReleaseReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest; + + elementCnt = 2; + + ueReleaseReq->protocolIEs.list.count = elementCnt; + ueReleaseReq->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseRequest_t *); + + /* Initialize the F1Setup members */ + DU_ALLOC(ueReleaseReq->protocolIEs.list.array,ueReleaseReq->protocolIEs.list.size); + if(ueReleaseReq->protocolIEs.list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE array"); + break; + } + for(ieIdx=0; ieIdxprotocolIEs.list.array[ieIdx],\ + sizeof(UEContextReleaseRequest_t)); + if(ueReleaseReq->protocolIEs.list.array[ieIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE elements"); + memAllocFail = true; + break; + } + } + if(memAllocFail == true) + break; + + /* Fetching Ue Cb Info*/ + GET_CELL_IDX(cellId, cellIdx); + if(duCb.actvCellLst[cellIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): CellId[%d] does not exist", cellId); + break; + } + else + { + GET_CRNTI(crnti, ueIdx); + if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].crnti != crnti) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseReq(): crnti[%d] does not exist", crnti); + break; + } + gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId; + gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId; + } + + ieIdx=0; + ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject; + ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present = \ + UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId; + + ieIdx++; + ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject; + ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present =\ + UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId; + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as APER */ + memset(encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf); + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseRequest structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + break; + } + else + { + DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseRequest\n"); + for(ieIdx=0; ieIdx< encBufSize; ieIdx++) + { + printf("%x",encBuf[ieIdx]); + } + } + + /* Sending msg */ + if(sendF1APMsg() != ROK) + { + DU_LOG("\nERROR --> F1AP : Sending UE Context Release Request failed"); + break; + } + ret = ROK; + break; + }while(true); + + FreeUeContextReleaseReq(f1apMsg); + return ret; +} +/*****************************************************************i + * + * @brief Free memory allocated for UE Context Release Complete + * + * @details + * + * Function : FreeUeContextReleaseComplete + * + * Functionality: + * - Free memory allocated for UE Context Release Complete + * + * @params[in] F1AP_PDU_t *f1apMsg + * @return void + * + * *************************************************************/ +void FreeUeContextReleaseComplete(F1AP_PDU_t *f1apMsg) +{ + uint8_t ieIdx; + UEContextReleaseComplete_t *ueReleaseComplete = NULLP; + + if(f1apMsg) + { + if(f1apMsg->choice.successfulOutcome) + { + ueReleaseComplete =&f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete; + if(ueReleaseComplete->protocolIEs.list.array) + { + for(ieIdx=0 ; ieIdxprotocolIEs.list.count; ieIdx++) + { + DU_FREE(ueReleaseComplete->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseComplete_t)); + } + DU_FREE(ueReleaseComplete->protocolIEs.list.array, ueReleaseComplete->protocolIEs.list.size); + } + DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + } + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + } + +} +/*****************************************************************i + * + * @brief Build and Send UE Context Release Complete + * + * @details + * + * Function : BuildAndSendUeContextReleaseComplete + * + * Functionality: + * - Build and Send UE Context Release Complete + * + * @params[in] cellId, gnbCuUeF1apId, gnbDuUeF1apId + * @return ROK - success + * RFAILED - failure + * + * *************************************************************/ +uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId) +{ + bool memAllocFail = false; + uint8_t ieIdx =0, ret = RFAILED, elementCnt = 0; + asn_enc_rval_t encRetVal; + F1AP_PDU_t *f1apMsg = NULLP; + UEContextReleaseComplete_t *ueReleaseComplete = NULLP; + + DU_LOG("\nINFO --> Building the UE Context Release Complete"); + do + { + DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for f1apMsg"); + break; + } + + f1apMsg->present = F1AP_PDU_PR_successfulOutcome; + DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + if(f1apMsg->choice.successfulOutcome == NULLP) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for\ + successfulOutcome"); + break; + } + f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextRelease; + f1apMsg->choice.successfulOutcome->criticality = Criticality_reject; + f1apMsg->choice.successfulOutcome->value.present = \ + SuccessfulOutcome__value_PR_UEContextReleaseComplete; + + ueReleaseComplete = &f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete; + + elementCnt = 2; + ueReleaseComplete->protocolIEs.list.count = elementCnt; + ueReleaseComplete->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseComplete_t *); + + /* Initialize the UE Release Complete members */ + DU_ALLOC(ueReleaseComplete->protocolIEs.list.array,ueReleaseComplete->protocolIEs.list.size); + if(ueReleaseComplete->protocolIEs.list.array == NULLP) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE array"); + break; + } + for(ieIdx=0; ieIdxprotocolIEs.list.array[ieIdx],\ + sizeof(UEContextReleaseComplete_t)); + if(ueReleaseComplete->protocolIEs.list.array[ieIdx] == NULLP) + { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE\ + elements"); + memAllocFail = true; + break; + } + } + if(memAllocFail == true) + break; + + + ieIdx=0; + ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject; + ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present = \ + UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID; + ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId; + + ieIdx++; + ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject; + ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present =\ + UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID; + ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId; + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupComplete type as APER */ + memset(encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf); + /* Encode results */ + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG("\nERROR --> F1AP : Could not encode UEContextReleaseComplete structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + break; + } + else + { + DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UEContextReleaseComplete\n"); + for(ieIdx=0; ieIdx< encBufSize; ieIdx++) + { + printf("%x",encBuf[ieIdx]); + } + } + + /* Sending msg */ + if(sendF1APMsg() != ROK) + { + DU_LOG("\nERROR --> F1AP : Sending UE Context Release Complete failed"); + break; + } + ret = ROK; + break; + }while(true); + + if(ret == ROK && (duCb.actvCellLst[cellId-1]->numActvUes == 0)) + { + duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS; + ret = duSendCellDeletReq(cellId); + if(ret != ROK) + { + DU_LOG("\nERROR --> F1AP: BuildAndSendUeContextReleaseComplete(): Failed to process cell\ + Delete req for CellId"); + } + } + FreeUeContextReleaseComplete(f1apMsg); + return ret; + +} + +/******************************************************************* +* +* @brief added free part for the memory allocated by aper_decoder +* +* @details +* +* Function : freeAperDecodeUeContextReleaseCommand +* +* Functionality: added free part for the memory allocated by aper_decoder +* +* @params[in] F1AP_PDU_t *f1apMsg +* @return void +* +* ****************************************************************/ +void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg) +{ + uint8_t ieIdx=0; + UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP; + + ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand; + + if(ueContextReleaseCommand->protocolIEs.list.array) + { + for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++) + { + if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]) + { + switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + break; + case ProtocolIE_ID_id_Cause: + break; + case ProtocolIE_ID_id_RRCContainer: + { + if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf) + { + free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf); + } + break; + } + default : + DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\ + ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id); + break; + } + } + free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]); + } + free(ueContextReleaseCommand->protocolIEs.list.array); + } +} +/******************************************************************* +* +* @brief processing of UE Context Release Command +* +* @details +* +* Function : procF1UeContextReleaseCommand +* +* Functionality: processing of UE Context Release Command +* +* @params[in] F1AP_PDU_t *f1apMsg +* @return void +* +* ****************************************************************/ +uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg) +{ + uint8_t ieIdx=0, ret=ROK, ueIdx=0; + uint16_t cellIdx =0; + bool ueIdxFound; + uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0; + DuUeCb *duUeCb = NULLP; + UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP; + + ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand; + + if(ueContextReleaseCommand->protocolIEs.list.array) + { + for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++) + { + if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]) + { + switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + { + gnbCuUeF1apId= ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\ + value.choice.GNB_CU_UE_F1AP_ID; + break; + } + + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + { + gnbDuUeF1apId = ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\ + value.choice.GNB_DU_UE_F1AP_ID; + break; + } + + case ProtocolIE_ID_id_Cause: + { + break; + } + + case ProtocolIE_ID_id_RRCContainer: + { + for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++) + { + for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) + { + if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\ + (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)) + { + duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx]; + DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb)); + if(duUeCb->f1UeDb) + { + memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb)); + duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE; + duUeCb->f1UeDb->cellIdx = cellIdx; + /* Filling Dl RRC Msg Info */ + DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg)); + if(!duUeCb->f1UeDb->dlRrcMsg) + { + DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \ + Memory allocation failed "); + ret = RFAILED; + } + else + { + duUeCb->f1UeDb->dlRrcMsgPres = true; + memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg)); + ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\ + &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\ + value.choice.RRCContainer); + } + + } + else + { + DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \ + Memory allocation failed "); + ret = RFAILED; + + } + + ueIdxFound = true; + break; + } + } + if(ueIdxFound == true) + { + break; + } + } + if(!ueIdxFound) + { + DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextReleaseCommand()"); + ret = RFAILED; + } + + + break; + } + default : + DU_LOG("\nERROR --> F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\ + ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id); + break; + } + } + } + } + if(ret != RFAILED) + { + duProcUeContextReleaseCommand(duUeCb); + } + freeAperDecodeUeContextReleaseCommand(f1apMsg); + return ret; +} +/************************************************************** + * + * @brief Handles received F1AP message and sends back response + * + * @details + * + * Function : F1APMsgHdlr + * + * Functionality: + * - Decodes received F1AP control message + * - Prepares response message, encodes and sends to SCTP + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void F1APMsgHdlr(Buffer *mBuf) +{ + int i =0; char *recvBuf =NULLP; MsgLen copyCnt =0; MsgLen recvBufLen =0; @@ -11155,74 +13752,84 @@ void F1APMsgHdlr(Buffer *mBuf) switch(f1apMsg->present) { case F1AP_PDU_PR_successfulOutcome: - { - switch(f1apMsg->choice.successfulOutcome->value.present) - { - case SuccessfulOutcome__value_PR_ResetAcknowledge: - { - DU_LOG("\nINFO --> F1AP : F1ResetAcknowledge is received successfully "); - break; - } - case SuccessfulOutcome__value_PR_F1SetupResponse: - { + { + switch(f1apMsg->choice.successfulOutcome->value.present) + { + case SuccessfulOutcome__value_PR_ResetAcknowledge: + { + DU_LOG("\nINFO --> F1AP : F1ResetAcknowledge is received successfully "); + break; + } + case SuccessfulOutcome__value_PR_F1SetupResponse: + { #ifndef ODU_TEST_STUB - procF1SetupRsp(f1apMsg); + procF1SetupRsp(f1apMsg); #endif - break; - } + break; + } - case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge: - { - procF1GNBDUCfgUpdAck(f1apMsg); - break; - } + case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge: + { + procF1GNBDUCfgUpdAck(f1apMsg); + break; + } - default: - { - DU_LOG("\nERROR --> F1AP : Invalid type of SuccessfulOutcome__value_PR_ResetAcknowledge [%d]",\ - f1apMsg->choice.successfulOutcome->value.present); - return; - } - }/* End of switch(successfulOutcome) */ - free(f1apMsg->choice.successfulOutcome); - break; - } + default: + { + DU_LOG("\nERROR --> F1AP : Invalid type of SuccessfulOutcome__value_PR_ResetAcknowledge [%d]",\ + f1apMsg->choice.successfulOutcome->value.present); + return; + } + }/* End of switch(successfulOutcome) */ + free(f1apMsg->choice.successfulOutcome); + break; + } case F1AP_PDU_PR_initiatingMessage: - { - switch(f1apMsg->choice.initiatingMessage->value.present) - { - case InitiatingMessage__value_PR_Reset: - { - procF1ResetReq(f1apMsg); - break; - } - case InitiatingMessage__value_PR_DLRRCMessageTransfer: - { - procF1DlRrcMsgTrans(f1apMsg); - break; - } - case InitiatingMessage__value_PR_UEContextSetupRequest: - { - procF1UeContextSetupReq(f1apMsg); - break; - } - default: - { - DU_LOG("\nERROR --> F1AP : Invalid type of F1AP_PDU_PR_initiatingMessage [%d]", - f1apMsg->choice.initiatingMessage->value.present); - return; - } - }/* End of switch(initiatingMessage) */ - free(f1apMsg->choice.initiatingMessage); - break; - } + { + switch(f1apMsg->choice.initiatingMessage->value.present) + { + case InitiatingMessage__value_PR_Reset: + { + procF1ResetReq(f1apMsg); + break; + } + case InitiatingMessage__value_PR_DLRRCMessageTransfer: + { + procF1DlRrcMsgTrans(f1apMsg); + break; + } + case InitiatingMessage__value_PR_UEContextSetupRequest: + { + procF1UeContextSetupReq(f1apMsg); + break; + } + case InitiatingMessage__value_PR_UEContextModificationRequest: + { + procF1UeContextModificationReq(f1apMsg); + break; + } + case InitiatingMessage__value_PR_UEContextReleaseCommand: + { + procF1UeContextReleaseCommand(f1apMsg); + break; + } + default: + { + DU_LOG("\nERROR --> F1AP : Invalid type of F1AP_PDU_PR_initiatingMessage [%d]", + f1apMsg->choice.initiatingMessage->value.present); + return; + } + }/* End of switch(initiatingMessage) */ + free(f1apMsg->choice.initiatingMessage); + break; + } default: - { - DU_LOG("\nERROR --> F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present); - return; - } - free(f1apMsg); + { + DU_LOG("\nERROR --> F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present); + return; + } + free(f1apMsg); }/* End of switch(f1apMsg->present) */