fix concurrency issue in TTCN3 PHY

master
Andre Puschmann 5 years ago
parent 0467d8bc84
commit 08418b17ce

@ -138,6 +138,8 @@ private:
int sr_tx_tti = -1; int sr_tx_tti = -1;
bool sr_pending = false; bool sr_pending = false;
std::mutex mutex;
uint32_t ra_trans_cnt = 0; uint32_t ra_trans_cnt = 0;
stack_interface_phy_lte* stack = nullptr; stack_interface_phy_lte* stack = nullptr;

@ -31,7 +31,6 @@ lte_ttcn3_phy::lte_ttcn3_phy(srslte::logger* logger_) : logger(logger_) {}
lte_ttcn3_phy::~lte_ttcn3_phy() {} lte_ttcn3_phy::~lte_ttcn3_phy() {}
int lte_ttcn3_phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_, syssim_interface_phy* syssim_) int lte_ttcn3_phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_, syssim_interface_phy* syssim_)
{ {
stack = stack_; stack = stack_;
syssim = syssim_; syssim = syssim_;
@ -69,6 +68,7 @@ void lte_ttcn3_phy::get_metrics(phy_metrics_t* m) {}
// The interface for the SS // The interface for the SS
void lte_ttcn3_phy::set_cell_map(const cell_list_t& cells_) void lte_ttcn3_phy::set_cell_map(const cell_list_t& cells_)
{ {
std::lock_guard<std::mutex> lock(mutex);
cells = cells_; cells = cells_;
} }
@ -140,6 +140,8 @@ void lte_ttcn3_phy::set_config_mbsfn_mcch(asn1::rrc::mcch_msg_s* mcch){};
/* Cell search and selection procedures */ /* Cell search and selection procedures */
phy_interface_rrc_lte::cell_search_ret_t lte_ttcn3_phy::cell_search(phy_cell_t* found_cell) phy_interface_rrc_lte::cell_search_ret_t lte_ttcn3_phy::cell_search(phy_cell_t* found_cell)
{ {
std::lock_guard<std::mutex> lock(mutex);
log.info("Running cell search in PHY\n"); log.info("Running cell search in PHY\n");
cell_search_ret_t ret = {}; cell_search_ret_t ret = {};
@ -259,6 +261,8 @@ void lte_ttcn3_phy::set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], u
// Called from the SYSSIM to configure the current TTI // Called from the SYSSIM to configure the current TTI
void lte_ttcn3_phy::set_current_tti(uint32_t tti) void lte_ttcn3_phy::set_current_tti(uint32_t tti)
{ {
std::lock_guard<std::mutex> lock(mutex);
current_tti = tti; current_tti = tti;
run_tti(); run_tti();
} }
@ -282,6 +286,7 @@ float lte_ttcn3_phy::get_pathloss_db()
} }
// Only provides a new UL grant, Tx is then triggered // Only provides a new UL grant, Tx is then triggered
// Calling function hold mutex
void lte_ttcn3_phy::new_grant_ul(mac_interface_phy_lte::mac_grant_ul_t ul_mac_grant) void lte_ttcn3_phy::new_grant_ul(mac_interface_phy_lte::mac_grant_ul_t ul_mac_grant)
{ {
mac_interface_phy_lte::tb_action_ul_t ul_action = {}; mac_interface_phy_lte::tb_action_ul_t ul_action = {};
@ -298,6 +303,8 @@ void lte_ttcn3_phy::new_grant_ul(mac_interface_phy_lte::mac_grant_ul_t ul_mac_gr
// Provides DL grant, copy data into DL action and pass up to MAC // Provides DL grant, copy data into DL action and pass up to MAC
void lte_ttcn3_phy::new_tb(const srsue::mac_interface_phy_lte::mac_grant_dl_t dl_grant, const uint8_t* data) void lte_ttcn3_phy::new_tb(const srsue::mac_interface_phy_lte::mac_grant_dl_t dl_grant, const uint8_t* data)
{ {
std::lock_guard<std::mutex> lock(mutex);
if (data == nullptr) { if (data == nullptr) {
log.error("Invalid data buffer passed\n"); log.error("Invalid data buffer passed\n");
return; return;
@ -345,6 +352,7 @@ void lte_ttcn3_phy::radio_failure()
log.debug("%s not implemented.\n", __FUNCTION__); log.debug("%s not implemented.\n", __FUNCTION__);
} }
// Calling function set_tti() is holding mutex
void lte_ttcn3_phy::run_tti() void lte_ttcn3_phy::run_tti()
{ {
// send report for each cell // send report for each cell

Loading…
Cancel
Save