mux: use updated SDU length when adding new SDUs

master
Andre Puschmann 6 years ago
parent 59355e79ff
commit 34d2eb761f

@ -307,12 +307,12 @@ bool mux::allocate_sdu(uint32_t lcid, srslte::sch_pdu* pdu_msg, int max_sdu_sz)
int buffer_state = rlc->get_buffer_state(lcid); int buffer_state = rlc->get_buffer_state(lcid);
while (buffer_state > 0 && sdu_space > 0) { // there is pending SDU to allocate while (buffer_state > 0 && sdu_space > 0) { // there is pending SDU to allocate
int requested_sdu_len = SRSLTE_MIN(buffer_state, max_sdu_sz); int requested_sdu_len = SRSLTE_MIN(buffer_state, sdu_space);
if (pdu_msg->new_subh()) { // there is space for a new subheader if (pdu_msg->new_subh()) { // there is space for a new subheader
int sdu_len = pdu_msg->get()->set_sdu(lcid, requested_sdu_len, rlc); int sdu_len = pdu_msg->get()->set_sdu(lcid, requested_sdu_len, rlc);
if (sdu_len > 0) { // new SDU could be added if (sdu_len > 0) { // new SDU could be added
Debug("SDU: allocated lcid=%d, rlc_buffer=%d, request_sdu_len=%d, allocated=%d/%d, max_sdu_sz=%d, " Debug("SDU: allocated lcid=%d, buffer_state=%d, request_sdu_len=%d, allocated=%d/%d, max_sdu_sz=%d, "
"remaining=%d\n", "remaining=%d\n",
lcid, lcid,
buffer_state, buffer_state,
@ -326,18 +326,20 @@ bool mux::allocate_sdu(uint32_t lcid, srslte::sch_pdu* pdu_msg, int max_sdu_sz)
buffer_state = rlc->get_buffer_state(lcid); buffer_state = rlc->get_buffer_state(lcid);
} else { } else {
Warning("Couldn't allocate new SDU (rlc_buffer=%d, requested_sdu_len=%d, allocated=%d/%d, remaining=%d)\n", Debug("Couldn't allocate new SDU (buffer_state=%d, requested_sdu_len=%d, sdu_len=%d, sdu_space=%d, "
buffer_state, "remaining=%d, get_sdu_space=%d)\n",
requested_sdu_len, buffer_state,
sdu_len, requested_sdu_len,
sdu_space, sdu_len,
pdu_msg->rem_size()); sdu_space,
pdu_msg->rem_size(),
pdu_msg->get_sdu_space());
pdu_msg->del_subh(); pdu_msg->del_subh();
// prevent endless loop // prevent endless loop
break; break;
} }
} else { } else {
Debug("Couldn't add new MAC subheader (rlc_buffer=%d, requested_sdu_len=%d, sdu_space=%d, remaining=%d)\n", Debug("Couldn't add new MAC subheader (buffer_state=%d, requested_sdu_len=%d, sdu_space=%d, remaining=%d)\n",
buffer_state, buffer_state,
requested_sdu_len, requested_sdu_len,
sdu_space, sdu_space,

Loading…
Cancel
Save