* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildULTnlInfo(TnlInfo *ulUpTnlInfo, ULUPTNLInformation_ToBeSetup_List_t *ulInfo, bool hoInProgress)
+uint8_t BuildULTnlInfo(uint8_t duId, TnlInfo *ulUpTnlInfo, ULUPTNLInformation_ToBeSetup_List_t *ulInfo, bool hoInProgress)
{
uint8_t idx;
uint8_t ulCnt;
ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->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] = cuCb.cuCfgParams.egtpParams.currTunnelId++;
+ ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf[3] = cuCb.cuCfgParams.egtpParams.egtpAssoc[duId-1].currTunnelId++;
ulUpTnlInfo->teId[0] = ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf[0];
ulUpTnlInfo->teId[1] = ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf[1];
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildDRBSetup(CuUeCb *ueCb, DRBs_ToBeSetup_List_t *drbSet)
+uint8_t BuildDRBSetup(uint32_t duId, CuUeCb *ueCb, DRBs_ToBeSetup_List_t *drbSet)
{
uint8_t idx = 0, extIeIdx = 0;
uint8_t elementCnt = 0, drbCnt = 0;
/*ULUPTNLInformation To Be Setup List*/
if(ueCb->state != UE_HANDOVER_IN_PROGRESS)
- BuildULTnlInforet = BuildULTnlInfo(&ueCb->drbList[ueCb->numDrb].ulUpTnlInfo, &drbSetItem->uLUPTNLInformation_ToBeSetup_List,\
+ BuildULTnlInforet = BuildULTnlInfo(duId, &ueCb->drbList[ueCb->numDrb].ulUpTnlInfo, &drbSetItem->uLUPTNLInformation_ToBeSetup_List,\
FALSE);
else
- BuildULTnlInforet = BuildULTnlInfo(&ueCb->drbList[idx].ulUpTnlInfo, &drbSetItem->uLUPTNLInformation_ToBeSetup_List,\
+ BuildULTnlInforet = BuildULTnlInfo(duId, &ueCb->drbList[idx].ulUpTnlInfo, &drbSetItem->uLUPTNLInformation_ToBeSetup_List,\
TRUE);
if(BuildULTnlInforet != ROK)
{
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(ueCb, &ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
+ ret1 = BuildDRBSetup(duId, ueCb, &ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
if(ret1 != ROK)
{
break;
* RFAILED - failure
*
* ****************************************************************/
-uint8_t addDrbTunnels(uint8_t teId)
+uint8_t addDrbTunnels(uint32_t duId, uint8_t teId)
{
uint8_t ret = ROK;
EgtpTnlEvt tnlEvt;
tnlEvt.action = EGTP_TNL_MGMT_ADD;
tnlEvt.lclTeid = teId;
tnlEvt.remTeid = teId;
- ret = cuEgtpTnlMgmtReq(tnlEvt);
+ ret = cuEgtpTnlMgmtReq(duId, tnlEvt);
if(ret != ROK)
{
DU_LOG("\nERROR --> EGTP : Tunnel management request failed for teId %x", teId);
* RFAILED - failure
*
* ****************************************************************/
-uint8_t procDrbSetupList(DRBs_Setup_List_t *drbSetupList)
+uint8_t procDrbSetupList(uint32_t duId, DRBs_Setup_List_t *drbSetupList)
{
uint8_t arrIdx = 0;
uint32_t teId = 0;
teId = extractTeId(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List);
if(teId > 0)
{
- if(addDrbTunnels(teId)== ROK)
+ if(addDrbTunnels(duId, teId)== ROK)
{
DU_LOG("\nDEBUG --> EGTP: Tunnel Added for TeId %d", teId);
}
case ProtocolIE_ID_id_DRBs_Setup_List:
{
/* Adding Tunnels for successful DRB */
- procDrbSetupList(&ueCtxtSetupRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List);
+ procDrbSetupList(duId, &ueCtxtSetupRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List);
break;
}
case ProtocolIE_ID_id_DUtoCURRCInformation:
* RFAILED - failure
*
* ****************************************************************/
-uint8_t deleteEgtpTunnel(uint8_t *buf)
+uint8_t deleteEgtpTunnel(uint32_t duId, uint8_t *buf)
{
uint32_t teId = 0;
EgtpTnlEvt tnlEvt;
tnlEvt.action = EGTP_TNL_MGMT_DEL;
tnlEvt.lclTeid = teId;
tnlEvt.remTeid = teId;
- if((cuEgtpTnlMgmtReq(tnlEvt)) != ROK)
+ if((cuEgtpTnlMgmtReq(duId, tnlEvt)) != ROK)
{
DU_LOG("\nERROR --> EGTP : Failed to delete tunnel Id %d", teId);
}
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildUlTnlInfoforSetupMod(uint8_t ueId, uint8_t drbId, TnlInfo *ulTnlInfo, ULUPTNLInformation_ToBeSetup_List_t *ulInfo, uint8_t actionType)
+uint8_t BuildUlTnlInfoforSetupMod(uint32_t duId, uint8_t ueId, uint8_t drbId, TnlInfo *ulTnlInfo, ULUPTNLInformation_ToBeSetup_List_t *ulInfo, uint8_t actionType)
{
uint8_t arrIdx;
uint8_t ulCnt;
else
{
ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[3] = cuCb.cuCfgParams.egtpParams.currTunnelId++;
+ gTP_TEID.buf[3] = cuCb.cuCfgParams.egtpParams.egtpAssoc[duId-1].currTunnelId++;
}
ulTnlInfo->teId[0] = ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf[0];
*
* ****************************************************************/
-uint8_t FillDrbItemToSetupMod(CuUeCb *ueCb, uint8_t arrIdx, DRBs_ToBeSetupMod_Item_t *drbItem)
+uint8_t FillDrbItemToSetupMod(uint32_t duId, CuUeCb *ueCb, uint8_t arrIdx, DRBs_ToBeSetupMod_Item_t *drbItem)
{
uint8_t ret = ROK;
}
/*ULUPTNLInformation To Be Setup List*/
- ret = BuildUlTnlInfoforSetupMod(ueCb->gnbCuUeF1apId, drbItem->dRBID, &ueCb->drbList[ueCb->numDrb].ulUpTnlInfo, \
+ ret = BuildUlTnlInfoforSetupMod(duId, ueCb->gnbCuUeF1apId, drbItem->dRBID, &ueCb->drbList[ueCb->numDrb].ulUpTnlInfo, \
&drbItem->uLUPTNLInformation_ToBeSetup_List, ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item);
if(ret != ROK)
{
*
* ****************************************************************/
-uint8_t FillDrbItemList(CuUeCb *ueCb, uint8_t arrIdx, struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe)
+uint8_t FillDrbItemList(uint32_t duId, CuUeCb *ueCb, uint8_t arrIdx, struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe)
{
drbItemIe->id = ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item;
drbItemIe->criticality = Criticality_reject;
drbItemIe->value.present = DRBs_ToBeSetupMod_ItemIEs__value_PR_DRBs_ToBeSetupMod_Item;
- if(FillDrbItemToSetupMod(ueCb, arrIdx, (&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item))) != ROK)
+ if(FillDrbItemToSetupMod(duId, ueCb, arrIdx, (&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item))) != ROK)
{
DU_LOG("\nERROR --> F1AP : FillDrbItemToSetupMod failed");
return RFAILED;
*
* ****************************************************************/
-uint8_t BuildDrbToBeSetupList(CuUeCb *ueCb, DRBs_ToBeSetupMod_List_t *drbSet)
+uint8_t BuildDrbToBeSetupList(uint32_t duId, CuUeCb *ueCb, DRBs_ToBeSetupMod_List_t *drbSet)
{
uint8_t ret = ROK;
uint8_t arrIdx =0;
return RFAILED;
}
- ret = FillDrbItemList(ueCb, arrIdx, (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx]);
+ ret = FillDrbItemList(duId, ueCb, arrIdx, (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx]);
if(ret != ROK)
{
DU_LOG("\nERROR --> F1AP : FillDrbItemList failed");
*
* ****************************************************************/
-uint8_t FillDrbToBeModItem(CuUeCb *ueCb, uint8_t arrIdx, DRBs_ToBeModified_Item_t *drbItem)
+uint8_t FillDrbToBeModItem(uint32_t duId, CuUeCb *ueCb, uint8_t arrIdx, DRBs_ToBeModified_Item_t *drbItem)
{
uint8_t ret = ROK;
uint drbIdx=0;
}/* End of QoS */
/*ULUPTNLInformation To Be Setup List*/
- ret = BuildUlTnlInfoforSetupMod(ueCb->gnbCuUeF1apId, drbItem->dRBID, &drbToBeMod->ulUpTnlInfo, &drbItem->uLUPTNLInformation_ToBeSetup_List,\
+ ret = BuildUlTnlInfoforSetupMod(duId, ueCb->gnbCuUeF1apId, drbItem->dRBID, &drbToBeMod->ulUpTnlInfo, &drbItem->uLUPTNLInformation_ToBeSetup_List,\
ProtocolIE_ID_id_DRBs_ToBeModified_Item);
if(ret != ROK)
{
*
* ****************************************************************/
-uint8_t FillDrbToBeModItemList(CuUeCb *ueCb, uint8_t arrIdx, struct DRBs_ToBeModified_ItemIEs *drbItemIe)
+uint8_t FillDrbToBeModItemList(uint32_t duId, CuUeCb *ueCb, uint8_t arrIdx, struct DRBs_ToBeModified_ItemIEs *drbItemIe)
{
drbItemIe->id = ProtocolIE_ID_id_DRBs_ToBeModified_Item;
drbItemIe->criticality = Criticality_reject;
drbItemIe->value.present = DRBs_ToBeModified_ItemIEs__value_PR_DRBs_ToBeModified_Item;
- if(FillDrbToBeModItem(ueCb, arrIdx, &(drbItemIe->value.choice.DRBs_ToBeModified_Item)) != ROK)
+ if(FillDrbToBeModItem(duId, ueCb, arrIdx, &(drbItemIe->value.choice.DRBs_ToBeModified_Item)) != ROK)
{
DU_LOG("\nERROR --> F1AP : FillDrbToBeModItem failed");
return RFAILED;
*
* ****************************************************************/
-uint8_t BuildDrbToBeModifiedList(CuUeCb *ueCb, DRBs_ToBeModified_List_t *drbSet)
+uint8_t BuildDrbToBeModifiedList(uint32_t duId, CuUeCb *ueCb, DRBs_ToBeModified_List_t *drbSet)
{
uint8_t ret = ROK;
uint8_t arrIdx =0;
return RFAILED;
}
- ret = FillDrbToBeModItemList(ueCb, arrIdx, (DRBs_ToBeModified_ItemIEs_t *)drbSet->list.array[arrIdx]);
+ ret = FillDrbToBeModItemList(duId, ueCb, arrIdx, (DRBs_ToBeModified_ItemIEs_t *)drbSet->list.array[arrIdx]);
if(ret != ROK)
{
DU_LOG("\nERROR --> F1AP : FillDrbToBeModItemList failed");
ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present =\
UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List;
- ret = BuildDrbToBeSetupList(ueCb, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+ ret = BuildDrbToBeSetupList(duId, ueCb, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
value.choice.DRBs_ToBeSetupMod_List));
/* DRB to be modified list */
ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present =\
UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List;
- ret = BuildDrbToBeModifiedList(ueCb, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+ ret = BuildDrbToBeModifiedList(duId, ueCb, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
value.choice.DRBs_ToBeModified_List));
/* TODO: DRB to be release list */
* RFAILED - failure
*
* ****************************************************************/
-uint8_t procDrbSetupModList(CuUeCb *ueCb, DRBs_SetupMod_List_t *drbSetupList)
+uint8_t procDrbSetupModList(uint32_t duId, CuUeCb *ueCb, DRBs_SetupMod_List_t *drbSetupList)
{
uint8_t arrIdx = 0, drbIdx;
uint32_t teId = 0;
teId = extractTeId(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List);
if(teId > 0)
{
- if(addDrbTunnels(teId)== ROK)
+ if(addDrbTunnels(duId, teId)== ROK)
{
DU_LOG("\nDEBUG --> EGTP: Tunnel Added for TeId %d", teId);
}
case ProtocolIE_ID_id_DRBs_SetupMod_List:
{
/* Adding Tunnels for successful DRB */
- procDrbSetupModList(ueCb, &ueCtxtModRsp->protocolIEs.list.array[idx]->value.choice.DRBs_SetupMod_List);
+ procDrbSetupModList(duId, ueCb, &ueCtxtModRsp->protocolIEs.list.array[idx]->value.choice.DRBs_SetupMod_List);
break;
}
void readCuCfg()
{
- uint8_t *numDu;
+ uint8_t numDu;
uint32_t ipv4_du, ipv4_cu;
DU_LOG("\nDEBUG --> CU_STUB : Reading CU configurations");
cuCb.cuCfgParams.sctpParams.numDu = 1;
#else
cuCb.cuCfgParams.sctpParams.numDu = 0;
- numDu = &cuCb.cuCfgParams.sctpParams.numDu;
- while(*numDu < MAX_DU_SUPPORTED)
+ cuCb.cuCfgParams.egtpParams.numDu = 0;
+ numDu = 0;
+ while(numDu < MAX_DU_SUPPORTED)
{
/* DU IP Address and Port*/
memset(&ipv4_du, 0, sizeof(uint32_t));
- cmInetAddr((S8*)DU_IP_V4_ADDR[*numDu], &ipv4_du);
- cuCb.cuCfgParams.sctpParams.sctpAssoc[*numDu].duIpAddr.ipV4Addr = ipv4_du;
- cuCb.cuCfgParams.sctpParams.sctpAssoc[*numDu].duIpAddr.ipV6Pres = false;
- cuCb.cuCfgParams.sctpParams.sctpAssoc[*numDu].duPort = DU_SCTP_PORT[*numDu];
+ cmInetAddr((S8*)DU_IP_V4_ADDR[numDu], &ipv4_du);
+ cuCb.cuCfgParams.sctpParams.sctpAssoc[numDu].duIpAddr.ipV4Addr = ipv4_du;
+ cuCb.cuCfgParams.sctpParams.sctpAssoc[numDu].duIpAddr.ipV6Pres = false;
+ cuCb.cuCfgParams.sctpParams.sctpAssoc[numDu].duPort = DU_SCTP_PORT[numDu];
/* CU IP Address and Port*/
memset(&ipv4_du, 0, sizeof(uint32_t));
cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
- cuCb.cuCfgParams.sctpParams.sctpAssoc[*numDu].cuIpAddr.ipV4Addr = ipv4_cu;
- cuCb.cuCfgParams.sctpParams.sctpAssoc[*numDu].cuIpAddr.ipV6Pres = false;
- cuCb.cuCfgParams.sctpParams.sctpAssoc[*numDu].cuPort = CU_SCTP_PORT_TO_DU[*numDu];
- (*numDu)++;
+ cuCb.cuCfgParams.sctpParams.sctpAssoc[numDu].cuIpAddr.ipV4Addr = ipv4_cu;
+ cuCb.cuCfgParams.sctpParams.sctpAssoc[numDu].cuIpAddr.ipV6Pres = false;
+ cuCb.cuCfgParams.sctpParams.sctpAssoc[numDu].cuPort = CU_SCTP_PORT_TO_DU[numDu];
+
+ /* EGTP Parameters */
+ memset(&ipv4_du, 0, sizeof(uint32_t));
+ cmInetAddr((S8*)DU_IP_V4_ADDR[numDu], &ipv4_du);
+ cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].localIp.ipV4Pres = TRUE;
+ cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].localIp.ipV4Addr = ipv4_cu;
+ cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].localPort = CU_EGTP_PORT[numDu];
+ cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].destIp.ipV4Pres = TRUE;
+ cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].destIp.ipV4Addr = ipv4_du;
+ cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].destPort = DU_EGTP_PORT[numDu];
+ cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].minTunnelId = MIN_TEID;
+ cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].currTunnelId = cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].minTunnelId;
+ cuCb.cuCfgParams.egtpParams.egtpAssoc[numDu].maxTunnelId = MAX_TEID;
+
+ (numDu)++;
}
+ cuCb.cuCfgParams.egtpParams.numDu = numDu;
+ cuCb.cuCfgParams.sctpParams.numDu = numDu;
#endif
/*PLMN*/
cuCb.cuCfgParams.rrcVersion.extRrcVer = EXT_RRC_VER;
- /* EGTP Parameters */
- cuCb.cuCfgParams.egtpParams.localIp.ipV4Pres = TRUE;
- cuCb.cuCfgParams.egtpParams.localIp.ipV4Addr = ipv4_cu;
- cuCb.cuCfgParams.egtpParams.localPort = CU_EGTP_PORT;
- cuCb.cuCfgParams.egtpParams.destIp.ipV4Pres = TRUE;
- cuCb.cuCfgParams.egtpParams.destIp.ipV4Addr = ipv4_du;
- cuCb.cuCfgParams.egtpParams.destPort = DU_EGTP_PORT;
- cuCb.cuCfgParams.egtpParams.minTunnelId = MIN_TEID;
- cuCb.cuCfgParams.egtpParams.currTunnelId = cuCb.cuCfgParams.egtpParams.minTunnelId;
- cuCb.cuCfgParams.egtpParams.maxTunnelId = MAX_TEID;
} /* End of readCuCfg */
* NUM_TUNNEL_TO_PUMP_DATA = 9, NUM_DL_PACKETS = 1.
* totalDataPacket = totalNumOfTestFlow * NUM_TUNNEL_TO_PUMP_DATA * NUM_DL_PACKETS
* totalDataPacket = [500*9*1] */
- int32_t totalNumOfTestFlow = 500;
+ int32_t totalNumOfTestFlow = 5;
while(true)
{
#define CU_SCTP_PORT_TO_DU (int[]){38472, 38473}
#endif
-#define DU_EGTP_PORT 39001
-#define CU_EGTP_PORT 39002
+#define DU_EGTP_PORT (int[]){39001, 39002}
+#define CU_EGTP_PORT (int[]){39003, 39004}
#define RRC_VER 0
#define EXT_RRC_VER 5
#define PLMN_MCC0 3
char cuName[CU_DU_NAME_LEN_MAX];
CuSctpParams sctpParams;
Plmn plmn;
- EgtpParams egtpParams;
+ CuEgtpParams egtpParams;
RrcVersion rrcVersion;
}CuCfgParams;
uint8_t egtpInitReq()
{
uint8_t ret = ROK;
-
+
+ egtpCb.egtpCfg = cuCb.cuCfgParams.egtpParams;
ret = cuEgtpCfgReq();
if(ret != ROK)
{
* ***********************************************************************/
S16 cuEgtpCfgReq()
{
- uint8_t ret;
-
- memcpy(&egtpCb.egtpCfg, &cuCb.cuCfgParams.egtpParams, sizeof(EgtpParams));
-
- egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.localIp.ipV4Addr);
- egtpCb.recvTptSrvr.addr.port = EGTP_DFLT_PORT;
+ uint8_t ret, destIdx =0;
+
+ memcpy(&egtpCb.egtpCfg, &cuCb.cuCfgParams.egtpParams, sizeof(CuEgtpParams));
+
+ for(destIdx=0; destIdx < egtpCb.egtpCfg.numDu; destIdx++)
+ {
+ egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.egtpAssoc[destIdx].localIp.ipV4Addr);
+ egtpCb.recvTptSrvr.addr.port = EGTP_RECVR_PORT;
- egtpCb.dstCb.dstIp = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.destIp.ipV4Addr);
- egtpCb.dstCb.dstPort = egtpCb.egtpCfg.destPort;
- egtpCb.dstCb.sendTptSrvr.addr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.localIp.ipV4Addr);
- egtpCb.dstCb.sendTptSrvr.addr.port = egtpCb.egtpCfg.localPort;
- egtpCb.dstCb.numTunn = 0;
+ egtpCb.dstCb[destIdx].duId = destIdx+1;
+ egtpCb.dstCb[destIdx].dstIp = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.egtpAssoc[destIdx].destIp.ipV4Addr);
+ egtpCb.dstCb[destIdx].dstPort = egtpCb.egtpCfg.egtpAssoc[destIdx].destPort;
+ egtpCb.dstCb[destIdx].sendTptSrvr.addr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.egtpAssoc[destIdx].localIp.ipV4Addr);
+ egtpCb.dstCb[destIdx].sendTptSrvr.addr.port = egtpCb.egtpCfg.egtpAssoc[destIdx].localPort;
+ egtpCb.dstCb[destIdx].numTunn = 0;
- ret = cmHashListInit(&(egtpCb.dstCb.teIdLst), 1024, sizeof(EgtpTeIdCb), FALSE, CM_HASH_KEYTYPE_UINT32_MOD, CU_APP_MEM_REG, CU_POOL);
+ ret = cmHashListInit(&(egtpCb.dstCb[destIdx].teIdLst), 1024, sizeof(EgtpTeIdCb), FALSE, CM_HASH_KEYTYPE_UINT32_MOD, CU_APP_MEM_REG, CU_POOL);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> EGTP : TeId hash list initialization failed");
- return RFAILED;
- }
- else
- {
- DU_LOG("\nINFO --> EGTP : Configuration successful");
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> EGTP : TeId hash list initialization failed");
+ return RFAILED;
+ }
+ else
+ {
+ DU_LOG("\nINFO --> EGTP : Configuration successful");
+ }
}
+ egtpCb.numDu = egtpCb.egtpCfg.numDu;
return ROK;
} /* cuEgtpCfgReq */
S16 cuEgtpSrvOpenReq(Pst *pst)
{
- uint8_t ret;
+ uint8_t ret, destIdx;
DU_LOG("\nINFO --> EGTP : Received open server request");
-
+
sockType = CM_INET_DGRAM;
if((ret = (cmInetSocket(sockType, &(egtpCb.recvTptSrvr.sockFd), protType))) != ROK)
{
DU_LOG("\nERROR --> EGTP : Failed to bind socket");
return RFAILED;
}
+
+ for(destIdx=0; destIdx < egtpCb.egtpCfg.numDu; destIdx++)
+ {
+ if(ret = (cmInetSocket(sockType, &(egtpCb.dstCb[destIdx].sendTptSrvr.sockFd), protType)) != ROK)
+ {
+ DU_LOG("\nERROR --> EGTP : Failed to open UDP socket");
+ return RFAILED;
+ }
- if(ret = (cmInetSocket(sockType, &(egtpCb.dstCb.sendTptSrvr.sockFd), protType)) != ROK)
- {
- DU_LOG("\nERROR --> EGTP : Failed to open UDP socket");
- return RFAILED;
- }
-
- ret = cmInetBind(&(egtpCb.dstCb.sendTptSrvr.sockFd), &(egtpCb.dstCb.sendTptSrvr.addr));
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> EGTP : Failed to bind socket");
- return RFAILED;
- }
-
- /* TODO: set socket options */
+ ret = cmInetBind(&(egtpCb.dstCb[destIdx].sendTptSrvr.sockFd), &(egtpCb.dstCb[destIdx].sendTptSrvr.addr));
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> EGTP : Failed to bind socket");
+ return RFAILED;
+ }
- DU_LOG("\nINFO --> EGTP : Receiver socket[%d] and Sender socket[%d] open", egtpCb.recvTptSrvr.sockFd.fd,\
- egtpCb.dstCb.sendTptSrvr.sockFd.fd);
+ /* TODO: set socket options */
+
+ DU_LOG("\nINFO --> EGTP : Receiver socket[%d] and Sender socket[%d] open", egtpCb.recvTptSrvr.sockFd.fd,\
+ egtpCb.dstCb[destIdx].sendTptSrvr.sockFd.fd);
+ }
return ROK;
} /* cuEgtpSrvOpenReq */
*
* ***************************************************************************/
-S16 cuEgtpTnlMgmtReq(EgtpTnlEvt tnlEvt)
+S16 cuEgtpTnlMgmtReq(uint32_t duId, EgtpTnlEvt tnlEvt)
{
S8 ret;
{
case EGTP_TNL_MGMT_ADD:
{
- ret = cuEgtpTnlAdd(tnlEvt);
+ ret = cuEgtpTnlAdd(duId, tnlEvt);
break;
}
case EGTP_TNL_MGMT_MOD:
{
- ret = cuEgtpTnlMod(tnlEvt);
+ ret = cuEgtpTnlMod(duId, tnlEvt);
break;
}
case EGTP_TNL_MGMT_DEL:
{
- ret = cuEgtpTnlDel(tnlEvt);
+ ret = cuEgtpTnlDel(duId, tnlEvt);
break;
}
default:
* RFAILED - failure
*
* ***************************************************************************/
-S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt)
+S16 cuEgtpTnlAdd(uint32_t duId, EgtpTnlEvt tnlEvt)
{
S16 ret;
EgtpTeIdCb *teidCb;
teidCb->teId = tnlEvt.lclTeid;
teidCb->remTeId = tnlEvt.remTeid;
- ret = cmHashListInsert(&(egtpCb.dstCb.teIdLst), (PTR)teidCb, (uint8_t *)&(teidCb->teId), sizeof(uint32_t));
+ ret = cmHashListInsert(&(egtpCb.dstCb[duId-1].teIdLst), (PTR)teidCb, (uint8_t *)&(teidCb->teId), sizeof(uint32_t));
if(ret != ROK)
{
DU_LOG("\nERROR --> EGTP : Failed to insert in hash list");
CU_FREE(teidCb, (Size)sizeof(EgtpTeIdCb));
return RFAILED;
}
- egtpCb.dstCb.numTunn++;
+ egtpCb.dstCb[duId-1].numTunn++;
/* Encoding pre-defined header */
memset(&preDefHdr, 0, sizeof(EgtpMsgHdr));
* RFAILED - failure
*
* ***************************************************************************/
-S16 cuEgtpTnlMod(EgtpTnlEvt tnlEvt)
+S16 cuEgtpTnlMod(uint32_t duId, EgtpTnlEvt tnlEvt)
{
#if 0
S16 ret;
DU_LOG("\nDEBUG --> CU_STUB : 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[duId-1].teIdLst), (uint8_t *)&(tnlEvt.teId), sizeof(uint32_t), 0, (PTR *)&teidCb);
if(teidCb == NULLP)
{
DU_LOG("\nDEBUG --> CU_STUBTunnel id not found");
* RFAILED - failure
*
* ***************************************************************************/
-S16 cuEgtpTnlDel(EgtpTnlEvt tnlEvt)
+S16 cuEgtpTnlDel(uint32_t duId, EgtpTnlEvt tnlEvt)
{
EgtpTeIdCb *teidCb = NULLP;
DU_LOG("\nDEBUG --> EGTP : Tunnel deletion : Local Teid[%d] Remote Teid[%d]", tnlEvt.lclTeid, tnlEvt.remTeid);
- cmHashListFind(&(egtpCb.dstCb.teIdLst), (uint8_t *)&(tnlEvt.lclTeid), sizeof(uint32_t), 0, (PTR *)&teidCb);
+ cmHashListFind(&(egtpCb.dstCb[duId-1].teIdLst), (uint8_t *)&(tnlEvt.lclTeid), sizeof(uint32_t), 0, (PTR *)&teidCb);
if(teidCb == NULLP)
{
DU_LOG("\nERROR --> EGTP : Tunnel id[%d] not configured", tnlEvt.lclTeid);
return RFAILED;
}
- cmHashListDelete(&(egtpCb.dstCb.teIdLst), (PTR)teidCb);
+ cmHashListDelete(&(egtpCb.dstCb[duId-1].teIdLst), (PTR)teidCb);
CU_FREE(teidCb, (Size)sizeof(EgtpTeIdCb));
- egtpCb.dstCb.numTunn--;
+ egtpCb.dstCb[duId-1].numTunn--;
return ROK;
} /* cuEgtpTnlDel */
} /* egtpEncodeHdr */
+/*******************************************************************
+ *
+ * @brief This handles the any EGTP received message
+ *
+ * @details
+ *
+ * Function : cuEgtpHdlRecvMsg
+ *
+ * Functionality:
+ * This handles the any EGTP received message
+ *
+ * @params[in] Message Buffer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
S16 cuEgtpHdlRecvMsg(Buffer *mBuf)
{
/*Decoding of EGTP message header */
}
+/*******************************************************************
+ *
+ * @brief Decodes message header
+ *
+ * @details
+ *
+ * Function : cuEgtpDecodeHdr
+ *
+ * Functionality:
+ * Decodes EGTP message haeder
+ *
+ * @params[in] Message Buffer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
S16 cuEgtpDecodeHdr(Buffer *mBuf)
{
EgtpMsg egtpMsg;
} /* End of cuEgtpDecodeHdr */
+/*******************************************************************
+ *
+ * @brief This function is responsible to build application message, encode EGTP
+ * header to it and send to DU over tunnel (teId)
+ *
+ * @details
+ *
+ * Function : cuEgtpDatReq
+ *
+ * Functionality:
+ * function is responsible to build application message, encode EGTP
+ * header to it and send to DU over tunnel (teId)
+ *
+ * @params[in] uint8_t teId
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
uint16_t cuEgtpDatReq(uint8_t teId)
{
- uint8_t ret = ROK, cnt = 0;
+ uint8_t ret = ROK, cnt = 0, duId =0;
EgtpMsg egtpMsg;
egtpMsg.msgHdr.teId = teId;
DU_LOG("\nERROR --> EGTP : DRB not created");
return RFAILED ;
}
- /* Build Application message that is supposed to come from app to egtp */
- ret = BuildAppMsg(&egtpMsg);
- if(ret != ROK)
+ for(duId = 1; duId<=egtpCb.numDu; duId++)
{
- DU_LOG("\nERROR --> EGTP : Failed to build App Msg");
- return RFAILED;
- }
+ /* Build Application message that is supposed to come from app to egtp */
+ ret = BuildAppMsg(duId, &egtpMsg);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> EGTP : Failed to build App Msg");
+ return RFAILED;
+ }
- /* Encode EGTP header to build final EGTP message */
- ret = BuildEgtpMsg(&egtpMsg);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> EGTP : Failed to build EGTP Msg");
- return RFAILED;
+ /* Encode EGTP header to build final EGTP message */
+ ret = BuildEgtpMsg(duId, &egtpMsg);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> EGTP : Failed to build EGTP Msg");
+ return RFAILED;
+ }
+ cuEgtpSendMsg(duId, egtpMsg.msg);
+ ODU_PUT_MSG_BUF(egtpMsg.msg);
}
- cuEgtpSendMsg(egtpMsg.msg);
- ODU_PUT_MSG_BUF(egtpMsg.msg);
-
return ROK;
}
-S16 BuildAppMsg(EgtpMsg *egtpMsg)
+/*******************************************************************
+ *
+ * @brief Builds application message to be sent to DU in DL path
+ *
+ * @details
+ *
+ * Function : BuildAppMsg
+ *
+ * Functionality:
+ * Builds application message to be sent to DU in DL path
+ *
+ * @params[in] uint32_t duId,EGTP message
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+S16 BuildAppMsg(uint32_t duId, EgtpMsg *egtpMsg)
{
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 "
ipv4Hdr.length = CM_IPV4_HDRLEN + mLen;
ipv4Hdr.hdrVer = 0x45;
ipv4Hdr.proto = 1;
- ipv4Hdr.srcAddr = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.localIp.ipV4Addr);
- ipv4Hdr.destAddr = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.destIp.ipV4Addr);
+ ipv4Hdr.srcAddr = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.egtpAssoc[duId-1].localIp.ipV4Addr);
+ ipv4Hdr.destAddr = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.egtpAssoc[duId-1].destIp.ipV4Addr);
/* Packing IPv4 header into buffer */
S16 ret, cnt, idx;
return ret;
}
-S16 BuildEgtpMsg(EgtpMsg *egtpMsg)
+/*******************************************************************
+ *
+ * @brief Encodes EGTP header to application message to send to DU
+ *
+ * @details
+ *
+ * Function : BuildEgtpMsg
+ *
+ * Functionality:
+ * Encodes EGTP header to application message to send to DU
+ *
+ * @params[in] uint32_t duId,EGTP message
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+S16 BuildEgtpMsg(uint32_t duId, EgtpMsg *egtpMsg)
{
EgtpTeIdCb *teidCb = NULLP;
MsgLen tPduSize;
uint32_t msgLen;
EgtpMsgHdr *msgHdr;
- cmHashListFind(&(egtpCb.dstCb.teIdLst), (uint8_t *)&(egtpMsg->msgHdr.teId), sizeof(uint32_t), 0, (PTR *)&teidCb);
+ cmHashListFind(&(egtpCb.dstCb[duId-1].teIdLst), (uint8_t *)&(egtpMsg->msgHdr.teId), sizeof(uint32_t), 0, (PTR *)&teidCb);
if(teidCb == NULLP)
{
DU_LOG("\nERROR --> EGTP : Tunnel id[%d] not configured", egtpMsg->msgHdr.teId);
return ROK;
}
-S16 cuEgtpSendMsg(Buffer *mBuf)
+/*******************************************************************
+ *
+ * @brief Send the egtp message to the destination DU
+ *
+ * @details
+ *
+ * Function : cuEgtpSendMsg
+ *
+ * Functionality:
+ * Send the egtp message to the destination DU
+ *
+ * @params[in] uint32_t duId
+ * Message Buffer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+S16 cuEgtpSendMsg(uint32_t duId, Buffer *mBuf)
{
S16 ret;
MsgLen txLen;
info.region = CU_APP_MEM_REG;
info.pool = CU_POOL;
- dstAddr.port = EGTP_DFLT_PORT;
- dstAddr.address = egtpCb.dstCb.dstIp;
+ dstAddr.port = EGTP_RECVR_PORT;
+ dstAddr.address = egtpCb.dstCb[duId-1].dstIp;
- ret = cmInetSendMsg(&(egtpCb.dstCb.sendTptSrvr.sockFd), &dstAddr, &info, mBuf, &txLen, CM_INET_NO_FLAG);
+ ret = cmInetSendMsg(&(egtpCb.dstCb[duId-1].sendTptSrvr.sockFd), &dstAddr, &info, mBuf, &txLen, CM_INET_NO_FLAG);
if(ret != ROK && ret != RWOULDBLOCK)
{
DU_LOG("\nERROR --> EGTP : Message send failure");
#ifndef __CU_STUB_EGTP_H__
#define __CU_STUB_EGTP_H__
-#define EGTP_DFLT_PORT 2152
+#define EGTP_RECVR_PORT 2152 /* As per the spec 29.281, the registered port number for GTP-U is 2152 */
#define EGTP_TNL_MGMT_ADD 1
#define EGTP_TNL_MGMT_MOD 2
#define EGTP_TNL_MGMT_DEL 3
typedef struct egtpDstCb
{
+ uint32_t duId;
CmInetIpAddr dstIp; /* destination IP */
uint16_t dstPort; /* Remote port that sends data */
EgtpTptSrvr sendTptSrvr; /* Transport server for sending UDP msg to */
CmHashListCp teIdLst; /* Tunnel Id list for this destination */
}EgtpDstCb;
-typedef struct egtpParams
+typedef struct egtpAssoc
{
SctpIpAddr localIp;
uint16_t localPort;
uint32_t currTunnelId;
uint32_t minTunnelId;
uint32_t maxTunnelId;
-}EgtpParams;
+}EgtpAssoc;
+
+typedef struct cuEgtpParams
+{
+ uint8_t numDu;
+ EgtpAssoc egtpAssoc[MAX_DU_SUPPORTED];
+}CuEgtpParams;
typedef struct egtpGlobalCb
{
- EgtpParams egtpCfg; /* EGTP configuration */
+ CuEgtpParams egtpCfg; /* EGTP configuration */
EgtpTptSrvr recvTptSrvr; /* Transport server for receiving UDP msg */
- EgtpDstCb dstCb; /* Destination endpoint */
+ uint8_t numDu;
+ EgtpDstCb dstCb[MAX_DU_SUPPORTED]; /* Destination endpoint */
uint8_t gCntPdu[MAX_TEID+1]; /* Maintaining PDU count for each bearer */
}EgtpGlobalCb;
EgtpGlobalCb egtpCb; /* EGTP global control block */
S16 egtpActvInit();
S16 cuEgtpCfgReq();
S16 cuEgtpSrvOpenReq();
-S16 cuEgtpTnlMgmtReq(EgtpTnlEvt tnlEvt);
-S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt);
-S16 cuEgtpTnlMod(EgtpTnlEvt tnlEvt);
-S16 cuEgtpTnlDel(EgtpTnlEvt tnlEvt);
+S16 cuEgtpTnlMgmtReq(uint32_t duId,EgtpTnlEvt tnlEvt);
+S16 cuEgtpTnlAdd(uint32_t duId, EgtpTnlEvt tnlEvt);
+S16 cuEgtpTnlMod(uint32_t duId,EgtpTnlEvt tnlEvt);
+S16 cuEgtpTnlDel(uint32_t duId,EgtpTnlEvt tnlEvt);
S16 cuEgtpEncodeHdr(uint8_t *preEncodedHdr, EgtpMsgHdr *preDefHdr, uint8_t *hdrIdx);
S16 cuEgtpHdlRecvMsg(Buffer *mBuf);
uint16_t cuEgtpDatReq(uint8_t teId);
-S16 BuildAppMsg(EgtpMsg *egtpMsg);
-S16 BuildEgtpMsg(EgtpMsg *egtpMsg);
-S16 cuEgtpSendMsg(Buffer *mBuf);
+S16 BuildAppMsg(uint32_t duId, EgtpMsg *egtpMsg);
+S16 BuildEgtpMsg(uint32_t duId, EgtpMsg *egtpMsg);
+S16 cuEgtpSendMsg(uint32_t duId, Buffer *mBuf);
S16 cuEgtpDecodeHdr(Buffer *mBuf);
#endif
memset(&f1PollParams, 0, sizeof(sctpSockPollParams));
- egtpFromAddr.port = egtpCb.dstCb.dstPort;
- egtpFromAddr.address = egtpCb.dstCb.dstIp;
/* All sockets are non-blocking */
timeout = 0;
}
/* Receiving EGTP data */
- egtpBufLen = -1;
- ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &egtpFromAddr, &memInfo, &egtpBuf, &egtpBufLen, CM_INET_NO_FLAG);
- if(ret == ROK && egtpBuf != NULLP)
+ for(destIdx = 0; destIdx < egtpCb.numDu; destIdx++)
{
- DU_LOG("\nINFO --> EGTP : Received UL Message [%ld]\n", numMsgRcvd+1);
- numMsgRcvd++;
- //ODU_PRINT_MSG(egtpBuf, 0 ,0);
- cuEgtpHdlRecvMsg(egtpBuf);
+
+ egtpFromAddr.port = egtpCb.dstCb[destIdx].dstPort;
+ egtpFromAddr.address = egtpCb.dstCb[destIdx].dstIp;
+ egtpBufLen = -1;
+ ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &egtpFromAddr, &memInfo, &egtpBuf, &egtpBufLen, CM_INET_NO_FLAG);
+ if(ret == ROK && egtpBuf != NULLP)
+ {
+ DU_LOG("\nINFO --> EGTP : Received UL Message [%ld] from DUid %d\n", numMsgRcvd+1, egtpCb.dstCb[destIdx].duId);
+ numMsgRcvd++;
+ //ODU_PRINT_MSG(egtpBuf, 0 ,0);
+ cuEgtpHdlRecvMsg(egtpBuf);
+ }
}
};
return (ret);
uint16_t cuPort;
}SctpAssocInfo;
-typedef struct CuSctpParams
+typedef struct cuSctpParams
{
uint8_t numDu;
SctpAssocInfo sctpAssoc[MAX_DU_SUPPORTED];
#endif
#define DU_EGTP_PORT 39001
-#define CU_EGTP_PORT 39002
+#define CU_EGTP_PORT 39003
#define NR_PCI 1
#define NR_CELL_ID 1
memcpy(&egtpCb.egtpCfg, &egtpCfg, sizeof(EgtpConfig));
egtpCb.recvTptSrvr.addr.address = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.localIp.ipV4Addr);
- egtpCb.recvTptSrvr.addr.port = EGTP_DFLT_PORT;
+ egtpCb.recvTptSrvr.addr.port = EGTP_RECVR_PORT;
egtpCb.dstCb.dstIp = CM_INET_NTOH_UINT32(egtpCb.egtpCfg.destIp.ipV4Addr);
egtpCb.dstCb.dstPort = egtpCb.egtpCfg.destPort;
info.region = DU_APP_MEM_REGION;
info.pool = DU_POOL;
- dstAddr.port = EGTP_DFLT_PORT;
+ dstAddr.port = EGTP_RECVR_PORT;
dstAddr.address = egtpCb.dstCb.dstIp;
ret = cmInetSendMsg(&(egtpCb.dstCb.sendTptSrvr.sockFd), &dstAddr, &info, \
#ifndef __DU_EGTP_H__
#define __DU_EGTP_H__
-#define EGTP_DFLT_PORT 2152
+#define EGTP_RECVR_PORT 2152 /* As per the spec 29.281, the registered port number for GTP-U is 2152 */
#define EGTP_MAX_HDR_LEN 40
#define EGTP_MAX_MSG_RECV 10
memset(&pst, 0, sizeof(Pst));
FILL_PST_PHY_STUB_TO_LWR_MAC(pst, EVT_PHY_STUB_SLOT_IND);
-
ODU_GET_MSG_BUF(pst.region, pst.pool, &mBuf);
if(!mBuf)
{