1-byte PDU fix for RLC AM

master
Paul Sutton 7 years ago
parent bd206e94fc
commit ac8cbcaaea

@ -613,7 +613,7 @@ int rlc_am::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
uint32_t pdu_space = nof_bytes;
uint8_t *pdu_ptr = pdu->msg;
if(pdu_space <= head_len)
if(pdu_space <= head_len + 1)
{
log->warning("%s Cannot build a PDU - %d bytes available, %d bytes required for header\n",
rrc->get_rb_name(lcid).c_str(), nof_bytes, head_len);
@ -652,7 +652,7 @@ int rlc_am::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
}
// Pull SDUs from queue
while(pdu_space > head_len && tx_sdu_queue.size() > 0)
while(pdu_space > head_len + 1 && tx_sdu_queue.size() > 0)
{
if(last_li > 0)
header.li[header.N_li++] = last_li;

@ -123,7 +123,7 @@ void basic_test()
byte_buffer_t pdu_bufs[NBUFS];
for(int i=0;i<NBUFS;i++)
{
len = rlc1.read_pdu(pdu_bufs[i].msg, 3); // 3 bytes for header + payload
len = rlc1.read_pdu(pdu_bufs[i].msg, 4); // 3 bytes for header + payload
pdu_bufs[i].N_bytes = len;
}
@ -351,7 +351,7 @@ void retx_test()
byte_buffer_t pdu_bufs[NBUFS];
for(int i=0;i<NBUFS;i++)
{
len = rlc1.read_pdu(pdu_bufs[i].msg, 3); // 2 byte header + 1 byte payload
len = rlc1.read_pdu(pdu_bufs[i].msg, 4); // 2 byte header + 1 byte payload
pdu_bufs[i].N_bytes = len;
}

Loading…
Cancel
Save