From f56592b0fe5f50b7b42fa9b874f236bad35186fe Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 8 Aug 2018 16:03:17 +0200 Subject: [PATCH] add getter for PDCP ul/dl counter --- lib/include/srslte/interfaces/ue_interfaces.h | 2 ++ lib/include/srslte/upper/pdcp.h | 2 ++ lib/include/srslte/upper/pdcp_entity.h | 2 ++ lib/include/srslte/upper/pdcp_interface.h | 2 ++ lib/src/upper/pdcp.cc | 23 +++++++++++++++++++ lib/src/upper/pdcp_entity.cc | 11 +++++++++ 6 files changed, 42 insertions(+) diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 0caa68d94..959635afc 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -251,6 +251,8 @@ public: srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) = 0; virtual void enable_integrity(uint32_t lcid) = 0; virtual void enable_encryption(uint32_t lcid) = 0; + virtual uint32_t get_dl_count(uint32_t lcid) = 0; + virtual uint32_t get_ul_count(uint32_t lcid) = 0; }; // PDCP interface for RLC diff --git a/lib/include/srslte/upper/pdcp.h b/lib/include/srslte/upper/pdcp.h index f1e02400a..e4be9d548 100644 --- a/lib/include/srslte/upper/pdcp.h +++ b/lib/include/srslte/upper/pdcp.h @@ -72,6 +72,8 @@ public: INTEGRITY_ALGORITHM_ID_ENUM integ_algo); void enable_integrity(uint32_t lcid); void enable_encryption(uint32_t lcid); + uint32_t get_dl_count(uint32_t lcid); + uint32_t get_ul_count(uint32_t lcid); // RLC interface void write_pdu(uint32_t lcid, byte_buffer_t *sdu); diff --git a/lib/include/srslte/upper/pdcp_entity.h b/lib/include/srslte/upper/pdcp_entity.h index fd69c92e9..aea49462c 100644 --- a/lib/include/srslte/upper/pdcp_entity.h +++ b/lib/include/srslte/upper/pdcp_entity.h @@ -83,6 +83,8 @@ public: INTEGRITY_ALGORITHM_ID_ENUM integ_algo_); void enable_integrity(); void enable_encryption(); + uint32_t get_dl_count(); + uint32_t get_ul_count(); // RLC interface void write_pdu(byte_buffer_t *pdu); diff --git a/lib/include/srslte/upper/pdcp_interface.h b/lib/include/srslte/upper/pdcp_interface.h index 0c2cb2428..9c4df085e 100644 --- a/lib/include/srslte/upper/pdcp_interface.h +++ b/lib/include/srslte/upper/pdcp_interface.h @@ -62,6 +62,8 @@ public: INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) = 0; virtual void enable_integrity() = 0; virtual void enable_encryption() = 0; + virtual uint32_t get_dl_count() = 0; + virtual uint32_t get_ul_count() = 0; // RLC interface virtual void write_pdu(byte_buffer_t *pdu) = 0; diff --git a/lib/src/upper/pdcp.cc b/lib/src/upper/pdcp.cc index a73b44283..c8391518b 100644 --- a/lib/src/upper/pdcp.cc +++ b/lib/src/upper/pdcp.cc @@ -231,6 +231,29 @@ void pdcp::enable_encryption(uint32_t lcid) pthread_rwlock_unlock(&rwlock); } +uint32_t pdcp::get_dl_count(uint32_t lcid) +{ + int ret = 0; + pthread_rwlock_rdlock(&rwlock); + if (valid_lcid(lcid)) { + ret = pdcp_array.at(lcid)->get_dl_count(); + } + pthread_rwlock_unlock(&rwlock); + return ret; +} + +uint32_t pdcp::get_ul_count(uint32_t lcid) +{ + int ret = 0; + pthread_rwlock_rdlock(&rwlock); + if (valid_lcid(lcid)) { + ret = pdcp_array.at(lcid)->get_ul_count(); + } + pthread_rwlock_unlock(&rwlock); + return ret; +} + + /******************************************************************************* RLC interface *******************************************************************************/ diff --git a/lib/src/upper/pdcp_entity.cc b/lib/src/upper/pdcp_entity.cc index 412937069..65bb07fae 100644 --- a/lib/src/upper/pdcp_entity.cc +++ b/lib/src/upper/pdcp_entity.cc @@ -408,6 +408,17 @@ uint8_t pdcp_entity::get_bearer_id(uint8_t lcid) } +uint32_t pdcp_entity::get_dl_count() +{ + return rx_count; +} + + +uint32_t pdcp_entity::get_ul_count() +{ + return tx_count; +} + /**************************************************************************** * Pack/Unpack helper functions * Ref: 3GPP TS 36.323 v10.1.0