From fa7d5bd40e73eb0f4b1da783fa140857c4751b7b Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Tue, 6 Feb 2018 16:59:20 +0100 Subject: [PATCH] rlc_am: retransmit first outstanding PDU in case the tx_window is full to avoid stalling --- lib/src/upper/rlc_am.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index 26e0d39d2..3f976bd91 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -312,6 +312,23 @@ int rlc_am::read_pdu(uint8_t *payload, uint32_t nof_bytes) pthread_mutex_unlock(&mutex); return build_status_pdu(payload, nof_bytes); } + + // if tx_window is full and retx_queue empty, retransmit next PDU to be ack'ed + if (tx_window.size() >= RLC_AM_WINDOW_SIZE && retx_queue.size() == 0) { + // make sure this SN is still in the Tx window + uint32_t retx_sn = vt_a; + while (tx_window[retx_sn].buf == NULL) { + retx_sn++; + } + + rlc_amd_retx_t retx; + retx.is_segment = false; + retx.so_start = 0; + retx.so_end = tx_window[retx_sn].buf->N_bytes; + retx.sn = retx_sn; + retx_queue.push_back(retx); + } + // RETX if required if(retx_queue.size() > 0) { int ret = build_retx_pdu(payload, nof_bytes);