From ae6ea60a7a2c8ab47d5a56d0b70ea8fca9433290 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 2 May 2025 16:49:26 +0200 Subject: [PATCH] Use gNB-DU config update/CellStatus in stack Use the gNB-DU configuration update to signal the cell status in the stack. At the DU, modify the code to always send this message -- previously, we only sent this message if a SIB1 update was necessary, but now it's always, only including SIB1 updates if necessary. At the CU, as we don't really have a use as of now, print the information, but don't do anything with it. --- openair2/LAYER2/NR_MAC_gNB/config.c | 14 ++++++++++---- openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 15 +++++++++++---- openair2/RRC/NR/rrc_gNB_du.c | 7 +++++++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 90891919db..d65e02998a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -950,11 +950,17 @@ void prepare_du_configuration_update(gNB_MAC_INST *mac, /* send gNB-DU configuration update to RRC */ f1ap_gnb_du_configuration_update_t update = { .transaction_id = 1, - .num_cells_to_modify = 1, + .num_status = 1, + .status[0].plmn = info->plmn, + .status[0].nr_cellid = info->nr_cellid, + .status[0].service_state = F1AP_STATE_IN_SERVICE, }; - update.cell_to_modify[0].old_nr_cellid = info->nr_cellid; - update.cell_to_modify[0].info = *info; - update.cell_to_modify[0].sys_info = get_sys_info(mib, sib1, NULL); + if (mib && sib1) { + update.num_cells_to_modify = 1, + update.cell_to_modify[0].old_nr_cellid = info->nr_cellid; + update.cell_to_modify[0].info = *info; + update.cell_to_modify[0].sys_info = get_sys_info(mib, sib1, NULL); + } mac->mac_rrc.gnb_du_configuration_update(&update); } 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 32943097ba..e0abf3142f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -167,18 +167,25 @@ void f1_setup_response(const f1ap_setup_resp_t *resp) // we can configure other SIB only after having received the ones generated by CU bool update = nr_mac_configure_other_sib(mac, cu_cell->num_SI, cu_cell->SI_msg); + /* only if we have to update SIB1, set mib and sib1 to non-NULL to indicate + * in du_config_update that it has changed (otherwise, gNB-DU config update + * indicates only cell status */ + NR_BCCH_BCH_Message_t *mib = NULL; + NR_BCCH_DL_SCH_Message_t *sib1 = NULL; if (update) { - f1ap_setup_req_t *sr = mac->f1_config.setup_req; - DevAssert(sr->num_cells_available == 1); - f1ap_served_cell_info_t *info = &sr->cell[0].info; NR_COMMON_channels_t *cc = &mac->common_channels[0]; - prepare_du_configuration_update(mac, info, cc->mib, cc->sib1); + mib = cc->mib; + sib1 = cc->sib1; } mac->f1_config.setup_resp = malloc(sizeof(*mac->f1_config.setup_resp)); AssertFatal(mac->f1_config.setup_resp != NULL, "out of memory\n"); // Copy F1AP message *mac->f1_config.setup_resp = cp_f1ap_setup_response(resp); + + f1ap_setup_req_t *sr = mac->f1_config.setup_req; + DevAssert(sr->num_cells_available == 1); + prepare_du_configuration_update(mac, &sr->cell[0].info, mib, sib1); NR_SCHED_UNLOCK(&mac->sched_lock); // NOTE: Before accepting any UEs, we should initialize the UE states. diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index d6e025309a..12836dd7dc 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -556,6 +556,13 @@ void rrc_gNB_process_f1_du_configuration_update(f1ap_gnb_du_configuration_update LOG_W(RRC, "du_configuration_update->cells_to_delete_list is not supported yet"); } + for (int i = 0; i < conf_up->num_status; ++i) { + const f1ap_cell_status_t *cs = &conf_up->status[i]; + const char *status = cs->service_state == F1AP_STATE_IN_SERVICE ? "in service" : "out of service"; + const plmn_id_t *p = &cs->plmn; + LOG_I(NR_RRC, "cell PLMN %03d.%0*d Cell ID %ld is %s\n", p->mcc, p->mnc_digit_length, p->mnc, cs->nr_cellid, status); + } + /* Send DU Configuration Acknowledgement */ f1ap_gnb_du_configuration_update_acknowledge_t ack = {.transaction_id = conf_up->transaction_id}; rrc->mac_rrc.gnb_du_configuration_update_acknowledge(assoc_id, &ack);