SRSENB: fix segmentation fault

This commit is contained in:
Xavier Arteaga 2020-01-24 11:44:25 +01:00 committed by Xavier Arteaga
parent 9a853d8692
commit 31dffb785f
4 changed files with 33 additions and 22 deletions

View File

@ -54,10 +54,10 @@ public:
void start_plot();
void set_config_dedicated(uint16_t rnti, asn1::rrc::phys_cfg_ded_s* dedicated);
void work_ul(srslte_ul_sf_cfg_t* ul_sf, stack_interface_phy_lte::ul_sched_t* ul_grants);
void work_dl(srslte_dl_sf_cfg_t* dl_sf_cfg,
stack_interface_phy_lte::dl_sched_t* dl_grants,
stack_interface_phy_lte::ul_sched_t* ul_grants,
void work_ul(const srslte_ul_sf_cfg_t& ul_sf, stack_interface_phy_lte::ul_sched_t& ul_grants);
void work_dl(const srslte_dl_sf_cfg_t& dl_sf_cfg,
stack_interface_phy_lte::dl_sched_t& dl_grants,
stack_interface_phy_lte::ul_sched_t& ul_grants,
srslte_mbsfn_cfg_t* mbsfn_cfg);
uint32_t get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]);

View File

@ -326,10 +326,10 @@ void cc_worker::set_config_dedicated(uint16_t rnti, asn1::rrc::phys_cfg_ded_s* d
}
}
void cc_worker::work_ul(srslte_ul_sf_cfg_t* ul_sf_cfg, stack_interface_phy_lte::ul_sched_t* ul_grants)
void cc_worker::work_ul(const srslte_ul_sf_cfg_t& ul_sf_cfg, stack_interface_phy_lte::ul_sched_t& ul_grants)
{
std::lock_guard<std::mutex> lock(mutex);
ul_sf = *ul_sf_cfg;
ul_sf = ul_sf_cfg;
log_h->step(ul_sf.tti);
for (auto& ue : ue_db) {
@ -340,38 +340,38 @@ void cc_worker::work_ul(srslte_ul_sf_cfg_t* ul_sf_cfg, stack_interface_phy_lte::
srslte_enb_ul_fft(&enb_ul);
// Decode pending UL grants for the tti they were scheduled
decode_pusch(ul_grants->pusch, ul_grants->nof_grants);
decode_pusch(ul_grants.pusch, ul_grants.nof_grants);
// Decode remaining PUCCH ACKs not associated with PUSCH transmission and SR signals
decode_pucch();
}
void cc_worker::work_dl(srslte_dl_sf_cfg_t* dl_sf_cfg,
stack_interface_phy_lte::dl_sched_t* dl_grants,
stack_interface_phy_lte::ul_sched_t* ul_grants,
void cc_worker::work_dl(const srslte_dl_sf_cfg_t& dl_sf_cfg,
stack_interface_phy_lte::dl_sched_t& dl_grants,
stack_interface_phy_lte::ul_sched_t& ul_grants,
srslte_mbsfn_cfg_t* mbsfn_cfg)
{
std::lock_guard<std::mutex> lock(mutex);
dl_sf = *dl_sf_cfg;
dl_sf = dl_sf_cfg;
// Put base signals (references, PBCH, PCFICH and PSS/SSS) into the resource grid
srslte_enb_dl_put_base(&enb_dl, &dl_sf);
// Put DL grants to resource grid. PDSCH data will be encoded as well.
if (dl_sf_cfg->sf_type == SRSLTE_SF_NORM) {
encode_pdcch_dl(dl_grants->pdsch, dl_grants->nof_grants);
encode_pdsch(dl_grants->pdsch, dl_grants->nof_grants);
if (dl_sf_cfg.sf_type == SRSLTE_SF_NORM) {
encode_pdcch_dl(dl_grants.pdsch, dl_grants.nof_grants);
encode_pdsch(dl_grants.pdsch, dl_grants.nof_grants);
} else {
if (mbsfn_cfg->enable) {
encode_pmch(dl_grants->pdsch, mbsfn_cfg);
encode_pmch(dl_grants.pdsch, mbsfn_cfg);
}
}
// Put UL grants to resource grid.
encode_pdcch_ul(ul_grants->pusch, ul_grants->nof_grants);
encode_pdcch_ul(ul_grants.pusch, ul_grants.nof_grants);
// Put pending PHICH HARQ ACK/NACK indications into subframe
encode_phich(ul_grants->phich, ul_grants->nof_phich);
encode_phich(ul_grants.phich, ul_grants.nof_phich);
// Generate signal and transmit
srslte_enb_dl_gen_signal(&enb_dl);

View File

@ -70,8 +70,16 @@ void phy_common::set_nof_workers(uint32_t nof_workers_)
void phy_common::reset()
{
bzero(ul_grants, sizeof(stack_interface_phy_lte::ul_sched_t) * TTIMOD_SZ);
bzero(dl_grants, sizeof(stack_interface_phy_lte::dl_sched_t) * TTIMOD_SZ);
for (auto& q : dl_grants) {
for (auto& g : q) {
g = {};
}
}
for (auto& q : ul_grants) {
for (auto& g : q) {
g = {};
}
}
}
bool phy_common::init(const phy_cell_cfg_list_t& cell_list_,
@ -93,7 +101,10 @@ bool phy_common::init(const phy_cell_cfg_list_t& cell_list_,
// Create grants
for (auto& q : dl_grants) {
q.resize(cell_list_.size());
q.resize(cell_list.size());
}
for (auto& q : ul_grants) {
q.resize(cell_list.size());
}
is_first_tx = true;

View File

@ -191,7 +191,7 @@ void sf_worker::work_imp()
// Process UL
for (uint32_t cc = 0; cc < cc_workers.size(); cc++) {
cc_workers[cc]->work_ul(&ul_sf, &phy->ul_grants[t_rx][cc]);
cc_workers[cc]->work_ul(ul_sf, phy->ul_grants[t_rx][cc]);
}
// Get DL scheduling for the TX TTI from MAC
@ -228,7 +228,7 @@ void sf_worker::work_imp()
// Process DL
for (uint32_t cc = 0; cc < cc_workers.size(); cc++) {
cc_workers[cc]->work_dl(&dl_sf, &phy->dl_grants[t_tx_dl][cc], &phy->ul_grants[t_tx_ul][cc], &mbsfn_cfg);
cc_workers[cc]->work_dl(dl_sf, phy->dl_grants[t_tx_dl][cc], phy->ul_grants[t_tx_ul][cc], &mbsfn_cfg);
}
// Get Transmission buffers