From aabec3d7af38520f29fd40fba2e88ac72df580fe Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Wed, 22 Sep 2021 17:33:43 +0200 Subject: [PATCH] sched,nr: forward SRs present in PUCCH from MAC to scheduler --- srsenb/src/stack/mac/nr/mac_nr.cc | 5 +++++ srsenb/src/stack/mac/nr/sched_nr_ue.cc | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/srsenb/src/stack/mac/nr/mac_nr.cc b/srsenb/src/stack/mac/nr/mac_nr.cc index 21620d240..017e45f19 100644 --- a/srsenb/src/stack/mac/nr/mac_nr.cc +++ b/srsenb/src/stack/mac/nr/mac_nr.cc @@ -339,6 +339,11 @@ bool mac_nr::handle_uci_data(const uint16_t rnti, const srsran_uci_cfg_nr_t& cfg bool is_ok = (value.ack[i] == 1) and value.valid; sched.dl_ack_info(rnti, 0, ack_bit->pid, 0, is_ok); } + + // Process SR + if (value.valid and value.sr > 0) { + sched.ul_sr_info(pdsch_slot - TX_ENB_DELAY, cfg_.pucch.rnti); + } return true; } diff --git a/srsenb/src/stack/mac/nr/sched_nr_ue.cc b/srsenb/src/stack/mac/nr/sched_nr_ue.cc index 528f2d123..a3bee7584 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_ue.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_ue.cc @@ -119,10 +119,12 @@ void ue::new_slot(slot_point pdcch_slot) auto& cc = carriers[ue_cc_cfg.cc]; if (cc != nullptr) { // Discount UL HARQ pending bytes to BSR - for (uint32_t pid = 0; pid < cc->harq_ent.nof_dl_harqs(); ++pid) { - ul_pending_bytes -= cc->harq_ent.ul_harq(pid).tbs(); - if (last_sr_slot.valid() and cc->harq_ent.ul_harq(pid).harq_slot_tx() > last_sr_slot) { - last_sr_slot.clear(); + for (uint32_t pid = 0; pid < cc->harq_ent.nof_ul_harqs(); ++pid) { + if (not cc->harq_ent.ul_harq(pid).empty()) { + ul_pending_bytes -= cc->harq_ent.ul_harq(pid).tbs(); + if (last_sr_slot.valid() and cc->harq_ent.ul_harq(pid).harq_slot_tx() > last_sr_slot) { + last_sr_slot.clear(); + } } } }