enb,sched: log lcid configurations in scheduler in a single log line

master
Francisco 3 years ago committed by Francisco Paisana
parent f2818d0504
commit f0a48d47b3

@ -14,6 +14,7 @@
#define SRSRAN_UE_BUFFER_MANAGER_H
#include "sched_config.h"
#include "srsran/adt/span.h"
#include "srsran/common/common_lte.h"
#include "srsran/common/common_nr.h"
#include "srsran/srslog/srslog.h"
@ -39,6 +40,7 @@ public:
explicit ue_buffer_manager(uint16_t rnti, srslog::basic_logger& logger_);
// Bearer configuration
void config_lcids(srsran::const_span<mac_lc_ch_cfg_t> bearer_cfg_list);
void config_lcid(uint32_t lcid, const mac_lc_ch_cfg_t& bearer_cfg);
// Buffer Status update
@ -78,6 +80,8 @@ public:
static bool is_lcg_valid(uint32_t lcg) { return lcg <= MAX_LCG_ID; }
protected:
bool config_lcid_internal(uint32_t lcid, const mac_lc_ch_cfg_t& bearer_cfg);
srslog::basic_logger& logger;
uint16_t rnti;

@ -11,6 +11,7 @@
*/
#include "srsenb/hdr/stack/mac/common/ue_buffer_manager.h"
#include "srsran/adt/bounded_vector.h"
#include "srsran/common/string_helpers.h"
#include "srsran/srslog/bundled/fmt/format.h"
#include "srsran/srslog/bundled/fmt/ranges.h"
@ -23,17 +24,60 @@ ue_buffer_manager<isNR>::ue_buffer_manager(uint16_t rnti_, srslog::basic_logger&
std::fill(lcg_bsr.begin(), lcg_bsr.end(), 0);
}
template <bool isNR>
void ue_buffer_manager<isNR>::config_lcids(srsran::const_span<mac_lc_ch_cfg_t> bearer_cfg_list)
{
bool log_enabled = logger.info.enabled();
srsran::bounded_vector<uint32_t, MAX_LC_ID> changed_list;
for (uint32_t lcid = 0; is_lcid_valid(lcid); ++lcid) {
if (log_enabled and config_lcid_internal(lcid, bearer_cfg_list[lcid])) {
changed_list.push_back(lcid);
}
}
// Log changed LCID configurations
if (not changed_list.empty()) {
fmt::memory_buffer fmtbuf;
for (uint32_t i = 0; i < changed_list.size(); ++i) {
uint32_t lcid = changed_list[i];
fmt::format_to(fmtbuf,
"{}{{lcid={}, mode={}, prio={}, lcg={}}}",
i > 0 ? ", " : "",
lcid,
to_string(channels[lcid].cfg.direction),
channels[lcid].cfg.priority,
channels[lcid].cfg.group);
}
logger.info("SCHED: rnti=0x%x, new lcid configuration: [%s]", rnti, srsran::to_c_str(fmtbuf));
}
}
template <bool isNR>
void ue_buffer_manager<isNR>::config_lcid(uint32_t lcid, const mac_lc_ch_cfg_t& bearer_cfg)
{
bool cfg_changed = config_lcid_internal(lcid, bearer_cfg);
if (cfg_changed) {
logger.info("SCHED: rnti=0x%x, lcid=%d configured: mode=%s, prio=%d, lcg=%d",
rnti,
lcid,
to_string(channels[lcid].cfg.direction),
channels[lcid].cfg.priority,
channels[lcid].cfg.group);
}
}
template <bool isNR>
bool ue_buffer_manager<isNR>::config_lcid_internal(uint32_t lcid, const mac_lc_ch_cfg_t& bearer_cfg)
{
if (not is_lcid_valid(lcid)) {
logger.warning("SCHED: Configuring rnti=0x%x bearer with invalid lcid=%d", rnti, lcid);
return;
return false;
}
if (not is_lcg_valid(bearer_cfg.group)) {
logger.warning(
"SCHED: Configuring rnti=0x%x bearer with invalid logical channel group id=%d", rnti, bearer_cfg.group);
return;
return false;
}
// update bearer config
@ -46,13 +90,9 @@ void ue_buffer_manager<isNR>::config_lcid(uint32_t lcid, const mac_lc_ch_cfg_t&
channels[lcid].bucket_size = channels[lcid].cfg.bsd * channels[lcid].cfg.pbr;
channels[lcid].Bj = 0;
}
logger.info("SCHED: rnti=0x%x bearer configured: lcid=%d, mode=%s, prio=%d, lcg=%d",
rnti,
lcid,
to_string(channels[lcid].cfg.direction),
channels[lcid].cfg.priority,
channels[lcid].cfg.group);
return true;
}
return false;
}
template <bool isNR>

@ -96,9 +96,7 @@ void ue::set_cfg(const ue_cfg_t& cfg)
}
}
for (uint32_t lcid = 0; lcid < cfg.ue_bearers.size(); ++lcid) {
buffers.config_lcid(lcid, cfg.ue_bearers[lcid]);
}
buffers.config_lcids(cfg.ue_bearers);
}
void ue::new_slot(slot_point pdcch_slot)

@ -57,9 +57,7 @@ uint32_t get_ul_mac_sdu_size_with_overhead(uint32_t rlc_pdu_bytes)
void lch_ue_manager::set_cfg(const sched_interface::ue_cfg_t& cfg)
{
for (uint32_t lcid = 0; is_lcid_valid(lcid); lcid++) {
config_lcid(lcid, cfg.ue_bearers[lcid]);
}
config_lcids(cfg.ue_bearers);
}
void lch_ue_manager::new_tti()

Loading…
Cancel
Save