diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 1fb4981330..876cd1e3a9 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -957,9 +957,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context F1AP_UEContextModificationRequest_t *out; uint8_t *buffer=NULL; uint32_t len=0; - // for test - LOG_W(F1AP, "UE Context Modification Request PLMN is hardcoded!\n"); - f1ap_served_cell_info_t hardCoded= { .plmn.mcc=208, .plmn.mnc=93, .plmn.mnc_digit_length=2}; + /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; @@ -985,13 +983,18 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context /* optional */ /* c3. NRCGI */ - if (0) { + if (true) { asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie3); ie3->id = F1AP_ProtocolIE_ID_id_SpCell_ID; ie3->criticality = F1AP_Criticality_ignore; ie3->value.present = F1AP_UEContextModificationRequestIEs__value_PR_NRCGI; /* - nRCGI */ - addnRCGI(ie3->value.choice.NRCGI, &hardCoded); + + f1ap_served_cell_info_t nrcgi = { + .plmn = f1ap_ue_context_modification_req->plmn, + .nr_cellid = f1ap_ue_context_modification_req->nr_cellid, + }; + addnRCGI(ie3->value.choice.NRCGI, &nrcgi); } /* optional */ @@ -1113,6 +1116,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context F1AP_SCell_ToBeSetupMod_Item_t *scell_toBeSetupMod_item= &scell_toBeSetupMod_item_ies->value.choice.SCell_ToBeSetupMod_Item; // /* - sCell_ID */ + f1ap_served_cell_info_t hardCoded = {0}; addnRCGI(scell_toBeSetupMod_item->sCell_ID, &hardCoded); /* sCellIndex */ scell_toBeSetupMod_item->sCellIndex = 6; // issue here @@ -1140,6 +1144,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context F1AP_SCell_ToBeRemoved_Item_t *scell_toBeRemoved_item= &scell_toBeRemoved_item_ies->value.choice.SCell_ToBeRemoved_Item; /* - sCell_ID */ + f1ap_served_cell_info_t hardCoded = {0}; addnRCGI(scell_toBeRemoved_item->sCell_ID, &hardCoded); } } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index b9d29303f0..91cb157c9d 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -927,16 +927,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t f1ap_ue_context_modification_req->rrc_container = malloc(ieRRC->value.choice.RRCContainer.size); memcpy(f1ap_ue_context_modification_req->rrc_container, ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size); - protocol_ctxt_t ctxt; - // decode RRC Container and act on the message type - ctxt.rntiMaybeUEid = f1ap_ue_context_modification_req->gNB_DU_ue_id; - ctxt.instance = instance; - ctxt.module_id = instance; - ctxt.enb_flag = 1; - ctxt.eNB_index = instance; - mem_block_t *pdcp_pdu_p = get_free_mem_block(ieRRC->value.choice.RRCContainer.size, __func__); - memcpy(&pdcp_pdu_p->data[0], ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size); - du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ieRRC->value.choice.RRCContainer.size, pdcp_pdu_p); + f1ap_ue_context_modification_req->rrc_container_length = ieRRC->value.choice.RRCContainer.size; } else { LOG_E(F1AP, " RRCContainer in UEContextModificationRequestIEs size id 0\n"); } @@ -944,6 +935,32 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t LOG_D(F1AP, "can't find RRCContainer in UEContextModificationRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } + /* CU2DU Information */ + F1AP_UEContextModificationRequestIEs_t *ieCU2DU = NULL; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextModificationRequestIEs_t, + ieCU2DU, + container, + F1AP_ProtocolIE_ID_id_CUtoDURRCInformation, + false); + if (ieCU2DU != NULL) { + f1ap_ue_context_modification_req->cu_to_du_rrc_information = + calloc(1, sizeof(*f1ap_ue_context_modification_req->cu_to_du_rrc_information)); + AssertFatal(f1ap_ue_context_modification_req->cu_to_du_rrc_information != NULL, "out of memory\n"); + cu_to_du_rrc_information_t *cu2du = f1ap_ue_context_modification_req->cu_to_du_rrc_information; + const F1AP_CUtoDURRCInformation_t *cu2duie = &ieCU2DU->value.choice.CUtoDURRCInformation; + if (cu2duie->cG_ConfigInfo != NULL) + LOG_W(F1AP, "UE RNTI %04x: ignoring cg_ConfigInfo, not implemented\n", f1ap_ue_context_modification_req->gNB_DU_ue_id); + if (cu2duie->measConfig != NULL) + LOG_W(F1AP, "UE RNTI %04x: ignoring measConfig, not implemented\n", f1ap_ue_context_modification_req->gNB_DU_ue_id); + if (cu2duie->uE_CapabilityRAT_ContainerList != NULL) { + F1AP_UE_CapabilityRAT_ContainerList_t *uecap = cu2duie->uE_CapabilityRAT_ContainerList; + cu2du->uE_CapabilityRAT_ContainerList = calloc(uecap->size, sizeof(*cu2du->uE_CapabilityRAT_ContainerList)); + AssertFatal(cu2du->uE_CapabilityRAT_ContainerList != NULL, "out of memory\n"); + cu2du->uE_CapabilityRAT_ContainerList_length = uecap->size; + memcpy(cu2du->uE_CapabilityRAT_ContainerList, uecap->buf, uecap->size); + } + } + ue_context_modification_request(f1ap_ue_context_modification_req); return 0; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ce465438a6..fc317593fb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2917,8 +2917,11 @@ void send_initial_ul_rrc_message(gNB_MAC_INST *mac, int rnti, const uint8_t *sdu uint8_t du2cu[1024]; int encoded = encode_cellGroupConfig(UE->CellGroup, du2cu, sizeof(du2cu)); + DevAssert(mac->f1_config.setup_req != NULL); + AssertFatal(mac->f1_config.setup_req->num_cells_available == 1, "can handle only one cell\n"); const f1ap_initial_ul_rrc_message_t ul_rrc_msg = { - /* TODO: add mcc, mnc, cell_id, ..., is not available at MAC yet */ + .plmn = mac->f1_config.setup_req->cell[0].info.plmn, + .nr_cellid = mac->f1_config.setup_req->cell[0].info.nr_cellid, .gNB_DU_ue_id = rnti, .crnti = rnti, .rrc_container = (uint8_t *) sdu, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index e18c9ea5b7..ea0d08e152 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -369,7 +369,8 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) update_cellGroupConfig(new_CellGroup, UE->uid, UE->capability, &mac->radio_config, scc); } - if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0 || req->drbs_to_be_released_length > 0) { + if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0 || req->drbs_to_be_released_length > 0 + || ue_cap != NULL) { resp.du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t)); AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n"); resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1, 1024); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index e7f36ff9c6..b057d023b3 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2077,7 +2077,6 @@ static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, i } if (resp->du_to_cu_rrc_information != NULL && resp->du_to_cu_rrc_information->cellGroupConfig != NULL) { - LOG_W(RRC, "UE context modification response contains new CellGroupConfig for UE %04x, triggering reconfiguration\n", UE->rnti); NR_CellGroupConfig_t *cellGroupConfig = NULL; asn_dec_rval_t dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_CellGroupConfig,