From b311806179fedb8b7793386f09dac346a88d152c Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 31 Aug 2021 13:40:31 +0200 Subject: [PATCH] mac,nr: avoid repacking NR DL retxs --- srsenb/hdr/stack/mac/mac.h | 2 +- srsenb/hdr/stack/mac/nr/sched_nr_harq.h | 20 +++++++++----------- srsenb/src/stack/mac/nr/mac_nr.cc | 2 +- srsenb/src/stack/mac/nr/sched_nr_harq.cc | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/srsenb/hdr/stack/mac/mac.h b/srsenb/hdr/stack/mac/mac.h index 0bf5bbc6f..63e5527dd 100644 --- a/srsenb/hdr/stack/mac/mac.h +++ b/srsenb/hdr/stack/mac/mac.h @@ -139,7 +139,7 @@ private: /* Map of active UEs */ static const uint16_t FIRST_RNTI = 0x46; rnti_map_t > ue_db; - std::atomic ue_counter; + std::atomic ue_counter{0}; uint8_t* assemble_rar(sched_interface::dl_sched_rar_grant_t* grants, uint32_t enb_cc_idx, diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_harq.h b/srsenb/hdr/stack/mac/nr/sched_nr_harq.h index 0689bd24d..103c6ed80 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_harq.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_harq.h @@ -56,12 +56,11 @@ public: bool new_retx(slot_point slot_tx, slot_point slot_ack, const prb_grant& grant); bool new_retx(slot_point slot_tx, slot_point slot_ack); - const uint32_t pid; - -protected: // NOTE: Has to be used before first tx is dispatched bool set_tbs(uint32_t tbs); + const uint32_t pid; + private: struct tb_t { bool active = false; @@ -84,16 +83,15 @@ class dl_harq_proc : public harq_proc public: dl_harq_proc(uint32_t id_, uint32_t nprb); - tx_harq_softbuffer& get_softbuffer() { return *softbuffer; } + tx_harq_softbuffer& get_softbuffer() { return *softbuffer; } srsran::unique_byte_buffer_t* get_tx_pdu() { return &pdu; } - // clear and reset softbuffer and PDU for new tx - bool set_tbs(uint32_t tbs) - { - softbuffer->reset(); - pdu->clear(); - return harq_proc::set_tbs(tbs); - } + bool new_tx(slot_point slot_tx, + slot_point slot_ack, + const prb_grant& grant, + uint32_t mcs, + uint32_t tbs, + uint32_t max_retx); private: srsran::unique_pool_ptr softbuffer; diff --git a/srsenb/src/stack/mac/nr/mac_nr.cc b/srsenb/src/stack/mac/nr/mac_nr.cc index afa2d7218..1ed756142 100644 --- a/srsenb/src/stack/mac/nr/mac_nr.cc +++ b/srsenb/src/stack/mac/nr/mac_nr.cc @@ -281,7 +281,7 @@ int mac_nr::get_dl_sched(const srsran_slot_cfg_t& slot_cfg, dl_sched_t& dl_sched continue; } for (auto& tb_data : pdsch.data) { - if (tb_data != nullptr) { + if (tb_data != nullptr and tb_data->N_bytes == 0) { // TODO: exclude retx from packing ue_db[rnti]->generate_pdu(tb_data, pdsch.sch.grant.tb->tbs / 8); diff --git a/srsenb/src/stack/mac/nr/sched_nr_harq.cc b/srsenb/src/stack/mac/nr/sched_nr_harq.cc index 0d27c34e7..185a44c9c 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_harq.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_harq.cc @@ -105,6 +105,21 @@ dl_harq_proc::dl_harq_proc(uint32_t id_, uint32_t nprb) : harq_proc(id_), softbuffer(harq_softbuffer_pool::get_instance().get_tx(nprb)), pdu(srsran::make_byte_buffer()) {} +bool dl_harq_proc::new_tx(slot_point slot_tx, + slot_point slot_ack, + const prb_grant& grant, + uint32_t mcs, + uint32_t tbs, + uint32_t max_retx) +{ + if (harq_proc::new_tx(slot_tx, slot_ack, grant, mcs, tbs, max_retx)) { + softbuffer->reset(); + pdu->clear(); + return true; + } + return false; +} + harq_entity::harq_entity(uint32_t nprb, uint32_t nof_harq_procs) { // Create HARQs