From 088bb8763eaf91c139ede025faf2fac7e57d25ed Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Mon, 14 Sep 2020 16:58:42 +0530 Subject: [PATCH] DL RRC Message Transfer from DU APP to RLC [Issue-ID: ODUHIGH-45] Change-Id: I44888c052dc8e2dbd7cd77d4ae3976b8851588dd Signed-off-by: Balaji Shankaran --- build/odu/makefile | 2 +- docs/README | 5 +- src/5gnrmac/lwr_mac_upr_inf.c | 2 +- src/5gnrrlc/kw.x | 1 + src/5gnrrlc/kw_dl_ex_ms.c | 23 +- src/5gnrrlc/kw_udx_ul.c | 2 +- src/5gnrrlc/kw_ul_ex_ms.c | 18 +- src/5gnrrlc/mac_stub.c | 4 +- src/5gnrrlc/rlc.h | 56 -- src/5gnrrlc/rlc_msg_hdl.c | 63 +- src/5gnrrlc/rlc_utils.h | 1 + src/cm/common_def.h | 5 +- src/cm/du_app_mac_inf.c | 60 +- src/cm/du_app_rlc_inf.c | 92 +- src/cm/du_app_rlc_inf.h | 40 +- src/cm/legtp.c | 16 +- src/cm/lsctp.c | 2 +- src/cm/mac_sch_interface.c | 2 +- src/codec_utils/F1AP/CUtoDURRCInformation.h | 2 +- src/cu_stub/cu_f1ap_msg_hdl.c | 1193 +++++++++++++++++++++++++- src/cu_stub/cu_f1ap_msg_hdl.h | 24 +- src/cu_stub/cu_stub.h | 20 +- src/cu_stub/cu_stub_egtp.c | 18 +- src/cu_stub/cu_stub_sctp.c | 4 +- src/du_app/du_cfg.c | 2 +- src/du_app/du_e2ap_msg_hdl.c | 8 +- src/du_app/du_egtp.c | 6 +- src/du_app/du_f1ap_msg_hdl.c | 1236 +++++---------------------- src/du_app/du_mgr_ex_ms.c | 16 +- src/du_app/du_msg_hdl.c | 4 +- src/du_app/du_sctp.c | 4 +- src/du_app/du_ue_mgr.c | 194 ++++- src/ric_stub/ric_e2ap_msg_hdl.c | 8 +- src/ric_stub/ric_stub_sctp.c | 4 +- 34 files changed, 1864 insertions(+), 1273 deletions(-) delete mode 100644 src/5gnrrlc/rlc.h diff --git a/build/odu/makefile b/build/odu/makefile index 634fc7a60..edb6b6e70 100644 --- a/build/odu/makefile +++ b/build/odu/makefile @@ -70,7 +70,7 @@ endif # macro for output file name and makefile name # -PLTFRM_FLAGS= -UMSPD -DODU #-DINTEL_FAPI -DINTEL_WLS -DEGTP_TEST +PLTFRM_FLAGS= -UMSPD -DODU #-DINTEL_FAPI #-DINTEL_WLS -DEGTP_TEST ifeq ($(MODE),TDD) PLTFRM_FLAGS += -DMODE=TDD diff --git a/docs/README b/docs/README index 61147fbba..3a0bf8a2c 100644 --- a/docs/README +++ b/docs/README @@ -9,7 +9,7 @@ Directory Structure : 2. l2/src/ : contains layer specific source code a. 5gnrmac : MAC source code - b. 5gnrrlc : RLC source code + b. 5gnrrlc : RLC source code c. cm : common, environment and interface files d. cu_stub : Stub code for CU e. du_app : DU application and F1 code @@ -22,6 +22,9 @@ Pre-requisite for Compilation : ------------------------------- 1. Linux 32-bit/64-bit machine 2. GCC version 4.6.3 and above +3. Install LKSCTP + a. On Ubuntu : sudo apt-get install -y libsctp-dev + b. On CentOS : yum install lksctp-tools How to Clean and Build: diff --git a/src/5gnrmac/lwr_mac_upr_inf.c b/src/5gnrmac/lwr_mac_upr_inf.c index 13b41a07b..64255f92d 100644 --- a/src/5gnrmac/lwr_mac_upr_inf.c +++ b/src/5gnrmac/lwr_mac_upr_inf.c @@ -117,7 +117,7 @@ uint8_t packRachInd(Pst *pst, RachInd *rachInd) uint8_t packLcSlotInd (Pst *pst, SlotIndInfo *slotInd) { Buffer *mBuf = NULLP; - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { return RFAILED; } diff --git a/src/5gnrrlc/kw.x b/src/5gnrrlc/kw.x index 517ddccce..227e97f08 100755 --- a/src/5gnrrlc/kw.x +++ b/src/5gnrrlc/kw.x @@ -610,6 +610,7 @@ typedef struct rlcCb RlcUlCb *ulCb; /*!< Ul Control Block */ RlcDlCb *dlCb; /*!< Dl Control Block */ } u; + uint8_t dlSduId; /*!< Downlink SDU ID */ }RlcCb; EXTERN RlcCb *rlcCb[MAX_RLC_INSTANCES]; /*!< RLC global control block */ diff --git a/src/5gnrrlc/kw_dl_ex_ms.c b/src/5gnrrlc/kw_dl_ex_ms.c index e069a598a..ea4fc8fa0 100755 --- a/src/5gnrrlc/kw_dl_ex_ms.c +++ b/src/5gnrrlc/kw_dl_ex_ms.c @@ -58,6 +58,7 @@ static int RLOG_FILE_ID=195; #include "kw.x" #include "kw_udx.x" #include "kw_dl.x" +#include "du_app_rlc_inf.h" #include "ctf.h" S16 rlcUtlDlBatchProcPkts(Void); @@ -287,8 +288,14 @@ Buffer *mBuf; /* message buffer */ break; } #endif /* LCKWU */ + + case EVENT_DL_RRC_MSG_TRANS_TO_RLC: + { + ret = unpackDlRrcMsgToRlc(RlcProcDlRrcMsgTransfer, pst, mBuf); + break; + } default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_ERROR,"Received Invalid Event[%d] from SM", @@ -370,7 +377,7 @@ Buffer *mBuf; /* message buffer */ } default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_ERROR,"Received Invalid Event[%d] from RLC UL", @@ -420,7 +427,7 @@ Buffer *mBuf; /* message buffer */ #endif /* LCKWU */ default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_ERROR,"Received Invalid Event[%d] from RRC", @@ -470,7 +477,7 @@ Buffer *mBuf; /* message buffer */ } default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_ERROR,"Received Invalid Event[%d] from PDCP", @@ -521,7 +528,7 @@ Buffer *mBuf; /* message buffer */ #endif default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_ERROR,"Received Invalid Event[%d] from MAC", @@ -543,7 +550,7 @@ Buffer *mBuf; /* message buffer */ break; } } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } #endif @@ -571,7 +578,7 @@ Buffer *mBuf; /* message buffer */ rlcUtlFreeDlMem(); #endif - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } } @@ -587,7 +594,7 @@ Buffer *mBuf; /* message buffer */ RLOG1(L_ERROR, "Received Invalid Source Entity[%d]", pst->event); } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); ret = RFAILED; break; } diff --git a/src/5gnrrlc/kw_udx_ul.c b/src/5gnrrlc/kw_udx_ul.c index 6cd5ae1bd..ac6dc9877 100755 --- a/src/5gnrrlc/kw_udx_ul.c +++ b/src/5gnrrlc/kw_udx_ul.c @@ -60,7 +60,7 @@ static int RLOG_FILE_ID=204; #include "kw_dl.x" #include "kw_ul.x" -#include "rlc.h" +#include "rlc_utils.h" #include "du_app_rlc_inf.h" #include "rlc_mgr.h" diff --git a/src/5gnrrlc/kw_ul_ex_ms.c b/src/5gnrrlc/kw_ul_ex_ms.c index 108c30add..8f9218d88 100755 --- a/src/5gnrrlc/kw_ul_ex_ms.c +++ b/src/5gnrrlc/kw_ul_ex_ms.c @@ -278,7 +278,7 @@ Buffer *mBuf; /* message buffer */ #endif #endif /* LCLKW */ default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_FATAL,"Received Invalid Event[%d] from SM", @@ -323,7 +323,7 @@ Buffer *mBuf; /* message buffer */ #endif /* LCCKW */ default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_ERROR,"Received Invalid Event[%d] from RLC UL", @@ -375,7 +375,7 @@ Buffer *mBuf; /* message buffer */ } #endif /* LCKWU */ default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_ERROR,"Received Invalid Event[%d] from RRC", @@ -406,7 +406,7 @@ Buffer *mBuf; /* message buffer */ } default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_ERROR,"Received Invalid Event[%d] from PDCP", @@ -439,7 +439,7 @@ Buffer *mBuf; /* message buffer */ #endif /* LCRGU */ default: - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); if (pst->dstInst < MAX_RLC_INSTANCES) { RLOG1(L_ERROR,"Received Invalid Event[%d] from MAC", @@ -458,7 +458,7 @@ Buffer *mBuf; /* message buffer */ case KWU_EVT_TTI_IND: { rlcUlBatchProc(); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } } @@ -478,14 +478,14 @@ Buffer *mBuf; /* message buffer */ tRlcCb = RLC_GET_RLCCB(pst->dstInst); TSL2SendStatsToApp(&(tRlcCb->genCfg.lmPst), 0); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } default: { printf("\n ERROR Invalid Event[%d] from CL to PDCPUL\n", pst->event); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } } @@ -499,7 +499,7 @@ Buffer *mBuf; /* message buffer */ { RLOG1(L_ERROR, "Received Invalid Source Entity[%d]",pst->event); } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); ret = RFAILED; break; } diff --git a/src/5gnrrlc/mac_stub.c b/src/5gnrrlc/mac_stub.c index 873886d4d..7bf768b0a 100644 --- a/src/5gnrrlc/mac_stub.c +++ b/src/5gnrrlc/mac_stub.c @@ -69,7 +69,7 @@ uint8_t macStubSendDlData(Pst *pst, SpId spId, RlcMacData *dlData) DU_LOG("\nMAC_STUB : Received DL data from RLC to be sent to PHY"); - ODU_PUT_MSG(dlData->pduInfo[0].pduBuf); + ODU_PUT_MSG_BUF(dlData->pduInfo[0].pduBuf); dlData->pduInfo[0].pduBuf = NULL; #if 0 @@ -84,7 +84,7 @@ uint8_t macStubSendDlData(Pst *pst, SpId spId, RlcMacData *dlData) #endif ulData = dlData; - ODU_GET_MSG(pst->region, pst->pool, &mBuf); + ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf); macStubBuildUlData(mBuf); ulData->pduInfo[0].pduBuf = mBuf; diff --git a/src/5gnrrlc/rlc.h b/src/5gnrrlc/rlc.h deleted file mode 100644 index e19e55c20..000000000 --- a/src/5gnrrlc/rlc.h +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* -################################################################################ -# Copyright (c) [2017-2019] [Radisys] # -# # -# Licensed under the Apache License, Version 2.0 (the "License"); # -# you may not use this file except in compliance with the License. # -# You may obtain a copy of the License at # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # -# See the License for the specific language governing permissions and # -# limitations under the License. # -################################################################################ -*******************************************************************************/ -/* This file contains defines for RLC layer */ - -/* Memory */ -#define RLC_MEM_REGION_UL 1 -#define RLC_MEM_REGION_DL 4 -#define RLC_POOL 1 - -/* Inst */ -#define RLC_UL_INST 0 -#define RLC_DL_INST 1 - -/* Fill Pst structure for sending msg from RLC to DUAPP */ -#define FILL_PST_RLC_TO_DUAPP(_pst, _procId, _srcInst, _event) \ -{ \ - _pst.selector = ODU_SELECTOR_LWLC; \ - _pst.srcEnt = ENTRLC; \ - _pst.dstEnt = ENTDUAPP; \ - _pst.dstInst = 0; \ - _pst.srcInst = _srcInst; \ - _pst.dstProcId = _procId; \ - _pst.srcProcId = _procId; \ - if(_srcInst == RLC_UL_INST) \ - { \ - _pst.region = RLC_MEM_REGION_UL; \ - } \ - else if(_srcInst == RLC_DL_INST) \ - { \ - _pst.region = RLC_MEM_REGION_DL; \ - } \ - _pst.pool = RLC_POOL; \ - _pst.event = _event; \ - _pst.route = 0; \ - _pst.prior = 0; \ - _pst.intfVer = 0; \ -} - -/********************************************************************** - End of file -**********************************************************************/ diff --git a/src/5gnrrlc/rlc_msg_hdl.c b/src/5gnrrlc/rlc_msg_hdl.c index 36f0ec167..713fc2779 100644 --- a/src/5gnrrlc/rlc_msg_hdl.c +++ b/src/5gnrrlc/rlc_msg_hdl.c @@ -35,9 +35,7 @@ #include "kw.x" #include "du_app_rlc_inf.h" -#include "rlc.h" - -extern U16 getTransId(); +#include "rlc_utils.h" /******************************************************************* * @@ -211,6 +209,65 @@ uint8_t RlcUlProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg) RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg)); return ret; } + +/******************************************************************* + * + * @brief Process the DL RRC Message from DU APP + * + * @details + * + * Function : RlcProcDlRrcMsgTransfer + * + * Functionality: Process the DL RRC Message from DU APP + * + * @params[in] Post structure + * DL RRC Message info + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo) +{ + uint16_t copyLen; + Buffer *mBuf; + KwuDatReqInfo *datReqInfo; + + RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo)); + if(!datReqInfo) + { + DU_LOG("\nRLC : Memory allocation failed in RlcProcDlRrcMsgTransfer"); + return RFAILED; + } + + datReqInfo->rlcId.rbType = dlRrcMsgInfo->rbType; + datReqInfo->rlcId.rbId = dlRrcMsgInfo->rbId; + datReqInfo->rlcId.ueId = dlRrcMsgInfo->ueIdx; + datReqInfo->rlcId.cellId = dlRrcMsgInfo->cellId; + datReqInfo->lcType = dlRrcMsgInfo->lcType; + datReqInfo->sduId = ++(rlcCb[pst->dstInst]->dlSduId); + + /* Copy fixed buffer to message */ + if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &mBuf) != ROK) + { + DU_LOG("\nRLC : Memory allocation failed at RlcMacProcUlData"); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo)); + return RFAILED; + } + /* ODU_COPY_FIX_BUF_TO_MSG copies fixed buffer in reverse order. Hence reversing the + * fixed buffer before copying in order to maintain the actual order*/ + reverseFixBuf(dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen); + ODU_COPY_FIX_BUF_TO_MSG(dlRrcMsgInfo->rrcMsg, mBuf, 0, dlRrcMsgInfo->msgLen, \ + (MsgLen *)©Len); + + RlcUiKwuDatReq(pst, datReqInfo, mBuf); + + /* Free memory allocated by du app */ + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_DL, RLC_POOL, datReqInfo, sizeof(KwuDatReqInfo)); + RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen); + RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo)); + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrrlc/rlc_utils.h b/src/5gnrrlc/rlc_utils.h index 47183236f..c7126aefa 100644 --- a/src/5gnrrlc/rlc_utils.h +++ b/src/5gnrrlc/rlc_utils.h @@ -51,6 +51,7 @@ } void reverseFixBuf(uint8_t *buf, uint16_t len); +uint16_t getTransId(); /********************************************************************** End of file diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 63416d203..bf7518a6b 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -70,8 +70,8 @@ #define ODU_END_CRNTI 500 /* Defining macros for common utility functions */ -#define ODU_GET_MSG SGetMsg -#define ODU_PUT_MSG SPutMsg +#define ODU_GET_MSG_BUF SGetMsg +#define ODU_PUT_MSG_BUF SPutMsg #define ODU_ADD_PRE_MSG_MULT SAddPreMsgMult #define ODU_ADD_POST_MSG_MULT SAddPstMsgMult #define ODU_START_TASK SStartTask @@ -79,6 +79,7 @@ #define ODU_ATTACH_TTSK SAttachTTsk #define ODU_POST_TASK SPstTsk #define ODU_COPY_MSG_TO_FIX_BUF SCpyMsgFix +#define ODU_COPY_FIX_BUF_TO_MSG SCpyFixMsg #define ODU_REG_TTSK SRegTTsk #define ODU_SET_PROC_ID SSetProcId #define ODU_FIND_MSG_LEN SFndLenMsg diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 75ff5c1e1..68379e429 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -47,7 +47,7 @@ uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg) { Buffer *mBuf = NULLP; - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { return RFAILED; } @@ -121,7 +121,7 @@ uint8_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) if(pst->selector == ODU_SELECTOR_LC) { Buffer *mBuf = NULLP; - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { return RFAILED; } @@ -204,7 +204,7 @@ uint8_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) else if(pst->selector == ODU_SELECTOR_LWLC) { - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); return RFAILED; @@ -243,13 +243,13 @@ uint8_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf) { /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStartInfo, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, cellStartInfo); } else { /* Nothing to do for loose coupling */ - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return ROK; } } @@ -282,7 +282,7 @@ uint8_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) { Buffer *mBuf = NULLP; - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nDU APP : Memory allocation failed for cell stop req pack"); return RFAILED; @@ -322,13 +322,13 @@ uint8_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf) { /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStopInfo, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, cellStopInfo); } else { /* Nothing to do for loose coupling */ - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return ROK; } } @@ -354,7 +354,7 @@ uint8_t packMacSlotInd(Pst *pst, SlotIndInfo *slotInfo ) { Buffer *mBuf = NULLP; - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); return RFAILED; @@ -376,7 +376,7 @@ uint8_t packMacSlotInd(Pst *pst, SlotIndInfo *slotInfo ) } else { - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } return ODU_POST_TASK(pst,mBuf); @@ -408,7 +408,7 @@ uint8_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&slotInfo, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, slotInfo); } else if(pst->selector == ODU_SELECTOR_LC) @@ -419,14 +419,14 @@ uint8_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) CMCHKUNPK(oduPackUInt16, &(slotInfo.sfn), mBuf); CMCHKUNPK(oduPackUInt16, &(slotInfo.cellId), mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, &slotInfo); } else { /* Nothing to do for loose coupling */ - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return ROK; } return ROK; @@ -452,7 +452,7 @@ uint8_t packMacStopInd(Pst *pst, MacCellStopInfo *cellStopId) { Buffer *mBuf = NULLP; - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nDU APP : Memory allocation failed for stop Ind pack"); return RFAILED; @@ -473,7 +473,7 @@ uint8_t packMacStopInd(Pst *pst, MacCellStopInfo *cellStopId) } else { - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } return ODU_POST_TASK(pst,mBuf); @@ -504,7 +504,7 @@ uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf) MacCellStopInfo *cellStopId; /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStopId, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, cellStopId); } else if(pst->selector == ODU_SELECTOR_LC) @@ -512,14 +512,14 @@ uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf) MacCellStopInfo cellStopId; CMCHKUNPK(oduPackUInt16, &(cellStopId.cellId), mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, &cellStopId); } else { /* Nothing to do for loose coupling */ - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return ROK; } return ROK; @@ -548,7 +548,7 @@ uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo) if(pst->selector == ODU_SELECTOR_LWLC) { - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nMAC : Memory allocation failed at packMacUlCcchInd"); return RFAILED; @@ -591,14 +591,14 @@ uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf) /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&ulCcchIndInfo, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, ulCcchIndInfo); } else { /* Nothing to do for other selectors */ DU_LOG("\n Only LWLC supported for UL CCCH Ind "); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } return RFAILED; } @@ -627,7 +627,7 @@ uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo) if(pst->selector == ODU_SELECTOR_LWLC) { - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nMAC : Memory allocation failed at packMacDlCcchInd"); return RFAILED; @@ -670,14 +670,14 @@ uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf) /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&dlCcchIndInfo, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, dlCcchIndInfo); } else { /* Nothing to do for other selectors */ DU_LOG("\n Only LWLC supported for DL CCCH Ind "); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } return RFAILED; @@ -707,7 +707,7 @@ uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg) if(pst->selector == ODU_SELECTOR_LWLC) { - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCreateReq"); return RFAILED; @@ -750,14 +750,14 @@ uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf) /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, ueCfg); } else { /* Nothing to do for other selectors */ DU_LOG("\n Only LWLC supported for UE Create Request "); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } return RFAILED; @@ -785,7 +785,7 @@ uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp) if(pst->selector == ODU_SELECTOR_LWLC) { - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCfgRsp"); return RFAILED; @@ -825,11 +825,11 @@ uint8_t unpackDuMacUeCreateRsp(DuMacUeCreateRspFunc func, Pst *pst, Buffer *mBuf /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, cfgRsp); } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } diff --git a/src/cm/du_app_rlc_inf.c b/src/cm/du_app_rlc_inf.c index b2ebef662..42a51dd92 100644 --- a/src/cm/du_app_rlc_inf.c +++ b/src/cm/du_app_rlc_inf.c @@ -43,7 +43,7 @@ uint8_t packDuRlcUlUeCreateReq(Pst *pst, RlcUeCfg *ueCfg) if(pst->selector == ODU_SELECTOR_LWLC) { - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nRLC : Memory allocation failed at packDuRlcUeCreateReq"); return RFAILED; @@ -85,14 +85,14 @@ uint8_t unpackRlcUlUeCreateReq(DuRlcUlUeCreateReq func, Pst *pst, Buffer *mBuf) RlcUeCfg *ueCfg; /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, ueCfg); } else { /* Nothing to do for other selectors */ DU_LOG("\nRLC: Only LWLC supported for UE Create Request "); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } return RFAILED; @@ -122,7 +122,7 @@ uint8_t packRlcUlDuUeCreateRsp(Pst *pst, RlcUeCfgRsp *ueCfg) if(pst->selector == ODU_SELECTOR_LWLC) { - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nRLC : Memory allocation failed at packRlcUlDuUeCreateRsp"); return RFAILED; @@ -164,14 +164,14 @@ uint8_t unpackRlcUlUeCreateRsp(RlcUlDuUeCreateRsp func, Pst *pst, Buffer *mBuf) RlcUeCfgRsp *cfgRsp; /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, cfgRsp); } else { /* Nothing to do for other selectors */ DU_LOG("\nRLC: Only LWLC supported for UE Create Response "); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } return RFAILED; @@ -200,7 +200,7 @@ uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo) if(pst->selector == ODU_SELECTOR_LWLC) { - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { DU_LOG("\nRLC : Memory allocation failed at packRlcUlRrcMsgToDu"); return RFAILED; @@ -239,19 +239,93 @@ uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf) RlcUlRrcMsgInfo *ulRrcMsgInfo; /* unpack the address of the structure */ CMCHKUNPK(oduUnpackPointer, (PTR *)&ulRrcMsgInfo, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return (*func)(pst, ulRrcMsgInfo); } else { /* Nothing to do for other selectors */ DU_LOG("\nRLC: Only LWLC supported for UL RRC Message transfer "); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } return RFAILED; } +/******************************************************************* + * + * @brief Pack and post DL RRC Message from DU APP to RLC + * + * @details + * + * Function : packDlRrcMsgToRlc + * + * Functionality: Pack and post DL RRC Message from DU APP to RLC + * + * @params[in] Post structure + * DL RRC Message info + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nRLC : Memory allocation failed at packRlcUlRrcMsgToDu"); + return RFAILED; + } + /* pack the address of the structure */ + CMCHKPK(oduPackPointer,(PTR)dlRrcMsgInfo, mBuf); + return ODU_POST_TASK(pst,mBuf); + } + else + { + DU_LOG("\nRLC: Only LWLC supported for packDlRrcMsgToRlc"); + } + return RFAILED; +} + +/******************************************************************* + * + * @brief Unpacks DL RRC Message info received at RLC from DU APP + * + * @details + * + * Function : unpackDlRrcMsgToRlc + * + * Functionality: + * Unpacks the DL RRC Message info received at RLC from DU APP + * + * @params[in] Pointer to handler function + * Post structure + * Messae buffer to be unpacked + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + RlcDlRrcMsgInfo *dlRrcMsgInfo; + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&dlRrcMsgInfo, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, dlRrcMsgInfo); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nRLC: Only LWLC supported for UL RRC Message transfer "); + ODU_PUT_MSG_BUF(mBuf); + } + return RFAILED; +} /********************************************************************** End of file diff --git a/src/cm/du_app_rlc_inf.h b/src/cm/du_app_rlc_inf.h index b4330f3f9..5cfe45bfb 100644 --- a/src/cm/du_app_rlc_inf.h +++ b/src/cm/du_app_rlc_inf.h @@ -20,11 +20,14 @@ #ifndef __RLC_INF_H__ #define __RLC_INF_H__ -/* Macro for Ue Context */ -#define MAX_NUM_LOGICAL_CHANNELS 11 +/* Events */ #define EVENT_RLC_UL_UE_CREATE_REQ 210 #define EVENT_RLC_UL_UE_CREATE_RSP 211 /*!< Config Confirm */ #define EVENT_UL_RRC_MSG_TRANS_TO_DU 212 +#define EVENT_DL_RRC_MSG_TRANS_TO_RLC 213 + +/* Macro for Ue Context */ +#define MAX_NUM_LOGICAL_CHANNELS 11 #define RB_ID_SRB 0 #define RB_ID_DRB 1 @@ -500,6 +503,21 @@ typedef struct ulRrcMsgInfo uint8_t *rrcMsg; /* RRC Message (UL-DCCH Message) */ }RlcUlRrcMsgInfo; +/* DL RRC Message from DU APP to RLC */ +typedef struct dlRrcMsgInfo +{ + uint16_t cellId; /* Cell Id */ + uint16_t ueIdx; /* UE index */ + uint8_t rbType; /* Radio Bearer Type */ + uint8_t rbId; /* Radio Bearer Id */ + uint8_t lcType; /* Logical channel type */ + uint8_t lcId; /* Logical channel Id */ + bool execDup; /* Execution duplication enabled */ + bool deliveryStaRpt; /* Reporting of delivery status by RLC to DU-APP enabled */ + uint16_t msgLen; /* RRC Message length */ + uint8_t *rrcMsg; /* RRC Message (DL-DCCH Message) */ +}RlcDlRrcMsgInfo; + /* Function Pointers */ /* UE create Request from DU APP to RLC*/ typedef uint8_t (*DuRlcUlUeCreateReq) ARGS(( @@ -516,16 +534,26 @@ typedef uint8_t (*RlcUlRrcMsgToDuFunc) ARGS(( Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo)); -/* Function Declarations */ +/* DL RRC Message from DU APP to RLC */ +typedef uint8_t (*DuDlRrcMsgToRlcFunc) ARGS(( + Pst *pst, + RlcDlRrcMsgInfo *dlRrcMsgInfo)); + +/* Pack/Unpack function declarations */ uint8_t packDuRlcUlUeCreateReq(Pst *pst, RlcUeCfg *ueCfg); uint8_t unpackRlcUlUeCreateReq(DuRlcUlUeCreateReq func, Pst *pst, Buffer *mBuf); -uint8_t RlcUlProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg); uint8_t packRlcUlDuUeCreateRsp(Pst *pst, RlcUeCfgRsp *ueCfgRsp); uint8_t unpackRlcUlUeCreateRsp(RlcUlDuUeCreateRsp func, Pst *pst, Buffer *mBuf); -uint8_t DuProcRlcUlUeCreateRsp(Pst *pst, RlcUeCfgRsp *cfgRsp); uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo); -uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo); uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf); +uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo); +uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf); + +/* Event Handler function declarations */ +uint8_t RlcUlProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg); +uint8_t DuProcRlcUlUeCreateRsp(Pst *pst, RlcUeCfgRsp *cfgRsp); +uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo); +uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo); #endif /* RLC_INF_H */ diff --git a/src/cm/legtp.c b/src/cm/legtp.c index 5e676741a..837cd95ac 100644 --- a/src/cm/legtp.c +++ b/src/cm/legtp.c @@ -92,7 +92,7 @@ uint8_t packEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) { Buffer *mBuf; - if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nDU_APP : Failed to allocate memory"); return RFAILED; @@ -160,7 +160,7 @@ uint8_t unpackEgtpCfgReq(EgtpCfgReq func, Pst *pst, Buffer *mBuf) oduPackUInt32(&(egtpCfg.localIp.ipV4Addr), mBuf); } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return ((*func)(pst, egtpCfg)); } @@ -188,7 +188,7 @@ uint8_t packEgtpCfgCfm(Pst *pst, CmStatus cfm) { Buffer *mBuf; - if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nEGTP : Failed to allocate memory"); return RFAILED; @@ -247,7 +247,7 @@ uint8_t packEgtpSrvOpenReq(Pst *pst) { Buffer *mBuf; - if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nDU_APP : Failed to allocate memory"); return RFAILED; @@ -300,7 +300,7 @@ uint8_t packEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) { Buffer *mBuf; - if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nEGTP : Failed to allocate memory"); return RFAILED; @@ -362,7 +362,7 @@ uint8_t packEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) { Buffer *mBuf; - if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nDU_APP : Failed to allocate memory"); return RFAILED; @@ -432,7 +432,7 @@ uint8_t packEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) { Buffer *mBuf; - if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nEGTP : Failed to allocate memory"); return RFAILED; @@ -502,7 +502,7 @@ uint8_t packEgtpSlotInd(Pst *pst) { Buffer *mBuf; - if(ODU_GET_MSG(DFLT_REGION, pst->pool, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { printf("\nDU_APP : Failed to allocate memory"); return RFAILED; diff --git a/src/cm/lsctp.c b/src/cm/lsctp.c index c28cc1d84..f527b1955 100644 --- a/src/cm/lsctp.c +++ b/src/cm/lsctp.c @@ -41,7 +41,7 @@ uint8_t cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy) { Buffer *mBuf; - if(ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { printf("\nSCTP : Failed to allocate memory"); return RFAILED; diff --git a/src/cm/mac_sch_interface.c b/src/cm/mac_sch_interface.c index 61792a33e..3d0e15d84 100644 --- a/src/cm/mac_sch_interface.c +++ b/src/cm/mac_sch_interface.c @@ -23,7 +23,7 @@ uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd) { Buffer *mBuf = NULLP; - if (ODU_GET_MSG(pst->region, pst->pool, &mBuf) != ROK) + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { return RFAILED; } diff --git a/src/codec_utils/F1AP/CUtoDURRCInformation.h b/src/codec_utils/F1AP/CUtoDURRCInformation.h index 755f39d37..5519fc4f9 100755 --- a/src/codec_utils/F1AP/CUtoDURRCInformation.h +++ b/src/codec_utils/F1AP/CUtoDURRCInformation.h @@ -29,7 +29,7 @@ typedef struct CUtoDURRCInformation { CG_ConfigInfo_t *cG_ConfigInfo; /* OPTIONAL */ UE_CapabilityRAT_ContainerList_t *uE_CapabilityRAT_ContainerList; /* OPTIONAL */ MeasConfig_t *measConfig; /* OPTIONAL */ - struct ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */ + struct ProtocolExtensionContainer_4624P16 *iE_Extensions; /* OPTIONAL */ /* * This type is extensible, * possible extensions are below. diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c index b574bcbb5..99f5c4225 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.c +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -44,7 +44,7 @@ S16 SendF1APMsg(Region region, Pool pool) { Buffer *mBuf = NULLP; - if(ODU_GET_MSG(region, pool, &mBuf) == ROK) + if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK) { if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK) { @@ -53,17 +53,17 @@ S16 SendF1APMsg(Region region, Pool pool) if(sctpSend(mBuf) != ROK) { DU_LOG("\nF1AP : SCTP Send failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } } else { DU_LOG("\nF1AP : ODU_ADD_POST_MSG_MULT failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } else { @@ -904,11 +904,9 @@ uint8_t BuildDLRRCContainer(RRCContainer_t *rrcContainer) * ****************************************************************/ S16 BuildAndSendDLRRCMessageTransfer() { - uint8_t ret = ROK ; uint8_t elementCnt = 0; uint8_t ieId; uint8_t idx; - uint16_t idx2; F1AP_PDU_t *f1apMsg = NULLP; DLRRCMessageTransfer_t *dlRRCMsg = NULLP; asn_enc_rval_t encRetVal; /* Encoder return value */ @@ -1036,7 +1034,6 @@ S16 BuildAndSendDLRRCMessageTransfer() return ROK; }/* End of BuildAndSendDLRRCMessageTransfer */ - /******************************************************************* * * @brief Builds and sends the UE Setup Response @@ -1183,7 +1180,6 @@ S16 BuildAndSendUESetRsp() return ROK; }/* End of BuildAndSendUESetRsp */ - uint8_t procInitULRRCMsg(F1AP_PDU_t *f1apMsg) { uint8_t idx; @@ -1239,23 +1235,1165 @@ uint8_t procInitULRRCMsg(F1AP_PDU_t *f1apMsg) ret = BuildAndSendDLRRCMessageTransfer(); 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 -* -* ****************************************************************/ + * + * @brief Builds Nrcgi + * + * @details + * + * Function : BuildNrcgi + * + * Functionality: Building the PLMN ID and NR Cell id + * + * @params[in] NRCGI_t *nrcgi + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildNrcgi(NRCGI_t *nrcgi) +{ + uint8_t ret; + uint8_t unused = 4; + uint8_t byteSize = 5; + uint8_t val = 16; + /* Allocate Buffer Memory */ + nrcgi->pLMN_Identity.size = 3 * sizeof(uint8_t); + CU_ALLOC(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size); + if(nrcgi->pLMN_Identity.buf == NULLP) + { + return RFAILED; + } + ret = buildPlmnId(cuCfgParams.plmn , &nrcgi->pLMN_Identity); + + if(ret != ROK) + { + return RFAILED; + } + nrcgi->nRCellIdentity.size = byteSize * sizeof(uint8_t); + CU_ALLOC(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size); + if(nrcgi->nRCellIdentity.buf == NULLP) + { + return RFAILED; + } + ret = fillBitString(&nrcgi->nRCellIdentity, unused, byteSize, val); + if(ret != ROK) + { + return RFAILED; + } + return ROK; +} +/******************************************************************* + * + * @brief Builds Special cell list for UE Setup Request + * + * @details + * + * Function : BuildSplCellList + * + * Functionality: Constructs the Special Cell list for UESetReq + * + * @params[in] SCell_ToBeSetup_List_t *spCellLst + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildSplCellList(SCell_ToBeSetup_List_t *spCellLst) +{ + uint8_t cellCnt; + uint8_t idx; + uint8_t ret; + cellCnt = 1; + spCellLst->list.count = cellCnt; + spCellLst->list.size = cellCnt * sizeof(SCell_ToBeSetup_ItemIEs_t *); + CU_ALLOC(spCellLst->list.array,spCellLst->list.size); + if(spCellLst->list.array == NULLP) + { + return RFAILED; + } + for(idx=0; idxlist.array[idx],sizeof(SCell_ToBeSetup_ItemIEs_t)); + if(spCellLst->list.array[idx] == NULLP) + { + return RFAILED; + } + } + idx = 0; + spCellLst->list.array[idx]->id = ProtocolIE_ID_id_SCell_ToBeSetup_Item; + spCellLst->list.array[idx]->criticality = Criticality_ignore; + spCellLst->list.array[idx]->value.present =\ + SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; + /* Special Cell ID -NRCGI */ + ret = BuildNrcgi(&spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCell_ID); + if(ret != ROK) + { + return RFAILED; + } + /*Special Cell Index*/ + spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCellIndex = 1; + return ROK; +}/* End of BuildSplCellList*/ + +/******************************************************************* + * + * @brief Builds SRBS to be setup + * + * @details + * + * Function : BuildSRBSetup + * + * Functionality: Constructs the SRB's for UESetReq + * + * @params[in] SRBs_ToBeSetup_List_t *srbSet + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildSRBSetup(SRBs_ToBeSetup_List_t *srbSet) +{ + uint8_t idx; + uint8_t srbCnt; + srbCnt = 1; + srbSet->list.count = srbCnt; + srbSet->list.size = srbCnt*sizeof(SRBs_ToBeSetup_ItemIEs_t *); + CU_ALLOC(srbSet->list.array,srbSet->list.size); + if(srbSet->list.array == NULLP) + { + return RFAILED; + } + for(idx=0; idxlist.array[idx],sizeof(SRBs_ToBeSetup_ItemIEs_t)); + if(srbSet->list.array[idx] == NULLP) + { + return RFAILED; + } + } + idx = 0; + srbSet->list.array[idx]->id = ProtocolIE_ID_id_SRBs_ToBeSetup_Item; + srbSet->list.array[idx]->criticality = Criticality_ignore; + srbSet->list.array[idx]->value.present = \ + SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item; + srbSet->list.array[idx]->value.choice.SRBs_ToBeSetup_Item.sRBID = 2; + return ROK; +}/* End of BuildSRBSetup*/ + +/******************************************************************* + * + * @brief Builds QOS Info for DRB Setum Item + * + * @details + * + * Function : BuildQOSInfo + * + * Functionality: Constructs the QOS Info for DRB Setup Item + * + * @params[in] QoSInformation_t *qosinfo + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos) +{ + /* NonDynamic5QIDescriptor */ + drbQos->qoS_Characteristics.present = QoS_Characteristics_PR_non_Dynamic_5QI; + CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t)); + if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI == NULLP) + { + return RFAILED; + } + /*FiveQI*/ + drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 0; + /*AveragingWindow*/ + CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\ + sizeof(AveragingWindow_t)); + if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow == \ + NULLP) + { + return RFAILED; + } + *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow) = 0; + /*MaxDataBurstVolume*/ + CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ + sizeof(MaxDataBurstVolume_t)); + if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume == \ + NULLP) + { + return RFAILED; + } + *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume) = 0; + + /*nRGRAN Allocation Retention Priority*/ + drbQos->nGRANallocationRetentionPriority.priorityLevel = PriorityLevel_highest; + drbQos->nGRANallocationRetentionPriority.pre_emptionCapability = Pre_emptionCapability_may_trigger_pre_emption; + drbQos->nGRANallocationRetentionPriority.pre_emptionVulnerability = Pre_emptionVulnerability_not_pre_emptable; + + /* TO DO: GBR_QoSFlowInformation */ + return ROK; +}/*End of BuildQOSInfo*/ + +/******************************************************************* + * + * @brief Builds SNSSAI + * + * @details + * + * Function : BuildSNSSAI + * + * Functionality: Constructs the SNSSAI For DRB list + * + * @params[in] SNSSAI_t *snssai + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildSNSSAI(SNSSAI_t *snssai) +{ + /*SNSSAI*/ + /*ssT*/ + snssai->sST.size = sizeof(uint8_t); + CU_ALLOC(snssai->sST.buf,snssai->sST.size); + if(snssai->sST.buf == NULLP) + { + return RFAILED; + } + snssai->sST.buf[0] = 3; + /*sD*/ + CU_ALLOC(snssai->sD,sizeof(OCTET_STRING_t)); + if(snssai->sD == NULLP) + { + return RFAILED; + } + snssai->sD->size = 3*sizeof(uint8_t); + CU_ALLOC(snssai->sD->buf,snssai->sD->size); + if(snssai->sD->buf == NULLP) + { + return RFAILED; + } + snssai->sD->buf[0] = 3; + snssai->sD->buf[1] = 6; + snssai->sD->buf[2] = 9; + return ROK; +}/*End of BuildSNSSAI*/ + +/******************************************************************* + * + * @brief Builds the flow map. + * + * @details + * + * Function : BuildFlowsMap + * + * Functionality: Constructs the flowmap For DRB list + * + * @params[in] Flows_Mapped_To_DRB_List_t *flowMap + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap) +{ + uint8_t ret; + uint8_t idx; + uint8_t flowCnt; + flowCnt = 1; + flowMap->list.count = flowCnt; + flowMap->list.size = flowCnt * sizeof(Flows_Mapped_To_DRB_Item_t *); + CU_ALLOC(flowMap->list.array,flowMap->list.size); + if(flowMap->list.array == NULLP) + { + return RFAILED; + } + for(idx=0; idxlist.array[idx],sizeof(Flows_Mapped_To_DRB_Item_t)); + if(flowMap->list.array[idx] == NULLP) + { + return RFAILED; + } + } + idx = 0; + flowMap->list.array[idx]->qoSFlowIdentifier = 0; + ret = BuildQOSInfo(&flowMap->list.array[idx]->qoSFlowLevelQoSParameters); + if(ret != ROK) + { + return RFAILED; + } + return ROK; +}/*End of BuildFlowsMap*/ + +/******************************************************************* + * + * @brief Builds the Uplink Tunnel Info + * + * @details + * + * Function : BuildULTnlInfo + * + * Functionality: Constructs the UL TnlInfo For DRB list + * + * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo) +{ + uint8_t idx; + uint8_t ulCnt; + ulCnt = 1; + ulInfo->list.count = ulCnt; + ulInfo->list.size = ulCnt * sizeof(ULUPTNLInformation_ToBeSetup_Item_t *); + CU_ALLOC(ulInfo->list.array,ulInfo->list.size); + if(ulInfo->list.array == NULLP) + { + return RFAILED; + } + for(idx=0; idxlist.array[idx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t)); + if(ulInfo->list.array[idx] == NULLP) + { + return RFAILED; + } + } + idx = 0; + ulInfo->list.array[idx]->uLUPTNLInformation.present = \ + UPTransportLayerInformation_PR_gTPTunnel; + /*GTP TUNNEL*/ + CU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel,\ + sizeof(GTPTunnel_t)); + if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel == NULLP) + { + return RFAILED; + } + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.size = 4*sizeof(uint8_t); + CU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf,ulInfo->list.array[idx]->\ + uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size); + if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf == NULLP) + { + return RFAILED; + } + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf[0] = 4; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf[1] = 4; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf[2] = 4; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf[3] = 5; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.bits_unused = 0; + /*GTP TEID*/ + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size\ + = 4 * sizeof(uint8_t); + CU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf,ulInfo->list.array[idx]->uLUPTNLInformation.choice.\ + gTPTunnel->gTP_TEID.size); + if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\ + == NULLP) + { + return RFAILED; + } + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf[0] = 11; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf[1] = 0; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf[2] = 0; + ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf[3] = 1; + + return ROK; +}/*End of BuildULTnlInfo*/ + +/******************************************************************* + * + * @brief Builds DRBS to be setup + * + * @details + * + * Function : BuildDRBSetup + * + * Functionality: Constructs the DRB's for UESetReq + * + * @params[in] DRBs_ToBeSetup_List_t *drbSet + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet) +{ + uint8_t BuildQOSInforet; + uint8_t BuildSNSSAIret; + uint8_t BuildFlowsMapret; + uint8_t BuildULTnlInforet; + uint8_t idx; + uint8_t drbCnt; + DRBs_ToBeSetup_Item_t *drbSetItem; + drbCnt = 1; + drbSet->list.count = drbCnt; + drbSet->list.size = drbCnt*sizeof(DRBs_ToBeSetup_ItemIEs_t *); + CU_ALLOC(drbSet->list.array,drbSet->list.size); + if(drbSet->list.array == NULLP) + { + return RFAILED; + } + for(idx=0; idxlist.array[idx],sizeof(DRBs_ToBeSetup_ItemIEs_t)); + if(drbSet->list.array[idx] == NULLP) + { + return RFAILED; + } + } + idx = 0; + drbSet->list.array[idx]->id = ProtocolIE_ID_id_DRBs_ToBeSetup_Item; + drbSet->list.array[idx]->criticality = Criticality_ignore; + drbSet->list.array[idx]->value.present = \ + DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; + drbSetItem = &drbSet->list.array[idx]->value.choice.DRBs_ToBeSetup_Item; + /*dRBID*/ + drbSetItem->dRBID = 1; + /*qoSInformation*/ + drbSetItem->qoSInformation.present = QoSInformation_PR_choice_extension; + CU_ALLOC(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t)); + if(drbSetItem->qoSInformation.choice.choice_extension == NULLP) + { + return RFAILED; + } + drbSetItem->qoSInformation.choice.choice_extension->id = \ + ProtocolIE_ID_id_DRB_Information; + drbSetItem->qoSInformation.choice.choice_extension->criticality = \ + Criticality_ignore; + drbSetItem->qoSInformation.choice.choice_extension->value.present = \ + QoSInformation_ExtIEs__value_PR_DRB_Information; + BuildQOSInforet = BuildQOSInfo(&drbSetItem->qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.dRB_QoS); + if(BuildQOSInforet != ROK) + { + return RFAILED; + } + /*SNSSAI*/ + BuildSNSSAIret = BuildSNSSAI(&drbSetItem->qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.sNSSAI); + if(BuildSNSSAIret != ROK) + { + return RFAILED; + } + /*Flows mapped to DRB List*/ + BuildFlowsMapret = BuildFlowsMap(&drbSetItem->qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List); + if(BuildFlowsMapret != ROK) + { + return RFAILED; + } + /*ULUPTNLInformation To Be Setup List*/ + BuildULTnlInforet = BuildULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); + if(BuildULTnlInforet != ROK) + { + return RFAILED; + } + /*RLCMode*/ + drbSetItem->rLCMode = RLCMode_rlc_um_bidirectional; + + /*UL Configuration*/ + CU_ALLOC(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t)); + if(drbSetItem->uLConfiguration == NULLP) + { + return RFAILED; + } + drbSetItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data; + return ROK; +}/* End of BuildDRBSetup*/ + +/******************************************************************* + * + * @brief Deallocating memory of function BuildAndSendUESetReq + * + * @details + * + * Function : FreeNrcgi + * + * Functionality: Deallocating memory for function BuildNrcgi + * + * @params[in] NRCGI_t *nrcgi + * + * @return void + * + *******************************************************************/ +void FreeNrcgi(NRCGI_t *nrcgi) +{ + if(nrcgi->pLMN_Identity.buf != NULLP) + { + if(nrcgi->nRCellIdentity.buf != NULLP) + { + CU_FREE(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size); + } + CU_FREE(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size); + } +} +/******************************************************************* + * + * @brief Deallocating memory of function BuildAndSendUESetReq + * + * @details + * + * Function : FreeSplCellList + * + * Functionality: Deallocating memory for function BuildSplCellList + * + * @params[in] SCell_ToBeSetup_List_t *spCellLst + * + * @return void + * + * + * *****************************************************************/ +void FreeSplCellList(SCell_ToBeSetup_List_t *spCellLst) +{ + uint8_t cellidx; + if(spCellLst->list.array != NULLP) + { + for(cellidx=0; cellidxlist.count; cellidx++) + { + if(cellidx==0&&spCellLst->list.array[cellidx]!=NULLP) + { + FreeNrcgi(&spCellLst->list.array[cellidx]->value.choice.SCell_ToBeSetup_Item.sCell_ID); + } + if(spCellLst->list.array[cellidx]!=NULLP) + { + CU_FREE(spCellLst->list.array[cellidx],sizeof(SCell_ToBeSetup_ItemIEs_t)); + } + } + CU_FREE(spCellLst->list.array,spCellLst->list.size); + } +} +/******************************************************************* + * + * @brief Deallocating memory of function BuildAndSendUESetReq + * + * @details + * + * Function : FreeSRBSetup + * + * Functionality: Deallocating memory for function BuildSRBSetup + * + * @params[in] SRBs_ToBeSetup_List_t *srbSet + * + * @return void + * + * + * ******************************************************************/ +void FreeSRBSetup(SRBs_ToBeSetup_List_t *srbSet) +{ + uint8_t srbidx; + if(srbSet->list.array != NULLP) + { + for(srbidx=0; srbidxlist.count; srbidx++) + { + if(srbSet->list.array[srbidx]!=NULLP) + { + CU_FREE(srbSet->list.array[srbidx],sizeof(SRBs_ToBeSetup_ItemIEs_t)); + } + } + CU_FREE(srbSet->list.array,srbSet->list.size); + } +} +/******************************************************************* + * + * @brief Deallocating memory of function BuildAndSendUESetReq + * + * @details + * + * Function : FreeQOSInfo + * + * Functionality: Deallocating memory for function BuildQOSInfo + * + * @params[in] QoSFlowLevelQoSParameters_t *drbQos + * + * @return void + * + * ****************************************************************/ +void FreeQOSInfo(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) + { + CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ + sizeof(MaxDataBurstVolume_t)); + } + CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\ + sizeof(AveragingWindow_t)); + } + CU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,\ + sizeof(NonDynamic5QIDescriptor_t)); + } +} +/******************************************************************* + * + * @brief Deallocating memory of function BuildAndSendUESetReq + * + * @details + * + * Function : FreeULTnlInfo + * + * Functionality: Deallocating memory for function BuildULTnlInfo + * + * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo + * + * @return void + * + + * ****************************************************************/ +void FreeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo) +{ + uint8_t ulidx=0; + if(ulInfo->list.array != NULLP) + { + for(ulidx=0; ulidxlist.count; ulidx++) + { + if(ulidx==0&&ulInfo->list.array[ulidx]!=NULLP) + { + if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP) + { + if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf != NULLP) + { + if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\ + !=NULLP) + { + CU_ALLOC(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\ + gTP_TEID.buf,ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.\ + gTPTunnel->gTP_TEID.size); + } + CU_FREE(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\ + transportLayerAddress.buf,ulInfo->list.array[ulidx]->\ + uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size); + } + CU_FREE(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel,\ + sizeof(GTPTunnel_t)); + } + } + if(ulInfo->list.array[ulidx]!=NULLP) + { + CU_FREE(ulInfo->list.array[ulidx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t)); + } + } + CU_FREE(ulInfo->list.array,ulInfo->list.size); + } +} +/******************************************************************* + * + * @brief Deallocating memory for BuildAndSendUESetReq + * + * @details + * + * Function : FreeDRBSetup + * + * Functionality: Deallocating memory for BuildDRBSetup + * + * @params[in] DRBs_ToBeSetup_List_t *drbSet + * + * @return void + * + * ****************************************************************/ +void FreeDRBSetup(DRBs_ToBeSetup_List_t *drbSet) +{ + DRBs_ToBeSetup_Item_t *drbSetItem; + uint8_t flowidx; + uint8_t drbidx; + 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) + { + FreeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); + CU_FREE(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t)); + + CU_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,\ + sizeof(MaxDataBurstVolume_t)); + } + CU_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,sizeof(AveragingWindow_t)); + } + CU_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,sizeof(NonDynamic5QIDescriptor_t)); + } + } + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP) + { + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx],sizeof(Flows_Mapped_To_DRB_Item_t)); + } + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.array,drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.size); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf,\ + drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->size); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD,\ + sizeof(OCTET_STRING_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf,\ + drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.size); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI, sizeof(NonDynamic5QIDescriptor_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t)); + } + } + if(drbSet->list.array[drbidx]!=NULLP) + { + CU_FREE(drbSet->list.array[drbidx],sizeof(DRBs_ToBeSetup_ItemIEs_t)); + } + } + CU_FREE(drbSet->list.array,drbSet->list.size); + } +} + + +/******************************************************************* + * + * @brief Free the UE Setup Request + * + * @details + * + * Function : FreeUESetReq + * + * Functionality: Deallocate the memory of BuildUESetReq + * + * @params[in] F1AP_PDU_t *f1apMsg + * + * @return void + * + * + * ****************************************************************/ +void FreeUESetReq(F1AP_PDU_t *f1apMsg) +{ + uint8_t idx=2; + uint8_t ieId; + UEContextSetupRequest_t *ueSetReq; + + if(f1apMsg != NULLP) + { + if(f1apMsg->choice.initiatingMessage != NULLP) + { + ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest; + if(ueSetReq->protocolIEs.list.array != NULLP) + { + if(ueSetReq->protocolIEs.list.array[idx]) + { + FreeNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI); + idx=6; + if(ueSetReq->protocolIEs.list.array[idx]) + { + FreeSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List); + idx++; + if(ueSetReq->protocolIEs.list.array[idx]) + { + FreeSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List); + idx++; + if(ueSetReq->protocolIEs.list.array[idx]) + { + FreeDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List); + } + } + } + } + for(ieId=0; ieIdprotocolIEs.list.count; ieId++) + { + if(ueSetReq->protocolIEs.list.array[ieId] != NULLP) + { + CU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t)); + } + } + CU_FREE(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size); + } + CU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); + } + CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + } +} + +/******************************************************************* + * + * @brief Builds and sends the UE Setup Request + * + * @details + * + * Function : BuildAndSendUESetReq + * + * Functionality: Constructs the UE Setup Request and sends + * it to the CU through SCTP. + * + * @params[in] + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t BuildAndSendUESetReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \ + uint16_t rrcContLen, uint8_t *rrcContainer) +{ + uint8_t Nrcgiret; + uint8_t SplCellListret; + uint8_t SrbSetupret; + uint8_t elementCnt; + uint8_t idx; + uint8_t idx1; + F1AP_PDU_t *f1apMsg = NULLP; + UEContextSetupRequest_t *ueSetReq = NULLP; + asn_enc_rval_t encRetVal; /* Encoder return value */ + memset(&encRetVal, 0, sizeof(asn_enc_rval_t)); + uint8_t ret= RFAILED; + uint8_t ret1; + while(1) + { + DU_LOG("\n F1AP : Building UE Context Setup Request\n"); + + CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + break; + } + + f1apMsg->present = F1AP_PDU_PR_initiatingMessage; + CU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); + if(f1apMsg->choice.initiatingMessage == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + break; + } + + f1apMsg->choice.initiatingMessage->procedureCode = \ + ProcedureCode_id_UEContextSetup; + f1apMsg->choice.initiatingMessage->criticality = Criticality_reject; + f1apMsg->choice.initiatingMessage->value.present = \ + InitiatingMessage__value_PR_UEContextSetupRequest; + ueSetReq = + &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest; + + elementCnt = 11; + ueSetReq->protocolIEs.list.count = elementCnt; + ueSetReq->protocolIEs.list.size = \ + elementCnt * sizeof(UEContextSetupRequestIEs_t *); + + /* Initialize the UESetup members */ + CU_ALLOC(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size); + + if(ueSetReq->protocolIEs.list.array == NULLP) + { + DU_LOG(" F1AP : Memory allocation for UE Context SetupRequest failed"); + break; + } + + for(idx1=0; idx1protocolIEs.list.array[idx1],sizeof(UEContextSetupRequestIEs_t)); + if(ueSetReq->protocolIEs.list.array[idx1] == NULLP) + { + break; + } + } + + idx = 0; + + /*GNB CU UE F1AP ID*/ + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = cuUeF1apId; + + /*GNB DU UE F1AP ID*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = duUeF1apId; + + /*Special Cell ID*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SpCell_ID; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_NRCGI; + Nrcgiret = BuildNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI); + if(Nrcgiret != ROK) + { + break; + } + + /*Served Cell Index*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_ServCellIndex; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_ServCellIndex; + ueSetReq->protocolIEs.list.array[idx]->value.choice.ServCellIndex = \ + CELL_INDEX; + + /*CellULConfigured*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SpCellULConfigured; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_CellULConfigured; + ueSetReq->protocolIEs.list.array[idx]->value.choice.CellULConfigured = \ + CellULConfigured_none; + + + /*CUtoDURRCContainer*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_CUtoDURRCInformation; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; + + /*Special Cells to be SetupList*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SCell_ToBeSetup_List; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; + SplCellListret = BuildSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List); + if(SplCellListret != ROK) + { + break; + } + /*SRBs To Be Setup List*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_SRBs_ToBeSetup_List; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; + SrbSetupret = BuildSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List); + if(SrbSetupret != ROK) + { + break; + } + /*DRBs to Be Setup List*/ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_DRBs_ToBeSetup_List; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; + ret1 = BuildDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List); + if(ret1 != ROK) + { + break; + } + + /* RRC Container */ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_RRCContainer; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_RRCContainer; + ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size = rrcContLen; + CU_ALLOC(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, + ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size); + if(!ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf) + { + DU_LOG(" F1AP : Memory allocation for BuildAndSendUESetReq failed"); + break; + } + memcpy(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \ + rrcContainer, ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size); + + /* RRC delivery status request */ + idx++; + ueSetReq->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_RRCDeliveryStatusRequest; + ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; + ueSetReq->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupRequestIEs__value_PR_RRCDeliveryStatusRequest; + ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCDeliveryStatusRequest = \ + RRCDeliveryStatusRequest_true; + + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + + /* Encode the F1SetupRequest type as APER */ + cmMemset((uint8_t *)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( "\n F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + break; + } + else + { + DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendF1APMsg(CU_APP_MEM_REG,CU_POOL) != ROK) + { + DU_LOG("\n F1AP : Sending UE Context Setup Request Failed"); + break; + } + ret = ROK; + break; + } + FreeUESetReq(f1apMsg); + + return ret; +}/* End of BuildAndSendUESetReq*/ + +uint8_t procUlRrcMsg(F1AP_PDU_t *f1apMsg) +{ + uint8_t idx; + uint8_t ret =ROK; + uint8_t cuUeF1apId, duUeF1apId; + uint8_t *rrcContainer; + uint16_t rrcContLen; + ULRRCMessageTransfer_t *ulRrcMsg = NULLP; + + ulRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer; + + for(idx=0; idx < ulRrcMsg->protocolIEs.list.count; idx++) + { + switch(ulRrcMsg->protocolIEs.list.array[idx]->id) + { + case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: + { + cuUeF1apId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID; + break; + } + case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: + { + duUeF1apId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID; + break; + } + case ProtocolIE_ID_id_SRBID: + break; + case ProtocolIE_ID_id_RRCContainer: + { + rrcContLen = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size; + CU_ALLOC(rrcContainer, rrcContLen) + if(!rrcContainer) + { + DU_LOG("\nCU_STUB: Failed to allocated memory in procUlRrcMsg"); + return RFAILED; + } + memcpy(rrcContainer, ulRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\ + rrcContLen); + break; + } + + default: + DU_LOG("\n Invalid Event %ld", ulRrcMsg->protocolIEs.list.array[idx]->id); + break; + } + } + if(!ret) + ret = BuildAndSendUESetReq(cuUeF1apId, duUeF1apId, rrcContLen, rrcContainer); + 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; @@ -1287,7 +2425,7 @@ void F1APMsgHdlr(Buffer *mBuf) printf("\nF1AP : Received flat buffer to be decoded : "); for(i=0; i< recvBufLen; i++) { - printf("%x",recvBuf[i]); + printf("%x",recvBuf[i]); } /* Decoding flat buffer into F1AP messsage */ @@ -1330,6 +2468,11 @@ void F1APMsgHdlr(Buffer *mBuf) procInitULRRCMsg(f1apMsg); break; } + case InitiatingMessage__value_PR_ULRRCMessageTransfer: + { + DU_LOG("\nF1AP : Received ULRRCMessageTransfer"); + procUlRrcMsg(f1apMsg); + } default: { DU_LOG("\nF1AP : Invalid type of intiating message [%d]",f1apMsg->choice.initiatingMessage->value.present); diff --git a/src/cu_stub/cu_f1ap_msg_hdl.h b/src/cu_stub/cu_f1ap_msg_hdl.h index 36c1b37d9..1d94ad988 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.h +++ b/src/cu_stub/cu_f1ap_msg_hdl.h @@ -31,7 +31,6 @@ #define ENCODE_FAIL -1 #define TRANS_ID 1 #define RRC_SIZE 1 -#define ENC_BUF_MAX_LEN 100 #define SUL_BAND_COUNT 0 #define UL_SRBID 1 #define DL_SRBID 0 @@ -41,24 +40,11 @@ #define CELL_INDEX 0 #define SRB1 1 -/* allocate and zero out a static buffer */ -#define CU_ALLOC(_datPtr, _size) \ -{ \ - S16 _ret; \ - _ret = SGetSBuf(CU_APP_MEM_REG, CU_POOL, \ - (Data **)&_datPtr, _size); \ - if(_ret == ROK) \ - cmMemset((U8*)_datPtr, 0, _size); \ - else \ - _datPtr = NULLP; \ -} - -/* free a static buffer */ -#define CU_FREE(_datPtr, _size) \ - if(_datPtr) \ - SPutSBuf(CU_APP_MEM_REG, CU_POOL, \ - (Data *)_datPtr, _size); - +#define CU_UE_F1AP_ID 0 +#define DU_UE_F1AP_ID 1 +#define SP_CELL_ID 2 +#define SERV_CELL_IDX 3 +#define CU_TO_DU_RRC_INF 4 typedef struct f1apDb { diff --git a/src/cu_stub/cu_stub.h b/src/cu_stub/cu_stub.h index 22ae74290..138c788c8 100644 --- a/src/cu_stub/cu_stub.h +++ b/src/cu_stub/cu_stub.h @@ -28,19 +28,20 @@ #define DU_PORT 38472 /* allocate and zero out a static buffer */ -#define CU_ALLOC(_datPtr, _size) \ -{ \ - S16 _ret; \ +#define CU_ALLOC(_datPtr, _size) \ +{ \ + S16 _ret; \ _ret = SGetSBuf(CU_APP_MEM_REG, CU_POOL, \ - (Data **)&_datPtr, _size); \ - if(_ret == ROK) \ - cmMemset((U8*)_datPtr, 0, _size); \ - else \ - _datPtr = NULLP; \ + (Data **)&_datPtr, _size); \ + if(_ret == ROK) \ + cmMemset((U8*)_datPtr, 0, _size); \ + else \ + _datPtr = NULLP; \ } /* free a static buffer */ -#define CU_FREE(_datPtr, _size) \ +#define CU_FREE(_datPtr, _size) \ + if(_datPtr) \ SPutSBuf(CU_APP_MEM_REG, CU_POOL, \ (Data *)_datPtr, _size); @@ -91,6 +92,7 @@ CuCfgParams cuCfgParams; //global variable to hold all configs void readCuCfg(); void cuAppInmsgHdlr(Buffer *mBuf); void sctpNtfyInd(CmInetSctpNotification *ntfy); +uint8_t egtpInitReq(); #endif diff --git a/src/cu_stub/cu_stub_egtp.c b/src/cu_stub/cu_stub_egtp.c index b8616c067..ff8f2d586 100644 --- a/src/cu_stub/cu_stub_egtp.c +++ b/src/cu_stub/cu_stub_egtp.c @@ -73,9 +73,9 @@ S16 egtpActvInit() * RFAILED - failure * ***************************************************************************/ -S16 egtpInitReq() +uint8_t egtpInitReq() { - S16 ret = ROK; + uint8_t ret = ROK; EgtpTnlEvt tnlEvt; ret = cuEgtpCfgReq(); @@ -102,8 +102,7 @@ S16 egtpInitReq() return RFAILED; } - return (ret); - + return ret; } /* egtpInitReq */ /************************************************************************** @@ -175,7 +174,7 @@ S16 cuEgtpSrvOpenReq(Pst *pst) DU_LOG("\nEGTP : Received open server request"); sockType = CM_INET_DGRAM; - if(ret = (cmInetSocket(sockType, &(egtpCb.recvTptSrvr.sockFd), protType)) != ROK) + if((ret = (cmInetSocket(sockType, &(egtpCb.recvTptSrvr.sockFd), protType))) != ROK) { DU_LOG("\nEGTP : Failed to open UDP socket"); return RFAILED; @@ -513,7 +512,6 @@ S16 cuEgtpHdlRecvMsg(Buffer *mBuf) S16 cuEgtpDecodeHdr(Buffer *mBuf) { EgtpMsg egtpMsg; - S16 retVal = ROK; /* Holds the return value */ U8 tmpByte[5]; /* Holds one byte of data after Dec */ U8 version = 0; /* Holds the version type, decoded */ MsgLen msgLen = 0; /* Holds the msgLen from the Hdr */ @@ -645,7 +643,7 @@ S16 cuEgtpDatReq() cnt++; } - ODU_PUT_MSG(egtpMsg.msg); + ODU_PUT_MSG_BUF(egtpMsg.msg); return ROK; } @@ -658,12 +656,12 @@ S16 BuildAppMsg(EgtpMsg *egtpMsg) Buffer *mBuf; - if(ODU_GET_MSG(CU_APP_MEM_REG, CU_POOL, &mBuf) == ROK) + if(ODU_GET_MSG_BUF(CU_APP_MEM_REG, CU_POOL, &mBuf) == ROK) { if(ODU_ADD_POST_MSG_MULT((Data *)data, datSize, mBuf) != ROK) { DU_LOG("\nEGTP : ODU_ADD_POST_MSG_MULT failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } } @@ -750,7 +748,7 @@ S16 BuildAppMsg(EgtpMsg *egtpMsg) egtpMsg->msgHdr.teId = 10; egtpMsg->msg = mBuf; - return ROK; + return ret; } diff --git a/src/cu_stub/cu_stub_sctp.c b/src/cu_stub/cu_stub_sctp.c index ab262d54a..089ba8ab4 100644 --- a/src/cu_stub/cu_stub_sctp.c +++ b/src/cu_stub/cu_stub_sctp.c @@ -496,11 +496,11 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou else if(connUp & (pollParams->port == f1Params.destPort)) { F1APMsgHdlr(pollParams->mBuf); - ODU_PUT_MSG(pollParams->mBuf); + ODU_PUT_MSG_BUF(pollParams->mBuf); } else { - ODU_PUT_MSG(pollParams->mBuf); + ODU_PUT_MSG_BUF(pollParams->mBuf); } } } diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index 6f8f88020..9170ba830 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -790,7 +790,7 @@ uint8_t duReadCfg() pst.pool= DU_POOL; - if(ODU_GET_MSG(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK) { DU_LOG("\nDU_APP : Memory allocation failed in duReadCfg"); return RFAILED; diff --git a/src/du_app/du_e2ap_msg_hdl.c b/src/du_app/du_e2ap_msg_hdl.c index a179f18e9..d9e5a7f6d 100644 --- a/src/du_app/du_e2ap_msg_hdl.c +++ b/src/du_app/du_e2ap_msg_hdl.c @@ -1163,7 +1163,7 @@ uint8_t SendE2APMsg(Region region, Pool pool) { Buffer *mBuf=NULLP; - if(ODU_GET_MSG(region, pool, &mBuf) == ROK) + if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK) { if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK) { @@ -1172,17 +1172,17 @@ uint8_t SendE2APMsg(Region region, Pool pool) if(sctpSend(mBuf, E2_INTERFACE) != ROK) { DU_LOG("\nE2AP : SCTP Send for E2 failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } } else { DU_LOG("\nE2AP : ODU_ADD_POST_MSG_MULT failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } else { diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c index 3a25df55e..6ec35557c 100644 --- a/src/du_app/du_egtp.c +++ b/src/du_app/du_egtp.c @@ -110,13 +110,13 @@ uint8_t egtpActvTsk(Pst *pst, Buffer *mBuf) case EVTSLOTIND: { ret = unpackEgtpSlotInd(egtpSlotInd, pst, mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } default: { DU_LOG("\nEGTP : Invalid event %d", pst->event); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); ret = RFAILED; } } @@ -606,7 +606,7 @@ uint8_t egtpHdlDatInd(EgtpMsg egtpMsg) /* Send over UDP */ egtpSendMsg(egtpMsg.msg); - ODU_PUT_MSG(egtpMsg.msg); + ODU_PUT_MSG_BUF(egtpMsg.msg); return ROK; }/* EgtpHdlDatInd */ diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index d63c8ad99..ac1fdb869 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -73,18 +73,15 @@ #include "du_mgr.h" #include "du_f1ap_msg_hdl.h" +extern DuCfgParams duCfgParam; +uint8_t ServedCellListreturn=RFAILED; + uint8_t procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg); uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg); void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg); -extern char encBuf[ENC_BUF_MAX_LEN]; -extern DuCfgParams duCfgParam; -uint8_t BuildULTnlInforet=RFAILED; -uint8_t ServedCellListreturn=RFAILED; -uint8_t sctpSend(Buffer *mBuf, U8 itfType); -uint8_t Nrcgiret=RFAILED; -uint8_t SplCellListret=RFAILED; -uint8_t SRBSetupret=RFAILED; +uint8_t sctpSend(Buffer *mBuf, uint8_t itfType); uint8_t BuildInitialUlBWP(BWP_UplinkDedicated_t *ulBwp); +uint8_t procUeContextSetupReq(F1AP_PDU_t *f1apMsg); /******************************************************************* * @@ -686,7 +683,7 @@ uint8_t SendF1APMsg(Region region, Pool pool) { Buffer *mBuf; - if(ODU_GET_MSG(region, pool, &mBuf) == ROK) + if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK) { if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK) { @@ -695,17 +692,17 @@ uint8_t SendF1APMsg(Region region, Pool pool) if(sctpSend(mBuf, F1_INTERFACE) != ROK) { DU_LOG("\nF1AP : SCTP Send failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } } else { DU_LOG("\nF1AP : ODU_ADD_POST_MSG_MULT failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } else { @@ -5235,1025 +5232,183 @@ uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti /******************************************************************* * - * @brief Builds Special cell list for UE Setup Request - * - * @details - * - * Function : BuildSplCellList - * - * Functionality: Constructs the Special Cell list for UESetReq - * - * @params[in] SCell_ToBeSetup_List_t *spCellLst - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t BuildSplCellList(SCell_ToBeSetup_List_t *spCellLst) -{ - uint8_t cellCnt; - uint8_t idx; - uint8_t ret; - cellCnt = 1; - spCellLst->list.count = cellCnt; - spCellLst->list.size = cellCnt * sizeof(SCell_ToBeSetup_ItemIEs_t *); - DU_ALLOC(spCellLst->list.array,spCellLst->list.size); - if(spCellLst->list.array == NULLP) - { - return RFAILED; - } - for(idx=0; idxlist.array[idx],sizeof(SCell_ToBeSetup_ItemIEs_t)); - if(spCellLst->list.array[idx] == NULLP) - { - return RFAILED; - } - } - idx = 0; - spCellLst->list.array[idx]->id = ProtocolIE_ID_id_SCell_ToBeSetup_Item; - spCellLst->list.array[idx]->criticality = Criticality_ignore; - spCellLst->list.array[idx]->value.present =\ - SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; - /* Special Cell ID -NRCGI */ - ret = BuildNrcgi(&spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCell_ID); - if(ret != ROK) - { - return RFAILED; - } - /*Special Cell Index*/ - spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCellIndex = 1; - return ROK; -}/* End of BuildSplCellList*/ - -/******************************************************************* - * - * @brief Builds SRBS to be setup - * - * @details - * - * Function : BuildSRBSetup - * - * Functionality: Constructs the SRB's for UESetReq - * - * @params[in] SRBs_ToBeSetup_List_t *srbSet - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t BuildSRBSetup(SRBs_ToBeSetup_List_t *srbSet) -{ - uint8_t idx; - uint8_t srbCnt; - srbCnt = 1; - srbSet->list.count = srbCnt; - srbSet->list.size = srbCnt*sizeof(SRBs_ToBeSetup_ItemIEs_t *); - DU_ALLOC(srbSet->list.array,srbSet->list.size); - if(srbSet->list.array == NULLP) - { - return RFAILED; - } - for(idx=0; idxlist.array[idx],sizeof(SRBs_ToBeSetup_ItemIEs_t)); - if(srbSet->list.array[idx] == NULLP) - { - return RFAILED; - } - } - idx = 0; - srbSet->list.array[idx]->id = ProtocolIE_ID_id_SRBs_ToBeSetup_Item; - srbSet->list.array[idx]->criticality = Criticality_ignore; - srbSet->list.array[idx]->value.present = \ - SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item; - srbSet->list.array[idx]->value.choice.SRBs_ToBeSetup_Item.sRBID = 2; - return ROK; -}/* End of BuildSRBSetup*/ - -/******************************************************************* - * - * @brief Builds QOS Info for DRB Setum Item + * @brief Free the memory allocated for UE Setup response * * @details * - * Function : BuildQOSInfo + * Function : FreeUeSetupRsp * - * Functionality: Constructs the QOS Info for DRB Setup Item - * - * @params[in] QoSInformation_t *qosinfo + * Functionality: + * Free the memory allocated for UE Setup response * + * @params[in] F1AP PDU for UE setup response * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos) +void FreeUeSetupRsp(F1AP_PDU_t *f1apMsg) { - /* NonDynamic5QIDescriptor */ - drbQos->qoS_Characteristics.present = QoS_Characteristics_PR_non_Dynamic_5QI; - DU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t)); - if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI == NULLP) - { - return RFAILED; - } - /*FiveQI*/ - drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 0; - /*AveragingWindow*/ - DU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\ - sizeof(AveragingWindow_t)); - if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow == \ - NULLP) - { - return RFAILED; - } - *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow) = 0; - /*MaxDataBurstVolume*/ - DU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ - sizeof(MaxDataBurstVolume_t)); - if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume == \ - NULLP) - { - return RFAILED; - } - *(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume) = 0; - - /*nRGRAN Allocation Retention Priority*/ - drbQos->nGRANallocationRetentionPriority.priorityLevel = \ - PriorityLevel_highest; - drbQos->nGRANallocationRetentionPriority.pre_emptionCapability = \ - Pre_emptionCapability_may_trigger_pre_emption; - drbQos->nGRANallocationRetentionPriority.pre_emptionVulnerability = \ - Pre_emptionVulnerability_not_pre_emptable; + uint8_t idx; + UEContextSetupResponse_t *ueSetRsp; - /* TO DO: GBR_QoSFlowInformation */ - return ROK; -}/*End of BuildQOSInfo*/ + 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.size; idx++) + { + DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\ + sizeof(UEContextSetupResponseIEs_t)); + } + DU_FREE(ueSetRsp->protocolIEs.list.array, \ + ueSetRsp->protocolIEs.list.size); + } + DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t)); + } + DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); + } +} /******************************************************************* * - * @brief Builds SNSSAI + * @brief Builds and sends the UE Setup Response * * @details * - * Function : BuildSNSSAI + * Function : BuildAndSendUESetRsp * - * Functionality: Constructs the SNSSAI For DRB list + * Functionality: Constructs the UE Setup Response and sends + * it to the DU through SCTP. * - * @params[in] SNSSAI_t *snssai + * @params[in] * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildSNSSAI(SNSSAI_t *snssai) +uint8_t BuildAndSendUESetRsp() { - /*SNSSAI*/ - /*ssT*/ - snssai->sST.size = sizeof(uint8_t); - DU_ALLOC(snssai->sST.buf,snssai->sST.size); - if(snssai->sST.buf == NULLP) - { - return RFAILED; - } - snssai->sST.buf[0] = 3; - /*sD*/ - DU_ALLOC(snssai->sD,sizeof(OCTET_STRING_t)); - if(snssai->sD == NULLP) - { - return RFAILED; - } - snssai->sD->size = 3*sizeof(uint8_t); - DU_ALLOC(snssai->sD->buf,snssai->sD->size); - if(snssai->sD->buf == NULLP) - { - return RFAILED; - } - snssai->sD->buf[0] = 3; - snssai->sD->buf[1] = 6; - snssai->sD->buf[2] = 9; - return ROK; -}/*End of BuildSNSSAI*/ + uint8_t ret = RFAILED; + uint8_t elementCnt; + uint8_t idx; + F1AP_PDU_t *f1apMsg = NULL; + UEContextSetupResponse_t *ueSetRsp; + asn_enc_rval_t encRetVal; /* Encoder return value */ -/******************************************************************* - * - * @brief Builds the flow map. - * - * @details - * - * Function : BuildFlowsMap - * - * Functionality: Constructs the flowmap For DRB list - * - * @params[in] Flows_Mapped_To_DRB_List_t *flowMap - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap) -{ - uint8_t ret; - uint8_t idx; - uint8_t flowCnt; - flowCnt = 1; - flowMap->list.count = flowCnt; - flowMap->list.size = flowCnt * sizeof(Flows_Mapped_To_DRB_Item_t *); - DU_ALLOC(flowMap->list.array,flowMap->list.size); - if(flowMap->list.array == NULLP) - { - return RFAILED; - } - for(idx=0; idxlist.array[idx],sizeof(Flows_Mapped_To_DRB_Item_t)); - if(flowMap->list.array[idx] == NULLP) - { - return RFAILED; - } - } - idx = 0; - flowMap->list.array[idx]->qoSFlowIdentifier = 0; - ret = BuildQOSInfo(&flowMap->list.array[idx]->qoSFlowLevelQoSParameters); - if(ret != ROK) - { - return RFAILED; - } - return ROK; -}/*End of BuildFlowsMap*/ + DU_LOG("\n F1AP : Building UE Context Setup Response\n"); -/******************************************************************* - * - * @brief Builds the Uplink Tunnel Info - * - * @details - * - * Function : BuildULTnlInfo - * - * Functionality: Constructs the UL TnlInfo For DRB list - * - * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo) -{ - uint8_t idx; - uint8_t ulCnt; - ulCnt = 1; - ulInfo->list.count = ulCnt; - ulInfo->list.size = ulCnt * sizeof(ULUPTNLInformation_ToBeSetup_Item_t *); - DU_ALLOC(ulInfo->list.array,ulInfo->list.size); - if(ulInfo->list.array == NULLP) - { - return RFAILED; - } - for(idx=0; idxlist.array[idx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t)); - if(ulInfo->list.array[idx] == NULLP) - { - return RFAILED; - } - } - idx = 0; - ulInfo->list.array[idx]->uLUPTNLInformation.present = \ - UPTransportLayerInformation_PR_gTPTunnel; - /*GTP TUNNEL*/ - DU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel,\ - sizeof(GTPTunnel_t)); - if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel == NULLP) - { - return RFAILED; - } - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.size = 4*sizeof(uint8_t); - DU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.buf,ulInfo->list.array[idx]->\ - uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size); - if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.buf == NULLP) - { - return RFAILED; - } - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.buf[0] = 4; - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.buf[1] = 4; - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.buf[2] = 4; - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.buf[3] = 5; - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.bits_unused = 0; - /*GTP TEID*/ - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size\ - = 4 * sizeof(uint8_t); - DU_ALLOC(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - gTP_TEID.buf,ulInfo->list.array[idx]->uLUPTNLInformation.choice.\ - gTPTunnel->gTP_TEID.size); - if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\ - == NULLP) - { - return RFAILED; - } - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - gTP_TEID.buf[0] = 11; - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - gTP_TEID.buf[1] = 0; - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - gTP_TEID.buf[2] = 0; - ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\ - gTP_TEID.buf[3] = 1; + while(true) + { + DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); + if(f1apMsg == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + break; + } - return ROK; -}/*End of BuildULTnlInfo*/ + f1apMsg->present = F1AP_PDU_PR_successfulOutcome; + DU_ALLOC(f1apMsg->choice.successfulOutcome, + sizeof(SuccessfulOutcome_t)); + if(f1apMsg->choice.successfulOutcome == NULLP) + { + DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); + break; + } -/******************************************************************* - * - * @brief Builds DRBS to be setup - * - * @details - * - * Function : BuildDRBSetup - * - * Functionality: Constructs the DRB's for UESetReq - * - * @params[in] DRBs_ToBeSetup_List_t *drbSet - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet) -{ - uint8_t BuildQOSInforet; - uint8_t BuildSNSSAIret; - uint8_t BuildFlowsMapret; - uint8_t idx; - uint8_t drbCnt; - DRBs_ToBeSetup_Item_t *drbSetItem; - drbCnt = 1; - drbSet->list.count = drbCnt; - drbSet->list.size = drbCnt*sizeof(DRBs_ToBeSetup_ItemIEs_t *); - DU_ALLOC(drbSet->list.array,drbSet->list.size); - if(drbSet->list.array == NULLP) - { - return RFAILED; - } - for(idx=0; idxlist.array[idx],sizeof(DRBs_ToBeSetup_ItemIEs_t)); - if(drbSet->list.array[idx] == NULLP) - { - return RFAILED; - } - } - idx = 0; - drbSet->list.array[idx]->id = ProtocolIE_ID_id_DRBs_ToBeSetup_Item; - drbSet->list.array[idx]->criticality = Criticality_ignore; - drbSet->list.array[idx]->value.present = \ - DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; - drbSetItem = &drbSet->list.array[idx]->value.choice.DRBs_ToBeSetup_Item; - /*dRBID*/ - drbSetItem->dRBID = 1; - /*qoSInformation*/ - drbSetItem->qoSInformation.present = QoSInformation_PR_choice_extension; - DU_ALLOC(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t)); - if(drbSetItem->qoSInformation.choice.choice_extension == NULLP) - { - return RFAILED; - } - drbSetItem->qoSInformation.choice.choice_extension->id = \ - ProtocolIE_ID_id_DRB_Information; - drbSetItem->qoSInformation.choice.choice_extension->criticality = \ - Criticality_ignore; - drbSetItem->qoSInformation.choice.choice_extension->value.present = \ - QoSInformation_ExtIEs__value_PR_DRB_Information; - BuildQOSInforet = BuildQOSInfo(&drbSetItem->qoSInformation.choice.\ - choice_extension->value.choice.DRB_Information.dRB_QoS); - if(BuildQOSInforet != ROK) - { - return RFAILED; - } - /*SNSSAI*/ - BuildSNSSAIret = BuildSNSSAI(&drbSetItem->qoSInformation.choice.\ - choice_extension->value.choice.DRB_Information.sNSSAI); - if(BuildSNSSAIret != ROK) - { - return RFAILED; - } - /*Flows mapped to DRB List*/ - BuildFlowsMapret = BuildFlowsMap(&drbSetItem->qoSInformation.choice.\ - choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List); - if(BuildFlowsMapret != ROK) - { - return RFAILED; - } - /*ULUPTNLInformation To Be Setup List*/ - BuildULTnlInforet = BuildULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); - if(BuildULTnlInforet != ROK) - { - return RFAILED; - } - /*RLCMode*/ - drbSetItem->rLCMode = RLCMode_rlc_um_bidirectional; + f1apMsg->choice.successfulOutcome->procedureCode = \ + ProcedureCode_id_UEContextSetup; + f1apMsg->choice.successfulOutcome->criticality = Criticality_reject; + f1apMsg->choice.successfulOutcome->value.present = \ + SuccessfulOutcome__value_PR_UEContextSetupResponse; + + ueSetRsp = + &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse; + elementCnt = 2; + ueSetRsp->protocolIEs.list.count = elementCnt; + ueSetRsp->protocolIEs.list.size = \ + elementCnt * sizeof(UEContextSetupResponse_t *); + + /* Initialize the UESetup members */ + DU_ALLOC(ueSetRsp->protocolIEs.list.array, \ + ueSetRsp->protocolIEs.list.size); + if(ueSetRsp->protocolIEs.list.array == NULLP) + { + DU_LOG(" F1AP : Memory allocation for UE Setup Response failed"); + break; + } - /*UL Configuration*/ - DU_ALLOC(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t)); - if(drbSetItem->uLConfiguration == NULLP) - { - return RFAILED; - } - drbSetItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data; - return ROK; -}/* End of BuildDRBSetup*/ -/******************************************************************* -* -* @brief Deallocating memory of function BuildAndSendUESetReq -* -* @details -* -* Function : FreeNrcgi -* -* Functionality: Deallocating memory for function BuildNrcgi -* -* @params[in] NRCGI_t *nrcgi -* -* @return void -* -*******************************************************************/ -void FreeNrcgi(NRCGI_t *nrcgi) -{ - if(nrcgi->pLMN_Identity.buf != NULLP) - { - if(nrcgi->nRCellIdentity.buf != NULLP) - { - DU_FREE(nrcgi->nRCellIdentity.buf, nrcgi->nRCellIdentity.size); - } - DU_FREE(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size); - } -} -/******************************************************************* -* -* @brief Deallocating memory of function BuildAndSendUESetReq -* -* @details -* -* Function : FreeSplCellList -* -* Functionality: Deallocating memory for function BuildSplCellList -* -* @params[in] SCell_ToBeSetup_List_t *spCellLst -* -* @return void -* -* -* *****************************************************************/ -void FreeSplCellList(SCell_ToBeSetup_List_t *spCellLst) -{ - uint8_t cellidx; - if(spCellLst->list.array != NULLP) - { - for(cellidx=0; cellidxlist.count; cellidx++) - { - if(cellidx==0&&spCellLst->list.array[cellidx]!=NULLP) - { - FreeNrcgi(&spCellLst->list.array[cellidx]->value.choice.SCell_ToBeSetup_Item.sCell_ID); - } - if(spCellLst->list.array[cellidx]!=NULLP) - { - DU_FREE(spCellLst->list.array[cellidx],sizeof(SCell_ToBeSetup_ItemIEs_t)); - } - } - DU_FREE(spCellLst->list.array,spCellLst->list.size); - } -} - /******************************************************************* - * - * @brief Deallocating memory of function BuildAndSendUESetReq - * - * @details - * - * Function : FreeSRBSetup - * - * Functionality: Deallocating memory for function BuildSRBSetup - * - * @params[in] SRBs_ToBeSetup_List_t *srbSet - * - * @return void - * - * - * ******************************************************************/ -void FreeSRBSetup(SRBs_ToBeSetup_List_t *srbSet) -{ - uint8_t srbidx; - if(srbSet->list.array != NULLP) - { - for(srbidx=0; srbidxlist.count; srbidx++) - { - if(srbSet->list.array[srbidx]!=NULLP) - { - DU_FREE(srbSet->list.array[srbidx],sizeof(SRBs_ToBeSetup_ItemIEs_t)); - } - } - DU_FREE(srbSet->list.array,srbSet->list.size); - } -} - /******************************************************************* - * - * @brief Deallocating memory of function BuildAndSendUESetReq - * - * @details - * - * Function : FreeQOSInfo - * - * Functionality: Deallocating memory for function BuildQOSInfo - * - * @params[in] QoSFlowLevelQoSParameters_t *drbQos - * - * @return void - * - * ****************************************************************/ -void FreeQOSInfo(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) - { - DU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ - sizeof(MaxDataBurstVolume_t)); - } - DU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\ - sizeof(AveragingWindow_t)); - } - DU_FREE(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI,\ - sizeof(NonDynamic5QIDescriptor_t)); - } -} - /******************************************************************* - * - * @brief Deallocating memory of function BuildAndSendUESetReq - * - * @details - * - * Function : FreeULTnlInfo - * - * Functionality: Deallocating memory for function BuildULTnlInfo - * - * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo - * - * @return void - * - - * ****************************************************************/ -void FreeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo) -{ - uint8_t ulidx=0; - if(ulInfo->list.array != NULLP) - { - for(ulidx=0; ulidxlist.count; ulidx++) - { - if(ulidx==0&&ulInfo->list.array[ulidx]!=NULLP) - { - if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP) - { - if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.buf != NULLP) - { - if(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\ - !=NULLP) - { - DU_ALLOC(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\ - gTP_TEID.buf,ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.\ - gTPTunnel->gTP_TEID.size); - } - DU_FREE(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel->\ - transportLayerAddress.buf,ulInfo->list.array[ulidx]->\ - uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size); - } - DU_FREE(ulInfo->list.array[ulidx]->uLUPTNLInformation.choice.gTPTunnel,\ - sizeof(GTPTunnel_t)); - } - } - if(ulInfo->list.array[ulidx]!=NULLP) - { - DU_FREE(ulInfo->list.array[ulidx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t)); - } - } - DU_FREE(ulInfo->list.array,ulInfo->list.size); - } -} -/******************************************************************* - * - * @brief Deallocating memory for BuildAndSendUESetReq - * - * @details - * - * Function : FreeDRBSetup - * - * Functionality: Deallocating memory for BuildDRBSetup - * - * @params[in] DRBs_ToBeSetup_List_t *drbSet - * - * @return void - * - * ****************************************************************/ -void FreeDRBSetup(DRBs_ToBeSetup_List_t *drbSet) -{ - DRBs_ToBeSetup_Item_t *drbSetItem; - uint8_t flowidx; - uint8_t drbidx; - if(drbSet->list.array == NULLP) + for(idx=0; idxprotocolIEs.list.array[idx],\ + sizeof(UEContextSetupResponseIEs_t)); + if(ueSetRsp->protocolIEs.list.array[idx] == 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) - { - if((BuildULTnlInforet==ROK)&&(drbSetItem->uLConfiguration!=NULLP)) - { - DU_FREE(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t)); - } - FreeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); - DU_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,\ - sizeof(MaxDataBurstVolume_t)); - } - DU_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,sizeof(AveragingWindow_t)); - } - DU_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,sizeof(NonDynamic5QIDescriptor_t)); - } - } - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP) - { - DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx],sizeof(Flows_Mapped_To_DRB_Item_t)); - } - } - DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\ - flows_Mapped_To_DRB_List.list.array,drbSetItem->qoSInformation.choice.choice_extension->value.\ - choice.DRB_Information.flows_Mapped_To_DRB_List.list.size); - } - DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf,\ - drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->size); - } - DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD,\ - sizeof(OCTET_STRING_t)); - } - DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf,\ - drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.size); - } - DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t)); - } - DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); - } - DU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI, sizeof(NonDynamic5QIDescriptor_t)); - } - DU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t)); - } - } - if(drbSet->list.array[drbidx]!=NULLP) - { - DU_FREE(drbSet->list.array[drbidx],sizeof(DRBs_ToBeSetup_ItemIEs_t)); - } - } - DU_FREE(drbSet->list.array,drbSet->list.size); + DU_LOG(" F1AP : Memory allocation for UE Setup Response failed"); + break; } -} -/******************************************************************* - * - * @brief Free the UE Setup Request - * - * @details - * - * Function : FreeUESetReq - * - * Functionality: Deallocate the memory of BuildUESetReq - * - * @params[in] F1AP_PDU_t *f1apMsg - * - * @return void - * - * - * ****************************************************************/ - void FreeUESetReq(F1AP_PDU_t *f1apMsg) -{ - uint8_t idx=2; - uint8_t ieId; - UEContextSetupRequest_t *ueSetReq; - - if(f1apMsg != NULLP) - { - if(f1apMsg->choice.initiatingMessage != NULLP) - { - ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest; - if(ueSetReq->protocolIEs.list.array != NULLP) - { - if(ueSetReq->protocolIEs.list.array[idx]) - { - if(Nrcgiret==ROK ) - { - idx=6; - if(ueSetReq->protocolIEs.list.array[idx]) - { - if(SplCellListret==ROK) - { - idx++; - if(ueSetReq->protocolIEs.list.array[idx]) - { - if(SRBSetupret == ROK) - { - idx=8; - FreeDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List); - } - idx--; - FreeSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List); - } - } - idx--; - FreeSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List); - } - } - idx=2; - FreeNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI); - } - for(ieId=0; ieIdprotocolIEs.list.count; ieId++) - { - if(ueSetReq->protocolIEs.list.array[ieId] != NULLP) - { - DU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t)); - } - } - DU_FREE(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size); - } - DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); - } - DU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); - } - } - -/******************************************************************* - * - * @brief Builds and sends the UE Setup Request - * - * @details - * - * Function : BuildAndSendUESetReq - * - * Functionality: Constructs the UE Setup Request and sends - * it to the CU through SCTP. - * - * @params[in] - * - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t BuildAndSendUESetReq() -{ - - uint8_t elementCnt; - uint8_t idx; - uint8_t idx1; - F1AP_PDU_t *f1apMsg = NULL; - UEContextSetupRequest_t *ueSetReq; - asn_enc_rval_t encRetVal; /* Encoder return value */ - uint8_t ret= RFAILED; - uint8_t ret1; - while(true) - { - DU_LOG("\n F1AP : Building UE Context Setup Request\n"); - - DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); - if(f1apMsg == NULLP) - { - DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); - break; - } - - f1apMsg->present = F1AP_PDU_PR_initiatingMessage; - DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); - if(f1apMsg->choice.initiatingMessage == NULLP) - { - DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed"); - break; - } + } - f1apMsg->choice.initiatingMessage->procedureCode = \ - ProcedureCode_id_UEContextSetup; - f1apMsg->choice.initiatingMessage->criticality = Criticality_reject; - f1apMsg->choice.initiatingMessage->value.present = \ - InitiatingMessage__value_PR_UEContextSetupRequest; - ueSetReq = - &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest; - elementCnt = 9; - ueSetReq->protocolIEs.list.count = elementCnt; - ueSetReq->protocolIEs.list.size = \ - elementCnt * sizeof(UEContextSetupRequestIEs_t *); - - /* Initialize the UESetup members */ - DU_ALLOC(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size); - - if(ueSetReq->protocolIEs.list.array == NULLP) - { - DU_LOG(" F1AP : Memory allocation for UE Context SetupRequest failed"); - break; - } + idx = 0; - for(idx1=0; idx1protocolIEs.list.array[idx1],sizeof(UEContextSetupRequestIEs_t)); - if(ueSetReq->protocolIEs.list.array[idx1] == NULLP) - { - break; - } - } + /*GNB CU UE F1AP ID*/ + ueSetRsp->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetRsp->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; + ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID; - idx = 0; - - /*GNB CU UE F1AP ID*/ - ueSetReq->protocolIEs.list.array[idx]->id = \ - ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; - ueSetReq->protocolIEs.list.array[idx]->value.present = \ - UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID; - - /*GNB DU UE F1AP ID*/ - idx++; - ueSetReq->protocolIEs.list.array[idx]->id = \ - ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; - ueSetReq->protocolIEs.list.array[idx]->value.present = \ - UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID; - - /*Special Cell ID*/ - idx++; - ueSetReq->protocolIEs.list.array[idx]->id = \ - ProtocolIE_ID_id_SpCell_ID; - ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; - ueSetReq->protocolIEs.list.array[idx]->value.present = \ - UEContextSetupRequestIEs__value_PR_NRCGI; - Nrcgiret = BuildNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI); - if(Nrcgiret != ROK) - { - break; - } + /*GNB DU UE F1AP ID*/ + idx++; + ueSetRsp->protocolIEs.list.array[idx]->id = \ + ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject; + ueSetRsp->protocolIEs.list.array[idx]->value.present = \ + UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; + ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID; - /*Served Cell Index*/ - idx++; - ueSetReq->protocolIEs.list.array[idx]->id = \ - ProtocolIE_ID_id_ServCellIndex; - ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; - ueSetReq->protocolIEs.list.array[idx]->value.present = \ - UEContextSetupRequestIEs__value_PR_ServCellIndex; - ueSetReq->protocolIEs.list.array[idx]->value.choice.ServCellIndex = \ - CELL_INDEX; - - /*CellULConfigured*/ - idx++; - ueSetReq->protocolIEs.list.array[idx]->id = \ - ProtocolIE_ID_id_SpCellULConfigured; - ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; - ueSetReq->protocolIEs.list.array[idx]->value.present = \ - UEContextSetupRequestIEs__value_PR_CellULConfigured; - ueSetReq->protocolIEs.list.array[idx]->value.choice.CellULConfigured = \ - CellULConfigured_none; - - - /*CUtoDURRCContainer*/ - idx++; - ueSetReq->protocolIEs.list.array[idx]->id = \ - ProtocolIE_ID_id_CUtoDURRCInformation; - ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; - ueSetReq->protocolIEs.list.array[idx]->value.present = \ - UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; - - /*Special Cells to be SetupList*/ - idx++; - ueSetReq->protocolIEs.list.array[idx]->id = \ - ProtocolIE_ID_id_SCell_ToBeSetup_List; - ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore; - ueSetReq->protocolIEs.list.array[idx]->value.present = \ - UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; - SplCellListret = BuildSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List); - if(SplCellListret != ROK) - { - break; - } - /*SRBs To Be Setup List*/ - idx++; - ueSetReq->protocolIEs.list.array[idx]->id = \ - ProtocolIE_ID_id_SRBs_ToBeSetup_List; - ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; - ueSetReq->protocolIEs.list.array[idx]->value.present = \ - UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; - SRBSetupret = BuildSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List); - if(SRBSetupret != ROK) - { - break; - } - /*DRBs to Be Setup List*/ - idx++; - ueSetReq->protocolIEs.list.array[idx]->id = \ - ProtocolIE_ID_id_DRBs_ToBeSetup_List; - ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject; - ueSetReq->protocolIEs.list.array[idx]->value.present = \ - UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; - ret1 = BuildDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List); - if(ret1 != ROK) - { - break; - } - xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); + xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); - /* Encode the F1SetupRequest type as APER */ - memset((uint8_t *)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( "\n F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\ - encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); - break; - } - else - { - DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n"); - for(int i=0; i< encBufSize; i++) - { - printf("%x",encBuf[i]); - } - } + /* Encode the UE context setup response type as APER */ + memset((uint8_t *)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( "\n F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + break; + } + else + { + DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n"); + for(int i=0; i< encBufSize; i++) + { + printf("%x",encBuf[i]); + } + } - /* Sending msg */ - if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK) - { - DU_LOG("\n F1AP : Sending UE Context Setup Request Failed"); - break; - } - ret = ROK; - break; + /* Sending msg */ + if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK) + { + DU_LOG("\n F1AP : Sending UE Context Setup Request Failed"); + break; + } + ret = ROK; + break; } - FreeUESetReq(f1apMsg); - return ret; -}/* End of BuildAndSendUESetReq*/ + FreeUeSetupRsp(f1apMsg); + return ret;; +}/* End of BuildAndSendUESetRsp */ + /******************************************************************* * @@ -6281,7 +5436,7 @@ void F1APMsgHdlr(Buffer *mBuf) F1AP_PDU_t *f1apMsg; asn_dec_rval_t rval; /* Decoder return value */ F1AP_PDU_t f1apasnmsg ; - + DU_LOG("\nF1AP : Received F1AP message buffer"); ODU_PRINT_MSG(mBuf, 0,0); @@ -6303,13 +5458,13 @@ void F1APMsgHdlr(Buffer *mBuf) printf("\nF1AP : Received flat buffer to be decoded : "); for(i=0; i< recvBufLen; i++) { - printf("%x",recvBuf[i]); + printf("%x",recvBuf[i]); } /* Decoding flat buffer into F1AP messsage */ f1apMsg = &f1apasnmsg; memset(f1apMsg, 0, sizeof(F1AP_PDU_t)); - + rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0); DU_FREE(recvBuf, (Size)recvBufLen); @@ -6324,59 +5479,64 @@ void F1APMsgHdlr(Buffer *mBuf) switch(f1apMsg->present) { case F1AP_PDU_PR_successfulOutcome: - { - switch(f1apMsg->choice.successfulOutcome->value.present) - { - case SuccessfulOutcome__value_PR_F1SetupResponse: - { + { + switch(f1apMsg->choice.successfulOutcome->value.present) + { + case SuccessfulOutcome__value_PR_F1SetupResponse: + { #ifndef ODU_TEST_STUB - procF1SetupRsp(f1apMsg); + procF1SetupRsp(f1apMsg); #endif - break; - } - - case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge: - { - procGNBDUCfgUpdAck(f1apMsg); - break; - } + break; + } - default: - { - DU_LOG("\nF1AP : Invalid type of successful outcome [%d]", f1apMsg->choice.successfulOutcome->value.present); - return; - } - }/* End of switch(successfulOutcome) */ - break; - } - case F1AP_PDU_PR_initiatingMessage: - { - switch(f1apMsg->choice.initiatingMessage->value.present) - { - case InitiatingMessage__value_PR_DLRRCMessageTransfer: - { - procDlRrcMsgTrans(f1apMsg); - break; - } + case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge: + { + procGNBDUCfgUpdAck(f1apMsg); + break; + } - default: - { - DU_LOG("\nF1AP : Invalid type of initiating message[%d]", - f1apMsg->choice.initiatingMessage->value.present); - return; - } - }/* End of switch(initiatingMessage) */ - break; - } + default: + { + DU_LOG("\nF1AP : Invalid type of successful outcome [%d]", f1apMsg->choice.successfulOutcome->value.present); + return; + } + }/* End of switch(successfulOutcome) */ + break; + } + case F1AP_PDU_PR_initiatingMessage: + { + switch(f1apMsg->choice.initiatingMessage->value.present) + { + case InitiatingMessage__value_PR_DLRRCMessageTransfer: + { + procDlRrcMsgTrans(f1apMsg); + break; + } + case InitiatingMessage__value_PR_UEContextSetupRequest: + { + procUeContextSetupReq(f1apMsg); + break; + } + + default: + { + DU_LOG("\nF1AP : Invalid type of initiating message[%d]", + f1apMsg->choice.initiatingMessage->value.present); + return; + } + }/* End of switch(initiatingMessage) */ + break; + } default: - { - DU_LOG("\nF1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present); - return; - } + { + DU_LOG("\nF1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present); + return; + } }/* End of switch(f1apMsg->present) */ - + } /* End of F1APMsgHdlr */ /********************************************************************** diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index 3fd9495a4..f2a7fd37c 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -137,13 +137,13 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) { DU_LOG("\n****** Received initial configs at DU APP ******\n"); duProcCfgComplete(); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } default: { DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTDUAPP"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); ret = RFAILED; } } @@ -187,7 +187,7 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) { DU_LOG("\nDU_APP : Invalid event %d received at duActvTsk from ENTRLC", \ pst->event); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); ret = RFAILED; } } @@ -200,7 +200,7 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) //Config complete case EVTCFG: { - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } case EVTLRGCFGCFM: @@ -246,7 +246,7 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) default: { DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTMAC"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); ret = RFAILED; } } @@ -279,7 +279,7 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) } } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } case ENTEGTP: @@ -307,13 +307,13 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) ret = RFAILED; } } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); break; } default: { DU_LOG("\nDU_APP : DU APP can not process message from Entity %d", pst->srcEnt); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); ret = RFAILED; } diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 89c6469e3..4dd8cfc07 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -1262,12 +1262,12 @@ uint8_t duSendEgtpTestData() Buffer *mBuf; - if(ODU_GET_MSG(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK) + if(ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK) { if(ODU_ADD_POST_MSG_MULT((Data *)data, datSize, mBuf) != ROK) { DU_LOG("\nDU_APP : ODU_ADD_POST_MSG_MULT failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } } diff --git a/src/du_app/du_sctp.c b/src/du_app/du_sctp.c index dbc74ba4e..9df6cc9b3 100644 --- a/src/du_app/du_sctp.c +++ b/src/du_app/du_sctp.c @@ -396,7 +396,7 @@ uint8_t duSctpAssocReq(uint8_t itfType) uint8_t duFillSctpPst(Pst *pst, Event event) { Buffer *mBuf; - if(ODU_GET_MSG(DFLT_REGION, DU_POOL, &mBuf) != ROK) + if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK) { printf("\nDU_APP : Failed to allocate memory"); return RFAILED; @@ -672,7 +672,7 @@ uint8_t processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, uint32 else { - ODU_PUT_MSG(pollParams->mBuf); + ODU_PUT_MSG_BUF(pollParams->mBuf); } } } diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 63a35b0db..5d790bd4a 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -61,6 +61,13 @@ DuRlcUlUeCreateReq packRlcUlUeCreateReqOpts[] = packDuRlcUlUeCreateReq, /* Light weight-loose coupling */ }; +DuDlRrcMsgToRlcFunc duSendDlRrcMsgToRlcOpts[] = +{ + packDlRrcMsgToRlc, /* Loose coupling */ + RlcProcDlRrcMsgTransfer, /* Tight coupling */ + packDlRrcMsgToRlc /* Light weight-loose coupling */ +}; + /******************************************************************* * * @brief Handles EGTP data from CU @@ -79,15 +86,15 @@ DuRlcUlUeCreateReq packRlcUlUeCreateReqOpts[] = * ****************************************************************/ uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg) { + /* TODO : Extract RbId/UeID/CellID/SduId from database using tunnel id in egtp header */ DU_LOG("\nDU_APP : Processing DL data"); - +#ifdef EGTP_TEST Pst pst; KwuDatReqInfo datReqInfo; -#ifdef EGTP_TEST datReqInfo.rlcId.rbId = RB_ID; datReqInfo.rlcId.rbType = CM_LTE_DRB; datReqInfo.rlcId.ueId = UE_ID; @@ -95,7 +102,7 @@ uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg) datReqInfo.sduId = ++sduId; datReqInfo.lcType = CM_LTE_LCH_DTCH; -#endif + /* Filling pst and Sending to RLC DL */ pst.selector = ODU_SELECTOR_LWLC; pst.srcEnt = ENTDUAPP; @@ -106,6 +113,9 @@ uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg) pst.region = duCb.init.region; cmPkKwuDatReq(&pst, &datReqInfo, egtpMsg->msg); +#else + //duBuildAndSendDlRrcMsgToRlc(); +#endif return ROK; } @@ -132,7 +142,7 @@ uint8_t duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf) /* Send UL data to CU via EGTP */ duSendEgtpDatInd(mBuf); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return ROK; } @@ -206,6 +216,182 @@ uint8_t duBuildAndSendDlCcchInd(uint16_t *cellId, uint16_t *crnti, \ } +/******************************************************************* + * + * @brief Build and Send DL RRC Message transfer to RLC + * + * @details + * + * Function : duBuildAndSendDlRrcMsgToRlc + * + * Functionality: + * Build and Send DL RRC Message transfer to RLC + * + * @params[in] Cell ID + * UE Index + * Logical Channgel ID + * RRC Message + * RRC Message Length + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, \ + uint8_t lcId, bool deliveryStaReq, uint16_t rrcMsgLen, uint8_t *rrcMsg) +{ + Pst pst; + uint8_t ret; + uint8_t lcIdx; + RlcDlRrcMsgInfo *dlRrcMsgInfo; + + DU_ALLOC_SHRABL_BUF(dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo)); + if(!dlRrcMsgInfo) + { + DU_LOG("\nDU APP : Memory allocation failed for dlRrcMsgInfo in \ + duBuildAndSendDlRrcMsgToRlc"); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rrcMsg, rrcMsgLen); + return RFAILED; + } + + /* Filling up the RRC msg info */ + dlRrcMsgInfo->cellId = cellId; + dlRrcMsgInfo->ueIdx = ueCfg.ueIdx; + for(lcIdx = 0; lcIdx <= MAX_NUM_LOGICAL_CHANNELS; lcIdx++) + { + if(ueCfg.rlcBearerCfg[lcIdx].lcId == lcId) + { + dlRrcMsgInfo->rbType = ueCfg.rlcBearerCfg[lcIdx].rbType; + dlRrcMsgInfo->rbId = ueCfg.rlcBearerCfg[lcIdx].rbId; + dlRrcMsgInfo->lcType = ueCfg.rlcBearerCfg[lcIdx].lcType; + dlRrcMsgInfo->lcId = ueCfg.rlcBearerCfg[lcIdx].lcId; + break; + } + } + dlRrcMsgInfo->execDup = false; + dlRrcMsgInfo->deliveryStaRpt = deliveryStaReq; + dlRrcMsgInfo->rrcMsg = rrcMsg; + dlRrcMsgInfo->msgLen = rrcMsgLen; + + /* Filling post structure and sending msg */ + memset(&pst, 0, sizeof(Pst)); + FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_TRANS_TO_RLC); + ret = (*duSendDlRrcMsgToRlcOpts[pst.selector])(&pst, dlRrcMsgInfo); + if(ret != ROK) + { + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rrcMsg, rrcMsgLen); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo)); + return RFAILED; + } + + return ROK; +} + +/******************************************************************* + * + * @brief Process UE context setup request from CU + * + * @details + * + * Function : procUeCintextSetupReq + * + * Functionality: Process UE context setup request from CU + * + * @params[in] F1AP message + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t procUeContextSetupReq(F1AP_PDU_t *f1apMsg) +{ + uint8_t ret = ROK; + uint8_t ieIdx, byteIdx, ueIdx; + uint8_t *rrcMsg = NULLP; + uint16_t rrcMsgLen; + uint16_t cellId, cellIdx; + uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */ + uint32_t gnbCuUeF1apId; /* GNB CU UE F1AP ID */ + bool deliveryStaReq = false; /* RRC msg delivery status request */ + DuUeCb *ueCb = NULLP; + UEContextSetupRequest_t *ueSetReq = NULLP; + + ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest; + + /* TODO : fetch remaining values from f1ap msg */ + for(ieIdx=0; ieIdx < ueSetReq->protocolIEs.list.count; 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; + break; + } + case ProtocolIE_ID_id_RRCContainer: + { + rrcMsgLen = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size; + DU_ALLOC_SHRABL_BUF(rrcMsg, rrcMsgLen); + if(!rrcMsg) + { + DU_LOG("\nDU APP : Memory allocation failed for RRC Msg in procUeCtxtSetupReq"); + return RFAILED; + } + memcpy(rrcMsg, ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\ + rrcMsgLen); + break; + } + case ProtocolIE_ID_id_RRCDeliveryStatusRequest: + { + deliveryStaReq = true; + break; + } + default: + { + break; + } + } + } + + cellId = duCb.actvCellLst[cellIdx]->cellId; + for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++) + { + if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId) && + (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId && + duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState == UE_ACTIVE)) + { + ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx]; + break; + } + } + + /* TODO : send RB config to MAC/RLC */ + + /* Sending DL RRC Message to RLC */ + if(ueIdx != MAX_NUM_UE) + { + ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, SRB_ID_1, \ + deliveryStaReq, rrcMsgLen, rrcMsg); + } + else + { + DU_LOG("\nDU APP : No UE found for CuUeF1apId[%d] and DuUeF1apId[%d]", \ + gnbCuUeF1apId, gnbDuUeF1apId); + DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rrcMsg, rrcMsgLen); + ret = RFAILED; + } + + return ret; +} + /****************************************************************** * * @brief Processes DL RRC Message Transfer sent by CU diff --git a/src/ric_stub/ric_e2ap_msg_hdl.c b/src/ric_stub/ric_e2ap_msg_hdl.c index 007d86f1b..e1cd8982a 100644 --- a/src/ric_stub/ric_e2ap_msg_hdl.c +++ b/src/ric_stub/ric_e2ap_msg_hdl.c @@ -52,7 +52,7 @@ S16 SendE2APMsg(Region region, Pool pool) { Buffer *mBuf; - if(ODU_GET_MSG(region, pool, &mBuf) == ROK) + if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK) { if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK) { @@ -61,17 +61,17 @@ S16 SendE2APMsg(Region region, Pool pool) if(sctpSend(mBuf) != ROK) { DU_LOG("\nE2AP : SCTP Send for E2 failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } } else { DU_LOG("\nE2AP : ODU_ADD_POST_MSG_MULT failed"); - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); return RFAILED; } - ODU_PUT_MSG(mBuf); + ODU_PUT_MSG_BUF(mBuf); } else { diff --git a/src/ric_stub/ric_stub_sctp.c b/src/ric_stub/ric_stub_sctp.c index d4453cac0..7c6f7db70 100644 --- a/src/ric_stub/ric_stub_sctp.c +++ b/src/ric_stub/ric_stub_sctp.c @@ -430,11 +430,11 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, U32 *timeou else if(connUp & (pollParams->port == ricParams.destPort)) { E2APMsgHdlr(pollParams->mBuf); - ODU_PUT_MSG(pollParams->mBuf); + ODU_PUT_MSG_BUF(pollParams->mBuf); } else { - ODU_PUT_MSG(pollParams->mBuf); + ODU_PUT_MSG_BUF(pollParams->mBuf); } } } -- 2.16.6