From 4569ef199d2cee6c803530f61b6afefbb3905e0e Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 15 Jan 2026 23:49:40 +0100 Subject: [PATCH] Refactor (RRC): drop isIntraFrequencyNeighbour flag and labelling Remove the isIntraFrequencyNeighbour field and all code that sets or uses it, simplifying neighbour cell handling and avoiding redundant state in the RRC gNB code. The flag duplicated information that can be derived from the neighbour absoluteFrequencySSB and the serving cell SSB ARFCN, and intra-frequency neighbours are logged in the SIB3 preparation flow. Changes: - Remove isIntraFrequencyNeighbour from nr_neighbour_cell_t in openair2/RRC/NR/nr_rrc_defs.h - Delete is_intra_frequency_neighbour() and label_intra_frequency_neighbours() helpers from openair2/RRC/NR/rrc_gNB_du.c - Remove calls to label_intra_frequency_neighbours() from rrc_gNB_process_f1_setup_req() and rrc_gNB_process_f1_du_configuration_update() in rrc_gNB_du.c - Stop setting .isIntraFrequencyNeighbour in the local nr_neighbour_cell_t neighbourConfig initializer in openair2/RRC/NR/rrc_gNB_mobility.c --- openair2/RRC/NR/nr_rrc_defs.h | 1 - openair2/RRC/NR/rrc_gNB_du.c | 42 ------------------------------ openair2/RRC/NR/rrc_gNB_mobility.c | 1 - 3 files changed, 44 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index f0e212c79f..113fbe2f94 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -387,7 +387,6 @@ typedef struct { int band; plmn_id_t plmn; uint32_t tac; - bool isIntraFrequencyNeighbour; // SIB3 (intra-frequency neighbor cell-specific offsets) nr_neighbour_cell_sib3_t sib3; // SIB4 (inter-frequency neighbor cell-specific parameters) diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index 9843d02b83..6b60e5b6b9 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -538,41 +538,6 @@ static const neighbour_cell_configuration_t *get_cell_neighbour_list(const gNB_R return (const neighbour_cell_configuration_t *)it; } -static void is_intra_frequency_neighbour(void *ssb_arfcn, void *neighbour_cell) -{ - uint32_t *ssb_arfcn_ptr = (uint32_t *)ssb_arfcn; - nr_neighbour_cell_t *neighbour_cell_ptr = (nr_neighbour_cell_t *)neighbour_cell; - - if (*ssb_arfcn_ptr == neighbour_cell_ptr->absoluteFrequencySSB) { - LOG_D(NR_RRC, "HO LOG: found intra frequency neighbour %lu!\n", neighbour_cell_ptr->nrcell_id); - neighbour_cell_ptr->isIntraFrequencyNeighbour = true; - } -} -/** - * @brief Labels neighbour cells if they are intra frequency to prepare meas config only for intra frequency ho - * @param[in] rrc Pointer to RRC instance - * @param[in] cell Pointer to cell container - */ -static void label_intra_frequency_neighbours(gNB_RRC_INST *rrc, const nr_rrc_cell_container_t *cell) -{ - if (!rrc->neighbour_cell_configuration) - return; - - const neighbour_cell_configuration_t *neighbour_cell_config = get_cell_neighbour_list(rrc, cell); - if (!neighbour_cell_config) - return; - - uint32_t ssb_arfcn = get_ssb_arfcn(cell); - LOG_D(NR_RRC, - "Cell %lu (PCI %d, SSB ARFCN %u) has neighbour cell configuration, labeling intra-frequency neighbours\n", - cell->info.cell_id, - cell->info.pci, - ssb_arfcn); - - const seq_arr_t *cell_neighbour_list = &neighbour_cell_config->neighbour_cells; - for_each((seq_arr_t *)cell_neighbour_list, (void *)&ssb_arfcn, is_intra_frequency_neighbour); -} - static bool valid_du_in_neighbour_configs(const seq_arr_t *neighbour_cell_configuration, const f1ap_served_cell_info_t *cell) { // MTC is mandatory, but some DUs don't send it in the F1 Setup Request, so @@ -880,9 +845,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) } } - if (new->mib != NULL &&new->sib1 != NULL) - label_intra_frequency_neighbours(rrc, new); - resp.cells_to_activate[i] = cell; } @@ -1098,10 +1060,6 @@ void rrc_gNB_process_f1_du_configuration_update(f1ap_gnb_du_configuration_update LOG_I(NR_RRC, "update system information of DU %ld\n", du->gNB_DU_id); } } - - if (cell && cell->mib != NULL && cell->sib1 != NULL && cell->assoc_id == du->assoc_id) { - label_intra_frequency_neighbours(rrc, cell); - } } if (conf_up->num_cells_to_delete > 0) { diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index e36e6ee684..fdbc2d66af 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -607,7 +607,6 @@ void nr_HO_N2_trigger_telnet(gNB_RRC_INST *rrc, uint32_t neighbour_pci, uint32_t if (neighbour_pci == scell_pci) { LOG_I(NR_RRC, "UE %d: trigger handover on the same cell PCI=%d\n", rrc_ue_id, neighbour_pci); nr_neighbour_cell_t neighbourConfig = { - .isIntraFrequencyNeighbour = true, .gNB_ID = du->gNB_DU_id, .nrcell_id = pcell->info.cell_id, .physicalCellId = pcell->info.pci,