Commit d3af6f1f authored by fnabet's avatar fnabet

Renaming or removing some Tx RLC AM fields

parent 39bdc2bc
...@@ -481,7 +481,7 @@ rlc_am_get_pdus ( ...@@ -481,7 +481,7 @@ rlc_am_get_pdus (
(rlc_pP->first_retrans_pdu_sn >= 0) && (rlc_pP->first_retrans_pdu_sn >= 0) &&
(rlc_pP->first_retrans_pdu_sn != rlc_pP->vt_s)) { (rlc_pP->first_retrans_pdu_sn != rlc_pP->vt_s)) {
tx_data_pdu_management = &rlc_pP->pdu_retrans_buffer[rlc_pP->first_retrans_pdu_sn]; tx_data_pdu_management = &rlc_pP->tx_data_pdu_buffer[rlc_pP->first_retrans_pdu_sn];
if ((tx_data_pdu_management->header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) && (tx_data_pdu_management->retx_count >= 0) if ((tx_data_pdu_management->header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) && (tx_data_pdu_management->retx_count >= 0)
&& (tx_data_pdu_management->nack_so_start == 0) && (tx_data_pdu_management->nack_so_stop == 0x7FFF)) { && (tx_data_pdu_management->nack_so_start == 0) && (tx_data_pdu_management->nack_so_stop == 0x7FFF)) {
...@@ -500,7 +500,7 @@ rlc_am_get_pdus ( ...@@ -500,7 +500,7 @@ rlc_am_get_pdus (
list_add_tail_eurecom (copy, &rlc_pP->pdus_to_mac_layer); list_add_tail_eurecom (copy, &rlc_pP->pdus_to_mac_layer);
rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - tx_data_pdu_management->header_and_payload_size; rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - tx_data_pdu_management->header_and_payload_size;
tx_data_pdu_management->retx_count += 1; tx_data_pdu_management->retx_count = tx_data_pdu_management->retx_count_next;
return; return;
} else if ((tx_data_pdu_management->retx_count >= 0) && (rlc_pP->nb_bytes_requested_by_mac >= RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) { } else if ((tx_data_pdu_management->retx_count >= 0) && (rlc_pP->nb_bytes_requested_by_mac >= RLC_AM_MIN_SEGMENT_SIZE_REQUEST)) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" SEND SEGMENT OF DATA PDU SN %04d MAC BYTES %d SIZE %d RTX COUNT %d nack_so_start %d nack_so_stop %04X(hex)\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" SEND SEGMENT OF DATA PDU SN %04d MAC BYTES %d SIZE %d RTX COUNT %d nack_so_start %d nack_so_stop %04X(hex)\n",
...@@ -535,7 +535,7 @@ rlc_am_get_pdus ( ...@@ -535,7 +535,7 @@ rlc_am_get_pdus (
// update first_retrans_pdu_sn // update first_retrans_pdu_sn
while ((rlc_pP->first_retrans_pdu_sn != rlc_pP->vt_s) && while ((rlc_pP->first_retrans_pdu_sn != rlc_pP->vt_s) &&
(!(rlc_pP->pdu_retrans_buffer[rlc_pP->first_retrans_pdu_sn].flags.retransmit))) { (!(rlc_pP->tx_data_pdu_buffer[rlc_pP->first_retrans_pdu_sn].flags.retransmit))) {
rlc_pP->first_retrans_pdu_sn = (rlc_pP->first_retrans_pdu_sn+1) & RLC_AM_SN_MASK; rlc_pP->first_retrans_pdu_sn = (rlc_pP->first_retrans_pdu_sn+1) & RLC_AM_SN_MASK;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" UPDATED first_retrans_pdu_sn SN %04d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" UPDATED first_retrans_pdu_sn SN %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
...@@ -706,22 +706,23 @@ rlc_am_mac_status_indication ( ...@@ -706,22 +706,23 @@ rlc_am_mac_status_indication (
// force BO to be > 0 // force BO to be > 0
rlc_sn_t sn = (rlc->vt_s - 1) & RLC_AM_SN_MASK; rlc_sn_t sn = (rlc->vt_s - 1) & RLC_AM_SN_MASK;
rlc_sn_t sn_end = (rlc->vt_a - 1) & RLC_AM_SN_MASK; rlc_sn_t sn_end = (rlc->vt_a - 1) & RLC_AM_SN_MASK;
int found_pdu = 0;
rlc_sn_t found_pdu_sn = 0; // avoid warning
(void)found_pdu_sn; /* avoid gcc warning "set but not used" */
/* Look for the first retransmittable PDU starting from vtS - 1 */
while (sn != sn_end) { while (sn != sn_end) {
if (rlc->pdu_retrans_buffer[sn].mem_block != NULL) { AssertFatal (rlc->tx_data_pdu_buffer[sn].mem_block != NULL, "RLC AM Tpoll Retx expiry sn=%d is empty vtA=%d vtS=%d LcId=%d\n",
if (!found_pdu) { sn, rlc->vt_a,rlc->vt_s,rlc->channel_id);
found_pdu = 1; if ((rlc->tx_data_pdu_buffer[sn].flags.ack == 0) && (rlc->tx_data_pdu_buffer[sn].flags.max_retransmit == 0)) {
found_pdu_sn = sn; rlc->retrans_num_bytes_to_retransmit = rlc->tx_data_pdu_buffer[sn].header_and_payload_size;
} rlc->tx_data_pdu_buffer[sn].flags.retransmit = 1;
status_resp.buffer_occupancy_in_bytes = rlc->pdu_retrans_buffer[sn].header_and_payload_size; status_resp.buffer_occupancy_in_bytes = rlc->tx_data_pdu_buffer[sn].header_and_payload_size;
status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu; status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
status_resp.head_sdu_remaining_size_to_send = status_resp.buffer_occupancy_in_bytes; status_resp.head_sdu_remaining_size_to_send = status_resp.buffer_occupancy_in_bytes;
// TODO head_sdu_is_segmented // TODO head_sdu_is_segmented
break; break;
}
else
{
sn = RLC_AM_PREV_SN(sn);
} }
} }
} }
......
...@@ -74,9 +74,8 @@ typedef struct rlc_am_entity_s { ...@@ -74,9 +74,8 @@ typedef struct rlc_am_entity_s {
signed int current_sdu_index; /*!< \brief Current SDU index in input_sdus array to be segmented which is not segmented or partially segmented. */ signed int current_sdu_index; /*!< \brief Current SDU index in input_sdus array to be segmented which is not segmented or partially segmented. */
rlc_am_tx_data_pdu_management_t *pdu_retrans_buffer; /*!< \brief Retransmission buffer. */ rlc_am_tx_data_pdu_management_t *tx_data_pdu_buffer; /*!< \brief Transmission PDU data buffer. Used also for retransmissions */
signed int retrans_num_pdus; /*!< \brief Number of PDUs in the retransmission buffer. */ signed int retrans_num_pdus; /*!< \brief Number of PDUs in the retransmission buffer. */
signed int retrans_num_bytes; /*!< \brief Number of bytes in the retransmission buffer. */
signed int retrans_num_bytes_to_retransmit; /*!< \brief Number of bytes in the retransmission buffer to be retransmitted. */ signed int retrans_num_bytes_to_retransmit; /*!< \brief Number of bytes in the retransmission buffer to be retransmitted. */
boolean_t force_poll; /*!< \brief force poll due to t_poll_retransmit time-out. */ boolean_t force_poll; /*!< \brief force poll due to t_poll_retransmit time-out. */
......
...@@ -51,16 +51,16 @@ rlc_am_init( ...@@ -51,16 +51,16 @@ rlc_am_init(
pthread_mutex_init(&rlc_pP->lock_input_sdus, NULL); pthread_mutex_init(&rlc_pP->lock_input_sdus, NULL);
rlc_pP->input_sdus = calloc(1, RLC_AM_SDU_CONTROL_BUFFER_SIZE*sizeof(rlc_am_tx_sdu_management_t)); rlc_pP->input_sdus = calloc(1, RLC_AM_SDU_CONTROL_BUFFER_SIZE*sizeof(rlc_am_tx_sdu_management_t));
//#warning "cast the rlc retrans buffer to uint32" //#warning "cast the rlc retrans buffer to uint32"
// rlc_pP->pdu_retrans_buffer = calloc(1, (uint16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t))); // rlc_pP->tx_data_pdu_buffer = calloc(1, (uint16_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(rlc_am_tx_data_pdu_management_t)));
rlc_pP->pdu_retrans_buffer = calloc(1, (uint32_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof( rlc_pP->tx_data_pdu_buffer = calloc(1, (uint32_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(
rlc_am_tx_data_pdu_management_t))); rlc_am_tx_data_pdu_management_t)));
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] input_sdus[] = %p element size=%zu\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] input_sdus[] = %p element size=%zu\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->input_sdus, rlc_pP->input_sdus,
sizeof(rlc_am_tx_sdu_management_t)); sizeof(rlc_am_tx_sdu_management_t));
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] pdu_retrans_buffer[] = %p element size=%zu\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[AM INIT] tx_data_pdu_buffer[] = %p element size=%zu\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->pdu_retrans_buffer, rlc_pP->tx_data_pdu_buffer,
sizeof(rlc_am_tx_data_pdu_management_t)); sizeof(rlc_am_tx_data_pdu_management_t));
// TX state variables // TX state variables
...@@ -175,16 +175,16 @@ rlc_am_cleanup( ...@@ -175,16 +175,16 @@ rlc_am_cleanup(
pthread_mutex_destroy(&rlc_pP->lock_input_sdus); pthread_mutex_destroy(&rlc_pP->lock_input_sdus);
if (rlc_pP->pdu_retrans_buffer != NULL) { if (rlc_pP->tx_data_pdu_buffer != NULL) {
for (i=0; i < RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; i++) { for (i=0; i < RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; i++) {
if (rlc_pP->pdu_retrans_buffer[i].mem_block != NULL) { if (rlc_pP->tx_data_pdu_buffer[i].mem_block != NULL) {
free_mem_block(rlc_pP->pdu_retrans_buffer[i].mem_block, __func__); free_mem_block(rlc_pP->tx_data_pdu_buffer[i].mem_block, __func__);
rlc_pP->pdu_retrans_buffer[i].mem_block = NULL; rlc_pP->tx_data_pdu_buffer[i].mem_block = NULL;
} }
} }
free(rlc_pP->pdu_retrans_buffer); free(rlc_pP->tx_data_pdu_buffer);
rlc_pP->pdu_retrans_buffer = NULL; rlc_pP->tx_data_pdu_buffer = NULL;
} }
memset(rlc_pP, 0, sizeof(rlc_am_entity_t)); memset(rlc_pP, 0, sizeof(rlc_am_entity_t));
......
...@@ -50,7 +50,7 @@ void rlc_am_nack_pdu ( ...@@ -50,7 +50,7 @@ void rlc_am_nack_pdu (
// - indicate to upper layers that max retransmission has been reached. // - indicate to upper layers that max retransmission has been reached.
mem_block_t* mb_p = rlc_pP->pdu_retrans_buffer[snP].mem_block; mem_block_t* mb_p = rlc_pP->tx_data_pdu_buffer[snP].mem_block;
int pdu_sdu_index; int pdu_sdu_index;
int sdu_index; int sdu_index;
...@@ -63,8 +63,8 @@ void rlc_am_nack_pdu ( ...@@ -63,8 +63,8 @@ void rlc_am_nack_pdu (
// increasing order among calls refering to only one status PDU // increasing order among calls refering to only one status PDU
// and among time // and among time
//----------------------------------------- //-----------------------------------------
if (rlc_pP->pdu_retrans_buffer[snP].last_nack_time != ctxt_pP->frame) { if (rlc_pP->tx_data_pdu_buffer[snP].last_nack_time != ctxt_pP->frame) {
rlc_pP->pdu_retrans_buffer[snP].last_nack_time = ctxt_pP->frame; rlc_pP->tx_data_pdu_buffer[snP].last_nack_time = ctxt_pP->frame;
rlc_am_clear_holes(ctxt_pP, rlc_pP, snP); rlc_am_clear_holes(ctxt_pP, rlc_pP, snP);
} }
...@@ -79,21 +79,22 @@ void rlc_am_nack_pdu ( ...@@ -79,21 +79,22 @@ void rlc_am_nack_pdu (
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] NACK PDU SN %04d previous retx_count %d 1ST_RETRANS_PDU %04d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] NACK PDU SN %04d previous retx_count %d 1ST_RETRANS_PDU %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
rlc_pP->pdu_retrans_buffer[snP].retx_count, rlc_pP->tx_data_pdu_buffer[snP].retx_count,
rlc_pP->first_retrans_pdu_sn); rlc_pP->first_retrans_pdu_sn);
rlc_pP->pdu_retrans_buffer[snP].flags.retransmit = 1; rlc_pP->tx_data_pdu_buffer[snP].flags.retransmit = 1;
if (rlc_pP->pdu_retrans_buffer[snP].retx_count == -1) { /* TODO : before incrementing retx_count_next, this must be a new occurrence of retransmission */
rlc_pP->pdu_retrans_buffer[snP].retx_count = 0; if (rlc_pP->tx_data_pdu_buffer[snP].retx_count == rlc_pP->tx_data_pdu_buffer[snP].retx_count_next){
rlc_pP->retrans_num_bytes_to_retransmit += rlc_pP->pdu_retrans_buffer[snP].header_and_payload_size; rlc_pP->tx_data_pdu_buffer[snP].retx_count_next ++;
} else { rlc_pP->retrans_num_bytes_to_retransmit += rlc_pP->tx_data_pdu_buffer[snP].header_and_payload_size;
rlc_pP->pdu_retrans_buffer[snP].retx_count += 1;
} }
if (rlc_pP->pdu_retrans_buffer[snP].retx_count >= rlc_pP->max_retx_threshold) { /* TODO: Move this part in UL SCH processing */
for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->pdu_retrans_buffer[snP].nb_sdus; pdu_sdu_index++) { #if 0
sdu_index = rlc_pP->pdu_retrans_buffer[snP].sdus_index[pdu_sdu_index]; if (rlc_pP->tx_data_pdu_buffer[snP].retx_count >= rlc_pP->max_retx_threshold) {
for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->tx_data_pdu_buffer[snP].nb_sdus; pdu_sdu_index++) {
sdu_index = rlc_pP->tx_data_pdu_buffer[snP].sdus_index[pdu_sdu_index];
assert(pdu_sdu_index < RLC_AM_MAX_SDU_IN_PDU); assert(pdu_sdu_index < RLC_AM_MAX_SDU_IN_PDU);
assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE); assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE);
rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1; rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1;
...@@ -117,6 +118,7 @@ void rlc_am_nack_pdu ( ...@@ -117,6 +118,7 @@ void rlc_am_nack_pdu (
} }
} }
} }
#endif
} else { } else {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU SN %05d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[NACK-PDU] ERROR NACK MISSING PDU SN %05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
...@@ -130,29 +132,27 @@ void rlc_am_ack_pdu ( ...@@ -130,29 +132,27 @@ void rlc_am_ack_pdu (
rlc_am_entity_t *const rlc_pP, rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP) const rlc_sn_t snP)
{ {
mem_block_t* mb_p = rlc_pP->pdu_retrans_buffer[snP].mem_block; mem_block_t* mb_p = rlc_pP->tx_data_pdu_buffer[snP].mem_block;
int pdu_sdu_index; int pdu_sdu_index;
int sdu_index; int sdu_index;
rlc_pP->pdu_retrans_buffer[snP].flags.retransmit = 0; rlc_pP->tx_data_pdu_buffer[snP].flags.retransmit = 0;
if ((rlc_pP->pdu_retrans_buffer[snP].flags.ack == 0) && (mb_p != NULL)) { if ((rlc_pP->tx_data_pdu_buffer[snP].flags.ack == 0) && (mb_p != NULL)) {
//if (mb_pP != NULL) { //if (mb_pP != NULL) {
free_mem_block(mb_p, __func__); free_mem_block(mb_p, __func__);
rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL; rlc_pP->tx_data_pdu_buffer[snP].mem_block = NULL;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] ACK PDU SN %05d previous retx_count %d \n", 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), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
rlc_pP->pdu_retrans_buffer[snP].retx_count); rlc_pP->tx_data_pdu_buffer[snP].retx_count);
rlc_pP->retrans_num_pdus -= 1;
rlc_pP->retrans_num_bytes -= rlc_pP->pdu_retrans_buffer[snP].header_and_payload_size;
if (rlc_pP->pdu_retrans_buffer[snP].retx_count >= 0) { if (rlc_pP->tx_data_pdu_buffer[snP].retx_count >= 0) {
rlc_pP->retrans_num_bytes_to_retransmit -= rlc_pP->pdu_retrans_buffer[snP].header_and_payload_size; rlc_pP->retrans_num_bytes_to_retransmit -= rlc_pP->tx_data_pdu_buffer[snP].header_and_payload_size;
} }
for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->pdu_retrans_buffer[snP].nb_sdus; pdu_sdu_index++) { for (pdu_sdu_index = 0; pdu_sdu_index < rlc_pP->tx_data_pdu_buffer[snP].nb_sdus; pdu_sdu_index++) {
sdu_index = rlc_pP->pdu_retrans_buffer[snP].sdus_index[pdu_sdu_index]; sdu_index = rlc_pP->tx_data_pdu_buffer[snP].sdus_index[pdu_sdu_index];
assert(sdu_index >= 0); assert(sdu_index >= 0);
assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE); assert(sdu_index < RLC_AM_SDU_CONTROL_BUFFER_SIZE);
rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1; rlc_pP->input_sdus[sdu_index].nb_pdus_ack += 1;
...@@ -182,19 +182,19 @@ void rlc_am_ack_pdu ( ...@@ -182,19 +182,19 @@ void rlc_am_ack_pdu (
// This state variable holds the value of the SN of the next AMD PDU for which a positive acknowledgment is to be // This state variable holds the value of the SN of the next AMD PDU for which a positive acknowledgment is to be
// received in-sequence, and it serves as the lower edge of the transmitting window. It is initially set to 0, and is updated // received in-sequence, and it serves as the lower edge of the transmitting window. It is initially set to 0, and is updated
// whenever the AM RLC entity receives a positive acknowledgment for an AMD PDU with SN = VT(A). // whenever the AM RLC entity receives a positive acknowledgment for an AMD PDU with SN = VT(A).
rlc_pP->pdu_retrans_buffer[snP].flags.ack = 1; rlc_pP->tx_data_pdu_buffer[snP].flags.ack = 1;
if (snP == rlc_pP->vt_a) { if (snP == rlc_pP->vt_a) {
//rlc_pP->pdu_retrans_buffer[snP].flags.ack = 1; //rlc_pP->tx_data_pdu_buffer[snP].flags.ack = 1;
do { do {
memset(&rlc_pP->pdu_retrans_buffer[rlc_pP->vt_a], 0, sizeof(rlc_am_tx_data_pdu_management_t)); memset(&rlc_pP->tx_data_pdu_buffer[rlc_pP->vt_a], 0, sizeof(rlc_am_tx_data_pdu_management_t));
if (rlc_pP->vt_a == rlc_pP->first_retrans_pdu_sn) { if (rlc_pP->vt_a == rlc_pP->first_retrans_pdu_sn) {
rlc_pP->first_retrans_pdu_sn = (rlc_pP->vt_a + 1) & RLC_AM_SN_MASK; rlc_pP->first_retrans_pdu_sn = (rlc_pP->vt_a + 1) & RLC_AM_SN_MASK;
} }
rlc_pP->vt_a = (rlc_pP->vt_a + 1) & RLC_AM_SN_MASK; rlc_pP->vt_a = (rlc_pP->vt_a + 1) & RLC_AM_SN_MASK;
} while ((rlc_pP->pdu_retrans_buffer[rlc_pP->vt_a].flags.ack == 1) && (rlc_pP->vt_a != rlc_pP->vt_s)); } while ((rlc_pP->tx_data_pdu_buffer[rlc_pP->vt_a].flags.ack == 1) && (rlc_pP->vt_a != rlc_pP->vt_s));
rlc_pP->vt_ms = (rlc_pP->vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK; rlc_pP->vt_ms = (rlc_pP->vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
...@@ -209,7 +209,7 @@ void rlc_am_ack_pdu ( ...@@ -209,7 +209,7 @@ void rlc_am_ack_pdu (
do { do {
rlc_pP->first_retrans_pdu_sn = (rlc_pP->first_retrans_pdu_sn + 1) & RLC_AM_SN_MASK; rlc_pP->first_retrans_pdu_sn = (rlc_pP->first_retrans_pdu_sn + 1) & RLC_AM_SN_MASK;
if (rlc_pP->pdu_retrans_buffer[rlc_pP->first_retrans_pdu_sn].retx_count >= 0) { if (rlc_pP->tx_data_pdu_buffer[rlc_pP->first_retrans_pdu_sn].retx_count >= 0) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] UPDATED first_retrans_pdu_sn -> %04d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] UPDATED first_retrans_pdu_sn -> %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->first_retrans_pdu_sn); rlc_pP->first_retrans_pdu_sn);
...@@ -231,21 +231,21 @@ void rlc_am_ack_pdu ( ...@@ -231,21 +231,21 @@ void rlc_am_ack_pdu (
if (mb_p != NULL) { if (mb_p != NULL) {
free_mem_block(mb_p, __func__); free_mem_block(mb_p, __func__);
rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL; rlc_pP->tx_data_pdu_buffer[snP].mem_block = NULL;
} }
if (rlc_pP->pdu_retrans_buffer[snP].flags.ack > 0) { if (rlc_pP->tx_data_pdu_buffer[snP].flags.ack > 0) {
if (snP == rlc_pP->vt_a) { if (snP == rlc_pP->vt_a) {
//rlc_pP->pdu_retrans_buffer[snP].flags.ack = 1; //rlc_pP->tx_data_pdu_buffer[snP].flags.ack = 1;
do { do {
memset(&rlc_pP->pdu_retrans_buffer[rlc_pP->vt_a], 0, sizeof(rlc_am_tx_data_pdu_management_t)); memset(&rlc_pP->tx_data_pdu_buffer[rlc_pP->vt_a], 0, sizeof(rlc_am_tx_data_pdu_management_t));
if (rlc_pP->vt_a == rlc_pP->first_retrans_pdu_sn) { if (rlc_pP->vt_a == rlc_pP->first_retrans_pdu_sn) {
rlc_pP->first_retrans_pdu_sn = (rlc_pP->vt_a + 1) & RLC_AM_SN_MASK; rlc_pP->first_retrans_pdu_sn = (rlc_pP->vt_a + 1) & RLC_AM_SN_MASK;
} }
rlc_pP->vt_a = (rlc_pP->vt_a + 1) & RLC_AM_SN_MASK; rlc_pP->vt_a = (rlc_pP->vt_a + 1) & RLC_AM_SN_MASK;
} while ((rlc_pP->pdu_retrans_buffer[rlc_pP->vt_a].flags.ack == 1) && (rlc_pP->vt_a != rlc_pP->vt_s)); } while ((rlc_pP->tx_data_pdu_buffer[rlc_pP->vt_a].flags.ack == 1) && (rlc_pP->vt_a != rlc_pP->vt_s));
rlc_pP->vt_ms = (rlc_pP->vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK; rlc_pP->vt_ms = (rlc_pP->vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] UPDATED VT(A) %04d VT(MS) %04d VT(S) %04d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] UPDATED VT(A) %04d VT(MS) %04d VT(S) %04d\n",
...@@ -263,11 +263,11 @@ mem_block_t* rlc_am_retransmit_get_copy ( ...@@ -263,11 +263,11 @@ mem_block_t* rlc_am_retransmit_get_copy (
rlc_am_entity_t *const rlc_pP, rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP) const rlc_sn_t snP)
{ {
mem_block_t* mb_original_p = rlc_pP->pdu_retrans_buffer[snP].mem_block; mem_block_t* mb_original_p = rlc_pP->tx_data_pdu_buffer[snP].mem_block;
if (mb_original_p != NULL) { if (mb_original_p != NULL) {
rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->pdu_retrans_buffer[snP % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE]; rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->tx_data_pdu_buffer[snP % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE];
int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req); int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req);
mem_block_t* mb_copy = get_free_mem_block(size, __func__); mem_block_t* mb_copy = get_free_mem_block(size, __func__);
...@@ -335,7 +335,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ...@@ -335,7 +335,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
// - set the header of the new AMD PDU segment in accordance with the description in sub clause 6.; // - set the header of the new AMD PDU segment in accordance with the description in sub clause 6.;
// - set the P field according to sub clause 5.2.2. // - set the P field according to sub clause 5.2.2.
mem_block_t* mb_original_p = rlc_pP->pdu_retrans_buffer[snP].mem_block; mem_block_t* mb_original_p = rlc_pP->tx_data_pdu_buffer[snP].mem_block;
if (mb_original_p != NULL) { if (mb_original_p != NULL) {
mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req), __func__); mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req), __func__);
...@@ -348,10 +348,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ...@@ -348,10 +348,10 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
((struct mac_tb_req*)(mb_sub_segment_p->data))->data_ptr = (uint8_t*)&(mb_sub_segment_p->data[sizeof(struct mac_tb_req)]); ((struct mac_tb_req*)(mb_sub_segment_p->data))->data_ptr = (uint8_t*)&(mb_sub_segment_p->data[sizeof(struct mac_tb_req)]);
if (rlc_am_get_data_pdu_infos(ctxt_pP, rlc_pP, pdu_original_p, rlc_pP->pdu_retrans_buffer[snP].header_and_payload_size, &pdu_info) >= 0) { if (rlc_am_get_data_pdu_infos(ctxt_pP, rlc_pP, pdu_original_p, rlc_pP->tx_data_pdu_buffer[snP].header_and_payload_size, &pdu_info) >= 0) {
int li_index = 0; int li_index = 0;
int start_offset = rlc_pP->pdu_retrans_buffer[snP].nack_so_start; int start_offset = rlc_pP->tx_data_pdu_buffer[snP].nack_so_start;
int stop_offset = rlc_pP->pdu_retrans_buffer[snP].nack_so_stop; int stop_offset = rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ORIGINAL PDU SN %04d:\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] ORIGINAL PDU SN %04d:\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
...@@ -361,8 +361,8 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ...@@ -361,8 +361,8 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
// all 15 bits set to 1 (indicate that the missing portion of the AMD PDU includes all bytes // all 15 bits set to 1 (indicate that the missing portion of the AMD PDU includes all bytes
// to the last byte of the AMD PDU) // to the last byte of the AMD PDU)
if (stop_offset == 0x7FFF) { if (stop_offset == 0x7FFF) {
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = rlc_pP->pdu_retrans_buffer[snP].payload_size - 1; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1;
stop_offset = rlc_pP->pdu_retrans_buffer[snP].nack_so_stop; stop_offset = rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] UPDATED RETRANS PDU SN %04d nack_so_stop FROM 0x7FFF to %05d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] UPDATED RETRANS PDU SN %04d nack_so_stop FROM 0x7FFF to %05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
...@@ -622,7 +622,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ...@@ -622,7 +622,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
test_pdu_copy_size = max_copy_payload_size; test_pdu_copy_size = max_copy_payload_size;
if ((stop_offset == (start_offset + max_copy_payload_size - 1)) && (stop_offset == rlc_pP->pdu_retrans_buffer[snP].payload_size - 1)) { if ((stop_offset == (start_offset + max_copy_payload_size - 1)) && (stop_offset == rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1)) {
not_test_fi = (not_test_fi & 0x2) | (not_fi_original & 0x1); // set b0 idendical to the b0 of the non segmented PDU not_test_fi = (not_test_fi & 0x2) | (not_fi_original & 0x1); // set b0 idendical to the b0 of the non segmented PDU
} else { } else {
not_test_fi = not_test_fi & 0x2; // clear b0 because no SDU ending in this PDU not_test_fi = not_test_fi & 0x2; // clear b0 because no SDU ending in this PDU
...@@ -630,7 +630,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ...@@ -630,7 +630,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
/*if (stop_offset == (rlc_pP->pdu_retrans_buffer[snP].payload_size - 1)) { /*if (stop_offset == (rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1)) {
test_fi = (test_fi & 0x02) | (fi_original & 0x01); test_fi = (test_fi & 0x02) | (fi_original & 0x01);
}*/ }*/
//--------------------------------------------------------------- //---------------------------------------------------------------
...@@ -687,16 +687,16 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ...@@ -687,16 +687,16 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
// copy payload to retransmit // copy payload to retransmit
//--------------------------------------------------------------- //---------------------------------------------------------------
memcpy(fill_payload_p, memcpy(fill_payload_p,
&rlc_pP->pdu_retrans_buffer[snP].payload[start_offset], &rlc_pP->tx_data_pdu_buffer[snP].payload[start_offset],
test_pdu_copy_size); test_pdu_copy_size);
((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size = (tb_size_t)(((uint64_t)fill_payload_p)+ test_pdu_copy_size) - ((uint64_t)(&pdu_sub_segment_p->b1)); ((struct mac_tb_req*)(mb_sub_segment_p->data))->tb_size = (tb_size_t)(((uint64_t)fill_payload_p)+ test_pdu_copy_size) - ((uint64_t)(&pdu_sub_segment_p->b1));
// set LSF // set LSF
if ((test_pdu_copy_size + start_offset) == rlc_pP->pdu_retrans_buffer[snP].payload_size) { if ((test_pdu_copy_size + start_offset) == rlc_pP->tx_data_pdu_buffer[snP].payload_size) {
pdu_sub_segment_p->data[0] = pdu_sub_segment_p->data[0] | 0x80; pdu_sub_segment_p->data[0] = pdu_sub_segment_p->data[0] | 0x80;
rlc_pP->pdu_retrans_buffer[snP].flags.retransmit = 0; rlc_pP->tx_data_pdu_buffer[snP].flags.retransmit = 0;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d SO %d %d BYTES PAYLOAD %d BYTES LSF!\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d SO %d %d BYTES PAYLOAD %d BYTES LSF!\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
...@@ -723,15 +723,15 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ...@@ -723,15 +723,15 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
// update nack_so_start // update nack_so_start
//--------------------------------------------------------------- //---------------------------------------------------------------
rlc_am_remove_hole(ctxt_pP, rlc_pP, snP, start_offset, test_pdu_copy_size+start_offset - 1); rlc_am_remove_hole(ctxt_pP, rlc_pP, snP, start_offset, test_pdu_copy_size+start_offset - 1);
//rlc_pP->pdu_retrans_buffer[snP].nack_so_start = rlc_pP->pdu_retrans_buffer[snP].nack_so_start + test_pdu_copy_size; //rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = rlc_pP->tx_data_pdu_buffer[snP].nack_so_start + test_pdu_copy_size;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d NOW nack_so_start %d nack_so_stop %d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] RE-SEND DATA PDU SN %04d NOW nack_so_start %d nack_so_stop %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
rlc_pP->pdu_retrans_buffer[snP].nack_so_start, rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop); rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop);
/*if (rlc_pP->pdu_retrans_buffer[snP].nack_so_start == rlc_pP->pdu_retrans_buffer[snP].nack_so_stop) { /*if (rlc_pP->tx_data_pdu_buffer[snP].nack_so_start == rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop) {
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = 0; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
}*/ }*/
} else { } else {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COULD NOT GET INFO FOR DATA PDU SN %04d -> RETURN NULL\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[RE-SEGMENT] COULD NOT GET INFO FOR DATA PDU SN %04d -> RETURN NULL\n",
...@@ -773,25 +773,25 @@ void rlc_am_tx_buffer_display ( ...@@ -773,25 +773,25 @@ void rlc_am_tx_buffer_display (
} }
while (rlc_pP->vt_s != sn) { while (rlc_pP->vt_s != sn) {
if (rlc_pP->pdu_retrans_buffer[sn].mem_block) { if (rlc_pP->tx_data_pdu_buffer[sn].mem_block) {
if ((loop % 1) == 0) { if ((loop % 1) == 0) {
LOG_D(RLC, "\nTX SN:\t"); LOG_D(RLC, "\nTX SN:\t");
} }
if (rlc_pP->pdu_retrans_buffer[sn].flags.retransmit) { if (rlc_pP->tx_data_pdu_buffer[sn].flags.retransmit) {
LOG_D(RLC, "%04d %d/%d Bytes (NACK RTX:%02d ",sn, rlc_pP->pdu_retrans_buffer[sn].header_and_payload_size, rlc_pP->pdu_retrans_buffer[sn].payload_size, LOG_D(RLC, "%04d %d/%d Bytes (NACK RTX:%02d ",sn, rlc_pP->tx_data_pdu_buffer[sn].header_and_payload_size, rlc_pP->tx_data_pdu_buffer[sn].payload_size,
rlc_pP->pdu_retrans_buffer[sn].retx_count); rlc_pP->tx_data_pdu_buffer[sn].retx_count);
} else { } else {
LOG_D(RLC, "%04d %d/%d Bytes (RTX:%02d ",sn, rlc_pP->pdu_retrans_buffer[sn].header_and_payload_size, rlc_pP->pdu_retrans_buffer[sn].payload_size, LOG_D(RLC, "%04d %d/%d Bytes (RTX:%02d ",sn, rlc_pP->tx_data_pdu_buffer[sn].header_and_payload_size, rlc_pP->tx_data_pdu_buffer[sn].payload_size,
rlc_pP->pdu_retrans_buffer[sn].retx_count); rlc_pP->tx_data_pdu_buffer[sn].retx_count);
} }
if (rlc_pP->pdu_retrans_buffer[sn].num_holes == 0) { if (rlc_pP->tx_data_pdu_buffer[sn].num_holes == 0) {
LOG_D(RLC, "SO:%04d->%04d)\t", rlc_pP->pdu_retrans_buffer[sn].nack_so_start, rlc_pP->pdu_retrans_buffer[sn].nack_so_stop); LOG_D(RLC, "SO:%04d->%04d)\t", rlc_pP->tx_data_pdu_buffer[sn].nack_so_start, rlc_pP->tx_data_pdu_buffer[sn].nack_so_stop);
} else { } else {
for (i=0; i<rlc_pP->pdu_retrans_buffer[sn].num_holes; i++) { for (i=0; i<rlc_pP->tx_data_pdu_buffer[sn].num_holes; i++) {
assert(i < RLC_AM_MAX_HOLES_REPORT_PER_PDU); assert(i < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
LOG_D(RLC, "SO:%04d->%04d)\t", rlc_pP->pdu_retrans_buffer[sn].hole_so_start[i], rlc_pP->pdu_retrans_buffer[sn].hole_so_stop[i]); LOG_D(RLC, "SO:%04d->%04d)\t", rlc_pP->tx_data_pdu_buffer[sn].hole_so_start[i], rlc_pP->tx_data_pdu_buffer[sn].hole_so_stop[i]);
} }
} }
...@@ -819,13 +819,13 @@ void rlc_am_retransmit_any_pdu( ...@@ -819,13 +819,13 @@ void rlc_am_retransmit_any_pdu(
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
while (sn != sn_end) { while (sn != sn_end) {
if (rlc_pP->pdu_retrans_buffer[sn].mem_block != NULL) { if (rlc_pP->tx_data_pdu_buffer[sn].mem_block != NULL) {
if (!found_pdu) { if (!found_pdu) {
found_pdu = 1; found_pdu = 1;
found_pdu_sn = sn; found_pdu_sn = sn;
} }
if (rlc_pP->pdu_retrans_buffer[sn].header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) { if (rlc_pP->tx_data_pdu_buffer[sn].header_and_payload_size <= rlc_pP->nb_bytes_requested_by_mac) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] RE-SEND DATA PDU SN %04d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[FORCE-TRAFFIC] RE-SEND DATA PDU SN %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
sn); sn);
...@@ -838,7 +838,7 @@ void rlc_am_retransmit_any_pdu( ...@@ -838,7 +838,7 @@ void rlc_am_retransmit_any_pdu(
// no need for update rlc_pP->nb_bytes_requested_by_mac // no need for update rlc_pP->nb_bytes_requested_by_mac
pdu_p = rlc_am_retransmit_get_copy(ctxt_pP, rlc_pP, sn); pdu_p = rlc_am_retransmit_get_copy(ctxt_pP, rlc_pP, sn);
pdu_sn_10_p = (rlc_am_pdu_sn_10_t*) (&pdu_p->data[sizeof(struct mac_tb_req)]); pdu_sn_10_p = (rlc_am_pdu_sn_10_t*) (&pdu_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->pdu_retrans_buffer[sn].header_and_payload_size,false); rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->tx_data_pdu_buffer[sn].header_and_payload_size,false);
//BugFix: polling is checked and done in function above ! //BugFix: polling is checked and done in function above !
//pdu_sn_10_p->b1 = pdu_sn_10_p->b1 | 0x20; //pdu_sn_10_p->b1 = pdu_sn_10_p->b1 | 0x20;
//BugFix : pdu_without_poll and byte_without_poll are reset only if a Poll is transmitted //BugFix : pdu_without_poll and byte_without_poll are reset only if a Poll is transmitted
...@@ -874,7 +874,7 @@ void rlc_am_retransmit_any_pdu( ...@@ -874,7 +874,7 @@ void rlc_am_retransmit_any_pdu(
rlc_am_nack_pdu (ctxt_pP, rlc_pP, found_pdu_sn, 0, 0x7FFF); rlc_am_nack_pdu (ctxt_pP, rlc_pP, found_pdu_sn, 0, 0x7FFF);
pdu_p = rlc_am_retransmit_get_subsegment(ctxt_pP, rlc_pP, found_pdu_sn, &rlc_pP->nb_bytes_requested_by_mac); pdu_p = rlc_am_retransmit_get_subsegment(ctxt_pP, rlc_pP, found_pdu_sn, &rlc_pP->nb_bytes_requested_by_mac);
pdu_sn_10_p = (rlc_am_pdu_sn_10_t*) (&pdu_p->data[sizeof(struct mac_tb_req)]); pdu_sn_10_p = (rlc_am_pdu_sn_10_t*) (&pdu_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->pdu_retrans_buffer[found_pdu_sn].header_and_payload_size,false); rlc_am_pdu_polling(ctxt_pP, rlc_pP, pdu_sn_10_p, rlc_pP->tx_data_pdu_buffer[found_pdu_sn].header_and_payload_size,false);
pdu_sn_10_p->b1 = pdu_sn_10_p->b1 | 0x20; pdu_sn_10_p->b1 = pdu_sn_10_p->b1 | 0x20;
rlc_pP->c_pdu_without_poll = 0; rlc_pP->c_pdu_without_poll = 0;
rlc_pP->c_byte_without_poll = 0; rlc_pP->c_byte_without_poll = 0;
......
...@@ -223,7 +223,7 @@ void rlc_am_segment_10 ( ...@@ -223,7 +223,7 @@ void rlc_am_segment_10 (
pdu_remaining_size = data_pdu_size - RLC_AM_HEADER_MIN_SIZE; pdu_remaining_size = data_pdu_size - RLC_AM_HEADER_MIN_SIZE;
pdu_p = (rlc_am_pdu_sn_10_t*) (&pdu_mem_p->data[sizeof(struct mac_tb_req)]); pdu_p = (rlc_am_pdu_sn_10_t*) (&pdu_mem_p->data[sizeof(struct mac_tb_req)]);
pdu_tb_req_p = (struct mac_tb_req*) (pdu_mem_p->data); pdu_tb_req_p = (struct mac_tb_req*) (pdu_mem_p->data);
pdu_mngt_p = &rlc_pP->pdu_retrans_buffer[rlc_pP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE]; pdu_mngt_p = &rlc_pP->tx_data_pdu_buffer[rlc_pP->vt_s % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE];
memset(pdu_mngt_p, 0, sizeof (rlc_am_tx_data_pdu_management_t)); memset(pdu_mngt_p, 0, sizeof (rlc_am_tx_data_pdu_management_t));
memset (pdu_mem_p->data, 0, sizeof (rlc_am_pdu_sn_10_t)+sizeof(struct mac_tb_req)); memset (pdu_mem_p->data, 0, sizeof (rlc_am_pdu_sn_10_t)+sizeof(struct mac_tb_req));
...@@ -531,11 +531,10 @@ void rlc_am_segment_10 ( ...@@ -531,11 +531,10 @@ void rlc_am_segment_10 (
pdu_mngt_p->mem_block = pdu_mem_p; pdu_mngt_p->mem_block = pdu_mem_p;
pdu_mngt_p->first_byte = (unsigned char*)pdu_p; pdu_mngt_p->first_byte = (unsigned char*)pdu_p;
pdu_mngt_p->header_and_payload_size = data_pdu_size - pdu_remaining_size; pdu_mngt_p->header_and_payload_size = data_pdu_size - pdu_remaining_size;
pdu_mngt_p->retx_count = -1; pdu_mngt_p->retx_count = 0;
pdu_mngt_p->retx_count_next = 0;
pdu_mngt_p->flags.transmitted = 1; pdu_mngt_p->flags.transmitted = 1;
rlc_pP->retrans_num_pdus += 1;
rlc_pP->retrans_num_bytes += pdu_mngt_p->header_and_payload_size;
pdu_p = NULL; pdu_p = NULL;
pdu_mem_p = NULL; pdu_mem_p = NULL;
......
...@@ -32,7 +32,7 @@ void rlc_am_clear_holes ( ...@@ -32,7 +32,7 @@ void rlc_am_clear_holes (
rlc_am_entity_t *const rlc_pP, rlc_am_entity_t *const rlc_pP,
const rlc_sn_t snP) const rlc_sn_t snP)
{ {
rlc_pP->pdu_retrans_buffer[snP].num_holes = 0; rlc_pP->tx_data_pdu_buffer[snP].num_holes = 0;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_am_shift_down_holes ( void rlc_am_shift_down_holes (
...@@ -43,12 +43,12 @@ void rlc_am_shift_down_holes ( ...@@ -43,12 +43,12 @@ void rlc_am_shift_down_holes (
{ {
int i; int i;
for (i=indexP; i < rlc_pP->pdu_retrans_buffer[snP].num_holes - 1; i++) { for (i=indexP; i < rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1; i++) {
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i+1]; rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i+1];
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i+1]; rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i+1];
} }
rlc_pP->pdu_retrans_buffer[snP].num_holes = rlc_pP->pdu_retrans_buffer[snP].num_holes - 1; rlc_pP->tx_data_pdu_buffer[snP].num_holes = rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_am_shift_up_holes ( void rlc_am_shift_up_holes (
...@@ -60,13 +60,13 @@ void rlc_am_shift_up_holes ( ...@@ -60,13 +60,13 @@ void rlc_am_shift_up_holes (
// shift include indexP // shift include indexP
int i; int i;
for (i=rlc_pP->pdu_retrans_buffer[snP].num_holes; i > indexP; i--) { for (i=rlc_pP->tx_data_pdu_buffer[snP].num_holes; i > indexP; i--) {
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i-1]; rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i-1];
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i-1]; rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i-1];
} }
rlc_pP->pdu_retrans_buffer[snP].num_holes = rlc_pP->pdu_retrans_buffer[snP].num_holes + 1; rlc_pP->tx_data_pdu_buffer[snP].num_holes = rlc_pP->tx_data_pdu_buffer[snP].num_holes + 1;
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU); assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_am_remove_hole ( void rlc_am_remove_hole (
...@@ -79,81 +79,81 @@ void rlc_am_remove_hole ( ...@@ -79,81 +79,81 @@ void rlc_am_remove_hole (
int i; int i;
#if TRACE_RLC_AM_HOLE #if TRACE_RLC_AM_HOLE
LOG_D(RLC, LOG_D(RLC,
PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d so_startP %05d so_stopP %05d rlc_pP->pdu_retrans_buffer[snP].nack_so_start %05d rlc_pP->pdu_retrans_buffer[snP].nack_so_stop %05d\n", PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d so_startP %05d so_stopP %05d rlc_pP->tx_data_pdu_buffer[snP].nack_so_start %05d rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop %05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
so_startP, so_startP,
so_stopP, so_stopP,
rlc_pP->pdu_retrans_buffer[snP].nack_so_start, rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop); rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop);
#endif #endif
assert(so_startP <= so_stopP); assert(so_startP <= so_stopP);
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) { if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
assert(so_startP == rlc_pP->pdu_retrans_buffer[snP].nack_so_start); assert(so_startP == rlc_pP->tx_data_pdu_buffer[snP].nack_so_start);
assert(so_stopP <= rlc_pP->pdu_retrans_buffer[snP].nack_so_stop); assert(so_stopP <= rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop);
#if TRACE_RLC_AM_HOLE #if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d MODIFIED nack_so_start %05d->%05d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d MODIFIED nack_so_start %05d->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
rlc_pP->pdu_retrans_buffer[snP].nack_so_start, rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
so_stopP+1); so_stopP+1);
#endif #endif
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = so_stopP+1; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_stopP+1;
if (rlc_pP->pdu_retrans_buffer[snP].nack_so_start >= rlc_pP->pdu_retrans_buffer[snP].nack_so_stop) { if (rlc_pP->tx_data_pdu_buffer[snP].nack_so_start >= rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop) {
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = 0; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
} }
} else { } else {
// normally should be removed in increasing order... // normally should be removed in increasing order...
for (i = 0; i < rlc_pP->pdu_retrans_buffer[snP].num_holes; i++) { for (i = 0; i < rlc_pP->tx_data_pdu_buffer[snP].num_holes; i++) {
if (so_startP <= rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i]) { if (so_startP <= rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i]) {
if (so_stopP >= rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]) { if (so_stopP >= rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i]) {
rlc_am_shift_down_holes(ctxt_pP, rlc_pP, snP, i); rlc_am_shift_down_holes(ctxt_pP, rlc_pP, snP, i);
i = i - 1; i = i - 1;
} else { } else {
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i] = so_stopP; rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = so_stopP;
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) { if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = 0; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
} else { } else {
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[0]; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0];
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[rlc_pP->pdu_retrans_buffer[snP].num_holes - 1]; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1];
} }
#if TRACE_RLC_AM_HOLE #if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
rlc_pP->pdu_retrans_buffer[snP].nack_so_start, rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop, rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop,
rlc_pP->pdu_retrans_buffer[snP].num_holes); rlc_pP->tx_data_pdu_buffer[snP].num_holes);
#endif #endif
return; return;
} }
} else if (so_startP > rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i]) { } else if (so_startP > rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i]) {
if (so_startP <= rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]) { if (so_startP <= rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i]) {
if (so_stopP < rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]) { if (so_stopP < rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i]) {
// BAD CASE: 1 HOLE IS SPLITTED IN 2 HOLES // BAD CASE: 1 HOLE IS SPLITTED IN 2 HOLES
rlc_am_shift_up_holes(ctxt_pP, rlc_pP, snP, i+1); rlc_am_shift_up_holes(ctxt_pP, rlc_pP, snP, i+1);
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i+1] = so_startP+1; rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i+1] = so_startP+1;
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i+1] = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i]; rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i+1] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i];
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = so_startP - 1; rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = so_startP - 1;
} else { } else {
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = so_startP; rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = so_startP;
} }
} }
} }
} }
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) { if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = 0; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = 0;
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = 0x7FFF; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = 0x7FFF;
} else { } else {
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[0]; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0];
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[rlc_pP->pdu_retrans_buffer[snP].num_holes - 1]; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[rlc_pP->tx_data_pdu_buffer[snP].num_holes - 1];
} }
} }
...@@ -161,11 +161,11 @@ void rlc_am_remove_hole ( ...@@ -161,11 +161,11 @@ void rlc_am_remove_hole (
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] REMOVE HOLE SN %04d NOW nack_so_start %05d nack_so_stop %05d num holes %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
rlc_pP->pdu_retrans_buffer[snP].nack_so_start, rlc_pP->tx_data_pdu_buffer[snP].nack_so_start,
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop, rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop,
rlc_pP->pdu_retrans_buffer[snP].num_holes); rlc_pP->tx_data_pdu_buffer[snP].num_holes);
#endif #endif
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size); assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void rlc_am_get_next_hole ( void rlc_am_get_next_hole (
...@@ -175,9 +175,9 @@ void rlc_am_get_next_hole ( ...@@ -175,9 +175,9 @@ void rlc_am_get_next_hole (
sdu_size_t* const so_startP, sdu_size_t* const so_startP,
sdu_size_t* const so_stopP) sdu_size_t* const so_stopP)
{ {
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) { if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
*so_startP = rlc_pP->pdu_retrans_buffer[snP].nack_so_start; *so_startP = rlc_pP->tx_data_pdu_buffer[snP].nack_so_start;
*so_stopP = rlc_pP->pdu_retrans_buffer[snP].nack_so_stop; *so_stopP = rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop;
#if TRACE_RLC_AM_HOLE #if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == 0)\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == 0)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
...@@ -186,15 +186,15 @@ void rlc_am_get_next_hole ( ...@@ -186,15 +186,15 @@ void rlc_am_get_next_hole (
*so_stopP); *so_stopP);
#endif #endif
} else { } else {
*so_startP = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[0]; *so_startP = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0];
*so_stopP = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[0]; *so_stopP = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[0];
#if TRACE_RLC_AM_HOLE #if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == %d)\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] rlc_am_get_next_hole(SN %04d) %05d->%05d (NUM HOLES == %d)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
*so_startP, *so_startP,
*so_stopP, *so_stopP,
rlc_pP->pdu_retrans_buffer[snP].num_holes); rlc_pP->tx_data_pdu_buffer[snP].num_holes);
#endif #endif
} }
} }
...@@ -214,33 +214,33 @@ void rlc_am_add_hole ( ...@@ -214,33 +214,33 @@ void rlc_am_add_hole (
// if global NACK // if global NACK
if ((so_startP == 0) && ((so_stopP == 0x7FFF) || (so_stopP == rlc_pP->pdu_retrans_buffer[snP].payload_size - 1))) { if ((so_startP == 0) && ((so_stopP == 0x7FFF) || (so_stopP == rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1))) {
rlc_pP->pdu_retrans_buffer[snP].num_holes = 0; rlc_pP->tx_data_pdu_buffer[snP].num_holes = 0;
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = so_startP; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_startP;
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = so_stopP;
#if TRACE_RLC_AM_HOLE #if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] SN %04d GLOBAL NACK 0->%05d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] SN %04d GLOBAL NACK 0->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
snP, snP,
so_stopP); so_stopP);
#endif #endif
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size); assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
return; return;
} }
if (so_stopP == 0x7FFF) { if (so_stopP == 0x7FFF) {
so_stopP = rlc_pP->pdu_retrans_buffer[snP].payload_size - 1; so_stopP = rlc_pP->tx_data_pdu_buffer[snP].payload_size - 1;
} }
// first hole // first hole
if (rlc_pP->pdu_retrans_buffer[snP].num_holes == 0) { if (rlc_pP->tx_data_pdu_buffer[snP].num_holes == 0) {
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[0] = so_startP; rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[0] = so_startP;
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop [0] = so_stopP; rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop [0] = so_stopP;
rlc_pP->pdu_retrans_buffer[snP].num_holes = 1; rlc_pP->tx_data_pdu_buffer[snP].num_holes = 1;
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = so_startP; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_startP;
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = so_stopP;
#if TRACE_RLC_AM_HOLE #if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] FIRST HOLE SN %04d GLOBAL NACK %05d->%05d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] FIRST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
...@@ -248,44 +248,44 @@ void rlc_am_add_hole ( ...@@ -248,44 +248,44 @@ void rlc_am_add_hole (
so_startP, so_startP,
so_stopP); so_stopP);
#endif #endif
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size); assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
return; return;
} }
hole_index = 0; hole_index = 0;
while (hole_index < rlc_pP->pdu_retrans_buffer[snP].num_holes) { while (hole_index < rlc_pP->tx_data_pdu_buffer[snP].num_holes) {
if (so_stopP < rlc_pP->pdu_retrans_buffer[snP].hole_so_start[hole_index]) { if (so_stopP < rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[hole_index]) {
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU); assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
if (hole_index > 0) { if (hole_index > 0) {
assert(so_startP > rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[hole_index-1]); assert(so_startP > rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index-1]);
} }
for (i=rlc_pP->pdu_retrans_buffer[snP].num_holes; i >= hole_index; i--) { for (i=rlc_pP->tx_data_pdu_buffer[snP].num_holes; i >= hole_index; i--) {
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_start[i-1]; rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[i-1];
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i] = rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[i-1]; rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i] = rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[i-1];
} }
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[hole_index] = so_startP; rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[hole_index] = so_startP;
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[hole_index] = so_stopP; rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index] = so_stopP;
// update nack "window" vars nack_so_start, nack_so_stop // update nack "window" vars nack_so_start, nack_so_stop
if (hole_index == 0) { if (hole_index == 0) {
rlc_pP->pdu_retrans_buffer[snP].nack_so_start = so_startP; rlc_pP->tx_data_pdu_buffer[snP].nack_so_start = so_startP;
} }
rlc_pP->pdu_retrans_buffer[snP].num_holes += 1; rlc_pP->tx_data_pdu_buffer[snP].num_holes += 1;
#if TRACE_RLC_AM_HOLE #if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] INSERT %d th HOLE SN %04d GLOBAL NACK %05d->%05d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] INSERT %d th HOLE SN %04d GLOBAL NACK %05d->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->pdu_retrans_buffer[snP].num_holes, rlc_pP->tx_data_pdu_buffer[snP].num_holes,
snP, snP,
so_startP, so_startP,
so_stopP); so_stopP);
#endif #endif
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size); assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU); assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
return; return;
} }
...@@ -293,17 +293,17 @@ void rlc_am_add_hole ( ...@@ -293,17 +293,17 @@ void rlc_am_add_hole (
} }
// if here insert to the "tail" // if here insert to the "tail"
if (so_startP > rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[hole_index - 1]) { if (so_startP > rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index - 1]) {
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU); assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
rlc_pP->pdu_retrans_buffer[snP].hole_so_start[hole_index] = so_startP; rlc_pP->tx_data_pdu_buffer[snP].hole_so_start[hole_index] = so_startP;
rlc_pP->pdu_retrans_buffer[snP].hole_so_stop[hole_index] = so_stopP; rlc_pP->tx_data_pdu_buffer[snP].hole_so_stop[hole_index] = so_stopP;
rlc_pP->pdu_retrans_buffer[snP].num_holes += 1; rlc_pP->tx_data_pdu_buffer[snP].num_holes += 1;
// update nack "window" vars nack_so_start, nack_so_stop // update nack "window" vars nack_so_start, nack_so_stop
rlc_pP->pdu_retrans_buffer[snP].nack_so_stop = so_stopP; rlc_pP->tx_data_pdu_buffer[snP].nack_so_stop = so_stopP;
#if TRACE_RLC_AM_HOLE #if TRACE_RLC_AM_HOLE
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] INSERT THE %d th LAST HOLE SN %04d GLOBAL NACK %05d->%05d\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[HOLE] INSERT THE %d th LAST HOLE SN %04d GLOBAL NACK %05d->%05d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->pdu_retrans_buffer[snP].num_holes, rlc_pP->tx_data_pdu_buffer[snP].num_holes,
snP, snP,
so_startP, so_startP,
so_stopP); so_stopP);
...@@ -312,6 +312,6 @@ void rlc_am_add_hole ( ...@@ -312,6 +312,6 @@ void rlc_am_add_hole (
assert(1==2); assert(1==2);
} }
assert(rlc_pP->pdu_retrans_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU); assert(rlc_pP->tx_data_pdu_buffer[snP].num_holes < RLC_AM_MAX_HOLES_REPORT_PER_PDU);
assert(rlc_pP->pdu_retrans_buffer[snP].nack_so_start < rlc_pP->pdu_retrans_buffer[snP].payload_size); assert(rlc_pP->tx_data_pdu_buffer[snP].nack_so_start < rlc_pP->tx_data_pdu_buffer[snP].payload_size);
} }
...@@ -117,8 +117,8 @@ typedef struct rlc_am_tx_data_pdu_management { ...@@ -117,8 +117,8 @@ typedef struct rlc_am_tx_data_pdu_management {
sdu_size_t nack_so_stop; /*!< \brief Highest NACK stop segment offset, must be set to data_size if global NACK */ sdu_size_t nack_so_stop; /*!< \brief Highest NACK stop segment offset, must be set to data_size if global NACK */
int8_t nb_sdus; /*!< \brief Number of sdu having segments in this pdu. */ int8_t nb_sdus; /*!< \brief Number of sdu having segments in this pdu. */
int8_t int8_t retx_count; /*!< \brief Counts the number of already occurred retransmissions of an AMD PDU (see subclause 5.2.1). */
retx_count; /*!< \brief Counts the number of retransmissions of an AMD PDU (see subclause 5.2.1). There is one RETX_COUNT counter per PDU that needs to be retransmitted. there is one VT(DAT) for each PDU and it is incremented each time the PDU is transmitted. */ int8_t retx_count_next; /*!< \brief Counts the number of already occurred retransmissions plus the latest pending one. */
pdu_management_flags_t flags; /*!< \brief PDU variables related to its retransmission. */ pdu_management_flags_t flags; /*!< \brief PDU variables related to its retransmission. */
} rlc_am_tx_data_pdu_management_t; } rlc_am_tx_data_pdu_management_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment