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 63ecce9b5ae19a6bee1a6bd289fe686d44878b93..f82c991e481b2881323d25489a38b6a759cda288 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 @@ -260,7 +260,7 @@ rlc_um_init (rlc_um_entity_t * const rlc_pP) rlc_pP->tx_sn_length = 10; rlc_pP->tx_header_min_length_in_bytes = 2; - + pthread_mutex_init(&rlc_pP->lock_dar_buffer, NULL); if (rlc_pP->dar_buffer == NULL) { rlc_pP->dar_buffer = calloc (1, 1024 * sizeof (void *)); } @@ -309,6 +309,7 @@ rlc_um_cleanup (rlc_um_entity_t * const rlc_pP) free (rlc_pP->dar_buffer); rlc_pP->dar_buffer = NULL; } + pthread_mutex_destroy(&rlc_pP->lock_dar_buffer); memset(rlc_pP, 0, sizeof(rlc_um_entity_t)); } @@ -382,7 +383,7 @@ void rlc_um_configure( } //----------------------------------------------------------------------------- void rlc_um_set_debug_infos( - rlc_um_entity_t *rlc_pP, + rlc_um_entity_t * const rlc_pP, const module_id_t enb_module_idP, const module_id_t ue_module_idP, const frame_t frameP, diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h index 19acd6bc64adb293a64ce258314177104699f9a6..2014045ec8e01ced09afd7cc4cdb69aa40d72911 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h @@ -197,7 +197,7 @@ protected_rlc_um_control_primitives(void rlc_um_configure( * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). */ protected_rlc_um_control_primitives(void rlc_um_set_debug_infos( - rlc_um_entity_t *rlcP, + rlc_um_entity_t * const rlcP, const module_id_t enb_module_idP, const module_id_t ue_module_idP, const frame_t frameP, diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c index 074bdb5e3ab8114180628de4ba4b3a6f92bdbc0e..9ee376dc7b10846f8cada84b3cf5d7f0fc2b7026 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c @@ -763,7 +763,7 @@ void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP, frame_t frameP, eN rlc_pP->rb_id, rlc_pP->vr_ur); #endif - + pthread_mutex_lock(&rlc_pP->lock_dar_buffer); old_vr_ur = rlc_pP->vr_ur; rlc_pP->vr_ur = rlc_pP->vr_ux; @@ -803,6 +803,7 @@ void rlc_um_check_timer_dar_time_out(rlc_um_entity_t *rlc_pP, frame_t frameP, eN #endif rlc_um_stop_and_reset_timer_reordering(rlc_pP, frameP); } + pthread_mutex_unlock(&rlc_pP->lock_dar_buffer); } } vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_CHECK_TIMER_DAR_TIME_OUT,VCD_FUNCTION_OUT); @@ -1055,6 +1056,8 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t } else { free_mem_block(pdu_mem_pP); } + pthread_mutex_lock(&rlc_pP->lock_dar_buffer); + in_window = rlc_um_in_window(rlc_pP, frameP, rlc_pP->vr_uh - rlc_pP->rx_um_window_size, sn, rlc_pP->vr_ur); #if defined(DEBUG_RLC_PAYLOAD) @@ -1082,6 +1085,7 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t rlc_pP->stat_rx_data_bytes_out_of_window += tb_sizeP; free_mem_block(pdu_mem_pP); pdu_mem_pP = NULL; + pthread_mutex_unlock(&rlc_pP->lock_dar_buffer); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT); return; } @@ -1103,6 +1107,7 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t rlc_pP->stat_rx_data_bytes_duplicate += tb_sizeP; free_mem_block(pdu_mem_pP); pdu_mem_pP = NULL; + pthread_mutex_unlock(&rlc_pP->lock_dar_buffer); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT); return; } @@ -1252,5 +1257,6 @@ rlc_um_receive_process_dar (rlc_um_entity_t *rlc_pP, frame_t frameP, eNB_flag_t #endif } } + pthread_mutex_unlock(&rlc_pP->lock_dar_buffer); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT); } 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 b890822166556f7331b75a345eee66cee57e2c05..1109a9f7c664e1c00a3957e4ad2461887dc8458c 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 @@ -106,6 +106,9 @@ typedef struct rlc_um_entity_s { mem_block_t *output_sdu_in_construction; /*!< \brief Memory area where a complete SDU is reassemblied before being send to upper layers. */ sdu_size_t output_sdu_size_to_write; /*!< \brief Size of the reassemblied SDU. */ + + //pthread_spinlock_t lock_dar_buffer; + pthread_mutex_t lock_dar_buffer; mem_block_t **dar_buffer; /*!< \brief Array of rx PDUs. */ list_t pdus_from_mac_layer; /*!< \brief Not Used. */