#include "du_sys_info_hdl.h"
#include "du_e2ap_msg_hdl.h"
#include "du_f1ap_conversions.h"
+#include "CNUEPagingIdentity.h"
+#include "PCCH-Config.h"
#ifdef O1_ENABLE
#include "CmInterface.h"
/* Multi CSI */
if(multiCsiDb && (multiCsiDb->multiCsiResrcListCount != 0))
{
- pucchCfg->multi_CSI_PUCCH_ResourceList == NULLP;
+ pucchCfg->multi_CSI_PUCCH_ResourceList = NULLP;
DU_ALLOC(pucchCfg->multi_CSI_PUCCH_ResourceList, sizeof(struct PUCCH_Config__multi_CSI_PUCCH_ResourceList));
if(pucchCfg->multi_CSI_PUCCH_ResourceList == NULLP)
{
* ****************************************************************/
uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
{
- uint8_t ret=0, ieIdx=0, ieExtIdx = 0, ueIdx=0, cellIdx=0, servCellIdx = 0;
+ int8_t ueIdx = -1;
+ uint8_t ret=0, ieIdx=0, ieExtIdx = 0, cellIdx=0, servCellIdx = 0;
bool ueCbFound = false, hoInProgress = false;
uint16_t nrCellId = 0;
uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0;
/* If UE context is not present, but UE is in handover */
if(!ueCbFound && hoInProgress)
{
- gnbDuUeF1apId = genGnbDuUeF1apId(nrCellId);
- duUeCb = &duCb.actvCellLst[cellIdx]->hoUeCb[gnbDuUeF1apId -1];
+ ueIdx = getFreeBitFromUeBitMap(nrCellId);
+ if(ueIdx != -1)
+ gnbDuUeF1apId = ueIdx +1;
+ else
+ {
+ DU_LOG("\nERROR --> F1AP : No free UE IDX found in UE bit map of cell Id [%d]", nrCellId);
+ ret = RFAILED;
+ break;
+ }
+ duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
duUeCb->f1UeDb = NULL;
duUeCb->gnbCuUeF1apId = gnbCuUeF1apId;
duUeCb->gnbDuUeF1apId = gnbDuUeF1apId;
{
cellIdentity = &deleteItem->oldNRCGI.nRCellIdentity;
bitStringToInt(cellIdentity, &cellId);
+
+ GET_CELL_IDX(cellId, cellIdx);
+ if(duCb.actvCellLst[cellIdx] != NULLP)
+ {
+ duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
+ }
}
}
}
- GET_CELL_IDX(cellId, cellIdx);
if(duCb.actvCellLst[cellIdx] != NULLP)
{
if(duCb.actvCellLst[cellIdx]->numActvUes == 0)
{
- duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
ret = duSendCellDeletReq(cellId);
if(ret == RFAILED)
{
struct DRBs_SetupMod_ItemIEs *drbItemIe;
drbCnt = ueCfg->numDrbSetupMod;
+
+ if(!drbCnt)
+ {
+ DU_LOG("\nINFO --> F1AP : BuildDrbToBeSetupModList(): No DRB information to avaialble to add");
+ return ROK;
+ }
+
drbSet->list.count = drbCnt;
drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *);
DU_ALLOC(drbSet->list.array, drbSet->list.size);
ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
- elementCnt = 3;
+ {
+ if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
+ elementCnt =3;
+ else
+ elementCnt =2;
+ }
if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
elementCnt = 5;
if(ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE)
}
if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || (ueCb->f1UeDb->actionType == UE_CTXT_MOD))
- {
- ieIdx++;
- ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
- ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
- ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
- UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
- if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
- {
- for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
+ {
+ if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
+ {
+ ieIdx++;
+ ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
+ ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+ ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
+ UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
+ if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
{
- if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
+ for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
{
- memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
+ if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
+ {
+ memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
+ }
}
}
- }
- ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
- value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
- if(ret != ROK)
- {
- DU_LOG( "\nERROR --> F1AP : Failed to build DRB setupmod List ");
- break;
+ ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
+ value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
+ if(ret != ROK)
+ {
+ DU_LOG( "\nERROR --> F1AP : Failed to build DRB setupmod List ");
+ break;
+ }
}
}
ret = RFAILED;
break;
}
+
+ ret = ROK;
break;
}
FreeUeContextModResp(f1apMsg);
* @return void
*
* ****************************************************************/
-void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *UeContextModifyReq )
+void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *ueContextModifyReq )
{
uint8_t arrIdx, ieId;
- if(UeContextModifyReq->protocolIEs.list.array)
+ if(ueContextModifyReq->protocolIEs.list.array)
{
- for( arrIdx = 0 ; arrIdx<UeContextModifyReq->protocolIEs.list.count ; arrIdx++)
+ for( arrIdx = 0 ; arrIdx<ueContextModifyReq->protocolIEs.list.count ; arrIdx++)
{
- if(UeContextModifyReq->protocolIEs.list.array[arrIdx])
+ if(ueContextModifyReq->protocolIEs.list.array[arrIdx])
{
- ieId = UeContextModifyReq->protocolIEs.list.array[arrIdx]->id;
+ ieId = ueContextModifyReq->protocolIEs.list.array[arrIdx]->id;
switch(ieId)
{
case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
break;
case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
{
- freeAperDecodeDrbToBeSetupModList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->\
+ freeAperDecodeDrbToBeSetupModList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
value.choice.DRBs_ToBeSetupMod_List);
break;
}
+ case ProtocolIE_ID_id_TransmissionActionIndicator:
+ break;
+ case ProtocolIE_ID_id_RRCContainer:
+ {
+ free(ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.buf);
+ }
}
- free(UeContextModifyReq->protocolIEs.list.array[arrIdx]);
+ free(ueContextModifyReq->protocolIEs.list.array[arrIdx]);
}
}
- free(UeContextModifyReq->protocolIEs.list.array);
+ free(ueContextModifyReq->protocolIEs.list.array);
}
}
/*******************************************************************
uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
{
UEContextModificationRequest_t *ueContextModifyReq = NULLP;
- uint8_t ret = ROK, ieIdx = 0, cellIdx=0, ueIdx=0;
+ uint8_t ret = ROK, ieIdx = 0, cellIdx=0;
DuUeCb *duUeCb = NULLP;
DRBs_ToBeSetupMod_List_t *drbSetupModCfg;
DRBs_ToBeModified_List_t *drbModifiedCfg;
{
if(duCb.actvCellLst[cellIdx])
{
- for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
+ if((duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbDuUeF1apId == gnbDuUeF1apId)&&\
+ (duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbCuUeF1apId == gnbCuUeF1apId))
{
- if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
- (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
+ duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1];
+ if(duUeCb->f1UeDb == NULLP)
{
- duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
- if(duUeCb->f1UeDb == NULLP)
- {
- DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
- duUeCb->f1UeDb->cellIdx = cellIdx;
- }
- break;
+ DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
+ duUeCb->f1UeDb->cellIdx = cellIdx;
+ duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
}
+ break;
}
}
}
}
break;
}
+
+ case ProtocolIE_ID_id_RRCContainer:
+ {
+ /* Filling Dl RRC Msg Info */
+ DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+ if(!duUeCb->f1UeDb->dlRrcMsg)
+ {
+ DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
+ Memory allocation failed ");
+ ret = RFAILED;
+ }
+ else
+ {
+ duUeCb->f1UeDb->dlRrcMsgPres = true;
+ memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+ ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
+ &ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+ value.choice.RRCContainer);
+ }
+
+ break;
+ }
+
case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
case ProtocolIE_ID_id_DRBs_ToBeModified_List:
{
if(duUeCb->f1UeDb)
{
- duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\
UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List)
{
}
break;
}
+ case ProtocolIE_ID_id_TransmissionActionIndicator:
+ {
+ if(duUeCb->f1UeDb)
+ {
+ if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator == TransmissionActionIndicator_stop)
+ {
+ duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = STOP_TRANSMISSION;
+ }
+ else
+ {
+ duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = RESTART_TRANSMISSION;
+ }
+ }
+ break;
+ }
+
+ case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+ {
+ if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
+ {
+ duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
+ }
+ break;
+ }
+
}
}
break;
}while(true);
- if(ret == ROK && duCb.actvCellLst[cellId-1] && (duCb.actvCellLst[cellId-1]->numActvUes == 0))
+ if((ret == ROK) && (duCb.actvCellLst[cellId-1]) && (duCb.actvCellLst[cellId-1]->cellStatus == DELETION_IN_PROGRESS)
+ && (duCb.actvCellLst[cellId-1]->numActvUes == 0))
{
- duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
ret = duSendCellDeletReq(cellId);
if(ret != ROK)
{
freeAperDecodeUeContextReleaseCommand(f1apMsg);
return ret;
}
+
+/**************************************************************
+ *
+ * @brief free the memory allocated by aper decoder for paging
+ *
+ * @details
+ *
+ * Function : freeAperDecodePagingMsg
+ *
+ * Functionality:
+ * - free the memory allocated by aper decoder for
+ * the paging f1ap msg
+ *
+ * @params[in] Paging_t *paging
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ****************************************************************/
+void freeAperDecodePagingMsg(Paging_t *paging)
+{
+ uint8_t ieIdx, cellIdx;
+ PagingCell_ItemIEs_t *pagingCellItemIes;
+ PagingCell_Item_t *pagingCellItem;
+ PagingCell_list_t *pagingCelllist;
+
+ if(paging)
+ {
+ if(paging->protocolIEs.list.array)
+ {
+ for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
+ {
+ if(paging->protocolIEs.list.array[ieIdx])
+ {
+ switch(paging->protocolIEs.list.array[ieIdx]->id)
+ {
+ case ProtocolIE_ID_id_UEIdentityIndexValue:
+ {
+ free(paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10.buf);
+ break;
+ }
+ case ProtocolIE_ID_id_PagingIdentity:
+ {
+ if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present == PagingIdentity_PR_cNUEPagingIdentity)
+ {
+ if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)
+ {
+ if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->present == \
+ CNUEPagingIdentity_PR_fiveG_S_TMSI)
+ {
+ free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->choice.fiveG_S_TMSI.buf);
+ }
+ free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity);
+ }
+ }
+ break;
+ }
+ case ProtocolIE_ID_id_PagingCell_List:
+ {
+ pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list;
+ if(pagingCelllist->list.array)
+ {
+ for(cellIdx = 0; cellIdx < pagingCelllist->list.count; cellIdx++)
+ {
+ if(pagingCelllist->list.array[cellIdx])
+ {
+ pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellIdx];
+ if(pagingCellItemIes->id == ProtocolIE_ID_id_PagingCell_Item)
+ {
+ pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
+ free(pagingCellItem->nRCGI.pLMN_Identity.buf);
+ free(pagingCellItem->nRCGI.nRCellIdentity.buf);
+ }
+ free(pagingCelllist->list.array[cellIdx]);
+ }
+ }
+ free(pagingCelllist->list.array);
+ }
+ break;
+ }
+ }
+ free(paging->protocolIEs.list.array[ieIdx]);
+ }
+ }
+ free(paging->protocolIEs.list.array);
+
+ }
+ }
+}
+
+/**************************************************************
+ *
+ * @brief processing the paging f1ap msg received from CU
+ *
+ * @details
+ *
+ * Function : procPagingMsg
+ *
+ * Functionality:
+ * - processing the paging f1ap msg received from CU
+ *
+ * @params[in] F1AP_PDU_t *f1apMsg
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ *
+ ****************************************************************/
+uint8_t procPagingMsg(F1AP_PDU_t *f1apMsg)
+{
+ uint8_t ieIdx = 0, cellListIdx = 0;
+ uint16_t cellId = 0;
+ Paging_t *paging = NULLP;
+ PagingCell_list_t *pagingCelllist = NULLP;
+ PagingCell_ItemIEs_t *pagingCellItemIes = NULLP;
+ PagingCell_Item_t *pagingCellItem = NULLP;
+ DuPagingMsg *tmpPagingParam = NULLP;
+
+ DU_LOG("\nINFO --> DU APP : Processing the Paging Message");
+ paging = &f1apMsg->choice.initiatingMessage->value.choice.Paging;
+ if(paging)
+ {
+ if(paging->protocolIEs.list.array)
+ {
+ DU_ALLOC(tmpPagingParam, sizeof(DuPagingMsg));
+ if(tmpPagingParam == NULLP)
+ {
+ DU_LOG("\nERROR --> DU APP : Memory Allocation Failure in procPagingMsg");
+ freeAperDecodePagingMsg(paging);
+ return RFAILED;
+ }
+ for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
+ {
+ if(paging->protocolIEs.list.array[ieIdx])
+ {
+ switch(paging->protocolIEs.list.array[ieIdx]->id)
+ {
+ case ProtocolIE_ID_id_UEIdentityIndexValue:
+ {
+ bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10,\
+ &tmpPagingParam->pagUeId);
+ break;
+ }
+
+ case ProtocolIE_ID_id_PagingIdentity:
+ {
+ switch(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present)
+ {
+ case PagingIdentity_PR_cNUEPagingIdentity:
+ {
+ if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)
+ {
+ bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.\
+ cNUEPagingIdentity->choice.fiveG_S_TMSI, &tmpPagingParam->sTmsi);
+
+ }
+ break;
+ }
+ case PagingIdentity_PR_rANUEPagingIdentity:
+ {
+ /*TODO: This Identifier is specific to RAN Initiated Paging – Connected Mode Paging*/
+ break;
+ }
+ default:
+ {
+ DU_LOG("ERROR --> DU APP: Invalid UE Paging Identity, Skipping this Paging Message:");
+ continue;
+ }
+ }
+ }
+
+ case ProtocolIE_ID_id_PagingDRX:
+ {
+ tmpPagingParam->pagingDrxPres = TRUE;
+ tmpPagingParam->pagingDrx = convertPagingCycleEnumToValue(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingDRX);
+ break;
+ }
+
+ case ProtocolIE_ID_id_PagingPriority:
+ {
+ tmpPagingParam->pagPriority = paging->protocolIEs.list.array[ieIdx]->value.choice.PagingPriority;
+ break;
+ }
+
+ case ProtocolIE_ID_id_PagingCell_List:
+ {
+ pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list;
+ if(pagingCelllist->list.array)
+ {
+ for(cellListIdx = 0; cellListIdx < pagingCelllist->list.count; cellListIdx++)
+ {
+ if(pagingCelllist->list.array[cellListIdx])
+ {
+ pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellListIdx];
+ pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
+ bitStringToInt(&pagingCellItem->nRCGI.nRCellIdentity, &cellId);
+ if(processPagingMsg(cellId, tmpPagingParam) != ROK)
+ {
+ DU_LOG("\nERROR --> DU APP : Paging Processing Failed at CellId:%d",cellId);
+ continue;
+ }
+ }
+ }
+ }
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> F1AP : Incorrect Paging IE option");
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ DU_FREE(tmpPagingParam, sizeof(DuPagingMsg));
+ freeAperDecodePagingMsg(paging);
+
+ return ROK;
+}
+
/**************************************************************
*
* @brief Handles received F1AP message and sends back response
procF1UeContextReleaseCommand(f1apMsg);
break;
}
+ case InitiatingMessage__value_PR_Paging:
+ {
+ procPagingMsg(f1apMsg);
+ break;
+ }
default:
{
DU_LOG("\nERROR --> F1AP : Invalid type of F1AP_PDU_PR_initiatingMessage [%d]",