From 21795b3b88cbb3f48c28d546a342f864ad7313f1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 5 Oct 2023 12:35:51 +0200 Subject: [PATCH 1/6] Correctly encode NRCGI in F1 UE Ctxt Modif Req The two hardcoded PLMNs are never executed: they are in an if(0) block --- openair2/F1AP/f1ap_cu_ue_context_management.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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); } } From 84ffd14a8fa3f23f516bc7afc4132cd504a8fb86 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 5 Oct 2023 12:36:26 +0200 Subject: [PATCH 2/6] Correctly handle UE Ctxt Modif RRC container The RRC container is to be handled by the msg handler in mac_rrc_dl_handler.c. Therefore, don't forward the RRC message, but copy it into the message so the handler can take the action. --- openair2/F1AP/f1ap_du_ue_context_management.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index b9d29303f0..851ced9176 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"); } From 68a82e0b7dbbbbeaa2132e13b484d24728f9563c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 5 Oct 2023 14:22:14 +0200 Subject: [PATCH 3/6] F1 Initial UL RRC message: fill PLMN and Cell ID --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index b9bb149310..154c4d072a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2916,8 +2916,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, From aaef0b5e747b79c6967b6b12222056204789fb65 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 5 Oct 2023 14:21:54 +0200 Subject: [PATCH 4/6] F1 UE Ctxt Modif Req: forward Capabilities, ignore other CU2DU - forward capabilities to update CellGroupConfig - Do not require measConfig/cG_ConfigInfo to be NULL, but ignore them, as it is not implemented --- openair2/F1AP/f1ap_du_ue_context_management.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 851ced9176..91cb157c9d 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -935,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; } From 4066fd4ba280173be300e4e354ef3db315978941 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 5 Oct 2023 14:22:38 +0200 Subject: [PATCH 5/6] UE Context Modification Handler: also trigger CellConfig if only UE Capability changes --- openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); From c3df9c277fa05231431ca44e4cade230a303d4d2 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sun, 8 Oct 2023 12:27:18 +0200 Subject: [PATCH 6/6] Remove warning about new CellGroupConfig It is *normal* to receive new CellGroupConfigs from the DU, hence a warning is not warranted. --- openair2/RRC/NR/rrc_gNB.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index e5dcc79dfd..f57c7567f5 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,