Commit f747a4da authored by Lionel Gauthier's avatar Lionel Gauthier

No ring buffer for input SDUs but list ('infinite' capacity), may have...

No ring buffer for input SDUs but list ('infinite' capacity), may have corrected also concurrency problems (sdu mngt pointer)

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6044 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 2ba14ef2
...@@ -406,6 +406,7 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP ...@@ -406,6 +406,7 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP
uint16_t sdu_remaining_size = 0; uint16_t sdu_remaining_size = 0;
int32_t diff_time=0; int32_t diff_time=0;
rlc_um_entity_t *rlc_p = NULL; rlc_um_entity_t *rlc_p = NULL;
mem_block_t *mb_p = NULL;
status_resp.buffer_occupancy_in_pdus = 0; status_resp.buffer_occupancy_in_pdus = 0;
status_resp.buffer_occupancy_in_bytes = 0; status_resp.buffer_occupancy_in_bytes = 0;
...@@ -421,25 +422,25 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP ...@@ -421,25 +422,25 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP
rlc_p->nb_bytes_requested_by_mac = tbs_sizeP; rlc_p->nb_bytes_requested_by_mac = tbs_sizeP;
status_resp.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (rlc_p); status_resp.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (rlc_p);
if (status_resp.buffer_occupancy_in_bytes > 0) { if ((status_resp.buffer_occupancy_in_bytes > 0) && ((mb_p = list_get_head(&rlc_p->input_sdus)) != NULL)) {
status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes; status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes;
status_resp.buffer_occupancy_in_pdus = rlc_p->nb_sdu; status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements;
diff_time = frameP - ((struct rlc_um_tx_sdu_management *) (rlc_p->input_sdus[rlc_p->current_sdu_index])->data)->sdu_creation_time; diff_time = frameP - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time;
status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + frameP) ; status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + frameP) ;
//msg("rlc_p status for frameP %d diff time %d resp %d\n", frameP, diff_time,status_resp.head_sdu_creation_time) ; //msg("rlc_p status for frameP %d diff time %d resp %d\n", frameP, diff_time,status_resp.head_sdu_creation_time) ;
sdu_size = ((struct rlc_um_tx_sdu_management *) (rlc_p->input_sdus[rlc_p->current_sdu_index])->data)->sdu_size; sdu_size = ((struct rlc_um_tx_sdu_management *) mb_p->data)->sdu_size;
sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) (rlc_p->input_sdus[rlc_p->current_sdu_index])->data)->sdu_remaining_size; sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) mb_p->data)->sdu_remaining_size;
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size; status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
if (sdu_size == sdu_remaining_size) { if (sdu_size == sdu_remaining_size) {
status_resp.head_sdu_is_segmented = 0; status_resp.head_sdu_is_segmented = 0;
} }
else { else {
status_resp.head_sdu_is_segmented = 1; status_resp.head_sdu_is_segmented = 1;
} }
} else { } else {
} }
...@@ -624,7 +625,7 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) ...@@ -624,7 +625,7 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP)
uint16_t data_size; uint16_t data_size;
#endif #endif
LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] RLC_UM_DATA_REQ size %d Bytes, BO %d , NB SDU %d current_sdu_index=%d next_sdu_index=%d\n", LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] RLC_UM_DATA_REQ size %d Bytes, BO %d , NB SDU %d\n",
frameP, frameP,
(rlc_p->is_enb) ? "eNB" : "UE", (rlc_p->is_enb) ? "eNB" : "UE",
rlc_p->enb_module_id, rlc_p->enb_module_id,
...@@ -632,13 +633,12 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) ...@@ -632,13 +633,12 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP)
rlc_p->rb_id, rlc_p->rb_id,
((struct rlc_um_data_req *) (sdu_pP->data))->data_size, ((struct rlc_um_data_req *) (sdu_pP->data))->data_size,
rlc_p->buffer_occupancy, rlc_p->buffer_occupancy,
rlc_p->nb_sdu, rlc_p->input_sdus.nb_elements);
rlc_p->current_sdu_index,
rlc_p->next_sdu_index); /*rlc_util_print_hex_octets(
rlc_util_print_hex_octets(
RLC, RLC,
(uint8_t*)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)], (uint8_t*)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)],
((struct rlc_um_data_req *) (sdu_pP->data))->data_size); ((struct rlc_um_data_req *) (sdu_pP->data))->data_size);*/
/*#ifndef USER_MODE /*#ifndef USER_MODE
rlc_um_time_us = (unsigned long int)(rt_get_time_ns ()/(RTIME)1000); rlc_um_time_us = (unsigned long int)(rt_get_time_ns ()/(RTIME)1000);
...@@ -648,18 +648,17 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) ...@@ -648,18 +648,17 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP)
usec = rlc_um_time_us % 1000000; usec = rlc_um_time_us % 1000000;
msg ("[RLC_UM_LITE][RB %d] at time %2d:%2d.%6d\n", rlc_p->rb_id, min, sec , usec); msg ("[RLC_UM_LITE][RB %d] at time %2d:%2d.%6d\n", rlc_p->rb_id, min, sec , usec);
#endif*/ #endif*/
if (rlc_p->input_sdus[rlc_p->next_sdu_index] == NULL) {
rlc_p->input_sdus[rlc_p->next_sdu_index] = sdu_pP;
// IMPORTANT : do not change order of affectations // IMPORTANT : do not change order of affectations
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size = ((struct rlc_um_data_req *) (sdu_pP->data))->data_size; ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size = ((struct rlc_um_data_req *) (sdu_pP->data))->data_size;
rlc_p->buffer_occupancy += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size; rlc_p->buffer_occupancy += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
rlc_p->nb_sdu += 1; //rlc_p->nb_sdu += 1;
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->first_byte = (uint8_t*)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)]; ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->first_byte = (uint8_t*)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)];
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_remaining_size = ((struct rlc_um_tx_sdu_management *)
(sdu_pP->data))->sdu_size; (sdu_pP->data))->sdu_size;
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_segmented_size = 0; ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_segmented_size = 0;
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_creation_time = frameP; ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_creation_time = frameP;
rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer; //rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer;
rlc_p->stat_tx_pdcp_sdu += 1; rlc_p->stat_tx_pdcp_sdu += 1;
rlc_p->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size; rlc_p->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
...@@ -710,8 +709,9 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) ...@@ -710,8 +709,9 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP)
LOG_T(RLC, "%s", message_string); LOG_T(RLC, "%s", message_string);
#endif #endif
# endif # endif
list_add_tail_eurecom(sdu_pP, &rlc_p->input_sdus);
} else { /*} else {
LOG_W(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] RLC-UM_DATA_REQ input buffer full SDU garbaged\n", LOG_W(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] RLC-UM_DATA_REQ input buffer full SDU garbaged\n",
frameP, frameP,
(rlc_p->is_enb) ? "eNB" : "UE", (rlc_p->is_enb) ? "eNB" : "UE",
...@@ -731,5 +731,5 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) ...@@ -731,5 +731,5 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP)
rlc_p->ue_module_id, rlc_p->ue_module_id,
rlc_p->rb_id); rlc_p->rb_id);
#endif #endif
} }*/
} }
...@@ -240,6 +240,7 @@ rlc_um_init (rlc_um_entity_t * const rlc_pP) ...@@ -240,6 +240,7 @@ rlc_um_init (rlc_um_entity_t * const rlc_pP)
memset (rlc_pP, 0, sizeof (rlc_um_entity_t)); memset (rlc_pP, 0, sizeof (rlc_um_entity_t));
// TX SIDE // TX SIDE
list_init (&rlc_pP->pdus_to_mac_layer, NULL); list_init (&rlc_pP->pdus_to_mac_layer, NULL);
list_init (&rlc_pP->input_sdus, NULL);
rlc_pP->protocol_state = RLC_NULL_STATE; rlc_pP->protocol_state = RLC_NULL_STATE;
//rlc_pP->nb_sdu = 0; //rlc_pP->nb_sdu = 0;
...@@ -262,15 +263,15 @@ rlc_um_init (rlc_um_entity_t * const rlc_pP) ...@@ -262,15 +263,15 @@ rlc_um_init (rlc_um_entity_t * const rlc_pP)
rlc_pP->tx_header_min_length_in_bytes = 2; rlc_pP->tx_header_min_length_in_bytes = 2;
// SPARE : not 3GPP // SPARE : not 3GPP
#ifdef JUMBO_FRAME /*#ifdef JUMBO_FRAME
rlc_pP->size_input_sdus_buffer =1024; rlc_pP->size_input_sdus_buffer =1024;
#else #else
rlc_pP->size_input_sdus_buffer =128; rlc_pP->size_input_sdus_buffer =128;
#endif #endif*/
if ((rlc_pP->input_sdus == NULL) && (rlc_pP->size_input_sdus_buffer > 0)) { /*if ((rlc_pP->input_sdus == NULL) && (rlc_pP->size_input_sdus_buffer > 0)) {
rlc_pP->input_sdus = calloc(1 , rlc_pP->size_input_sdus_buffer * sizeof (void *)); rlc_pP->input_sdus = calloc(1 , rlc_pP->size_input_sdus_buffer * sizeof (void *));
} }*/
if (rlc_pP->dar_buffer == NULL) { if (rlc_pP->dar_buffer == NULL) {
rlc_pP->dar_buffer = calloc (1, 1024 * sizeof (void *)); rlc_pP->dar_buffer = calloc (1, 1024 * sizeof (void *));
} }
...@@ -285,9 +286,9 @@ rlc_um_reset_state_variables (rlc_um_entity_t * const rlc_pP) ...@@ -285,9 +286,9 @@ rlc_um_reset_state_variables (rlc_um_entity_t * const rlc_pP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
rlc_pP->buffer_occupancy = 0; rlc_pP->buffer_occupancy = 0;
rlc_pP->nb_sdu = 0; //rlc_pP->nb_sdu = 0;
rlc_pP->next_sdu_index = 0; //rlc_pP->next_sdu_index = 0;
rlc_pP->current_sdu_index = 0; //rlc_pP->current_sdu_index = 0;
// TX SIDE // TX SIDE
rlc_pP->vt_us = 0; rlc_pP->vt_us = 0;
...@@ -304,8 +305,9 @@ rlc_um_cleanup (rlc_um_entity_t * const rlc_pP) ...@@ -304,8 +305,9 @@ rlc_um_cleanup (rlc_um_entity_t * const rlc_pP)
int index; int index;
// TX SIDE // TX SIDE
list_free (&rlc_pP->pdus_to_mac_layer); list_free (&rlc_pP->pdus_to_mac_layer);
list_free (&rlc_pP->input_sdus);
if (rlc_pP->input_sdus) { /*if (rlc_pP->input_sdus) {
for (index = 0; index < rlc_pP->size_input_sdus_buffer; index++) { for (index = 0; index < rlc_pP->size_input_sdus_buffer; index++) {
if (rlc_pP->input_sdus[index]) { if (rlc_pP->input_sdus[index]) {
free_mem_block (rlc_pP->input_sdus[index]); free_mem_block (rlc_pP->input_sdus[index]);
...@@ -313,7 +315,7 @@ rlc_um_cleanup (rlc_um_entity_t * const rlc_pP) ...@@ -313,7 +315,7 @@ rlc_um_cleanup (rlc_um_entity_t * const rlc_pP)
} }
free (rlc_pP->input_sdus); free (rlc_pP->input_sdus);
rlc_pP->input_sdus = NULL; rlc_pP->input_sdus = NULL;
} }*/
// RX SIDE // RX SIDE
list_free (&rlc_pP->pdus_from_mac_layer); list_free (&rlc_pP->pdus_from_mac_layer);
if ((rlc_pP->output_sdu_in_construction)) { if ((rlc_pP->output_sdu_in_construction)) {
......
...@@ -93,11 +93,12 @@ typedef struct rlc_um_entity_s { ...@@ -93,11 +93,12 @@ typedef struct rlc_um_entity_s {
// tranmission // tranmission
//----------------------------- //-----------------------------
// sdu communication; // sdu communication;
mem_block_t **input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). Should be accessed as an array. */ list_t input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). Should be accessed as an array. */
uint16_t size_input_sdus_buffer; /*!< \brief Size of the input SDU buffer. */ //mem_block_t **input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). Should be accessed as an array. */
uint16_t nb_sdu; /*!< \brief Total number of SDUs in input_sdus[] */ //uint16_t size_input_sdus_buffer; /*!< \brief Size of the input SDU buffer. */
uint16_t next_sdu_index; /*!< \brief Next SDU index for a new incomin SDU in input_sdus[]. */ //uint16_t nb_sdu; /*!< \brief Total number of SDUs in input_sdus[] */
uint16_t current_sdu_index; /*!< \brief Current SDU index in input_sdus array to be segmented. */ //uint16_t next_sdu_index; /*!< \brief Next SDU index for a new incomin SDU in input_sdus[]. */
//uint16_t current_sdu_index; /*!< \brief Current SDU index in input_sdus array to be segmented. */
rlc_buffer_occupancy_t buffer_occupancy; /*!< \brief Number of bytes contained in input_sdus buffer.*/ rlc_buffer_occupancy_t buffer_occupancy; /*!< \brief Number of bytes contained in input_sdus buffer.*/
uint32_t nb_bytes_requested_by_mac; /*!< \brief Number of bytes requested by lower layer for next transmission. */ uint32_t nb_bytes_requested_by_mac; /*!< \brief Number of bytes requested by lower layer for next transmission. */
list_t pdus_to_mac_layer; /*!< \brief PDUs buffered for transmission to MAC layer. */ list_t pdus_to_mac_layer; /*!< \brief PDUs buffered for transmission to MAC layer. */
......
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