Fix data race in ul_harq.

master
faluco 3 years ago committed by faluco
parent d02012b588
commit 2b73beb3dd

@ -100,7 +100,7 @@ private:
srsran::ul_harq_cfg_t harq_cfg = {};
float average_retx = 0.0;
std::atomic<float> average_retx{0};
uint64_t nof_pkts = 0;
ra_proc* ra_procedure = nullptr;

@ -103,7 +103,7 @@ int ul_harq_entity::get_current_tbs(uint32_t pid)
float ul_harq_entity::get_average_retx()
{
return average_retx;
return average_retx.load(std::memory_order_relaxed);
}
ul_harq_entity::ul_harq_process::ul_harq_process() : logger(srslog::fetch_basic_logger("MAC"))
@ -348,7 +348,10 @@ void ul_harq_entity::ul_harq_process::generate_new_tx(mac_interface_phy_lte::mac
mac_interface_phy_lte::tb_action_ul_t* action)
{
// Compute average number of retransmissions per packet considering previous packet
harq_entity->average_retx = SRSRAN_VEC_CMA((float)current_tx_nb, harq_entity->average_retx, harq_entity->nof_pkts++);
harq_entity->average_retx.store(SRSRAN_VEC_CMA((float)current_tx_nb,
harq_entity->average_retx.load(std::memory_order_relaxed),
harq_entity->nof_pkts++),
std::memory_order_relaxed);
cur_grant = grant;
harq_feedback = false;
is_grant_configured = true;

Loading…
Cancel
Save