Commit 805c968b authored by francescomani's avatar francescomani Committed by Robert Schmidt

Add a check for BWP start and size validity in configuration

parent ca0cc079
...@@ -1368,7 +1368,7 @@ void nfapi_stop_l1() ...@@ -1368,7 +1368,7 @@ void nfapi_stop_l1()
} }
} }
static void get_bwp_config(nr_mac_config_t *configuration) static void get_bwp_config(nr_mac_config_t *configuration, const NR_ServingCellConfigCommon_t *scc)
{ {
char path[MAX_OPTNAME_SIZE * 2 + 8]; char path[MAX_OPTNAME_SIZE * 2 + 8];
snprintf(path, sizeof(path), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); snprintf(path, sizeof(path), "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
...@@ -1377,10 +1377,13 @@ static void get_bwp_config(nr_mac_config_t *configuration) ...@@ -1377,10 +1377,13 @@ static void get_bwp_config(nr_mac_config_t *configuration)
AssertFatal(configuration->num_additional_bwps >= 0 && configuration->num_additional_bwps <= 4, AssertFatal(configuration->num_additional_bwps >= 0 && configuration->num_additional_bwps <= 4,
"Invalid number of additional BWPs %d\n", "Invalid number of additional BWPs %d\n",
configuration->num_additional_bwps); configuration->num_additional_bwps);
int bw = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
for (int i = 0; i < configuration->num_additional_bwps; i++) { for (int i = 0; i < configuration->num_additional_bwps; i++) {
configuration->bwp_config[i].id = i + 1; configuration->bwp_config[i].id = i + 1;
int bwp_start = *BWPParamList.paramarray[i][GNB_BWP_START_IDX].iptr; int bwp_start = *BWPParamList.paramarray[i][GNB_BWP_START_IDX].iptr;
AssertFatal(bwp_start >= 0 && bwp_start < bw, "Invalid BWP start value %d\n", bwp_start);
int bwp_size = *BWPParamList.paramarray[i][GNB_BWP_SIZE_IDX].iptr; int bwp_size = *BWPParamList.paramarray[i][GNB_BWP_SIZE_IDX].iptr;
AssertFatal(bwp_start + bwp_size <= bw, "BWP start %d and BWP size %d exceeds full BW %d\n", bwp_start, bwp_size, bw);
configuration->bwp_config[i].location_and_bw = PRBalloc_to_locationandbandwidth(bwp_size, bwp_start); configuration->bwp_config[i].location_and_bw = PRBalloc_to_locationandbandwidth(bwp_size, bwp_start);
configuration->bwp_config[i].scs = *BWPParamList.paramarray[i][GNB_BWP_SCS_IDX].iptr; configuration->bwp_config[i].scs = *BWPParamList.paramarray[i][GNB_BWP_SCS_IDX].iptr;
LOG_I(GNB_APP, LOG_I(GNB_APP,
...@@ -1418,12 +1421,6 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) ...@@ -1418,12 +1421,6 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
config.pdsch_AntennaPorts.XP, config.pdsch_AntennaPorts.XP,
config.pusch_AntennaPorts); config.pusch_AntennaPorts);
// BWP
get_bwp_config(&config);
AssertFatal(config.num_additional_bwps <= 4, "Impossible to configure more than 4 additional BWPs\n");
config.first_active_bwp = *GNBParamList.paramarray[0][GNB_1ST_ACTIVE_BWP_IDX].iptr;
AssertFatal(config.first_active_bwp <= config.num_additional_bwps, "1st active BWP does not belog to the configured BWPs\n");
// RU // RU
GET_PARAMS_LIST(RUParamList, RUParams, RUPARAMS_DESC, CONFIG_STRING_RU_LIST, NULL); GET_PARAMS_LIST(RUParamList, RUParams, RUPARAMS_DESC, CONFIG_STRING_RU_LIST, NULL);
int num_tx = 0; int num_tx = 0;
...@@ -1524,7 +1521,11 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) ...@@ -1524,7 +1521,11 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
config.num_agg_level_candidates[PDCCH_AGG_LEVEL16]); config.num_agg_level_candidates[PDCCH_AGG_LEVEL16]);
NR_ServingCellConfigCommon_t *scc = get_scc_config(cfg, config.minRXTXTIME, config.do_SRS); NR_ServingCellConfigCommon_t *scc = get_scc_config(cfg, config.minRXTXTIME, config.do_SRS);
//xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); // BWP
get_bwp_config(&config, scc);
AssertFatal(config.num_additional_bwps <= 4, "Impossible to configure more than 4 additional BWPs\n");
config.first_active_bwp = *GNBParamList.paramarray[0][GNB_1ST_ACTIVE_BWP_IDX].iptr;
AssertFatal(config.first_active_bwp <= config.num_additional_bwps, "1st active BWP does not belog to the configured BWPs\n");
if (MacRLC_ParamList.numelt > 0) { if (MacRLC_ParamList.numelt > 0) {
/* NR RLC config is needed by mac_top_init_gNB() */ /* NR RLC config is needed by mac_top_init_gNB() */
......
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