From a52bbdf1365c7a5770bce6d0dbb10fcf79795abc Mon Sep 17 00:00:00 2001 From: Robert Falkenberg Date: Thu, 6 Feb 2025 15:31:44 +0100 Subject: [PATCH] rlc: move rlc_buffer_state into own header file --- include/srsran/mac/mac_sdu_handler.h | 2 +- .../mac/mac_ue_control_information_handler.h | 2 + include/srsran/rlc/rlc_buffer_state.h | 48 +++++++++++++++++++ include/srsran/rlc/rlc_tx.h | 31 +----------- 4 files changed, 52 insertions(+), 31 deletions(-) create mode 100644 include/srsran/rlc/rlc_buffer_state.h diff --git a/include/srsran/mac/mac_sdu_handler.h b/include/srsran/mac/mac_sdu_handler.h index 8a4fe5719f..6c90f9f8e7 100644 --- a/include/srsran/mac/mac_sdu_handler.h +++ b/include/srsran/mac/mac_sdu_handler.h @@ -3,7 +3,7 @@ #include "srsran/adt/byte_buffer.h" #include "srsran/adt/byte_buffer_chain.h" -#include "srsran/rlc/rlc_tx.h" +#include "srsran/rlc/rlc_buffer_state.h" namespace srsran { diff --git a/include/srsran/mac/mac_ue_control_information_handler.h b/include/srsran/mac/mac_ue_control_information_handler.h index 9e7b3e3bbd..0610b16917 100644 --- a/include/srsran/mac/mac_ue_control_information_handler.h +++ b/include/srsran/mac/mac_ue_control_information_handler.h @@ -12,6 +12,8 @@ #include "srsran/ran/du_types.h" #include "srsran/ran/logical_channel/lcid.h" +#include +#include namespace srsran { diff --git a/include/srsran/rlc/rlc_buffer_state.h b/include/srsran/rlc/rlc_buffer_state.h new file mode 100644 index 0000000000..c028a8ace8 --- /dev/null +++ b/include/srsran/rlc/rlc_buffer_state.h @@ -0,0 +1,48 @@ +/* + * + * Copyright 2021-2025 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#pragma once + +#include "fmt/format.h" +#include +#include + +namespace srsran { + +/// Structure used to represent RLC buffer state. +/// The buffer state is transmitted towards lower layers (i.e. the MAC and the scheduler). +/// It includes the amount of data pending for transmission (queued SDUs, headers, and for RLC AM, ReTx and status PDUs) +/// and the time of arrival of the oldest PDU among those queues. +struct rlc_buffer_state { + /// Amount of bytes pending for transmission. + unsigned pending_bytes = 0; + /// Head of line (HOL) time of arrival (TOA) holds the TOA of the oldest SDU or ReTx that is queued for transmission. + std::optional hol_toa; +}; +} // namespace srsran + +namespace fmt { + +// associated formatter +template <> +struct formatter { + template + auto parse(ParseContext& ctx) + { + return ctx.begin(); + } + + template + auto format(const srsran::rlc_buffer_state& bs, FormatContext& ctx) const + { + return format_to(ctx.out(), "pending_bytes={} hol_toa={}", bs.pending_bytes, bs.hol_toa); + } +}; +} // namespace fmt diff --git a/include/srsran/rlc/rlc_tx.h b/include/srsran/rlc/rlc_tx.h index e5ae5760ab..9bab1b0665 100644 --- a/include/srsran/rlc/rlc_tx.h +++ b/include/srsran/rlc/rlc_tx.h @@ -11,7 +11,7 @@ #pragma once #include "srsran/adt/byte_buffer.h" -#include "fmt/format.h" +#include "srsran/rlc/rlc_buffer_state.h" #include /* @@ -133,16 +133,6 @@ class rlc_tx_upper_layer_control_notifier /*************************************** * Interfaces/notifiers for lower layers ***************************************/ -/// Structure used to represent RLC buffer state. -/// The buffer state is transmitted towards lower layers (i.e. the MAC and the scheduler). -/// It includes the amount of data pending for transmission (queued SDUs, headers, and for RLC AM, ReTx and status PDUs) -/// and the time of arrival of the oldest PDU among those queues. -struct rlc_buffer_state { - /// Amount of bytes pending for transmission. - unsigned pending_bytes = 0; - /// Head of line (HOL) time of arrival (TOA) holds the TOA of the oldest SDU or ReTx that is queued for transmission. - std::optional hol_toa; -}; /// This interface represents the data exit point of the transmitting side of a RLC entity. /// The lower layers will use this interface to pull a PDU from the RLC, or to @@ -188,22 +178,3 @@ class rlc_tx_lower_layer_notifier virtual void on_buffer_state_update(const rlc_buffer_state& bsr) = 0; }; } // namespace srsran - -namespace fmt { - -// associated formatter -template <> -struct formatter { - template - auto parse(ParseContext& ctx) - { - return ctx.begin(); - } - - template - auto format(const srsran::rlc_buffer_state& bs, FormatContext& ctx) const - { - return format_to(ctx.out(), "pending_bytes={} hol_toa={}", bs.pending_bytes, bs.hol_toa); - } -}; -} // namespace fmt