From 6ffefa70d25f1f2e9a5879d4eb8f3af6379b54a9 Mon Sep 17 00:00:00 2001 From: barveankit Date: Sun, 6 Mar 2022 22:47:48 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-427] Changes in Ue Context Release Command for handover Signed-off-by: barveankit Change-Id: Ic618d627e15477fd739b49aff491f3a6451e89ff Signed-off-by: barveankit --- src/cu_stub/cu_f1ap_msg_hdl.c | 57 +++++++++++++++++------------ src/cu_stub/cu_f1ap_msg_hdl.h | 4 +- src/cu_stub/cu_stub.h | 2 +- src/du_app/du_f1ap_msg_hdl.c | 85 ++++++++++++++++++++++--------------------- src/du_app/du_f1ap_msg_hdl.h | 2 +- src/du_app/du_ue_mgr.c | 62 ++++++++++++++----------------- 6 files changed, 110 insertions(+), 102 deletions(-) diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c index e5bbb6e55..fdf616846 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.c +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -8438,7 +8438,9 @@ void FreeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg) 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; @@ -8468,7 +8470,13 @@ uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, u 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*); @@ -8495,6 +8503,7 @@ uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, u { 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; @@ -8509,34 +8518,36 @@ uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, u 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 */ diff --git a/src/cu_stub/cu_f1ap_msg_hdl.h b/src/cu_stub/cu_f1ap_msg_hdl.h index 585eb5843..b9f9b4121 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.h +++ b/src/cu_stub/cu_f1ap_msg_hdl.h @@ -64,8 +64,8 @@ typedef enum /* 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; diff --git a/src/cu_stub/cu_stub.h b/src/cu_stub/cu_stub.h index d2c3f88c6..fb2674086 100644 --- a/src/cu_stub/cu_stub.h +++ b/src/cu_stub/cu_stub.h @@ -77,7 +77,7 @@ if(cuCb.duInfo[_duIdx].duId == _duId)\ {\ _duDb = (&cuCb.duInfo[_duIdx]);\ - break; \ + break; \ }\ }\ } diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 2a8cbad50..b175d4a86 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -14948,8 +14948,8 @@ void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg) 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; @@ -14979,11 +14979,6 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg) } case ProtocolIE_ID_id_Cause: - { - break; - } - - case ProtocolIE_ID_id_RRCContainer: { for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++) { @@ -14992,39 +14987,9 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg) 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; } @@ -15034,13 +14999,51 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg) 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 : @@ -15053,7 +15056,7 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg) } if(ret != RFAILED) { - duProcUeContextReleaseCommand(duUeCb); + duProcUeContextReleaseCommand(cellId, duUeCb); } freeAperDecodeUeContextReleaseCommand(f1apMsg); return ret; diff --git a/src/du_app/du_f1ap_msg_hdl.h b/src/du_app/du_f1ap_msg_hdl.h index cbc05dd13..d1ca3767c 100644 --- a/src/du_app/du_f1ap_msg_hdl.h +++ b/src/du_app/du_f1ap_msg_hdl.h @@ -52,7 +52,7 @@ uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg * 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 **********************************************************************/ diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index f0212001e..b18ee5e9f 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -3268,50 +3268,44 @@ void deleteRlcUeCfg(RlcUeCfg *ueCfg) * 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; } -- 2.16.6