SRSENB: Added PHY CA PRACH workers

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 2f00fd62ec
commit 2e1479e9d6

@ -73,12 +73,12 @@ public:
ul_sched_grant_t pusch[MAX_GRANTS]; ul_sched_grant_t pusch[MAX_GRANTS];
ul_sched_ack_t phich[MAX_GRANTS]; ul_sched_ack_t phich[MAX_GRANTS];
uint32_t nof_grants; uint32_t nof_grants;
uint32_t nof_phich; uint32_t nof_phich;
} ul_sched_t; } ul_sched_t;
virtual int sr_detected(uint32_t tti, uint16_t rnti) = 0;
virtual int rach_detected(uint32_t tti, uint32_t primary_cc_idx, uint32_t preamble_idx, uint32_t time_adv) = 0;
virtual int sr_detected(uint32_t tti, uint16_t rnti) = 0;
virtual int rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv) = 0;
virtual int ri_info(uint32_t tti, uint16_t rnti, uint32_t ri_value) = 0; virtual int ri_info(uint32_t tti, uint16_t rnti, uint32_t ri_value) = 0;
virtual int pmi_info(uint32_t tti, uint16_t rnti, uint32_t pmi_value) = 0; virtual int pmi_info(uint32_t tti, uint16_t rnti, uint32_t pmi_value) = 0;
virtual int cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi_value) = 0; virtual int cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi_value) = 0;

@ -95,11 +95,11 @@ private:
std::vector<std::unique_ptr<srslte::log_filter> > log_vec; std::vector<std::unique_ptr<srslte::log_filter> > log_vec;
srslte::log* log_h = nullptr; srslte::log* log_h = nullptr;
srslte::thread_pool workers_pool; srslte::thread_pool workers_pool;
std::vector<sf_worker> workers; std::vector<sf_worker> workers;
phy_common workers_common; phy_common workers_common;
prach_worker prach; prach_worker_pool prach;
txrx tx_rx; txrx tx_rx;
bool initialized = false; bool initialized = false;

@ -33,25 +33,7 @@ namespace srsenb {
class prach_worker : thread class prach_worker : thread
{ {
public: public:
prach_worker() : prach_worker(uint32_t cc_idx_) : buffer_pool(8), thread("PRACH_WORKER") { cc_idx = cc_idx_; }
initiated(false),
prach_nof_det(0),
max_prach_offset_us(0),
buffer_pool(8),
running(false),
nof_sf(0),
sf_cnt(0),
thread("PRACH_WORKER")
{
log_h = nullptr;
stack = nullptr;
bzero(&prach, sizeof(srslte_prach_t));
bzero(&prach_indices, sizeof(prach_indices));
bzero(&prach_offsets, sizeof(prach_offsets));
bzero(&prach_p2avg, sizeof(prach_p2avg));
bzero(&cell, sizeof(cell));
bzero(&prach_cfg, sizeof(prach_cfg));
}
int init(const srslte_cell_t& cell_, int init(const srslte_cell_t& cell_,
const srslte_prach_cfg_t& prach_cfg_, const srslte_prach_cfg_t& prach_cfg_,
@ -63,14 +45,15 @@ public:
void stop(); void stop();
private: private:
uint32_t prach_nof_det; uint32_t cc_idx = 0;
uint32_t prach_indices[165]; uint32_t prach_nof_det = 0;
float prach_offsets[165]; uint32_t prach_indices[165] = {};
float prach_p2avg[165]; float prach_offsets[165] = {};
float prach_p2avg[165] = {};
srslte_cell_t cell;
srslte_prach_cfg_t prach_cfg; srslte_cell_t cell = {};
srslte_prach_t prach; srslte_prach_cfg_t prach_cfg = {};
srslte_prach_t prach = {};
const static int sf_buffer_sz = 128*1024; const static int sf_buffer_sz = 128*1024;
class sf_buffer { class sf_buffer {
@ -95,7 +78,7 @@ private:
srslte::log* log_h = nullptr; srslte::log* log_h = nullptr;
stack_interface_phy_lte* stack = nullptr; stack_interface_phy_lte* stack = nullptr;
float max_prach_offset_us = 0.0f; float max_prach_offset_us = 0.0f;
bool initiated = 0; bool initiated = false;
bool running = false; bool running = false;
uint32_t nof_sf = 0; uint32_t nof_sf = 0;
uint32_t sf_cnt = 0; uint32_t sf_cnt = 0;
@ -105,5 +88,53 @@ private:
}; };
class prach_worker_pool:
{
private:
std::vector<std::unique_ptr<prach_worker> > prach_vec;
public:
prach_worker_pool() = default;
~prach_worker_pool() = default;
void init(uint32_t cc_idx,
const srslte_cell_t& cell_,
const srslte_prach_cfg_t& prach_cfg_,
stack_interface_phy_lte* mac,
srslte::log* log_h,
int priority)
{
// 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);
}
void set_max_prach_offset_us(float delay_us)
{
for (auto& prach : prach_vec) {
prach->set_max_prach_offset_us(delay_us);
}
}
void stop()
{
for (auto& prach : prach_vec) {
prach->stop();
}
}
int new_tti(uint32_t cc_idx, uint32_t tti, cf_t* buffer)
{
int ret = SRSLTE_ERROR;
if (cc_idx < prach_vec.size()) {
ret = prach_vec[cc_idx]->new_tti(tti, buffer);
}
return ret;
}
};
} }
#endif // SRSENB_PRACH_WORKER_H #endif // SRSENB_PRACH_WORKER_H

@ -41,7 +41,7 @@ public:
bool init(srslte::radio_interface_phy* radio_handler, bool init(srslte::radio_interface_phy* radio_handler,
srslte::thread_pool* _workers_pool, srslte::thread_pool* _workers_pool,
phy_common* worker_com, phy_common* worker_com,
prach_worker* prach, prach_worker_pool* prach_,
srslte::log* log_h, srslte::log* log_h,
uint32_t prio); uint32_t prio);
void stop(); void stop();
@ -52,7 +52,7 @@ private:
srslte::radio_interface_phy* radio_h = nullptr; srslte::radio_interface_phy* radio_h = nullptr;
srslte::log* log_h = nullptr; srslte::log* log_h = nullptr;
srslte::thread_pool* workers_pool = nullptr; srslte::thread_pool* workers_pool = nullptr;
prach_worker* prach = nullptr; prach_worker_pool* prach = nullptr;
phy_common* worker_com = nullptr; phy_common* worker_com = nullptr;
srslte::channel_ptr ul_channel = nullptr; srslte::channel_ptr ul_channel = nullptr;

@ -57,9 +57,9 @@ public:
/* PHY-MAC interface */ /* PHY-MAC interface */
int sr_detected(uint32_t tti, uint16_t rnti) final { return mac.sr_detected(tti, rnti); } int sr_detected(uint32_t tti, uint16_t rnti) final { return mac.sr_detected(tti, rnti); }
int rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv) final int rach_detected(uint32_t tti, uint32_t primary_cc_idx, uint32_t preamble_idx, uint32_t time_adv) final
{ {
return mac.rach_detected(tti, preamble_idx, time_adv); return mac.rach_detected(tti, primary_cc_idx, preamble_idx, time_adv);
} }
int ri_info(uint32_t tti, uint16_t rnti, uint32_t ri_value) final { return mac.ri_info(tti, rnti, ri_value); } int ri_info(uint32_t tti, uint16_t rnti, uint32_t ri_value) final { return mac.ri_info(tti, rnti, ri_value); }
int pmi_info(uint32_t tti, uint16_t rnti, uint32_t pmi_value) final { return mac.pmi_info(tti, rnti, pmi_value); } int pmi_info(uint32_t tti, uint16_t rnti, uint32_t pmi_value) final { return mac.pmi_info(tti, rnti, pmi_value); }

@ -61,7 +61,7 @@ public:
/******** Interface from PHY (PHY -> MAC) ****************/ /******** Interface from PHY (PHY -> MAC) ****************/
int sr_detected(uint32_t tti, uint16_t rnti) final; int sr_detected(uint32_t tti, uint16_t rnti) final;
int rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv) final; int rach_detected(uint32_t tti, uint32_t primary_cc_idx, uint32_t preamble_idx, uint32_t time_adv) final;
int set_dl_ant_info(uint16_t rnti, asn1::rrc::phys_cfg_ded_s::ant_info_c_* dl_ant_info); int set_dl_ant_info(uint16_t rnti, asn1::rrc::phys_cfg_ded_s::ant_info_c_* dl_ant_info);

@ -58,16 +58,12 @@ phy::~phy()
void phy::parse_config(const phy_cfg_t& cfg) void phy::parse_config(const phy_cfg_t& cfg)
{ {
// PRACH configuration // PRACH configuration
ZERO_OBJECT(prach_cfg);
prach_cfg.config_idx = cfg.prach_cnfg.prach_cfg_info.prach_cfg_idx; prach_cfg.config_idx = cfg.prach_cnfg.prach_cfg_info.prach_cfg_idx;
prach_cfg.hs_flag = cfg.prach_cnfg.prach_cfg_info.high_speed_flag; prach_cfg.hs_flag = cfg.prach_cnfg.prach_cfg_info.high_speed_flag;
prach_cfg.root_seq_idx = cfg.prach_cnfg.root_seq_idx; prach_cfg.root_seq_idx = cfg.prach_cnfg.root_seq_idx;
prach_cfg.zero_corr_zone = cfg.prach_cnfg.prach_cfg_info.zero_correlation_zone_cfg; prach_cfg.zero_corr_zone = cfg.prach_cnfg.prach_cfg_info.zero_correlation_zone_cfg;
prach_cfg.freq_offset = cfg.prach_cnfg.prach_cfg_info.prach_freq_offset; prach_cfg.freq_offset = cfg.prach_cnfg.prach_cfg_info.prach_freq_offset;
// Uplink Physical common configuration
ZERO_OBJECT(workers_common.ul_cfg_com);
// DMRS // DMRS
workers_common.ul_cfg_com.dmrs.cyclic_shift = cfg.pusch_cnfg.ul_ref_sigs_pusch.cyclic_shift; workers_common.ul_cfg_com.dmrs.cyclic_shift = cfg.pusch_cnfg.ul_ref_sigs_pusch.cyclic_shift;
workers_common.ul_cfg_com.dmrs.delta_ss = cfg.pusch_cnfg.ul_ref_sigs_pusch.group_assign_pusch; workers_common.ul_cfg_com.dmrs.delta_ss = cfg.pusch_cnfg.ul_ref_sigs_pusch.group_assign_pusch;
@ -80,7 +76,7 @@ void phy::parse_config(const phy_cfg_t& cfg)
asn1::rrc::pusch_cfg_common_s::pusch_cfg_basic_s_::hop_mode_e_::intra_and_inter_sub_frame asn1::rrc::pusch_cfg_common_s::pusch_cfg_basic_s_::hop_mode_e_::intra_and_inter_sub_frame
? srslte_pusch_hopping_cfg_t::SRSLTE_PUSCH_HOP_MODE_INTRA_SF ? srslte_pusch_hopping_cfg_t::SRSLTE_PUSCH_HOP_MODE_INTRA_SF
: srslte_pusch_hopping_cfg_t::SRSLTE_PUSCH_HOP_MODE_INTER_SF; : srslte_pusch_hopping_cfg_t::SRSLTE_PUSCH_HOP_MODE_INTER_SF;
;
workers_common.ul_cfg_com.hopping.n_sb = cfg.pusch_cnfg.pusch_cfg_basic.n_sb; workers_common.ul_cfg_com.hopping.n_sb = cfg.pusch_cnfg.pusch_cfg_basic.n_sb;
workers_common.ul_cfg_com.hopping.hopping_offset = cfg.pusch_cnfg.pusch_cfg_basic.pusch_hop_offset; workers_common.ul_cfg_com.hopping.hopping_offset = cfg.pusch_cnfg.pusch_cfg_basic.pusch_hop_offset;
workers_common.ul_cfg_com.pusch.max_nof_iterations = workers_common.params.pusch_max_its; workers_common.ul_cfg_com.pusch.max_nof_iterations = workers_common.params.pusch_max_its;
@ -95,7 +91,6 @@ void phy::parse_config(const phy_cfg_t& cfg)
workers_common.ul_cfg_com.pucch.threshold_format1 = 0.8; workers_common.ul_cfg_com.pucch.threshold_format1 = 0.8;
// PDSCH configuration // PDSCH configuration
ZERO_OBJECT(workers_common.dl_cfg_com);
workers_common.dl_cfg_com.tm = SRSLTE_TM1; workers_common.dl_cfg_com.tm = SRSLTE_TM1;
workers_common.dl_cfg_com.pdsch.rs_power = cfg.pdsch_cnfg.ref_sig_pwr; workers_common.dl_cfg_com.pdsch.rs_power = cfg.pdsch_cnfg.ref_sig_pwr;
workers_common.dl_cfg_com.pdsch.p_b = cfg.pdsch_cnfg.p_b; workers_common.dl_cfg_com.pdsch.p_b = cfg.pdsch_cnfg.p_b;
@ -107,7 +102,7 @@ int phy::init(const phy_args_t& args,
srslte::radio_interface_phy* radio_, srslte::radio_interface_phy* radio_,
stack_interface_phy_lte* stack_) stack_interface_phy_lte* stack_)
{ {
mlockall(MCL_CURRENT | MCL_FUTURE); mlockall((uint32_t)MCL_CURRENT | (uint32_t)MCL_FUTURE);
// Create array of pointers to phy_logs // Create array of pointers to phy_logs
for (int i = 0; i < args.nof_phy_threads; i++) { for (int i = 0; i < args.nof_phy_threads; i++) {
@ -148,7 +143,10 @@ int phy::init(const phy_args_t& args,
workers_pool.init_worker(i, &workers[i], WORKERS_THREAD_PRIO); workers_pool.init_worker(i, &workers[i], WORKERS_THREAD_PRIO);
} }
prach.init(cfg.cell, prach_cfg, stack_, log_vec.at(0).get(), PRACH_WORKER_THREAD_PRIO); // For each carrier, initialise PRACH worker
for (uint32_t cc = 0; cc < args.nof_carriers; cc++) {
prach.init(cc, cfg.cell, prach_cfg, stack_, log_vec.at(0).get(), PRACH_WORKER_THREAD_PRIO);
}
prach.set_max_prach_offset_us(args.max_prach_offset_us); prach.set_max_prach_offset_us(args.max_prach_offset_us);
// Warning this must be initialized after all workers have been added to the pool // Warning this must be initialized after all workers have been added to the pool

@ -127,11 +127,17 @@ int prach_worker::run_tti(sf_buffer *b)
if (prach_nof_det) { if (prach_nof_det) {
for (uint32_t i=0;i<prach_nof_det;i++) { for (uint32_t i=0;i<prach_nof_det;i++) {
log_h->info("PRACH: %d/%d, preamble=%d, offset=%.1f us, peak2avg=%.1f, max_offset=%.1f us\n", log_h->info("PRACH: cc=%d, %d/%d, preamble=%d, offset=%.1f us, peak2avg=%.1f, max_offset=%.1f us\n",
i, prach_nof_det, prach_indices[i], prach_offsets[i]*1e6, prach_p2avg[i], max_prach_offset_us); cc_idx,
i,
prach_nof_det,
prach_indices[i],
prach_offsets[i] * 1e6,
prach_p2avg[i],
max_prach_offset_us);
if (prach_offsets[i]*1e6 < max_prach_offset_us) { if (prach_offsets[i]*1e6 < max_prach_offset_us) {
stack->rach_detected(b->tti, prach_indices[i], (uint32_t)(prach_offsets[i] * 1e6)); stack->rach_detected(b->tti, cc_idx, prach_indices[i], (uint32_t)(prach_offsets[i] * 1e6));
} }
} }
} }

@ -46,7 +46,7 @@ txrx::txrx() : thread("TXRX")
bool txrx::init(srslte::radio_interface_phy* radio_h_, bool txrx::init(srslte::radio_interface_phy* radio_h_,
srslte::thread_pool* workers_pool_, srslte::thread_pool* workers_pool_,
phy_common* worker_com_, phy_common* worker_com_,
prach_worker* prach_, prach_worker_pool* prach_,
srslte::log* log_h_, srslte::log* log_h_,
uint32_t prio_) uint32_t prio_)
{ {
@ -131,11 +131,12 @@ void txrx::run_thread()
tx_worker_cnt = (tx_worker_cnt+1)%nof_workers; tx_worker_cnt = (tx_worker_cnt+1)%nof_workers;
// Trigger phy worker execution // Trigger phy worker execution
workers_pool->start_worker(worker); workers_pool->start_worker(worker);
// Trigger prach worker execution // Trigger prach worker execution
prach->new_tti(tti, buffer[0]); for (uint32_t cc = 0; cc < worker_com->params.nof_carriers; cc++) {
prach->new_tti(cc, tti, buffer[cc * worker_com->cell.nof_ports]);
}
} else { } else {
// wait_worker() only returns NULL if it's being closed. Quit now to avoid unnecessary loops here // wait_worker() only returns NULL if it's being closed. Quit now to avoid unnecessary loops here
running = false; running = false;

@ -460,7 +460,7 @@ int mac::sr_detected(uint32_t tti, uint16_t rnti)
return ret; return ret;
} }
int mac::rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv) int mac::rach_detected(uint32_t tti, uint32_t primary_cc_idx, uint32_t preamble_idx, uint32_t time_adv)
{ {
log_h->step(tti); log_h->step(tti);

Loading…
Cancel
Save