Batch of data race fixes in the following classes: RLC AM, Intra measure, UL HARQ, PHY common.

master
faluco 3 years ago committed by Andre Puschmann
parent dd5eda04e3
commit 5f93ff6ed0

@ -74,7 +74,8 @@ private:
srslog::basic_logger& logger; srslog::basic_logger& logger;
srsran_cell_t serving_cell = {}; ///< Current serving cell in the EARFCN, to avoid reporting it srsran_cell_t serving_cell = {}; ///< Current serving cell in the EARFCN, to avoid reporting it
uint32_t current_earfcn = 0; ///< Current EARFCN std::atomic<uint32_t> current_earfcn = {0}; ///< Current EARFCN
std::mutex mutex;
/// LTE-based measuring objects /// LTE-based measuring objects
scell_recv scell_rx; ///< Secondary cell searcher scell_recv scell_rx; ///< Secondary cell searcher

@ -118,7 +118,7 @@ private:
lockable_grant cur_grant; lockable_grant cur_grant;
uint32_t pid; uint32_t pid;
uint32_t current_tx_nb; std::atomic<uint32_t> current_tx_nb = {0};
uint32_t current_irv; uint32_t current_irv;
bool harq_feedback; bool harq_feedback;
bool is_grant_configured; bool is_grant_configured;

@ -306,12 +306,14 @@ bool phy_common::is_any_ul_pending_ack()
#define tti_pusch_hi(sf) \ #define tti_pusch_hi(sf) \
(sf->tti + \ (sf->tti + \
(cell.frame_type == SRSRAN_FDD ? FDD_HARQ_DELAY_UL_MS \ (cell.frame_type == SRSRAN_FDD ? FDD_HARQ_DELAY_UL_MS \
: I_phich ? 7 : k_pusch[sf->tdd_config.sf_config][sf->tti % 10]) + \ : I_phich ? 7 \
: k_pusch[sf->tdd_config.sf_config][sf->tti % 10]) + \
(FDD_HARQ_DELAY_DL_MS - FDD_HARQ_DELAY_UL_MS)) (FDD_HARQ_DELAY_DL_MS - FDD_HARQ_DELAY_UL_MS))
#define tti_pusch_gr(sf) \ #define tti_pusch_gr(sf) \
(sf->tti + \ (sf->tti + \
(cell.frame_type == SRSRAN_FDD ? FDD_HARQ_DELAY_UL_MS \ (cell.frame_type == SRSRAN_FDD ? FDD_HARQ_DELAY_UL_MS \
: dci->ul_idx == 1 ? 7 : k_pusch[sf->tdd_config.sf_config][sf->tti % 10]) + \ : dci->ul_idx == 1 ? 7 \
: k_pusch[sf->tdd_config.sf_config][sf->tti % 10]) + \
(FDD_HARQ_DELAY_DL_MS - FDD_HARQ_DELAY_UL_MS)) (FDD_HARQ_DELAY_DL_MS - FDD_HARQ_DELAY_UL_MS))
// SF->TTI is at which Format0 dci is received // SF->TTI is at which Format0 dci is received

@ -42,8 +42,11 @@ void intra_measure_lte::init(uint32_t cc_idx, const args_t& args)
void intra_measure_lte::set_primary_cell(uint32_t earfcn, srsran_cell_t cell) void intra_measure_lte::set_primary_cell(uint32_t earfcn, srsran_cell_t cell)
{ {
current_earfcn = earfcn; {
std::lock_guard<std::mutex> lock(mutex);
serving_cell = cell; serving_cell = cell;
}
current_earfcn = earfcn;
set_current_sf_len((uint32_t)SRSRAN_SF_LEN_PRB(cell.nof_prb)); set_current_sf_len((uint32_t)SRSRAN_SF_LEN_PRB(cell.nof_prb));
} }
@ -51,8 +54,14 @@ bool intra_measure_lte::measure_rat(measure_context_t context, std::vector<cf_t>
{ {
std::set<uint32_t> cells_to_measure = context.active_pci; std::set<uint32_t> cells_to_measure = context.active_pci;
srsran_cell_t serving_cell_copy{};
{
std::lock_guard<std::mutex> lock(mutex);
serving_cell_copy = serving_cell;
}
// Detect new cells using PSS/SSS // Detect new cells using PSS/SSS
scell_rx.find_cells(buffer.data(), serving_cell, context.meas_len_ms, cells_to_measure); scell_rx.find_cells(buffer.data(), serving_cell_copy, context.meas_len_ms, cells_to_measure);
// Initialise empty neighbour cell list // Initialise empty neighbour cell list
std::vector<phy_meas_t> neighbour_cells = {}; std::vector<phy_meas_t> neighbour_cells = {};
@ -62,10 +71,10 @@ bool intra_measure_lte::measure_rat(measure_context_t context, std::vector<cf_t>
// Use Cell Reference signal to measure cells in the time domain for all known active PCI // Use Cell Reference signal to measure cells in the time domain for all known active PCI
for (const uint32_t& id : cells_to_measure) { for (const uint32_t& id : cells_to_measure) {
// Do not measure serving cell here since it's measured by workers // Do not measure serving cell here since it's measured by workers
if (id == serving_cell.id) { if (id == serving_cell_copy.id) {
continue; continue;
} }
srsran_cell_t cell = serving_cell; srsran_cell_t cell = serving_cell_copy;
cell.id = id; cell.id = id;
if (srsran_refsignal_dl_sync_set_cell(&refsignal_dl_sync, cell) < SRSRAN_SUCCESS) { if (srsran_refsignal_dl_sync_set_cell(&refsignal_dl_sync, cell) < SRSRAN_SUCCESS) {

@ -317,7 +317,7 @@ void ul_harq_entity::ul_harq_process::generate_retx(mac_interface_phy_lte::mac_g
Info("UL %d: Adaptive retx=%d, RV=%d, TBS=%d, HI=%s, ndi=%d, prev_ndi=%d", Info("UL %d: Adaptive retx=%d, RV=%d, TBS=%d, HI=%s, ndi=%d, prev_ndi=%d",
pid, pid,
current_tx_nb, current_tx_nb.load(),
get_rv(), get_rv(),
grant.tb.tbs, grant.tb.tbs,
harq_feedback ? "ACK" : "NACK", harq_feedback ? "ACK" : "NACK",
@ -337,7 +337,7 @@ void ul_harq_entity::ul_harq_process::generate_retx(mac_interface_phy_lte::mac_g
// Non-adaptive retx are only sent if HI=NACK. If HI=ACK but no dci was received do not reset PID // Non-adaptive retx are only sent if HI=NACK. If HI=ACK but no dci was received do not reset PID
Info("UL %d: Non-Adaptive retx=%d, RV=%d, TBS=%d, HI=%s", Info("UL %d: Non-Adaptive retx=%d, RV=%d, TBS=%d, HI=%s",
pid, pid,
current_tx_nb, current_tx_nb.load(),
get_rv(), get_rv(),
cur_grant.get_tbs(), cur_grant.get_tbs(),
harq_feedback ? "ACK" : "NACK"); harq_feedback ? "ACK" : "NACK");

Loading…
Cancel
Save