Add option to run prach_worker in the caller thread instead of by a background worker. This is useful when running simulations with ZMQ, to avoid the prach worker to take too much time and miss the RAR deadline

master
Ismael Gomez 4 years ago
parent 74ffe393c6
commit 6348ddefd5

@ -62,6 +62,7 @@ struct phy_args_t {
bool pusch_meas_evm = false;
bool pusch_meas_ta = true;
bool pucch_meas_ta = true;
uint32_t nof_prach_threads = 1;
srslte::channel::args_t dl_channel_args;
srslte::channel::args_t ul_channel_args;

@ -37,7 +37,8 @@ public:
const srslte_prach_cfg_t& prach_cfg_,
stack_interface_phy_lte* mac,
srslte::log* log_h,
int priority);
int priority,
uint32_t nof_workers);
int new_tti(uint32_t tti, cf_t* buffer);
void set_max_prach_offset_us(float delay_us);
void stop();
@ -86,6 +87,7 @@ private:
bool running = false;
uint32_t nof_sf = 0;
uint32_t sf_cnt = 0;
uint32_t nof_workers = 0;
void run_thread() final;
int run_tti(sf_buffer* b);
@ -105,14 +107,15 @@ public:
const srslte_prach_cfg_t& prach_cfg_,
stack_interface_phy_lte* mac,
srslte::log* log_h,
int priority)
int priority,
uint32_t nof_workers_x_cc)
{
// Create PRACH worker if required
while (cc_idx >= prach_vec.size()) {
prach_vec.push_back(std::unique_ptr<prach_worker>(new prach_worker(prach_vec.size())));
}
prach_vec[cc_idx]->init(cell_, prach_cfg_, mac, log_h, priority);
prach_vec[cc_idx]->init(cell_, prach_cfg_, mac, log_h, priority, nof_workers_x_cc);
}
void set_max_prach_offset_us(float delay_us)

@ -189,6 +189,7 @@ void parse_args(all_args_t* args, int argc, char* argv[])
("expert.pusch_meas_evm", bpo::value<bool>(&args->phy.pusch_meas_evm)->default_value(false), "Enable/Disable PUSCH EVM measure")
("expert.tx_amplitude", bpo::value<float>(&args->phy.tx_amplitude)->default_value(0.6), "Transmit amplitude factor")
("expert.nof_phy_threads", bpo::value<uint32_t>(&args->phy.nof_phy_threads)->default_value(3), "Number of PHY threads")
("expert.nof_prach_threads", bpo::value<uint32_t>(&args->phy.nof_prach_threads)->default_value(1), "Number of PRACH workers per carrier. Only 1 or 0 is supported")
("expert.max_prach_offset_us", bpo::value<float>(&args->phy.max_prach_offset_us)->default_value(30), "Maximum allowed RACH offset (in us)")
("expert.equalizer_mode", bpo::value<string>(&args->phy.equalizer_mode)->default_value("mmse"), "Equalizer mode")
("expert.estimator_fil_w", bpo::value<float>(&args->phy.estimator_fil_w)->default_value(0.1), "Chooses the coefficients for the 3-tap channel estimator centered filter.")
@ -306,6 +307,14 @@ void parse_args(all_args_t* args, int argc, char* argv[])
}
}
// Check PRACH workers
if (args->phy.nof_prach_threads > 1) {
fprintf(stderr,
"nof_prach_workers = %d. Value is not supported, only 0 or 1 are allowed\n",
args->phy.nof_prach_threads);
exit(1);
}
// Convert eNB Id
std::size_t pos = {};
try {

@ -132,7 +132,13 @@ int phy::init(const phy_args_t& args,
// For each carrier, initialise PRACH worker
for (uint32_t cc = 0; cc < cfg.phy_cell_cfg.size(); cc++) {
prach_cfg.root_seq_idx = cfg.phy_cell_cfg[cc].root_seq_idx;
prach.init(cc, cfg.phy_cell_cfg[cc].cell, prach_cfg, stack_, log_h.get(), PRACH_WORKER_THREAD_PRIO);
prach.init(cc,
cfg.phy_cell_cfg[cc].cell,
prach_cfg,
stack_,
log_h.get(),
PRACH_WORKER_THREAD_PRIO,
args.nof_prach_threads);
}
prach.set_max_prach_offset_us(args.max_prach_offset_us);

@ -19,12 +19,14 @@ int prach_worker::init(const srslte_cell_t& cell_,
const srslte_prach_cfg_t& prach_cfg_,
stack_interface_phy_lte* stack_,
srslte::log* log_h_,
int priority)
int priority,
uint32_t nof_workers_)
{
log_h = log_h_;
stack = stack_;
prach_cfg = prach_cfg_;
cell = cell_;
log_h = log_h_;
stack = stack_;
prach_cfg = prach_cfg_;
cell = cell_;
nof_workers = nof_workers_;
max_prach_offset_us = 50;
@ -41,7 +43,10 @@ int prach_worker::init(const srslte_cell_t& cell_,
nof_sf = (uint32_t)ceilf(prach.T_tot * 1000);
start(priority);
if (nof_workers > 0) {
start(priority);
}
initiated = true;
sf_cnt = 0;
@ -66,7 +71,10 @@ void prach_worker::stop()
running = false;
sf_buffer* s = nullptr;
pending_buffers.push(s);
wait_thread_finish();
if (nof_workers > 0) {
wait_thread_finish();
}
srslte_prach_free(&prach);
}
@ -106,7 +114,13 @@ int prach_worker::new_tti(uint32_t tti_rx, cf_t* buffer_rx)
sf_cnt++;
if (sf_cnt == nof_sf) {
sf_cnt = 0;
pending_buffers.push(current_buffer);
if (nof_workers == 0) {
run_tti(current_buffer);
current_buffer->reset();
buffer_pool.deallocate(current_buffer);
} else {
pending_buffers.push(current_buffer);
}
}
}
return 0;

Loading…
Cancel
Save