From beed2ddbaa6d2524add7280d993b40cefc696a88 Mon Sep 17 00:00:00 2001 From: Francisco Date: Fri, 26 Feb 2021 16:47:35 +0000 Subject: [PATCH] simplified tx softbuffer acquisition interface in mac::ue --- srsenb/hdr/stack/mac/ue.h | 13 ++++++++----- srsenb/src/stack/mac/ue.cc | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/srsenb/hdr/stack/mac/ue.h b/srsenb/hdr/stack/mac/ue.h index a42ffec7b..ba2cd1824 100644 --- a/srsenb/hdr/stack/mac/ue.h +++ b/srsenb/hdr/stack/mac/ue.h @@ -47,10 +47,13 @@ public: void allocate_cc(uint32_t nof_prb, uint32_t nof_rx_harq_proc, uint32_t nof_tx_harq_proc); void deallocate_cc(); - bool empty() const { return softbuffer_tx_list.empty(); } - cc_softbuffer_tx_list_t& get_tx_softbuffer() { return softbuffer_tx_list; } - srslte_softbuffer_rx_t& get_rx_softbuffer(uint32_t tti) { return softbuffer_rx_list[tti % nof_rx_harq_proc]; } - srslte::byte_buffer_t* get_tx_payload_buffer(size_t harq_pid, size_t tb) + bool empty() const { return softbuffer_tx_list.empty(); } + srslte_softbuffer_tx_t& get_tx_softbuffer(uint32_t pid, uint32_t tb_idx) + { + return softbuffer_tx_list.at(pid * SRSLTE_MAX_TB + tb_idx); + } + srslte_softbuffer_rx_t& get_rx_softbuffer(uint32_t tti) { return softbuffer_rx_list.at(tti % nof_rx_harq_proc); } + srslte::byte_buffer_t* get_tx_payload_buffer(size_t harq_pid, size_t tb) { return tx_payload_buffer[harq_pid][tb].get(); } @@ -84,7 +87,7 @@ public: srslog::basic_logger& logger, uint32_t nof_cells_, uint32_t nof_rx_harq_proc = SRSLTE_FDD_NOF_HARQ, - uint32_t nof_tx_harq_proc = SRSLTE_FDD_NOF_HARQ * SRSLTE_MAX_TB); + uint32_t nof_tx_harq_proc = SRSLTE_FDD_NOF_HARQ); virtual ~ue(); void reset(); diff --git a/srsenb/src/stack/mac/ue.cc b/srsenb/src/stack/mac/ue.cc index dd44511d4..0db8e45c6 100644 --- a/srsenb/src/stack/mac/ue.cc +++ b/srsenb/src/stack/mac/ue.cc @@ -57,7 +57,7 @@ void cc_buffer_handler::allocate_cc(uint32_t nof_prb_, uint32_t nof_rx_harq_proc } // Create and init Tx buffers - softbuffer_tx_list.resize(nof_tx_harq_proc); + softbuffer_tx_list.resize(nof_tx_harq_proc * SRSLTE_MAX_TB); for (auto& buffer : softbuffer_tx_list) { srslte_softbuffer_tx_init(&buffer, nof_prb); } @@ -166,7 +166,7 @@ ue::get_tx_softbuffer(const uint32_t ue_cc_idx, const uint32_t harq_process, con return nullptr; } - return &cc_buffers[ue_cc_idx].get_tx_softbuffer().at((harq_process * SRSLTE_MAX_TB + tb_idx) % nof_tx_harq_proc); + return &cc_buffers[ue_cc_idx].get_tx_softbuffer(harq_process, tb_idx); } uint8_t* ue::request_buffer(uint32_t tti, uint32_t ue_cc_idx, const uint32_t len)