diff --git a/lib/include/srsran/interfaces/pdcp_interface_types.h b/lib/include/srsran/interfaces/pdcp_interface_types.h index 15ba28a54..cd7cdf7c0 100644 --- a/lib/include/srsran/interfaces/pdcp_interface_types.h +++ b/lib/include/srsran/interfaces/pdcp_interface_types.h @@ -156,6 +156,15 @@ public: // TODO: Support the following configurations // bool do_rohc; + + bool operator==(const pdcp_config_t& other) const + { + return bearer_id == other.bearer_id and rb_type == other.rb_type and tx_direction == other.tx_direction and + rx_direction == other.rx_direction and sn_len == other.sn_len and hdr_len_bytes == other.hdr_len_bytes and + t_reordering == other.t_reordering and discard_timer == other.discard_timer and rat == other.rat and + status_report_required == other.status_report_required; + } + bool operator!=(const pdcp_config_t& other) const { return not(*this == other); } }; // Specifies in which direction security (integrity and ciphering) are enabled for PDCP diff --git a/lib/src/pdcp/pdcp.cc b/lib/src/pdcp/pdcp.cc index 2c45a0de1..993e65c04 100644 --- a/lib/src/pdcp/pdcp.cc +++ b/lib/src/pdcp/pdcp.cc @@ -93,8 +93,7 @@ void pdcp::write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu) int pdcp::add_bearer(uint32_t lcid, pdcp_config_t cfg) { if (valid_lcid(lcid)) { - logger.error("Bearer %s already configured.", rrc->get_rb_name(lcid)); - return SRSRAN_ERROR; + return pdcp_array[lcid]->configure(cfg) ? SRSRAN_SUCCESS : SRSRAN_ERROR; } std::unique_ptr entity; diff --git a/lib/src/pdcp/pdcp_entity_lte.cc b/lib/src/pdcp/pdcp_entity_lte.cc index e562dcac7..5c73f6539 100644 --- a/lib/src/pdcp/pdcp_entity_lte.cc +++ b/lib/src/pdcp/pdcp_entity_lte.cc @@ -51,6 +51,15 @@ pdcp_entity_lte::~pdcp_entity_lte() bool pdcp_entity_lte::configure(const pdcp_config_t& cnfg_) { + if (active) { + // Already configured + if (cnfg_ != cfg) { + logger.error("Bearer reconfiguration not supported. LCID=%d.", rrc->get_rb_name(lcid)); + return false; + } + return true; + } + cfg = cnfg_; 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 197e7bb75..a7a7d8c62 100644 --- a/lib/src/pdcp/pdcp_entity_nr.cc +++ b/lib/src/pdcp/pdcp_entity_nr.cc @@ -43,6 +43,15 @@ void pdcp_entity_nr::reestablish() bool pdcp_entity_nr::configure(const pdcp_config_t& cnfg_) { + if (active) { + // Already configured + if (cnfg_ != cfg) { + logger.error("Bearer reconfiguration not supported. LCID=%d.", rrc->get_rb_name(lcid)); + return false; + } + return true; + } + cfg = cnfg_; window_size = 1 << (cfg.sn_len - 1);