From 84670fed17a640ca68c199055b740c41f04c9f4d Mon Sep 17 00:00:00 2001 From: "lal.harshita" Date: Tue, 22 Mar 2022 13:56:08 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-425] Changes in Ue Context Modification request for HO Signed-off-by: lal.harshita Change-Id: I3ce15a4c4de39d7f021485874f37057a1679d4a1 Signed-off-by: lal.harshita --- src/5gnrmac/mac.h | 1 + src/5gnrmac/mac_msg_hdl.c | 26 +++++-- src/5gnrmac/mac_ue_mgr.c | 3 +- src/5gnrrlc/rlc_msg_hdl.c | 3 +- src/5gnrsch/sch.c | 20 ++++- src/5gnrsch/sch.h | 1 + src/5gnrsch/sch_ue_mgr.c | 1 + src/cm/du_app_mac_inf.h | 8 ++ src/cm/mac_sch_interface.h | 8 ++ src/cu_stub/cu_f1ap_msg_hdl.c | 176 ++++++++++++++++++++++++++++++++---------- src/cu_stub/cu_f1ap_msg_hdl.h | 3 +- src/du_app/du_f1ap_msg_hdl.c | 125 +++++++++++++++++++++++------- src/du_app/du_mgr.h | 1 + src/du_app/du_ue_mgr.c | 10 ++- 14 files changed, 302 insertions(+), 84 deletions(-) diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index 3067cde25..9ee975f8d 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -214,6 +214,7 @@ typedef struct macUeCb MacBsrTmrCfg bsrTmrCfg; /* BSR Timer Info */ UeUlCb ulInfo; /* UE specific UL info */ UeDlCb dlInfo; /* UE specific DL info */ + DataTransmissionAction transmissionAction; }MacUeCb; struct macCellCb diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index e59e9bb19..e8ba97385 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -186,14 +186,26 @@ uint8_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd) * ****************************************************************/ uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd) { - uint16_t pduIdx; + uint8_t ueId = 0; + uint16_t pduIdx, cellIdx = 0; DU_LOG("\nDEBUG --> MAC : Received Rx Data indication"); /* TODO : compare the handle received in RxDataInd with handle send in PUSCH * PDU, which is stored in raCb */ for(pduIdx = 0; pduIdx < rxDataInd->numPdus; pduIdx++) { - unpackRxData(rxDataInd->cellId, rxDataInd->timingInfo, &rxDataInd->pdus[pduIdx]); + + GET_CELL_IDX(rxDataInd->cellId, cellIdx); + GET_UE_ID(rxDataInd->pdus[pduIdx].rnti, ueId); + + if(macCb.macCell[cellIdx] && macCb.macCell[cellIdx]->ueCb[ueId -1].transmissionAction == STOP_TRANSMISSION) + { + DU_LOG("\nINFO --> MAC : UL data transmission not allowed for UE %d", macCb.macCell[cellIdx]->ueCb[ueId -1].duUeF1apId); + } + else + { + unpackRxData(rxDataInd->cellId, rxDataInd->timingInfo, &rxDataInd->pdus[pduIdx]); + } MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rxDataInd->pdus[pduIdx].pduData,\ rxDataInd->pdus[pduIdx].pduLength); } @@ -771,10 +783,8 @@ uint8_t buildAndSendSrInd(UciInd *macUciInd, uint8_t crnti) * ****************************************************************/ uint8_t FapiMacUciInd(Pst *pst, UciInd *macUciInd) { - uint8_t pduIdx = 0; - uint8_t ret = ROK; - uint16_t nPdus; - uint16_t crnti; + uint8_t pduIdx = 0, ret = ROK; + uint16_t nPdus = 0, crnti = 0; if(macUciInd) { @@ -789,8 +799,8 @@ uint8_t FapiMacUciInd(Pst *pst, UciInd *macUciInd) if(macUciInd->pdus[pduIdx].uci.uciPucchF0F1.srInfo.srIndPres) { DU_LOG("\nDEBUG --> MAC : Received SR UCI indication"); - crnti = macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti; - ret = buildAndSendSrInd(macUciInd, crnti); + crnti = macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti; + ret = buildAndSendSrInd(macUciInd, crnti); } break; case UCI_IND_PUCCH_F2F3F4: diff --git a/src/5gnrmac/mac_ue_mgr.c b/src/5gnrmac/mac_ue_mgr.c index 6950bf31a..a201e52c5 100644 --- a/src/5gnrmac/mac_ue_mgr.c +++ b/src/5gnrmac/mac_ue_mgr.c @@ -1618,7 +1618,7 @@ uint8_t fillSchUeCfg(Pst *pst, SchUeCfg *schUeCfg, MacUeCfg *ueCfg) schUeCfg->cellId = ueCfg->cellId; schUeCfg->duUeF1apId = ueCfg->duUeF1apId; schUeCfg->crnti = ueCfg->crnti; - + schUeCfg->dataTransmissionInfo = ueCfg->transmissionAction; /* Copy MAC cell group config */ if(ueCfg->macCellGrpCfgPres == true) { @@ -2012,6 +2012,7 @@ uint8_t fillMacUeCb(MacUeCb *ueCb, MacUeCfg *ueCfg, uint8_t cellIdx) { DU_LOG("\nERROR --> MAC: Failed while filing MAC LC List at fillMacUeCb()"); } + ueCb->transmissionAction = ueCfg->transmissionAction; return ret; } diff --git a/src/5gnrrlc/rlc_msg_hdl.c b/src/5gnrrlc/rlc_msg_hdl.c index 9fbb0d7eb..d73f83386 100644 --- a/src/5gnrrlc/rlc_msg_hdl.c +++ b/src/5gnrrlc/rlc_msg_hdl.c @@ -65,6 +65,7 @@ uint8_t fillRlcUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp) rlcCfgRsp->cellId = rlcCRsp->cellId; rlcCfgRsp->ueId = rlcCRsp->ueId; + rlcCfgRsp->result = RLC_DU_APP_RSP_OK; for(idx = 0; idx < rlcCRsp->numEnt; idx++) { if(rlcCRsp->entCfgCfm[idx].status.status == CKW_CFG_CFM_OK) @@ -230,7 +231,7 @@ uint8_t fillRlcCfg(RlcCb *gCb, RlcCfgInfo *rlcUeCfg, RlcUeCfg *ueCfg) rlcUeCfg->cellId = ueCfg->cellId; rlcUeCfg->numEnt = ueCfg->numLcs; rlcUeCfg->transId = getTransId(); - + for(lcIdx = 0; lcIdx < rlcUeCfg->numEnt; lcIdx++) { if(fillLcCfg(gCb, &rlcUeCfg->entCfg[lcIdx], &ueCfg->rlcLcCfg[lcIdx]) != ROK) diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index 69e7c19d3..ac474c715 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -962,6 +962,12 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) GET_UE_ID(dlBoInfo->crnti, ueId); ueCb = &cell->ueCb[ueId-1]; + if(ueCb->ueCfg.dataTransmissionAction == STOP_DATA_TRANSMISSION) + { + DU_LOG("INFO --> SCH : DL Data transmission not allowed for UE %d", ueCb->ueCfg.duUeF1apId); + return ROK; + } + lcId = dlBoInfo->lcId; CHECK_LCID(lcId, isLcIdValid); if(isLcIdValid == FALSE) @@ -997,8 +1003,6 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) } else { - /* TODO : These part of changes will be corrected during DL scheduling as - * per K0 - K1 -K2 */ SET_ONE_BIT(ueId, cell->boIndBitMap); if(ueCb->dlInfo.dlLcCtxt[lcId].lcId == lcId) { @@ -1064,6 +1068,12 @@ uint8_t MacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd) return RFAILED; } + if(ueCb->ueCfg.dataTransmissionAction == STOP_DATA_TRANSMISSION) + { + DU_LOG("\nINFO --> SCH: UL Data transmission not allowed for UE %d", ueCb->ueCfg.duUeF1apId); + return ROK; + } + ueCb->bsrRcvd = true; /* store dataVolume per lcg in uecb */ for(lcgIdx = 0; lcgIdx < bsrInd->numLcg; lcgIdx++) @@ -1114,7 +1124,11 @@ uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd) DU_LOG("\nERROR --> SCH : Crnti %d is inactive", uciInd->crnti); return ROK; } - + if(ueCb->ueCfg.dataTransmissionAction == STOP_DATA_TRANSMISSION) + { + DU_LOG("\nINFO --> SCH: UL Data transmission not allowed for UE %d", ueCb->ueCfg.duUeF1apId); + return ROK; + } if(uciInd->numSrBits) { ueCb->srRcvd = true; diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 865bc0ea3..e1d8ad8f9 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -231,6 +231,7 @@ typedef struct schUeCfgCb SchAmbrCfg *ambrCfg; SchModulationInfo dlModInfo; SchModulationInfo ulModInfo; + SchDataTransmission dataTransmissionAction; }SchUeCfgCb; /*Following structures to keep record and estimations of PRB allocated for each diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index 83856f718..fa4ce2e55 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -261,6 +261,7 @@ uint8_t fillSchUeCb(Inst inst, SchUeCb *ueCb, SchUeCfg *ueCfg) ueCb->ueCfg.cellId = ueCfg->cellId; ueCb->ueCfg.duUeF1apId = ueCfg->duUeF1apId; ueCb->ueCfg.crnti = ueCfg->crnti; + ueCb->ueCfg.dataTransmissionAction = ueCfg->dataTransmissionInfo; if(ueCfg->macCellGrpCfgPres == true) { memcpy(&ueCb->ueCfg.macCellGrpCfg , &ueCfg->macCellGrpCfg, sizeof(SchMacCellGrpCfg)); diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index f4d185db1..abaaab1a6 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -521,6 +521,13 @@ typedef enum RSRC_RRC_CONNECTED_USERS }ResourceType; +typedef enum +{ + TRANSMISSION_ALLOWED, + STOP_TRANSMISSION, + RESTART_TRANSMISSION +}DataTransmissionAction; + typedef struct failureCause { CauseGrp type; @@ -1260,6 +1267,7 @@ typedef struct macUeCfg uint8_t numLcs; LcCfg lcCfgList[MAX_NUM_LC]; UeCfgState macUeCfgState; /* InActive / Completed */ + DataTransmissionAction transmissionAction; }MacUeCfg; typedef struct nrcgi diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 9bea28b9c..0bb6dace4 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -428,6 +428,13 @@ typedef enum BOTH }DlPduType; +typedef enum +{ + DATA_TRANSMISSION_ALLOWED, + STOP_DATA_TRANSMISSION, + RESTART_DATA_TRANSMISSION +}SchDataTransmission; + /*structures*/ typedef struct timeDomainAlloc { @@ -1578,6 +1585,7 @@ typedef struct schUeCfg SchModulationInfo ulModInfo; uint8_t numLcs; SchLcCfg schLcCfg[MAX_NUM_LC]; + SchDataTransmission dataTransmissionInfo; }SchUeCfg; typedef struct schUeCfgRsp diff --git a/src/cu_stub/cu_f1ap_msg_hdl.c b/src/cu_stub/cu_f1ap_msg_hdl.c index 30c492782..2bf96de62 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.c +++ b/src/cu_stub/cu_f1ap_msg_hdl.c @@ -1179,6 +1179,22 @@ uint8_t fillDlCcchRrcMsg(CuUeCb *ueCb, RRCContainer_t *rrcContainer) } } +/******************************************************************* + * + * @brief Fills QOS flow configuration + * + * @details + * + * Function : fillQosFlowsToAdd + * + * Functionality: Fills QOS flow configuration + * + * @params[in] struct SDAP_Config__mappedQoS_FlowsToAdd *qosFlow + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ uint8_t fillQosFlowsToAdd(struct SDAP_Config__mappedQoS_FlowsToAdd *qosFlow) { uint8_t idx, ied, elementCnt; @@ -6063,6 +6079,17 @@ uint8_t BuildRlcBearerToAddModList(CuUeCb *ueCb, struct CellGroupConfigRrc__rlc_ } } + if(!elementCnt) + { + DU_LOG("INFO --> F1AP : No RLC Bearer available to add or modify"); + return ROK; + } + CU_ALLOC(rlcBearerList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList)); + if(!rlcBearerList) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failure in CellGrpConfig"); + return RFAILED; + } rlcBearerList->list.count = elementCnt; rlcBearerList->list.size = elementCnt * sizeof(struct RLC_BearerConfig *); @@ -6137,7 +6164,7 @@ uint8_t BuildRlcBearerToAddModList(CuUeCb *ueCb, struct CellGroupConfigRrc__rlc_ for(drbIdx=0; drbIdx < ueCb->numDrb; drbIdx++) { - if(!updateAllRbCfg && ueCb->srbList[srbIdx].cfgSentToUe) + if(!updateAllRbCfg && ueCb->drbList[drbIdx].cfgSentToUe) continue; rlcBearerList->list.array[idx]->logicalChannelIdentity = ueCb->drbList[drbIdx].lcId; @@ -6412,12 +6439,7 @@ uint8_t fillCellGrpCfg(CuUeCb *ueCb, OCTET_STRING_t *cellGrp, bool updateAllRbCf cellGrpCfg.cellGroupId = CELL_GRP_ID; cellGrpCfg.rlc_BearerToAddModList = NULLP; - CU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList)); - if(!cellGrpCfg.rlc_BearerToAddModList) - { - DU_LOG("\nERROR --> F1AP : Memory allocation failure in CellGrpConfig"); - break; - } + if(BuildRlcBearerToAddModList(ueCb, cellGrpCfg.rlc_BearerToAddModList, updateAllRbCfg) != ROK) { DU_LOG("\nERROR --> F1AP : fillCellGrpCfg failed"); @@ -7610,19 +7632,32 @@ void freeRrcReconfig(RRCReconfiguration_t *rrcReconfig) * ****************************************************************/ uint8_t fillSrbToAddModList(CuUeCb *ueCb, SRB_ToAddModList_t *srbToAddList, bool updateAllRbCfg) { - uint8_t srbIdx, srbDbIdx; + uint8_t srbIdx, srbDbIdx, elementCnt = 0; if(updateAllRbCfg) - srbToAddList->list.count = ueCb->numSrb; + elementCnt = ueCb->numSrb; else { - srbToAddList->list.count = 0; for(srbDbIdx=0; srbDbIdx < ueCb->numSrb; srbDbIdx++) { if(ueCb->srbList[srbDbIdx].cfgSentToUe == false) - srbToAddList->list.count++; + elementCnt++; } } + + if(!elementCnt) + { + DU_LOG("INFO --> F1AP : No SRB available to add or modify"); + return ROK; + } + + CU_ALLOC(srbToAddList, sizeof(SRB_ToAddModList_t)); + if(!srbToAddList) + { + DU_LOG("\nERROR --> F1AP: Memory allocation failed for SRB to AddMod List in fillRadioBearerConfig"); + return RFAILED; + } + srbToAddList->list.count = elementCnt; srbToAddList->list.size = srbToAddList->list.count * sizeof(SRB_ToAddMod_t *); CU_ALLOC(srbToAddList->list.array, srbToAddList->list.size); @@ -7696,19 +7731,34 @@ uint8_t fillSrbToAddModList(CuUeCb *ueCb, SRB_ToAddModList_t *srbToAddList, bool * ****************************************************************/ uint8_t fillDrbToAddModList(CuUeCb *ueCb, DRB_ToAddModList_t *drbToAddList, bool updateAllRbCfg) { - uint8_t drbIdx, drbDbIdx; + uint8_t drbIdx, drbDbIdx, elementCnt = 0; if(updateAllRbCfg) - drbToAddList->list.count = ueCb->numDrb; + elementCnt = ueCb->numDrb; else { - drbToAddList->list.count = 0; for(drbDbIdx=0; drbDbIdx < ueCb->numDrb; drbDbIdx++) { if(ueCb->drbList[drbDbIdx].cfgSentToUe == false) - drbToAddList->list.count++; + elementCnt++; } } + + if(!elementCnt) + { + DU_LOG("INFO --> F1AP : No DRB available to add or modify"); + return ROK; + } + + /* DRB To Add/Mod List */ + CU_ALLOC(drbToAddList, sizeof(DRB_ToAddModList_t)); + if(!drbToAddList) + { + DU_LOG("\nERROR --> F1AP: Memory allocation failed for DRB to AddMod List in fillRadioBearerConfig"); + return RFAILED; + } + + drbToAddList->list.count = elementCnt; drbToAddList->list.size = drbToAddList->list.count * sizeof(DRB_ToAddMod_t *); CU_ALLOC(drbToAddList->list.array, drbToAddList->list.size); @@ -7815,24 +7865,11 @@ uint8_t fillDrbToAddModList(CuUeCb *ueCb, DRB_ToAddModList_t *drbToAddList, bool uint8_t fillRadioBearerConfig(CuUeCb *ueCb, RadioBearerConfig_t *radioBearerConfig, bool updateAllRbCfg) { /* SRB To Add/Mod List */ - CU_ALLOC(radioBearerConfig->srb_ToAddModList, sizeof(SRB_ToAddModList_t)); - if(!radioBearerConfig->srb_ToAddModList) - { - DU_LOG("\nERROR --> F1AP: Memory allocation failed for SRB to AddMod List in fillRadioBearerConfig"); - return RFAILED; - } if(fillSrbToAddModList(ueCb, radioBearerConfig->srb_ToAddModList, updateAllRbCfg) != ROK) { return RFAILED; } - /* DRB To Add/Mod List */ - CU_ALLOC(radioBearerConfig->drb_ToAddModList, sizeof(DRB_ToAddModList_t)); - if(!radioBearerConfig->drb_ToAddModList) - { - DU_LOG("\nERROR --> F1AP: Memory allocation failed for DRB to AddMod List in fillRadioBearerConfig"); - return RFAILED; - } if(fillDrbToAddModList(ueCb, radioBearerConfig->drb_ToAddModList, updateAllRbCfg) != ROK) { return RFAILED; @@ -8618,6 +8655,12 @@ uint8_t fillHOPreparationInfoBuf(CuUeCb *ueCb, HandoverPreparationInformation_t return RFAILED; } ret = fillRrcReconfigBuf(ueCb, &hoPrepInfoIe->sourceConfig->rrcReconfiguration, true); + + if(ret != ROK) + { + DU_LOG( "\nERROR --> F1AP : Failed to fill Rrc reconfiguration buffer"); + return RFAILED; + } hoPrepInfoIe->rrm_Config = NULLP; hoPrepInfoIe->as_Context = NULLP; @@ -10384,20 +10427,20 @@ void FreeDrbToBeModifiedList(DRBs_ToBeModified_List_t *drbSet) void FreeUeContextModicationRequest(F1AP_PDU_t *f1apMsg) { uint8_t arrIdx =0 , ieId=0; - UEContextModificationRequest_t *UeContextModifyReq = NULLP; + UEContextModificationRequest_t *ueContextModifyReq = NULLP; if(f1apMsg) { if(f1apMsg->choice.initiatingMessage) { - UeContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest; - if(UeContextModifyReq->protocolIEs.list.array) + ueContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest; + if(ueContextModifyReq->protocolIEs.list.array) { - for( arrIdx = 0 ; arrIdxprotocolIEs.list.count ; arrIdx++) + for( arrIdx = 0 ; arrIdxprotocolIEs.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: @@ -10406,22 +10449,29 @@ void FreeUeContextModicationRequest(F1AP_PDU_t *f1apMsg) break; case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List: { - FreeDrbToBeSetupModList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->value.\ + FreeDrbToBeSetupModList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.\ choice.DRBs_ToBeSetupMod_List); break; } case ProtocolIE_ID_id_DRBs_ToBeModified_List: { - FreeDrbToBeModifiedList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->value.\ - choice.DRBs_ToBeSetupMod_List); + FreeDrbToBeModifiedList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.\ + choice.DRBs_ToBeModified_List); break; } + case ProtocolIE_ID_id_TransmissionActionIndicator: + break; + case ProtocolIE_ID_id_RRCContainer: + { + CU_FREE(ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.buf,\ + ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.size); + } } - CU_FREE(UeContextModifyReq->protocolIEs.list.array[arrIdx], sizeof(UEContextModificationRequest_t)); + CU_FREE(ueContextModifyReq->protocolIEs.list.array[arrIdx], sizeof(UEContextModificationRequest_t)); } } - CU_FREE(UeContextModifyReq->protocolIEs.list.array, UeContextModifyReq->protocolIEs.list.size); + CU_FREE(ueContextModifyReq->protocolIEs.list.array, ueContextModifyReq->protocolIEs.list.size); } CU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t)); } @@ -10453,10 +10503,9 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt CuUeCb *ueCb = (CuUeCb *)cuUeCb; F1AP_PDU_t *f1apMsg = NULLP; UEContextModificationRequest_t *ueContextModifyReq = NULLP; - + action =RESTART_DATA_TX; asn_enc_rval_t encRetVal; DU_LOG("\nINFO --> F1AP : Building Ue context modification request\n"); - while(1) { CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t)); @@ -10486,6 +10535,9 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt elementCnt = 3; else if(action == RRC_RECONFIG_COMPLETE_IND) elementCnt = 3; + else if((action == STOP_DATA_TX) || (action == RESTART_DATA_TX)) + elementCnt = 5; + ueContextModifyReq->protocolIEs.list.count = elementCnt; ueContextModifyReq->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationRequest_t *); @@ -10545,8 +10597,11 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt if(ret != ROK) { + DU_LOG("\nERROR --> F1AP : BuildAndSendUeContextModificationReq(): Failed to build drb to be modified list"); break; } + + /* TODO: fill the RRC reconfiguration information in RRC Contaiiner ie in case of MODIFY_UE */ } else if(action == QUERY_CONFIG) { @@ -10567,6 +10622,45 @@ uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *cuUeCb, UeCtxt ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCReconfigurationCompleteIndicator = \ RRCReconfigurationCompleteIndicator_true; } + else if((action == STOP_DATA_TX) || (action == RESTART_DATA_TX)) + { + ieIdx++; + if(action == STOP_DATA_TX) + { + ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_TransmissionActionIndicator; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = \ + UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator = \ + TransmissionActionIndicator_stop; + } + else if (action == RESTART_DATA_TX) + { + ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_TransmissionActionIndicator; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = \ + UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator = \ + TransmissionActionIndicator_restart; + } + ieIdx++; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCContainer; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = \ + UEContextModificationRequestIEs__value_PR_RRCContainer; + if(fillRrcReconfigBuf(ueCb, &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer, true) != ROK) + { + DU_LOG( "\nERROR --> F1AP : Failed to fill Rrc reconfiguration buffer"); + return RFAILED; + } + + /* RRC delivery status request */ + ieIdx++; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCDeliveryStatusRequest; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present = UEContextModificationRequestIEs__value_PR_RRCDeliveryStatusRequest; + ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCDeliveryStatusRequest = RRCDeliveryStatusRequest_true; + } xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg); diff --git a/src/cu_stub/cu_f1ap_msg_hdl.h b/src/cu_stub/cu_f1ap_msg_hdl.h index fd923c25d..0ebc88d5f 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.h +++ b/src/cu_stub/cu_f1ap_msg_hdl.h @@ -165,7 +165,8 @@ typedef enum MODIFY_UE, /* Modify UE configuration at DU */ RRC_RECONFIG_COMPLETE_IND, /* Indicate to DU that RRC Reconfiguration is complete */ QUERY_CONFIG, /* Query DU for its configurations */ - STOP_DATA_TX /* Stop data transmission from DU to a particular UE */ + STOP_DATA_TX, /* Stop data transmission from DU to a particular UE */ + RESTART_DATA_TX /* Restart data transmission from DU to a particular UE */ }UeCtxtModAction; typedef struct f1apDb diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 1279b6919..723924339 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -13966,6 +13966,13 @@ uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg) 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); @@ -14162,7 +14169,12 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb) 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) @@ -14213,28 +14225,31 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb) } 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; + } } } @@ -14520,17 +14535,17 @@ void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet) * @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 ; arrIdxprotocolIEs.list.count ; arrIdx++) + for( arrIdx = 0 ; arrIdxprotocolIEs.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: @@ -14539,15 +14554,21 @@ void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *U 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); } } /******************************************************************* @@ -14600,6 +14621,7 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) { DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb)); duUeCb->f1UeDb->cellIdx = cellIdx; + duUeCb->f1UeDb->actionType = UE_CTXT_MOD; } break; } @@ -14613,12 +14635,34 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) } 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) { @@ -14669,6 +14713,31 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg) } 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; + } + } } diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index c294cb8b9..5f02a2ceb 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -139,6 +139,7 @@ typedef struct duUeCfg UpTnlCfg upTnlInfo[MAX_NUM_DRB]; /* User plane TNL Info*/ uint8_t numDrbSetupMod; /*No. of DRB Added during Modification*/ MacUeCfg copyOfmacUeCfg; + DataTransmissionAction dataTransmissionAction; }DuUeCfg; typedef struct f1UeContextSetup diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index 7a55d58d9..96a496ffe 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -1223,12 +1223,19 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuU } else { + if(ueCfgDb->dataTransmissionAction == STOP_TRANSMISSION) + { + macUeCfg->transmissionAction = ueCfgDb->dataTransmissionAction; + return ROK; + } + /* Fetching MacDb from DuUeCb. * In case of UE hand-in, UE context is created before RRC setup. Hence * crnti is not known yet. Thus, passing crnti=0 to this function. * In such a case actvCellLst doesnt yet have any entry for this UE. So * duMacDb will be NULL. */ + if(crnti != 0) { GET_CELL_IDX(cellId, cellIdx); @@ -1241,7 +1248,7 @@ uint8_t fillMacUeCfg(uint16_t cellId, uint8_t gnbDuUef1apId, uint16_t crnti, DuU } duMacDb->macUeCfgState = UE_CFG_INPROGRESS; } - + if(ueCfgDb->cellGrpCfg) { ret = procUeReCfgCellInfo(macUeCfg, duMacDb, ueCfgDb->cellGrpCfg); @@ -1671,6 +1678,7 @@ uint8_t fillRlcUeCfg(uint16_t cellId, uint8_t ueId, DuUeCfg *ueCfgDb, RlcUeCfg * /*Filling RlcUeCfg */ rlcUeCfg->cellId = cellId; rlcUeCfg->ueId = ueId; + for(dbIdx = 0; (dbIdx < ueCfgDb->numRlcLcs && ret == ROK); dbIdx++) { ret = fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]); -- 2.16.6