diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index f4dced1ec..e6e1ff279 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -198,7 +198,7 @@ uint32_t rlc_am::get_bearer() void rlc_am::write_sdu(byte_buffer_t *sdu) { tx_sdu_queue.write(sdu); - log->info_hex(sdu->msg, sdu->N_bytes, "%s Tx SDU, tx_sdu_len=%d", rrc->get_rb_name(lcid).c_str(), tx_sdu_queue.size()); + log->info_hex(sdu->msg, sdu->N_bytes, "%s Tx SDU, tx_sdu_queue_len=%d", rrc->get_rb_name(lcid).c_str(), tx_sdu_queue.size()); } /**************************************************************************** @@ -273,6 +273,27 @@ uint32_t rlc_am::get_buffer_state() goto unlock_and_return; } + // check if pollRetx timer expired (Section 5.2.2.3 in TS 36.322) + if (poll_retx()) { + // if both tx and retx buffer are empty, retransmit next PDU to be ack'ed + log->info("Poll reTx timer expired (lcid=%d)\n", lcid); + if ((tx_window.size() > 0 && retx_queue.size() == 0 && tx_sdu_queue.size() == 0)) { + std::map::iterator it = tx_window.find(vt_s - 1); + if (it != tx_window.end()) { + log->info("Schedule last PDU (SN=%d) for reTx.\n", vt_s - 1); + rlc_amd_retx_t retx; + retx.is_segment = false; + retx.so_start = 0; + retx.so_end = tx_window[vt_s - 1].buf->N_bytes; + retx.sn = vt_s - 1; + retx_queue.push_back(retx); + } else { + log->error("Found invalid PDU in tx_window.\n"); + } + poll_retx_timeout.start(cfg.t_poll_retx); + } + } + // Bytes needed for retx if(retx_queue.size() > 0) { rlc_amd_retx_t retx = retx_queue.front();