diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c index f80a46695d21baef203f4eaa59ec03b8267358ae..06ad9a3b05ace2ccbaeff4fe42a5d6a040254181 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c @@ -206,23 +206,28 @@ boolean_t rlc_am_nack_pdu ( void rlc_am_ack_pdu ( const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlc_pP, - const rlc_sn_t snP) + const rlc_sn_t snP, + boolean_t free_pdu) { mem_block_t* mb_p = rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE].mem_block; rlc_am_tx_data_pdu_management_t *tx_data_pdu_buffer = &rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_WINDOW_SIZE]; tx_data_pdu_buffer->flags.retransmit = 0; - if ((tx_data_pdu_buffer->flags.ack == 0) && (mb_p != NULL)) { - //if (mb_pP != NULL) { + if (mb_p != NULL) { + if (free_pdu) { free_mem_block(mb_p, __func__); tx_data_pdu_buffer->mem_block = NULL; LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] ACK PDU SN %05d previous retx_count %d \n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), snP, tx_data_pdu_buffer->retx_count); + } if (tx_data_pdu_buffer->retx_payload_size) { + AssertFatal (tx_data_pdu_buffer->flags.ack == 0, + "RLC AM Rx Status Report sn=%d acked twice but is pending for Retx vtA=%d vtS=%d LcId=%d\n", + snP, rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); rlc_pP->retrans_num_bytes_to_retransmit -= tx_data_pdu_buffer->retx_payload_size; tx_data_pdu_buffer->retx_payload_size = 0; tx_data_pdu_buffer->num_holes = 0; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h index 338bc791968565aba6640d19f2e6dc181c30695c..7224d39bf96b90b11562fb4be5eb47c74daeca41 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.h @@ -74,12 +74,14 @@ protected_rlc_am_retransmit(boolean_t rlc_am_nack_pdu ( * \param[in] ctxtP Running context. * \param[in] rlcP RLC AM protocol instance pointer. * \param[in] snP Sequence number of the PDU that is acknowledged. +* \param[in] free_pdu Boolean indicating that the PDU can be freed because smaller than new vtA. * \note Depending on the state of the retransmission buffer, positive confirmation can be sent to higher layers about the receiving by the peer RLC AM instance of a particular SDU. */ protected_rlc_am_retransmit(void rlc_am_ack_pdu ( const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlcP, - const rlc_sn_t snP);) + const rlc_sn_t snP, + boolean_t free_pdu);) /*! \fn mem_block_t* rlc_am_retransmit_get_copy (const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *rlcP, rlc_sn_t snP) * \brief The RLC AM PDU which have the sequence number snP is marked ACKed. diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c index c07e9cd6f3fbd65f51ec07a584784bb6b799ad3d..a5c15a5262a15bcb154c9c013765ebeb8f5645db 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c @@ -318,7 +318,7 @@ rlc_am_receive_process_control_pdu( { if (rlc_pP->control_pdu_info.num_nack == 0) { while (sn_cursor != ack_sn) { - rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor); + rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor,TRUE); sn_cursor = RLC_AM_NEXT_SN(sn_cursor); } @@ -330,7 +330,7 @@ rlc_am_receive_process_control_pdu( prev_nack_sn = 0x3FFF; while (sn_cursor != nack_sn) { - rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor); + rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor,TRUE); sn_cursor = RLC_AM_NEXT_SN(sn_cursor); } @@ -354,7 +354,8 @@ rlc_am_receive_process_control_pdu( if (sn_cursor != nack_sn) { rlc_am_ack_pdu(ctxt_pP, rlc_pP, - sn_cursor); + sn_cursor, + FALSE); } else { status = rlc_am_nack_pdu (ctxt_pP, rlc_pP, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c index 2dfa472523f5a536f7515ccaaa8d1fbbc218168b..3edb09d22815ca0053af0aecf9aed40f1f53e8a7 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c @@ -88,8 +88,8 @@ rlc_am_check_timer_poll_retransmit( /* Look for the first retransmittable PDU starting from vtS - 1 */ while (sn != sn_end) { tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[sn % RLC_AM_WINDOW_SIZE]; - AssertFatal (tx_data_pdu_buffer_p->mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d is empty vtA=%d vtS=%d LcId=%d\n", - sn, rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); + AssertFatal (tx_data_pdu_buffer_p->mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d ack=%d is empty vtA=%d vtS=%d LcId=%d\n", + sn, tx_data_pdu_buffer_p->flags.ack,rlc_pP->vt_a,rlc_pP->vt_s,rlc_pP->channel_id); if ((tx_data_pdu_buffer_p->flags.ack == 0) && (tx_data_pdu_buffer_p->flags.max_retransmit == 0)) { tx_data_pdu_buffer_p->flags.retransmit = 1; tx_data_pdu_buffer_p->retx_payload_size = tx_data_pdu_buffer_p->payload_size;