From d4a4da7eccf790369c1b97d3c220e62fa0712bb9 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 18 Oct 2021 20:51:56 +0200 Subject: [PATCH] mux_nr: fix tiny issue in mux unit when adding SDUs of different logical channels this issue has a tiny affect when adding new SDUs from different logical channels to an UL MAC PDU. Since the MAC subPDU header is accounted for twice, less SDU payload may be packed. The patch calculates the required header space and accounts for it in the scheduling. Howerver, it is only substracted from the available space when an SDU was actually added. --- srsue/src/stack/mac_nr/mux_nr.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/srsue/src/stack/mac_nr/mux_nr.cc b/srsue/src/stack/mac_nr/mux_nr.cc index 001dea03f..3fd79f01f 100644 --- a/srsue/src/stack/mac_nr/mux_nr.cc +++ b/srsue/src/stack/mac_nr/mux_nr.cc @@ -94,10 +94,10 @@ srsran::unique_byte_buffer_t mux_nr::get_pdu(uint32_t max_pdu_len) uint8_t* rd = rlc_buff->msg; // Determine space for RLC - remaining_len -= remaining_len >= srsran::mac_sch_subpdu_nr::MAC_SUBHEADER_LEN_THRESHOLD ? 3 : 2; + int32_t subpdu_header_len = (remaining_len >= srsran::mac_sch_subpdu_nr::MAC_SUBHEADER_LEN_THRESHOLD ? 3 : 2); - // Read PDU from RLC - int pdu_len = rlc->read_pdu(lc.lcid, rd, remaining_len); + // Read PDU from RLC (account for subPDU header) + int pdu_len = rlc->read_pdu(lc.lcid, rd, remaining_len - subpdu_header_len); if (pdu_len > remaining_len) { logger.error("Can't add SDU of %d B. Available space %d B", pdu_len, remaining_len); @@ -114,10 +114,11 @@ srsran::unique_byte_buffer_t mux_nr::get_pdu(uint32_t max_pdu_len) break; } } else { + // couldn't read PDU from RLC break; } - remaining_len -= pdu_len; + remaining_len -= (pdu_len + subpdu_header_len); logger.debug("%d B remaining PDU", remaining_len); } }