From 80e23624f82fe81c316258027b0d91405a4c7d22 Mon Sep 17 00:00:00 2001 From: Robert Falkenberg Date: Sat, 12 Mar 2022 06:21:43 +0100 Subject: [PATCH] lib,rlc_am_nr: extract function am_window_size() --- .../srsran/interfaces/rlc_interface_types.h | 8 ++++++++ lib/include/srsran/rlc/rlc_am_nr.h | 12 +++--------- lib/src/rlc/rlc_am_nr.cc | 16 ++++++++-------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/include/srsran/interfaces/rlc_interface_types.h b/lib/include/srsran/interfaces/rlc_interface_types.h index 5d574826f..903dc3f81 100644 --- a/lib/include/srsran/interfaces/rlc_interface_types.h +++ b/lib/include/srsran/interfaces/rlc_interface_types.h @@ -78,6 +78,14 @@ constexpr uint32_t cardinality(const rlc_am_nr_sn_size_t& sn_size) { return (1 << to_number(sn_size)); } +/**************************************************************************** + * Tx constants + * Ref: 3GPP TS 38.322 version 16.2.0 Section 7.2 + ***************************************************************************/ +constexpr uint32_t am_window_size(const rlc_am_nr_sn_size_t& sn_size) +{ + return cardinality(sn_size) / 2; +} struct rlc_am_config_t { /**************************************************************************** diff --git a/lib/include/srsran/rlc/rlc_am_nr.h b/lib/include/srsran/rlc/rlc_am_nr.h index 07cf6c123..a5312a89d 100644 --- a/lib/include/srsran/rlc/rlc_am_nr.h +++ b/lib/include/srsran/rlc/rlc_am_nr.h @@ -147,14 +147,10 @@ private: * Ref: 3GPP TS 38.322 version 16.2.0 Section 7.1 ***************************************************************************/ struct rlc_am_nr_tx_state_t st = {}; - std::unique_ptr > tx_window = - std::unique_ptr >( - new rlc_ringbuffer_t); + std::unique_ptr > tx_window; // Queues and buffers - std::unique_ptr > retx_queue = - std::unique_ptr >( - new pdu_retx_queue); + std::unique_ptr > retx_queue; uint32_t sdu_under_segmentation_sn = INVALID_RLC_SN; // SN of the SDU currently being segmented. pdcp_sn_vector_t notify_info_vec; @@ -254,9 +250,7 @@ private: uint32_t rx_mod_base_nr(uint32_t sn) const; // RX Window - std::unique_ptr > rx_window = - std::unique_ptr >( - new rlc_ringbuffer_t); + std::unique_ptr > rx_window; // Mutexes std::mutex mutex; diff --git a/lib/src/rlc/rlc_am_nr.cc b/lib/src/rlc/rlc_am_nr.cc index 331842123..c183bf5ca 100644 --- a/lib/src/rlc/rlc_am_nr.cc +++ b/lib/src/rlc/rlc_am_nr.cc @@ -51,16 +51,16 @@ bool rlc_am_nr_tx::configure(const rlc_config_t& cfg_) case rlc_am_nr_sn_size_t::size12bits: min_hdr_size = 2; tx_window = std::unique_ptr >( - new rlc_ringbuffer_t); + new rlc_ringbuffer_t); retx_queue = std::unique_ptr >( - new pdu_retx_queue); + new pdu_retx_queue); break; case rlc_am_nr_sn_size_t::size18bits: min_hdr_size = 3; tx_window = std::unique_ptr >( - new rlc_ringbuffer_t); + new rlc_ringbuffer_t); retx_queue = std::unique_ptr >( - new pdu_retx_queue); + new pdu_retx_queue); break; default: RlcError("attempt to configure unsupported tx_sn_field_length %s", to_string(cfg.tx_sn_field_length)); @@ -943,7 +943,7 @@ uint32_t rlc_am_nr_tx::tx_mod_base_nr(uint32_t sn) const uint32_t rlc_am_nr_tx::tx_window_size() const { - return cardinality(cfg.tx_sn_field_length) / 2; + return am_window_size(cfg.tx_sn_field_length); } bool rlc_am_nr_tx::inside_tx_window(uint32_t sn) const @@ -995,11 +995,11 @@ bool rlc_am_nr_rx::configure(const rlc_config_t& cfg_) switch (cfg.rx_sn_field_length) { case rlc_am_nr_sn_size_t::size12bits: rx_window = std::unique_ptr >( - new rlc_ringbuffer_t); + new rlc_ringbuffer_t); break; case rlc_am_nr_sn_size_t::size18bits: rx_window = std::unique_ptr >( - new rlc_ringbuffer_t); + new rlc_ringbuffer_t); break; default: RlcError("attempt to configure unsupported rx_sn_field_length %s", to_string(cfg.rx_sn_field_length)); @@ -1383,7 +1383,7 @@ uint32_t rlc_am_nr_rx::rx_mod_base_nr(uint32_t sn) const uint32_t rlc_am_nr_rx::rx_window_size() const { - return cardinality(cfg.rx_sn_field_length) / 2; + return am_window_size(cfg.rx_sn_field_length); } bool rlc_am_nr_rx::inside_rx_window(uint32_t sn)