SRSENB: fix segmentation fault

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 9a853d8692
commit 31dffb785f

@ -54,10 +54,10 @@ public:
void start_plot(); void start_plot();
void set_config_dedicated(uint16_t rnti, asn1::rrc::phys_cfg_ded_s* dedicated); 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_ul(const 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, 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::dl_sched_t& dl_grants,
stack_interface_phy_lte::ul_sched_t* ul_grants, stack_interface_phy_lte::ul_sched_t& ul_grants,
srslte_mbsfn_cfg_t* mbsfn_cfg); srslte_mbsfn_cfg_t* mbsfn_cfg);
uint32_t get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]); uint32_t get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]);

@ -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); std::lock_guard<std::mutex> lock(mutex);
ul_sf = *ul_sf_cfg; ul_sf = ul_sf_cfg;
log_h->step(ul_sf.tti); log_h->step(ul_sf.tti);
for (auto& ue : ue_db) { 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); srslte_enb_ul_fft(&enb_ul);
// Decode pending UL grants for the tti they were scheduled // 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 remaining PUCCH ACKs not associated with PUSCH transmission and SR signals
decode_pucch(); decode_pucch();
} }
void cc_worker::work_dl(srslte_dl_sf_cfg_t* dl_sf_cfg, 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::dl_sched_t& dl_grants,
stack_interface_phy_lte::ul_sched_t* ul_grants, stack_interface_phy_lte::ul_sched_t& ul_grants,
srslte_mbsfn_cfg_t* mbsfn_cfg) srslte_mbsfn_cfg_t* mbsfn_cfg)
{ {
std::lock_guard<std::mutex> lock(mutex); 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 // Put base signals (references, PBCH, PCFICH and PSS/SSS) into the resource grid
srslte_enb_dl_put_base(&enb_dl, &dl_sf); srslte_enb_dl_put_base(&enb_dl, &dl_sf);
// Put DL grants to resource grid. PDSCH data will be encoded as well. // Put DL grants to resource grid. PDSCH data will be encoded as well.
if (dl_sf_cfg->sf_type == SRSLTE_SF_NORM) { if (dl_sf_cfg.sf_type == SRSLTE_SF_NORM) {
encode_pdcch_dl(dl_grants->pdsch, dl_grants->nof_grants); encode_pdcch_dl(dl_grants.pdsch, dl_grants.nof_grants);
encode_pdsch(dl_grants->pdsch, dl_grants->nof_grants); encode_pdsch(dl_grants.pdsch, dl_grants.nof_grants);
} else { } else {
if (mbsfn_cfg->enable) { if (mbsfn_cfg->enable) {
encode_pmch(dl_grants->pdsch, mbsfn_cfg); encode_pmch(dl_grants.pdsch, mbsfn_cfg);
} }
} }
// Put UL grants to resource grid. // 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 // 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 // Generate signal and transmit
srslte_enb_dl_gen_signal(&enb_dl); srslte_enb_dl_gen_signal(&enb_dl);

@ -70,8 +70,16 @@ void phy_common::set_nof_workers(uint32_t nof_workers_)
void phy_common::reset() void phy_common::reset()
{ {
bzero(ul_grants, sizeof(stack_interface_phy_lte::ul_sched_t) * TTIMOD_SZ); for (auto& q : dl_grants) {
bzero(dl_grants, sizeof(stack_interface_phy_lte::dl_sched_t) * TTIMOD_SZ); 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_, 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 // Create grants
for (auto& q : dl_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; is_first_tx = true;

@ -191,7 +191,7 @@ void sf_worker::work_imp()
// Process UL // Process UL
for (uint32_t cc = 0; cc < cc_workers.size(); cc++) { 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 // Get DL scheduling for the TX TTI from MAC
@ -228,7 +228,7 @@ void sf_worker::work_imp()
// Process DL // Process DL
for (uint32_t cc = 0; cc < cc_workers.size(); cc++) { 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 // Get Transmission buffers

Loading…
Cancel
Save