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 (
(rlc_pP->first_retrans_pdu_sn >= 0) &&
(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)
&& (tx_data_pdu_management->nack_so_start == 0) && (tx_data_pdu_management->nack_so_stop == 0x7FFF)) {
......@@ -500,7 +500,7 @@ rlc_am_get_pdus (
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;
tx_data_pdu_management->retx_count += 1;
tx_data_pdu_management->retx_count = tx_data_pdu_management->retx_count_next;
return;
} 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",
......@@ -535,7 +535,7 @@ rlc_am_get_pdus (
// update first_retrans_pdu_sn
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;
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),
......@@ -706,22 +706,23 @@ rlc_am_mac_status_indication (
// force BO to be > 0
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;
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) {
if (rlc->pdu_retrans_buffer[sn].mem_block != NULL) {
if (!found_pdu) {
found_pdu = 1;
found_pdu_sn = sn;
}
status_resp.buffer_occupancy_in_bytes = rlc->pdu_retrans_buffer[sn].header_and_payload_size;
status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
status_resp.head_sdu_remaining_size_to_send = status_resp.buffer_occupancy_in_bytes;
// TODO head_sdu_is_segmented
break;
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",
sn, rlc->vt_a,rlc->vt_s,rlc->channel_id);
if ((rlc->tx_data_pdu_buffer[sn].flags.ack == 0) && (rlc->tx_data_pdu_buffer[sn].flags.max_retransmit == 0)) {
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->tx_data_pdu_buffer[sn].header_and_payload_size;
status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
status_resp.head_sdu_remaining_size_to_send = status_resp.buffer_occupancy_in_bytes;
// TODO head_sdu_is_segmented
break;
}
else
{
sn = RLC_AM_PREV_SN(sn);
}
}
}
......
......@@ -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. */
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_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. */
boolean_t force_poll; /*!< \brief force poll due to t_poll_retransmit time-out. */
......
......@@ -51,16 +51,16 @@ rlc_am_init(
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));
//#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->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, (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, (uint32_t)((unsigned int)RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE*(unsigned int)sizeof(
rlc_am_tx_data_pdu_management_t)));
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),
rlc_pP->input_sdus,
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),
rlc_pP->pdu_retrans_buffer,
rlc_pP->tx_data_pdu_buffer,
sizeof(rlc_am_tx_data_pdu_management_t));
// TX state variables
......@@ -175,16 +175,16 @@ rlc_am_cleanup(
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++) {
if (rlc_pP->pdu_retrans_buffer[i].mem_block != NULL) {
free_mem_block(rlc_pP->pdu_retrans_buffer[i].mem_block, __func__);
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->tx_data_pdu_buffer[i].mem_block, __func__);
rlc_pP->tx_data_pdu_buffer[i].mem_block = NULL;
}
}
free(rlc_pP->pdu_retrans_buffer);
rlc_pP->pdu_retrans_buffer = NULL;
free(rlc_pP->tx_data_pdu_buffer);
rlc_pP->tx_data_pdu_buffer = NULL;
}
memset(rlc_pP, 0, sizeof(rlc_am_entity_t));
......
......@@ -223,7 +223,7 @@ void rlc_am_segment_10 (
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_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_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 (
pdu_mngt_p->mem_block = pdu_mem_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->retx_count = -1;
pdu_mngt_p->retx_count = 0;
pdu_mngt_p->retx_count_next = 0;
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_mem_p = NULL;
......
......@@ -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 */
int8_t nb_sdus; /*!< \brief Number of sdu having segments in this pdu. */
int8_t
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; /*!< \brief Counts the number of already occurred retransmissions of an AMD PDU (see subclause 5.2.1). */
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. */
} 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