From 196855364caa657b62f43efb2b3f2c03f052a503 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 11 Feb 2026 11:48:58 +0100 Subject: [PATCH] Add documentation to refactored functions in gnb_config.c --- openair2/GNB_APP/gnb_config.c | 11 +++++++++++ openair2/GNB_APP/gnb_config_common.c | 3 +++ 2 files changed, 14 insertions(+) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 10ab9a73d0..c758b391b8 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2012,11 +2012,16 @@ static nr_neighbour_cell_t *get_neighbour_by_pci(seq_arr_t *neighbour_cells, int return NULL; } +/** @brief Parse and add neighbour cells for a given cell configuration + * @param[in,out] cell Neighbour cell configuration to populate + * @param[in] list Parameter list describing neighbour cells + * @param[in] n_path Base path for neighbour configuration in the config tree */ static void parse_neighbour_cells_list(neighbour_cell_configuration_t *cell, const paramlist_def_t *list, const char *n_path) { cell->neighbour_cells = malloc_or_fail(sizeof(seq_arr_t)); seq_arr_init(cell->neighbour_cells, sizeof(nr_neighbour_cell_t)); + /* Parse each neighbour cell in the list */ for (int l = 0; l < list->numelt; ++l) { const paramdef_t *cell_params = list->paramarray[l]; nr_neighbour_cell_t n = {.gNB_ID = *cell_params[GNB_CONFIG_N_CELL_GNB_ID_IDX].uptr, @@ -2045,6 +2050,7 @@ static void parse_neighbour_cells_list(neighbour_cell_configuration_t *cell, con n.absoluteFrequencySSB, n.tac); + /* Check for duplicate PCI in the neighbour list */ if (get_neighbour_by_pci(cell->neighbour_cells, n.physicalCellId) != NULL) { LOG_E(GNB_APP, "Cell %ld: duplicate PCI %d in neighbour list (NCI=%ld)\n", cell->nr_cell_id, n.physicalCellId, n.nrcell_id); AssertFatal(false, "PCI must be unique within a cell's neighbour list\n"); @@ -2054,6 +2060,8 @@ static void parse_neighbour_cells_list(neighbour_cell_configuration_t *cell, con } } +/** @brief Sort neighbour cell configuration by cell ID + * @param[in] rrc Pointer to RRC instance */ static void sort_neighbour_configuration(gNB_RRC_INST *rrc) { void *base = seq_arr_front(rrc->neighbour_cell_configuration); @@ -2062,6 +2070,9 @@ static void sort_neighbour_configuration(gNB_RRC_INST *rrc) qsort(base, nmemb, element_size, sort_neighbour_cell_config_by_cell_id); } +/** @brief Fill neighbour cell configuration from config file + * @param[in] gnb_idx gNB index + * @param[in,out] rrc Pointer to RRC instance */ static void fill_neighbour_cell_configuration(const uint8_t gnb_idx, gNB_RRC_INST *rrc) { char path[MAX_OPTNAME_SIZE + 8]; diff --git a/openair2/GNB_APP/gnb_config_common.c b/openair2/GNB_APP/gnb_config_common.c index 5aed92f810..aca2457d08 100644 --- a/openair2/GNB_APP/gnb_config_common.c +++ b/openair2/GNB_APP/gnb_config_common.c @@ -31,6 +31,9 @@ uint16_t set_snssai_config(nssai_t *nssai, const int max_num_ssi, uint8_t k, uin return num_ssi; } +/** @brief Extract PLMN from parameter array + * @param[in] params Parameter array containing PLMN fields + * @return plmn_id_t structure filled from parameters */ plmn_id_t extract_plmn_from_params(const paramdef_t *params, int n_params) { plmn_id_t plmn = {.mcc = *gpd(params, n_params, GNB_CONFIG_STRING_MOBILE_COUNTRY_CODE)->uptr,