/* This file contains F1AP message handler functions */
#include "common_def.h"
#include "OCTET_STRING.h"
-#include "BIT_STRING.h"
-#include "odu_common_codec.h"
#include "cu_stub_sctp.h"
+#include "cu_stub_egtp.h"
#include "cu_f1ap_msg_hdl.h"
-#include "legtp.h"
-/*header files needed for Ue Context Setup */
-#include<ProtocolIE-Field.h>
+#include "cu_stub.h"
+
+#include "BIT_STRING.h"
+#include "odu_common_codec.h"
+#include "ProtocolIE-Field.h"
#include "ProtocolExtensionField.h"
#include "ProtocolIE-SingleContainer.h"
#include "F1AP-PDU.h"
#include "UPTransportLayerInformation.h"
#include "GTPTunnel.h"
#include "QoSInformation.h"
+#include "Cells-to-be-Activated-List.h"
+#include "DL-CCCH-Message.h"
+#include "SRB-ToAddModList.h"
+#include "SRB-ToAddMod.h"
+#include "RRCSetup-IEs.h"
+#include "RRCSetup.h"
+#include "DL-DCCH-Message.h"
+#include "RRCReconfiguration-IEs.h"
+#include "RRCReconfiguration.h"
+#include "DRB-ToAddModList.h"
+#include "DRB-ToAddMod.h"
+#include "SDAP-Config.h"
/* MACRO for CUtoDURRCInformation */
#define CELL_GRP_ID 1
/* MACRO Define for PUSCH Configuration */
#define PUSCH_K2_CFG1 1
#define PUSCH_K2_CFG2 2
+#define PUSCH_START_SYMBOL 3
#define PUSCH_MSG3_DELTA_PREAMBLE 0
#define PUSCH_P0_NOMINAL_WITH_GRANT -70
* RFAILED - failure
*
* ****************************************************************/
-S16 SendF1APMsg(Region region, Pool pool)
+S16 SendF1APMsg(Region region, Pool pool, uint32_t duId)
{
Buffer *mBuf = NULLP;
{
ODU_PRINT_MSG(mBuf, 0,0);
- if(sctpSend(mBuf) != ROK)
+ if(sctpSend(duId, mBuf) != ROK)
{
DU_LOG("\nERROR --> F1AP : SCTP Send failed");
ODU_PUT_MSG_BUF(mBuf);
* RFAILED - failure
*
* ****************************************************************/
-S16 BuildAndSendF1SetupRsp(BIT_STRING_t *nrcellId)
+uint8_t BuildAndSendF1SetupRsp(uint32_t duId, BIT_STRING_t *nrcellId)
{
uint8_t idx,ieIdx;
uint8_t elementCnt,cellCnt;
f1SetupRsp->protocolIEs.list.array[idx]->value.present = \
F1SetupResponseIEs__value_PR_GNB_CU_Name;
cuName = &f1SetupRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_Name;
- cuName->size = sizeof(cuCfgParams.cuName);
+ cuName->size = sizeof(cuCb.cuCfgParams.cuName);
CU_ALLOC(cuName->buf, sizeof(cuName->size));
if(cuName->buf == NULLP)
CU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
return RFAILED;
}
- strcpy((char*)cuName->buf, (char*)cuCfgParams.cuName);
+ strcpy((char*)cuName->buf, (char*)cuCb.cuCfgParams.cuName);
/*Cells to be activated list*/
idx++;
CU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
return RFAILED;
}
- buildPlmnId(cuCfgParams.plmn , cellToActivate->list.array[0]->value.choice.\
+ buildPlmnId(cuCb.cuCfgParams.plmn , cellToActivate->list.array[0]->value.choice.\
Cells_to_be_Activated_List_Item.nRCGI.pLMN_Identity.buf);
cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\
nRCGI.nRCellIdentity.size = 5;
}
/* Need to check RRC Version */
- rrcVer->latest_RRC_Version.buf[0] = cuCfgParams.rrcVersion.rrcVer;
+ rrcVer->latest_RRC_Version.buf[0] = cuCb.cuCfgParams.rrcVersion.rrcVer;
rrcVer->latest_RRC_Version.bits_unused = 5; //TODO: pick from cuCfgParam. If not present, add it
CU_ALLOC(rrcVer->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P81_t));
if(rrcVer->iE_Extensions == NULLP)
}
/* Sending msg */
- if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK)
+ if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL, duId) != ROK)
{
DU_LOG("\nERROR --> F1AP : Sending F1 Setup Response failed");
return RFAILED;
*
* ****************************************************************/
-S16 BuildAndSendDUUpdateAck()
+uint8_t BuildAndSendDUUpdateAck(uint32_t duId)
{
uint8_t idx;
uint8_t elementCnt;
}
/* Sending msg */
- if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK)
+ /* TODO : Hardcoding DU ID to 1 for messages other than F1 Setup Response. This will be made generic in future gerrit */
+ if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL, duId) != ROK)
{
DU_LOG("\nERROR --> F1AP : Sending GNB-DU Config Update Ack failed");
return RFAILED;
return ROK;
}/* End of BuildAndSendDUUpdateAck*/
+
/*******************************************************************
*
* @brief deallocating the memory of F1reset msg
CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
if(f1apMsg == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for the BuildAndSendF1ResetReq's F1AP-PDU failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for the BuildAndSendF1ResetReq's F1AP-PDU failed");
+ break;
}
f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
CU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
if(f1apMsg->choice.initiatingMessage == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for BuildAndSendF1ResetReq failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for BuildAndSendF1ResetReq failed");
+ break;
}
f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_Reset;
f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
CU_ALLOC(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
if(f1ResetMsg->protocolIEs.list.array == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation failed for BuildAndSendF1ResetReq");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed for BuildAndSendF1ResetReq");
+ break;
}
for(idx=0; idx<elementCnt; idx++)
{
- CU_ALLOC(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
- if(f1ResetMsg->protocolIEs.list.array[idx] == NULLP)
- {
- DU_LOG("\nERROR --> F1AP : Memory allocation failed for BuildAndSendF1ResetReq msg array");
- break;
- }
+ CU_ALLOC(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
+ if(f1ResetMsg->protocolIEs.list.array[idx] == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed for BuildAndSendF1ResetReq msg array");
+ break;
+ }
}
/*TransactionID*/
memset(encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
- encBuf);
+ encBuf);
/* Encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nERROR --> F1AP : Could not encode F1Reset structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
+ DU_LOG("\nERROR --> F1AP : Could not encode F1Reset structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
else
{
- DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1Reset\n");
- for(idx=0; idx< encBufSize; idx++)
- {
- DU_LOG("%x",encBuf[idx]);
- }
+ DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for F1Reset\n");
+ for(idx=0; idx< encBufSize; idx++)
+ {
+ DU_LOG("%x",encBuf[idx]);
+ }
}
- if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK)
+ /* TODO : Hardcoding DU ID to 1 for messages other than F1 Setup Response. This will be made generic in future gerrit */
+ if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL, DU_ID) != ROK)
{
- DU_LOG("\nERROR --> F1AP : Sending F1 Reset request failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Sending F1 Reset request failed");
+ break;
}
ret = ROK;
*
* ****************************************************************/
-uint8_t fillMasterCellGroup(uint8_t ueId, OCTET_STRING_t *masterCellGroup)
+uint8_t fillMasterCellGroup(CuUeCb *ueCb, OCTET_STRING_t *masterCellGroup)
{
uint8_t ret = ROK;
masterCellGroup->buf = NULLP;
- if(ueCb[ueId-1].f1apMsgDb.duToCuContainer.buf)
+ if(ueCb->f1apMsgDb.duToCuContainer.buf)
{
- masterCellGroup->size = ueCb[ueId-1].f1apMsgDb.duToCuContainer.size;
+ masterCellGroup->size = ueCb->f1apMsgDb.duToCuContainer.size;
CU_ALLOC(masterCellGroup->buf, masterCellGroup->size);
if(masterCellGroup->buf != NULLP)
{
- memcpy(masterCellGroup->buf, ueCb[ueId-1].f1apMsgDb.duToCuContainer.buf,\
- masterCellGroup->size);
+ memcpy(masterCellGroup->buf, ueCb->f1apMsgDb.duToCuContainer.buf, masterCellGroup->size);
}
else
{
- ret = RFAILED;
+ DU_LOG( "\nERROR --> F1AP : Master Cell Group buffer is NULL");
+ ret = RFAILED;
}
}
else
*
* ****************************************************************/
-uint8_t fillRRCSetupIE(uint8_t ueId, RRCSetup_IEs_t *rrcSetupIE)
+uint8_t fillRRCSetupIE(CuUeCb *ueCb, RRCSetup_IEs_t *rrcSetupIE)
{
uint8_t ret = ROK;
if(rrcSetupIE)
CU_ALLOC(rrcSetupIE->radioBearerConfig.srb_ToAddModList, sizeof(SRB_ToAddModList_t));
if(rrcSetupIE->radioBearerConfig.srb_ToAddModList != NULLP)
{
- ret = fillSrbCfg(SRB1, rrcSetupIE->radioBearerConfig.srb_ToAddModList);
+ ret = fillSrbCfg(SRB1, rrcSetupIE->radioBearerConfig.srb_ToAddModList);
}
if(ret == ROK)
{
- ret = fillMasterCellGroup(ueId, &rrcSetupIE->masterCellGroup);
+ ret = fillMasterCellGroup(ueCb, &rrcSetupIE->masterCellGroup);
}
else
{
- CU_FREE(rrcSetupIE->radioBearerConfig.srb_ToAddModList, sizeof(SRB_ToAddModList_t));
- ret = RFAILED;
+ CU_FREE(rrcSetupIE->radioBearerConfig.srb_ToAddModList, sizeof(SRB_ToAddModList_t));
+ ret = RFAILED;
}
}
return ret;
*
* ****************************************************************/
-uint8_t fillDlCcchRrcMsg(uint8_t ueId, RRCContainer_t *rrcContainer)
+uint8_t fillDlCcchRrcMsg(CuUeCb *ueCb, RRCContainer_t *rrcContainer)
{
uint8_t ret = ROK;
uint16_t idx2;
DL_CCCH_Message_t dl_CCCH_Msg;
- asn_enc_rval_t encRetVal;
+ asn_enc_rval_t encRetVal;
if(rrcContainer != NULLP)
{
if(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup != NULLP)
{
dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->rrc_TransactionIdentifier = 0;
- dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->criticalExtensions.\
- present = RRCSetup__criticalExtensions_PR_rrcSetup;
+ dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->criticalExtensions.present = \
+ RRCSetup__criticalExtensions_PR_rrcSetup;
+
/* Fill RRC Setup IE */
- CU_ALLOC(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->\
- criticalExtensions.choice.rrcSetup, sizeof(RRCSetup_IEs_t));
- if(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->\
- criticalExtensions.choice.rrcSetup != NULLP)
+ CU_ALLOC(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup, \
+ sizeof(RRCSetup_IEs_t));
+ if(dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup != NULLP)
{
- ret = fillRRCSetupIE(ueId, dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->\
- criticalExtensions.choice.rrcSetup);
+ ret = fillRRCSetupIE(ueCb, dl_CCCH_Msg.message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup);
if(ret == ROK)
{
*
* ****************************************************************/
-uint8_t BuildDLRRCContainer(uint8_t ueId, uint8_t rrcMsgType, RRCContainer_t *rrcContainer)
+uint8_t BuildDLRRCContainer(CuUeCb *ueCb, uint8_t rrcMsgType, RRCContainer_t *rrcContainer)
{
uint8_t ret, bufLen;
ret =ROK;
if(rrcMsgType == RRC_SETUP)
{
- ret = fillDlCcchRrcMsg(ueId, rrcContainer);
+ ret = fillDlCcchRrcMsg(ueCb, rrcContainer);
if(ret == RFAILED)
- DU_LOG("\nERROR --> F1AP: Failed to fill DL-CCCH Msg at RRC SETUP");
+ DU_LOG("\nERROR --> F1AP: Failed to fill DL-CCCH Msg at RRC SETUP");
}
else if(rrcMsgType == REGISTRATION_ACCEPT)
{
CU_ALLOC(rrcContainer->buf, rrcContainer->size);
if(rrcContainer->buf != NULLP)
{
- memset(rrcContainer->buf, 0, bufLen);
- memcpy(rrcContainer->buf, buf, bufLen);
+ memset(rrcContainer->buf, 0, bufLen);
+ memcpy(rrcContainer->buf, buf, bufLen);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failure for RRC Container buffer");
+ ret = RFAILED;
}
}
else if(rrcMsgType == RRC_RECONFIG)
{
/*Hardcoded RRC Container from reference logs*/
char buf[196]= {
- 0x00, 0x04, 0x00, 0xaa, 0x80, 0x40, 0x9a, 0x05, 0x20, 0x00, 0x05, 0xeb, 0xc0, 0x51, 0x50, 0x00,
- 0x03, 0x00, 0x03, 0xf7, 0x56, 0xec, 0x7f, 0x08, 0x42, 0x10, 0x80, 0x00, 0x10, 0x21, 0x47, 0x84,
- 0xd1, 0x00, 0x00, 0x00, 0x02, 0x81, 0x5d, 0x10, 0x0a, 0xc2, 0x44, 0x40, 0x2b, 0xb2, 0x07, 0x41,
- 0x87, 0xa8, 0x02, 0xc7, 0x00, 0x88, 0x05, 0x76, 0x40, 0xe8, 0x30, 0xf5, 0x40, 0x4c, 0x00, 0x10,
- 0x02, 0x00, 0xa5, 0x83, 0xe0, 0x60, 0x02, 0x10, 0x72, 0x01, 0x0c, 0xa0, 0xa0, 0xd8, 0x00, 0x00,
- 0x00, 0x01, 0x0f, 0x02, 0x3c, 0x01, 0x80, 0x10, 0x82, 0xb0, 0x40, 0x00, 0x00, 0x02, 0x1e, 0x04,
- 0x78, 0x07, 0x00, 0x21, 0x05, 0x61, 0x00, 0x00, 0x00, 0x04, 0x3c, 0x08, 0xf0, 0x16, 0x00, 0x42,
- 0x0a, 0xc3, 0x00, 0x00, 0x00, 0x08, 0x78, 0x11, 0xe0, 0x3c, 0x00, 0x84, 0x14, 0x00, 0x07, 0xe5,
- 0xc0, 0xa0, 0xd8, 0x42, 0x20, 0x02, 0x80, 0xa0, 0x02, 0x24, 0x47, 0xa0, 0x20, 0x27, 0xa1, 0x22,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x24, 0x41, 0x20, 0xc0, 0x80, 0x00, 0x20, 0x80,
- 0x00, 0x25, 0x20, 0xa0, 0x38, 0x00, 0x00, 0x00, 0x44, 0xa2, 0x82, 0x69, 0xee, 0x0c, 0xad, 0xca,
- 0x4c, 0x2c, 0x8d, 0x2e, 0x6f, 0x2e, 0x69, 0x2d, 0xce, 0x8c, 0xae, 0x4d, 0xcc, 0xae, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0x00};
+ 0x00, 0x04, 0x00, 0xaa, 0x80, 0x40, 0x9a, 0x05, 0x20, 0x00, 0x05, 0xeb, 0xc0, 0x51, 0x50, 0x00,
+ 0x03, 0x00, 0x03, 0xf7, 0x56, 0xec, 0x7f, 0x08, 0x42, 0x10, 0x80, 0x00, 0x10, 0x21, 0x47, 0x84,
+ 0xd1, 0x00, 0x00, 0x00, 0x02, 0x81, 0x5d, 0x10, 0x0a, 0xc2, 0x44, 0x40, 0x2b, 0xb2, 0x07, 0x41,
+ 0x87, 0xa8, 0x02, 0xc7, 0x00, 0x88, 0x05, 0x76, 0x40, 0xe8, 0x30, 0xf5, 0x40, 0x4c, 0x00, 0x10,
+ 0x02, 0x00, 0xa5, 0x83, 0xe0, 0x60, 0x02, 0x10, 0x72, 0x01, 0x0c, 0xa0, 0xa0, 0xd8, 0x00, 0x00,
+ 0x00, 0x01, 0x0f, 0x02, 0x3c, 0x01, 0x80, 0x10, 0x82, 0xb0, 0x40, 0x00, 0x00, 0x02, 0x1e, 0x04,
+ 0x78, 0x07, 0x00, 0x21, 0x05, 0x61, 0x00, 0x00, 0x00, 0x04, 0x3c, 0x08, 0xf0, 0x16, 0x00, 0x42,
+ 0x0a, 0xc3, 0x00, 0x00, 0x00, 0x08, 0x78, 0x11, 0xe0, 0x3c, 0x00, 0x84, 0x14, 0x00, 0x07, 0xe5,
+ 0xc0, 0xa0, 0xd8, 0x42, 0x20, 0x02, 0x80, 0xa0, 0x02, 0x24, 0x47, 0xa0, 0x20, 0x27, 0xa1, 0x22,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x24, 0x41, 0x20, 0xc0, 0x80, 0x00, 0x20, 0x80,
+ 0x00, 0x25, 0x20, 0xa0, 0x38, 0x00, 0x00, 0x00, 0x44, 0xa2, 0x82, 0x69, 0xee, 0x0c, 0xad, 0xca,
+ 0x4c, 0x2c, 0x8d, 0x2e, 0x6f, 0x2e, 0x69, 0x2d, 0xce, 0x8c, 0xae, 0x4d, 0xcc, 0xae, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00};
bufLen =196;
rrcContainer->size = bufLen;
CU_ALLOC(rrcContainer->buf, rrcContainer->size);
if(rrcContainer->buf != NULLP)
{
- memset(rrcContainer->buf, 0, bufLen);
- memcpy(rrcContainer->buf, buf, bufLen);
+ memset(rrcContainer->buf, 0, bufLen);
+ memcpy(rrcContainer->buf, buf, bufLen);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failure for RRC Container buffer");
+ ret = RFAILED;
}
}
return ret;
}
+/*******************************************************************
+ *
+ * @brief Frees the DLRRCMessageTransfer
+ *
+ * @details
+ *
+ * Function : freeDlRrcMessageTransfer
+ *
+ * Functionality: Frees the DLRRCMessageTransfer
+ *
+ * @params[in]
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void freeDlRrcMessageTransfer(F1AP_PDU_t *f1apMsg)
+{
+ uint8_t idx=0;
+ DLRRCMessageTransfer_t *dlRRCMsg = NULLP;
+
+ if(f1apMsg)
+ {
+ dlRRCMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
+ if(dlRRCMsg->protocolIEs.list.array)
+ {
+ idx = 3;
+ CU_FREE(dlRRCMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \
+ dlRRCMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+ for(idx=0; idx<dlRRCMsg->protocolIEs.list.count; idx++)
+ {
+ CU_FREE(dlRRCMsg->protocolIEs.list.array[idx], sizeof(DLRRCMessageTransferIEs_t));
+ }
+ CU_FREE(dlRRCMsg->protocolIEs.list.array, dlRRCMsg->protocolIEs.list.size);
+ }
+ CU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+ }
+}
+
/*******************************************************************
*
* @brief Builds and sends the DLRRCMessageTransfer
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendDLRRCMessageTransfer(uint8_t ueId, uint8_t srbId, uint8_t rrcMsgType)
+uint8_t BuildAndSendDLRRCMessageTransfer(uint32_t duId, CuUeCb *ueCb, uint8_t srbId, uint8_t rrcMsgType)
{
uint8_t elementCnt = 0;
uint8_t ieId;
}
f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
- CU_ALLOC(f1apMsg->choice.initiatingMessage,
- sizeof(InitiatingMessage_t));
+ CU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
if(f1apMsg->choice.initiatingMessage == NULLP)
{
DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
CU_ALLOC(dlRRCMsg->protocolIEs.list.array[idx], sizeof(DLRRCMessageTransferIEs_t));
if(dlRRCMsg->protocolIEs.list.array[idx] == NULLP)
{
- for(ieId=0; ieId<idx; ieId++)
- {
- CU_FREE(dlRRCMsg->protocolIEs.list.array[ieId],\
- sizeof(DLRRCMessageTransferIEs_t));
- }
- CU_FREE(dlRRCMsg->protocolIEs.list.array,\
- dlRRCMsg->protocolIEs.list.size);
- CU_FREE(f1apMsg->choice.initiatingMessage,\
- sizeof(InitiatingMessage_t));
- CU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
- return RFAILED;
+ for(ieId=0; ieId<idx; ieId++)
+ {
+ CU_FREE(dlRRCMsg->protocolIEs.list.array[ieId], sizeof(DLRRCMessageTransferIEs_t));
+ }
+ CU_FREE(dlRRCMsg->protocolIEs.list.array, dlRRCMsg->protocolIEs.list.size);
+ CU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
+ CU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
+ return RFAILED;
}
}
/* GNB CU UE F1AP ID */
idx = 0;
dlRRCMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
- dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
- DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
- dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = ueId;
+ dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.present = DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
/* GNB DU UE F1AP ID */
idx++;
- dlRRCMsg->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
- dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
- DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
- dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = ueId;
+ dlRRCMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+ dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.present = DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;;
/* SRBID */
idx++;
dlRRCMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_SRBID;
- dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
- DLRRCMessageTransferIEs__value_PR_SRBID;
+ dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.present = DLRRCMessageTransferIEs__value_PR_SRBID;
dlRRCMsg->protocolIEs.list.array[idx]->value.choice.SRBID = srbId;
/* RRCContainer */
idx++;
dlRRCMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_RRCContainer;
- dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
- DLRRCMessageTransferIEs__value_PR_RRCContainer;
- BuildDLRRCContainer(ueId, rrcMsgType, &dlRRCMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer);
+ dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.present = DLRRCMessageTransferIEs__value_PR_RRCContainer;
+ BuildDLRRCContainer(ueCb, rrcMsgType, &dlRRCMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer);
xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
memset(encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
- encBuf);
+ encBuf);
/* Encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
DU_LOG( "\nERROR --> F1AP : Could not encode DL RRC Message Transfer structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
return RFAILED;
}
else
DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for DL RRC Message transfer\n");
for(int i=0; i< encBufSize; i++)
{
- DU_LOG("%x",encBuf[i]);
+ DU_LOG("%x",encBuf[i]);
}
}
/* Sending msg */
- if(SendF1APMsg(CU_APP_MEM_REG,CU_POOL) != ROK)
+ if(SendF1APMsg(CU_APP_MEM_REG,CU_POOL, duId) != ROK)
{
DU_LOG("\nERROR --> F1AP : Sending DL RRC Message Transfer Failed");
return RFAILED;
}
-
+ freeDlRrcMessageTransfer(f1apMsg);
return ROK;
}/* End of BuildAndSendDLRRCMessageTransfer */
*
* ****************************************************************/
-uint8_t setDlRRCMsgType(uint8_t ueId)
+uint8_t setDlRRCMsgType(CuUeCb *ueCb)
{
uint8_t rrcMsgType = 0;
- switch(ueCb[ueId -1].f1apMsgDb.dlRrcMsgCount)
+ switch(ueCb->f1apMsgDb.dlRrcMsgCount)
{
case RRC_SETUP:
- rrcMsgType = RRC_SETUP;
- break;
+ rrcMsgType = RRC_SETUP;
+ break;
case REGISTRATION_ACCEPT:
- rrcMsgType = REGISTRATION_ACCEPT;
- break;
+ rrcMsgType = REGISTRATION_ACCEPT;
+ break;
case UE_CONTEXT_SETUP_REQ:
- rrcMsgType = UE_CONTEXT_SETUP_REQ;
- break;
+ rrcMsgType = UE_CONTEXT_SETUP_REQ;
+ break;
case SECURITY_MODE_COMPLETE:
- rrcMsgType = SECURITY_MODE_COMPLETE;
- break;
+ rrcMsgType = SECURITY_MODE_COMPLETE;
+ break;
case RRC_RECONFIG:
- rrcMsgType = RRC_RECONFIG;
- break;
+ rrcMsgType = RRC_RECONFIG;
+ break;
+ case RRC_RECONFIG_COMPLETE:
+ rrcMsgType = RRC_RECONFIG_COMPLETE;
+ break;
case UE_CONTEXT_MOD_REQ:
- rrcMsgType = UE_CONTEXT_MOD_REQ;
- break;
+ rrcMsgType = UE_CONTEXT_MOD_REQ;
+ break;
default:
- break;
+ break;
}
return rrcMsgType;
}
*
* ****************************************************************/
-uint8_t procInitULRRCMsg(F1AP_PDU_t *f1apMsg)
+uint8_t procInitULRRCMsg(uint32_t duId, F1AP_PDU_t *f1apMsg)
{
- uint8_t idx, rrcMsgType, gnbDuUeF1apId;
+ uint8_t idx,cellIdx=0, duIdx=0, rrcMsgType, gnbDuUeF1apId;
uint8_t ret =ROK;
+ uint32_t nrCellId, crnti;
+ DuDb *duDb;
+ CuCellCb *cellCb;
+ CuUeCb *ueCb;
InitialULRRCMessageTransfer_t *initULRRCMsg = NULLP;
- DU_LOG("\nINFO --> F1AP : filling the required values in DB in procInitULRRCMsg");
+ DU_LOG("\nINFO --> F1AP : filling the required values in DB in procInitULRRCMsg");
+
+ SEARCH_DU_DB(duIdx, duId, duDb);
initULRRCMsg = &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
for(idx=0; idx < initULRRCMsg->protocolIEs.list.count; idx++)
case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
gnbDuUeF1apId = initULRRCMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
break;
+
case ProtocolIE_ID_id_NRCGI:
+ nrCellId = initULRRCMsg->protocolIEs.list.array[idx]->value.choice.NRCGI.nRCellIdentity.buf[4] >>
+ initULRRCMsg->protocolIEs.list.array[idx]->value.choice.NRCGI.nRCellIdentity.bits_unused;
+ SEARCH_CELL_DB(cellIdx, duDb, nrCellId, cellCb);
+ if(cellCb == NULLP)
+ return RFAILED;
break;
+
case ProtocolIE_ID_id_C_RNTI:
+ crnti = initULRRCMsg->protocolIEs.list.array[idx]->value.choice.C_RNTI;
+ if(duDb->ueCb[gnbDuUeF1apId-1].gnbDuUeF1apId == 0)
+ {
+ ueCb = &duDb->ueCb[gnbDuUeF1apId-1];
+ memset(ueCb, 0, sizeof(CuUeCb));
+ ueCb->cellCb = cellCb;
+ ueCb->crnti = crnti;
+ ueCb->gnbDuUeF1apId = gnbDuUeF1apId;
+ ueCb->gnbCuUeF1apId = ++cuCb.gnbCuUeF1apIdGenerator;
+ ueCb->state = UE_ATTACH_IN_PROGRESS;
+ (duDb->numUe)++;
+
+ cellCb->ueCb[cellCb->numUe] = ueCb;
+ cellCb->numUe++;
+ }
break;
+
case ProtocolIE_ID_id_RRCContainer:
break;
+
case ProtocolIE_ID_id_DUtoCURRCContainer:
{
- if((initULRRCMsg->protocolIEs.list.array[idx]->value.choice\
- .DUtoCURRCContainer.size > 0) && (initULRRCMsg->protocolIEs\
- .list.array[idx]->value.choice.DUtoCURRCContainer.buf != NULLP))
+ if((initULRRCMsg->protocolIEs.list.array[idx]->value.choice.DUtoCURRCContainer.size > 0) && \
+ (initULRRCMsg->protocolIEs.list.array[idx]->value.choice.DUtoCURRCContainer.buf != NULLP))
{
DU_LOG("\nINFO --> Received Du to Cu RRC Container ");
- ueCb[gnbDuUeF1apId-1].ueId = gnbDuUeF1apId;
- ueCb[gnbDuUeF1apId-1].f1apMsgDb.duToCuContainer.size = initULRRCMsg->protocolIEs\
- .list.array[idx]->value.choice.DUtoCURRCContainer.size;
- CU_ALLOC(ueCb[gnbDuUeF1apId-1].f1apMsgDb.duToCuContainer.buf, \
- ueCb[gnbDuUeF1apId-1].f1apMsgDb.duToCuContainer.size);
- if(ueCb[gnbDuUeF1apId-1].f1apMsgDb.duToCuContainer.buf != NULLP)
+ ueCb->f1apMsgDb.duToCuContainer.size = initULRRCMsg->protocolIEs.list.array[idx]->value.choice.DUtoCURRCContainer.size;
+ CU_ALLOC(ueCb->f1apMsgDb.duToCuContainer.buf, ueCb->f1apMsgDb.duToCuContainer.size);
+ if(ueCb->f1apMsgDb.duToCuContainer.buf != NULLP)
{
- memcpy(ueCb[gnbDuUeF1apId-1].f1apMsgDb.duToCuContainer.buf, initULRRCMsg->protocolIEs\
- .list.array[idx]->value.choice.DUtoCURRCContainer.buf, ueCb[gnbDuUeF1apId-1].f1apMsgDb\
- .duToCuContainer.size);
+ memcpy(ueCb->f1apMsgDb.duToCuContainer.buf, \
+ initULRRCMsg->protocolIEs.list.array[idx]->value.choice.DUtoCURRCContainer.buf, \
+ ueCb->f1apMsgDb.duToCuContainer.size);
}
}
else
}
break;
}
+
default:
DU_LOG("\nERROR --> Invalid Event %ld", initULRRCMsg->protocolIEs.list.array[idx]->id);
break;
}
}
+
if(ret == ROK)
{
- ueCb[gnbDuUeF1apId-1].f1apMsgDb.dlRrcMsgCount++;
- rrcMsgType = setDlRRCMsgType(gnbDuUeF1apId);
- ret = BuildAndSendDLRRCMessageTransfer(gnbDuUeF1apId, SRB0, rrcMsgType);
+ ueCb->f1apMsgDb.dlRrcMsgCount++;
+ rrcMsgType = setDlRRCMsgType(ueCb);
+ ret = BuildAndSendDLRRCMessageTransfer(duId, ueCb, SRB0, rrcMsgType);
}
return ret;
}
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildNrcgi(NRCGI_t *nrcgi)
+uint8_t BuildNrcgi(NRCGI_t *nrcgi, uint32_t nrCellId)
{
uint8_t ret;
uint8_t unused_bits = 4;
uint8_t byteSize = 5;
- uint8_t val = 1;
+ uint8_t val = nrCellId << unused_bits;
+
/* Allocate Buffer Memory */
nrcgi->pLMN_Identity.size = 3 * sizeof(uint8_t);
CU_ALLOC(nrcgi->pLMN_Identity.buf, nrcgi->pLMN_Identity.size);
{
return RFAILED;
}
- ret = buildPlmnId(cuCfgParams.plmn , nrcgi->pLMN_Identity.buf);
+ ret = buildPlmnId(cuCb.cuCfgParams.plmn , nrcgi->pLMN_Identity.buf);
if(ret != ROK)
{
{
return RFAILED;
}
-#if 0
- ret = fillBitString(&nrcgi->nRCellIdentity, unused, byteSize, val);
- if(ret != ROK)
- {
- return RFAILED;
- }
-#endif
- memset(nrcgi->nRCellIdentity.buf, 0, nrcgi->nRCellIdentity.size);
- nrcgi->nRCellIdentity.buf[0] |= val;
- nrcgi->nRCellIdentity.bits_unused = unused_bits;
+ fillBitString(&nrcgi->nRCellIdentity, unused_bits, byteSize, val);
return ROK;
}
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildSplCellList(SCell_ToBeSetup_List_t *spCellLst)
+uint8_t BuildSplCellList(CuUeCb *ueCb, SCell_ToBeSetup_List_t *spCellLst)
{
uint8_t cellCnt;
uint8_t idx;
idx = 0;
spCellLst->list.array[idx]->id = ProtocolIE_ID_id_SCell_ToBeSetup_Item;
spCellLst->list.array[idx]->criticality = Criticality_ignore;
- spCellLst->list.array[idx]->value.present =\
- SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item;
+ spCellLst->list.array[idx]->value.present = SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item;
+
/* Special Cell ID -NRCGI */
- ret = BuildNrcgi(&spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
+ ret = BuildNrcgi(&spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCell_ID, ueCb->cellCb->nrCellId);
if(ret != ROK)
{
return RFAILED;
{
uint8_t idx;
uint8_t srbCnt;
+
srbCnt = 1;
srbSet->list.count = srbCnt;
srbSet->list.size = srbCnt*sizeof(SRBs_ToBeSetup_ItemIEs_t *);
{
return RFAILED;
}
+
for(idx=0; idx<srbCnt; idx++)
{
CU_ALLOC(srbSet->list.array[idx],sizeof(SRBs_ToBeSetup_ItemIEs_t));
return RFAILED;
}
}
+
idx = 0;
srbSet->list.array[idx]->id = ProtocolIE_ID_id_SRBs_ToBeSetup_Item;
srbSet->list.array[idx]->criticality = Criticality_ignore;
- srbSet->list.array[idx]->value.present = \
- SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item;
+ srbSet->list.array[idx]->value.present = SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item;
srbSet->list.array[idx]->value.choice.SRBs_ToBeSetup_Item.sRBID = 2;
return ROK;
}/* End of BuildSRBSetup*/
ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
gTP_TEID.buf[2] = 0;
ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[3] = cuCfgParams.egtpParams.currTunnelId++;
+ gTP_TEID.buf[3] = cuCb.cuCfgParams.egtpParams.currTunnelId++;
return ROK;
}/*End of BuildULTnlInfo*/
}
/*SNSSAI*/
BuildSNSSAIret = BuildSNSSAI(&drbSetItem->qoSInformation.choice.\
- choice_extension->value.choice.DRB_Information.sNSSAI, cuCfgParams.snssaiList[0]);
+ choice_extension->value.choice.DRB_Information.sNSSAI, cuCb.snssaiList[0]);
if(BuildSNSSAIret != ROK)
{
DU_LOG("\nERROR --> F1AP : Failed to build SNSSAI Info in BuildDRBSetup");
resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->cyclicShift_n2\
= SRS_CYCLIC_SHIFT_N2;
- resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = \
- 0;
+ resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = PUSCH_START_SYMBOL;
resourceList->list.array[rsrcIdx]->resourceMapping.nrofSymbols = \
SRS_Resource__resourceMapping__nrofSymbols_n1;
resourceList->list.array[rsrcIdx]->resourceMapping.repetitionFactor = \
CU_ALLOC(tagList->list.array[idx], sizeof(struct TAG));
if(!tagList->list.array[idx])
{
- DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
- return RFAILED;
+ DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildTagConfig");
+ return RFAILED;
}
}
CU_ALLOC(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
if(!schReqList->list.array[idx])
{
- DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
- return RFAILED;
+ DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildSchedulingReqConfig");
+ return RFAILED;
}
}
CU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
if(!cellGrpCfg.rlc_BearerToAddModList)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation failure in CellGrpConfig");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation failure in CellGrpConfig");
+ break;
}
if(BuildRlcBearerToAddModList(cellGrpCfg.rlc_BearerToAddModList) != ROK)
{
- DU_LOG("\nERROR --> F1AP : fillCellGrpCfg failed");
- break;
+ DU_LOG("\nERROR --> F1AP : fillCellGrpCfg failed");
+ break;
}
cellGrpCfg.rlc_BearerToReleaseList = NULLP;
CU_ALLOC(cellGrpCfg.mac_CellGroupConfig, sizeof(MAC_CellGroupConfig_t));
if(!cellGrpCfg.mac_CellGroupConfig)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation failure in fillCellGrpCfg");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation failure in fillCellGrpCfg");
+ break;
}
if(BuildMacCellGrpCfg(cellGrpCfg.mac_CellGroupConfig) != ROK)
{
- DU_LOG("\nERROR --> F1AP : BuildMacCellGrpCfg failed");
- break;
+ DU_LOG("\nERROR --> F1AP : BuildMacCellGrpCfg failed");
+ break;
}
-
cellGrpCfg.physicalCellGroupConfig = NULLP;
CU_ALLOC(cellGrpCfg.physicalCellGroupConfig, sizeof(PhysicalCellGroupConfig_t));
if(!cellGrpCfg.physicalCellGroupConfig)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+ break;
}
if(BuildPhyCellGrpCfg(cellGrpCfg.physicalCellGroupConfig) != ROK)
{
- DU_LOG("\nERROR --> F1AP : BuildPhyCellGrpCfg failed");
- break;
+ DU_LOG("\nERROR --> F1AP : BuildPhyCellGrpCfg failed");
+ break;
}
cellGrpCfg.spCellConfig = NULLP;
CU_ALLOC(cellGrpCfg.spCellConfig, sizeof(SpCellConfig_t));
if(!cellGrpCfg.spCellConfig)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+ break;
}
if(BuildSpCellCfg(cellGrpCfg.spCellConfig) != ROK)
{
- DU_LOG("\nERROR --> F1AP : BuildSpCellCfg failed");
- break;
+ DU_LOG("\nERROR --> F1AP : BuildSpCellCfg failed");
+ break;
}
cellGrpCfg.sCellToAddModList = NULLP;
/* Encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG( "\nERROR --> F1AP : Could not encode DuToCuRrcContainer (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
+ DU_LOG( "\nERROR --> F1AP : Could not encode DuToCuRrcContainer (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
else
{
- DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for DuToCuRrcContainer\n");
- for(int i=0; i< encBufSize; i++)
- {
- DU_LOG("%x",encBuf[i]);
- }
+ DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for DuToCuRrcContainer\n");
+ for(int i=0; i< encBufSize; i++)
+ {
+ DU_LOG("%x",encBuf[i]);
+ }
}
cellGrp->size = encBufSize;
CU_ALLOC(cellGrp->buf, cellGrp->size);
if(!cellGrp->buf)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDuToCuRrcContainer");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDuToCuRrcContainer");
+ break;
}
memcpy(cellGrp->buf, encBuf, cellGrp->size);
ret = ROK;
break;
}
FreeMemCellGrpCfg(&cellGrpCfg);
- return ROK;
+ return ret;
}
/*******************************************************************
if(!ueCapablityList.list.array)
{
DU_LOG("\nERROR --> Memory allocation failed in fillUeCapRatContList");
- ret = RFAILED;
- break;
+ ret = RFAILED;
+ break;
}
for(idx=0; idx<elementCnt; idx++)
CU_ALLOC(ueCapablityList.list.array[idx], sizeof(UE_CapabilityRAT_Container_t));
if(ueCapablityList.list.array[idx] == NULLP)
{
- DU_LOG("\nERROR --> Memory allocation failed in fillUeCapRatContList");
+ DU_LOG("\nERROR --> Memory allocation failed in fillUeCapRatContList");
ret = RFAILED;
- break;
+ break;
}
}
idx = 0;
cmMemset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
encRetVal = aper_encode(&asn_DEF_UE_CapabilityRAT_ContainerListRRC, 0, \
- &ueCapablityList, PrepFinalEncBuf, encBuf);
+ &ueCapablityList, PrepFinalEncBuf, encBuf);
/* Encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
DU_LOG( "\nERROR --> F1AP : Could not encode UE Capability RAT Container (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
break;
}
else
DU_LOG("%x",encBuf[i]);
}
}
-
+
ueCapablityListBuf->size = encBufSize;
CU_ALLOC(ueCapablityListBuf->buf, ueCapablityListBuf->size);
if(!ueCapablityListBuf->buf)
if(rrcMsg->iE_Extensions->list.array == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for CUtoDURRCInformation_ExtIEs failed");
- ret = RFAILED;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for CUtoDURRCInformation_ExtIEs failed");
+ ret = RFAILED;
}
for(idx=0; idx<elementCnt; idx++)
{
- CU_ALLOC(rrcMsg->iE_Extensions->list.array[idx], sizeof(CUtoDURRCInformation_ExtIEs_t));
- if(rrcMsg->iE_Extensions->list.array[idx] == NULLP)
- {
- ret = RFAILED;
- }
+ CU_ALLOC(rrcMsg->iE_Extensions->list.array[idx], sizeof(CUtoDURRCInformation_ExtIEs_t));
+ if(rrcMsg->iE_Extensions->list.array[idx] == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation for array elements failed");
+ ret = RFAILED;
+ }
}
idx = 0;
/* Filling CellGroupConfig_t IE */
rrcMsg->iE_Extensions->list.array[idx]->id = ProtocolIE_ID_id_CellGroupConfig;
rrcMsg->iE_Extensions->list.array[idx]->criticality = Criticality_ignore;
rrcMsg->iE_Extensions->list.array[idx]->extensionValue.present =\
- CUtoDURRCInformation_ExtIEs__extensionValue_PR_CellGroupConfig;
+ CUtoDURRCInformation_ExtIEs__extensionValue_PR_CellGroupConfig;
ret = fillCellGrpCfg(&rrcMsg->iE_Extensions->list.array[idx]->extensionValue.choice.CellGroupConfig);
}
return ret;
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendUeContextSetupReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \
- uint16_t rrcContLen, uint8_t *rrcContainer)
+uint8_t BuildAndSendUeContextSetupReq(uint32_t duId, CuUeCb *ueCb, uint16_t rrcContLen, uint8_t *rrcContainer)
{
uint8_t Nrcgiret;
uint8_t SplCellListret;
CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
if(f1apMsg == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
+ break;
}
f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
CU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
if(f1apMsg->choice.initiatingMessage == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
+ break;
}
- f1apMsg->choice.initiatingMessage->procedureCode = \
- ProcedureCode_id_UEContextSetup;
+ f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextSetup;
f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
- f1apMsg->choice.initiatingMessage->value.present = \
- InitiatingMessage__value_PR_UEContextSetupRequest;
- ueSetReq =
- &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
+ f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_UEContextSetupRequest;
+
+ ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
elementCnt = 12;
ueSetReq->protocolIEs.list.count = elementCnt;
- ueSetReq->protocolIEs.list.size = \
- elementCnt * sizeof(UEContextSetupRequestIEs_t *);
+ ueSetReq->protocolIEs.list.size = elementCnt * sizeof(UEContextSetupRequestIEs_t *);
/* Initialize the UESetup members */
CU_ALLOC(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
if(ueSetReq->protocolIEs.list.array == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for UE Context SetupRequest failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for UE Context SetupRequest failed");
+ break;
}
for(idx1=0; idx1<elementCnt; idx1++)
{
- CU_ALLOC(ueSetReq->protocolIEs.list.array[idx1],sizeof(UEContextSetupRequestIEs_t));
- if(ueSetReq->protocolIEs.list.array[idx1] == NULLP)
- {
- break;
- }
+ CU_ALLOC(ueSetReq->protocolIEs.list.array[idx1],sizeof(UEContextSetupRequestIEs_t));
+ if(ueSetReq->protocolIEs.list.array[idx1] == NULLP)
+ {
+ break;
+ }
}
idx = 0;
/*GNB CU UE F1AP ID*/
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = cuUeF1apId;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
/*GNB DU UE F1AP ID*/
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = duUeF1apId;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;
/*Special Cell ID*/
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_SpCell_ID;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_SpCell_ID;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_NRCGI;
- Nrcgiret = BuildNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_NRCGI;
+ Nrcgiret = BuildNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI, ueCb->cellCb->nrCellId);
if(Nrcgiret != ROK)
{
- break;
+ break;
}
/*Served Cell Index*/
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_ServCellIndex;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_ServCellIndex;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_ServCellIndex;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.ServCellIndex = \
- CELL_INDEX;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_ServCellIndex;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.ServCellIndex = CELL_INDEX;
/*CellULConfigured*/
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_SpCellULConfigured;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_SpCellULConfigured;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_CellULConfigured;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.CellULConfigured = \
- CellULConfigured_none;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_CellULConfigured;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.CellULConfigured = CellULConfigured_none;
/*CUtoDURRCContainer*/
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_CUtoDURRCInformation;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_CUtoDURRCInformation;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation;
if(fillCuToDuContainer(&ueSetReq->protocolIEs.list.array[idx]->value.choice.CUtoDURRCInformation))
{
- break;
+ break;
}
/*Special Cells to be SetupList*/
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_SCell_ToBeSetup_List;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_SCell_ToBeSetup_List;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List;
- SplCellListret = BuildSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List;
+ SplCellListret = BuildSplCellList(ueCb, &ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
if(SplCellListret != ROK)
{
- break;
+ break;
}
+
/*SRBs To Be Setup List*/
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_SRBs_ToBeSetup_List;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_SRBs_ToBeSetup_List;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List;
- SrbSetupret = BuildSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List;
+ SrbSetupret = BuildSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
if(SrbSetupret != ROK)
{
- break;
+ break;
}
+
/*DRBs to Be Setup List*/
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_DRBs_ToBeSetup_List;
+ 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;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List;
ret1 = BuildDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
if(ret1 != ROK)
{
- break;
+ break;
}
/* RRC Container for security mode */
idx++;
ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_RRCContainer;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_RRCContainer;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_RRCContainer;
+
char secModeBuf[9]={0x00, 0x02, 0x22, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00};
bufLen =9;
ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size = bufLen;
CU_ALLOC(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,
- ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
if(!ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for BuildAndSendUeContextSetupReq failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for BuildAndSendUeContextSetupReq failed");
+ break;
}
memset(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, 0, bufLen);
memcpy(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, secModeBuf, bufLen);
/* RRC delivery status request */
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_RRCDeliveryStatusRequest;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_RRCDeliveryStatusRequest;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_RRCDeliveryStatusRequest;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCDeliveryStatusRequest = \
- RRCDeliveryStatusRequest_true;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_RRCDeliveryStatusRequest;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCDeliveryStatusRequest = RRCDeliveryStatusRequest_true;
/* Bit Rate hardcoded as in reference logs */
idx++;
- ueSetReq->protocolIEs.list.array[idx]->id = \
- ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL;
+ ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
- ueSetReq->protocolIEs.list.array[idx]->value.present = \
- UEContextSetupRequestIEs__value_PR_BitRate;
+ ueSetReq->protocolIEs.list.array[idx]->value.present = UEContextSetupRequestIEs__value_PR_BitRate;
+
char bitRateBuf[4]= {0x3B, 0x37, 0xF4, 0xCD};
bufLen = 4;
ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.size = bufLen;
CU_ALLOC(ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.buf,\
- ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.size);
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.size);
if(!ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.buf)
{
- DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Bit Rate in BuildAndSendUeContextSetupReq()");
- break;
+ DU_LOG("\nERROR --> F1AP : Failed to allocate memory for Bit Rate in BuildAndSendUeContextSetupReq()");
+ break;
}
memset(ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.buf, 0, bufLen);
memcpy(ueSetReq->protocolIEs.list.array[idx]->value.choice.BitRate.buf, bitRateBuf, bufLen);
/* Encode the F1SetupRequest type as APER */
memset(encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
- encBuf);
+ encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
+
/* Encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
+ DU_LOG( "\nERROR --> F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
else
{
- DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for UE Context Setup Request\n");
- for(int i=0; i< encBufSize; i++)
- {
- DU_LOG("%x",encBuf[i]);
- }
+ DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for UE Context Setup Request\n");
+ for(int i=0; i< encBufSize; i++)
+ {
+ DU_LOG("%x",encBuf[i]);
+ }
}
/* Sending msg */
- if(SendF1APMsg(CU_APP_MEM_REG,CU_POOL) != ROK)
+ if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL, duId) != ROK)
{
- DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Request Failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Sending UE Context Setup Request Failed");
+ break;
}
ret = ROK;
break;
* RFAILED - failure
*
* ****************************************************************/
-uint8_t procUeContextSetupResponse(F1AP_PDU_t *f1apMsg)
+uint8_t procUeContextSetupResponse(uint32_t duId, F1AP_PDU_t *f1apMsg)
{
- uint8_t idx, duUeF1apId;
+ uint8_t duIdx=0, idx, duUeF1apId;
+ DuDb *duDb;
+ CuUeCb *ueCb;
UEContextSetupResponse_t *ueCtxtSetupRsp = NULLP;
+
+ SEARCH_DU_DB(duIdx, duId, duDb);
ueCtxtSetupRsp = &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
for(idx=0; idx < ueCtxtSetupRsp->protocolIEs.list.count; idx++)
case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
{
duUeF1apId = ueCtxtSetupRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
+ ueCb = &duDb->ueCb[duUeF1apId-1];
break;
}
case ProtocolIE_ID_id_DRBs_Setup_List:
}
}
}
- ueCb[duUeF1apId-1].f1apMsgDb.dlRrcMsgCount++; /* keeping DL RRC Msg Count */
+ ueCb->f1apMsgDb.dlRrcMsgCount++; /* keeping DL RRC Msg Count */
return ROK;
}
*
* ****************************************************************/
-uint8_t procUlRrcMsg(F1AP_PDU_t *f1apMsg)
+uint8_t procUlRrcMsg(uint32_t duId, F1AP_PDU_t *f1apMsg)
{
- uint8_t idx, ret, srbId, rrcMsgType;
+ uint8_t idx, ret, srbId, rrcMsgType, duIdx=0;
uint8_t cuUeF1apId, duUeF1apId;
uint8_t *rrcContainer = NULLP;
uint16_t rrcContLen;
+ DuDb *duDb;
+ CuUeCb *ueCb;
ULRRCMessageTransfer_t *ulRrcMsg = NULLP;
ret = ROK;
+ SEARCH_DU_DB(duIdx, duId, duDb);
ulRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
for(idx=0; idx < ulRrcMsg->protocolIEs.list.count; idx++)
{
switch(ulRrcMsg->protocolIEs.list.array[idx]->id)
{
- case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
- {
- cuUeF1apId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
- break;
- }
- case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
- {
- duUeF1apId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
- break;
- }
- case ProtocolIE_ID_id_SRBID:
- srbId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
- break;
- case ProtocolIE_ID_id_RRCContainer:
- {
- rrcContLen = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
- CU_ALLOC(rrcContainer, rrcContLen)
- if(!rrcContainer)
- {
- DU_LOG("\nERROR --> F1AP : Failed to allocated memory in procUlRrcMsg");
- return RFAILED;
- }
- memcpy(rrcContainer, ulRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\
- rrcContLen);
- break;
- }
+ case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+ {
+ cuUeF1apId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
+ break;
+ }
+ case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+ {
+ duUeF1apId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
+ break;
+ }
+ case ProtocolIE_ID_id_SRBID:
+ srbId = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
+ break;
- default:
- DU_LOG("\nERROR --> F1AP : Invalid Event %ld", ulRrcMsg->protocolIEs.list.array[idx]->id);
- break;
+ case ProtocolIE_ID_id_RRCContainer:
+ {
+ rrcContLen = ulRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
+ CU_ALLOC(rrcContainer, rrcContLen);
+ if(!rrcContainer)
+ {
+ DU_LOG("\nERROR --> F1AP : Failed to allocated memory in procUlRrcMsg");
+ return RFAILED;
+ }
+ memcpy(rrcContainer, ulRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, rrcContLen);
+ break;
+ }
+
+ default:
+ DU_LOG("\nERROR --> F1AP : Invalid Event %ld", ulRrcMsg->protocolIEs.list.array[idx]->id);
+ break;
}
}
+
if(srbId == 1)
{
- ueCb[duUeF1apId-1].f1apMsgDb.dlRrcMsgCount++;
- rrcMsgType = setDlRRCMsgType(duUeF1apId);
+ ueCb = &duDb->ueCb[duUeF1apId-1];
+ ueCb->f1apMsgDb.dlRrcMsgCount++;
+ rrcMsgType = setDlRRCMsgType(ueCb);
if(rrcMsgType == REGISTRATION_ACCEPT)
{
DU_LOG("\nINFO --> F1AP: Sending DL RRC MSG for RRC Registration Accept");
- ret = BuildAndSendDLRRCMessageTransfer(duUeF1apId, srbId, rrcMsgType);
+ ret = BuildAndSendDLRRCMessageTransfer(duId, ueCb, srbId, rrcMsgType);
}
if(rrcMsgType == UE_CONTEXT_SETUP_REQ)
{
- DU_LOG("\nINFO --> F1AP: Sending Ue Context Setup Req");
- ret = BuildAndSendUeContextSetupReq(cuUeF1apId, duUeF1apId,\
- rrcContLen, rrcContainer);
+ DU_LOG("\nINFO --> F1AP: Sending Ue Context Setup Req");
+ ret = BuildAndSendUeContextSetupReq(duId, ueCb, rrcContLen, rrcContainer);
}
if(rrcMsgType == SECURITY_MODE_COMPLETE)
{
/* To trigger the DL RRC Msg for RRC Reconfig */
- ueCb[duUeF1apId-1].f1apMsgDb.dlRrcMsgCount++;
- rrcMsgType = setDlRRCMsgType(duUeF1apId);
+ ueCb->f1apMsgDb.dlRrcMsgCount++;
+ rrcMsgType = setDlRRCMsgType(ueCb);
if(rrcMsgType == RRC_RECONFIG)
{
DU_LOG("\nINFO --> F1AP: Sending DL RRC MSG for RRC Reconfig");
- BuildAndSendDLRRCMessageTransfer(duUeF1apId, srbId, rrcMsgType);
+ BuildAndSendDLRRCMessageTransfer(duId, ueCb, srbId, rrcMsgType);
}
}
- if(rrcMsgType == UE_CONTEXT_MOD_REQ)
+ if(rrcMsgType == RRC_RECONFIG_COMPLETE)
{
- DU_LOG("\nINFO --> F1AP: Sending UE Context Modification Request");
- BuildAndSendUeContextModificationReq(duUeF1apId);
+ ueCb->state = UE_ACTIVE;
+ ueCb->f1apMsgDb.dlRrcMsgCount++;
+ rrcMsgType = setDlRRCMsgType(ueCb);
+ if(rrcMsgType == UE_CONTEXT_MOD_REQ)
+ {
+ DU_LOG("\nINFO --> F1AP: Sending UE Context Modification Request");
+ BuildAndSendUeContextModificationReq(duId, ueCb, MODIFY_UE);
+ }
}
}
return ret;
CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
if(f1apMsg == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
+ break;
}
f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
CU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
if(f1apMsg->choice.successfulOutcome == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed");
+ break;
}
f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_Reset;
CU_ALLOC(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
if(f1ResetAck->protocolIEs.list.array == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for F1ResetAckIEs failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for F1ResetAckIEs failed");
+ break;
}
for(idx=0; idx<elementCnt; idx++)
{
- CU_ALLOC(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
- if(f1ResetAck->protocolIEs.list.array[idx] == NULLP)
- {
- break;
- }
+ CU_ALLOC(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
+ if(f1ResetAck->protocolIEs.list.array[idx] == NULLP)
+ {
+ break;
+ }
}
/*TransactionID*/
idx = 0;
/* Check encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nERROR --> F1AP : Could not encode F1ResetAck structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
+ DU_LOG("\nERROR --> F1AP : Could not encode F1ResetAck structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
else
{
- DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for F1ResetAck \n");
- for(int i=0; i< encBufSize; i++)
- {
- DU_LOG("%x",encBuf[i]);
- }
+ DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for F1ResetAck \n");
+ for(int i=0; i< encBufSize; i++)
+ {
+ DU_LOG("%x",encBuf[i]);
+ }
}
+
/* Sending msg */
- if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK)
+ /* TODO : Hardcoding DU ID to 1 for messages other than F1 Setup Response. This will be made generic in future gerrit */
+ if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL, DU_ID) != ROK)
{
- DU_LOG("\nERROR --> F1AP : Sending F1 Reset Response failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Sending F1 Reset Response failed");
+ break;
}
ret = ROK;
FreeF1ResetAck(f1apMsg);
return ret;
}
+
void FreeUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
{
uint8_t arrIdx =0;
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildUlTnlInfoforSetupMod(uint8_t ueId, ULUPTNLInformation_ToBeSetup_List_t *ulInfo, uint8_t actionType)
+uint8_t BuildUlTnlInfoforSetupMod(uint8_t ueId, uint8_t drbId, ULUPTNLInformation_ToBeSetup_List_t *ulInfo, uint8_t actionType)
{
uint8_t arrIdx;
uint8_t ulCnt;
{
/*TODO: DRB context to be stored in CU STUB so that tunnel Id can be easily
* fetched based on the Drb Id */
- if(ueId == 1)
- {
- /* Tunnel Id for DRB 2 of UE 1 is 2. Hence passing the same TeId */
- ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf[3] = 2;
- }
- else if(ueId == 2)
- {
- /* Tunnel Id for DRB 2 of UE 2 is 5. Hence passing the same TeId */
- ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf[3] = 5;
- }
- else if(ueId == 3)
- {
- /* Tunnel Id for DRB 2 of UE 3 is 8. Hence passing the same TeId */
- ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf[3] = 8;
- }
+ /*For For UE Id=1, DRB=2 is modified. For UE Id = 2, DRB=5 is modified and so on.*/
+ ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf[3]=\
+ (MAX_NUM_DRB_ADDED_PER_UE *(ueId - 1)) + drbId;
}
else
{
ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
- gTP_TEID.buf[3] = cuCfgParams.egtpParams.currTunnelId++;
+ gTP_TEID.buf[3] = cuCb.cuCfgParams.egtpParams.currTunnelId++;
}
return ROK;
}/*End of BuildULTnlInfo*/
uint8_t ret = ROK;
/*Drb Id */
- drbItem->dRBID = arrIdx + DRB3;
+ drbItem->dRBID = arrIdx + DRB_ID_TO_ADD_MOD;
/*qoSInformation*/
drbItem->qoSInformation.present = QoSInformation_PR_choice_extension;
/*SNSSAI*/
ret = BuildSNSSAI(&drbItem->qoSInformation.choice.\
- choice_extension->value.choice.DRB_Information.sNSSAI, cuCfgParams.snssaiList[1]);
+ choice_extension->value.choice.DRB_Information.sNSSAI, cuCb.snssaiList[1]);
if(ret != ROK)
{
DU_LOG("\nERROR --> F1AP : BuildSNSSAI failed");
}
/*ULUPTNLInformation To Be Setup List*/
- ret = BuildUlTnlInfoforSetupMod(ueId, &drbItem->uLUPTNLInformation_ToBeSetup_List, \
+ ret = BuildUlTnlInfoforSetupMod(ueId, drbItem->dRBID, &drbItem->uLUPTNLInformation_ToBeSetup_List, \
ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item);
if(ret != ROK)
{
if(drbSet->list.array[arrIdx] == NULLP)
{
DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupList for array idx [%d]", arrIdx);
- return RFAILED;
+ return RFAILED;
}
- }
- arrIdx = 0;
- ret = FillDrbItemList(ueId, arrIdx, (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx]);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> F1AP : FillDrbItemList failed");
+ ret = FillDrbItemList(ueId, arrIdx, (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx]);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : FillDrbItemList failed");
+ }
}
return ret;
*
* ****************************************************************/
-uint8_t FillDrbToBeModItem(uint8_t ueId, DRBs_ToBeModified_Item_t *drbItem)
+uint8_t FillDrbToBeModItem(uint8_t ueId, uint8_t arrIdx, DRBs_ToBeModified_Item_t *drbItem)
{
uint8_t ret = ROK;
/*Drb Id */
- drbItem->dRBID = DRB2;
+ drbItem->dRBID = DRB2 + arrIdx;
/*qoSInformation*/
drbItem->qoSInformation = NULLP;
/*SNSSAI*/
ret = BuildSNSSAI(&drbItem->qoSInformation->choice.\
- choice_extension->value.choice.DRB_Information.sNSSAI,cuCfgParams.snssaiList[0]);
+ choice_extension->value.choice.DRB_Information.sNSSAI, cuCb.snssaiList[0]);
if(ret != ROK)
{
DU_LOG("\nERROR --> F1AP : BuildSNSSAI failed");
}/* End of QoS */
/*ULUPTNLInformation To Be Setup List*/
- ret = BuildUlTnlInfoforSetupMod(ueId, &drbItem->uLUPTNLInformation_ToBeSetup_List,\
+ ret = BuildUlTnlInfoforSetupMod(ueId, drbItem->dRBID, &drbItem->uLUPTNLInformation_ToBeSetup_List,\
ProtocolIE_ID_id_DRBs_ToBeModified_Item);
if(ret != ROK)
{
*
* ****************************************************************/
-uint8_t FillDrbToBeModItemList(uint8_t ueId, struct DRBs_ToBeModified_ItemIEs *drbItemIe)
+uint8_t FillDrbToBeModItemList(uint8_t ueId, 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(ueId, &(drbItemIe->value.choice.DRBs_ToBeModified_Item)) != ROK)
+ if(FillDrbToBeModItem(ueId, arrIdx, &(drbItemIe->value.choice.DRBs_ToBeModified_Item)) != ROK)
{
DU_LOG("\nERROR --> F1AP : FillDrbToBeModItem failed");
return RFAILED;
uint8_t arrIdx =0;
uint8_t drbCnt =0;
- drbCnt = 1;
+ drbCnt = MAX_DRB_MODIFIED_UE_MOD_REQ;
drbSet->list.count = drbCnt;
drbSet->list.size = drbCnt * sizeof(DRBs_ToBeModified_ItemIEs_t *);
CU_ALLOC(drbSet->list.array, drbSet->list.size);
if(drbSet->list.array[arrIdx] == NULLP)
{
DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDrbToBeSetupList");
- return RFAILED;
+ return RFAILED;
}
- }
- arrIdx=0;
- ret = FillDrbToBeModItemList(ueId, (DRBs_ToBeModified_ItemIEs_t *)drbSet->list.array[arrIdx]);
- if(ret != ROK)
- {
- DU_LOG("\nERROR --> F1AP : FillDrbToBeModItemList failed");
+ ret = FillDrbToBeModItemList(ueId, arrIdx, (DRBs_ToBeModified_ItemIEs_t *)drbSet->list.array[arrIdx]);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : FillDrbToBeModItemList failed");
+ }
}
return ret;
CU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
}
}
+
/*******************************************************************
*
* @brief Builds the Ue Context Modification Req
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendUeContextModificationReq(uint8_t ueId)
+uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxtModAction action)
{
uint8_t ieIdx = 0;
uint8_t elementCnt = 0;
uint8_t ret = RFAILED;
+ CuUeCb *ueCb = (CuUeCb *)cuUeCb;
F1AP_PDU_t *f1apMsg = NULLP;
UEContextModificationRequest_t *ueContextModifyReq = NULLP;
CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
if(f1apMsg == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
+ break;
}
f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
CU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
if(f1apMsg->choice.initiatingMessage == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
+ break;
}
f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextModification;
f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
ueContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
- elementCnt = 4;
+ if(action == MODIFY_UE)
+ elementCnt = 4;
+ else if(action == QUERY_CONFIG)
+ elementCnt = 3;
ueContextModifyReq->protocolIEs.list.count = elementCnt;
ueContextModifyReq->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationRequest_t *);
CU_ALLOC(ueContextModifyReq->protocolIEs.list.array, ueContextModifyReq->protocolIEs.list.size);
if(ueContextModifyReq->protocolIEs.list.array == NULLP)
{
- DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
+ break;
}
for(ieIdx=0 ; ieIdx<elementCnt; ieIdx++)
{
- CU_ALLOC(ueContextModifyReq->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationRequest_t));
- if(ueContextModifyReq->protocolIEs.list.array[ieIdx] == NULLP)
- {
- DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
- break;
- }
+ CU_ALLOC(ueContextModifyReq->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationRequest_t));
+ if(ueContextModifyReq->protocolIEs.list.array[ieIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation for UE context modifcation Request failed");
+ break;
+ }
}
-
ieIdx=0;
ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = \
UEContextModificationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
- ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID = ueId;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
ieIdx++;
ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present=\
UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
- ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = ueId;
-
- /* DRB to be setup list */
- ieIdx++;
- ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_ToBeSetupMod_List;
- ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
- ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present =\
- UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List;
- ret = BuildDrbToBeSetupList(ueId, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
- value.choice.DRBs_ToBeSetupMod_List));
-
- /* DRB to be modified list */
- ieIdx++;
- ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_ToBeModified_List;
- ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
- ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present =\
- UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List;
- ret = BuildDrbToBeModifiedList(ueId, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
- value.choice.DRBs_ToBeModified_List));
-
- /* TODO: DRB to be release list */
-
- if(ret != ROK)
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;
+
+ if(action == MODIFY_UE)
+ {
+ /* DRB to be setup list */
+ ieIdx++;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_ToBeSetupMod_List;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present =\
+ UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List;
+ ret = BuildDrbToBeSetupList(ueCb->gnbCuUeF1apId, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+ value.choice.DRBs_ToBeSetupMod_List));
+
+ /* DRB to be modified list */
+ ieIdx++;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_ToBeModified_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->gnbCuUeF1apId, &(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+ value.choice.DRBs_ToBeModified_List));
+
+ /* TODO: DRB to be release list */
+
+ if(ret != ROK)
+ {
+ break;
+ }
+ }
+ else if(action == QUERY_CONFIG)
{
- break;
+ ieIdx++;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_GNB_DUConfigurationQuery;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = \
+ UEContextModificationRequestIEs__value_PR_GNB_DUConfigurationQuery;
+ ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DUConfigurationQuery = GNB_DUConfigurationQuery_true;
}
+
xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
/* Encode the F1SetupRequest type as APER */
memset(encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
- encBuf);
+ encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
/* Encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nERROR --> F1AP : Could not encode ueContextModifyReq structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
+ DU_LOG("\nERROR --> F1AP : Could not encode ueContextModifyReq structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
else
{
- DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for ueContextModifyReq\n");
- for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
- {
- DU_LOG("%x",encBuf[ieIdx]);
- }
+ DU_LOG("\nDEBUG --> F1AP : Created APER encodedbuffer for ueContextModifyReq\n");
+ for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
+ {
+ DU_LOG("%x",encBuf[ieIdx]);
+ }
}
- if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK)
+ /* TODO : Hardcoding DU ID to 1 for messages other than F1 Setup Response. This will be made generic in future gerrit */
+ if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL, duId) != ROK)
{
- DU_LOG("\nERROR --> F1AP : Sending Ue context modification request failed");
- break;
+ DU_LOG("\nERROR --> F1AP : Sending Ue context modification request failed");
+ break;
}
ret = ROK;
FreeUeContextModicationRequest(f1apMsg);
return ret;
}
+
/*****************************************************************i
-*
+ *
* @brief Free memory allocated for UE Context Release Command
*
* @details
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendUeContextReleaseCommand(uint8_t cuUeF1apId, uint8_t duUeF1apId)
+uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, uint8_t duUeF1apId)
{
bool memAllocFailed = false;
uint8_t ieIdx = 0,elementCnt = 0, ret = RFAILED, bufLen=0;
}
}
- if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL) != ROK)
+ /* TODO : Hardcoding DU ID to 1 for messages other than F1 Setup Response. This will be made generic in future gerrit */
+ if(SendF1APMsg(CU_APP_MEM_REG, CU_POOL, duId) != ROK)
{
DU_LOG("\nERROR --> F1AP : Sending Ue context Release Command failed");
break;
* RFAILED - failure
*
* ****************************************************************/
-uint8_t procUeContextReleaseReq(F1AP_PDU_t *f1apMsg)
+uint8_t procUeContextReleaseReq(uint32_t duId, F1AP_PDU_t *f1apMsg)
{
uint8_t ieIdx=0, duUeF1apId=0,cuUeF1apId=0;
break;
}
}
- if(BuildAndSendUeContextReleaseCommand(cuUeF1apId, duUeF1apId) != ROK)
+
+ if(BuildAndSendUeContextReleaseCommand(duId, cuUeF1apId, duUeF1apId) != ROK)
{
DU_LOG("\nERROR --> F1AP : procUeContextReleaseReq(): Failed to build Ue Context Release Command ");
return RFAILED;
* RFAILED - failure
*
* ****************************************************************/
-uint8_t procGnbDuUpdate(F1AP_PDU_t *f1apMsg)
+uint8_t procGnbDuUpdate(uint32_t duId, F1AP_PDU_t *f1apMsg)
{
bool cellToBeDelete = false;
- uint8_t ieIdx = 0, ueIdx = 0;
+ uint8_t ieIdx = 0, ueIdx = 0, duIdx = 0, cellIdx=0;
+ uint16_t nrCellId;
+ DuDb *duDb;
+ CuCellCb *cellCb;
GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
duCfgUpdate = &f1apMsg->choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate;
break;
case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
{
+ struct Served_Cells_To_Delete_ItemIEs *deleteItemIe = \
+ (struct Served_Cells_To_Delete_ItemIEs *)duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
+ Served_Cells_To_Delete_List.list.array[0];
+ nrCellId = deleteItemIe->value.choice.Served_Cells_To_Delete_Item.oldNRCGI.nRCellIdentity.buf[4] >>\
+ deleteItemIe->value.choice.Served_Cells_To_Delete_Item.oldNRCGI.nRCellIdentity.bits_unused;
cellToBeDelete = true;
break;
}
break;
}
}
- if(BuildAndSendDUUpdateAck() != ROK)
+ if(BuildAndSendDUUpdateAck(duId) != ROK)
{
DU_LOG("ERROR --> F1AP : Failed to build and send DUUpdateAck");
return RFAILED;
}
+#if 0
+ /* We don't require F1 Reset message in Cell Up and Broadcast Procedure flow, So that's why
+ * commented this trigger for now */
if(cellToBeDelete == false)
{
return RFAILED;
}
}
- else
+#endif
+ if(cellToBeDelete == true)
{
- for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+ SEARCH_DU_DB(duIdx, duId, duDb);
+ SEARCH_CELL_DB(cellIdx, duDb, nrCellId, cellCb);
+ for(ueIdx = 0; ueIdx < cellCb->numUe; ueIdx++)
{
- CU_FREE(ueCb[ueIdx].f1apMsgDb.duToCuContainer.buf, ueCb[ueIdx].f1apMsgDb.duToCuContainer.size);
- memset(&ueCb[ueIdx], 0, sizeof(UeCb));
+ CU_FREE(cellCb->ueCb[ueIdx]->f1apMsgDb.duToCuContainer.buf, cellCb->ueCb[ueIdx]->f1apMsgDb.duToCuContainer.size);
+ memset(cellCb->ueCb[ueIdx], 0, sizeof(CuUeCb));
}
}
{
if(sliceSupportList->list.array)
{
- cuCfgParams.numSnssaiSupported = sliceSupportList->list.count;
+ cuCb.numSnssaiSupported = sliceSupportList->list.count;
for(sliceListIdx=0; sliceListIdx<sliceSupportList->list.count; sliceListIdx++)
{
if(sliceSupportList->list.array[sliceListIdx])
{
- CU_ALLOC(cuCfgParams.snssaiList[sliceListIdx], sizeof(Snssai));
- if(cuCfgParams.snssaiList[sliceListIdx] == NULLP)
+ CU_ALLOC(cuCb.snssaiList[sliceListIdx], sizeof(Snssai));
+ if(cuCb.snssaiList[sliceListIdx] == NULLP)
{
DU_LOG("\nERROR --> CU_STUB: buildSliceList(): Memory allocation failed");
return RFAILED;
}
if(sliceSupportList->list.array[sliceListIdx]->sNSSAI.sST.buf)
{
- memcpy(&cuCfgParams.snssaiList[sliceListIdx]->sst, sliceSupportList->list.array[sliceListIdx]->\
+ memcpy(&cuCb.snssaiList[sliceListIdx]->sst, sliceSupportList->list.array[sliceListIdx]->\
sNSSAI.sST.buf, sliceSupportList->list.array[sliceListIdx]->sNSSAI.sST.size);
}
if(sliceSupportList->list.array[sliceListIdx]->sNSSAI.sD->size)
{
- memcpy(&cuCfgParams.snssaiList[sliceListIdx]->sd,\
+ memcpy(&cuCb.snssaiList[sliceListIdx]->sd,\
sliceSupportList->list.array[sliceListIdx]->sNSSAI.sD->buf,\
sliceSupportList->list.array[sliceListIdx]->sNSSAI.sD->size);
}
* RFAILED - failure
*
* ****************************************************************/
-uint8_t procUeContextModificationResponse(F1AP_PDU_t *f1apMsg)
+uint8_t procUeContextModificationResponse(uint32_t duId, F1AP_PDU_t *f1apMsg)
{
- uint8_t idx, duUeF1apId;
- UEContextModificationResponse_t *ueCtxtModRsp = NULLP;
+ uint8_t idx=0, duIdx=0, duUeF1apId;
+ DuDb *duDb;
+ CuUeCb *ueCb;
+ UEContextModificationResponse_t *ueCtxtModRsp = NULLP;
+
+ SEARCH_DU_DB(duIdx, duId, duDb);
ueCtxtModRsp = &f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
for(idx=0; idx < ueCtxtModRsp->protocolIEs.list.count; idx++)
case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
{
duUeF1apId = ueCtxtModRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
+ ueCb = &duDb->ueCb[duUeF1apId-1];
+ if(ueCb->state == UE_HANDOVER_IN_PROGRESS)
+ {
+ /* TODO : Next procedure i.e. UE context setup request to
+ * target DU should be triggerred here */
+ return ROK;
+ }
break;
}
case ProtocolIE_ID_id_DRBs_SetupMod_List:
}
}
}
+
return ROK;
}
* RFAILED - failure
*
* ****************************************************************/
-void procF1SetupReq(F1AP_PDU_t *f1apMsg)
+void procF1SetupReq(uint32_t *destDuId, F1AP_PDU_t *f1apMsg)
{
- uint8_t ieIdx = 0, plmnidx=0, ret=ROK;
+ uint8_t ieIdx = 0, plmnidx=0, duIdx = 0, ret=ROK, cellIdx = 0;
+ uint32_t duId = 0, nrCellId = 0;
+ DuDb *duDb = NULLP;
+ CuCellCb *cellCb = NULLP;
BIT_STRING_t nrcellIdentity;
F1SetupRequest_t *f1SetupReq = NULLP;
GNB_DU_Served_Cells_Item_t *srvCellItem = NULLP;
{
switch(f1SetupReq->protocolIEs.list.array[ieIdx]->id)
{
+ case ProtocolIE_ID_id_gNB_DU_ID:
+ {
+ duId = f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0];
+ SEARCH_DU_DB(duIdx, duId, duDb);
+ if(duDb == NULLP)
+ {
+ duDb = &cuCb.duInfo[cuCb.numDu];
+ memset(duDb, 0, sizeof(DuDb));
+ duDb->duId = duId;
+ cuCb.numDu++;
+ *destDuId = duId;
+ }
+ else
+ return;
+ break;
+ }
+ case ProtocolIE_ID_id_gNB_DU_Name:
+ {
+ strcpy((char *)duDb->duName, (char*)f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Name.buf);
+ break;
+ }
case ProtocolIE_ID_id_gNB_DU_Served_Cells_List:
{
duServedCell = &f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_Served_Cells_List;
srvCellItem = &duServedCell->list.array[plmnidx]->value.choice.GNB_DU_Served_Cells_Item;
ret = procServedCellPlmnList(&srvCellItem->served_Cell_Information.servedPLMNs);
memcpy(&nrcellIdentity, &srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity, sizeof(BIT_STRING_t));
+
+ nrCellId = nrcellIdentity.buf[4] >> nrcellIdentity.bits_unused;
+ SEARCH_CELL_DB(cellIdx, duDb, nrCellId, cellCb);
+ if(cellCb == NULLP)
+ {
+ cellCb = &duDb->cellCb[duDb->numCells];
+ memset(cellCb, 0, sizeof(CuCellCb));
+ cellCb->nrCellId = nrCellId;
+ duDb->numCells++;
+ }
}
}
}
}
if(ret == ROK)
{
- BuildAndSendF1SetupRsp(&nrcellIdentity);
+ BuildAndSendF1SetupRsp(duId, &nrcellIdentity);
}
else
{
* RFAILED - failure
*
* ****************************************************************/
-void F1APMsgHdlr(Buffer *mBuf)
+void F1APMsgHdlr(uint32_t *duId, Buffer *mBuf)
{
int i;
char *recvBuf;
case InitiatingMessage__value_PR_F1SetupRequest:
{
DU_LOG("\nINFO --> F1AP : F1 setup request received");
- procF1SetupReq(f1apMsg);
+ procF1SetupReq(duId, f1apMsg);
break;
}
case InitiatingMessage__value_PR_GNBDUConfigurationUpdate:
{
DU_LOG("\nINFO --> F1AP : GNB-DU config update received");
- procGnbDuUpdate(f1apMsg);
+ procGnbDuUpdate(*duId, f1apMsg);
break;
}
case InitiatingMessage__value_PR_InitialULRRCMessageTransfer:
{
DU_LOG("\nINFO --> F1AP : Received InitialULRRCMessageTransfer");
- procInitULRRCMsg(f1apMsg);
+ procInitULRRCMsg(*duId, f1apMsg);
break;
}
case InitiatingMessage__value_PR_ULRRCMessageTransfer:
{
DU_LOG("\nINFO --> F1AP : Received ULRRCMessageTransfer");
- procUlRrcMsg(f1apMsg);
+ procUlRrcMsg(*duId, f1apMsg);
break;
}
case InitiatingMessage__value_PR_UEContextReleaseRequest:
{
DU_LOG("\nINFO --> F1AP : Received UE Context Release Request");
- procUeContextReleaseReq(f1apMsg);
+ procUeContextReleaseReq(*duId, f1apMsg);
break;
}
default:
case SuccessfulOutcome__value_PR_UEContextSetupResponse:
{
DU_LOG("\nINFO --> F1AP : UE ContextSetupResponse received");
- procUeContextSetupResponse(f1apMsg);
+ procUeContextSetupResponse(*duId, f1apMsg);
break;
}
case SuccessfulOutcome__value_PR_UEContextModificationResponse:
{
DU_LOG("\nINFO --> F1AP : UE Context Modification Response received");
- procUeContextModificationResponse(f1apMsg);
+ procUeContextModificationResponse(*duId, f1apMsg);
break;
}
case SuccessfulOutcome__value_PR_UEContextReleaseComplete: