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;
InitialULRRCMessageTransfer_t *initULRRCMsg = NULLP;
DU_LOG("\nINFO --> F1AP : filling the required values in DB in procInitULRRCMsg");
-
- duDb = getDuDb(duId);
+
+ 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_NRCGI:
nrCellId = initULRRCMsg->protocolIEs.list.array[idx]->value.choice.NRCGI.nRCellIdentity.buf[4] >>
initULRRCMsg->protocolIEs.list.array[idx]->value.choice.NRCGI.nRCellIdentity.bits_unused;
- cellCb = getCellCb(duDb, nrCellId);
+ SEARCH_CELL_DB(cellIdx, duDb, nrCellId, cellCb);
if(cellCb == NULLP)
return RFAILED;
break;
ueCb->crnti = crnti;
ueCb->gnbDuUeF1apId = gnbDuUeF1apId;
ueCb->gnbCuUeF1apId = ++cuCb.gnbCuUeF1apIdGenerator;
- ueCb->state = ATTACH_IN_PROGRESS;
+ ueCb->state = UE_ATTACH_IN_PROGRESS;
(duDb->numUe)++;
cellCb->ueCb[cellCb->numUe] = ueCb;
* ****************************************************************/
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;
- duDb = getDuDb(duId);
+ SEARCH_DU_DB(duIdx, duId, duDb);
ueCtxtSetupRsp = &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
for(idx=0; idx < ueCtxtSetupRsp->protocolIEs.list.count; idx++)
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;
ULRRCMessageTransfer_t *ulRrcMsg = NULLP;
ret = ROK;
- duDb = getDuDb(duId);
+ SEARCH_DU_DB(duIdx, duId, duDb);
ulRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.ULRRCMessageTransfer;
for(idx=0; idx < ulRrcMsg->protocolIEs.list.count; idx++)
}
if(rrcMsgType == RRC_RECONFIG_COMPLETE)
{
- ueCb->state = ACTIVE;
+ ueCb->state = UE_ACTIVE;
ueCb->f1apMsgDb.dlRrcMsgCount++;
rrcMsgType = setDlRRCMsgType(ueCb);
if(rrcMsgType == UE_CONTEXT_MOD_REQ)
uint8_t procGnbDuUpdate(uint32_t duId, F1AP_PDU_t *f1apMsg)
{
bool cellToBeDelete = false;
- uint8_t ieIdx = 0, ueIdx = 0;
- uint16_t cellId;
+ uint8_t ieIdx = 0, ueIdx = 0, duIdx = 0, cellIdx=0;
+ uint16_t nrCellId;
DuDb *duDb;
CuCellCb *cellCb;
GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
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];
- cellId = deleteItemIe->value.choice.Served_Cells_To_Delete_Item.oldNRCGI.nRCellIdentity.buf[4] >>\
+ 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;
#endif
if(cellToBeDelete == true)
{
- duDb = getDuDb(duId);
- cellCb = getCellCb(duDb, cellId);
+ SEARCH_DU_DB(duIdx, duId, duDb);
+ SEARCH_CELL_DB(cellIdx, duDb, nrCellId, cellCb);
for(ueIdx = 0; ueIdx < cellCb->numUe; ueIdx++)
{
CU_FREE(cellCb->ueCb[ueIdx]->f1apMsgDb.duToCuContainer.buf, cellCb->ueCb[ueIdx]->f1apMsgDb.duToCuContainer.size);
* ****************************************************************/
uint8_t procUeContextModificationResponse(uint32_t duId, F1AP_PDU_t *f1apMsg)
{
- uint8_t idx, duUeF1apId;
+ uint8_t idx=0, duIdx=0, duUeF1apId;
DuDb *duDb;
CuUeCb *ueCb;
- UEContextModificationResponse_t *ueCtxtModRsp = NULLP;
+ UEContextModificationResponse_t *ueCtxtModRsp = NULLP;
- duDb = getDuDb(duId);
+ SEARCH_DU_DB(duIdx, duId, duDb);
ueCtxtModRsp = &f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
for(idx=0; idx < ueCtxtModRsp->protocolIEs.list.count; idx++)
{
duUeF1apId = ueCtxtModRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
ueCb = &duDb->ueCb[duUeF1apId-1];
- if(ueCb->state == HANDOVER_IN_PROGRESS)
+ if(ueCb->state == UE_HANDOVER_IN_PROGRESS)
{
/* TODO : Next procedure i.e. UE context setup request to
* target DU should be triggerred here */
void procF1SetupReq(uint32_t *destDuId, F1AP_PDU_t *f1apMsg)
{
uint8_t ieIdx = 0, plmnidx=0, duIdx = 0, ret=ROK, cellIdx = 0;
- uint32_t duId, cellId;
+ uint32_t duId = 0, nrCellId = 0;
DuDb *duDb = NULLP;
CuCellCb *cellCb = NULLP;
BIT_STRING_t nrcellIdentity;
case ProtocolIE_ID_id_gNB_DU_ID:
{
duId = f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0];
- duDb = getDuDb(duId);
+ SEARCH_DU_DB(duIdx, duId, duDb);
if(duDb == NULLP)
{
duDb = &cuCb.duInfo[cuCb.numDu];
ret = procServedCellPlmnList(&srvCellItem->served_Cell_Information.servedPLMNs);
memcpy(&nrcellIdentity, &srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity, sizeof(BIT_STRING_t));
- cellId = nrcellIdentity.buf[4] >> nrcellIdentity.bits_unused;
- cellCb = getCellCb(duDb, cellId);
+ 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 = cellId;
+ cellCb->nrCellId = nrCellId;
duDb->numCells++;
}
}
extern StartupConfig g_cfg;
#endif
-/*******************************************************************
- *
- * @brief Fetches pointer to DU Database
- *
- * @details
- *
- * Function : getDuDb
- *
- * Functionality:
- * Searches and returns pointer to DU structure based on DU Id
- *
- * @params[in] DU Id
- * @return Pointer to DU Db
- *
- ******************************************************************/
-DuDb* getDuDb(uint32_t duId)
-{
- uint8_t duIdx;
- for(duIdx=0; duIdx < cuCb.numDu; duIdx++)
- {
- if(cuCb.duInfo[duIdx].duId == duId)
- return (&cuCb.duInfo[duIdx]);
- }
- return NULLP;
-}
-
-/*******************************************************************
- *
- * @brief Fetches pointer to Cell Cb
- *
- * @details
- *
- * Function : getCellCb
- *
- * Functionality:
- * Searches for a cell within a DU based on NR cell Id
- * Returns pointer to this cell Cb structure
- *
- * @params[in] Pointer to DU Db
- * NR Cell ID
- * @return Pointer to cell Cb
- *
- ******************************************************************/
-CuCellCb* getCellCb(DuDb *duDb, uint32_t cellId)
-{
- uint8_t cellIdx;
- for(cellIdx=0; cellIdx < duDb->numCells; cellIdx++)
- {
- if(duDb->cellCb[cellIdx].nrCellId == cellId)
- return &(duDb->cellCb[cellIdx]);
- }
- return NULLP;
-}
-
/*******************************************************************
*
* @brief Handles SCTP notification
* ****************************************************************/
void initiateInterDuHandover(uint32_t sourceDuId, uint32_t targetDuId, uint32_t ueId)
{
+ uint8_t duIdx = 0;
DuDb *duDb = NULLP;
CuUeCb *ueCb = NULLP;
-
- duDb = getDuDb(sourceDuId);
+
+ SEARCH_DU_DB(duIdx, sourceDuId, duDb);
if(duDb)
ueCb = &duDb->ueCb[ueId-1];
if(ueCb)
- ueCb->state = HANDOVER_IN_PROGRESS;
+ ueCb->state = UE_HANDOVER_IN_PROGRESS;
DU_LOG("\nINFO --> CU_STUB: Inter-DU Handover Started for ueId [%d] from DU ID [%d] to DU ID [%d]", \
ueId, sourceDuId, targetDuId);