From ab583728b1581b9d4d9536fdfc3fd34b6596781f Mon Sep 17 00:00:00 2001 From: "lal.harshita" Date: Fri, 30 Jul 2021 15:58:46 +0530 Subject: [PATCH] Change-Id: I814c7779357b0351f66671d9fdc4e49e81f2c94f Signed-off-by: lal.harshita --- src/5gnrrlc/rlc_utl_ul.c | 106 +++++---- src/cm/common_def.h | 2 +- src/cu_stub/cu_f1ap_msg_hdl.c | 469 ++++++++++++++++++++++++------------- src/cu_stub/cu_f1ap_msg_hdl.h | 5 +- src/cu_stub/cu_stub.c | 33 ++- src/cu_stub/cu_stub.h | 4 + src/cu_stub/cu_stub_egtp.c | 69 +++--- src/cu_stub/cu_stub_egtp.h | 5 +- src/du_app/du_cfg.c | 5 +- src/du_app/du_cfg.h | 3 + src/du_app/du_egtp.c | 2 +- src/du_app/du_f1ap_msg_hdl.c | 43 ++-- src/du_app/du_ue_mgr.c | 3 +- src/phy_stub/phy_stub.h | 2 + src/phy_stub/phy_stub_msg_hdl.c | 10 +- src/phy_stub/phy_stub_thread_hdl.c | 15 +- 16 files changed, 492 insertions(+), 284 deletions(-) diff --git a/src/5gnrrlc/rlc_utl_ul.c b/src/5gnrrlc/rlc_utl_ul.c index 4604f19f2..507d8c1f5 100755 --- a/src/5gnrrlc/rlc_utl_ul.c +++ b/src/5gnrrlc/rlc_utl_ul.c @@ -198,12 +198,12 @@ uint8_t rlcUtlRcvFrmMac(RlcCb *gCb, KwDatIndInfo *datIndInfo) uint8_t rlcUtlSendUlDataToDu(RlcCb *gCb, RlcUlRbCb *rbCb, Buffer *sdu) { #ifndef KW_PDCP - KwuDatIndInfo *datIndInfo; /* Data Indication Information */ + KwuDatIndInfo *datIndInfo = NULLP; /* Data Indication Information */ KwuDatIndInfo datIndInfoTmp; #endif - RlcUlRrcMsgInfo *ulRrcMsgInfo; - RlcUlUserDatInfo *ulUserDatInfo; - uint16_t msgLen, copyLen; + RlcUlRrcMsgInfo *ulRrcMsgInfo = NULLP; + RlcUlUserDatInfo *ulUserDatInfo = NULLP; + uint16_t msgLen = 0, copyLen = 0; Pst pst; #ifndef KW_PDCP @@ -231,28 +231,28 @@ uint8_t rlcUtlSendUlDataToDu(RlcCb *gCb, RlcUlRbCb *rbCb, Buffer *sdu) ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo)); if (ulRrcMsgInfo) { - ulRrcMsgInfo->cellId = rbCb->rlcId.cellId; - ulRrcMsgInfo->ueIdx = rbCb->rlcId.ueId; - ulRrcMsgInfo->lcId = rbCb->lch.lChId; - RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, - ulRrcMsgInfo->rrcMsg, msgLen); - if (ulRrcMsgInfo->rrcMsg) - { - ODU_GET_MSG_LEN(sdu, (MsgLen *)&msgLen); - ODU_COPY_MSG_TO_FIX_BUF(sdu, 0, msgLen, ulRrcMsgInfo->rrcMsg, (MsgLen *)©Len); - ulRrcMsgInfo->msgLen = msgLen; - - /* Sending UL RRC Message transfeer to DU APP */ - memset(&pst, 0, sizeof(Pst)); - FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_UL_RRC_MSG_TRANS_TO_DU); - rlcSendUlRrcMsgToDu(&pst, ulRrcMsgInfo); - } - else - { - DU_LOG("\nERROR --> RLC_UL: rlcUtlSendUlDataToDu: Memory allocation failed for rrcMsg"); - RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo)); - return RFAILED; - } + ulRrcMsgInfo->cellId = rbCb->rlcId.cellId; + ulRrcMsgInfo->ueIdx = rbCb->rlcId.ueId; + ulRrcMsgInfo->lcId = rbCb->lch.lChId; + ODU_GET_MSG_LEN(sdu, (MsgLen *)&msgLen); + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, + ulRrcMsgInfo->rrcMsg, msgLen); + if (ulRrcMsgInfo->rrcMsg) + { + ODU_COPY_MSG_TO_FIX_BUF(sdu, 0, msgLen, ulRrcMsgInfo->rrcMsg, (MsgLen *)©Len); + ulRrcMsgInfo->msgLen = msgLen; + + /* Sending UL RRC Message transfeer to DU APP */ + memset(&pst, 0, sizeof(Pst)); + FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_UL_RRC_MSG_TRANS_TO_DU); + rlcSendUlRrcMsgToDu(&pst, ulRrcMsgInfo); + } + else + { + DU_LOG("\nERROR --> RLC_UL: rlcUtlSendUlDataToDu: Memory allocation failed for rrcMsg"); + RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo)); + return RFAILED; + } } else { @@ -266,33 +266,35 @@ uint8_t rlcUtlSendUlDataToDu(RlcCb *gCb, RlcUlRbCb *rbCb, Buffer *sdu) RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, ulUserDatInfo, sizeof(RlcUlUserDatInfo)); if (ulUserDatInfo) { - ulUserDatInfo->cellId = rbCb->rlcId.cellId; - ulUserDatInfo->ueIdx = rbCb->rlcId.ueId; + ulUserDatInfo->cellId = rbCb->rlcId.cellId; + ulUserDatInfo->ueIdx = rbCb->rlcId.ueId; ulUserDatInfo->rbId = rbCb->rlcId.rbId; - RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, ulUserDatInfo->userData, msgLen); - if (ulUserDatInfo->userData) - { - ODU_GET_MSG_LEN(sdu, (MsgLen *)&msgLen); - ODU_COPY_MSG_TO_FIX_BUF(sdu, 0, msgLen, ulUserDatInfo->userData, (MsgLen *)©Len); - ulUserDatInfo->msgLen = msgLen; - - /* Sending UL RRC Message transfeer to DU APP */ - memset(&pst, 0, sizeof(Pst)); - FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_UL_USER_DATA_TRANS_TO_DU); - rlcSendUlUserDataToDu(&pst, ulUserDatInfo); - } - else - { - DU_LOG("\nERROR --> RLC_UL: rlcUtlSendUlDataToDu: Memory allocation failed for user data"); - RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, ulUserDatInfo, sizeof(RlcUlUserDatInfo)); - return RFAILED; - } - } - else - { - DU_LOG("\nERROR --> RLC_UL: rlcUtlSendUlDataToDu: Memory allocation failed for ulUserDatInfo"); - return RFAILED; - } + ODU_GET_MSG_LEN(sdu, (MsgLen *)&msgLen); + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, ulUserDatInfo->userData, msgLen); + if (ulUserDatInfo->userData) + { + ODU_COPY_MSG_TO_FIX_BUF(sdu, 0, msgLen, ulUserDatInfo->userData, (MsgLen *)©Len); + ulUserDatInfo->msgLen = msgLen; + + DU_LOG("\nDEBUG --> RLC_UL -> DUAPP : UL DATA [DRB ID:%d]", ulUserDatInfo->rbId); + + /* Sending UL RRC Message transfeer to DU APP */ + memset(&pst, 0, sizeof(Pst)); + FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_UL_USER_DATA_TRANS_TO_DU); + rlcSendUlUserDataToDu(&pst, ulUserDatInfo); + } + else + { + DU_LOG("\nERROR --> RLC_UL: rlcUtlSendUlDataToDu: Memory allocation failed for user data"); + RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, ulUserDatInfo, sizeof(RlcUlUserDatInfo)); + return RFAILED; + } + } + else + { + DU_LOG("\nERROR --> RLC_UL: rlcUtlSendUlDataToDu: Memory allocation failed for ulUserDatInfo"); + return RFAILED; + } } return ROK; } /* rlcUtlSendUlDataToDu */ diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 0350c6f7e..d326e37fe 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -58,7 +58,7 @@ #define MAX_NUM_CELL 1 #define MAX_NUM_UE 2 #define MAX_NUM_UE_PER_TTI 1 -#define MAX_NUM_LC 11 +#define MAX_NUM_LC 32 /*Spec 38.331: Sec 6.4: maxLC-ID Keyword*/ #define MAX_NUM_SRB 3 /* Max. no of Srbs */ #define MAX_NUM_DRB 29 /* spec 38.331, maxDRB */ diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c index 07e176c83..c5f586642 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.c +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -23,6 +23,7 @@ #include "odu_common_codec.h" #include "cu_stub_sctp.h" #include "cu_f1ap_msg_hdl.h" +#include "legtp.h" /*header files needed for Ue Context Setup */ #include #include "ProtocolExtensionField.h" @@ -81,6 +82,11 @@ #include "GBR-QosInformation.h" #include "DRBs-ToBeSetupMod-List.h" #include "DRBs-ToBeSetupMod-Item.h" +#include "DRBs-Setup-Item.h" +#include "DLUPTNLInformation-ToBeSetup-List.h" +#include "DLUPTNLInformation-ToBeSetup-Item.h" +#include "UPTransportLayerInformation.h" +#include "GTPTunnel.h" /* MACRO for CUtoDURRCInformation */ #define CELL_GRP_ID 1 @@ -174,6 +180,7 @@ #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 @@ -2165,7 +2172,7 @@ uint8_t BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap) * * Functionality: Constructs the UL TnlInfo For DRB list * - * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo + * @params[in] UPTNLInformation_ToBeSetup_List_t *ulInfo * * @return ROK - success * RFAILED - failure @@ -2263,14 +2270,11 @@ uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo) * ****************************************************************/ uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet) { - uint8_t BuildQOSInforet; - uint8_t BuildSNSSAIret; - uint8_t BuildFlowsMapret; - uint8_t BuildULTnlInforet; - uint8_t idx; - uint8_t drbCnt; + uint8_t BuildQOSInforet = 0,BuildSNSSAIret = 0, idx = 0; + uint8_t BuildFlowsMapret =0, BuildULTnlInforet =0, drbCnt = 0; DRBs_ToBeSetup_Item_t *drbSetItem; - drbCnt = 1; + + drbCnt = MAX_DRB_SET; drbSet->list.count = drbCnt; drbSet->list.size = drbCnt*sizeof(DRBs_ToBeSetup_ItemIEs_t *); CU_ALLOC(drbSet->list.array,drbSet->list.size); @@ -2283,66 +2287,66 @@ uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet) CU_ALLOC(drbSet->list.array[idx],sizeof(DRBs_ToBeSetup_ItemIEs_t)); if(drbSet->list.array[idx] == NULLP) { - return RFAILED; + return RFAILED; } - } - idx = 0; - drbSet->list.array[idx]->id = ProtocolIE_ID_id_DRBs_ToBeSetup_Item; - drbSet->list.array[idx]->criticality = Criticality_ignore; - drbSet->list.array[idx]->value.present = \ - DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; - drbSetItem = &drbSet->list.array[idx]->value.choice.DRBs_ToBeSetup_Item; - /*dRBID*/ - drbSetItem->dRBID = 1; - /*qoSInformation*/ - drbSetItem->qoSInformation.present = QoSInformation_PR_choice_extension; - CU_ALLOC(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t)); - if(drbSetItem->qoSInformation.choice.choice_extension == NULLP) - { - return RFAILED; - } - drbSetItem->qoSInformation.choice.choice_extension->id = \ - ProtocolIE_ID_id_DRB_Information; - drbSetItem->qoSInformation.choice.choice_extension->criticality = \ - Criticality_ignore; - drbSetItem->qoSInformation.choice.choice_extension->value.present = \ + + drbSet->list.array[idx]->id = ProtocolIE_ID_id_DRBs_ToBeSetup_Item; + drbSet->list.array[idx]->criticality = Criticality_ignore; + drbSet->list.array[idx]->value.present = \ + DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; + drbSetItem = &drbSet->list.array[idx]->value.choice.DRBs_ToBeSetup_Item; + /*dRBID*/ + drbSetItem->dRBID = idx + 1; + /*qoSInformation*/ + drbSetItem->qoSInformation.present = QoSInformation_PR_choice_extension; + CU_ALLOC(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t)); + if(drbSetItem->qoSInformation.choice.choice_extension == NULLP) + { + return RFAILED; + } + drbSetItem->qoSInformation.choice.choice_extension->id = \ + ProtocolIE_ID_id_DRB_Information; + drbSetItem->qoSInformation.choice.choice_extension->criticality = \ + Criticality_ignore; + drbSetItem->qoSInformation.choice.choice_extension->value.present = \ QoSInformation_ExtIEs__value_PR_DRB_Information; - BuildQOSInforet = BuildQOSInfo(&drbSetItem->qoSInformation.choice.\ - choice_extension->value.choice.DRB_Information.dRB_QoS); - if(BuildQOSInforet != ROK) - { - return RFAILED; - } - /*SNSSAI*/ - BuildSNSSAIret = BuildSNSSAI(&drbSetItem->qoSInformation.choice.\ - choice_extension->value.choice.DRB_Information.sNSSAI); - if(BuildSNSSAIret != ROK) - { - return RFAILED; - } - /*Flows mapped to DRB List*/ - BuildFlowsMapret = BuildFlowsMap(&drbSetItem->qoSInformation.choice.\ - choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List); - if(BuildFlowsMapret != ROK) - { - return RFAILED; - } - /*ULUPTNLInformation To Be Setup List*/ - BuildULTnlInforet = BuildULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); - if(BuildULTnlInforet != ROK) - { - return RFAILED; - } - /*RLCMode*/ - drbSetItem->rLCMode = RLCMode_rlc_um_bidirectional; + BuildQOSInforet = BuildQOSInfo(&drbSetItem->qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.dRB_QoS); + if(BuildQOSInforet != ROK) + { + return RFAILED; + } + /*SNSSAI*/ + BuildSNSSAIret = BuildSNSSAI(&drbSetItem->qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.sNSSAI); + if(BuildSNSSAIret != ROK) + { + return RFAILED; + } + /*Flows mapped to DRB List*/ + BuildFlowsMapret = BuildFlowsMap(&drbSetItem->qoSInformation.choice.\ + choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List); + if(BuildFlowsMapret != ROK) + { + return RFAILED; + } + /*ULUPTNLInformation To Be Setup List*/ + BuildULTnlInforet = BuildULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); + if(BuildULTnlInforet != ROK) + { + return RFAILED; + } + /*RLCMode*/ + drbSetItem->rLCMode = RLCMode_rlc_um_bidirectional; - /*UL Configuration*/ - CU_ALLOC(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t)); - if(drbSetItem->uLConfiguration == NULLP) - { - return RFAILED; - } - drbSetItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data; + /*UL Configuration*/ + CU_ALLOC(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t)); + if(drbSetItem->uLConfiguration == NULLP) + { + return RFAILED; + } + drbSetItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data; + } return ROK; }/* End of BuildDRBSetup*/ @@ -2548,100 +2552,97 @@ void FreeDRBSetup(DRBs_ToBeSetup_List_t *drbSet) { for(drbidx=0; drbidxlist.count; drbidx++) { - if(drbidx==0&&drbSet->list.array[drbidx] != NULLP) - { - drbSetItem =&drbSet->list.array[drbidx]->value.choice.DRBs_ToBeSetup_Item; - if(drbSetItem->qoSInformation.choice.choice_extension != NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\ - flows_Mapped_To_DRB_List.list.array != NULLP) - { - for(flowidx=0;flowidxqoSInformation.choice.choice_extension->value.choice.DRB_Information.\ - flows_Mapped_To_DRB_List.list.count; flowidx++) - { - if(flowidx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) - { - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) - { - FreeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); - CU_FREE(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t)); - - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ - sizeof(MaxDataBurstVolume_t)); - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ - qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t)); - } - } - if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP) - { - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ - DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx],sizeof(Flows_Mapped_To_DRB_Item_t)); - } - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\ - flows_Mapped_To_DRB_List.list.array,drbSetItem->qoSInformation.choice.choice_extension->value.\ - choice.DRB_Information.flows_Mapped_To_DRB_List.list.size); - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf,\ - drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->size); - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD,\ - sizeof(OCTET_STRING_t)); - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf,\ - drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.size); - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t)); - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ - qoS_Characteristics.choice.non_Dynamic_5QI, sizeof(NonDynamic5QIDescriptor_t)); - } - CU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t)); - } - } - if(drbSet->list.array[drbidx]!=NULLP) - { - CU_FREE(drbSet->list.array[drbidx],sizeof(DRBs_ToBeSetup_ItemIEs_t)); - } + if(drbSet->list.array[drbidx] != NULLP) + { + drbSetItem =&drbSet->list.array[drbidx]->value.choice.DRBs_ToBeSetup_Item; + if(drbSetItem->qoSInformation.choice.choice_extension != NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.array != NULLP) + { + for(flowidx=0;flowidxqoSInformation.choice.choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.count; flowidx++) + { + if(flowidx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP) + { + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP) + { + FreeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List); + CU_FREE(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t)); + + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,\ + sizeof(MaxDataBurstVolume_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]->qoSFlowLevelQoSParameters.\ + qoS_Characteristics.choice.non_Dynamic_5QI,sizeof(NonDynamic5QIDescriptor_t)); + } + } + if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx]!=NULLP) + { + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\ + DRB_Information.flows_Mapped_To_DRB_List.list.array[flowidx],sizeof(Flows_Mapped_To_DRB_Item_t)); + } + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\ + flows_Mapped_To_DRB_List.list.array,drbSetItem->qoSInformation.choice.choice_extension->value.\ + choice.DRB_Information.flows_Mapped_To_DRB_List.list.size); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->buf,\ + drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->size); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD,\ + sizeof(OCTET_STRING_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf,\ + drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.size); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume,sizeof(MaxDataBurstVolume_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,sizeof(AveragingWindow_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\ + qoS_Characteristics.choice.non_Dynamic_5QI, sizeof(NonDynamic5QIDescriptor_t)); + } + CU_FREE(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t)); + } + CU_FREE(drbSet->list.array[drbidx],sizeof(DRBs_ToBeSetup_ItemIEs_t)); + } } CU_FREE(drbSet->list.array,drbSet->list.size); } @@ -2722,13 +2723,13 @@ void FreeUeContextSetupReq(F1AP_PDU_t *f1apMsg) { if(ueSetReq->protocolIEs.list.array[ieId] != NULLP) { - CU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t)); + CU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t)); } } CU_FREE(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size); } CU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t)); - } + } CU_FREE(f1apMsg, sizeof(F1AP_PDU_t)); } } @@ -6575,11 +6576,147 @@ uint8_t BuildAndSendUeContextSetupReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \ return ret; }/* End of BuildAndSendUeContextSetupReq*/ +/********************************************************************** + * @brief Function to extractTeId received in UE context setup Response + * + * @details + * + * Function : extractTeId + * + * Functionality: + * - Function to extract TeId + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + **********************************************************************/ +uint8_t extractTeId(DLUPTNLInformation_ToBeSetup_List_t *dlTnlInfo) +{ + uint8_t arrIdx = 0; + uint32_t teId = 0; + GTPTunnel_t *gtpDl = NULLP; + + for(arrIdx =0; arrIdx < dlTnlInfo->list.count; arrIdx++) + { + if(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.present == UPTransportLayerInformation_PR_gTPTunnel) + { + if(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel != NULLP) + { + gtpDl = dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel; + if(gtpDl->gTP_TEID.size > 0) + { + teIdStringToInt(gtpDl->gTP_TEID.buf, &teId); + } + else + DU_LOG("\nERROR --> EGTP: No TeId received"); + return(teId); + } + } + } + return teId; +} + +/**************************************************************** + * @brief Function to add Drb tunnels + * + * @details + * + * Function : addDrbTunnels + * + * Functionality: + * - Function to add Drb tunnels + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t addDrbTunnels(uint8_t teId) +{ + uint8_t ret = ROK; + EgtpTnlEvt tnlEvt; + + if(teId > MAX_TEID || teId < MIN_TEID) + { + DU_LOG("\nERROR --> EGTP : TEID(%x) OUT Of Range",teId); + } + memset(&tnlEvt, 0, sizeof(EgtpTnlEvt)); + tnlEvt.action = EGTP_TNL_MGMT_ADD; + tnlEvt.lclTeid = teId; + tnlEvt.remTeid = teId; + ret = cuEgtpTnlMgmtReq(tnlEvt); + if(ret != ROK) + { + DU_LOG("\nERROR --> EGTP : Tunnel management request failed for teId %x", teId); + } + return ROK; +} +/**************************************************************** + * @brief Function to process Drb Setup List + * + * @details + * + * Function : procDrbSetupList + * + * Functionality: + * - Function to process DRB Setup List + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t procDrbSetupList(DRBs_Setup_List_t *drbSetupList) +{ + uint8_t arrIdx = 0; + uint32_t teId = 0; + DRBs_Setup_ItemIEs_t *drbItemIe = NULLP; + + if(drbSetupList != NULLP) + { + for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++) + { + drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]); + if(drbItemIe->value.present == DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item) + { + /* extracting teId */ + teId = extractTeId(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List); + if(teId > 0) + { + if(addDrbTunnels(teId)== ROK) + { + DU_LOG("\nDEBUG --> EGTP: Tunnel Added for TeId %d", teId); + } + } + else + return RFAILED; + } + } + } + return ROK; +} + +/**************************************************************** + * @brief Function to process Ue Context Setup Response + * + * @details + * + * Function : procUeContextSetupResponse + * + * Functionality: + * - Function to process Ue Context Setup Response + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ uint8_t procUeContextSetupResponse(F1AP_PDU_t *f1apMsg) { uint8_t idx, duUeF1apId; - UEContextSetupResponse_t *ueCtxtSetupRsp; + UEContextSetupResponse_t *ueCtxtSetupRsp = NULLP; ueCtxtSetupRsp = &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse; for(idx=0; idx < ueCtxtSetupRsp->protocolIEs.list.count; idx++) @@ -6591,9 +6728,17 @@ uint8_t procUeContextSetupResponse(F1AP_PDU_t *f1apMsg) duUeF1apId = ueCtxtSetupRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID; break; } + case ProtocolIE_ID_id_DRBs_Setup_List: + { + /* Adding Tunnels for successful DRB */ + procDrbSetupList(&ueCtxtSetupRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List); + break; + + } } } ueCb[duUeF1apId-1].f1apMsgDb.dlRrcMsgCount++; /* keeping DL RRC Msg Count */ + return ROK; } /**************************************************************** diff --git a/src/cu_stub/cu_f1ap_msg_hdl.h b/src/cu_stub/cu_f1ap_msg_hdl.h index ba7092709..af563e546 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.h +++ b/src/cu_stub/cu_f1ap_msg_hdl.h @@ -35,6 +35,7 @@ #include "DRB-ToAddMod.h" #include "SDAP-Config.h" #include "du_log.h" +#include "cu_stub.h" #define ENCODE_FAIL -1 #define TRANS_ID 1 @@ -50,8 +51,9 @@ #define SRB1 1 #define SRB2 2 #define DRB1 1 -#define DRB2 2 +#define DRB2 6 //Pls Ignore this; to avoid the collision with DRBID=2 in UE COntext setup #define QCI 9 +#define MAX_DRB_SET 2 #define CU_UE_F1AP_ID 0 #define DU_UE_F1AP_ID 1 @@ -67,6 +69,7 @@ #define RRC_RECONFIG 6 #define UE_CONTEXT_MOD_REQ 7 + typedef struct f1apDb { uint8_t dlRrcMsgCount; diff --git a/src/cu_stub/cu_stub.c b/src/cu_stub/cu_stub.c index ff9da8e90..4460c033c 100644 --- a/src/cu_stub/cu_stub.c +++ b/src/cu_stub/cu_stub.c @@ -215,9 +215,9 @@ void readCuCfg() cuCfgParams.egtpParams.destIp.ipV4Pres = TRUE; cuCfgParams.egtpParams.destIp.ipV4Addr = ipv4_du; cuCfgParams.egtpParams.destPort = DU_EGTP_PORT; - cuCfgParams.egtpParams.minTunnelId = 0; + cuCfgParams.egtpParams.minTunnelId = MIN_TEID; cuCfgParams.egtpParams.currTunnelId = cuCfgParams.egtpParams.minTunnelId; - cuCfgParams.egtpParams.maxTunnelId = 10; + cuCfgParams.egtpParams.maxTunnelId = MAX_TEID; } /* End of readCuCfg */ @@ -239,14 +239,39 @@ void readCuCfg() void *cuConsoleHandler(void *args) { char ch; + uint8_t teId = 0; + uint8_t ret = ROK; + while(true) { /* Send DL user data to CU when user enters 'd' on console */ if((ch = getchar()) == 'd') { + + uint8_t cnt =0; + DU_LOG("\n EGTP --> : Enter TEID id(1..10) where DL Data to be sent\n"); + scanf("%d",&teId); + + if(teId > MAX_TEID || teId < MIN_TEID) + { + DU_LOG("\nERROR --> EGTP : TEID(%x) OUT Of Range",teId); + printf("\n"); + continue; + } /* Start Pumping data from CU to DU */ - DU_LOG("\nDEBUG --> EGTP: Sending DL User Data"); - cuEgtpDatReq(); + DU_LOG("\nDEBUG --> EGTP: Sending DL User Data(teId:%d)\n",teId); + + while(cnt < NUM_DL_PACKETS) + { + ret = cuEgtpDatReq(teId); + if(ret != ROK) + { + DU_LOG("\nERROR --> EGTP: Issue with teid=%d\n",teId); + break; + } + cnt++; + } + continue; } } } diff --git a/src/cu_stub/cu_stub.h b/src/cu_stub/cu_stub.h index 74d684718..d2763c3ed 100644 --- a/src/cu_stub/cu_stub.h +++ b/src/cu_stub/cu_stub.h @@ -27,7 +27,11 @@ #define MAX_DU_PORT 2 #define DU_PORT 38472 +/*VALID Tunnel ID*/ +#define MIN_TEID 1 /*[Spec 29.281,Sec 5.1]: All Zero TEIDs are never assigned for setting up GTP-U Tunnel*/ +#define MAX_TEID 10 /*[Spec 29.281]: Max limit is not mentioned but as per GTP-U Header Format, TEID occupies 4 octets */ /* allocate and zero out a static buffer */ + #define CU_ALLOC(_datPtr, _size) \ { \ S16 _ret; \ diff --git a/src/cu_stub/cu_stub_egtp.c b/src/cu_stub/cu_stub_egtp.c index f2b6da60c..69f6dba7d 100644 --- a/src/cu_stub/cu_stub_egtp.c +++ b/src/cu_stub/cu_stub_egtp.c @@ -19,12 +19,12 @@ /* This file contains all EGTP related functionality */ #include "common_def.h" +#include "cu_f1ap_msg_hdl.h" #include "cu_stub_egtp.h" #include "du_log.h" /* Global variable declaration */ EgtpGlobalCb egtpCb; - /************************************************************************** * @brief Task Initiation callback function. * @@ -49,6 +49,9 @@ S16 egtpActvInit() { DU_LOG("\n\nDEBUG --> EGTP : Initializing"); memset (&egtpCb, 0, sizeof(EgtpGlobalCb)); + + //Initializing with INVALID value + memset(egtpCb.gCntPdu, 0xFF , sizeof(uint8_t)*(MAX_TEID+1)); protType = CM_INET_PROTO_UDP; return ROK; } @@ -76,7 +79,6 @@ S16 egtpActvInit() uint8_t egtpInitReq() { uint8_t ret = ROK; - EgtpTnlEvt tnlEvt; ret = cuEgtpCfgReq(); if(ret != ROK) @@ -92,16 +94,6 @@ uint8_t egtpInitReq() return (ret); } - tnlEvt.action = EGTP_TNL_MGMT_ADD; - tnlEvt.lclTeid = 1; - tnlEvt.remTeid = 1; - ret = cuEgtpTnlMgmtReq(tnlEvt); - if(ret != ROK) - { - DU_LOG("\nERROR --> EGTP : Tunnel management request failed"); - return RFAILED; - } - return ret; } /* egtpInitReq */ @@ -309,9 +301,11 @@ S16 cuEgtpTnlAdd(EgtpTnlEvt tnlEvt) preDefHdr.teId = teidCb->remTeId; preDefHdr.extHdr.pdcpNmb.pres = FALSE; preDefHdr.extHdr.udpPort.pres = FALSE; - preDefHdr.nPdu.pres = FALSE; - + preDefHdr.nPdu.pres = TRUE; //Including nPdu when sending data + preDefHdr.nPdu.val = 0; + cuEgtpEncodeHdr((uint8_t *)teidCb->preEncodedHdr.hdr, &preDefHdr, &(teidCb->preEncodedHdr.cnt)); + egtpCb.gCntPdu[teidCb->remTeId] = 0;//Resetting the Cnt Value for this DRB which indicates its creation /* SPutSBuf(CU_APP_MEM_REG, CU_POOL, (Data *)teidCb, (Size)sizeof(EgtpTeIdCb));*/ @@ -618,18 +612,25 @@ S16 cuEgtpDecodeHdr(Buffer *mBuf) ODU_REM_PRE_MSG(&extHdrType, mBuf); } - DU_LOG("\nDEBUG --> EGTP : Message Buffer after decoding header "); + DU_LOG("\nDEBUG --> EGTP : Message Buffer after decoding header [TEID:%d]",egtpMsg.msgHdr.teId); ODU_PRINT_MSG(mBuf, 0, 0); return ROK; } /* End of cuEgtpDecodeHdr */ -S16 cuEgtpDatReq() +uint16_t cuEgtpDatReq(uint8_t teId) { uint8_t ret = ROK, cnt = 0; EgtpMsg egtpMsg; + egtpMsg.msgHdr.teId = teId; + + if(egtpCb.gCntPdu[teId] == 0xFF) //DRB not created + { + 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) @@ -645,15 +646,7 @@ S16 cuEgtpDatReq() 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); - } - + cuEgtpSendMsg(egtpMsg.msg); ODU_PUT_MSG_BUF(egtpMsg.msg); return ROK; @@ -763,17 +756,22 @@ S16 BuildAppMsg(EgtpMsg *egtpMsg) ret = ODU_ADD_PRE_MSG_MULT(revPkArray, (MsgLen)cnt, mBuf); egtpMsg->msgHdr.msgType = EGTPU_MSG_GPDU; - egtpMsg->msgHdr.nPdu.pres = FALSE; + egtpMsg->msgHdr.nPdu.pres = TRUE; + + if(egtpCb.gCntPdu[egtpMsg->msgHdr.teId] != NUM_DL_PACKETS) + egtpCb.gCntPdu[egtpMsg->msgHdr.teId]++; + else + egtpCb.gCntPdu[egtpMsg->msgHdr.teId] = 1; + + egtpMsg->msgHdr.nPdu.val = egtpCb.gCntPdu[egtpMsg->msgHdr.teId]; egtpMsg->msgHdr.seqNum.pres = FALSE; egtpMsg->msgHdr.extHdr.udpPort.pres = FALSE; egtpMsg->msgHdr.extHdr.pdcpNmb.pres = FALSE; - egtpMsg->msgHdr.teId = 1; egtpMsg->msg = mBuf; return ret; } - S16 BuildEgtpMsg(EgtpMsg *egtpMsg) { EgtpTeIdCb *teidCb = NULLP; @@ -830,11 +828,18 @@ S16 BuildEgtpMsg(EgtpMsg *egtpMsg) teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] &= ~(EGTP_MASK_BIT2); } - ODU_ADD_PRE_MSG_MULT(&teidCb->preEncodedHdr.hdr[hdrLen], (EGTP_MAX_HDR_LEN - hdrLen), egtpMsg->msg); - - DU_LOG("\nDEBUG --> EGTP : Sending message buffer"); - ODU_PRINT_MSG(egtpMsg->msg, 0, 0); + /*Update the nPdU number*/ + if(egtpMsg->msgHdr.nPdu.pres) + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] |= (EGTP_MASK_BIT1); + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 11] = egtpMsg->msgHdr.nPdu.val; + } + else + { + teidCb->preEncodedHdr.hdr[EGTP_MAX_HDR_LEN - 1] &= ~(EGTP_MASK_BIT1); + } + ODU_ADD_PRE_MSG_MULT(&teidCb->preEncodedHdr.hdr[hdrLen], (EGTP_MAX_HDR_LEN - hdrLen), egtpMsg->msg); return ROK; } diff --git a/src/cu_stub/cu_stub_egtp.h b/src/cu_stub/cu_stub_egtp.h index 02b11d475..5addcb0f6 100644 --- a/src/cu_stub/cu_stub_egtp.h +++ b/src/cu_stub/cu_stub_egtp.h @@ -47,6 +47,8 @@ #define EGTP_MASK_BIT7 0x40 #define EGTP_MASK_BIT8 0x80 +#define NUM_DL_PACKETS 4 + uint8_t sockType; uint8_t protType; @@ -123,6 +125,7 @@ typedef struct egtpGlobalCb EgtpParams egtpCfg; /* EGTP configuration */ EgtpTptSrvr recvTptSrvr; /* Transport server for receiving UDP msg */ EgtpDstCb dstCb; /* Destination endpoint */ + uint8_t gCntPdu[MAX_TEID+1]; /* Maintaining PDU count for each bearer */ }EgtpGlobalCb; EgtpGlobalCb egtpCb; /* EGTP global control block */ @@ -135,7 +138,7 @@ S16 cuEgtpTnlMod(EgtpTnlEvt tnlEvt); S16 cuEgtpTnlDel(EgtpTnlEvt tnlEvt); S16 cuEgtpEncodeHdr(uint8_t *preEncodedHdr, EgtpMsgHdr *preDefHdr, uint8_t *hdrIdx); S16 cuEgtpHdlRecvMsg(Buffer *mBuf); -S16 cuEgtpDatReq(); +uint16_t cuEgtpDatReq(uint8_t teId); S16 BuildAppMsg(EgtpMsg *egtpMsg); S16 BuildEgtpMsg(EgtpMsg *egtpMsg); S16 cuEgtpSendMsg(Buffer *mBuf); diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index ac754e4a8..aaa88b7c3 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -466,6 +466,7 @@ uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID; pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID; pdcchCfg.monitorSlotPrdAndOffPresent = \ + SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; //pdcchCfg.monitorSlotPrdAndOff = \ SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; @@ -642,8 +643,8 @@ uint8_t readCfg() duCfgParam.egtpParams.destIp.ipV4Pres = TRUE; duCfgParam.egtpParams.destIp.ipV4Addr = ipv4_cu; duCfgParam.egtpParams.destPort = CU_EGTP_PORT; - duCfgParam.egtpParams.minTunnelId = 0; - duCfgParam.egtpParams.maxTunnelId = 10; + duCfgParam.egtpParams.minTunnelId = MIN_TEID; + duCfgParam.egtpParams.maxTunnelId = MAX_TEID; duCfgParam.maxUe = 32; //TODO: Check /* DU Info */ diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index fabeaaf29..877813273 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -295,6 +295,9 @@ #define PDSCH_MCS_INDEX 20 /* For 64QAM, valid mcs index: 17-28 in 38.214 - Table 5.1.3.1-1*/ #define PUSCH_MCS_INDEX 10 /* For 16QAM, valid mcs index: 10-16 in 38.214 - Table 5.1.3.1-1*/ +/*VALID Tunnel ID*/ +#define MIN_TEID 1 /*[Spec 29.281,Sec 5.1]: All Zero TEIDs are never assigned for setting up GTP-U Tunnel*/ +#define MAX_TEID 10 /*[Spec 29.281]: Max limit is not mentioned but as per GTP-U Header Format, TEID occupies 4 octets */ typedef enum { GNBDU, diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c index b895aa296..fc9df1b2c 100644 --- a/src/du_app/du_egtp.c +++ b/src/du_app/du_egtp.c @@ -932,7 +932,7 @@ uint8_t egtpRecvMsg() &recvBuf, (int16_t *)&bufLen, CM_INET_NO_FLAG); if(ret == ROK && recvBuf != NULLP) { - //DU_LOG("\nDEBUG --> EGTP : Received DL Message[%ld]\n", gDlDataRcvdCnt + 1); + DU_LOG("\nDEBUG --> EGTP : Received DL Message[%ld]\n", gDlDataRcvdCnt + 1); //ODU_PRINT_MSG(recvBuf, 0 ,0); egtpHdlRecvData(recvBuf); gDlDataRcvdCnt++; diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 2ef720114..6b6a13655 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -7765,6 +7765,8 @@ uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList } (ueCfgDb->numRlcLcs)++; (ueCfgDb->numMacLcs)++; + DU_LOG("\nDEBUG -> DUAPP: extractRlcCfgToAddMod:RBType:%d, DrbID: %d,lcId:%d, [RLC,MAC,NumDrb]:[%x,%x,%x]",\ + rbType, rbId, lcId, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb); } //TODO: To send the failure cause in UeContextSetupRsp return ROK; @@ -9947,6 +9949,8 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb) &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]); ueCfgDb->numRlcLcs++; ueCfgDb->numMacLcs++; + DU_LOG("\nDEBUG --> DUAPP: extractSrbListToSetup: SRBID: %d [RLC,MAC,NumDrb]:[%x,%x,%x]",\ + srbItem->sRBID, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb); if(ret == RFAILED) { DU_LOG("\nERROR --> F1AP: Failed at extractSrbListToSetup()"); @@ -10024,10 +10028,10 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcL * * ****************************************************************/ -uint8_t extractDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_List_t *drbCfg,DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\ -uint8_t drbCount, DuUeCfg *ueCfgDb) +uint8_t extractDrbListToSetup(DRBs_ToBeSetup_List_t *drbCfg,DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\ +uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap) { - uint8_t ret, drbIdx; + uint8_t ret, drbIdx, lcId = 0; DRBs_ToBeSetup_Item_t *drbItem = NULLP; DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP; @@ -10050,7 +10054,14 @@ uint8_t drbCount, DuUeCfg *ueCfgDb) } memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg)); memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg)); - + + lcId = getDrbLcId(drbBitMap); + if(lcId == RFAILED) + { + DU_LOG("\nERROR --> F1AP : InCorrect LCID extractDrbListToSetup()"); + ret = RFAILED; + break; + } if(drbCfg != NULL) { drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item; @@ -10077,6 +10088,9 @@ uint8_t drbCount, DuUeCfg *ueCfgDb) ueCfgDb->numRlcLcs++; ueCfgDb->numMacLcs++; ueCfgDb->numDrb++; + + DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetup:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\ + lcId,*drbBitMap, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs, ueCfgDb->numDrb); if(ret == RFAILED) { DU_LOG("\nERROR --> F1AP : Failed at extractDrbListToSetup()"); @@ -10310,7 +10324,7 @@ void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t *ueSetReq) * ****************************************************************/ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) { - uint8_t ret=0, ieIdx=0, ueIdx=0, lcId=0, cellIdx=0; + uint8_t ret=0, ieIdx=0, ueIdx=0, cellIdx=0; bool ueCbFound = false; uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0; DuUeCb *duUeCb = NULL; @@ -10412,19 +10426,14 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg) } case ProtocolIE_ID_id_DRBs_ToBeSetup_List: { - lcId = getDrbLcId(&duUeCb->drbBitMap); - if(lcId != RFAILED) - { drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List; - if(extractDrbListToSetup(lcId, drbCfg, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg)) + + if(extractDrbListToSetup(drbCfg, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap)) { DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetup()"); //TODO: Update the failure cause in ue context Setup Response ret = RFAILED; } - } - else - ret = RFAILED; break; } case ProtocolIE_ID_id_RRCContainer: @@ -12778,7 +12787,7 @@ void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *U uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) { UEContextModificationRequest_t *ueContextModifyReq = NULLP; - uint8_t ret = ROK, ieIdx = 0, lcId =0,cellIdx=0, ueIdx=0; + uint8_t ret = ROK, ieIdx = 0, cellIdx=0, ueIdx=0; DuUeCb *duUeCb = NULLP; DRBs_ToBeSetupMod_List_t *drbSetupModCfg; uint32_t gnbCuUeF1apId, gnbDuUeF1apId; @@ -12809,23 +12818,19 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) { duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx]; - lcId = getDrbLcId(&duUeCb->drbBitMap); - if(lcId != RFAILED) - { DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb)); if(duUeCb->f1UeDb) { duUeCb->f1UeDb->actionType = UE_CTXT_MOD; drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\ choice.DRBs_ToBeSetupMod_List; - if(extractDrbListToSetup(lcId, NULL, drbSetupModCfg ,drbSetupModCfg->list.count, \ - &duUeCb->f1UeDb->duUeCfg)) + if(extractDrbListToSetup(NULL, drbSetupModCfg ,drbSetupModCfg->list.count, \ + &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap)) { DU_LOG("\nERROR --> DU APP : Failed at extractDrbListToSetup()"); ret = RFAILED; } } - } break; } } diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index d4d7ca058..75a8267bf 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -183,7 +183,8 @@ uint8_t duBuildAndSendDlUserDataToRlc(uint16_t msgLen, EgtpMsg *egtpMsg) { /* Filling post structure and sending msg */ FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_USER_DATA_TRANS_TO_RLC); - DU_LOG("\nDEBUG --> DU_APP : Sending User Data Msg to RLC \n"); + DU_LOG("\nDEBUG --> DU_APP : Sending User Data Msg to RLC [TEID, nPDU]:[%d, %d]\n",\ + egtpMsg->msgHdr.teId, egtpMsg->msgHdr.nPdu.val); ret = (*duSendRlcDlUserDataToRlcOpts[pst.selector])(&pst, dlDataMsgInfo); } if(ret != ROK) diff --git a/src/phy_stub/phy_stub.h b/src/phy_stub/phy_stub.h index fab871291..759c83c6d 100644 --- a/src/phy_stub/phy_stub.h +++ b/src/phy_stub/phy_stub.h @@ -25,6 +25,8 @@ #define MAX_SFN_VALUE 1023 #define NR_PCI 1 #define SLOT_DELAY 3 +#define NUM_DRB_TO_PUMP_DATA 2 +#define NUM_UL_PACKETS 4 /*UE Ids for RACH IND*/ #define UE_IDX_0 0 #define UE_IDX_1 1 diff --git a/src/phy_stub/phy_stub_msg_hdl.c b/src/phy_stub/phy_stub_msg_hdl.c index 8cd6217e0..168ea65e4 100644 --- a/src/phy_stub/phy_stub_msg_hdl.c +++ b/src/phy_stub/phy_stub_msg_hdl.c @@ -1319,7 +1319,7 @@ S16 l1HdlUlDciReq(uint16_t msgLen, void *msg) * RFAILED - failure * * ****************************************************************/ -uint8_t l1SendUlUserData() +uint8_t l1SendUlUserData(uint8_t drbId) { uint8_t cnt = 0; fapi_rx_data_indication_t *rxDataInd; @@ -1328,6 +1328,7 @@ uint8_t l1SendUlUserData() uint16_t byteIdx = 0; uint32_t msgLen = 0; uint8_t idx = 0; + uint8_t lcId = 0; MAC_ALLOC(rxDataInd, sizeof(fapi_rx_data_indication_t)); if(!rxDataInd) @@ -1377,7 +1378,8 @@ uint8_t l1SendUlUserData() /* Below ulMsg supports 12bit SN for UM mode */ /* SI SN */ - uint8_t ulMsg[] = {4, msgLen, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 1, 0, 0, 192, 168, 130, 81, 192, 168, 130, 82, 84, 104, + lcId = MIN_DRB_LCID + drbId; + uint8_t ulMsg[] = {lcId, msgLen, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 1, 0, 0, 192, 168, 130, 81, 192, 168, 130, 82, 84, 104, 105, 115, 32, 105, 115, 32, 69, 71, 84, 80, 32, 100, 97, 116, 97, 32, 102, 114, 111, 109, 32, 68, 85, 0, 0, 0, 0, 0}; msgLen += 2; /* 2bytes of header */ memcpy(pdu, &ulMsg, msgLen); @@ -1401,9 +1403,9 @@ uint8_t l1SendUlUserData() fillMsgHeader(&rxDataInd->header, FAPI_RX_DATA_INDICATION, msgLen); /* Send Message to peer */ - while(cnt < 2) + while(cnt < NUM_UL_PACKETS) { - DU_LOG("\nDEBUG --> PHY STUB : Sending UL User Data[%d] at sfn %d slot %d", cnt+1, sfnValue, slotValue); + DU_LOG("\nDEBUG --> PHY STUB : Sending UL User Data[%d][LCID:%d] at sfn %d slot %d", cnt+1, lcId, sfnValue, slotValue); /* Sending Rx data indication to MAC */ rxDataInd->sfn = sfnValue; rxDataInd->slot = slotValue; diff --git a/src/phy_stub/phy_stub_thread_hdl.c b/src/phy_stub/phy_stub_thread_hdl.c index 4bdea8106..e7d24fdca 100644 --- a/src/phy_stub/phy_stub_thread_hdl.c +++ b/src/phy_stub/phy_stub_thread_hdl.c @@ -137,21 +137,28 @@ void l1HdlSlotIndicaion(bool stopSlotInd) void *l1ConsoleHandler(void *args) { char ch; + uint8_t drbIdx = 0; + while(true) { /* Send UL user data to DU when user enters 'd' on console */ if((ch = getchar()) == 'd') { /* Start Pumping data from PHY stub to DU */ - DU_LOG("\nDEBUG --> PHY STUB: Sending UL User Data"); - l1SendUlUserData(); + for(drbIdx = 0; drbIdx < NUM_DRB_TO_PUMP_DATA; drbIdx++) //Number of DRB times the loop will run + { + DU_LOG("\nDEBUG --> PHY STUB: Sending UL User Data[DrbId:%d]",drbIdx); + l1SendUlUserData(drbIdx); + } } else if((ch = getchar()) == 'c') { /* Send Control PDU from PHY stub to DU */ - DU_LOG("\nDEBUG --> PHY STUB: Sending Status PDU"); - l1SendStatusPdu(); + DU_LOG("\nDEBUG --> PHY STUB: Sending Status PDU"); + l1SendStatusPdu(); } + DU_LOG("\n"); + continue; } } -- 2.16.6