diff --git a/srsenb/src/phy/phy.cc b/srsenb/src/phy/phy.cc index 442f7fa5a..85fe2a507 100644 --- a/srsenb/src/phy/phy.cc +++ b/srsenb/src/phy/phy.cc @@ -99,6 +99,12 @@ int phy::init(const phy_args_t& args, srsran::radio_interface_phy* radio_, stack_interface_phy_lte* stack_) { + if (cfg.phy_cell_cfg.size() > SRSRAN_MAX_CARRIERS) { + phy_log.error( + "Number of carriers=%zd provided above its maximum=%zd", cfg.phy_cell_cfg.size(), SRSRAN_MAX_CARRIERS); + return SRSRAN_ERROR; + } + mlockall((uint32_t)MCL_CURRENT | (uint32_t)MCL_FUTURE); // Add PHY lib log. diff --git a/srsenb/test/phy/CMakeLists.txt b/srsenb/test/phy/CMakeLists.txt index a53b112e4..383a9e00f 100644 --- a/srsenb/test/phy/CMakeLists.txt +++ b/srsenb/test/phy/CMakeLists.txt @@ -52,7 +52,7 @@ add_lte_test(enb_phy_test_tm4 enb_phy_test --duration=${ENB_PHY_TEST_DURATION} - # - 5 Aggregated carriers # - 6 PRB # - PUCCH format 3 ACK/NACK feedback mode and more than 2 ACK/NACK bits in PUSCH -add_lte_test(enb_phy_test_tm1_ca_pucch3 enb_phy_test --duration=${ENB_PHY_TEST_DURATION} --nof_enb_cells=5 --ue_cell_list=3,4,0,1,2 --ack_mode=pucch3 --cell.nof_prb=6 --tm=1) +add_lte_test(enb_phy_test_tm1_ca_pucch3 enb_phy_test --duration=${ENB_PHY_TEST_DURATION} --nof_enb_cells=6 --ue_cell_list=3,4,0,1,2 --ack_mode=pucch3 --cell.nof_prb=6 --tm=1) # Five carrier aggregation using PUCCH3: # - 6 eNb cell/carrier @@ -60,7 +60,7 @@ add_lte_test(enb_phy_test_tm1_ca_pucch3 enb_phy_test --duration=${ENB_PHY_TEST_D # - 5 Aggregated carriers # - 6 PRB # - PUCCH format 3 ACK/NACK feedback mode and more than 2 ACK/NACK bits in PUSCH -add_lte_test(enb_phy_test_tm4_ca_pucch3 enb_phy_test --duration=${ENB_PHY_TEST_DURATION} --nof_enb_cells=5 --ue_cell_list=0,4,3,1,2 --ack_mode=pucch3 --cell.nof_prb=6 --tm=4) +add_lte_test(enb_phy_test_tm4_ca_pucch3 enb_phy_test --duration=${ENB_PHY_TEST_DURATION} --nof_enb_cells=6 --ue_cell_list=0,4,3,1,2 --ack_mode=pucch3 --cell.nof_prb=6 --tm=4) # Two carrier aggregation using Channel Selection: # - 6 eNb cell/carrier @@ -68,7 +68,7 @@ add_lte_test(enb_phy_test_tm4_ca_pucch3 enb_phy_test --duration=${ENB_PHY_TEST_D # - 2 Aggregated carriers # - 6 PRB # - PUCCH format 1b with Channel selection ACK/NACK feedback mode -add_lte_test(enb_phy_test_tm1_ca_cs enb_phy_test --duration=${ENB_PHY_TEST_DURATION} --nof_enb_cells=5 --ue_cell_list=4,3 --ack_mode=cs --cell.nof_prb=6 --tm=1) +add_lte_test(enb_phy_test_tm1_ca_cs enb_phy_test --duration=${ENB_PHY_TEST_DURATION} --nof_enb_cells=6 --ue_cell_list=5,4 --ack_mode=cs --cell.nof_prb=6 --tm=1) # Two carrier aggregation using Channel Selection: # - 6 eNb cell/carrier @@ -76,7 +76,7 @@ add_lte_test(enb_phy_test_tm1_ca_cs enb_phy_test --duration=${ENB_PHY_TEST_DURAT # - 2 Aggregated carriers # - 6 PRB # - PUCCH format 1b with Channel selection ACK/NACK feedback mode -add_lte_test(enb_phy_test_tm4_ca_cs enb_phy_test --duration=${ENB_PHY_TEST_DURATION} --nof_enb_cells=5 --ue_cell_list=0,4 --ack_mode=cs --cell.nof_prb=6 --tm=4) +add_lte_test(enb_phy_test_tm4_ca_cs enb_phy_test --duration=${ENB_PHY_TEST_DURATION} --nof_enb_cells=6 --ue_cell_list=1,5 --ack_mode=cs --cell.nof_prb=6 --tm=4) # Two carrier aggregation using Channel Selection and HO: # - 3 eNb cell/carrier diff --git a/srsenb/test/phy/enb_phy_test.cc b/srsenb/test/phy/enb_phy_test.cc index 75a6b8366..abc656bff 100644 --- a/srsenb/test/phy/enb_phy_test.cc +++ b/srsenb/test/phy/enb_phy_test.cc @@ -1228,6 +1228,12 @@ public: phy_cfg.prach_cnfg.prach_cfg_info.prach_freq_offset = 2; phy_cfg.prach_cnfg.prach_cfg_info.zero_correlation_zone_cfg = 5; + /// eNb PHY initialisation instance + enb_phy = unique_srsenb_phy_t(new srsenb::phy(log_sink)); + } + + int init() + { // Create base UE dedicated configuration srsran::phy_cfg_t dedicated = {}; @@ -1293,11 +1299,10 @@ public: stack = unique_dummy_stack_t(new dummy_stack(phy_cfg, phy_rrc_cfg, args.log_level, args.rnti)); stack->set_active_cell_list(args.ue_cell_list); - /// eNb PHY initialisation instance - enb_phy = unique_srsenb_phy_t(new srsenb::phy(log_sink)); - /// Initiate eNb PHY with the given RNTI - enb_phy->init(phy_args, phy_cfg, radio.get(), stack.get()); + if (enb_phy->init(phy_args, phy_cfg, radio.get(), stack.get()) < 0) { + return SRSRAN_ERROR; + } enb_phy->set_config(args.rnti, phy_rrc_cfg); enb_phy->complete_config(args.rnti); enb_phy->set_activation_deactivation_scell(args.rnti, activation); @@ -1307,6 +1312,8 @@ public: /// Configure UE with initial configuration ue_phy->reconfigure(phy_rrc_cfg); + + return SRSRAN_SUCCESS; } void stop() @@ -1457,6 +1464,14 @@ int main(int argc, char** argv) // Create Test Bench unique_phy_test_bench test_bench = unique_phy_test_bench(new phy_test_bench(test_args, srslog::get_default_sink())); + int err_code = test_bench->init(); + bool valid_cfg = test_args.nof_enb_cells <= SRSRAN_MAX_CARRIERS; + if (not valid_cfg) { + // Verify that phy returns with an error if provided an invalid configuration + TESTASSERT(err_code != SRSRAN_SUCCESS); + return 0; + } + TESTASSERT(err_code == SRSRAN_SUCCESS); // Run Simulation for (uint32_t i = 0; i < test_args.duration; i++) {