return RFAILED;
}
schUeCfg->ambrCfg->ulBr = ueCfg->ambrCfg->ulBr;
- schUeCfg->ambrCfg->dlBr = ueCfg->ambrCfg->dlBr;
}
else
schUeCfg->ambrCfg = NULLP;
RlcDlRbCb *rbCb; /* RB Control Block */
RlcCb *tRlcCb;
- DU_LOG("\nDEBUG --> RLC_UL : Received DL Data");
+ DU_LOG("\nDEBUG --> RLC_DL : Received DL Data");
#if (ERRCLASS & ERRCLS_INT_PAR)
if(pst->dstInst >= MAX_RLC_INSTANCES)
rlcDbmFetchDlRbCbByRbId(tRlcCb, &datReq->rlcId, &rbCb);
if(!rbCb)
{
- DU_LOG("\nERROR --> RLC_UL : CellId[%u]:DL RbId [%d] not found",
+ DU_LOG("\nERROR --> RLC_DL : CellId[%u]:DL RbId [%d] not found",
datReq->rlcId.cellId,datReq->rlcId.rbId);
ODU_PUT_MSG_BUF(mBuf);
}
default:
{
- DU_LOG("\nERROR --> RLC_UL : Invalid RB Mode");
+ DU_LOG("\nERROR --> RLC_DL : Invalid RB Mode");
break;
}
}
* ****************************************************************/
void oduCpyFixBufToMsg(uint8_t *fixBuf, Buffer *mBuf, uint16_t len)
{
- uint8_t idx, revIdx, temp;
- uint16_t copyLen;
+ uint16_t idx = 0, revIdx = 0, temp = 0, copyLen = 0;
/* ODU_COPY_FIX_BUF_TO_MSG copies fixed buffer in reverse order. \
* Hence reversing the fixed buffer before copying in order to \
#define MAX_NUM_CELL 1
#define MAX_NUM_UE 1
#define MAX_NUM_LC 11
+#define MAX_NUM_TUNNEL 2 /* Max. no of Tunnels */
/* 5G ORAN phy delay */
#define PHY_DELTA 2
typedef struct ambrCfg
{
uint32_t ulBr; /* UL Bit rate */
- uint32_t dlBr; /* DL Bit rate */
}AmbrCfg;
/* Single Network Slice Selection assistance Info */
typedef struct schAmbrCfg
{
uint32_t ulBr; /* Ul BitRate */
- uint32_t dlBr; /* Dl BitRate */
}SchAmbrCfg;
typedef struct schModulationInfo
return ROK;
}
+/*******************************************************************
+ *
+ * @brief Function to decode teId value from the octect String
+ *
+ * @details
+ *
+ * Function : teIdStringToInt
+ *
+ * Functionality: Function to decode teId value from the octect string
+ * It can used as generic function to convert
+ * octect string to uint32_t value
+ *
+ * @params[in] buf, value
+ * @return void
+ *
+ * ****************************************************************/
+void teIdStringToInt(uint8_t *buf, uint32_t *val)
+{
+ uint32_t temp1 = 0, temp2 = 0, temp3 = 0;
+
+ temp1 |= buf[0];
+ temp1 <<= 24;
+
+ temp2 |= buf[1];
+ temp2 <<= 16;
+ temp3 |= buf[2];
+ temp3 <<= 8;
+
+ *val = temp1|temp2|temp3|buf[3];
+}
+
+/*******************************************************************
+ *
+ * @brief Function to encode teId value to the octect String
+ *
+ * @details
+ *
+ * Function : fillTeIdString
+ *
+ * Functionality: Function to encode teId value to the octect String
+ * It can used as generic function to encode
+ * uint32_t value to octect string
+ *
+ * @params[in] bufSize, value, buf
+ * @return void
+ *
+ * ****************************************************************/
+
+void fillTeIdString(uint8_t bufSize, uint32_t val, uint8_t *buf)
+{
+ uint8_t bitPos;
+
+ for(bitPos = 0; bitPos < TEID_BIT_SIZE; bitPos += 8, bufSize--)
+ {
+ /*extracting bitBits from the bitPos*/
+ buf[bufSize] = (((1 << 8) - 1) & (val >> (bitPos)));
+ }
+}
/**********************************************************************
End of file
#define ENC_BUF_MAX_LEN 400
#define ENCODE_FAIL -1
+#define TEID_BIT_SIZE 24
char encBuf[ENC_BUF_MAX_LEN];
int encBufSize;
int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf);
uint8_t fillBitString(BIT_STRING_t *id, uint8_t unusedBits, uint8_t byteSize, uint8_t val);
uint8_t bitStringToInt(BIT_STRING_t *bitString, void *val);
+void fillTeIdString(uint8_t bufSize, uint32_t val, uint8_t *buf);
+void teIdStringToInt(uint8_t *buf, uint32_t *val);
#endif
#define DMRS_ADDITIONAL_POS 0 /* DMRS Additional poistion */
#define RES_ALLOC_TYPE 1 /* Resource allocation type */
+#define FIVE_QI_VALUE 9 /*spec 23.501, Table 5.7.4-1*/
+
/*******************************************************************
*
* @brief Sends F1 msg over SCTP
return RFAILED;
}
/*FiveQI*/
- drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 0;
+ drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = FIVE_QI_VALUE;
/*AveragingWindow*/
CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\
sizeof(AveragingWindow_t));
*(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume) = 0;
/*nRGRAN Allocation Retention Priority*/
- drbQos->nGRANallocationRetentionPriority.priorityLevel = PriorityLevel_highest;
+ drbQos->nGRANallocationRetentionPriority.priorityLevel = PriorityLevel_lowest;
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*/
{
return RFAILED;
}
+ /* NOTE: Below IP address must be changed if running on different IP configuration */
ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf[0] = 4;
+ transportLayerAddress.buf[0] = 192;
ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf[1] = 4;
+ transportLayerAddress.buf[1] = 168;
ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf[2] = 4;
+ transportLayerAddress.buf[2] = 130;
ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- transportLayerAddress.buf[3] = 5;
+ transportLayerAddress.buf[3] = 82;
ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
transportLayerAddress.bits_unused = 0;
/*GTP TEID*/
return RFAILED;
}
ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[0] = 11;
+ gTP_TEID.buf[0] = 0;
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] = 2;
+ gTP_TEID.buf[3] = 1;
return ROK;
}/*End of BuildULTnlInfo*/
return RFAILED;
}
ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[0] = 11;
+ gTP_TEID.buf[0] = 0;
ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
gTP_TEID.buf[1] = 0;
ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
gTP_TEID.buf[2] = 0;
ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[3] = 1;
+ gTP_TEID.buf[3] = 2;
return ROK;
}/*End of BuildULTnlInfo*/
}
tnlEvt.action = EGTP_TNL_MGMT_ADD;
- tnlEvt.lclTeid = 10;
+ tnlEvt.lclTeid = 1;
tnlEvt.remTeid = 1;
ret = cuEgtpTnlMgmtReq(tnlEvt);
if(ret != ROK)
S16 cuEgtpDatReq()
{
- uint16_t cnt = 0;
+ uint8_t ret = ROK, cnt = 0;
EgtpMsg egtpMsg;
/* Build Application message that is supposed to come from app to egtp */
- BuildAppMsg(&egtpMsg);
+ ret = BuildAppMsg(&egtpMsg);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> EGTP : Failed to build App Msg");
+ return RFAILED;
+ }
/* Encode EGTP header to build final EGTP message */
- BuildEgtpMsg(&egtpMsg);
-
+ ret = BuildEgtpMsg(&egtpMsg);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> EGTP : Failed to build EGTP Msg");
+ return RFAILED;
+ }
/* Send Message to peer */
while(cnt < 200)
{
DU_LOG("\nDEBUG --> EGTP : Sending message[%d]", cnt+1);
cuEgtpSendMsg(egtpMsg.msg);
cnt++;
+ //sleep(1);
}
ODU_PUT_MSG_BUF(egtpMsg.msg);
S16 BuildAppMsg(EgtpMsg *egtpMsg)
{
- char data[30] = "This is EGTP data from CU";
- int datSize = 30;
+ char data[1215] = "In telecommunications, 5G is the fifth generation technology standard for broadband cellular"
+ " networks, which cellular phone companies began deploying worldwide in 2019, and is the planned successor to the 4G "
+ " networks which provide connectivity to most current cellphones. 5G networks are predicted to have more than 1.7"
+ " billion subscribers worldwide by 2025, according to the GSM Association.Like its predecessors, 5G networks are"
+ " cellular networks,in which the service area is divided into small geographical areas called cells.All 5G wireless"
+ " devices in a cell are connected to the Internet and telephone network by radio waves through local antenna in the"
+ " cell. The main advantage of the new networks is that they will have greater bandwidth, giving higher download"
+ " speeds, eventually up to 10 gigabits per second(Gbit/s). Due to the increased bandwidth, it is expected the"
+ " networks will not exclusively serve cellphones like existing cellular networks, but also be used as general"
+ " internet service providers for laptops and desktop computers, competing with existing ISPs such as cable"
+ " internet, and also will make possible new applications in internet of things (IoT) and machine to machine areas.";
+
+ int datSize = 1215;
Buffer *mBuf;
egtpMsg->msgHdr.seqNum.pres = FALSE;
egtpMsg->msgHdr.extHdr.udpPort.pres = FALSE;
egtpMsg->msgHdr.extHdr.pdcpNmb.pres = FALSE;
- egtpMsg->msgHdr.teId = 10;
+ egtpMsg->msgHdr.teId = 1;
egtpMsg->msg = mBuf;
return ret;
* ***************************************************************************/
uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt)
{
- S8 ret;
+ uint8_t ret = ROK;
DU_LOG("\nDEBUG --> EGTP : Received tunnel management request");
switch(tnlEvt.action)
DU_LOG("\nDEBUG --> EGTP : Sending Tunnel management confirmation");
duHdlEgtpTnlMgmtCfm(tnlEvt);
- return ROK;
+ return ret;
}
/**************************************************************************
* ***************************************************************************/
uint8_t egtpTnlMod(EgtpTnlEvt tnlEvt)
{
-#if 0
- uint8_t ret;
EgtpTeIdCb *teidCb = NULLP;
- DU_LOG("\nINFO --> Tunnel modification : LocalTeid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid);
+ DU_LOG("\nINFO --> EGTP : Tunnel modification : LocalTeid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid);
- cmHashListFind(&(egtpCb.dstCb.teIdLst), (uint8_t *)&(tnlEvt.teId), sizeof(uint32_t), 0, (PTR *)&teidCb);
+ cmHashListFind(&(egtpCb.dstCb.teIdLst), (uint8_t *)&(tnlEvt.lclTeid), sizeof(uint32_t), 0, (PTR *)&teidCb);
if(teidCb == NULLP)
{
- DU_LOG("\nERROR --> Tunnel id not found");
+ DU_LOG("\nERROR --> EGTP : Tunnel id not found");
return RFAILED;
}
-
- teidCb->teId = tnlEvt.lclTeid;
- DU_LOG("\nINFO --> Tunnel id is" , teidCb->teId);
+ teidCb->teId = tnlEvt.remTeid;
teidCb->remTeId = tnlEvt.remTeid;
-#endif
return ROK;
}
cmHashListDelete(&(egtpCb.dstCb.teIdLst), (PTR)teidCb);
DU_FREE(teidCb, sizeof(EgtpTeIdCb));
egtpCb.dstCb.numTunn--;
-
return ROK;
}
#include "du_mgr.h"
#include "du_cell_mgr.h"
#include "du_f1ap_msg_hdl.h"
+#include "DRBs-Setup-Item.h"
+#include "DLUPTNLInformation-ToBeSetup-List.h"
+#include "DLUPTNLInformation-ToBeSetup-Item.h"
+#include "UPTransportLayerInformation.h"
+#include "GTPTunnel.h"
DuCfgParams duCfgParam;
{
freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]);
}
+ for(lcIdx = 0; lcIdx < ueCfg->numDrb; lcIdx++)
+ {
+ DU_FREE(ueCfg->upTnlInfo[lcIdx].tnlCfg1, sizeof(GtpTnlCfg));
+ memset(&ueCfg->upTnlInfo[lcIdx], 0, sizeof(UpTnlCfg));
+ }
}
/*******************************************************************
qosToAdd->ulPduSessAggMaxBitRate = 0;
}
-uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd)
+/*******************************************************************
+ *
+ * @brief Function to extract GTP Tunnel Info from CU
+ *
+ * @details
+ *
+ * Function : extractUpTnlInfo
+ *
+ * Functionality: Function to extract GTP Tunnel Info from CU
+ *
+ * @params[in] F1AP message
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
+ ULUPTNLInformation_ToBeSetup_List_t *tnlInfo, UpTnlCfg *upTnlInfo)
+{
+ uint8_t tnlIdx;
+ uint32_t ipv4_du = 0;
+ GTPTunnel_t *gtpTunnel = NULLP;
+
+ upTnlInfo->drbId = drbId;
+ upTnlInfo->configType = configType;
+ cmInetAddr((char *)DU_IP_V4_ADDR, &ipv4_du);
+
+ for(tnlIdx=0; tnlIdx < tnlInfo->list.count; tnlIdx++)
+ {
+ if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.present == UPTransportLayerInformation_PR_gTPTunnel)
+ {
+ if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel)
+ {
+ gtpTunnel = tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel;
+ DU_ALLOC(upTnlInfo->tnlCfg1, sizeof(GtpTnlCfg));
+ if(upTnlInfo->tnlCfg1 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : extractUpTnlInfo: Failed to allocate mmeory for tunnel cfg 1");
+ return RFAILED;
+ }
+ bitStringToInt(>pTunnel->transportLayerAddress, &upTnlInfo->tnlCfg1->ulTnlAddress);
+ upTnlInfo->tnlCfg1->dlTnlAddress = ipv4_du;
+ if(gtpTunnel->gTP_TEID.size > 0)
+ {
+ teIdStringToInt(gtpTunnel->gTP_TEID.buf, &upTnlInfo->tnlCfg1->teId);
+ }
+ }
+ break;
+ }
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extract DRB info received from CU
+ *
+ * @details
+ *
+ * Function : extractDrbCfg
+ *
+ * Functionality: Function to extract DRB info received from CU
+ *
+ * @params[in] F1AP message
+ * @return void
+ *
+ * ****************************************************************/
+uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
{
DRB_Information_t *drbInfo = NULLP;
+ if(extractUpTnlInfo(drbItem->dRBID, CONFIG_ADD, &drbItem->uLUPTNLInformation_ToBeSetup_List, upTnlInfo) != ROK)
+ {
+ DU_LOG("\nERROR --> DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
+ return RFAILED;
+ }
if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension)
{
if(drbItem->qoSInformation.choice.choice_extension->value.present ==
return ROK;
}
-uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg)
+uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg,\
+ UpTnlCfg *upTnlInfo)
{
uint8_t ret = ROK;
if(drbCfg)
{
- ret = extractDrbCfg(drbCfg, lcCfg);
- if(ret == RFAILED)
+ if(drbCfg != NULLP)
{
- DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
- return ret;
+ ret = extractDrbCfg(drbCfg, lcCfg, upTnlInfo);
+ if(ret == RFAILED)
+ {
+ DU_LOG("ERROR --> F1AP : Failed to build Drb Qos at extractMacRbCfg()");
+ return ret;
+ }
}
}
else
}
uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\
- DRBs_ToBeSetup_Item_t *drbItem, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg)
+ DRBs_ToBeSetup_Item_t *drbItem, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
{
uint8_t ret = ROK;
lcCfg->configType = configType;
if(rbType == RB_TYPE_SRB)
{
- ret = extractMacRbCfg(lcId, NULL, ulLcCfg, lcCfg);
+ ret = extractMacRbCfg(lcId, NULL, ulLcCfg, lcCfg, NULL);
}
else if(rbType == RB_TYPE_DRB)
{
- ret = extractMacRbCfg(lcId, drbItem, ulLcCfg, lcCfg);
+ ret = extractMacRbCfg(lcId, drbItem, ulLcCfg, lcCfg, upTnlInfo);
}
return ret;
}
memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg));
memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg));
procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]));
- ret = procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx]);
+ ret = procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL);
if(ret == RFAILED)
{
DU_LOG("\nERROR --> DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()");
procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd);
/* Filling MAC INFO */
- ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL, NULL, macLcToAdd);
+ ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL, NULL, macLcToAdd, NULL);
if(ret == RFAILED)
{
DU_LOG("\nERROR --> F1AP : Failed at MAC LC Cfg in procSrbListToSetup()");
*
* ****************************************************************/
-uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd)
+uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
+ LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo)
{
uint8_t ret = ROK;
procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
/* Filling MAC INFO */
- ret = procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, macLcToAdd);
+ ret = procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, macLcToAdd, upTnlInfo);
if(ret == RFAILED)
{
- DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in extractDrbListToSetup()");
+ DU_LOG("\nERROR --> F1AP : Failed at RLC LC Cfg in procDrbListToSetup()");
return ret;
}
drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
if(ueCfgDb->numMacLcs > MAX_NUM_LC)
{
- DU_LOG("\nERROR --> F1AP: MAX LC Reached in MAC ");
+ DU_LOG("\nERROR --> F1AP : MAX LC Reached in MAC at extractDrbListToSetup()");
ret = RFAILED;
break;
}
if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
{
- DU_LOG("\nERROR --> F1AP: MAX LC Reached in RLC");
+ DU_LOG("\nERROR --> F1AP : MAX LC Reached in RLC at extractDrbListToSetup()");
ret = RFAILED;
break;
}
memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
ret = procDrbListToSetup(lcId, drbItem, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
- &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]);
+ &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
+
ueCfgDb->numRlcLcs++;
ueCfgDb->numMacLcs++;
+ ueCfgDb->numDrb++;
if(ret == RFAILED)
{
DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetup()");
DU_ALLOC_SHRABL_BUF(dlRrcMsg->rrcMsgPdu, dlRrcMsg->rrcMsgSize);
if(!dlRrcMsg->rrcMsgPdu)
{
- DU_LOG("\nERROR --> DU APP : Memory allocation failed for RRC Msg in procUeCtxtSetupReq");
+ DU_LOG("\nERROR --> DU APP : Memory allocation failed for RRC Msg in extractDlRrcMsg()");
ret = RFAILED;
}
else
memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg));
memcpy(&duUeCb->f1UeDb->duUeCfg.ambrCfg->ulBr,
ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize);
- duUeCb->f1UeDb->duUeCfg.ambrCfg->dlBr = 0;
}
}
else
}
+/*******************************************************************
+ * @brief Free the memory allocated for Dl Tunnel Info
+ *
+ * @details
+ *
+ * Function : freeDlTnlInfo
+ *
+ * Functionality:
+ * Free the memory allocated for Dl Tunnel Info
+ *
+ * @params[in] DLUPTNLInformation_ToBeSetup_List_t *
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeDlTnlInfo(DLUPTNLInformation_ToBeSetup_List_t *tnlInfo)
+{
+ uint8_t arrIdx = 0;
+
+ for(arrIdx=0; arrIdx < tnlInfo->list.count; arrIdx++)
+ {
+ DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
+ }
+}
+
+/*******************************************************************
+ * @brief Free the memory allocated for DRB setup List
+ *
+ * @details
+ *
+ * Function : freeDrbSetupList
+ *
+ * Functionality:
+ * Free the memory allocated for DRB setup list
+ *
+ * @params[in] DRBs_Setup_List_t *
+ * @return void
+ *
+ * ****************************************************************/
+void freeDrbSetupList(DRBs_Setup_List_t *drbSetupList)
+{
+ uint8_t arrIdx = 0;
+ DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
+
+ for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
+ {
+ drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
+ freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List);
+ }
+}
+
/*******************************************************************
* @brief Free the memory allocated for UE Setup response
*
}
break;
}
+ case ProtocolIE_ID_id_DRBs_Setup_List:
+ {
+ freeDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List);
+ break;
+ }
default:
DU_LOG("\nERROR --> DUAPP: Invalid Id %ld at FreeUeContextSetupRsp()",\
ueSetRsp->protocolIEs.list.array[idx]->id);
return ROK;
}
+/*******************************************************************
+ *
+ * @brief Fills Dl Gtp tunnel Info
+ *
+ * @details
+ *
+ * Function : fillGtpTunnelforDl
+ *
+ * Functionality: Fills Dl Gtp tunnel Info
+ *
+ * @params[in]
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t fillGtpTunnelforDl(GTPTunnel_t *gtpDl, GtpTnlCfg *gtpUeCfg)
+{
+ uint8_t bufSize = 0;
+
+ gtpDl->transportLayerAddress.size = 4*sizeof(uint8_t);
+ DU_ALLOC(gtpDl->transportLayerAddress.buf, gtpDl->transportLayerAddress.size);
+ if(gtpDl->transportLayerAddress.buf == NULLP)
+ {
+ return RFAILED;
+ }
+ memcpy(gtpDl->transportLayerAddress.buf, >pUeCfg->dlTnlAddress, gtpDl->transportLayerAddress.size);
+
+ /*GTP TEID*/
+ gtpDl->gTP_TEID.size = 4 * sizeof(uint8_t);
+ DU_ALLOC(gtpDl->gTP_TEID.buf, gtpDl->gTP_TEID.size);
+ if(gtpDl->gTP_TEID.buf == NULLP)
+ {
+ return RFAILED;
+ }
+ bufSize = 3; /*forming an Octect String*/
+ fillTeIdString(bufSize, gtpUeCfg->teId, gtpDl->gTP_TEID.buf);
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills DL Tunnel Setup List
+ *
+ * @details
+ *
+ * Function : fillDlTnlSetupList
+ *
+ * Functionality: Fills the DL Tunnel Setup List
+ *
+ * @params[in]
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t fillDlTnlSetupList(DLUPTNLInformation_ToBeSetup_List_t *dlTnlInfo, UpTnlCfg *tnlCfg)
+{
+ uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
+
+ eleCount = 1;
+ dlTnlInfo->list.count = eleCount;
+ dlTnlInfo->list.size = (eleCount * sizeof(DLUPTNLInformation_ToBeSetup_Item_t *));
+
+ /* Initialize the DL Tnl Setup List Members */
+ DU_ALLOC(dlTnlInfo->list.array, dlTnlInfo->list.size);
+ if(dlTnlInfo->list.array == NULLP)
+ {
+ DU_LOG(" ERROR --> F1AP : Memory allocation for DL Tnl Setup List in fillDlTnlSetupList()");
+ ret = RFAILED;
+ }
+ for(arrIdx=0; arrIdx < eleCount; arrIdx++)
+ {
+ DU_ALLOC(dlTnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
+ if(dlTnlInfo->list.array[arrIdx] == NULLP)
+ {
+ DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDlTnlSetupList()", arrIdx);
+ return RFAILED;
+ }
+ dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.present = UPTransportLayerInformation_PR_gTPTunnel;
+ DU_ALLOC(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
+ if(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel == NULLP)
+ {
+ DU_LOG(" ERROR --> F1AP : Memory allocation for DL tunnel info in fillDlTnlSetupList()");
+ return RFAILED;
+ }
+ ret = fillGtpTunnelforDl(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel,\
+ tnlCfg->tnlCfg1);
+ if(ret != ROK)
+ break;
+ }
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills the Drb Setup List for Ue Context Setup Response
+ *
+ * @details
+ *
+ * Function : fillDrbSetupList
+ *
+ * Functionality: Fills the Drb Setup List for Ue Context Setup Response
+ *
+ * @params[in]
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg)
+{
+ uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
+ DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
+
+ eleCount = ueCfg->numDrb;
+ drbSetupList->list.count = eleCount;
+ drbSetupList->list.size = \
+ (eleCount * sizeof(DRBs_Setup_Item_t *));
+
+ /* Initialize the Drb Setup List Members */
+ DU_ALLOC(drbSetupList->list.array, drbSetupList->list.size);
+ if(drbSetupList->list.array == NULLP)
+ {
+ DU_LOG(" ERROR --> F1AP : Memory allocation for DRB Setup List in fillDrbSetupList()");
+ ret = RFAILED;
+ }
+
+ for(arrIdx=0; arrIdx < eleCount; arrIdx++)
+ {
+ DU_ALLOC(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
+ if(drbSetupList->list.array[arrIdx] == NULLP)
+ {
+ DU_LOG(" ERROR --> F1AP : Memory allocation for arrIdx [%d] failed in fillDrbSetupList()", arrIdx);
+ return RFAILED;
+ }
+ drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
+ drbItemIe->id = ProtocolIE_ID_id_DRBs_Setup_Item;
+ drbItemIe->criticality = Criticality_reject;
+ drbItemIe->value.present = DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item;
+ drbItemIe->value.choice.DRBs_Setup_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
+ ret = fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List,\
+ &ueCfg->upTnlInfo[arrIdx]);
+ if(ret != ROK)
+ break;
+ }
+ return ret;
+}
+
/*******************************************************************
*
* @brief Builds and sends the UE Setup Response
ueSetRsp =
&f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
- elementCnt = 3;
+ elementCnt = 4;
ueSetRsp->protocolIEs.list.count = elementCnt;
ueSetRsp->protocolIEs.list.size = \
elementCnt * sizeof(UEContextSetupResponse_t *);
cellGrpCfg = (CellGroupConfigRrc_t*)ueCb->f1UeDb->duUeCfg.cellGrpCfg;
ret = EncodeUeCntxtDuToCuInfo(&ueSetRsp->protocolIEs.list.array[idx]->value.\
choice.DUtoCURRCInformation.cellGroupConfig, cellGrpCfg);
- /* Free UeContext Db created during Ue context Req */
- freeF1UeDb(ueCb->f1UeDb);
- ueCb->f1UeDb = NULLP;
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nERROR --> F1AP : Failed to EncodeUeCntxtDuToCuInfo in BuildAndSendUeContextSetupRsp()");
+ freeF1UeDb(ueCb->f1UeDb);
+ ueCb->f1UeDb = NULLP;
+ break;
+ }
}
}
else
{
- DU_LOG("\nERROR --> F1AP: Failed to form DUtoCU RRCInfo at BuildAndSendUeContextSetupRsp()");
+ DU_LOG("\nERROR --> F1AP : Failed to form DUtoCU RRCInfo at BuildAndSendUeContextSetupRsp()");
ret = RFAILED;
+ break;
}
+
+ /* Drb Setup List */
+ idx++;
+ ueSetRsp->protocolIEs.list.array[idx]->id = \
+ ProtocolIE_ID_id_DRBs_Setup_List;
+ ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ ueSetRsp->protocolIEs.list.array[idx]->value.present =\
+ UEContextSetupResponseIEs__value_PR_DRBs_Setup_List;
+ ret = fillDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List,\
+ &ueCb->f1UeDb->duUeCfg);
if(ret == RFAILED)
+ {
+ DU_LOG("\nERROR --> F1AP : Failed to fillDrbSetupList in BuildAndSendUeContextSetupRsp()");
+ freeF1UeDb(ueCb->f1UeDb);
+ ueCb->f1UeDb = NULLP;
break;
+ }
+
+ /* Free UeContext Db created during Ue context Req */
+ freeF1UeDb(ueCb->f1UeDb);
+ ueCb->f1UeDb = NULLP;
xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
/* Encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\
+ DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Response structure (at %s)\n",\
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
ret = RFAILED;
break;
}
else
{
- DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Setup Request\n");
+ DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for UE Context Setup Response\n");
for(int i=0; i< encBufSize; i++)
{
printf("%x",encBuf[i]);
/* Sending msg */
if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK)
{
- DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Request Failed");
+ DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Response failed");
ret = RFAILED;
break;
}
uint8_t *rrcMsgPdu;
}F1DlRrcMsg;
+typedef struct gtpTnlCfg
+{
+ uint32_t ulTnlAddress; /* remote Address */
+ uint32_t dlTnlAddress; /* local Address */
+ uint32_t teId;
+}GtpTnlCfg;
+
+typedef struct upTnlCfg
+{
+ ConfigType configType;
+ uint8_t cellId;
+ uint8_t ueIdx;
+ uint8_t drbId;
+ GtpTnlCfg *tnlCfg1; /* Tunnel 1 */
+ GtpTnlCfg *tnlCfg2; /* Tunnel 2 */
+}UpTnlCfg;
+
typedef struct duUeCfg
{
void *cellGrpCfg;
uint8_t numMacLcs; /* Mac Ue Cfg */
LcCfg macLcCfg[MAX_NUM_LC];
AmbrCfg *ambrCfg;
+ uint8_t numDrb;
+ UpTnlCfg upTnlInfo[MAX_NUM_DRB]; /* User plane TNL Info*/
}DuUeCfg;
typedef struct f1UeContextSetup
DuCellCb* actvCellLst[MAX_NUM_CELL]; /* List of cells activated/to be activated of type DuCellCb */
uint32_t numUe; /* current number of UEs */
UeCcchCtxt ueCcchCtxt[MAX_NUM_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
+ uint8_t numDrb; /* current number of DRbs*/
+ UpTnlCfg* upTnlCfg[MAX_NUM_DRB]; /* tunnel info for every Drb */
}DuCb;
uint8_t duHdlEgtpCfgComplete(CmStatus cfm);
uint8_t duSendEgtpSrvOpenReq();
uint8_t duHdlEgtpSrvOpenComplete(CmStatus cfm);
-uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t lclTeid, uint32_t remTeid);
+uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t teIdMod, GtpTnlCfg *tnlInfo);
uint8_t duSendEgtpDatInd(Buffer *mBuf);
uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm);
uint8_t duBuildAndSendMacCellStart();
if(cfm.status == LCM_PRIM_OK)
{
DU_LOG("\nDEBUG --> DU_APP : EGTP server opened successfully");
-#ifdef EGTP_TEST
- duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_ADD, EGTP_LCL_TEID, EGTP_REM_TEID);
-#endif
}
else
{
*
* ****************************************************************/
-uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t lclTeid, uint32_t remTeid)
+uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t teIdTobeMod, GtpTnlCfg *ueCbTnlCfg)
{
+ uint8_t ret =ROK;
Pst pst;
EgtpTnlEvt tnlEvt;
- tnlEvt.action = action;
- tnlEvt.lclTeid = lclTeid;
- tnlEvt.remTeid = remTeid;
+ DU_LOG("\nDEBUG --> DU_APP : Sending EGTP tunnel management request for teId [%d]", ueCbTnlCfg->teId);
- DU_LOG("\nDEBUG --> DU_APP : Sending EGTP tunnel management request");
+ /* ADD/MOD/DEL per tunnel */
+ tnlEvt.action = action;
+ tnlEvt.remTeid = ueCbTnlCfg->teId;
+ if(action != EGTP_TNL_MGMT_ADD)
+ {
+ tnlEvt.lclTeid = teIdTobeMod;
+ }
+ else
+ {
+ tnlEvt.lclTeid = ueCbTnlCfg->teId;
+ }
duFillEgtpPst(&pst, EVTTNLMGMTREQ);
- egtpTnlMgmtReq(&pst, tnlEvt);
- return ROK;
+ ret = egtpTnlMgmtReq(&pst, tnlEvt);
+ return ret;
}
/*******************************************************************
uint8_t DuProcRlcUlUserDataTrans(Pst *pst, RlcUlUserDatInfo *ulUserData)
{
uint8_t rbIdx;
- DuCellCb *cellCb;
- DuUeCb ueCb;
EgtpMsg egtpMsg;
Buffer *mBuf;
- if(duGetCellCb(ulUserData->cellId, &cellCb) != ROK)
- return RFAILED;
-
- ueCb = cellCb->ueCb[ulUserData->ueIdx -1];
-
DU_LOG("\nDEBUG --> DU APP : Received UL user data");
/* Fill EGTP header */
egtpMsg.msgHdr.extHdr.pdcpNmb.pres = FALSE;
/* Fetch EGTP tunnel info */
- /* TODO : keep the "#if 0" code block and test once DL User data changes are submitted */
-#if 0
- for(rbIdx = 0; rbIdx < MAX_NUM_DRB; rbIdx++)
+ for(rbIdx = 0; rbIdx < duCb.numDrb; rbIdx++)
{
- if(ueCb.ulTnlCfg[rbIx]->drbId == ulUserData->rbId)
+ if((duCb.upTnlCfg[rbIdx] != NULLP) && (duCb.upTnlCfg[rbIdx]->drbId == ulUserData->rbId))
{
- egtpMsg.msgHdr.teId = ueCb.ulTnlCfg[rbIx]->tnlCfg.teId;
+ if(duCb.upTnlCfg[rbIdx]->tnlCfg1)
+ {
+ egtpMsg.msgHdr.teId = duCb.upTnlCfg[rbIdx]->tnlCfg1->teId; /*As we are supporting only 1 tunnel per DRB*/
+ break;
+ }
}
}
-#else
- egtpMsg.msgHdr.teId = 1;
-#endif
if (ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) != ROK)
{
#include "du_f1ap_msg_hdl.h"
#include "du_ue_mgr.h"
-#ifdef EGTP_TEST
-uint32_t sduId = 0;
-#endif
-
DuMacDlCcchInd packMacDlCcchIndOpts[] =
{
packMacDlCcchInd, /* Loose coupling */
MacProcUeReconfigReq, /* TIght coupling */
packDuMacUeReconfigReq /* Light weight-loose coupling */
};
+
+#ifdef EGTP_TEST
+uint32_t sduId = 0;
+#endif
+
/*******************************************************************
*
* @brief Handles EGTP data from CU
}
memset(*macAmbr, 0, sizeof(AmbrCfg));
(*macAmbr)->ulBr = ueDbAmbr->ulBr;
- (*macAmbr)->dlBr = ueDbAmbr->dlBr;
}
else
{
}
+/*******************************************************************
+ *
+ * @brief Function to fill Tunnel Config to Add/Mod
+ *
+ *
+ * @details
+ *
+ * Function : fillTnlCfgToAddMod
+ *
+ * Functionality: Function to fill tunnel Config to Add/Mod
+ *
+ * @params[in] Pointer to tnlCfgDb,
+ * pointer to f1TnlCfg
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillTnlCfgToAddMod(UpTnlCfg **ueCbTnlCfg, UpTnlCfg *f1TnlCfg)
+{
+ if(*ueCbTnlCfg == NULLP)
+ {
+ /* copying to DuCb Tnl Cfg */
+ DU_ALLOC(*ueCbTnlCfg, sizeof(UpTnlCfg));
+ if(*ueCbTnlCfg == NULLP)
+ {
+ DU_LOG("\nERROR --> DU_APP : fillTnlCfgToAddMod: Memory Alloc failed for drbId[%d]", f1TnlCfg->drbId);
+ return RFAILED;
+ }
+ }
+ memset(*ueCbTnlCfg, 0, sizeof(UpTnlCfg));
+ (*ueCbTnlCfg)->configType = f1TnlCfg->configType;
+ (*ueCbTnlCfg)->cellId = f1TnlCfg->cellId;
+ (*ueCbTnlCfg)->ueIdx = f1TnlCfg->ueIdx;
+ (*ueCbTnlCfg)->drbId = f1TnlCfg->drbId;
+ if(f1TnlCfg->tnlCfg1)
+ {
+ if((*ueCbTnlCfg)->tnlCfg1 == NULLP)
+ {
+ DU_ALLOC((*ueCbTnlCfg)->tnlCfg1, sizeof(GtpTnlCfg));
+ if((*ueCbTnlCfg)->tnlCfg1 == NULLP)
+ {
+ DU_LOG("\nERROR --> DU_APP : fillTnlCfgToAddMod: Memory Alloc failed for tnlCfg1 for drbId[%d]", f1TnlCfg->drbId);
+ return RFAILED;
+ }
+ }
+ memset((*ueCbTnlCfg)->tnlCfg1, 0, sizeof(GtpTnlCfg));
+ (*ueCbTnlCfg)->tnlCfg1->teId = f1TnlCfg->tnlCfg1->teId;
+ (*ueCbTnlCfg)->tnlCfg1->ulTnlAddress = f1TnlCfg->tnlCfg1->ulTnlAddress;
+ (*ueCbTnlCfg)->tnlCfg1->dlTnlAddress = f1TnlCfg->tnlCfg1->dlTnlAddress;
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Processing the tunnel Request to EGTP
+ *
+ * @details
+ *
+ * Function : duProcEgtpTunnelCfg
+ *
+ * Functionality: Processing the tunnel Request to EGTP
+ *
+ * @params[in] UptnlCfg *duTnlCfg, UpTnlCfg *f1TnlCfg
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duProcEgtpTunnelCfg(uint8_t ueCbIdx, UpTnlCfg *duTnlCfg, UpTnlCfg *f1TnlCfg)
+{
+ uint8_t ret = RFAILED, delIdx;
+
+ if(f1TnlCfg->tnlCfg1 == NULLP)
+ {
+ DU_LOG("\nERROR --> DU_APP : Tunnel config not found");
+ return ret;
+ }
+
+ if(f1TnlCfg->configType == CONFIG_ADD)
+ {
+ if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_ADD, NULLP, f1TnlCfg->tnlCfg1) == ROK)
+ {
+ if(fillTnlCfgToAddMod(&duCb.upTnlCfg[duCb.numDrb], f1TnlCfg) == ROK)
+ {
+ duCb.numDrb++;
+ ret = ROK;
+ }
+ }
+ }
+ else if(f1TnlCfg->configType == CONFIG_MOD)
+ {
+ if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_MOD, duTnlCfg->tnlCfg1->teId, f1TnlCfg->tnlCfg1) == ROK)
+ {
+ if(fillTnlCfgToAddMod(&duTnlCfg, f1TnlCfg) == ROK)
+ {
+ ret = ROK;
+ }
+ }
+ }
+ else if(f1TnlCfg->configType == CONFIG_DEL)
+ {
+ if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_DEL, duTnlCfg->tnlCfg1->teId, f1TnlCfg->tnlCfg1) == ROK)
+ {
+ /* Free memory at drbIdx */
+ DU_FREE(duTnlCfg->tnlCfg1, sizeof(GtpTnlCfg));
+ DU_FREE(duTnlCfg, sizeof(UpTnlCfg));
+ duCb.numDrb--;
+ for(delIdx = ueCbIdx; delIdx < duCb.numDrb; delIdx++)
+ {
+ /* moving all elements one index ahead */
+ ret = fillTnlCfgToAddMod(&duCb.upTnlCfg[delIdx], duCb.upTnlCfg[delIdx+1]);
+ if(ret != ROK)
+ {
+ return ret;
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+/***********************************************************************
+ *
+ * @brief Function to fill Tunnel Config
+ * and sends tunnel Req to EGTP
+ *
+ *
+ * @details
+ *
+ * Function : duUpdateTunnelCfgDb
+ *
+ * Functionality: Function to fill tunnel Config
+ * and sends tunnel Cfg Req to EGTP
+ *
+ * @params[in] ueIdx, cellId, DuUeCfg
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duUpdateTunnelCfgDb(uint8_t ueIdx, uint8_t cellId, DuUeCfg *duUeCfg)
+{
+ uint8_t ret = ROK, drbIdx, duCbDrbIdx;
+ bool drbFound = false;
+
+ /*If Add/Mod tunnels request for that DRB is successful in EGTP */
+ /*then update drbId and tunnel Info in duCb */
+ for(drbIdx=0; drbIdx < duUeCfg->numDrb; drbIdx++)
+ {
+ duUeCfg->upTnlInfo[drbIdx].cellId = cellId;
+ duUeCfg->upTnlInfo[drbIdx].ueIdx = ueIdx;
+ for(duCbDrbIdx = 0; duCbDrbIdx < duCb.numDrb; duCbDrbIdx++)
+ {
+ if(duCb.upTnlCfg[duCbDrbIdx]->drbId == duUeCfg->upTnlInfo[drbIdx].drbId)
+ {
+ drbFound = true; /* existing DRB */
+ if(duProcEgtpTunnelCfg(duCbDrbIdx, duCb.upTnlCfg[duCbDrbIdx], &duUeCfg->upTnlInfo[drbIdx]) != ROK)
+ {
+ DU_LOG("\nERROR -> DU_APP : duUpdateTunnelCfgDb: Failed to modify tunnel req for Drb id[%d]",
+ duUeCfg->upTnlInfo[drbIdx].drbId);
+ ret = RFAILED;
+ }
+ break;
+ }
+ else
+ drbFound = false;
+ }
+ if(!drbFound && ret == ROK)/* new DRB to Add */
+ {
+ if(duProcEgtpTunnelCfg(NULLP, NULLP, &duUeCfg->upTnlInfo[drbIdx]) != ROK)
+ {
+ DU_LOG("\nERROR -> DU_APP : duUpdateTunnelCfgDb: Failed to add tunnel req for Drb id[%d]",
+ duUeCfg->upTnlInfo[drbIdx].drbId);
+ ret = RFAILED;
+ break;
+ }
+ }
+ else
+ break;
+ }
+ return ret;
+}
+
/*******************************************************************
*
* @brief @brief To update DuUeCb Mac and Rlc Ue Cfg
ret = duUpdateMacCfg(&ueCb->macUeCfg, ueCb->f1UeDb);
if(ret == RFAILED)
DU_LOG("\nERROR --> DU APP : Failed while updating MAC LC Config at duUpdateDuUeCbCfg()");
+ else
+ {
+ if(duUpdateTunnelCfgDb(ueIdx, cellId, &ueCb->f1UeDb->duUeCfg) != ROK)
+ {
+ DU_LOG("\nERROR --> DU_APP : Failed to establish tunnel in duUpdateDuUeCbCfg()");
+ return RFAILED;
+ }
+ }
}
else
DU_LOG("\nERROR --> DU APP : Failed while updating RLC LC Config at duUpdateDuUeCbCfg()");
/* free a static buffer */
#define DU_FREE(_datPtr, _size) \
- if(_datPtr) \
+{ \
+ if(_datPtr != NULLP) \
+ { \
SPutSBuf(DU_APP_MEM_REGION, DU_POOL, \
- (Data *)_datPtr, _size);
-
+ (Data *)_datPtr, _size); \
+ _datPtr = NULLP; \
+ } \
+}
/* Allocate shared memory to be used for LWLC
* during inter-layer communication */
#define DU_ALLOC_SHRABL_BUF(_buf, _size) \