Skip to content

Commit

Permalink
rlc: move rlc_buffer_state into own header file
Browse files Browse the repository at this point in the history
  • Loading branch information
robertfalkenberg authored and codebot committed Feb 10, 2025
1 parent abaf622 commit a52bbdf
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 31 deletions.
2 changes: 1 addition & 1 deletion include/srsran/mac/mac_sdu_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 2 additions & 0 deletions include/srsran/mac/mac_ue_control_information_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include "srsran/ran/du_types.h"
#include "srsran/ran/logical_channel/lcid.h"
#include <chrono>
#include <optional>

namespace srsran {

Expand Down
48 changes: 48 additions & 0 deletions include/srsran/rlc/rlc_buffer_state.h
Original file line number Diff line number Diff line change
@@ -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 <chrono>
#include <optional>

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<std::chrono::system_clock::time_point> hol_toa;
};
} // namespace srsran

namespace fmt {

// associated formatter
template <>
struct formatter<srsran::rlc_buffer_state> {
template <typename ParseContext>
auto parse(ParseContext& ctx)
{
return ctx.begin();
}

template <typename FormatContext>
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
31 changes: 1 addition & 30 deletions include/srsran/rlc/rlc_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#pragma once

#include "srsran/adt/byte_buffer.h"
#include "fmt/format.h"
#include "srsran/rlc/rlc_buffer_state.h"
#include <optional>

/*
Expand Down Expand Up @@ -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<std::chrono::system_clock::time_point> 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
Expand Down Expand Up @@ -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<srsran::rlc_buffer_state> {
template <typename ParseContext>
auto parse(ParseContext& ctx)
{
return ctx.begin();
}

template <typename FormatContext>
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

0 comments on commit a52bbdf

Please sign in to comment.