From f427a25a30d940286e6d839c428b40f680f9b7f7 Mon Sep 17 00:00:00 2001 From: Francisco Date: Thu, 14 Oct 2021 10:35:35 +0100 Subject: [PATCH] nr,gnb,mac: account for header space larger than 2 when packing PDSCH --- lib/include/srsran/mac/mac_sch_pdu_nr.h | 3 ++- lib/src/mac/mac_sch_pdu_nr.cc | 7 +------ srsenb/src/stack/mac/nr/ue_nr.cc | 5 +++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/include/srsran/mac/mac_sch_pdu_nr.h b/lib/include/srsran/mac/mac_sch_pdu_nr.h index 1ff74110d..fb15b1768 100644 --- a/lib/include/srsran/mac/mac_sch_pdu_nr.h +++ b/lib/include/srsran/mac/mac_sch_pdu_nr.h @@ -198,8 +198,9 @@ public: void to_string(fmt::memory_buffer& buffer); -private: uint32_t size_header_sdu(const uint32_t lcid_, const uint32_t nbytes); + +private: /// Private helper that adds a subPDU to the MAC PDU uint32_t add_sudpdu(mac_sch_subpdu_nr& subpdu); diff --git a/lib/src/mac/mac_sch_pdu_nr.cc b/lib/src/mac/mac_sch_pdu_nr.cc index f87289230..28645ff0b 100644 --- a/lib/src/mac/mac_sch_pdu_nr.cc +++ b/lib/src/mac/mac_sch_pdu_nr.cc @@ -423,13 +423,8 @@ uint32_t mac_sch_pdu_nr::size_header_sdu(const uint32_t lcid, const uint32_t nby { if (ulsch && (lcid == mac_sch_subpdu_nr::CCCH_SIZE_48 || lcid == mac_sch_subpdu_nr::CCCH_SIZE_64)) { return 1; - } else { - if (nbytes < 256) { - return 2; - } else { - return 3; - } } + return nbytes < 256 ? 2 : 3; } uint32_t mac_sch_pdu_nr::get_remaing_len() diff --git a/srsenb/src/stack/mac/nr/ue_nr.cc b/srsenb/src/stack/mac/nr/ue_nr.cc index 88ae1a2a4..4e79a257d 100644 --- a/srsenb/src/stack/mac/nr/ue_nr.cc +++ b/srsenb/src/stack/mac/nr/ue_nr.cc @@ -146,8 +146,9 @@ int ue_nr::generate_pdu(srsran::byte_buffer_t* pdu, uint32_t grant_size) // read RLC PDU ue_rlc_buffer->clear(); - int lcid = 4; - int pdu_len = rlc->read_pdu(rnti, lcid, ue_rlc_buffer->msg, grant_size - 2); + int lcid = 4; + int pdu_len = + rlc->read_pdu(rnti, lcid, ue_rlc_buffer->msg, grant_size - mac_pdu_dl.size_header_sdu(lcid, grant_size)); // Only create PDU if RLC has something to tx if (pdu_len > 0) {