diff --git a/srsenb/hdr/phy/cc_worker.h b/srsenb/hdr/phy/cc_worker.h index 3308d3beb..6877b6cc2 100644 --- a/srsenb/hdr/phy/cc_worker.h +++ b/srsenb/hdr/phy/cc_worker.h @@ -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]); diff --git a/srsenb/src/phy/cc_worker.cc b/srsenb/src/phy/cc_worker.cc index ab2870195..7bae4f023 100644 --- a/srsenb/src/phy/cc_worker.cc +++ b/srsenb/src/phy/cc_worker.cc @@ -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 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 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); diff --git a/srsenb/src/phy/phy_common.cc b/srsenb/src/phy/phy_common.cc index 2c749398f..ad2e3a39f 100644 --- a/srsenb/src/phy/phy_common.cc +++ b/srsenb/src/phy/phy_common.cc @@ -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; diff --git a/srsenb/src/phy/sf_worker.cc b/srsenb/src/phy/sf_worker.cc index a5964ba71..0603574a1 100644 --- a/srsenb/src/phy/sf_worker.cc +++ b/srsenb/src/phy/sf_worker.cc @@ -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