diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index fecedc98ed..b370122120 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -449,7 +449,7 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP status_resp.rlc_info.rlc_protocol_state = ((rlc_um_entity_t *) rlc_pP)->protocol_state; #ifdef DEBUG_RLC_UM_TX_STATUS if ((((rlc_um_entity_t *) rlc_pP)->rb_id > 0) && (status_resp.buffer_occupancy_in_bytes > 0)) { - LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n", + LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_STATUS_INDICATION (DATA) %d bytes requested -> %d bytes available\n", frameP, (rlc_p->is_enb) ? "eNB" : "UE", rlc_p->enb_module_id, @@ -479,7 +479,7 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP } #endif } else { - LOG_E(RLC, "[RLC] RLCp not defined!!!\n"); + LOG_E(RLC, "[RLC] rlc_um_mac_status_indication RLC NULL!!!\n"); } return status_resp; } @@ -709,7 +709,9 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) LOG_T(RLC, "%s", message_string); #endif # endif + pthread_mutex_lock(&rlc_p->lock_input_sdus); list_add_tail_eurecom(sdu_pP, &rlc_p->input_sdus); + pthread_mutex_unlock(&rlc_p->lock_input_sdus); /*} else { LOG_W(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] RLC-UM_DATA_REQ input buffer full SDU garbaged\n", diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c index 953c225b05..63ecce9b5a 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c @@ -240,6 +240,7 @@ rlc_um_init (rlc_um_entity_t * const rlc_pP) memset (rlc_pP, 0, sizeof (rlc_um_entity_t)); // TX SIDE list_init (&rlc_pP->pdus_to_mac_layer, NULL); + pthread_mutex_init(&rlc_pP->lock_input_sdus, NULL); list_init (&rlc_pP->input_sdus, NULL); rlc_pP->protocol_state = RLC_NULL_STATE; @@ -291,6 +292,7 @@ rlc_um_cleanup (rlc_um_entity_t * const rlc_pP) int index; // TX SIDE list_free (&rlc_pP->pdus_to_mac_layer); + pthread_mutex_destroy(&rlc_pP->lock_input_sdus); list_free (&rlc_pP->input_sdus); // RX SIDE diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h index c0c509fa64..b890822166 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_entity.h @@ -38,6 +38,7 @@ # ifndef __RLC_UM_ENTITY_H__ # define __RLC_UM_ENTITY_H__ +# include # include "platform_types.h" # include "platform_constants.h" # include "list.h" @@ -93,6 +94,8 @@ typedef struct rlc_um_entity_s { // tranmission //----------------------------- // sdu communication; + //pthread_spinlock_t lock_input_sdus; + pthread_mutex_t lock_input_sdus; list_t input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). Should be accessed as an array. */ 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. */ diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c index 2ff96d0fea..7d09a6c14a 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c @@ -99,6 +99,8 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) list_init (&pdus, NULL); // param string identifying the list is NULL pdu_mem_p = NULL; + // not fine locking + pthread_mutex_lock(&rlc_pP->lock_input_sdus); while ((list_get_head(&rlc_pP->input_sdus)) && (nb_bytes_to_transmit > 0)) { #if defined(TRACE_RLC_UM_SEGMENT) @@ -150,6 +152,7 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) rlc_pP->ue_module_id, rlc_pP->rb_id); #endif + pthread_mutex_unlock(&rlc_pP->lock_input_sdus); return; } #if defined(TRACE_RLC_UM_SEGMENT) @@ -483,6 +486,7 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) //nb_bytes_to_transmit = nb_bytes_to_transmit - data_pdu_size; nb_bytes_to_transmit = 0; // 1 PDU only } + pthread_mutex_unlock(&rlc_pP->lock_input_sdus); } //----------------------------------------------------------------------------- void @@ -540,6 +544,7 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) list_init (&pdus, NULL); // param string identifying the list is NULL pdu_mem_p = NULL; + pthread_mutex_lock(&rlc_pP->lock_input_sdus); while ((list_get_head(&rlc_pP->input_sdus)) && (nb_bytes_to_transmit > 0)) { #if defined(TRACE_RLC_UM_SEGMENT) LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT5 nb_bytes_to_transmit %d BO %d\n", @@ -590,6 +595,7 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) rlc_pP->ue_module_id, rlc_pP->rb_id); #endif + pthread_mutex_unlock(&rlc_pP->lock_input_sdus); return; } #if defined(TRACE_RLC_UM_SEGMENT) @@ -919,5 +925,6 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) //nb_bytes_to_transmit = nb_bytes_to_transmit - data_pdu_size; nb_bytes_to_transmit = 0; // 1 PDU only } + pthread_mutex_unlock(&rlc_pP->lock_input_sdus); }