From 179e959d05f01076118e88af87edb1d7a179e113 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 31 Mar 2020 18:15:21 +0100 Subject: [PATCH] fix msg3 retx issue. Now nof_prb for pucch above 1 are forbidden for prb==6 --- srsenb/src/enb_cfg_parser.cc | 23 ++++++++++++++++++----- srsenb/src/phy/cc_worker.cc | 3 +++ srsenb/src/stack/mac/scheduler.cc | 19 +++++++++++++++---- srsenb/test/mac/sched_grid_test.cc | 2 +- srsenb/test/mac/scheduler_test_utils.h | 2 +- 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 42e877c91..cd6147af1 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -991,11 +991,12 @@ int set_derived_args(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_ } } - // Check PRACH configuration + // Check PUCCH and PRACH configuration + uint32_t nrb_pucch = std::max(rrc_cfg_->sr_cfg.nof_prb, rrc_cfg_->cqi_cfg.nof_prb); uint32_t prach_freq_offset = rrc_cfg_->sibs[1].sib2().rr_cfg_common.prach_cfg.prach_cfg_info.prach_freq_offset; - if (args_->enb.n_prb > 10) { - uint32_t lower_bound = SRSLTE_MAX(rrc_cfg_->sr_cfg.nof_prb, rrc_cfg_->cqi_cfg.nof_prb); - uint32_t upper_bound = args_->enb.n_prb - lower_bound; + if (args_->enb.n_prb > 6) { + uint32_t lower_bound = nrb_pucch; + uint32_t upper_bound = args_->enb.n_prb - nrb_pucch; if (prach_freq_offset + 6 > upper_bound or prach_freq_offset < lower_bound) { fprintf(stderr, "ERROR: Invalid PRACH configuration - prach_freq_offset=%d collides with PUCCH.\n", @@ -1009,7 +1010,7 @@ int set_derived_args(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_ } else { // 6 PRB case if (prach_freq_offset + 6 > args_->enb.n_prb) { fprintf(stderr, - "WARNING: Invalid PRACH configuration - prach=(%d, %d) does not fit into the eNB PRBs=(0, %d).\n", + "ERROR: Invalid PRACH configuration - prach=(%d, %d) does not fit into the eNB PRBs=(0, %d).\n", prach_freq_offset, prach_freq_offset + 6, args_->enb.n_prb); @@ -1019,6 +1020,18 @@ int set_derived_args(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_ // patch PRACH config for PHY and in RRC for SIB2 rrc_cfg_->sibs[1].sib2().rr_cfg_common.prach_cfg.prach_cfg_info.prach_freq_offset = 0; phy_cfg_->prach_cnfg.prach_cfg_info.prach_freq_offset = 0; + return SRSLTE_ERROR; + } + if (nrb_pucch > 1) { + fprintf(stderr, + "ERROR: Invalid PUCCH configuration - \"cqi_report_cnfg=%d\" and \"sched_request_cnfg.nof_prb=%d\"" + " in rr.conf for 6 PRBs.\n Consider decreasing these values to 1 to leave enough space for the " + "transmission of Msg3.\n", + rrc_cfg_->cqi_cfg.nof_prb, + rrc_cfg_->sr_cfg.nof_prb); + rrc_cfg_->cqi_cfg.nof_prb = 1; + rrc_cfg_->sr_cfg.nof_prb = 1; + return SRSLTE_ERROR; } } diff --git a/srsenb/src/phy/cc_worker.cc b/srsenb/src/phy/cc_worker.cc index 3a71fabcf..d0b3d09f7 100644 --- a/srsenb/src/phy/cc_worker.cc +++ b/srsenb/src/phy/cc_worker.cc @@ -354,6 +354,9 @@ int cc_worker::decode_pusch(stack_interface_phy_lte::ul_sched_grant_t* grants, u // Notify MAC new received data and HARQ Indication value if (pusch_res.data) { + static bool test_flag = false; + pusch_res.crc = pusch_res.crc && test_flag; + test_flag = true; phy->stack->crc_info(tti_rx, rnti, cc_idx, grant.tb.tbs / 8, pusch_res.crc); // Save metrics stats diff --git a/srsenb/src/stack/mac/scheduler.cc b/srsenb/src/stack/mac/scheduler.cc index 89d200536..61c393438 100644 --- a/srsenb/src/stack/mac/scheduler.cc +++ b/srsenb/src/stack/mac/scheduler.cc @@ -64,10 +64,21 @@ bool sched_cell_params_t::set_cfg(uint32_t enb_cc_id return false; } - // PRACH has to fit within the PUSCH space - bool invalid_prach = cfg.cell.nof_prb == 6 and (cfg.prach_freq_offset + 6 > cfg.cell.nof_prb); - invalid_prach |= cfg.cell.nof_prb > 6 and ((cfg.prach_freq_offset + 6) > (cfg.cell.nof_prb - cfg.nrb_pucch) or - (int) cfg.prach_freq_offset < cfg.nrb_pucch); + bool invalid_prach; + if (cfg.cell.nof_prb == 6) { + // PUCCH has to allow space for Msg3 + if (cfg.nrb_pucch > 1) { + Console("Invalid PUCCH configuration: nrb_pucch=%d does not allow space for Msg3 transmission..\n", + cfg.nrb_pucch); + return false; + } + // PRACH has to fit within the PUSCH+PUCCH space + invalid_prach = cfg.prach_freq_offset + 6 > cfg.cell.nof_prb; + } else { + // PRACH has to fit within the PUSCH space + invalid_prach = (cfg.prach_freq_offset + 6) > (cfg.cell.nof_prb - cfg.nrb_pucch) or + ((int)cfg.prach_freq_offset < cfg.nrb_pucch); + } if (invalid_prach) { Error("Invalid PRACH configuration: frequency offset=%d outside bandwidth limits\n", cfg.prach_freq_offset); Console("Invalid PRACH configuration: frequency offset=%d outside bandwidth limits\n", cfg.prach_freq_offset); diff --git a/srsenb/test/mac/sched_grid_test.cc b/srsenb/test/mac/sched_grid_test.cc index cc448753c..fd2712c14 100644 --- a/srsenb/test/mac/sched_grid_test.cc +++ b/srsenb/test/mac/sched_grid_test.cc @@ -53,7 +53,7 @@ int test_pdcch_one_ue() sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg(); sched_interface::cell_cfg_t cell_cfg = generate_default_cell_cfg(nof_prb); sched_interface::sched_args_t sched_args{}; - cell_params[ENB_CC_IDX].set_cfg(ENB_CC_IDX, cell_cfg, sched_args); + TESTASSERT(cell_params[ENB_CC_IDX].set_cfg(ENB_CC_IDX, cell_cfg, sched_args)); pdcch_grid_t pdcch; sched_ue sched_ue{}; diff --git a/srsenb/test/mac/scheduler_test_utils.h b/srsenb/test/mac/scheduler_test_utils.h index 5ec01757a..59c73b876 100644 --- a/srsenb/test/mac/scheduler_test_utils.h +++ b/srsenb/test/mac/scheduler_test_utils.h @@ -106,7 +106,7 @@ inline srsenb::sched_interface::cell_cfg_t generate_default_cell_cfg(uint32_t no cell_cfg.sibs[1].len = 41; cell_cfg.sibs[1].period_rf = 16; cell_cfg.si_window_ms = 40; - cell_cfg.nrb_pucch = 2; + cell_cfg.nrb_pucch = (cell_cfg_phy.nof_prb == 6) ? 1 : 2; cell_cfg.prach_freq_offset = (cell_cfg_phy.nof_prb == 6) ? 0 : 2; cell_cfg.prach_rar_window = 3; cell_cfg.maxharq_msg3tx = 3;