enb,sched: improve sched ue buffer manager to show rnti in logs

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

@ -36,7 +36,7 @@ protected:
constexpr static uint32_t pbr_infinity = -1;
public:
explicit ue_buffer_manager(srslog::basic_logger& logger_);
explicit ue_buffer_manager(uint16_t rnti, srslog::basic_logger& logger_);
// Bearer configuration
void config_lcid(uint32_t lcid, const mac_lc_ch_cfg_t& bearer_cfg);
@ -46,6 +46,7 @@ public:
void dl_buffer_state(uint8_t lcid, uint32_t tx_queue, uint32_t prio_tx_queue);
// Configuration getters
uint16_t get_rnti() const { return rnti; }
bool is_bearer_active(uint32_t lcid) const { return get_cfg(lcid).is_active(); }
bool is_bearer_ul(uint32_t lcid) const { return get_cfg(lcid).is_ul(); }
bool is_bearer_dl(uint32_t lcid) const { return get_cfg(lcid).is_dl(); }
@ -78,6 +79,7 @@ public:
protected:
srslog::basic_logger& logger;
uint16_t rnti;
struct logical_channel {
mac_lc_ch_cfg_t cfg;

@ -26,7 +26,7 @@ class lch_ue_manager : private ue_buffer_manager<false>
using base_type = ue_buffer_manager<false>;
public:
lch_ue_manager() : ue_buffer_manager(srslog::fetch_basic_logger("MAC")) {}
explicit lch_ue_manager(uint16_t rnti) : ue_buffer_manager(rnti, srslog::fetch_basic_logger("MAC")) {}
void set_cfg(const sched_interface::ue_cfg_t& cfg_);
void new_tti();

@ -18,7 +18,7 @@
namespace srsenb {
template <bool isNR>
ue_buffer_manager<isNR>::ue_buffer_manager(srslog::basic_logger& logger_) : logger(logger_)
ue_buffer_manager<isNR>::ue_buffer_manager(uint16_t rnti_, srslog::basic_logger& logger_) : logger(logger_), rnti(rnti_)
{
std::fill(lcg_bsr.begin(), lcg_bsr.end(), 0);
}
@ -27,11 +27,12 @@ template <bool isNR>
void ue_buffer_manager<isNR>::config_lcid(uint32_t lcid, const mac_lc_ch_cfg_t& bearer_cfg)
{
if (not is_lcid_valid(lcid)) {
logger.warning("Configuring bearer with invalid logical channel id=%d", lcid);
logger.warning("SCHED: Configuring rnti=0x%x bearer with invalid lcid=%d", rnti, lcid);
return;
}
if (not is_lcg_valid(bearer_cfg.group)) {
logger.warning("Configuring bearer with invalid logical channel group id=%d", bearer_cfg.group);
logger.warning(
"SCHED: Configuring rnti=0x%x bearer with invalid logical channel group id=%d", rnti, bearer_cfg.group);
return;
}
@ -45,7 +46,8 @@ 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: bearer configured: lcid=%d, mode=%s, prio=%d, lcg=%d",
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,
@ -99,7 +101,7 @@ template <bool isNR>
void ue_buffer_manager<isNR>::ul_bsr(uint32_t lcg_id, uint32_t val)
{
if (not is_lcg_valid(lcg_id)) {
logger.warning("The provided logical channel group id=%d is not valid", lcg_id);
logger.warning("SCHED: The provided lcg_id=%d for rnti=0x%x is not valid", lcg_id, rnti);
return;
}
lcg_bsr[lcg_id] = val;
@ -107,7 +109,8 @@ void ue_buffer_manager<isNR>::ul_bsr(uint32_t lcg_id, uint32_t val)
if (logger.debug.enabled()) {
fmt::memory_buffer str_buffer;
fmt::format_to(str_buffer, "{}", lcg_bsr);
logger.debug("SCHED: lcg_id=%d, bsr=%d. Current state=%s", lcg_id, val, srsran::to_c_str(str_buffer));
logger.debug(
"SCHED: rnti=0x%x, lcg_id=%d, bsr=%d. Current state=%s", rnti, lcg_id, val, srsran::to_c_str(str_buffer));
}
}
@ -120,9 +123,9 @@ void ue_buffer_manager<isNR>::dl_buffer_state(uint8_t lcid, uint32_t tx_queue, u
}
if (lcid <= MAX_SRB_LC_ID and
(channels[lcid].buf_tx != (int)tx_queue or channels[lcid].buf_prio_tx != (int)prio_tx_queue)) {
logger.info("SCHED: DL lcid=%d buffer_state=%d,%d", lcid, tx_queue, prio_tx_queue);
logger.info("SCHED: rnti=0x%x DL lcid=%d buffer_state=%d,%d", rnti, lcid, tx_queue, prio_tx_queue);
} else {
logger.debug("SCHED: DL lcid=%d buffer_state=%d,%d", lcid, tx_queue, prio_tx_queue);
logger.debug("SCHED: rnti=0x%x DL lcid=%d buffer_state=%d,%d", rnti, lcid, tx_queue, prio_tx_queue);
}
channels[lcid].buf_prio_tx = prio_tx_queue;
channels[lcid].buf_tx = tx_queue;

@ -78,7 +78,7 @@ slot_ue ue_carrier::try_reserve(slot_point pdcch_slot, uint32_t dl_pending_bytes
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ue::ue(uint16_t rnti_, const ue_cfg_t& cfg, const sched_params& sched_cfg_) :
rnti(rnti_), sched_cfg(sched_cfg_), buffers(srslog::fetch_basic_logger(sched_cfg_.sched_cfg.logger_name))
rnti(rnti_), sched_cfg(sched_cfg_), buffers(rnti_, srslog::fetch_basic_logger(sched_cfg_.sched_cfg.logger_name))
{
set_cfg(cfg);
}

@ -33,7 +33,7 @@ namespace srsenb {
*******************************************************/
sched_ue::sched_ue(uint16_t rnti_, const std::vector<sched_cell_params_t>& cell_list_params_, const ue_cfg_t& cfg_) :
logger(srslog::fetch_basic_logger("MAC")), rnti(rnti_)
logger(srslog::fetch_basic_logger("MAC")), rnti(rnti_), lch_handler(rnti_)
{
cells.reserve(cell_list_params_.size());
for (auto& c : cell_list_params_) {

@ -78,15 +78,18 @@ void lch_ue_manager::new_tti()
void lch_ue_manager::ul_buffer_add(uint8_t lcid, uint32_t bytes)
{
if (lcid >= sched_interface::MAX_LC) {
logger.warning("The provided lcid=%d is not valid", lcid);
logger.warning("SCHED: The provided lcid=%d for rnti=0x%x is not valid", lcid, rnti);
return;
}
lcg_bsr[channels[lcid].cfg.group] += bytes;
if (logger.debug.enabled()) {
fmt::memory_buffer str_buffer;
fmt::format_to(str_buffer, "{}", get_bsr_state());
logger.debug(
"SCHED: UL buffer update=%d, lcg_id=%d, bsr=%s", bytes, channels[lcid].cfg.group, srsran::to_c_str(str_buffer));
logger.debug("SCHED: rnti=0x%x UL buffer update=%d, lcg_id=%d, bsr=%s",
rnti,
bytes,
channels[lcid].cfg.group,
srsran::to_c_str(str_buffer));
}
}

@ -76,7 +76,7 @@ int test_newtx_until_empty(srsenb::lch_ue_manager& lch_handler, int lcid, uint32
int test_lc_ch_pbr_infinity()
{
srsenb::lch_ue_manager lch_handler;
srsenb::lch_ue_manager lch_handler{0x46};
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();
ue_cfg = generate_setup_ue_cfg(ue_cfg);
@ -125,7 +125,7 @@ int test_lc_ch_pbr_infinity()
int test_lc_ch_pbr_finite()
{
srsenb::lch_ue_manager lch_handler;
srsenb::lch_ue_manager lch_handler{0x46};
sched_interface::dl_sched_pdu_t pdu;
srsenb::sched_interface::ue_cfg_t ue_cfg = generate_default_ue_cfg();

Loading…
Cancel
Save