Refactor gNB configuration code to share PLMN extraction logic and to split neighbour-cell configuration into smaller helpers with safer allocation and clearer list handling. Changes: - Add `extract_plmn_from_params()` in `gnb_config_common.c` and declare it in `gnb_config_common.h` to centralize PLMN extraction from `paramdef_t`. - Update `set_plmn_config()` to use `extract_plmn_from_params()` when filling the PLMN array instead of duplicating field assignments. - Refactor `fill_neighbour_cell_configuration()` in `gnb_config.c` to delegate per-cell neighbour parsing to `parse_neighbour_cells_list()` and sorting to `sort_neighbour_configuration()`, simplifying the main loop. - Use `extract_plmn_from_params()` when parsing neighbour PLMNs in `parse_neighbour_cells_list()` and log each neighbour with its PLMN, PCI, and other radio parameters before adding it to the sequence. - Switch allocation of `rrc->neighbour_cell_configuration` in `fill_neighbour_cell_configuration()` from `malloc` to `malloc_or_fail()` to enforce consistent handling of allocation failures.
12 lines
376 B
C
12 lines
376 B
C
/*
|
|
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include "common/5g_platform_types.h"
|
|
#include "common/config/config_paramdesc.h"
|
|
|
|
uint16_t set_snssai_config(nssai_t *nssai, const int max_num_ssi, uint8_t k, uint8_t l);
|
|
uint8_t set_plmn_config(plmn_id_t *p, uint8_t idx);
|
|
plmn_id_t extract_plmn_from_params(const paramdef_t *params, int n_params);
|