From 1dd211c91cb1a93161c8e72e9b58708a7e960a0f Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Thu, 14 Jan 2021 13:52:21 +0000 Subject: [PATCH] fix log initialization in sched_helpers.cc --- srsenb/hdr/stack/mac/sched_helpers.h | 2 + srsenb/hdr/stack/mac/sched_ue.h | 3 -- srsenb/src/stack/mac/sched_helpers.cc | 46 ++++++++++++++----- .../src/stack/mac/sched_ue_ctrl/sched_lch.cc | 18 +------- 4 files changed, 37 insertions(+), 32 deletions(-) diff --git a/srsenb/hdr/stack/mac/sched_helpers.h b/srsenb/hdr/stack/mac/sched_helpers.h index 4198aa49f..3006010f2 100644 --- a/srsenb/hdr/stack/mac/sched_helpers.h +++ b/srsenb/hdr/stack/mac/sched_helpers.h @@ -151,6 +151,8 @@ void log_dl_cc_results(srslte::log_ref log_h, uint32_t enb_cc_idx, const sched_i /// Logs PHICH contents void log_phich_cc_results(srslte::log_ref log_h, uint32_t enb_cc_idx, const sched_interface::ul_sched_res_t& result); +const char* to_string(sched_interface::ue_bearer_cfg_t::direction_t dir); + } // namespace srsenb #endif // SRSLTE_SCHED_HELPERS_H diff --git a/srsenb/hdr/stack/mac/sched_ue.h b/srsenb/hdr/stack/mac/sched_ue.h index 2c10649a9..409f260be 100644 --- a/srsenb/hdr/stack/mac/sched_ue.h +++ b/srsenb/hdr/stack/mac/sched_ue.h @@ -87,8 +87,6 @@ private: cc_st cc_state_ = cc_st::idle; }; -const char* to_string(sched_interface::ue_bearer_cfg_t::direction_t dir); - /** This class is designed to be thread-safe because it is called from workers through scheduler thread and from * higher layers and mac threads. */ @@ -257,7 +255,6 @@ private: bool phy_config_dedicated_enabled = false; tti_point current_tti; - std::array last_ttis; std::vector carriers; ///< map of UE CellIndex to carrier configuration std::vector enb_ue_cc_idx_map; }; diff --git a/srsenb/src/stack/mac/sched_helpers.cc b/srsenb/src/stack/mac/sched_helpers.cc index b1bd66de8..e76e65dd0 100644 --- a/srsenb/src/stack/mac/sched_helpers.cc +++ b/srsenb/src/stack/mac/sched_helpers.cc @@ -15,13 +15,13 @@ #include "srslte/srslog/bundled/fmt/format.h" #include -#define Info(fmt, ...) mac_log->error(fmt, ##__VA_ARGS__) -#define Error(fmt, ...) mac_log->error(fmt, ##__VA_ARGS__) +#define Debug(fmt, ...) srslte::logmap::get("MAC")->debug(fmt, ##__VA_ARGS__) +#define Info(fmt, ...) srslte::logmap::get("MAC")->info(fmt, ##__VA_ARGS__) +#define Warning(fmt, ...) srslte::logmap::get("MAC")->warning(fmt, ##__VA_ARGS__) +#define Error(fmt, ...) srslte::logmap::get("MAC")->error(fmt, ##__VA_ARGS__) namespace srsenb { -srslte::log_ref mac_log{"MAC"}; - using dl_sched_res_t = sched_interface::dl_sched_res_t; using dl_sched_data_t = sched_interface::dl_sched_data_t; using custom_mem_buffer = fmt::basic_memory_buffer; @@ -303,6 +303,8 @@ void generate_cce_location(srslte_regs_t* regs_, uint32_t get_aggr_level(uint32_t nof_bits, uint32_t dl_cqi, uint32_t max_aggr_lvl, uint32_t cell_nof_prb, bool use_tbs_index_alt) { + static srslte::log_ref cached_log = srslte::logmap::get("MAC"); + uint32_t l = 0; float max_coderate = srslte_cqi_to_coderate(dl_cqi, use_tbs_index_alt); float coderate; @@ -319,15 +321,19 @@ get_aggr_level(uint32_t nof_bits, uint32_t dl_cqi, uint32_t max_aggr_lvl, uint32 l++; } while (l < l_max && factor * coderate > max_coderate); - mac_log->debug("SCHED: CQI=%d, l=%d, nof_bits=%d, coderate=%.2f, max_coderate=%.2f\n", - dl_cqi, - l, - nof_bits, - coderate, - max_coderate); + cached_log->debug("SCHED: CQI=%d, l=%d, nof_bits=%d, coderate=%.2f, max_coderate=%.2f\n", + dl_cqi, + l, + nof_bits, + coderate, + max_coderate); return l; } +/******************************************************* + * sched_interface helper functions + *******************************************************/ + /// sanity check the UE CC configuration int check_ue_cfg_correctness(const sched_interface::ue_cfg_t& ue_cfg) { @@ -344,13 +350,13 @@ int check_ue_cfg_correctness(const sched_interface::ue_cfg_t& ue_cfg) continue; } if (not cc1.dl_cfg.cqi_report.periodic_configured and not cc1.dl_cfg.cqi_report.aperiodic_configured) { - mac_log->warning("SCHED: No CQI configuration was provided for UE scell index=%d \n", i); + Warning("SCHED: No CQI configuration was provided for UE scell index=%d \n", i); ret = SRSLTE_ERROR; } else if (cc1.dl_cfg.cqi_report.periodic_configured) { for (uint32_t j = i + 1; j < cc_list.size(); ++j) { if (cc_list[j].active and cc_list[j].dl_cfg.cqi_report.periodic_configured and cc_list[j].dl_cfg.cqi_report.pmi_idx == cc1.dl_cfg.cqi_report.pmi_idx) { - mac_log->warning( + Warning( "SCHED: The provided CQI configurations for UE scells %d and %d collide in time resources.\n", i, j); ret = SRSLTE_ERROR; } @@ -361,4 +367,20 @@ int check_ue_cfg_correctness(const sched_interface::ue_cfg_t& ue_cfg) return ret; } +const char* to_string(sched_interface::ue_bearer_cfg_t::direction_t dir) +{ + switch (dir) { + case sched_interface::ue_bearer_cfg_t::IDLE: + return "idle"; + case sched_interface::ue_bearer_cfg_t::BOTH: + return "bi-dir"; + case sched_interface::ue_bearer_cfg_t::DL: + return "DL"; + case sched_interface::ue_bearer_cfg_t::UL: + return "UL"; + default: + return "unrecognized direction"; + } +} + } // namespace srsenb diff --git a/srsenb/src/stack/mac/sched_ue_ctrl/sched_lch.cc b/srsenb/src/stack/mac/sched_ue_ctrl/sched_lch.cc index 9c7270a6c..6cf176596 100644 --- a/srsenb/src/stack/mac/sched_ue_ctrl/sched_lch.cc +++ b/srsenb/src/stack/mac/sched_ue_ctrl/sched_lch.cc @@ -11,7 +11,7 @@ */ #include "srsenb/hdr/stack/mac/sched_ue_ctrl/sched_lch.h" -#include "srsenb/hdr/stack/mac/sched_common.h" +#include "srsenb/hdr/stack/mac/sched_helpers.h" #include "srslte/common/log_helper.h" namespace srsenb { @@ -54,22 +54,6 @@ uint32_t get_ul_mac_sdu_size_with_overhead(uint32_t rlc_pdu_bytes) * *******************************************************/ -const char* to_string(sched_interface::ue_bearer_cfg_t::direction_t dir) -{ - switch (dir) { - case sched_interface::ue_bearer_cfg_t::IDLE: - return "idle"; - case sched_interface::ue_bearer_cfg_t::BOTH: - return "bi-dir"; - case sched_interface::ue_bearer_cfg_t::DL: - return "DL"; - case sched_interface::ue_bearer_cfg_t::UL: - return "UL"; - default: - return "unrecognized direction"; - } -} - void lch_ue_manager::set_cfg(const sched_interface::ue_cfg_t& cfg) { for (uint32_t lcid = 0; lcid < sched_interface::MAX_LC; lcid++) {