From cc369aca1f1c18ab2572edb6e4e1a65ae175613c Mon Sep 17 00:00:00 2001 From: Francisco Date: Wed, 31 Mar 2021 19:32:33 +0100 Subject: [PATCH] sched - handle the case when the CRC is missing and max retx is reached --- .../hdr/stack/mac/sched_ue_ctrl/sched_harq.h | 12 +++-- srsenb/src/stack/mac/sched.cc | 4 +- srsenb/src/stack/mac/sched_grid.cc | 6 ++- .../src/stack/mac/sched_ue_ctrl/sched_harq.cc | 45 +++++++++++++------ 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/srsenb/hdr/stack/mac/sched_ue_ctrl/sched_harq.h b/srsenb/hdr/stack/mac/sched_ue_ctrl/sched_harq.h index 5a89510fa..ecc76b1f8 100644 --- a/srsenb/hdr/stack/mac/sched_ue_ctrl/sched_harq.h +++ b/srsenb/hdr/stack/mac/sched_ue_ctrl/sched_harq.h @@ -24,9 +24,10 @@ class harq_proc { public: harq_proc(); - void init(uint32_t id); - void reset(uint32_t tb_idx); - uint32_t get_id() const; + void init(uint32_t id); + void reset(uint32_t tb_idx); + + uint32_t get_id() const { return id; } bool is_empty() const; bool is_empty(uint32_t tb_idx) const; @@ -62,6 +63,9 @@ class dl_harq_proc : public harq_proc { public: dl_harq_proc(); + + void new_tti(tti_point tti_tx_dl); + void new_tx(const rbgmask_t& new_mask, uint32_t tb_idx, tti_point tti_tx_dl, @@ -86,6 +90,8 @@ private: class ul_harq_proc : public harq_proc { public: + void new_tti(); + void new_tx(srsran::tti_point tti, int mcs, int tbs, prb_interval alloc, uint32_t max_retx_, bool is_msg3); void new_retx(srsran::tti_point tti_, int* mcs, int* tbs, prb_interval alloc); bool set_ack(uint32_t tb_idx, bool ack); diff --git a/srsenb/src/stack/mac/sched.cc b/srsenb/src/stack/mac/sched.cc index ba52e0ba8..e7604e056 100644 --- a/srsenb/src/stack/mac/sched.cc +++ b/srsenb/src/stack/mac/sched.cc @@ -297,7 +297,7 @@ int sched::dl_sched(uint32_t tti_tx_dl, uint32_t enb_cc_idx, sched_interface::dl return 0; } - tti_point tti_rx = tti_point{tti_tx_dl} - FDD_HARQ_DELAY_UL_MS; + tti_point tti_rx = tti_point{tti_tx_dl} - TX_ENB_DELAY; new_tti(tti_rx); // copy result @@ -318,7 +318,7 @@ int sched::ul_sched(uint32_t tti, uint32_t enb_cc_idx, srsenb::sched_interface:: } // Compute scheduling Result for tti_rx - tti_point tti_rx = tti_point{tti} - FDD_HARQ_DELAY_UL_MS - FDD_HARQ_DELAY_DL_MS; + tti_point tti_rx = tti_point{tti} - TX_ENB_DELAY - FDD_HARQ_DELAY_DL_MS; new_tti(tti_rx); // copy result diff --git a/srsenb/src/stack/mac/sched_grid.cc b/srsenb/src/stack/mac/sched_grid.cc index b66002eda..fcb3b7d24 100644 --- a/srsenb/src/stack/mac/sched_grid.cc +++ b/srsenb/src/stack/mac/sched_grid.cc @@ -686,7 +686,8 @@ void sf_sched::set_dl_data_sched_result(const sf_cch_allocator::alloc_result_t& // Print Resulting DL Allocation fmt::memory_buffer str_buffer; fmt::format_to(str_buffer, - "SCHED: DL {} rnti=0x{:x}, cc={}, pid={}, mask=0x{:x}, dci=({}, {}), n_rtx={}, tbs={}, buffer={}/{}", + "SCHED: DL {} rnti=0x{:x}, cc={}, pid={}, mask=0x{:x}, dci=({}, {}), n_rtx={}, tbs={}, " + "buffer={}/{}, tti_tx_dl={}", is_newtx ? "tx" : "retx", user->get_rnti(), cc_cfg->enb_cc_idx, @@ -697,7 +698,8 @@ void sf_sched::set_dl_data_sched_result(const sf_cch_allocator::alloc_result_t& dl_harq.nof_retx(0) + dl_harq.nof_retx(1), tbs, data_before, - user->get_requested_dl_bytes(cc_cfg->enb_cc_idx).stop()); + user->get_requested_dl_bytes(cc_cfg->enb_cc_idx).stop(), + get_tti_tx_dl()); logger.info("%s", srsran::to_c_str(str_buffer)); } } diff --git a/srsenb/src/stack/mac/sched_ue_ctrl/sched_harq.cc b/srsenb/src/stack/mac/sched_ue_ctrl/sched_harq.cc index 1b7d8f8de..5957ad25b 100644 --- a/srsenb/src/stack/mac/sched_ue_ctrl/sched_harq.cc +++ b/srsenb/src/stack/mac/sched_ue_ctrl/sched_harq.cc @@ -45,11 +45,6 @@ void harq_proc::reset(uint32_t tb_idx) tx_cnt[tb_idx] = 0; } -uint32_t harq_proc::get_id() const -{ - return id; -} - bool harq_proc::is_empty() const { for (uint32_t i = 0; i < SRSRAN_MAX_TB; ++i) { @@ -83,14 +78,7 @@ int harq_proc::set_ack_common(uint32_t tb_idx, bool ack_) } ack_state[tb_idx] = ack_; logger->debug("ACK=%d received pid=%d, tb_idx=%d, n_rtx=%d, max_retx=%d", ack_, id, tb_idx, n_rtx[tb_idx], max_retx); - if (!ack_ && (n_rtx[tb_idx] + 1 >= max_retx)) { - logger->info("SCHED: discarding TB=%d pid=%d, tti=%d, maximum number of retx exceeded (%d)", - tb_idx, - id, - tti.to_uint(), - max_retx); - active[tb_idx] = false; - } else if (ack_) { + if (ack_) { active[tb_idx] = false; } return SRSRAN_SUCCESS; @@ -161,6 +149,20 @@ dl_harq_proc::dl_harq_proc() : harq_proc() n_cce = 0; } +void dl_harq_proc::new_tti(tti_point tti_tx_dl) +{ + for (uint32_t tb = 0; tb < SRSRAN_MAX_TB; ++tb) { + if (has_pending_retx(tb, tti_tx_dl) and nof_retx(tb) + 1 >= max_nof_retx()) { + logger->info("SCHED: discarding DL TB=%d pid=%d, tti=%d, maximum number of retx exceeded (%d)", + tb, + get_id(), + tti.to_uint(), + max_retx); + active[tb] = false; + } + } +} + void dl_harq_proc::new_tx(const rbgmask_t& new_mask, uint32_t tb_idx, tti_point tti_tx_dl, @@ -222,9 +224,18 @@ void dl_harq_proc::reset_pending_data() } /****************************************************** - * UE::UL HARQ class * + * UE::UL HARQ class * ******************************************************/ +void ul_harq_proc::new_tti() +{ + if (has_pending_retx() and nof_retx(0) + 1 >= max_nof_retx()) { + logger->info( + "SCHED: discarding UL pid=%d, tti=%d, maximum number of retx exceeded (%d)", get_id(), tti.to_uint(), max_retx); + active[0] = false; + } +} + prb_interval ul_harq_proc::get_alloc() const { return allocation; @@ -329,6 +340,12 @@ void harq_entity::reset() void harq_entity::new_tti(tti_point tti_rx) { last_ttis[tti_rx.to_uint() % last_ttis.size()] = tti_rx; + for (auto& hul : ul_harqs) { + hul.new_tti(); + } + for (auto& hdl : dl_harqs) { + hdl.new_tti(to_tx_dl(tti_rx)); + } } dl_harq_proc* harq_entity::get_empty_dl_harq(tti_point tti_tx_dl)