From 55ea2cbcee9a90ec82977da2b75ac4073d169032 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Sat, 2 Oct 2021 14:09:19 +0100 Subject: [PATCH] sched,nr: fix harq delay derivation --- srsenb/hdr/stack/mac/nr/sched_nr_cfg.h | 7 +++++++ srsenb/src/stack/mac/nr/sched_nr_helpers.cc | 2 +- srsenb/src/stack/mac/nr/sched_nr_ue.cc | 14 ++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h index 0839b523e..26c225805 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h @@ -128,6 +128,13 @@ public: { return cce_positions_list[ss_id_to_cce_idx[search_id]]; } + uint32_t get_k1(slot_point pdsch_slot) const + { + if (phy().duplex.mode == SRSRAN_DUPLEX_MODE_TDD) { + return phy().harq_ack.dl_data_to_ul_ack[pdsch_slot.to_uint() % phy().duplex.tdd.pattern1.period_ms]; + } + return phy().harq_ack.dl_data_to_ul_ack[pdsch_slot.to_uint() % phy().harq_ack.nof_dl_data_to_ul_ack]; + } private: uint16_t rnti = SRSRAN_INVALID_RNTI; diff --git a/srsenb/src/stack/mac/nr/sched_nr_helpers.cc b/srsenb/src/stack/mac/nr/sched_nr_helpers.cc index a73c0bfbb..086e223ef 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_helpers.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_helpers.cc @@ -94,7 +94,7 @@ void fill_dl_dci_ue_fields(const slot_ue& ue, fill_dci_common(ue, bwp_cfg, dci); if (dci.ctx.format == srsran_dci_format_nr_1_0) { - dci.harq_feedback = ue.cfg->phy().harq_ack.dl_data_to_ul_ack[ue.pdsch_slot.slot_idx()] - 1; + dci.harq_feedback = (ue.uci_slot - ue.pdsch_slot) - 1; } else { dci.harq_feedback = ue.pdsch_slot.slot_idx(); } diff --git a/srsenb/src/stack/mac/nr/sched_nr_ue.cc b/srsenb/src/stack/mac/nr/sched_nr_ue.cc index 476019230..77cbfa86e 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_ue.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_ue.cc @@ -48,14 +48,12 @@ slot_ue ue_carrier::try_reserve(slot_point pdcch_slot, sfu.harq_ent = &harq_ent; const uint32_t k0 = 0; sfu.pdsch_slot = sfu.pdcch_slot + k0; - uint32_t k1 = - sfu.cfg->phy() - .harq_ack.dl_data_to_ul_ack[sfu.pdsch_slot.slot_idx() % sfu.cfg->phy().harq_ack.nof_dl_data_to_ul_ack]; - sfu.uci_slot = sfu.pdsch_slot + k1; - uint32_t k2 = bwp_cfg.active_bwp().pusch_ra_list[0].K; - sfu.pusch_slot = sfu.pdcch_slot + k2; - sfu.dl_cqi = dl_cqi; - sfu.ul_cqi = ul_cqi; + uint32_t k1 = sfu.cfg->get_k1(sfu.pdsch_slot); + sfu.uci_slot = sfu.pdsch_slot + k1; + uint32_t k2 = bwp_cfg.active_bwp().pusch_ra_list[0].K; + sfu.pusch_slot = sfu.pdcch_slot + k2; + sfu.dl_cqi = dl_cqi; + sfu.ul_cqi = ul_cqi; // set UE-common parameters sfu.dl_pending_bytes = dl_pending_bytes;