Commit 4cb0bd37 authored by Robert Schmidt's avatar Robert Schmidt

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.
parent 98ebd0d7
......@@ -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);
......
......@@ -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
......
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment