diff --git a/lib/include/srsran/interfaces/enb_pdcp_interfaces.h b/lib/include/srsran/interfaces/enb_pdcp_interfaces.h index 5b5a907c2..3e832f833 100644 --- a/lib/include/srsran/interfaces/enb_pdcp_interfaces.h +++ b/lib/include/srsran/interfaces/enb_pdcp_interfaces.h @@ -31,7 +31,7 @@ public: class pdcp_interface_rrc { public: - virtual void set_enabled(uint16_t rnti, uint32_t lcid, bool enable) = 0; + 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/enb_rlc_interfaces.h b/lib/include/srsran/interfaces/enb_rlc_interfaces.h index f2f3cddb2..ff0e6dec5 100644 --- a/lib/include/srsran/interfaces/enb_rlc_interfaces.h +++ b/lib/include/srsran/interfaces/enb_rlc_interfaces.h @@ -41,6 +41,7 @@ public: virtual void discard_sdu(uint16_t rnti, uint32_t lcid, uint32_t sn) = 0; virtual bool rb_is_um(uint16_t rnti, uint32_t lcid) = 0; virtual bool sdu_queue_is_full(uint16_t rnti, uint32_t lcid) = 0; + virtual bool is_suspended(uint16_t rnti, uint32_t lcid) = 0; }; // RLC interface for RRC @@ -56,6 +57,7 @@ public: virtual void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu) = 0; virtual bool has_bearer(uint16_t rnti, uint32_t lcid) = 0; virtual bool suspend_bearer(uint16_t rnti, uint32_t lcid) = 0; + virtual bool is_suspended(uint16_t rnti, uint32_t lcid) = 0; virtual bool resume_bearer(uint16_t rnti, uint32_t lcid) = 0; virtual void reestablish(uint16_t rnti) = 0; }; diff --git a/lib/include/srsran/interfaces/ue_rlc_interfaces.h b/lib/include/srsran/interfaces/ue_rlc_interfaces.h index bf937cd9c..5c32d1678 100644 --- a/lib/include/srsran/interfaces/ue_rlc_interfaces.h +++ b/lib/include/srsran/interfaces/ue_rlc_interfaces.h @@ -51,6 +51,8 @@ public: ///< Allow PDCP to query SDU queue status virtual bool sdu_queue_is_full(uint32_t lcid) = 0; + + virtual bool is_suspended(const uint32_t lcid) = 0; }; class rlc_interface_mac : public srsran::read_pdu_interface diff --git a/lib/src/pdcp/pdcp_entity_lte.cc b/lib/src/pdcp/pdcp_entity_lte.cc index 017b45123..af5663735 100644 --- a/lib/src/pdcp/pdcp_entity_lte.cc +++ b/lib/src/pdcp/pdcp_entity_lte.cc @@ -139,6 +139,11 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn) return; } + if (rlc->is_suspended(lcid)) { + logger.warning("Trying to send SDU while re-establishment is in progress. Dropping SDU. LCID=%d", 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; @@ -166,7 +171,6 @@ void pdcp_entity_lte::write_sdu(unique_byte_buffer_t sdu, int upper_sn) return; } } - // check for pending security config in transmit direction if (enable_security_tx_sn != -1 && enable_security_tx_sn == static_cast(tx_count)) { enable_integrity(DIRECTION_TX); diff --git a/lib/test/pdcp/pdcp_base_test.h b/lib/test/pdcp/pdcp_base_test.h index 19c1a86bb..2ad9ce1d3 100644 --- a/lib/test/pdcp/pdcp_base_test.h +++ b/lib/test/pdcp/pdcp_base_test.h @@ -55,6 +55,8 @@ public: logger.info("Discard_count=%" PRIu64 "", discard_count); } + bool is_suspended(uint32_t lcid) { return false; } + uint64_t rx_count = 0; uint64_t discard_count = 0; diff --git a/srsenb/hdr/stack/upper/pdcp.h b/srsenb/hdr/stack/upper/pdcp.h index aa43919ce..5a19f2ad9 100644 --- a/srsenb/hdr/stack/upper/pdcp.h +++ b/srsenb/hdr/stack/upper/pdcp.h @@ -77,6 +77,7 @@ private: void discard_sdu(uint32_t lcid, uint32_t discard_sn); bool rb_is_um(uint32_t lcid); bool sdu_queue_is_full(uint32_t lcid); + bool is_suspended(uint32_t lcid); }; class user_interface_gtpu : public srsue::gw_interface_pdcp diff --git a/srsenb/hdr/stack/upper/rlc.h b/srsenb/hdr/stack/upper/rlc.h index a635de684..55526b0aa 100644 --- a/srsenb/hdr/stack/upper/rlc.h +++ b/srsenb/hdr/stack/upper/rlc.h @@ -53,6 +53,7 @@ public: bool has_bearer(uint16_t rnti, uint32_t lcid); bool suspend_bearer(uint16_t rnti, uint32_t lcid); bool resume_bearer(uint16_t rnti, uint32_t lcid); + bool is_suspended(uint16_t rnti, uint32_t lcid); void reestablish(uint16_t rnti) final; // rlc_interface_pdcp diff --git a/srsenb/src/stack/upper/pdcp.cc b/srsenb/src/stack/upper/pdcp.cc index 4b9c8baaf..1f460f43e 100644 --- a/srsenb/src/stack/upper/pdcp.cc +++ b/srsenb/src/stack/upper/pdcp.cc @@ -217,6 +217,11 @@ bool pdcp::user_interface_rlc::rb_is_um(uint32_t lcid) return rlc->rb_is_um(rnti, lcid); } +bool pdcp::user_interface_rlc::is_suspended(uint32_t lcid) +{ + return rlc->is_suspended(rnti, lcid); +} + bool pdcp::user_interface_rlc::sdu_queue_is_full(uint32_t lcid) { return rlc->sdu_queue_is_full(rnti, lcid); diff --git a/srsenb/src/stack/upper/rlc.cc b/srsenb/src/stack/upper/rlc.cc index 25d3c1678..38ccd6a35 100644 --- a/srsenb/src/stack/upper/rlc.cc +++ b/srsenb/src/stack/upper/rlc.cc @@ -150,6 +150,17 @@ bool rlc::suspend_bearer(uint16_t rnti, uint32_t lcid) return result; } +bool rlc::is_suspended(uint16_t rnti, uint32_t lcid) +{ + pthread_rwlock_rdlock(&rwlock); + bool result = false; + if (users.count(rnti)) { + result = users[rnti].rlc->is_suspended(lcid); + } + pthread_rwlock_unlock(&rwlock); + return result; +} + bool rlc::resume_bearer(uint16_t rnti, uint32_t lcid) { pthread_rwlock_rdlock(&rwlock); diff --git a/srsenb/test/common/dummy_classes_common.h b/srsenb/test/common/dummy_classes_common.h index 966166fe8..54db6c90a 100644 --- a/srsenb/test/common/dummy_classes_common.h +++ b/srsenb/test/common/dummy_classes_common.h @@ -30,6 +30,7 @@ public: void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu) override { last_sdu = std::move(sdu); } bool has_bearer(uint16_t rnti, uint32_t lcid) override { return false; } bool suspend_bearer(uint16_t rnti, uint32_t lcid) override { return true; } + bool is_suspended(uint16_t rnti, uint32_t lcid) override { return false; } bool resume_bearer(uint16_t rnti, uint32_t lcid) override { return true; } void reestablish(uint16_t rnti) override {} diff --git a/srsue/src/test/ttcn3/hdr/ttcn3_syssim.h b/srsue/src/test/ttcn3/hdr/ttcn3_syssim.h index 667ae210d..6f673407e 100644 --- a/srsue/src/test/ttcn3/hdr/ttcn3_syssim.h +++ b/srsue/src/test/ttcn3/hdr/ttcn3_syssim.h @@ -170,6 +170,8 @@ public: bool sdu_queue_is_full(uint32_t lcid); + bool is_suspended(uint32_t lcid); + void set_as_security(const ttcn3_helpers::timing_info_t timing, const std::string cell_name, std::array k_rrc_enc_, diff --git a/srsue/src/test/ttcn3/src/ttcn3_syssim.cc b/srsue/src/test/ttcn3/src/ttcn3_syssim.cc index 6c689345e..f792617eb 100644 --- a/srsue/src/test/ttcn3/src/ttcn3_syssim.cc +++ b/srsue/src/test/ttcn3/src/ttcn3_syssim.cc @@ -1191,6 +1191,11 @@ bool ttcn3_syssim::sdu_queue_is_full(uint32_t lcid) return false; } +bool ttcn3_syssim::is_suspended(uint32_t lcid) +{ + return false; +} + void ttcn3_syssim::set_as_security(const ttcn3_helpers::timing_info_t timing, const std::string cell_name, std::array k_rrc_enc_,