diff --git a/srsenb/hdr/stack/mac/sched_harq.h b/srsenb/hdr/stack/mac/sched_harq.h index ecc7dcd93..f6f3d2e8f 100644 --- a/srsenb/hdr/stack/mac/sched_harq.h +++ b/srsenb/hdr/stack/mac/sched_harq.h @@ -26,7 +26,6 @@ #include "srslte/common/log.h" #include "srslte/common/tti_point.h" #include "srslte/interfaces/sched_interface.h" -#include namespace srsenb { @@ -52,7 +51,7 @@ protected: int set_ack_common(uint32_t tb_idx, bool ack); void reset_pending_data_common(); - enum ack_t { NULL_ACK, NACK, ACK }; + enum ack_t { NACK, ACK }; bool ack_state[SRSLTE_MAX_TB]; bool active[SRSLTE_MAX_TB]; @@ -98,10 +97,10 @@ public: void new_tx(srslte::tti_point tti, int mcs, int tbs, prb_interval alloc, uint32_t max_retx_); void new_retx(srslte::tti_point tti_, int* mcs, int* tbs, prb_interval alloc); bool set_ack(uint32_t tb_idx, bool ack); + bool retx_requires_pdcch(srslte::tti_point tti_, prb_interval alloc) const; prb_interval get_alloc() const; bool has_pending_retx() const; - bool is_adaptive_retx() const; void reset_pending_data(); uint32_t get_pending_data() const; @@ -111,7 +110,6 @@ public: private: prb_interval allocation; int pending_data; - bool is_adaptive; bool pending_phich = false; }; diff --git a/srsenb/src/stack/mac/sched_grid.cc b/srsenb/src/stack/mac/sched_grid.cc index ba12f4fd1..d8f79e5fb 100644 --- a/srsenb/src/stack/mac/sched_grid.cc +++ b/srsenb/src/stack/mac/sched_grid.cc @@ -865,11 +865,10 @@ alloc_outcome_t sf_sched::alloc_ul_user(sched_ue* user, prb_interval alloc) ul_harq_proc* h = user->get_ul_harq(get_tti_tx_ul(), user->get_active_cell_index(cc_cfg->enb_cc_idx).second); bool has_retx = h->has_pending_retx(); if (has_retx) { - prb_interval prev_alloc = h->get_alloc(); - if (prev_alloc == alloc and h->has_pending_phich()) { - alloc_type = ul_alloc_t::NOADAPT_RETX; - } else { + if (h->retx_requires_pdcch(tti_point{get_tti_tx_ul()}, alloc)) { alloc_type = ul_alloc_t::ADAPT_RETX; + } else { + alloc_type = ul_alloc_t::NOADAPT_RETX; } } else { alloc_type = ul_alloc_t::NEWTX; diff --git a/srsenb/src/stack/mac/sched_harq.cc b/srsenb/src/stack/mac/sched_harq.cc index 336162f7d..6bac52541 100644 --- a/srsenb/src/stack/mac/sched_harq.cc +++ b/srsenb/src/stack/mac/sched_harq.cc @@ -239,15 +239,9 @@ bool ul_harq_proc::has_pending_retx() const return has_pending_retx_common(0); } -bool ul_harq_proc::is_adaptive_retx() const -{ - return is_adaptive and has_pending_retx(); -} - void ul_harq_proc::new_tx(tti_point tti_, int mcs, int tbs, prb_interval alloc, uint32_t max_retx_) { - is_adaptive = false; - allocation = alloc; + allocation = alloc; new_tx_common(0, tti_point{tti_}, mcs, tbs, max_retx_); pending_data = tbs; pending_phich = true; @@ -256,12 +250,16 @@ void ul_harq_proc::new_tx(tti_point tti_, int mcs, int tbs, prb_interval alloc, void ul_harq_proc::new_retx(tti_point tti_, int* mcs, int* tbs, prb_interval alloc) { // If PRBs changed, or there was no tx in last oportunity (e.g. HARQ is being resumed) - is_adaptive = alloc != allocation or tti_ != to_tx_ul(tti); - allocation = alloc; + allocation = alloc; new_retx_common(0, tti_point{tti_}, mcs, tbs); pending_phich = true; } +bool ul_harq_proc::retx_requires_pdcch(srslte::tti_point tti_, prb_interval alloc) const +{ + return alloc != allocation or tti_ != to_tx_ul(tti); +} + bool ul_harq_proc::set_ack(uint32_t tb_idx, bool ack_) { if (is_empty()) { diff --git a/srsenb/src/stack/mac/sched_ue.cc b/srsenb/src/stack/mac/sched_ue.cc index e0e53ecd6..8e2f71660 100644 --- a/srsenb/src/stack/mac/sched_ue.cc +++ b/srsenb/src/stack/mac/sched_ue.cc @@ -825,7 +825,7 @@ int sched_ue::generate_format0(sched_interface::ul_sched_data_t* data, } } else if (tbs > 0) { dci->tb.rv = sched_utils::get_rvidx(h->nof_retx(0)); - if (!is_newtx && h->is_adaptive_retx()) { + if (!is_newtx && data->needs_pdcch) { dci->tb.mcs_idx = 28 + dci->tb.rv; } else { dci->tb.mcs_idx = mcs; diff --git a/srsenb/test/mac/sched_ue_ded_test_suite.cc b/srsenb/test/mac/sched_ue_ded_test_suite.cc index 1b86f69c6..2fb05b789 100644 --- a/srsenb/test/mac/sched_ue_ded_test_suite.cc +++ b/srsenb/test/mac/sched_ue_ded_test_suite.cc @@ -186,10 +186,13 @@ int test_ul_sched_result(const sim_enb_ctxt_t& enb_ctxt, const sf_output_res_t& if (not h.active) { // the HARQ is being resumed CONDERROR(not pusch_ptr->needs_pdcch, "Resumed UL HARQs need to be signalled in PDCCH\n"); - } - if (not pusch_ptr->needs_pdcch) { - // non-adaptive retx - CONDERROR(pusch_ptr->dci.type2_alloc.riv != h.riv, "Non-adaptive retx must keep the same riv\n"); + } else { + if (pusch_ptr->needs_pdcch) { + CONDERROR(pusch_ptr->dci.type2_alloc.riv == h.riv, "Adaptive retx must change riv\n"); + } else { + // non-adaptive retx + CONDERROR(pusch_ptr->dci.type2_alloc.riv != h.riv, "Non-adaptive retx must keep the same riv\n"); + } } CONDERROR(sched_utils::get_rvidx(h.nof_retxs + 1) != (uint32_t)pusch_ptr->dci.tb.rv, "Invalid rv index for retx\n");