Skip to content

Commit 196b823

Browse files
herlesupreethcodebot
authored andcommitted
sched: fix assigning of left of bytes to SDU
1 parent 265f8b8 commit 196b823

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/scheduler/ue_scheduling/dl_logical_channel_manager.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ unsigned dl_logical_channel_manager::allocate_mac_sdu(dl_msg_lc_info& subpdu, lc
7272
}
7373

7474
// Account for available space and MAC subheader to decide the number of bytes to allocate.
75-
unsigned alloc_bytes = std::min(rem_bytes, lch_bytes);
75+
unsigned alloc_bytes = std::min(rem_bytes, get_mac_sdu_required_bytes(lch_bytes));
7676

77-
// If it is last PDU of the TBS, allocate all leftover bytes.
77+
// Allocate all leftover bytes in following cases:
78+
// - If it is last PDU of the TBS.
79+
// - [Implementation-defined] If \c leftover_bytes is < 5 bytes, as it results in small SDU size.
7880
unsigned leftover_bytes = rem_bytes - alloc_bytes;
79-
if (leftover_bytes > 0 and (leftover_bytes <= MAX_MAC_SDU_SUBHEADER_SIZE or pending_bytes() == 0)) {
81+
if (leftover_bytes > 0 and ((leftover_bytes <= MAX_MAC_SDU_SUBHEADER_SIZE + 1) or pending_bytes() == 0)) {
8082
alloc_bytes += leftover_bytes;
8183
}
8284
if (alloc_bytes == MAC_SDU_SUBHEADER_LENGTH_THRES + MIN_MAC_SDU_SUBHEADER_SIZE) {

0 commit comments

Comments
 (0)