From 4cb0bd37127421ec20412eb7df69648b9fa93800 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 11 Jul 2024 11:24:00 +0200 Subject: [PATCH] Clean up servingCellConfigDedicated once after reading config get_default_secondaryCellGroup() would "sanitize" the servingCellConfig, i.e., remove BWP that are invalid. However, it is difficult to understand (we can do sanitization once at the beginning) and reason (why the servingCellConfig is modified in get_default_secondaryCellGroup(), because all we want is a new CellGroupConfig, without modifying other data structures). Instead, do sanitization once after reading the configuration in gnb_config.c. Also, modify physical simulators nr_dlsim and nr_ulsim to apply this sanitization before a call to get_default_secondaryCellGroup(), as the latter would have done the sanitization. --- openair1/SIMULATION/NR_PHY/dlsim.c | 5 ++--- openair1/SIMULATION/NR_PHY/ulsim.c | 5 ++--- openair2/GNB_APP/gnb_config.c | 10 +++++++++ openair2/RRC/NR/nr_rrc_config.c | 33 ------------------------------ 4 files changed, 14 insertions(+), 39 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 728163e049..2877e48ecc 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -708,6 +708,8 @@ int main(int argc, char **argv) NR_ServingCellConfig_t *scd = calloc(1,sizeof(*scd)); prepare_scd(scd); + /* removes unnecessary BWPs, if any */ + fix_scd(scd); gNB->ap_N1 = pdsch_AntennaPorts.N1; gNB->ap_N2 = pdsch_AntennaPorts.N2; @@ -720,9 +722,6 @@ int main(int argc, char **argv) NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, 0); - /* RRC parameter validation for secondaryCellGroup */ - fix_scd(scd); - /* -U option modify DMRS */ if(modify_dmrs) { update_dmrs_config(secondaryCellGroup, dmrs_arg); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 822153fd14..b786fd27f7 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -627,6 +627,8 @@ int main(int argc, char *argv[]) NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); prepare_scd(scd); + /* removes unnecessary BWPs, if any */ + fix_scd(scd); NR_UE_NR_Capability_t* UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t)); prepare_sim_uecap(UE_Capability_nr,scc,mu, @@ -634,9 +636,6 @@ int main(int argc, char *argv[]) NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, 0); - /* RRC parameter validation for secondaryCellGroup */ - fix_scd(scd); - NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc); // UE dedicated configuration diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index b732a88879..5c24d04e3b 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -621,6 +621,16 @@ void fix_scd(NR_ServingCellConfig_t *scd) { } } + + if (scd->downlinkBWP_ToAddModList->list.count == 0) { + free(scd->downlinkBWP_ToAddModList); + scd->downlinkBWP_ToAddModList = NULL; + } + + if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.count == 0) { + free(scd->uplinkConfig->uplinkBWP_ToAddModList); + scd->uplinkConfig->uplinkBWP_ToAddModList = NULL; + } } static void verify_gnb_param_notset(paramdef_t *params, int paramidx, const char *paramname) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 4804a6c163..8cbf3d8adb 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -3025,38 +3025,6 @@ NR_CellGroupConfig_t *decode_cellGroupConfig(const uint8_t *buffer, int buffer_s return cellGroupConfig; } -/* TODO: this should disappear */ -static void fix_servingcellconfigdedicated(NR_ServingCellConfig_t *scd) -{ - int b = 0; - while (b < scd->downlinkBWP_ToAddModList->list.count) { - if (scd->downlinkBWP_ToAddModList->list.array[b]->bwp_Common->genericParameters.locationAndBandwidth == 0) { - asn_sequence_del(&scd->downlinkBWP_ToAddModList->list, b, 1); - } else { - b++; - } - } - - if (scd->downlinkBWP_ToAddModList->list.count == 0) { - free(scd->downlinkBWP_ToAddModList); - scd->downlinkBWP_ToAddModList = NULL; - } - - b = 0; - while (b < scd->uplinkConfig->uplinkBWP_ToAddModList->list.count) { - if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[b]->bwp_Common->genericParameters.locationAndBandwidth == 0) { - asn_sequence_del(&scd->uplinkConfig->uplinkBWP_ToAddModList->list, b, 1); - } else { - b++; - } - } - - if (scd->uplinkConfig->uplinkBWP_ToAddModList->list.count == 0) { - free(scd->uplinkConfig->uplinkBWP_ToAddModList); - scd->uplinkConfig->uplinkBWP_ToAddModList = NULL; - } -} - static NR_ServingCellConfigCommon_t *clone_ServingCellConfigCommon(const NR_ServingCellConfigCommon_t *scc) { if (scc == NULL) @@ -3091,7 +3059,6 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC uint64_t bitmap = get_ssb_bitmap(servingcellconfigcommon); // See comment at the end of this function regarding ServingCellConfig - fix_servingcellconfigdedicated(servingcellconfigdedicated); NR_CellGroupConfig_t *secondaryCellGroup = calloc(1, sizeof(*secondaryCellGroup)); secondaryCellGroup->cellGroupId = scg_id;