From f80b09ac990abe0593b92c0e288273a8bb1e5bc9 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 28 Oct 2024 08:13:00 +0100 Subject: [PATCH] Simplified use of nb_nr_inst * nb_nr_inst represents the number of gNB instances and the number of RAN contexts * it used also to count the number of RRC instances in the node * it is set from config file in NRRCConfig, therefore redundant checks after this function have been removed * redundant global variable NB_gNB_INST, set after nb_nr_inst, was removed --- executables/nr-gnb.c | 3 --- executables/nr-softmodem.c | 18 +++++------------- openair2/GNB_APP/gnb_app.c | 2 -- openair2/GNB_APP/gnb_config.c | 6 +++++- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index f250893133..6e9dd91a59 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -400,10 +400,7 @@ void term_gNB_Tpool(int inst) { void init_eNB_afterRU(void) { int inst,ru_id,i,aa; PHY_VARS_gNB *gNB; - LOG_D(PHY, "%s() RC.nb_nr_inst:%d\n", __FUNCTION__, RC.nb_nr_inst); - if(NFAPI_MODE == NFAPI_MODE_PNF) - RC.nb_nr_inst = 1; for (inst=0; inst 0) { - AssertFatal(RC.nb_nr_inst == 1, "multiple RRC instances are not supported\n"); - RC.nrrrc = calloc(1, sizeof(*RC.nrrrc)); - RC.nrrrc[0] = calloc(1,sizeof(gNB_RRC_INST)); - RCconfig_NRRRC(RC.nrrrc[0]); - } - - if (RC.nb_nr_inst > 0 && - !get_softmodem_params()->nsa && - !(node_type == ngran_gNB_DU)) { + if (!get_softmodem_params()->nsa && !(node_type == ngran_gNB_DU)) { // we start pdcp in both cuup (for drb) and cucp (for srb) init_pdcp(); } @@ -373,7 +366,6 @@ static void get_options(configmodule_interface_t *cfg) memset((void *)&RC,0,sizeof(RC)); /* Read RC configuration file */ NRRCConfig(); - NB_gNB_INST = RC.nb_nr_inst; NB_RU = RC.nb_RU; } } diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 49b53aa572..e62ddf38b0 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -54,8 +54,6 @@ #include "gnb_config.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" -extern unsigned char NB_gNB_INST; - extern RAN_CONTEXT_t RC; #define GNB_REGISTER_RETRY_DELAY 10 diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 8273141f8a..1f600331d7 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2136,6 +2136,11 @@ void NRRCConfig(void) { config_get(config_get_if(), GNBSParams, sizeofArray(GNBSParams), NULL); RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(RC.nb_nr_inst == NUMBER_OF_gNB_MAX, + "Configuration error: RC.nb_nr_inst (%d) must equal NUMBER_OF_gNB_MAX (%d).\n" + "Currently, only one instance of each layer (L1, L2, L3) is supported.\n" + "Ensure that nb_nr_inst matches the maximum allowed gNB instances in this configuration.", + RC.nb_nr_inst, NUMBER_OF_gNB_MAX); // Get num MACRLC instances config_getlist(config_get_if(), &MACRLCParamList, NULL, 0, NULL); @@ -2383,7 +2388,6 @@ int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_up gnb_cu_cfg_update->num_cells_to_activate, RC.nb_nr_inst); AssertFatal(gnb_cu_cfg_update->num_cells_to_activate == 1, "only one cell supported at the moment\n"); - AssertFatal(RC.nb_nr_inst == 1, "expected one instance\n"); gNB_MAC_INST *mac = RC.nrmac[0]; NR_SCHED_LOCK(&mac->sched_lock); for (j = 0; j < gnb_cu_cfg_update->num_cells_to_activate; j++) {