rlc_am_lte: refactor retransmit_pdu() to send different SNs

it seems that different SNs should be retransmitted depending
on the actual situation. In case of pollRetx timer expiration,
vt_s - 1 should actually be resent.

This patch prepares the function to accept different SNs but
leaves it to send vt_a by default. The RLC AM test would need
to changed as well to not fail.
This commit is contained in:
Andre Puschmann 2021-05-19 18:08:58 +02:00
parent 81c1851bbd
commit 21b3635ae4
2 changed files with 11 additions and 11 deletions

View File

@ -393,7 +393,7 @@ private:
void debug_state();
int required_buffer_size(rlc_amd_retx_t retx);
void retransmit_pdu();
void retransmit_pdu(uint32_t sn);
// Helpers
bool poll_required();

View File

@ -556,7 +556,7 @@ int rlc_am_lte::rlc_am_lte_tx::read_pdu(uint8_t* payload, uint32_t nof_bytes)
// Section 5.2.2.3 in TS 36.311, if tx_window is full and retx_queue empty, retransmit PDU
if (tx_window.size() >= RLC_AM_WINDOW_SIZE && retx_queue.empty()) {
retransmit_pdu();
retransmit_pdu(vt_a);
}
// RETX if required
@ -576,11 +576,11 @@ void rlc_am_lte::rlc_am_lte_tx::timer_expired(uint32_t timeout_id)
std::unique_lock<std::mutex> lock(mutex);
if (poll_retx_timer.is_valid() && poll_retx_timer.id() == timeout_id) {
logger.debug("%s Poll reTx timer expired after %dms", RB_NAME, poll_retx_timer.duration());
// Section 5.2.2.3 in TS 36.311, schedule PDU for retransmission if
// (a) both tx and retx buffer are empty, or
// Section 5.2.2.3 in TS 36.322, schedule PDU for retransmission if
// (a) both tx and retx buffer are empty (excluding tx'ed PDU waiting for ack), or
// (b) no new data PDU can be transmitted (tx window is full)
if ((retx_queue.empty() && tx_sdu_queue.size() == 0) || tx_window.size() >= RLC_AM_WINDOW_SIZE) {
retransmit_pdu();
retransmit_pdu(vt_a); // TODO: TS says to send vt_s - 1 here
}
}
@ -591,21 +591,21 @@ void rlc_am_lte::rlc_am_lte_tx::timer_expired(uint32_t timeout_id)
}
}
void rlc_am_lte::rlc_am_lte_tx::retransmit_pdu()
void rlc_am_lte::rlc_am_lte_tx::retransmit_pdu(uint32_t sn)
{
if (tx_window.empty()) {
logger.warning("%s No PDU to retransmit.", RB_NAME);
logger.warning("%s No PDU to retransmit", RB_NAME);
return;
}
if (not tx_window.has_sn(vt_a)) {
logger.warning("%s Can't retransmit unexisting SN=%d.", RB_NAME, vt_a);
if (not tx_window.has_sn(sn)) {
logger.warning("%s Can't retransmit unexisting SN=%d", RB_NAME, sn);
return;
}
// select first PDU in tx window for retransmission
rlc_amd_tx_pdu& pdu = tx_window[vt_a];
logger.info("%s Schedule SN=%d for reTx.", RB_NAME, pdu.rlc_sn);
rlc_amd_tx_pdu& pdu = tx_window[sn];
logger.info("%s Schedule SN=%d for reTx", RB_NAME, pdu.rlc_sn);
rlc_amd_retx_t& retx = retx_queue.push();
retx.is_segment = false;
retx.so_start = 0;