diff --git a/lib/include/srsran/interfaces/pdcp_interface_types.h b/lib/include/srsran/interfaces/pdcp_interface_types.h index cd7cdf7c0..6507e14ba 100644 --- a/lib/include/srsran/interfaces/pdcp_interface_types.h +++ b/lib/include/srsran/interfaces/pdcp_interface_types.h @@ -165,6 +165,8 @@ public: status_report_required == other.status_report_required; } bool operator!=(const pdcp_config_t& other) const { return not(*this == other); } + + std::string get_rb_name() const { return (rb_type == PDCP_RB_IS_DRB ? "DRB" : "SRB") + std::to_string(bearer_id); } }; // Specifies in which direction security (integrity and ciphering) are enabled for PDCP diff --git a/lib/src/pdcp/pdcp_entity_lte.cc b/lib/src/pdcp/pdcp_entity_lte.cc index b0f3c55f9..4f1efdafa 100644 --- a/lib/src/pdcp/pdcp_entity_lte.cc +++ b/lib/src/pdcp/pdcp_entity_lte.cc @@ -61,8 +61,7 @@ bool pdcp_entity_lte::configure(const pdcp_config_t& cnfg_) } cfg = cnfg_; - rb_name = cfg.rb_type == PDCP_RB_IS_DRB ? "DRB" : "SRB"; - rb_name += std::to_string(cfg.bearer_id); + rb_name = cfg.get_rb_name(); maximum_pdcp_sn = (1u << cfg.sn_len) - 1u; st.last_submitted_pdcp_rx_sn = maximum_pdcp_sn; diff --git a/lib/src/pdcp/pdcp_entity_nr.cc b/lib/src/pdcp/pdcp_entity_nr.cc index ba354599d..f447816c9 100644 --- a/lib/src/pdcp/pdcp_entity_nr.cc +++ b/lib/src/pdcp/pdcp_entity_nr.cc @@ -37,7 +37,7 @@ pdcp_entity_nr::~pdcp_entity_nr() {} // Reestablishment procedure: 38.323 5.2 void pdcp_entity_nr::reestablish() { - logger.info("Re-establish %s with bearer ID: %d", rrc->get_rb_name(lcid), cfg.bearer_id); + logger.info("Re-establish %s with bearer ID: %d", rb_name.c_str(), cfg.bearer_id); // TODO } @@ -46,13 +46,14 @@ bool pdcp_entity_nr::configure(const pdcp_config_t& cnfg_) if (active) { // Already configured if (cnfg_ != cfg) { - logger.error("Bearer reconfiguration not supported. LCID=%s.", rrc->get_rb_name(lcid)); + logger.error("Bearer reconfiguration not supported. LCID=%s.", rb_name.c_str()); return false; } return true; } cfg = cnfg_; + rb_name = cfg.get_rb_name(); window_size = 1 << (cfg.sn_len - 1); // Timers @@ -70,7 +71,7 @@ bool pdcp_entity_nr::configure(const pdcp_config_t& cnfg_) void pdcp_entity_nr::reset() { active = false; - logger.debug("Reset %s", rrc->get_rb_name(lcid)); + logger.debug("Reset %s", rb_name.c_str()); } // SDAP/RRC interface @@ -80,7 +81,7 @@ void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, int sn) logger.info(sdu->msg, sdu->N_bytes, "TX %s SDU, integrity=%s, encryption=%s", - rrc->get_rb_name(lcid), + rb_name.c_str(), srsran_direction_text[integrity_direction], srsran_direction_text[encryption_direction]); @@ -136,7 +137,7 @@ void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu) logger.info(pdu->msg, pdu->N_bytes, "RX %s PDU (%d B), integrity=%s, encryption=%s", - rrc->get_rb_name(lcid), + rb_name.c_str(), pdu->N_bytes, srsran_direction_text[integrity_direction], srsran_direction_text[encryption_direction]);