From 4093e75237c2546632860a256eefc6fdc4211d76 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 11 Jun 2020 12:43:11 +0100 Subject: [PATCH] Starting to add getters and setters of the state in PDCP lte entity. --- lib/include/srslte/upper/pdcp_entity_lte.h | 13 ++++++-- lib/src/upper/pdcp_entity_lte.cc | 36 ++++++++++++++-------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/lib/include/srslte/upper/pdcp_entity_lte.h b/lib/include/srslte/upper/pdcp_entity_lte.h index 77065df57..d867664ff 100644 --- a/lib/include/srslte/upper/pdcp_entity_lte.h +++ b/lib/include/srslte/upper/pdcp_entity_lte.h @@ -39,6 +39,13 @@ namespace srslte { #define PDCP_CONTROL_MAC_I 0x00000000 +struct pdcp_lte_state_t { + uint32_t tx_count; + uint32_t rx_hfn; + uint32_t next_pdcp_rx_sn; + uint32_t last_submitted_pdcp_rx_sn; +}; + /**************************************************************************** * LTE PDCP Entity * Class for LTE PDCP entities @@ -57,8 +64,10 @@ public: void reestablish(); // GW/RRC interface - void write_sdu(unique_byte_buffer_t sdu, bool blocking); - void get_bearer_status(uint16_t* dlsn, uint16_t* dlhfn, uint16_t* ulsn, uint16_t* ulhfn); + void write_sdu(unique_byte_buffer_t sdu, bool blocking); + void get_bearer_status(uint16_t* dlsn, uint16_t* dlhfn, uint16_t* ulsn, uint16_t* ulhfn); + pdcp_lte_state_t get_state(); + void set_state(const pdcp_lte_state_t& state); // RLC interface void write_pdu(unique_byte_buffer_t pdu); diff --git a/lib/src/upper/pdcp_entity_lte.cc b/lib/src/upper/pdcp_entity_lte.cc index 9e77db242..6fbc65c80 100644 --- a/lib/src/upper/pdcp_entity_lte.cc +++ b/lib/src/upper/pdcp_entity_lte.cc @@ -29,12 +29,8 @@ pdcp_entity_lte::pdcp_entity_lte(srsue::rlc_interface_pdcp* rlc_, srsue::gw_interface_pdcp* gw_, srslte::task_handler_interface* task_executor_, srslte::log_ref log_) : - pdcp_entity_base(task_executor_, log_), - rlc(rlc_), - rrc(rrc_), - gw(gw_) -{ -} + pdcp_entity_base(task_executor_, log_), rlc(rlc_), rrc(rrc_), gw(gw_) +{} pdcp_entity_lte::~pdcp_entity_lte() { @@ -79,15 +75,15 @@ void pdcp_entity_lte::reestablish() log->info("Re-establish %s with bearer ID: %d\n", rrc->get_rb_name(lcid).c_str(), cfg.bearer_id); // For SRBs if (is_srb()) { - tx_count = 0; - rx_hfn = 0; - next_pdcp_rx_sn = 0; + tx_count = 0; + rx_hfn = 0; + next_pdcp_rx_sn = 0; } else { // Only reset counter in RLC-UM if (rlc->rb_is_um(lcid)) { - tx_count = 0; - rx_hfn = 0; - next_pdcp_rx_sn = 0; + tx_count = 0; + rx_hfn = 0; + next_pdcp_rx_sn = 0; } } } @@ -370,4 +366,20 @@ bool pdcp_entity_lte::check_valid_config() return true; } +/**************************************************************************** + * Internal state getters/setters + ***************************************************************************/ +pdcp_lte_state_t pdcp_entity_lte::get_state() +{ + return pdcp_lte_state_t{tx_count, rx_hfn, next_pdcp_rx_sn, last_submitted_pdcp_rx_sn}; +} + +void pdcp_entity_lte::set_state(const pdcp_lte_state_t& state) +{ + tx_count = state.tx_count; + rx_hfn = state.rx_hfn; + next_pdcp_rx_sn = state.next_pdcp_rx_sn; + last_submitted_pdcp_rx_sn = state.last_submitted_pdcp_rx_sn; +} + } // namespace srslte