Commit d2daa68a authored by Lionel Gauthier's avatar Lionel Gauthier

But mutex on dar buffer, tested RTAI, but missed slot can occur, because phy...

But mutex on dar buffer, tested RTAI, but missed slot can occur, because phy rx and tx threads stimulate code with dar buffer, other solutions can be implemented.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6146 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 23db2b52
......@@ -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,
......
......@@ -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,
......
......@@ -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);
}
......@@ -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. */
......
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