diff --git a/lib/include/srslte/common/common.h b/lib/include/srslte/common/common.h index 023736009..fce12d827 100644 --- a/lib/include/srslte/common/common.h +++ b/lib/include/srslte/common/common.h @@ -43,6 +43,7 @@ #define SRSLTE_N_MCH_LCIDS 32 #define TX_DELAY 4 +#define TX_DELAY_DL 4 #define MSG3_DELAY_MS 2 // Delay added to TX_DELAY #define TTI_SUB(a, b) ((((a) + 10240) - (b)) % 10240) @@ -52,6 +53,7 @@ // Use only in FDD mode!! #define FDD_HARQ_DELAY_MS 4 +#define FDD_HARQ_DELAY_DL_MS 4 #define TTI_RX(tti) (TTI_SUB(tti, FDD_HARQ_DELAY_MS)) #define TTI_RX_ACK(tti) (TTI_ADD(tti, FDD_HARQ_DELAY_MS + TX_DELAY)) diff --git a/srsenb/hdr/stack/mac/scheduler_ue.h b/srsenb/hdr/stack/mac/scheduler_ue.h index 2b4f59f03..e462465a5 100644 --- a/srsenb/hdr/stack/mac/scheduler_ue.h +++ b/srsenb/hdr/stack/mac/scheduler_ue.h @@ -33,7 +33,7 @@ namespace srsenb { struct sched_ue_carrier { - const static int SCHED_MAX_HARQ_PROC = TX_DELAY + FDD_HARQ_DELAY_MS; + const static int SCHED_MAX_HARQ_PROC = TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS; sched_ue_carrier(const sched_interface::ue_cfg_t& cfg_, const sched_cell_params_t& cell_cfg_, diff --git a/srsenb/src/stack/mac/scheduler.cc b/srsenb/src/stack/mac/scheduler.cc index ba3d0bbdd..b69a6ca5c 100644 --- a/srsenb/src/stack/mac/scheduler.cc +++ b/srsenb/src/stack/mac/scheduler.cc @@ -378,7 +378,7 @@ int sched::dl_sched(uint32_t tti, uint32_t cc_idx, sched_interface::dl_sched_res } std::lock_guard lock(sched_mutex); - uint32_t tti_rx = sched_utils::tti_subtract(tti, TX_DELAY); + uint32_t tti_rx = sched_utils::tti_subtract(tti, TX_DELAY_DL); last_tti = sched_utils::max_tti(last_tti, tti_rx); if (cc_idx < carrier_schedulers.size()) { @@ -401,7 +401,7 @@ int sched::ul_sched(uint32_t tti, uint32_t cc_idx, srsenb::sched_interface::ul_s std::lock_guard lock(sched_mutex); // Compute scheduling Result for tti_rx - uint32_t tti_rx = sched_utils::tti_subtract(tti, TX_DELAY + FDD_HARQ_DELAY_MS); + uint32_t tti_rx = sched_utils::tti_subtract(tti, TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS); if (cc_idx < carrier_schedulers.size()) { const sf_sched_result& tti_sched = carrier_schedulers[cc_idx]->generate_tti_result(tti_rx); diff --git a/srsenb/src/stack/mac/scheduler_grid.cc b/srsenb/src/stack/mac/scheduler_grid.cc index 3adc802f9..301479c2d 100644 --- a/srsenb/src/stack/mac/scheduler_grid.cc +++ b/srsenb/src/stack/mac/scheduler_grid.cc @@ -48,10 +48,10 @@ const char* alloc_outcome_t::to_string() const tti_params_t::tti_params_t(uint32_t tti_rx_) : tti_rx(tti_rx_), - sf_idx_tx_dl(TTI_ADD(tti_rx, TX_DELAY) % 10), - tti_tx_dl(TTI_ADD(tti_rx, TX_DELAY)), - tti_tx_ul(TTI_ADD(tti_rx, (TX_DELAY + FDD_HARQ_DELAY_MS))), - sfn_tx_dl(TTI_ADD(tti_rx, TX_DELAY) / 10) + sf_idx_tx_dl(TTI_ADD(tti_rx, TX_DELAY_DL) % 10), + tti_tx_dl(TTI_ADD(tti_rx, TX_DELAY_DL)), + tti_tx_ul(TTI_ADD(tti_rx, (TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS))), + sfn_tx_dl(TTI_ADD(tti_rx, TX_DELAY_DL) / 10) { } diff --git a/srsenb/src/stack/mac/scheduler_harq.cc b/srsenb/src/stack/mac/scheduler_harq.cc index be62f37e3..c906784c1 100644 --- a/srsenb/src/stack/mac/scheduler_harq.cc +++ b/srsenb/src/stack/mac/scheduler_harq.cc @@ -223,7 +223,8 @@ rbgmask_t dl_harq_proc::get_rbgmask() const bool dl_harq_proc::has_pending_retx(uint32_t tb_idx, uint32_t tti_tx_dl) const { uint32_t tti_diff = srslte_tti_interval(tti_tx_dl, tti); - return (tti_diff < (10240 / 2)) and (tti_diff >= TX_DELAY + FDD_HARQ_DELAY_MS) and has_pending_retx_common(tb_idx); + return (tti_diff < (10240 / 2)) and (tti_diff >= TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS) and + has_pending_retx_common(tb_idx); } int dl_harq_proc::get_tbs(uint32_t tb_idx) const @@ -366,7 +367,7 @@ dl_harq_proc* harq_entity::get_pending_dl_harq(uint32_t tti_tx_dl) std::pair harq_entity::set_ack_info(uint32_t tti_rx, uint32_t tb_idx, bool ack) { for (auto& h : dl_harqs) { - if (TTI_ADD(h.get_tti(), FDD_HARQ_DELAY_MS) == tti_rx) { + if (TTI_ADD(h.get_tti(), FDD_HARQ_DELAY_DL_MS) == tti_rx) { h.set_ack(tb_idx, ack); return {h.get_id(), h.get_tbs(tb_idx)}; } @@ -381,8 +382,8 @@ ul_harq_proc* harq_entity::get_ul_harq(uint32_t tti_tx_ul) void harq_entity::reset_pending_data(uint32_t tti_rx) { - uint32_t tti_tx_ul = TTI_ADD(tti_rx, (TX_DELAY + FDD_HARQ_DELAY_MS)); - uint32_t tti_tx_dl = TTI_ADD(tti_rx, TX_DELAY); + uint32_t tti_tx_ul = TTI_ADD(tti_rx, (TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS)); + uint32_t tti_tx_dl = TTI_ADD(tti_rx, TX_DELAY_DL); // Reset ACK state of UL Harq get_ul_harq(tti_tx_ul)->reset_pending_data(); diff --git a/srsenb/test/mac/scheduler_ca_test.cc b/srsenb/test/mac/scheduler_ca_test.cc index 506954e61..3086e7dd7 100644 --- a/srsenb/test/mac/scheduler_ca_test.cc +++ b/srsenb/test/mac/scheduler_ca_test.cc @@ -182,7 +182,7 @@ int test_scell_activation(test_scell_activation_params params) // Event: Wait for UE to receive and ack CE. Send cqi==0, which should not activate the SCell uint32_t cqi = 0; - for (uint32_t i = 0; i < TX_DELAY; ++i) { + for (uint32_t i = 0; i < TX_DELAY_DL; ++i) { tester.dl_cqi_info(tester.tti_info.tti_params.tti_rx, rnti1, 1, cqi); generator.step_tti(); } diff --git a/srsenb/test/mac/scheduler_test_common.cc b/srsenb/test/mac/scheduler_test_common.cc index e87d6ef93..4cfb22f4e 100644 --- a/srsenb/test/mac/scheduler_test_common.cc +++ b/srsenb/test/mac/scheduler_test_common.cc @@ -395,7 +395,7 @@ int user_state_sched_tester::test_ra(uint32_t enb_ CONDERROR(ul_result.pusch[i].needs_pdcch and not userinfo.msg3_tic.is_valid() and userinfo.msg3_tic.tti_rx() > tic.tti_rx(), "No UL newtxs allocs allowed before Msg3 Rx\n"); - tti_counter msg3_tic = userinfo.rar_tic + FDD_HARQ_DELAY_MS + MSG3_DELAY_MS; + tti_counter msg3_tic = userinfo.rar_tic + FDD_HARQ_DELAY_DL_MS + MSG3_DELAY_MS; CONDERROR(msg3_tic > tic.tic_tx_ul(), "No UL allocs allowed before Msg3 alloc\n"); } } @@ -404,7 +404,7 @@ int user_state_sched_tester::test_ra(uint32_t enb_ for (uint32_t i = 0; i < dl_result.nof_data_elems; ++i) { if (dl_result.data[i].dci.rnti == rnti) { CONDERROR(not userinfo.msg3_tic.is_valid(), "No DL data alloc allowed before Msg3 alloc\n"); - CONDERROR(tic + FDD_HARQ_DELAY_MS < userinfo.msg3_tic, "Msg4 cannot be tx without Msg3 being acked\n"); + CONDERROR(tic + FDD_HARQ_DELAY_DL_MS < userinfo.msg3_tic, "Msg4 cannot be tx without Msg3 being acked\n"); } } @@ -438,7 +438,7 @@ int user_state_sched_tester::test_ra(uint32_t enb_ /* TEST: Check Msg3 */ if (userinfo.rar_tic.is_valid()) { - tti_counter expected_msg3_tti = userinfo.rar_tic + FDD_HARQ_DELAY_MS + MSG3_DELAY_MS; + tti_counter expected_msg3_tti = userinfo.rar_tic + FDD_HARQ_DELAY_DL_MS + MSG3_DELAY_MS; if (expected_msg3_tti == tic.tic_tx_ul()) { for (uint32_t i = 0; i < ul_result.nof_dci_elems; ++i) { if (ul_result.pusch[i].dci.rnti == rnti) { @@ -750,7 +750,7 @@ int common_sched_tester::schedule_acks() for (uint32_t i = 0; i < tti_info.dl_sched_result[ccidx].nof_data_elems; ++i) { ack_info_t ack_data; ack_data.rnti = tti_info.dl_sched_result[ccidx].data[i].dci.rnti; - ack_data.tti = FDD_HARQ_DELAY_MS + tti_info.tti_params.tti_tx_dl; + ack_data.tti = FDD_HARQ_DELAY_DL_MS + tti_info.tti_params.tti_tx_dl; ack_data.enb_cc_idx = ccidx; ack_data.ue_cc_idx = ue_db[ack_data.rnti].get_cell_index(ccidx).second; const srsenb::dl_harq_proc& dl_h = @@ -767,7 +767,7 @@ int common_sched_tester::schedule_acks() while (it != to_ack.end() and it->first < ack_data.tti) { if (it->second.rnti == ack_data.rnti and it->second.dl_harq.get_id() == ack_data.dl_harq.get_id() and it->second.ue_cc_idx == ack_data.ue_cc_idx) { - CONDERROR(it->second.tti + 2 * FDD_HARQ_DELAY_MS > ack_data.tti, + CONDERROR(it->second.tti + TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS > ack_data.tti, "The retx dl harq id=%d was transmitted too soon\n", ack_data.dl_harq.get_id()); auto toerase_it = it++; diff --git a/srsenb/test/mac/scheduler_test_utils.h b/srsenb/test/mac/scheduler_test_utils.h index 58593571e..954caca68 100644 --- a/srsenb/test/mac/scheduler_test_utils.h +++ b/srsenb/test/mac/scheduler_test_utils.h @@ -33,8 +33,8 @@ struct tti_counter { tti_counter() = default; void set_start_tti(uint32_t tti_) { counter = tti_; } uint32_t tti_rx() const { return counter % 10240u; } - tti_counter tic_tx_dl() const { return tti_counter{counter + TX_DELAY}; } - tti_counter tic_tx_ul() const { return tti_counter{counter + TX_DELAY + FDD_HARQ_DELAY_MS}; } + tti_counter tic_tx_dl() const { return tti_counter{counter + TX_DELAY_DL}; } + tti_counter tic_tx_ul() const { return tti_counter{counter + TX_DELAY_DL + FDD_HARQ_DELAY_DL_MS}; } bool operator==(const tti_counter& other) const { return counter == other.counter; } bool operator!=(const tti_counter& other) const { return counter != other.counter; } bool operator<(const tti_counter& other) const { return counter < other.counter; }