diff --git a/lib/include/srsran/interfaces/enb_pdcp_interfaces.h b/lib/include/srsran/interfaces/enb_pdcp_interfaces.h index e49604591..5b5a907c2 100644 --- a/lib/include/srsran/interfaces/enb_pdcp_interfaces.h +++ b/lib/include/srsran/interfaces/enb_pdcp_interfaces.h @@ -31,6 +31,7 @@ public: class pdcp_interface_rrc { public: + virtual void set_enabled(uint16_t rnti, uint32_t lcid, bool enable) = 0; virtual void reset(uint16_t rnti) = 0; virtual void add_user(uint16_t rnti) = 0; virtual void rem_user(uint16_t rnti) = 0; diff --git a/lib/include/srsran/interfaces/ue_pdcp_interfaces.h b/lib/include/srsran/interfaces/ue_pdcp_interfaces.h index bdcf4c40f..65d825cfc 100644 --- a/lib/include/srsran/interfaces/ue_pdcp_interfaces.h +++ b/lib/include/srsran/interfaces/ue_pdcp_interfaces.h @@ -24,6 +24,7 @@ public: virtual void reestablish() = 0; virtual void reestablish(uint32_t lcid) = 0; virtual void reset() = 0; + virtual void set_enabled(uint32_t lcid, bool enabled) = 0; virtual void write_sdu(uint32_t lcid, srsran::unique_byte_buffer_t sdu, int sn = -1) = 0; virtual int add_bearer(uint32_t lcid, srsran::pdcp_config_t cnfg) = 0; virtual void del_bearer(uint32_t lcid) = 0; diff --git a/lib/include/srsran/upper/pdcp.h b/lib/include/srsran/upper/pdcp.h index d7e1ff918..88ebf3ca5 100644 --- a/lib/include/srsran/upper/pdcp.h +++ b/lib/include/srsran/upper/pdcp.h @@ -36,6 +36,7 @@ public: void reestablish() override; void reestablish(uint32_t lcid) override; void reset() override; + void set_enabled(uint32_t lcid, bool enabled) override; void write_sdu(uint32_t lcid, unique_byte_buffer_t sdu, int sn = -1) override; void write_sdu_mch(uint32_t lcid, unique_byte_buffer_t sdu); int add_bearer(uint32_t lcid, pdcp_config_t cnfg) override; diff --git a/lib/include/srsran/upper/pdcp_entity_base.h b/lib/include/srsran/upper/pdcp_entity_base.h index 75bb8f0b8..837b370fd 100644 --- a/lib/include/srsran/upper/pdcp_entity_base.h +++ b/lib/include/srsran/upper/pdcp_entity_base.h @@ -60,6 +60,7 @@ public: virtual void reset() = 0; virtual void reestablish() = 0; + void set_enabled(bool enabled) { active = enabled; } bool is_active() { return active; } bool is_srb() { return cfg.rb_type == PDCP_RB_IS_SRB; } bool is_drb() { return cfg.rb_type == PDCP_RB_IS_DRB; } diff --git a/lib/src/pdcp/pdcp.cc b/lib/src/pdcp/pdcp.cc index 993e65c04..0e03df711 100644 --- a/lib/src/pdcp/pdcp.cc +++ b/lib/src/pdcp/pdcp.cc @@ -63,6 +63,15 @@ void pdcp::reset() pdcp_array.clear(); } +void pdcp::set_enabled(uint32_t lcid, bool enabled) +{ + if (valid_lcid(lcid)) { + pdcp_array.at(lcid)->set_enabled(enabled); + } else { + logger.warning("LCID %d doesn't exist while setting enabled", lcid); + } +} + /******************************************************************************* RRC/GW interface *******************************************************************************/ diff --git a/lib/src/pdcp/pdcp_entity_lte.cc b/lib/src/pdcp/pdcp_entity_lte.cc index d616fb0cb..d4be424e1 100644 --- a/lib/src/pdcp/pdcp_entity_lte.cc +++ b/lib/src/pdcp/pdcp_entity_lte.cc @@ -134,6 +134,11 @@ void pdcp_entity_lte::reset() // GW/RRC interface void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn) { + if (!active) { + logger.warning("Dropping %s SDU due to inactive bearer", rrc->get_rb_name(lcid)); + return; + } + if (rlc->sdu_queue_is_full(lcid)) { logger.info(sdu->msg, sdu->N_bytes, "Dropping %s SDU due to full queue", rrc->get_rb_name(lcid)); return; @@ -216,6 +221,11 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn) // RLC interface void pdcp_entity_lte::write_pdu(unique_byte_buffer_t pdu) { + if (!active) { + logger.warning("Dropping %s PDU due to inactive bearer", rrc->get_rb_name(lcid)); + return; + } + // Handle control PDUs if (is_drb() && is_control_pdu(pdu)) { logger.info("Handling PDCP control PDU"); diff --git a/srsenb/hdr/stack/upper/pdcp.h b/srsenb/hdr/stack/upper/pdcp.h index 4bc74f75d..aa43919ce 100644 --- a/srsenb/hdr/stack/upper/pdcp.h +++ b/srsenb/hdr/stack/upper/pdcp.h @@ -44,6 +44,7 @@ public: void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t sdu) {} // pdcp_interface_rrc + void set_enabled(uint16_t rnti, uint32_t lcid, bool enabled) override; void reset(uint16_t rnti) override; void add_user(uint16_t rnti) override; void rem_user(uint16_t rnti) override; diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index c6dfddd45..d0d35c6e7 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -700,7 +700,10 @@ void rrc::ue::rrc_mobility::s1_source_ho_st::handle_ho_cmd(wait_ho_cmd& s, const /* Enter Handover Execution */ // TODO: Do anything with MeasCfg info within the Msg (e.g. update ue_var_meas)? - // Disable DRBs in the MAC, while Reconfiguration is taking place. + // Disable DRBs in the MAC and PDCP, while Reconfiguration is taking place. + for (const drb_to_add_mod_s& drb : rrc_ue->bearer_list.get_established_drbs()) { + rrc_ue->parent->pdcp->set_enabled(rrc_ue->rnti, drb_to_lcid((lte_drb)drb.drb_id), false); + } rrc_ue->mac_ctrl.set_drb_activation(false); rrc_ue->mac_ctrl.update_mac(mac_controller::proc_stage_t::other); diff --git a/srsenb/src/stack/upper/pdcp.cc b/srsenb/src/stack/upper/pdcp.cc index 7bf37ba12..4b9c8baaf 100644 --- a/srsenb/src/stack/upper/pdcp.cc +++ b/srsenb/src/stack/upper/pdcp.cc @@ -86,6 +86,13 @@ void pdcp::del_bearer(uint16_t rnti, uint32_t lcid) } } +void pdcp::set_enabled(uint16_t rnti, uint32_t lcid, bool enabled) +{ + if (users.count(rnti)) { + users[rnti].pdcp->set_enabled(lcid, enabled); + } +} + void pdcp::reset(uint16_t rnti) { if (users.count(rnti)) { diff --git a/srsenb/test/common/dummy_classes_common.h b/srsenb/test/common/dummy_classes_common.h index f376f672b..966166fe8 100644 --- a/srsenb/test/common/dummy_classes_common.h +++ b/srsenb/test/common/dummy_classes_common.h @@ -39,6 +39,7 @@ public: class pdcp_dummy : public pdcp_interface_rrc, public pdcp_interface_gtpu { public: + void set_enabled(uint16_t rnti, uint32_t lcid, bool enabled) override {} void reset(uint16_t rnti) override {} void add_user(uint16_t rnti) override {} void rem_user(uint16_t rnti) override {} diff --git a/srsue/src/stack/rrc/test/ue_rrc_nr_test.cc b/srsue/src/stack/rrc/test/ue_rrc_nr_test.cc index 1f382e78c..c58dc050e 100644 --- a/srsue/src/stack/rrc/test/ue_rrc_nr_test.cc +++ b/srsue/src/stack/rrc/test/ue_rrc_nr_test.cc @@ -62,6 +62,7 @@ class dummy_rlc : public rlc_interface_rrc class dummy_pdcp : public pdcp_interface_rrc { + void set_enabled(uint32_t lcid, bool enabled) {}; void reestablish(){}; void reestablish(uint32_t lcid){}; void reset(){};