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;
+ uint8_t duIdx = 0, ieIdx = 0,elementCnt = 0, ret = RFAILED, bufLen=0;
+ DuDb *duDb;
+ CuUeCb *ueCb;
F1AP_PDU_t *f1apMsg = NULLP;
UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
ueContextReleaseCommand =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
- elementCnt = 4;
+ SEARCH_DU_DB(duIdx, duId, duDb);
+ ueCb = &duDb->ueCb[duUeF1apId-1];
+ if(ueCb->state == UE_HANDOVER_IN_PROGRESS)
+ elementCnt = 3;
+ else
+ elementCnt = 4;
+
ueContextReleaseCommand->protocolIEs.list.count = elementCnt;
ueContextReleaseCommand->protocolIEs.list.size = elementCnt*sizeof(UEContextReleaseCommand_t*);
{
break;
}
+
ieIdx=0;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =duUeF1apId;
+ /* Cause of UE context release */
ieIdx++;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_Cause;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present=\
- UEContextReleaseCommandIEs__value_PR_Cause;
+ UEContextReleaseCommandIEs__value_PR_Cause;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.Cause.present = Cause_PR_radioNetwork;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.Cause.choice.radioNetwork=\
- CauseRadioNetwork_normal_release;
-
- /* RRC Container for RRC release */
- ieIdx++;
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCContainer;
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present = \
- UEContextReleaseCommandIEs__value_PR_RRCContainer;
- char secModeBuf[7]={ 0x00, 0x05, 0x13, 0x00, 0x00, 0x00, 0x00};
- bufLen =7;
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = bufLen;
- CU_ALLOC(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
- if(!ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
- {
- DU_LOG("\nERROR --> F1AP : Memory allocation for BuildAndSendUeContextReleaseCommand failed");
- break;
+ CauseRadioNetwork_normal_release;
+ if(ueCb->state != UE_HANDOVER_IN_PROGRESS)
+ {
+ /* RRC Container for RRC release */
+ ieIdx++;
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCContainer;
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present = \
+ UEContextReleaseCommandIEs__value_PR_RRCContainer;
+ char secModeBuf[7]={ 0x00, 0x05, 0x13, 0x00, 0x00, 0x00, 0x00};
+ bufLen =7;
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = bufLen;
+ CU_ALLOC(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
+ if(!ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation for BuildAndSendUeContextReleaseCommand failed");
+ break;
+ }
+ memset(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, 0, bufLen);
+ memcpy(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, secModeBuf, bufLen);
}
- memset(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, 0, bufLen);
- memcpy(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, secModeBuf, bufLen);
-
xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
/* Encode the UE Context Release Command type as APER */
/* Defines action to be performed via UE Context Modification request */
typedef enum
{
- MODIFY_UE, /* Modify UE configuration at DU */
- QUERY_CONFIG, /* Query DU for its configurations */
+ MODIFY_UE, /* Modify UE configuration at DU */
+ QUERY_CONFIG, /* Query DU for its configurations */
STOP_DATA_TX /* Stop data transmission from DU to a particular UE */
}UeCtxtModAction;
if(cuCb.duInfo[_duIdx].duId == _duId)\
{\
_duDb = (&cuCb.duInfo[_duIdx]);\
- break; \
+ break; \
}\
}\
}
uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
{
uint8_t ieIdx=0, ret=ROK, ueIdx=0;
- uint16_t cellIdx =0;
- bool ueIdxFound;
+ uint16_t cellIdx =0, cellId = 0, crnti = 0;
+ bool ueIdxFound = false;
uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0;
DuUeCb *duUeCb = NULLP;
UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
}
case ProtocolIE_ID_id_Cause:
- {
- break;
- }
-
- case ProtocolIE_ID_id_RRCContainer:
{
for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
{
if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
{
+ cellId = duCb.actvCellLst[cellIdx]->cellId;
+ crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
- DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
- if(duUeCb->f1UeDb)
- {
- memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
- duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
- duUeCb->f1UeDb->cellIdx = cellIdx;
- /* 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,\
- &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
- value.choice.RRCContainer);
- }
-
- }
- else
- {
- DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
- Memory allocation failed ");
- ret = RFAILED;
-
- }
-
ueIdxFound = true;
break;
}
break;
}
}
+
if(!ueIdxFound)
{
- DU_LOG("\nERROR --> F1AP: DuUeCb is not found at procF1UeContextReleaseCommand()");
+ DU_LOG("\nERROR --> F1AP: procF1UeContextReleaseCommand(): Ue Information is not available");
ret = RFAILED;
}
+ break;
+ }
+ case ProtocolIE_ID_id_RRCContainer:
+ {
+ if(ueIdxFound == true)
+ {
+ DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
+ if(duUeCb->f1UeDb)
+ {
+ memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
+ duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
+ duUeCb->f1UeDb->cellIdx = cellIdx;
+ /* 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,\
+ &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
+ value.choice.RRCContainer);
+ }
+
+ }
+ else
+ {
+ DU_LOG("\nERROR --> DU APP : procF1UeContextReleaseCommand(): \
+ Memory allocation failed ");
+ ret = RFAILED;
+ }
+ }
break;
}
default :
}
if(ret != RFAILED)
{
- duProcUeContextReleaseCommand(duUeCb);
+ duProcUeContextReleaseCommand(cellId, duUeCb);
}
freeAperDecodeUeContextReleaseCommand(f1apMsg);
return ret;
uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueId);
uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId);
uint8_t duSendCellDeletReq(uint16_t cellId);
-uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb);
+uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb);
/**********************************************************************
End of file
**********************************************************************/
* RFAILED - failure
*
* ****************************************************************/
-uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb)
+uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb)
{
uint8_t ret =ROK, ueId=0;
- uint16_t cellId=0,crnti =0;
- if(duUeCb == NULLP)
- {
- DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : duUeCb is null");
- return RFAILED;
- }
- if(duUeCb->f1UeDb == NULLP)
- {
- DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : f1UeDb is null");
- return RFAILED;
- }
-
- cellId = duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->cellId;
- crnti = duUeCb->crnti;
- GET_UE_ID(crnti, ueId);
-
- /* Send DL RRC msg for RRC release */
- if(duUeCb->f1UeDb->dlRrcMsg)
+ uint16_t crnti = 0;
+
+ if(duUeCb != NULLP)
{
- if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
+ crnti = duUeCb->crnti;
+ GET_UE_ID(crnti, ueId);
+
+ if(duUeCb->f1UeDb)
{
- ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueId-1].rlcUeCfg,\
- duUeCb->f1UeDb->dlRrcMsg);
- if(ret == RFAILED)
+ /* Send DL RRC msg for RRC release */
+ if(duUeCb->f1UeDb->dlRrcMsg)
{
- DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
- DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
- duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
- DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+ if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
+ {
+ ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueId-1].rlcUeCfg,\
+ duUeCb->f1UeDb->dlRrcMsg);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
+ duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
+ DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+ }
+ }
}
}
- }
- else
- {
- ret = duBuildAndSendUeDeleteReq(cellId,crnti);
- if(ret == RFAILED)
+ else
{
- DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
+ ret = duBuildAndSendUeDeleteReq(cellId,crnti);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nERROR --> DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
+ }
}
}
-
return ret;
}