[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-434] EGTP connection towards multiple DUs... 92/7992/7
authorlal.harshita <Harshita.Lal@radisys.com>
Mon, 28 Mar 2022 09:52:01 +0000 (15:22 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Tue, 5 Apr 2022 10:02:14 +0000 (15:32 +0530)
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
Change-Id: If0891b7ce8910d38a78b2363b5a7541005f90396
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
src/cu_stub/cu_f1ap_msg_hdl.c
src/cu_stub/cu_stub.c
src/cu_stub/cu_stub.h
src/cu_stub/cu_stub_egtp.c
src/cu_stub/cu_stub_egtp.h
src/cu_stub/cu_stub_sctp.c
src/cu_stub/cu_stub_sctp.h
src/du_app/du_cfg.h
src/du_app/du_egtp.c
src/du_app/du_egtp.h
src/phy_stub/phy_stub_msg_hdl.c

index 601e18e..16530c2 100644 (file)
@@ -2549,7 +2549,7 @@ uint8_t BuildFlowsMap(DrbInfo *drbInfo, Flows_Mapped_To_DRB_List_t *flowMap , ui
  *         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;
@@ -2628,7 +2628,7 @@ uint8_t BuildULTnlInfo(TnlInfo *ulUpTnlInfo, ULUPTNLInformation_ToBeSetup_List_t
       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];
@@ -2661,7 +2661,7 @@ uint8_t BuildULTnlInfo(TnlInfo *ulUpTnlInfo, ULUPTNLInformation_ToBeSetup_List_t
  *         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;
@@ -2758,10 +2758,10 @@ uint8_t BuildDRBSetup(CuUeCb *ueCb, DRBs_ToBeSetup_List_t *drbSet)
 
       /*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)
       {
@@ -9034,7 +9034,7 @@ uint8_t BuildAndSendUeContextSetupReq(uint32_t duId, CuUeCb *ueCb, uint16_t rrcC
       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;
@@ -9181,7 +9181,7 @@ uint8_t extractTeId(DLUPTNLInformation_ToBeSetup_List_t *dlTnlInfo)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t addDrbTunnels(uint8_t teId)
+uint8_t addDrbTunnels(uint32_t duId, uint8_t teId)
 {
    uint8_t ret = ROK;
    EgtpTnlEvt tnlEvt;
@@ -9194,7 +9194,7 @@ uint8_t addDrbTunnels(uint8_t teId)
    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);
@@ -9217,7 +9217,7 @@ uint8_t addDrbTunnels(uint8_t 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;
@@ -9234,7 +9234,7 @@ uint8_t procDrbSetupList(DRBs_Setup_List_t *drbSetupList)
             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);
               }
@@ -9285,7 +9285,7 @@ uint8_t procUeContextSetupResponse(uint32_t duId, F1AP_PDU_t *f1apMsg)
           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:
@@ -9621,7 +9621,7 @@ void FreeUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
 *         RFAILED - failure
 *
 * ****************************************************************/
-uint8_t deleteEgtpTunnel(uint8_t *buf)
+uint8_t deleteEgtpTunnel(uint32_t duId, uint8_t *buf)
 {
    uint32_t teId = 0;
    EgtpTnlEvt tnlEvt;
@@ -9636,7 +9636,7 @@ uint8_t deleteEgtpTunnel(uint8_t *buf)
    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);
    }
@@ -9659,7 +9659,7 @@ uint8_t deleteEgtpTunnel(uint8_t *buf)
 *         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;
@@ -9753,7 +9753,7 @@ uint8_t BuildUlTnlInfoforSetupMod(uint8_t ueId, uint8_t drbId, TnlInfo *ulTnlInf
    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];
@@ -9864,7 +9864,7 @@ void FreeDrbItem(DRBs_ToBeSetupMod_Item_t *drbItem)
 *
 * ****************************************************************/
 
-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;
 
@@ -9944,7 +9944,7 @@ uint8_t FillDrbItemToSetupMod(CuUeCb *ueCb, uint8_t arrIdx, DRBs_ToBeSetupMod_It
    }
    
    /*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)
    {
@@ -9977,13 +9977,13 @@ uint8_t FillDrbItemToSetupMod(CuUeCb *ueCb, uint8_t arrIdx, DRBs_ToBeSetupMod_It
 *
 * ****************************************************************/
 
-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;
@@ -10047,7 +10047,7 @@ void FreeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
 *
 * ****************************************************************/
 
-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;
@@ -10072,7 +10072,7 @@ uint8_t BuildDrbToBeSetupList(CuUeCb *ueCb, DRBs_ToBeSetupMod_List_t *drbSet)
          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");
@@ -10099,7 +10099,7 @@ uint8_t BuildDrbToBeSetupList(CuUeCb *ueCb, DRBs_ToBeSetupMod_List_t *drbSet)
 *
 * ****************************************************************/
 
-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;
@@ -10195,7 +10195,7 @@ uint8_t FillDrbToBeModItem(CuUeCb *ueCb, uint8_t arrIdx, DRBs_ToBeModified_Item_
    }/* 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)
    {
@@ -10222,12 +10222,12 @@ uint8_t FillDrbToBeModItem(CuUeCb *ueCb, uint8_t arrIdx, DRBs_ToBeModified_Item_
 *
 * ****************************************************************/
 
-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;
@@ -10253,7 +10253,7 @@ uint8_t FillDrbToBeModItemList(CuUeCb *ueCb, uint8_t arrIdx, struct DRBs_ToBeMod
 *
 * ****************************************************************/
 
-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;
@@ -10277,7 +10277,7 @@ uint8_t BuildDrbToBeModifiedList(CuUeCb *ueCb, DRBs_ToBeModified_List_t *drbSet)
          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");
@@ -10581,7 +10581,7 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt
          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 */
@@ -10590,7 +10590,7 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt
          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 */
@@ -11146,7 +11146,7 @@ uint8_t procSrbSetupModList(CuUeCb *ueCb, SRBs_SetupMod_List_t *srbSetupList)
  *         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;
@@ -11175,7 +11175,7 @@ uint8_t procDrbSetupModList(CuUeCb *ueCb, DRBs_SetupMod_List_t *drbSetupList)
             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);
               }
@@ -11286,7 +11286,7 @@ uint8_t procUeContextModificationResponse(uint32_t duId, F1AP_PDU_t *f1apMsg)
           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; 
 
              }
index 31515a4..cd44bf9 100644 (file)
@@ -133,7 +133,7 @@ uint8_t tst()
 
 void readCuCfg()
 {
-   uint8_t  *numDu;
+   uint8_t  numDu;
    uint32_t ipv4_du, ipv4_cu;
 
    DU_LOG("\nDEBUG  -->  CU_STUB : Reading CU configurations");
@@ -162,25 +162,42 @@ void readCuCfg()
    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*/
@@ -196,16 +213,6 @@ void readCuCfg()
    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 */
 
@@ -276,7 +283,7 @@ void *cuConsoleHandler(void *args)
     * 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) 
    {
index 826038a..01e62ea 100644 (file)
@@ -33,8 +33,8 @@
 #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
@@ -116,7 +116,7 @@ typedef struct cuCfgParams
    char             cuName[CU_DU_NAME_LEN_MAX];
    CuSctpParams     sctpParams;
    Plmn             plmn;
-   EgtpParams       egtpParams;
+   CuEgtpParams     egtpParams;
    RrcVersion       rrcVersion;
 }CuCfgParams;
 
index 8657cb2..ba51369 100644 (file)
@@ -84,7 +84,8 @@ S16 egtpActvInit()
 uint8_t egtpInitReq()
 {
    uint8_t ret = ROK;
-
+   
+   egtpCb.egtpCfg = cuCb.cuCfgParams.egtpParams;
    ret = cuEgtpCfgReq();
    if(ret != ROK)
    {
@@ -118,30 +119,35 @@ uint8_t egtpInitReq()
  * ***********************************************************************/
 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 */
@@ -166,10 +172,10 @@ S16 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)
    {
@@ -183,24 +189,27 @@ S16 cuEgtpSrvOpenReq(Pst *pst)
       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 */
 
@@ -222,7 +231,7 @@ S16 cuEgtpSrvOpenReq(Pst *pst)
  *
  
  * ***************************************************************************/
-S16 cuEgtpTnlMgmtReq(EgtpTnlEvt tnlEvt)
+S16 cuEgtpTnlMgmtReq(uint32_t duId, EgtpTnlEvt tnlEvt)
 {
    S8 ret;
 
@@ -231,17 +240,17 @@ S16 cuEgtpTnlMgmtReq(EgtpTnlEvt tnlEvt)
    {
       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:
@@ -269,7 +278,7 @@ S16 cuEgtpTnlMgmtReq(EgtpTnlEvt tnlEvt)
  *         RFAILED - failure
  *
  * ***************************************************************************/
-S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt)
+S16 cuEgtpTnlAdd(uint32_t duId, EgtpTnlEvt tnlEvt)
 {
    S16   ret;
    EgtpTeIdCb     *teidCb;
@@ -291,14 +300,14 @@ S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt)
    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));
@@ -332,7 +341,7 @@ S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt)
  *         RFAILED - failure
  * 
  * ***************************************************************************/
-S16 cuEgtpTnlMod(EgtpTnlEvt tnlEvt)
+S16 cuEgtpTnlMod(uint32_t duId, EgtpTnlEvt tnlEvt)
 {
 #if 0
    S16   ret;
@@ -340,7 +349,7 @@ S16 cuEgtpTnlMod(EgtpTnlEvt tnlEvt)
 
    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");
@@ -368,22 +377,22 @@ S16 cuEgtpTnlMod(EgtpTnlEvt tnlEvt)
  *         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 */
@@ -499,6 +508,22 @@ S16 cuEgtpEncodeHdr(uint8_t *preEncodedHdr, EgtpMsgHdr *preDefHdr, uint8_t *hdrI
 
 } /* 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 */
@@ -510,6 +535,22 @@ S16 cuEgtpHdlRecvMsg(Buffer *mBuf)
 
 }
 
+/*******************************************************************
+ *
+ * @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;
@@ -627,9 +668,28 @@ S16 cuEgtpDecodeHdr(Buffer *mBuf)
      
 } /* 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;
@@ -639,29 +699,48 @@ uint16_t cuEgtpDatReq(uint8_t 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 "
@@ -705,8 +784,8 @@ S16 BuildAppMsg(EgtpMsg  *egtpMsg)
    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;
@@ -780,7 +859,24 @@ S16 BuildAppMsg(EgtpMsg  *egtpMsg)
    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;
@@ -788,7 +884,7 @@ S16 BuildEgtpMsg(EgtpMsg *egtpMsg)
    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);
@@ -851,7 +947,24 @@ S16 BuildEgtpMsg(EgtpMsg *egtpMsg)
    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;
@@ -861,10 +974,10 @@ S16 cuEgtpSendMsg(Buffer *mBuf)
    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");
index 0ca75fc..8510c9c 100644 (file)
@@ -21,7 +21,7 @@
 #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
@@ -111,6 +111,7 @@ typedef struct EgtpTeIdCb
 
 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 */
@@ -118,7 +119,7 @@ typedef struct egtpDstCb
    CmHashListCp  teIdLst;        /* Tunnel Id list for this destination */
 }EgtpDstCb;
 
-typedef struct egtpParams
+typedef struct egtpAssoc 
 {
    SctpIpAddr  localIp;
    uint16_t    localPort;
@@ -127,13 +128,20 @@ typedef struct egtpParams
    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 */
@@ -141,16 +149,16 @@ 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
index aa8626e..c74290a 100644 (file)
@@ -420,8 +420,6 @@ uint8_t sctpSockPoll()
 
    memset(&f1PollParams, 0, sizeof(sctpSockPollParams));
     
-   egtpFromAddr.port = egtpCb.dstCb.dstPort;
-   egtpFromAddr.address = egtpCb.dstCb.dstIp;
 
    /* All sockets are non-blocking */
    timeout = 0;
@@ -443,15 +441,21 @@ uint8_t sctpSockPoll()
       }
 
       /* 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);
index 2c0a9b7..ed09e27 100644 (file)
@@ -72,7 +72,7 @@ typedef struct sctpAssocInfo
    uint16_t    cuPort;
 }SctpAssocInfo;
 
-typedef struct CuSctpParams
+typedef struct cuSctpParams
 {
    uint8_t        numDu;
    SctpAssocInfo  sctpAssoc[MAX_DU_SUPPORTED];
index 709deeb..e883154 100644 (file)
@@ -38,7 +38,7 @@
 #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
 
index 76ec0cf..2a486c6 100644 (file)
@@ -285,7 +285,7 @@ uint8_t egtpCfgReq(Pst *pst, EgtpConfig egtpCfg)
    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;
@@ -877,7 +877,7 @@ uint8_t egtpSendMsg(Buffer *mBuf)
    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, \
index 2f158e2..b8c7b4e 100644 (file)
@@ -21,7 +21,7 @@
 #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
 
index 7098e0a..94b7392 100644 (file)
@@ -706,7 +706,6 @@ uint16_t l1BuildAndSendSlotIndication()
 
       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)
       {