From 6f95418689b158807035d411bc87d47c4749758b Mon Sep 17 00:00:00 2001 From: yagoda Date: Wed, 5 Apr 2023 14:54:18 +0200 Subject: [PATCH] eMBMS: adding mch mutex to avoid race conditions in SIB13 R/W --- srsue/hdr/phy/phy_common.h | 1 + srsue/src/phy/phy_common.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/srsue/hdr/phy/phy_common.h b/srsue/hdr/phy/phy_common.h index 6de05adec..a23547a02 100644 --- a/srsue/hdr/phy/phy_common.h +++ b/srsue/hdr/phy/phy_common.h @@ -336,6 +336,7 @@ private: bool have_mtch_stop = false; std::mutex mtch_mutex; + std::mutex mch_mutex; std::condition_variable mtch_cvar; std::atomic is_pending_tx_end{false}; diff --git a/srsue/src/phy/phy_common.cc b/srsue/src/phy/phy_common.cc index 0ca17c9ec..58ad6a5ca 100644 --- a/srsue/src/phy/phy_common.cc +++ b/srsue/src/phy/phy_common.cc @@ -944,6 +944,7 @@ void phy_common::reset() void phy_common::build_mch_table() { // First reset tables + std::lock_guard lock(mch_mutex); bzero(&mch_table[0], sizeof(uint8_t) * 40); // 40 element table represents 4 frames (40 subframes) @@ -966,6 +967,7 @@ void phy_common::build_mch_table() void phy_common::build_mcch_table() { + std::lock_guard lock(mch_mutex); // First reset tables bzero(&mcch_table[0], sizeof(uint8_t) * 10); generate_mcch_table(&mcch_table[0], (uint32_t)mbsfn_config.mbsfn_area_info.mcch_cfg.sf_alloc_info); @@ -1023,7 +1025,7 @@ bool phy_common::is_mch_subframe(srsran_mbsfn_cfg_t* cfg, uint32_t phy_tti) cfg->mbsfn_mcs = 2; cfg->enable = false; cfg->is_mcch = false; - + std::lock_guard lock(mch_mutex); // Check for MCCH if (is_mcch_subframe(cfg, phy_tti)) { cfg->is_mcch = true;