Fix concurrency issue in set_crnti()

master
Ismael Gomez 5 years ago committed by Andre Puschmann
parent 2f3a125757
commit f2851b037e

@ -214,6 +214,7 @@ private:
received_ack_t pending_dl_ack[TTIMOD_SZ][SRSLTE_MAX_CARRIERS] = {}; received_ack_t pending_dl_ack[TTIMOD_SZ][SRSLTE_MAX_CARRIERS] = {};
uint32_t pending_dl_dai[TTIMOD_SZ][SRSLTE_MAX_CARRIERS] = {}; uint32_t pending_dl_dai[TTIMOD_SZ][SRSLTE_MAX_CARRIERS] = {};
std::mutex pending_dl_ack_mutex; std::mutex pending_dl_ack_mutex;
std::mutex pending_dl_grant_mutex;
// Cross-carried grants scheduled from PCell // Cross-carried grants scheduled from PCell
typedef struct { typedef struct {

@ -428,6 +428,7 @@ void phy_common::set_dl_pending_grant(uint32_t tti,
uint32_t grant_cc_idx, uint32_t grant_cc_idx,
const srslte_dci_dl_t* dl_dci) const srslte_dci_dl_t* dl_dci)
{ {
std::lock_guard<std::mutex> lock(pending_dl_grant_mutex);
if (!pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].enable) { if (!pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].enable) {
pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].dl_dci = *dl_dci; pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].dl_dci = *dl_dci;
pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].grant_cc_idx = grant_cc_idx; pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].grant_cc_idx = grant_cc_idx;
@ -439,6 +440,7 @@ void phy_common::set_dl_pending_grant(uint32_t tti,
bool phy_common::get_dl_pending_grant(uint32_t tti, uint32_t cc_idx, uint32_t* grant_cc_idx, srslte_dci_dl_t* dl_dci) bool phy_common::get_dl_pending_grant(uint32_t tti, uint32_t cc_idx, uint32_t* grant_cc_idx, srslte_dci_dl_t* dl_dci)
{ {
std::lock_guard<std::mutex> lock(pending_dl_grant_mutex);
if (pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].enable) { if (pending_dl_grant[tti % FDD_HARQ_DELAY_MS][cc_idx].enable) {
// Read grant // Read grant
if (dl_dci) { if (dl_dci) {

@ -149,6 +149,7 @@ void sf_worker::set_cfo(const uint32_t& cc_idx, float cfo)
void sf_worker::set_crnti(uint16_t rnti) void sf_worker::set_crnti(uint16_t rnti)
{ {
std::lock_guard<std::mutex> lock(mutex);
for (auto& cc_worker : cc_workers) { for (auto& cc_worker : cc_workers) {
cc_worker->set_crnti(rnti); cc_worker->set_crnti(rnti);
} }
@ -156,6 +157,7 @@ void sf_worker::set_crnti(uint16_t rnti)
void sf_worker::set_tdd_config(srslte_tdd_config_t config) void sf_worker::set_tdd_config(srslte_tdd_config_t config)
{ {
std::lock_guard<std::mutex> lock(mutex);
for (auto& cc_worker : cc_workers) { for (auto& cc_worker : cc_workers) {
cc_worker->set_tdd_config(config); cc_worker->set_tdd_config(config);
} }
@ -164,6 +166,7 @@ void sf_worker::set_tdd_config(srslte_tdd_config_t config)
void sf_worker::enable_pregen_signals(bool enabled) void sf_worker::enable_pregen_signals(bool enabled)
{ {
std::lock_guard<std::mutex> lock(mutex);
for (auto& cc_worker : cc_workers) { for (auto& cc_worker : cc_workers) {
cc_worker->enable_pregen_signals(enabled); cc_worker->enable_pregen_signals(enabled);
} }

Loading…
Cancel
Save