From ce3c808a169ce12bff362e85c6a2f2dbcec4be4a Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 26 May 2021 12:50:16 +0200 Subject: [PATCH] Reviewed SRSENB PHY unused variables and log messages --- srsenb/hdr/phy/lte/sf_worker.h | 4 +--- srsenb/hdr/phy/txrx.h | 2 -- srsenb/src/phy/lte/cc_worker.cc | 9 ++++----- srsenb/src/phy/lte/sf_worker.cc | 18 ++++++------------ srsenb/src/phy/phy.cc | 5 +++-- srsenb/src/phy/phy_ue_db.cc | 6 ++++-- srsenb/src/phy/txrx.cc | 9 ++------- 7 files changed, 20 insertions(+), 33 deletions(-) diff --git a/srsenb/hdr/phy/lte/sf_worker.h b/srsenb/hdr/phy/lte/sf_worker.h index 4830fea55..b350f4939 100644 --- a/srsenb/hdr/phy/lte/sf_worker.h +++ b/srsenb/hdr/phy/lte/sf_worker.h @@ -32,7 +32,7 @@ public: void init(phy_common* phy); cf_t* get_buffer_rx(uint32_t cc_idx, uint32_t antenna_idx); - void set_time(uint32_t tti_, uint32_t tx_worker_cnt_, const srsran::rf_timestamp_t& tx_time_); + void set_time(uint32_t tti_, const srsran::rf_timestamp_t& tx_time_); int add_rnti(uint16_t rnti, uint32_t cc_idx); void rem_rnti(uint16_t rnti); @@ -60,8 +60,6 @@ private: std::mutex work_mutex; uint32_t tti_rx = 0, tti_tx_dl = 0, tti_tx_ul = 0; - uint32_t t_rx = 0, t_tx_dl = 0, t_tx_ul = 0; - uint32_t tx_worker_cnt = 0; srsran::rf_timestamp_t tx_time = {}; std::vector > cc_workers; diff --git a/srsenb/hdr/phy/txrx.h b/srsenb/hdr/phy/txrx.h index 18d4e8400..4b305c184 100644 --- a/srsenb/hdr/phy/txrx.h +++ b/srsenb/hdr/phy/txrx.h @@ -52,8 +52,6 @@ private: // Main system TTI counter uint32_t tti = 0; - uint32_t tx_worker_cnt = 0; - uint32_t nof_workers = 0; std::atomic running; }; diff --git a/srsenb/src/phy/lte/cc_worker.cc b/srsenb/src/phy/lte/cc_worker.cc index 2b5227f97..25a93fffe 100644 --- a/srsenb/src/phy/lte/cc_worker.cc +++ b/srsenb/src/phy/lte/cc_worker.cc @@ -187,8 +187,6 @@ void cc_worker::rem_rnti(uint16_t rnti) if (ue_db.count(rnti)) { delete ue_db[rnti]; ue_db.erase(rnti); - } else { - Error("Removing user: rnti=0x%x does not exist\n", rnti); } } @@ -273,7 +271,8 @@ void cc_worker::decode_pusch_rnti(stack_interface_phy_lte::ul_sched_grant_t& ul_ // Get UE configuration if (phy->ue_db.get_ul_config(rnti, cc_idx, ul_cfg) < SRSRAN_SUCCESS) { - Error("Error retrieving UL configuration for RNTI %x and CC %d", rnti, cc_idx); + // It could happen that the UL configuration is missing due to intra-enb HO which is not an error + Info("Failed retrieving UL configuration for cc=%d rnti=0x%x", cc_idx, rnti); return; } @@ -458,7 +457,7 @@ int cc_worker::encode_pdcch_ul(stack_interface_phy_lte::ul_sched_grant_t* grants srsran_dci_cfg_t dci_cfg = {}; if (phy->ue_db.get_dci_ul_config(grants[i].dci.rnti, cc_idx, dci_cfg) < SRSRAN_SUCCESS) { - Error("Error retrieving DCI UL configuration for RNTI %x, CC %d", grants[i].dci.rnti, cc_idx); + Error("Error retrieving DCI UL configuration for cc=%d rnti=0x%x", grants[i].dci.rnti, cc_idx); continue; } @@ -479,7 +478,7 @@ int cc_worker::encode_pdcch_ul(stack_interface_phy_lte::ul_sched_grant_t* grants if (logger.info.enabled()) { char str[512]; srsran_dci_ul_info(&grants[i].dci, str, 512); - logger.info("PDCCH: cc=%d, %s, tti_tx_dl=%d", cc_idx, str, tti_tx_dl); + logger.info("PDCCH: cc=%d, rnti=0x%x, %s, tti_tx_dl=%d", cc_idx, grants[i].dci.rnti, str, tti_tx_dl); } } } diff --git a/srsenb/src/phy/lte/sf_worker.cc b/srsenb/src/phy/lte/sf_worker.cc index 6ab897427..d95c43d9d 100644 --- a/srsenb/src/phy/lte/sf_worker.cc +++ b/srsenb/src/phy/lte/sf_worker.cc @@ -101,17 +101,12 @@ cf_t* sf_worker::get_buffer_rx(uint32_t cc_idx, uint32_t antenna_idx) return cc_workers[cc_idx]->get_buffer_rx(antenna_idx); } -void sf_worker::set_time(uint32_t tti_, uint32_t tx_worker_cnt_, const srsran::rf_timestamp_t& tx_time_) +void sf_worker::set_time(uint32_t tti_, const srsran::rf_timestamp_t& tx_time_) { tti_rx = tti_; tti_tx_dl = TTI_ADD(tti_rx, FDD_HARQ_DELAY_UL_MS); tti_tx_ul = TTI_RX_ACK(tti_rx); - t_tx_dl = TTIMOD(tti_tx_dl); - t_rx = TTIMOD(tti_rx); - t_tx_ul = TTIMOD(tti_tx_ul); - - tx_worker_cnt = tx_worker_cnt_; tx_time.copy(tx_time_); for (auto& w : cc_workers) { @@ -167,9 +162,9 @@ void sf_worker::work_imp() srsran_sf_t sf_type = phy->is_mbsfn_sf(&mbsfn_cfg, tti_tx_dl) ? SRSRAN_SF_MBSFN : SRSRAN_SF_NORM; // Uplink grants to receive this TTI - stack_interface_phy_lte::ul_sched_list_t ul_grants = phy->get_ul_grants(t_rx); + stack_interface_phy_lte::ul_sched_list_t ul_grants = phy->get_ul_grants(tti_rx); // Uplink grants to transmit this tti and receive in the future - stack_interface_phy_lte::ul_sched_list_t ul_grants_tx = phy->get_ul_grants(t_tx_ul); + stack_interface_phy_lte::ul_sched_list_t ul_grants_tx = phy->get_ul_grants(tti_tx_ul); // Downlink grants to transmit this TTI stack_interface_phy_lte::dl_sched_list_t dl_grants(phy->get_nof_carriers_lte()); @@ -184,8 +179,8 @@ void sf_worker::work_imp() ul_sf.tti = tti_rx; // Set UL grant availability prior to any UL processing - if (phy->ue_db.set_ul_grant_available(tti_rx, ul_grants)) { - Error("Error setting UL grants. Some grant's RNTI does not exist."); + if (phy->ue_db.set_ul_grant_available(tti_rx, ul_grants) < SRSRAN_SUCCESS) { + Info("Failed setting UL grants. Some grant's RNTI does not exist."); } // Process UL @@ -235,8 +230,7 @@ void sf_worker::work_imp() } // Save grants - phy->set_ul_grants(t_tx_ul, ul_grants_tx); - phy->set_ul_grants(t_rx, ul_grants); + phy->set_ul_grants(tti_tx_ul, ul_grants_tx); Debug("Sending to radio"); tx_buffer.set_nof_samples(SRSRAN_SF_LEN_PRB(phy->get_nof_prb(0))); diff --git a/srsenb/src/phy/phy.cc b/srsenb/src/phy/phy.cc index 8bbe4f712..1db96641c 100644 --- a/srsenb/src/phy/phy.cc +++ b/srsenb/src/phy/phy.cc @@ -105,9 +105,10 @@ int phy::init(const phy_args_t& args, } // Add PHY lib log. - srslog::basic_levels log_lvl = srslog::str_to_basic_level(args.log.phy_lib_level); + srslog::basic_levels lib_log_lvl = srslog::str_to_basic_level(args.log.phy_lib_level); + srslog::basic_levels log_lvl = srslog::str_to_basic_level(args.log.phy_level); - phy_lib_log.set_level(log_lvl); + phy_lib_log.set_level(lib_log_lvl); phy_lib_log.set_hex_dump_max_size(args.log.phy_hex_limit); if (log_lvl != srslog::basic_levels::none) { srsran_phy_log_register_handler(this, srsran_phy_handler); diff --git a/srsenb/src/phy/phy_ue_db.cc b/srsenb/src/phy/phy_ue_db.cc index 5988f164e..0932edb33 100644 --- a/srsenb/src/phy/phy_ue_db.cc +++ b/srsenb/src/phy/phy_ue_db.cc @@ -740,6 +740,7 @@ int phy_ue_db::get_last_ul_tb(uint16_t rnti, uint32_t enb_cc_idx, uint32_t pid, int phy_ue_db::set_ul_grant_available(uint32_t tti, const stack_interface_phy_lte::ul_sched_list_t& ul_sched_list) { + int ret = SRSRAN_SUCCESS; std::lock_guard lock(mutex); // Reset all available grants flags for the given TTI @@ -757,12 +758,13 @@ int phy_ue_db::set_ul_grant_available(uint32_t tti, const stack_interface_phy_lt uint16_t rnti = ul_sched_grant.dci.rnti; // Check that eNb Cell/Carrier is active for the given RNTI if (_assert_active_enb_cc(rnti, enb_cc_idx) != SRSRAN_SUCCESS) { - return SRSRAN_ERROR; + ret = SRSRAN_ERROR; + continue; } // Rise Grant available flag ue_db[rnti].cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].is_grant_available[tti] = true; } } - return SRSRAN_SUCCESS; + return ret; } diff --git a/srsenb/src/phy/txrx.cc b/srsenb/src/phy/txrx.cc index 03f1f0935..d78393550 100644 --- a/srsenb/src/phy/txrx.cc +++ b/srsenb/src/phy/txrx.cc @@ -53,11 +53,8 @@ bool txrx::init(stack_interface_phy_lte* stack_, nr_workers = nr_workers_; worker_com = worker_com_; prach = prach_; - tx_worker_cnt = 0; running = true; - nof_workers = lte_workers->get_nof_workers(); - // Instantiate UL channel emulator if (worker_com->params.ul_channel_args.enable) { ul_channel = srsran::channel_ptr( @@ -167,15 +164,13 @@ void txrx::run_thread() // Compute TX time: Any transmission happens in TTI+4 thus advance 4 ms the reception time timestamp.add(FDD_HARQ_DELAY_UL_MS * 1e-3); - Debug("Setting TTI=%d, tx_mutex=%d, tx_time=%ld:%f to worker %d", + Debug("Setting TTI=%d, tx_time=%ld:%f to worker %d", tti, - tx_worker_cnt, timestamp.get(0).full_secs, timestamp.get(0).frac_secs, lte_worker->get_id()); - lte_worker->set_time(tti, tx_worker_cnt, timestamp); - tx_worker_cnt = (tx_worker_cnt + 1) % nof_workers; + lte_worker->set_time(tti, timestamp); // Trigger prach worker execution for (uint32_t cc = 0; cc < worker_com->get_nof_carriers_lte(); cc++) {