From 5f7f818abbd27dc05a867832eeffc928de29e907 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Fri, 13 Nov 2020 13:10:42 +0100 Subject: [PATCH] pdu: fix bug in BSR table lookup the bug causes the BSR to return a bsr_idx of 0, i.e. no data pending, when the buff_size was reported to be 1 B only. Instead, the UE should return BSR idx 1, i.e. between 0 < BSR <= 10. --- lib/src/mac/pdu.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/mac/pdu.cc b/lib/src/mac/pdu.cc index d9f14e88d..acae8f350 100644 --- a/lib/src/mac/pdu.cc +++ b/lib/src/mac/pdu.cc @@ -979,9 +979,9 @@ uint8_t sch_subh::buff_size_table(uint32_t buffer_size) } else if (buffer_size > 150000) { return 63; } else { - for (int i = 0; i < 61; i++) { - if (buffer_size < btable[i + 2]) { - return 1 + i; + for (int i = 1; i < 62; i++) { + if (buffer_size <= btable[i + 1]) { + return i; } } return 62;