diff --git a/lib/include/srslte/interfaces/enb_interfaces.h b/lib/include/srslte/interfaces/enb_interfaces.h index 067144cf3..c8ee85021 100644 --- a/lib/include/srslte/interfaces/enb_interfaces.h +++ b/lib/include/srslte/interfaces/enb_interfaces.h @@ -386,7 +386,8 @@ public: virtual void enable_encryption(uint16_t rnti, uint32_t lcid) = 0; virtual bool get_bearer_status(uint16_t rnti, uint32_t lcid, uint16_t* dlsn, uint16_t* dlhfn, uint16_t* ulsn, uint16_t* ulhfn) = 0; - virtual bool get_state(uint16_t rnti, uint32_t lcid, srslte::pdcp_lte_state_t* state) = 0; + virtual bool get_state(uint16_t rnti, uint32_t lcid, srslte::pdcp_lte_state_t* state) = 0; + virtual bool set_state(uint16_t rnti, uint32_t lcid, const srslte::pdcp_lte_state_t& state) = 0; }; // PDCP interface for RLC diff --git a/lib/include/srslte/upper/pdcp.h b/lib/include/srslte/upper/pdcp.h index ad0505584..3cfd19715 100644 --- a/lib/include/srslte/upper/pdcp.h +++ b/lib/include/srslte/upper/pdcp.h @@ -57,6 +57,7 @@ public: void enable_security_timed(uint32_t lcid, srslte_direction_t direction, uint32_t sn); bool get_bearer_status(uint32_t lcid, uint16_t* dlsn, uint16_t* dlhfn, uint16_t* ulsn, uint16_t* ulhfn); bool get_state(uint32_t lcid, srslte::pdcp_lte_state_t* state); + bool set_state(uint32_t lcid, const srslte::pdcp_lte_state_t& state); // RLC interface void write_pdu(uint32_t lcid, unique_byte_buffer_t sdu); diff --git a/lib/src/upper/pdcp.cc b/lib/src/upper/pdcp.cc index 99da4f4dd..22a85e334 100644 --- a/lib/src/upper/pdcp.cc +++ b/lib/src/upper/pdcp.cc @@ -237,6 +237,15 @@ bool pdcp::get_state(uint32_t lcid, srslte::pdcp_lte_state_t* state) return true; } +bool pdcp::set_state(uint32_t lcid, const srslte::pdcp_lte_state_t& state) +{ + if (not valid_lcid(lcid)) { + return false; + } + pdcp_array[lcid]->set_state(state); + return true; +} + /******************************************************************************* RLC interface *******************************************************************************/ diff --git a/srsenb/hdr/stack/upper/pdcp.h b/srsenb/hdr/stack/upper/pdcp.h index 62aec899a..f9e43e0fb 100644 --- a/srsenb/hdr/stack/upper/pdcp.h +++ b/srsenb/hdr/stack/upper/pdcp.h @@ -55,6 +55,7 @@ public: bool get_bearer_status(uint16_t rnti, uint32_t lcid, uint16_t* dlsn, uint16_t* dlhfn, uint16_t* ulsn, uint16_t* ulhfn) override; bool get_state(uint16_t rnti, uint32_t lcid, srslte::pdcp_lte_state_t* state); + bool set_state(uint16_t rnti, uint32_t lcid, const srslte::pdcp_lte_state_t& state); private: class user_interface_rlc : public srsue::rlc_interface_pdcp diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index 498a09601..8409547b6 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -558,7 +558,7 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu) // If reconf due to reestablishment, recover PDCP state if (state == RRC_STATE_REESTABLISHMENT_COMPLETE) { - // parent->pdcp->set_state(rnti, 3, old_reest_pdcp_state); + parent->pdcp->set_state(rnti, 3, old_reest_pdcp_state); } // Reuse same PDU diff --git a/srsenb/src/stack/upper/pdcp.cc b/srsenb/src/stack/upper/pdcp.cc index 9a45ffbe6..e7013ecad 100644 --- a/srsenb/src/stack/upper/pdcp.cc +++ b/srsenb/src/stack/upper/pdcp.cc @@ -138,6 +138,14 @@ bool pdcp::get_state(uint16_t rnti, uint32_t lcid, srslte::pdcp_lte_state_t* sta return users[rnti].pdcp->get_state(lcid, state); } +bool pdcp::set_state(uint16_t rnti, uint32_t lcid, const srslte::pdcp_lte_state_t& state) +{ + if (users.count(rnti) == 0) { + return false; + } + return users[rnti].pdcp->set_state(lcid, state); +} + void pdcp::write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) { if (users.count(rnti)) { diff --git a/srsenb/test/common/dummy_classes.h b/srsenb/test/common/dummy_classes.h index d2272bf95..f6e00bf11 100644 --- a/srsenb/test/common/dummy_classes.h +++ b/srsenb/test/common/dummy_classes.h @@ -78,6 +78,7 @@ public: return true; } bool get_state(uint16_t rnti, uint32_t lcid, srslte::pdcp_lte_state_t* state) { return true; } + bool set_state(uint16_t rnti, uint32_t lcid, const srslte::pdcp_lte_state_t& state) { return true; } }; class s1ap_dummy : public s1ap_interface_rrc